agsh / onvif

ONVIF node.js implementation
http://agsh.github.io/onvif/
MIT License
692 stars 234 forks source link

Return camera name, hardware, and urn during discovery #188

Closed aziztitu closed 3 years ago

aziztitu commented 3 years ago

Currently there doesn't seem to be any way to get the camera's device info during the discovery.

Is this planned to be supported in the future?

RogerHardiman commented 3 years ago

example4.js gives an example of receiving the discovery messages and the information you need is in the 'xml' parameter (the raw XML received). So you probably want to parse the XML to extract more detail. If you wanted to add this to the library so it returns the extra detail in the rinfo value, a PR would be great.

If you want more detail like serial numbers, you need to connect and authenticate with the camera and get the Device Information. Example2.js shows examples of connecting and getting DeviceInformation.

Finally, as an example of parsing the XML from Discovery, take a look at the onvif-audit project here on github. https://github.com/RogerHardiman/onvif-audit

It already has a parser that processes the Discovery XML in onvif-audit.js around line 110. and will display the urn/uuid, the Make and the Model. That's all you get from Discovery using data fields called 'scopes'. In theory you can set the location scope but I've never seen it used. 2 devices on my LAN return the MAC address in the scope, but not all of them so I don't bother looking for it in onvif-audit

RogerHardiman commented 3 years ago

So, if you want to pull some bits from onvif-audit and put them into this onvif library, then a Pull Request would be welcome.

RogerHardiman commented 3 years ago

I've copied some sample code from onvif-audit over into example4 to show how to display the device make/model/hardware from the Discovery results.