You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

598 lines
38 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __PONVIF_CLASS_HEADER__
  2. #define __PONVIF_CLASS_HEADER__
  3. // Based on PHP Onvif library
  4. #include <curl/curl.h>
  5. #include <openssl/sha.h>
  6. #include <vector>
  7. #ifdef __linux__
  8. #include <arpa/inet.h>
  9. #include <netdb.h>
  10. #include <netinet/in.h>
  11. #include <pthread.h>
  12. #include <sys/socket.h>
  13. #include <unistd.h>
  14. #endif
  15. #include "../../alg/generic/base64.h"
  16. #include "../../components/base/basicLogCollection.h"
  17. #include "../../components/base/basicTypes.h"
  18. #include "../curl/curlRequestsManager.h"
  19. #include "../protocol/xmlParser.h"
  20. #define CURL_MANAGER
  21. // #define DEBUG_ONVIF_PRINTOUT_MESSAGES
  22. // #define DEBUG_ONVIF_TRAFFIC
  23. #define PONVIF_DEFAULT_DISCOVERYBINDIP (CSTR) "0.0.0.0"
  24. #define PONVIF_DEFAULT_DISCOVERYMCASTIP (CSTR) "239.255.255.250"
  25. #define PONVIF_DEFAULT_DISCOVERYMCASTPORT 3702
  26. #define PONVIF_DEFAULT_DISCOVERYTIMEOUT 12
  27. #define PONVIF_PACK_DISCOVERY \
  28. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:w=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" xmlns:d=\"http://schemas.xmlsoap.org/ws/2005/04/discovery\" xmlns:dn=\"http://www.onvif.org/ver10/network/wsdl\"><s:Header><w:MessageID>uuid:84ede3de-7dec-11d0-c360-f01234567890</w:MessageID><w:To e:mustUnderstand=\"true\">urn:schemas-xmlsoap-org:ws:2005:04:discovery</w:To><w:Action a:mustUnderstand=\"true\">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</w:Action></s:Header><s:Body><d:Probe><d:Types>dn:NetworkVideoTransmitter</d:Types></d:Probe></s:Body></s:Envelope>"
  29. #define PONVIF_PACK_GET_SYS_DTS \
  30. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetSystemDateAndTime xmlns=\"http://www.onvif.org/ver10/device/wsdl\"/></s:Body></s:Envelope>"
  31. #define PONVIF_PACK_GET_CAPABILITIES \
  32. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetCapabilities xmlns=\"http://www.onvif.org/ver10/device/wsdl\"><Category>All</Category></GetCapabilities></s:Body></s:Envelope>"
  33. #define PONVIF_PACK_GET_VIDEO_SOURCES \
  34. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetVideoSources xmlns=\"http://www.onvif.org/ver10/media/wsdl\"/></s:Body></s:Envelope>"
  35. #define PONVIF_PACK_GET_PROFILES \
  36. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetProfiles xmlns=\"http://www.onvif.org/ver10/media/wsdl\"/></s:Body></s:Envelope>"
  37. #define PONVIF_PACK_GET_SERVICES \
  38. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetServices xmlns=\"http://www.onvif.org/ver10/device/wsdl\"><IncludeCapability>false</IncludeCapability></GetServices></s:Body></s:Envelope>"
  39. #define PONVIF_PACK_GET_DEV_INFO \
  40. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetDeviceInformation xmlns=\"http://www.onvif.org/ver10/device/wsdl\"/></s:Body></s:Envelope>"
  41. #define PONVIF_PACK_GET_STREAM_URI \
  42. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetStreamUri xmlns=\"http://www.onvif.org/ver10/media/wsdl\"><StreamSetup><Stream xmlns=\"http://www.onvif.org/ver10/schema\">%s</Stream><Transport xmlns=\"http://www.onvif.org/ver10/schema\"><Protocol>%s</Protocol></Transport></StreamSetup><ProfileToken>%s</ProfileToken></GetStreamUri></s:Body></s:Envelope>"
  43. #define PONVIF_PACK_GET_PICTURE_URI \
  44. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetSnapshotUri xmlns=\"http://www.onvif.org/ver10/media/wsdl\"><ProfileToken>%s</ProfileToken></GetSnapshotUri></s:Body></s:Envelope>"
  45. #define PONVIF_PACK_GET_PRESETS \
  46. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetPresets xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken></GetPresets></s:Body></s:Envelope>"
  47. #define PONVIF_PACK_GET_PTZ_NODE \
  48. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetNode xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><NodeToken>%s</NodeToken></GetNode></s:Body></s:Envelope>"
  49. #define PONVIF_PACK_GET_PTZ_STATUS \
  50. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetStatus xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken></GetStatus></s:Body></s:Envelope>"
  51. #define PONVIF_PACK_GOTO_PRESET \
  52. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GotoPreset xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><PresetToken>%s</PresetToken><Speed><PanTilt x=\"%0.3f\" y=\"%0.3f\" xmlns=\"http://www.onvif.org/ver10/schema\"/><Zoom x=\"%0.3f\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Speed></GotoPreset></s:Body></s:Envelope>"
  53. #define PONVIF_PACK_REMOVE_PRESET \
  54. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><RemovePreset xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><PresetToken>%s</PresetToken></RemovePreset></s:Body></s:Envelope>"
  55. #define PONVIF_PACK_SET_PRESET \
  56. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><SetPreset xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><PresetName>%s</PresetName></SetPreset></s:Body></s:Envelope>"
  57. #define PONVIF_PACK_RELATIVE_MOVE \
  58. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><RelativeMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Translation><PanTilt x=\"%0.2f\" y=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Translation><Speed><PanTilt x=\"%0.2f\" y=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Speed></RelativeMove></s:Body></s:Envelope>"
  59. #define PONVIF_PACK_RELATIVE_ZOOM \
  60. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><RelativeMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Translation><Zoom x=\"%0.2f\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Translation><Speed><Zoom x=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Speed></RelativeMove></s:Body></s:Envelope>"
  61. #define PONVIF_PACK_ABSOLUTE_MOVE \
  62. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><AbsoluteMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Position><PanTilt x=\"%0.6f\" y=\"%0.6f\" xmlns=\"http://www.onvif.org/ver10/schema\"/><Zoom x=\"%0.6f\" space=\"http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Position><Speed><PanTilt x=\"1\" y=\"1\" xmlns=\"http://www.onvif.org/ver10/schema\"/><Zoom x=\"1\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Speed></AbsoluteMove></s:Body></s:Envelope>"
  63. #define PONVIF_PACK_CONTINUOUS_MOVE \
  64. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ContinuousMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Velocity><PanTilt x=\"%0.2f\" y=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Velocity></ContinuousMove></s:Body></s:Envelope>"
  65. // #define PONVIF_PACK_CONTINUOUS_MOVE_A (CSTR)"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:tptz=\"http://www.onvif.org/ver20/ptz/wsdl\"
  66. // xmlns:tt=\"http://www.onvif.org/ver10/schema\"><soap:Body><tptz:ContinuousMove><tptz:ProfileToken>Profile_1</tptz:ProfileToken><tptz:Velocity><tt:PanTilt x=\"1\" y=\"1\"/><tt:Zoom
  67. // x=\"1\"/></tptz:Velocity></tptz:ContinuousMove></soap:Body></soap:Envelope>"
  68. #define PONVIF_PACK_CONTINUOUS_ZOOM \
  69. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ContinuousMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Velocity><Zoom x=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Velocity></ContinuousMove></s:Body></s:Envelope>"
  70. #define PONVIF_PACK_PTZ_STOP \
  71. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><Stop xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><PanTilt>true</PanTilt><Zoom>true</Zoom></Stop></s:Body></s:Envelope>"
  72. #define PONVIF_ENVELOPE_EXT \
  73. (CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><e:Envelope xmlns:e=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:w=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" xmlns:d=\"http://schemas.xmlsoap.org/ws/2005/04/discovery\" xmlns:dn=\"http://www.onvif.org/ver10/network/wsdl\">%s%s</e:Envelope>"
  74. #define PONVIF_ENVELOPE_SIM (CSTR) "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">%s%s</s:Envelope>"
  75. #define PONVIF_BODY (CSTR) "<s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">%s</s:Body>"
  76. #define PONVIF_HEADER_PROBE \
  77. (CSTR)"<e:Header><w:MessageID>uuid:84ede3de-7dec-11d0-c360-f01234567890</w:MessageID><w:To e:mustUnderstand=\"true\">urn:schemas-xmlsoap-org:ws:2005:04:discovery</w:To><w:Action a:mustUnderstand=\"true\">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</w:Action></e:Header>"
  78. #define PONVIF_HEADER_SECUR \
  79. (CSTR)"<s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header>"
  80. #define PONVIF_PCK_GET_CAPABILITIES (CSTR) "<GetCapabilities xmlns=\"http://www.onvif.org/ver10/device/wsdl\"><Category>All</Category></GetCapabilities>"
  81. typedef struct S_videoSourceProfile
  82. {
  83. char sourcetoken[CTEXT];
  84. char profiletoken[CTEXT];
  85. char profilename[CTEXT];
  86. char encoding[16];
  87. int width;
  88. int height;
  89. int fps;
  90. int bitrate;
  91. } videoSourceProfile;
  92. typedef struct S_onvifVideoResolution
  93. {
  94. int Width;
  95. int Height;
  96. } onvifVideoResolution;
  97. typedef struct S_onvifBacklightCompensation
  98. {
  99. bool Mode;
  100. float Level;
  101. } onvifBacklightCompensation;
  102. typedef enum E_onvifExposurePriority
  103. {
  104. LowNoise = 0,
  105. FrameRate
  106. } onvifExposurePriority;
  107. typedef struct S_onvifRectangle
  108. {
  109. int x;
  110. int y;
  111. int width;
  112. int height;
  113. } onvifRectangle;
  114. typedef struct S_onvifExposure
  115. {
  116. bool Mode;
  117. onvifExposurePriority Priority;
  118. onvifRectangle Window;
  119. float MinExposureTime;
  120. float MaxExposureTime;
  121. float MinGain;
  122. float MaxGain;
  123. float MinIris;
  124. float MaxIris;
  125. float ExposureTime;
  126. float Gain;
  127. float Iris;
  128. } onvifExposure;
  129. typedef enum E_onvifOnOffAuto
  130. {
  131. ON = 0,
  132. OFF,
  133. AUTO
  134. } onvifOnOffAuto;
  135. typedef struct S_onvifFocusConfiguration
  136. {
  137. bool AutoFocusMode;
  138. float DefaultSpeed;
  139. float NearLimit;
  140. float FarLimit;
  141. } onvifFocusConfiguration;
  142. typedef struct S_onvifWideDynamicRange
  143. {
  144. bool Mode;
  145. float Level;
  146. } onvifWideDynamicRange;
  147. typedef struct S_onvifWhiteBalanceExtension
  148. {
  149. } onvifWhiteBalanceExtension;
  150. typedef struct S_onvifWhiteBalance
  151. {
  152. bool Mode;
  153. float CrGain;
  154. float CbGain;
  155. onvifWhiteBalanceExtension * Extension;
  156. } onvifWhiteBalance;
  157. typedef struct S_onvifImagingSettingsExtension
  158. {
  159. } onvifImagingSettingsExtension;
  160. typedef struct S_onvifImagingSettings
  161. {
  162. onvifBacklightCompensation * BacklightCompensation;
  163. float Brightness;
  164. float ColorSaturation;
  165. float Contrast;
  166. onvifExposure * Exposure;
  167. onvifFocusConfiguration * Focus;
  168. onvifOnOffAuto IrCutFilter;
  169. float Sharpness;
  170. onvifWideDynamicRange * WideDynamicRange;
  171. onvifWhiteBalance * WhiteBalance;
  172. onvifImagingSettingsExtension * Extension;
  173. } onvifImagingSettings;
  174. typedef struct S_onvifVideoSourceExtension
  175. {
  176. onvifImagingSettings * Imaging;
  177. } onvifVideoSourceExtension;
  178. typedef struct S_onvifVideoSource
  179. {
  180. char token[CTEXT];
  181. float Framerate;
  182. onvifVideoResolution Resolution;
  183. onvifImagingSettings * Imaging;
  184. onvifVideoSourceExtension * Extension;
  185. } videoSource;
  186. typedef struct S_onvifSupportedVersions
  187. {
  188. int Major;
  189. int Minor;
  190. } onvifSupportedVersions;
  191. typedef struct S_onvifNetworkCapabilitiesExtension2
  192. {
  193. } onvifNetworkCapabilitiesExtension2;
  194. typedef struct S_onvifNetworkCapabilitiesExtension
  195. {
  196. bool Dot11Configuration;
  197. onvifNetworkCapabilitiesExtension2 * Extension;
  198. } onvifNetworkCapabilitiesExtension;
  199. typedef struct S_onvifNetworkCapabilities
  200. {
  201. bool IPFilter;
  202. bool ZeroConfiguration;
  203. bool IPVersion6;
  204. bool DynDNS;
  205. onvifNetworkCapabilitiesExtension * Extension;
  206. } onvifNetworkCapabilities;
  207. typedef struct S_onvifIOCapabilitiesExtension2
  208. {
  209. } onvifIOCapabilitiesExtension2;
  210. typedef struct S_onvifIOAuxiliaryData
  211. {
  212. } onvifIOAuxiliaryData;
  213. typedef struct S_onvifIOCapabilitiesExtension
  214. {
  215. bool Auxiliary;
  216. onvifIOAuxiliaryData * AuxiliaryCommands;
  217. onvifIOCapabilitiesExtension2 * Extension;
  218. } onvifIOCapabilitiesExtension;
  219. typedef struct S_onvifIOCapabilities
  220. {
  221. int InputConnectors;
  222. int RelayOutputs;
  223. onvifIOCapabilitiesExtension * Extension;
  224. } onvifIOCapabilities;
  225. typedef struct S_onvifSecurityCapabilitiesExtension2
  226. {
  227. bool Dot1X;
  228. int SupportedEAPMethod;
  229. bool RemoteUserHandling;
  230. } onvifSecurityCapabilitiesExtension2;
  231. typedef struct S_onvifSecurityCapabilitiesExtension
  232. {
  233. bool TLS1_0;
  234. onvifSecurityCapabilitiesExtension2 * Extension;
  235. } onvifSecurityCapabilitiesExtension;
  236. typedef struct S_onvifSecurityCapabilities
  237. {
  238. bool TLS1_1;
  239. bool TLS1_2;
  240. bool OnboardKeyGeneration;
  241. bool AccessPolicyConfig;
  242. bool X_509Token;
  243. bool SAMLToken;
  244. bool KerberosToken;
  245. bool RELToken;
  246. onvifSecurityCapabilitiesExtension * Extension;
  247. } onvifSecurityCapabilities;
  248. typedef struct S_onvifSystemCapabilitiesExtension2
  249. {
  250. } onvifSystemCapabilitiesExtension2;
  251. typedef struct S_onvifSystemCapabilitiesExtension
  252. {
  253. bool HttpFirmwareUpgrade;
  254. bool HttpSystemBackup;
  255. bool HttpSystemLogging;
  256. bool HttpSupportInformation;
  257. onvifSystemCapabilitiesExtension2 * Extension;
  258. } onvifSystemCapabilitiesExtension;
  259. typedef struct S_onvifSystemCapabilities
  260. {
  261. bool DiscoveryResolve;
  262. bool DiscoveryBye;
  263. bool RemoteDiscovery;
  264. bool SystemBackup;
  265. bool SystemLogging;
  266. bool FirmwareUpgrade;
  267. onvifSupportedVersions * SupportedVersions;
  268. onvifSystemCapabilitiesExtension * Extension;
  269. } onvifSystemCapabilities;
  270. typedef struct S_onvifDeviceCapabilitiesExtension
  271. {
  272. } onvifDeviceCapabilitiesExtension;
  273. typedef struct S_onvifAnalyticsCapabilities
  274. {
  275. char XAddr[CTEXT];
  276. bool RuleSupport;
  277. bool AnalyticsModuleSupport;
  278. } onvifAnalyticsCapabilities;
  279. typedef struct S_onvifDeviceCapabilities
  280. {
  281. char XAddr[CTEXT];
  282. onvifNetworkCapabilities * Network;
  283. onvifSystemCapabilities * System;
  284. onvifIOCapabilities * IO;
  285. onvifSecurityCapabilities * Security;
  286. onvifDeviceCapabilitiesExtension * Extension;
  287. } onvifDeviceCapabilities;
  288. typedef struct S_onvifEventCapabilities
  289. {
  290. char XAddr[CTEXT];
  291. bool WSSubscriptionPolicySupport;
  292. bool WSPullPointSupport;
  293. bool WSPausableSubscriptionManagerInterfaceSupport;
  294. } onvifEventCapabilities;
  295. typedef struct S_onvifImagingCapabilities
  296. {
  297. char XAddr[CTEXT];
  298. } onvifImagingCapabilities;
  299. typedef struct S_onvifRealTimeStreamingCapabilitiesExtension
  300. {
  301. } onvifRealTimeStreamingCapabilitiesExtension;
  302. typedef struct S_onvifRealTimeStreamingCapabilities
  303. {
  304. bool RTPMulticast;
  305. bool RTP_TCP;
  306. bool RTP_RTSP_TCP;
  307. onvifRealTimeStreamingCapabilitiesExtension * Extension;
  308. } onvifRealTimeStreamingCapabilities;
  309. typedef struct S_onvifProfileCapabilities
  310. {
  311. int MaximumNumberOfProfiles;
  312. } onvifProfileCapabilities;
  313. typedef struct S_onvifMediaCapabilitiesExtension
  314. {
  315. onvifProfileCapabilities * ProfileCapabilities;
  316. } onvifMediaCapabilitiesExtension;
  317. typedef struct S_onvifMediaCapabilities
  318. {
  319. char XAddr[CTEXT];
  320. onvifRealTimeStreamingCapabilities * StreamingCapabilities;
  321. onvifMediaCapabilitiesExtension * Extension;
  322. } onvifMediaCapabilities;
  323. typedef struct S_onvifPTZCapabilities
  324. {
  325. char XAddr[CTEXT];
  326. } onvifPTZCapabilities;
  327. typedef struct S_onvifDeviceIOCapabilities
  328. {
  329. char XAddr[CTEXT];
  330. int VideoSources;
  331. int VideoOutputs;
  332. int AudioSources;
  333. int AudioOutputs;
  334. int RelayOutputs;
  335. } onvifDeviceIOCapabilities;
  336. typedef struct S_onvifDisplayCapabilities
  337. {
  338. char XAddr[CTEXT];
  339. bool FixedLayout;
  340. } onvifDisplayCapabilities;
  341. typedef struct S_onvifRecordingCapabilities
  342. {
  343. char XAddr[CTEXT];
  344. bool ReceiverSource;
  345. bool MediaProfileSource;
  346. bool DynamicRecordings;
  347. bool DynamicTracks;
  348. int MaxStringLength;
  349. } onvifRecordingCapabilities;
  350. typedef struct S_onvifSearchCapabilities
  351. {
  352. char XAddr[CTEXT];
  353. bool MetadataSearch;
  354. } onvifSearchCapabilities;
  355. typedef struct S_onvifReplayCapabilities
  356. {
  357. char XAddr[CTEXT];
  358. } onvifReplayCapabilities;
  359. typedef struct S_onvifReceiverCapabilities
  360. {
  361. char XAddr[CTEXT];
  362. bool RTP_Multicast;
  363. bool RTP_TCP;
  364. bool RTP_RTSP_TCP;
  365. int SupportedReceivers;
  366. int MaximumRTSPURILength;
  367. } onvifReceiverCapabilities;
  368. typedef struct S_onvifAnalyticsDeviceExtension
  369. {
  370. } onvifAnalyticsDeviceExtension;
  371. typedef struct S_onvifAnalyticsDeviceCapabilities
  372. {
  373. char XAddr[CTEXT];
  374. bool RuleSupport;
  375. onvifAnalyticsDeviceExtension * Extension;
  376. } onvifAnalyticsDeviceCapabilities;
  377. typedef struct S_onvifCapabilitiesExtension2
  378. {
  379. } onvifCapabilitiesExtension2;
  380. typedef struct S_onvifCapabilitiesExtension
  381. {
  382. onvifDeviceIOCapabilities * DeviceIO;
  383. onvifDisplayCapabilities * Display;
  384. onvifRecordingCapabilities * Recording;
  385. onvifSearchCapabilities * Search;
  386. onvifReplayCapabilities * Replay;
  387. onvifReceiverCapabilities * Receiver;
  388. onvifAnalyticsDeviceCapabilities * AnalyticsDevice;
  389. onvifCapabilitiesExtension2 * Extensions;
  390. } onvifCapabilitiesExtension;
  391. typedef struct S_nodeCapability
  392. {
  393. onvifAnalyticsCapabilities * Analytics;
  394. onvifDeviceCapabilities * Device;
  395. onvifEventCapabilities * Events;
  396. onvifImagingCapabilities * Imaging;
  397. onvifMediaCapabilities * Media;
  398. onvifPTZCapabilities * PTZ;
  399. onvifCapabilitiesExtension * Extension;
  400. } nodeCapability;
  401. typedef struct S_discoveryNodeInfo
  402. {
  403. char endpoint_uid[64];
  404. char types[CTEXT];
  405. char scopes[CTEXT];
  406. char x_addrs[CTEXT];
  407. char meta_version[10];
  408. char ip_addrs[32];
  409. } discoveryNodeInfo;
  410. class pOnvif;
  411. typedef std::vector<videoSourceProfile *> videoSourceProfiles;
  412. typedef std::vector<videoSource *> videoSources;
  413. typedef std::vector<discoveryNodeInfo *> discoveryResults;
  414. class pOnvif
  415. {
  416. private:
  417. void cleanNodeCapability( nodeCapability *ptr );
  418. curlRequestsManager * m_pHttpAccessManager;
  419. basicMutex m_mResponseProtector;
  420. CURL * m_pCURL;
  421. basicLogCollection * m_pLog;
  422. CSTR m_pIpAddress;
  423. CSTR m_pUsername;
  424. CSTR m_pPassword;
  425. CSTR m_pDeviceURI;
  426. int m_pLastIndex;
  427. CSTR m_pMediaURI;
  428. CSTR m_pSnapshotURI;
  429. CSTR m_pPTZURI;
  430. CSTR m_pBaseURI;
  431. onvifSupportedVersions m_sOnvifVersion;
  432. time_t m_nDeltaTime;
  433. videoSources m_vVideoSources;
  434. videoSourceProfiles m_vVideoProfiles;
  435. videoSourceProfiles m_vActiveSources;
  436. nodeCapability m_sCapabilities;
  437. CSTR m_pProxyHost;
  438. int m_nProxyPort;
  439. CSTR m_pProxyUsername;
  440. CSTR m_pProxyPassword;
  441. CSTR m_pLastResponse;
  442. bool m_bIntransingent;
  443. time_t m_nDiscoveryTimeout;
  444. CSTR m_pDiscoveryBindIP;
  445. CSTR m_pDiscoveryMCastIP;
  446. int m_nDiscoveryMCastPort;
  447. bool m_bDiscoveryHideDuplicates;
  448. bool parser_done;
  449. uint8_t m_bAuthMode;
  450. #ifndef CURL_MANAGER
  451. static int _writer(char * data, size_t size, size_t nmemb, pOnvif * Ptr);
  452. #endif
  453. static void * parser(void * obj, void * ptr);
  454. public:
  455. pOnvif();
  456. ~pOnvif();
  457. bool setProxyHost(CSTR proxyHost);
  458. CSTR getProxyHost(void);
  459. bool setProxyPort(int proxyPort);
  460. int getProxyPort(void);
  461. bool setProxyUsername(CSTR proxyUsername);
  462. CSTR getProxyUsername(void);
  463. bool setProxyPassword(CSTR proxyPassword);
  464. CSTR getProxyPassword(void);
  465. bool setUsername(CSTR username);
  466. CSTR getUsername(void);
  467. bool setPassword(CSTR password);
  468. bool setAuthMode(uint8_t Mode);
  469. CSTR getPassword(void);
  470. CSTR getDeviceUri(void);
  471. bool setDeviceUri(CSTR deviceUri);
  472. CSTR getIPAddress(void);
  473. bool setIPAddress(CSTR ipAddress);
  474. videoSources * getSources(void);
  475. videoSourceProfiles * getProfiles(void);
  476. videoSourceProfiles * getActiveProfiles(void);
  477. CSTR getMediaUri(void);
  478. CSTR getPTZUri(void);
  479. CSTR getBaseUrl(void);
  480. void getSupportedVersion(void);
  481. nodeCapability * getCapabilities(void);
  482. bool setBreakOnError(bool intransingent);
  483. CSTR getLastResponse(void);
  484. bool setDiscoveryTimeout(int discoverytimeout);
  485. bool setDiscoveryBindIp(CSTR discoverybindip);
  486. bool setDiscoveryMcastIp(CSTR discoverymcastip);
  487. bool setDiscoveryMcastPort(int discoverymcastport);
  488. bool setDiscoveryHideDuplicates(bool discoveryhideduplicates);
  489. CSTR getSnapshotUri(void);
  490. discoveryResults discover(void);
  491. bool create(void);
  492. struct tm * core_GetSystemDateAndTime(void);
  493. bool core_GetCapabilities();
  494. bool core_GetDeviceInformation();
  495. bool media_GetVideoSources();
  496. bool media_GetProfiles();
  497. bool media_GetServices();
  498. CSTR media_GetStreamUri(CSTR profileToken, CSTR stream = (CSTR) "RTP-Unicast", CSTR protocol = (CSTR) "RTSP");
  499. CSTR media_GetSnapshotUri(CSTR profileToken);
  500. bool ptz_GetPresets(CSTR profileToken);
  501. bool ptz_GetNode(CSTR ptzNodeToken);
  502. bool ptz_GetStatus(CSTR profileToken, ptzStatus * tStatus);
  503. bool ptz_GotoPreset(CSTR profileToken, CSTR presetToken, float speed_pantilt_x, float speed_pantilt_y, float speed_zoom_x);
  504. bool ptz_RemovePreset(CSTR profileToken, CSTR presetToken);
  505. bool ptz_SetPreset(CSTR profileToken, CSTR presetName);
  506. bool ptz_RelativeMove(CSTR profileToken, float translation_pantilt_x, float translation_pantilt_y, float speed_pantilt_x, float speed_pantilt_y);
  507. bool ptz_RelativeMoveZoom(CSTR profileToken, float zoom, float speedZoom);
  508. bool ptz_AbsoluteMove(CSTR profileToken, float position_pantilt_x, float position_pantilt_y, float zoom);
  509. bool ptz_ContinuousMove(CSTR profileToken, float velocity_pantilt_x, float velocity_pantilt_y);
  510. bool ptz_ContinuousMoveZoom(CSTR profileToken, float zoom);
  511. bool ptz_Stop(CSTR profileToken, bool pantilt, bool zoom);
  512. /*
  513. Internal functions
  514. */
  515. private:
  516. accessToken _makeToken(void);
  517. void _getOnvifVersion(nodeCapability & capabilities);
  518. void _getActiveSources(videoSourceProfiles & videoSources, videoSourceProfiles profiles);
  519. void _getProfileData(videoSourceProfiles & videoSources, videoSourceProfiles profiles);
  520. // protected function _xml2array($response);
  521. accessToken _passwordDigest(CSTR username, CSTR password, time_t timestamp = 0, uint32_t nonce = 0);
  522. bool _send_request(CSTR url, CSTR post_string, bool mr = true);
  523. bool _post_request(CSTR url, CSTR post_string);
  524. };
  525. #endif