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.

615 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_accessToken
  82. {
  83. char USERNAME[CTEXT];
  84. char PASSDIGEST[CTEXT]; // SHA_DIGEST_LENGTH];
  85. char NONCE[CTEXT]; // SHA_DIGEST_LENGTH];
  86. char TIMESTAMP[CTEXT];
  87. } accessToken;
  88. typedef struct S_videoSourceProfile
  89. {
  90. char sourcetoken[CTEXT];
  91. char profiletoken[CTEXT];
  92. char profilename[CTEXT];
  93. char encoding[16];
  94. int width;
  95. int height;
  96. int fps;
  97. int bitrate;
  98. } videoSourceProfile;
  99. typedef struct S_onvifVideoResolution
  100. {
  101. int Width;
  102. int Height;
  103. } onvifVideoResolution;
  104. typedef struct S_onvifBacklightCompensation
  105. {
  106. bool Mode;
  107. float Level;
  108. } onvifBacklightCompensation;
  109. typedef enum E_onvifExposurePriority
  110. {
  111. LowNoise = 0,
  112. FrameRate
  113. } onvifExposurePriority;
  114. typedef struct S_onvifRectangle
  115. {
  116. int x;
  117. int y;
  118. int width;
  119. int height;
  120. } onvifRectangle;
  121. typedef struct S_onvifExposure
  122. {
  123. bool Mode;
  124. onvifExposurePriority Priority;
  125. onvifRectangle Window;
  126. float MinExposureTime;
  127. float MaxExposureTime;
  128. float MinGain;
  129. float MaxGain;
  130. float MinIris;
  131. float MaxIris;
  132. float ExposureTime;
  133. float Gain;
  134. float Iris;
  135. } onvifExposure;
  136. typedef enum E_onvifOnOffAuto
  137. {
  138. ON = 0,
  139. OFF,
  140. AUTO
  141. } onvifOnOffAuto;
  142. typedef struct S_onvifFocusConfiguration
  143. {
  144. bool AutoFocusMode;
  145. float DefaultSpeed;
  146. float NearLimit;
  147. float FarLimit;
  148. } onvifFocusConfiguration;
  149. typedef struct S_onvifWideDynamicRange
  150. {
  151. bool Mode;
  152. float Level;
  153. } onvifWideDynamicRange;
  154. typedef struct S_onvifWhiteBalanceExtension
  155. {
  156. } onvifWhiteBalanceExtension;
  157. typedef struct S_onvifWhiteBalance
  158. {
  159. bool Mode;
  160. float CrGain;
  161. float CbGain;
  162. onvifWhiteBalanceExtension * Extension;
  163. } onvifWhiteBalance;
  164. typedef struct S_onvifImagingSettingsExtension
  165. {
  166. } onvifImagingSettingsExtension;
  167. typedef struct S_onvifImagingSettings
  168. {
  169. onvifBacklightCompensation * BacklightCompensation;
  170. float Brightness;
  171. float ColorSaturation;
  172. float Contrast;
  173. onvifExposure * Exposure;
  174. onvifFocusConfiguration * Focus;
  175. onvifOnOffAuto IrCutFilter;
  176. float Sharpness;
  177. onvifWideDynamicRange * WideDynamicRange;
  178. onvifWhiteBalance * WhiteBalance;
  179. onvifImagingSettingsExtension * Extension;
  180. } onvifImagingSettings;
  181. typedef struct S_onvifVideoSourceExtension
  182. {
  183. onvifImagingSettings * Imaging;
  184. } onvifVideoSourceExtension;
  185. typedef struct S_onvifVideoSource
  186. {
  187. char token[CTEXT];
  188. float Framerate;
  189. onvifVideoResolution Resolution;
  190. onvifImagingSettings * Imaging;
  191. onvifVideoSourceExtension * Extension;
  192. } videoSource;
  193. typedef struct S_onvifSupportedVersions
  194. {
  195. int Major;
  196. int Minor;
  197. } onvifSupportedVersions;
  198. typedef struct S_onvifNetworkCapabilitiesExtension2
  199. {
  200. } onvifNetworkCapabilitiesExtension2;
  201. typedef struct S_onvifNetworkCapabilitiesExtension
  202. {
  203. bool Dot11Configuration;
  204. onvifNetworkCapabilitiesExtension2 * Extension;
  205. } onvifNetworkCapabilitiesExtension;
  206. typedef struct S_onvifNetworkCapabilities
  207. {
  208. bool IPFilter;
  209. bool ZeroConfiguration;
  210. bool IPVersion6;
  211. bool DynDNS;
  212. onvifNetworkCapabilitiesExtension * Extension;
  213. } onvifNetworkCapabilities;
  214. typedef struct S_onvifIOCapabilitiesExtension2
  215. {
  216. } onvifIOCapabilitiesExtension2;
  217. typedef struct S_onvifIOAuxiliaryData
  218. {
  219. } onvifIOAuxiliaryData;
  220. typedef struct S_onvifIOCapabilitiesExtension
  221. {
  222. bool Auxiliary;
  223. onvifIOAuxiliaryData * AuxiliaryCommands;
  224. onvifIOCapabilitiesExtension2 * Extension;
  225. } onvifIOCapabilitiesExtension;
  226. typedef struct S_onvifIOCapabilities
  227. {
  228. int InputConnectors;
  229. int RelayOutputs;
  230. onvifIOCapabilitiesExtension * Extension;
  231. } onvifIOCapabilities;
  232. typedef struct S_onvifSecurityCapabilitiesExtension2
  233. {
  234. bool Dot1X;
  235. int SupportedEAPMethod;
  236. bool RemoteUserHandling;
  237. } onvifSecurityCapabilitiesExtension2;
  238. typedef struct S_onvifSecurityCapabilitiesExtension
  239. {
  240. bool TLS1_0;
  241. onvifSecurityCapabilitiesExtension2 * Extension;
  242. } onvifSecurityCapabilitiesExtension;
  243. typedef struct S_onvifSecurityCapabilities
  244. {
  245. bool TLS1_1;
  246. bool TLS1_2;
  247. bool OnboardKeyGeneration;
  248. bool AccessPolicyConfig;
  249. bool X_509Token;
  250. bool SAMLToken;
  251. bool KerberosToken;
  252. bool RELToken;
  253. onvifSecurityCapabilitiesExtension * Extension;
  254. } onvifSecurityCapabilities;
  255. typedef struct S_onvifSystemCapabilitiesExtension2
  256. {
  257. } onvifSystemCapabilitiesExtension2;
  258. typedef struct S_onvifSystemCapabilitiesExtension
  259. {
  260. bool HttpFirmwareUpgrade;
  261. bool HttpSystemBackup;
  262. bool HttpSystemLogging;
  263. bool HttpSupportInformation;
  264. onvifSystemCapabilitiesExtension2 * Extension;
  265. } onvifSystemCapabilitiesExtension;
  266. typedef struct S_onvifSystemCapabilities
  267. {
  268. bool DiscoveryResolve;
  269. bool DiscoveryBye;
  270. bool RemoteDiscovery;
  271. bool SystemBackup;
  272. bool SystemLogging;
  273. bool FirmwareUpgrade;
  274. onvifSupportedVersions * SupportedVersions;
  275. onvifSystemCapabilitiesExtension * Extension;
  276. } onvifSystemCapabilities;
  277. typedef struct S_onvifDeviceCapabilitiesExtension
  278. {
  279. } onvifDeviceCapabilitiesExtension;
  280. typedef struct S_onvifAnalyticsCapabilities
  281. {
  282. char XAddr[CTEXT];
  283. bool RuleSupport;
  284. bool AnalyticsModuleSupport;
  285. } onvifAnalyticsCapabilities;
  286. typedef struct S_onvifDeviceCapabilities
  287. {
  288. char XAddr[CTEXT];
  289. onvifNetworkCapabilities * Network;
  290. onvifSystemCapabilities * System;
  291. onvifIOCapabilities * IO;
  292. onvifSecurityCapabilities * Security;
  293. onvifDeviceCapabilitiesExtension * Extension;
  294. } onvifDeviceCapabilities;
  295. typedef struct S_onvifEventCapabilities
  296. {
  297. char XAddr[CTEXT];
  298. bool WSSubscriptionPolicySupport;
  299. bool WSPullPointSupport;
  300. bool WSPausableSubscriptionManagerInterfaceSupport;
  301. } onvifEventCapabilities;
  302. typedef struct S_onvifImagingCapabilities
  303. {
  304. char XAddr[CTEXT];
  305. } onvifImagingCapabilities;
  306. typedef struct S_onvifRealTimeStreamingCapabilitiesExtension
  307. {
  308. } onvifRealTimeStreamingCapabilitiesExtension;
  309. typedef struct S_onvifRealTimeStreamingCapabilities
  310. {
  311. bool RTPMulticast;
  312. bool RTP_TCP;
  313. bool RTP_RTSP_TCP;
  314. onvifRealTimeStreamingCapabilitiesExtension * Extension;
  315. } onvifRealTimeStreamingCapabilities;
  316. typedef struct S_onvifProfileCapabilities
  317. {
  318. int MaximumNumberOfProfiles;
  319. } onvifProfileCapabilities;
  320. typedef struct S_onvifMediaCapabilitiesExtension
  321. {
  322. onvifProfileCapabilities * ProfileCapabilities;
  323. } onvifMediaCapabilitiesExtension;
  324. typedef struct S_onvifMediaCapabilities
  325. {
  326. char XAddr[CTEXT];
  327. onvifRealTimeStreamingCapabilities * StreamingCapabilities;
  328. onvifMediaCapabilitiesExtension * Extension;
  329. } onvifMediaCapabilities;
  330. typedef struct S_onvifPTZCapabilities
  331. {
  332. char XAddr[CTEXT];
  333. } onvifPTZCapabilities;
  334. typedef struct S_onvifDeviceIOCapabilities
  335. {
  336. char XAddr[CTEXT];
  337. int VideoSources;
  338. int VideoOutputs;
  339. int AudioSources;
  340. int AudioOutputs;
  341. int RelayOutputs;
  342. } onvifDeviceIOCapabilities;
  343. typedef struct S_onvifDisplayCapabilities
  344. {
  345. char XAddr[CTEXT];
  346. bool FixedLayout;
  347. } onvifDisplayCapabilities;
  348. typedef struct S_onvifRecordingCapabilities
  349. {
  350. char XAddr[CTEXT];
  351. bool ReceiverSource;
  352. bool MediaProfileSource;
  353. bool DynamicRecordings;
  354. bool DynamicTracks;
  355. int MaxStringLength;
  356. } onvifRecordingCapabilities;
  357. typedef struct S_onvifSearchCapabilities
  358. {
  359. char XAddr[CTEXT];
  360. bool MetadataSearch;
  361. } onvifSearchCapabilities;
  362. typedef struct S_onvifReplayCapabilities
  363. {
  364. char XAddr[CTEXT];
  365. } onvifReplayCapabilities;
  366. typedef struct S_onvifReceiverCapabilities
  367. {
  368. char XAddr[CTEXT];
  369. bool RTP_Multicast;
  370. bool RTP_TCP;
  371. bool RTP_RTSP_TCP;
  372. int SupportedReceivers;
  373. int MaximumRTSPURILength;
  374. } onvifReceiverCapabilities;
  375. typedef struct S_onvifAnalyticsDeviceExtension
  376. {
  377. } onvifAnalyticsDeviceExtension;
  378. typedef struct S_onvifAnalyticsDeviceCapabilities
  379. {
  380. char XAddr[CTEXT];
  381. bool RuleSupport;
  382. onvifAnalyticsDeviceExtension * Extension;
  383. } onvifAnalyticsDeviceCapabilities;
  384. typedef struct S_onvifCapabilitiesExtension2
  385. {
  386. } onvifCapabilitiesExtension2;
  387. typedef struct S_onvifCapabilitiesExtension
  388. {
  389. onvifDeviceIOCapabilities * DeviceIO;
  390. onvifDisplayCapabilities * Display;
  391. onvifRecordingCapabilities * Recording;
  392. onvifSearchCapabilities * Search;
  393. onvifReplayCapabilities * Replay;
  394. onvifReceiverCapabilities * Receiver;
  395. onvifAnalyticsDeviceCapabilities * AnalyticsDevice;
  396. onvifCapabilitiesExtension2 * Extensions;
  397. } onvifCapabilitiesExtension;
  398. typedef struct S_nodeCapability
  399. {
  400. onvifAnalyticsCapabilities * Analytics;
  401. onvifDeviceCapabilities * Device;
  402. onvifEventCapabilities * Events;
  403. onvifImagingCapabilities * Imaging;
  404. onvifMediaCapabilities * Media;
  405. onvifPTZCapabilities * PTZ;
  406. onvifCapabilitiesExtension * Extension;
  407. } nodeCapability;
  408. typedef struct S_discoveryNodeInfo
  409. {
  410. char endpoint_uid[64];
  411. char types[CTEXT];
  412. char scopes[CTEXT];
  413. char x_addrs[CTEXT];
  414. char meta_version[10];
  415. char ip_addrs[32];
  416. } discoveryNodeInfo;
  417. typedef struct S_ptzStatus
  418. {
  419. float pan;
  420. float tilt;
  421. float zoom;
  422. bool hasMoveStatus;
  423. bool PanTiltIdle;
  424. bool ZoomIdle;
  425. } ptzStatus;
  426. class pOnvif;
  427. typedef std::vector<videoSourceProfile *> videoSourceProfiles;
  428. typedef std::vector<videoSource *> videoSources;
  429. typedef std::vector<discoveryNodeInfo *> discoveryResults;
  430. class pOnvif
  431. {
  432. private:
  433. curlRequestsManager * m_pHttpAccessManager;
  434. basicMutex m_mResponseProtector;
  435. CURL * m_pCURL;
  436. basicLogCollection * m_pLog;
  437. CSTR m_pIpAddress;
  438. CSTR m_pUsername;
  439. CSTR m_pPassword;
  440. CSTR m_pDeviceURI;
  441. int m_pLastIndex;
  442. CSTR m_pMediaURI;
  443. CSTR m_pSnapshotURI;
  444. CSTR m_pPTZURI;
  445. CSTR m_pBaseURI;
  446. onvifSupportedVersions m_sOnvifVersion;
  447. time_t m_nDeltaTime;
  448. videoSources m_vVideoSources;
  449. videoSourceProfiles m_vVideoProfiles;
  450. videoSourceProfiles m_vActiveSources;
  451. nodeCapability m_sCapabilities;
  452. CSTR m_pProxyHost;
  453. int m_nProxyPort;
  454. CSTR m_pProxyUsername;
  455. CSTR m_pProxyPassword;
  456. CSTR m_pLastResponse;
  457. bool m_bIntransingent;
  458. time_t m_nDiscoveryTimeout;
  459. CSTR m_pDiscoveryBindIP;
  460. CSTR m_pDiscoveryMCastIP;
  461. int m_nDiscoveryMCastPort;
  462. bool m_bDiscoveryHideDuplicates;
  463. bool parser_done;
  464. uint8_t m_bAuthMode;
  465. #ifndef CURL_MANAGER
  466. static int _writer(char * data, size_t size, size_t nmemb, pOnvif * Ptr);
  467. #endif
  468. static void * parser(void * obj, void * ptr);
  469. public:
  470. pOnvif();
  471. ~pOnvif();
  472. bool setProxyHost(CSTR proxyHost);
  473. CSTR getProxyHost(void);
  474. bool setProxyPort(int proxyPort);
  475. int getProxyPort(void);
  476. bool setProxyUsername(CSTR proxyUsername);
  477. CSTR getProxyUsername(void);
  478. bool setProxyPassword(CSTR proxyPassword);
  479. CSTR getProxyPassword(void);
  480. bool setUsername(CSTR username);
  481. CSTR getUsername(void);
  482. bool setPassword(CSTR password);
  483. bool setAuthMode(uint8_t Mode);
  484. CSTR getPassword(void);
  485. CSTR getDeviceUri(void);
  486. bool setDeviceUri(CSTR deviceUri);
  487. CSTR getIPAddress(void);
  488. bool setIPAddress(CSTR ipAddress);
  489. videoSources * getSources(void);
  490. videoSourceProfiles * getProfiles(void);
  491. videoSourceProfiles * getActiveProfiles(void);
  492. CSTR getMediaUri(void);
  493. CSTR getPTZUri(void);
  494. CSTR getBaseUrl(void);
  495. void getSupportedVersion(void);
  496. nodeCapability * getCapabilities(void);
  497. bool setBreakOnError(bool intransingent);
  498. CSTR getLastResponse(void);
  499. bool setDiscoveryTimeout(int discoverytimeout);
  500. bool setDiscoveryBindIp(CSTR discoverybindip);
  501. bool setDiscoveryMcastIp(CSTR discoverymcastip);
  502. bool setDiscoveryMcastPort(int discoverymcastport);
  503. bool setDiscoveryHideDuplicates(bool discoveryhideduplicates);
  504. CSTR getSnapshotUri(void);
  505. discoveryResults discover(void);
  506. bool create(void);
  507. struct tm * core_GetSystemDateAndTime(void);
  508. bool core_GetCapabilities();
  509. bool core_GetDeviceInformation();
  510. bool media_GetVideoSources();
  511. bool media_GetProfiles();
  512. bool media_GetServices();
  513. CSTR media_GetStreamUri(CSTR profileToken, CSTR stream = (CSTR) "RTP-Unicast", CSTR protocol = (CSTR) "RTSP");
  514. CSTR media_GetSnapshotUri(CSTR profileToken);
  515. bool ptz_GetPresets(CSTR profileToken);
  516. bool ptz_GetNode(CSTR ptzNodeToken);
  517. bool ptz_GetStatus(CSTR profileToken, ptzStatus * tStatus);
  518. bool ptz_GotoPreset(CSTR profileToken, CSTR presetToken, float speed_pantilt_x, float speed_pantilt_y, float speed_zoom_x);
  519. bool ptz_RemovePreset(CSTR profileToken, CSTR presetToken);
  520. bool ptz_SetPreset(CSTR profileToken, CSTR presetName);
  521. bool ptz_RelativeMove(CSTR profileToken, float translation_pantilt_x, float translation_pantilt_y, float speed_pantilt_x, float speed_pantilt_y);
  522. bool ptz_RelativeMoveZoom(CSTR profileToken, float zoom, float speedZoom);
  523. bool ptz_AbsoluteMove(CSTR profileToken, float position_pantilt_x, float position_pantilt_y, float zoom);
  524. bool ptz_ContinuousMove(CSTR profileToken, float velocity_pantilt_x, float velocity_pantilt_y);
  525. bool ptz_ContinuousMoveZoom(CSTR profileToken, float zoom);
  526. bool ptz_Stop(CSTR profileToken, bool pantilt, bool zoom);
  527. /*
  528. Internal functions
  529. */
  530. private:
  531. accessToken _makeToken(void);
  532. void _getOnvifVersion(nodeCapability & capabilities);
  533. void _getActiveSources(videoSourceProfiles & videoSources, videoSourceProfiles profiles);
  534. void _getProfileData(videoSourceProfiles & videoSources, videoSourceProfiles profiles);
  535. // protected function _xml2array($response);
  536. accessToken _passwordDigest(CSTR username, CSTR password, time_t timestamp = 0, uint32_t nonce = 0);
  537. bool _send_request(CSTR url, CSTR post_string, bool mr = true);
  538. bool _post_request(CSTR url, CSTR post_string);
  539. };
  540. #endif