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.

528 lines
41 KiB

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