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.

140 lines
5.8 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __ONVIF_CLIENT_EVENT__
  2. #define __ONVIF_CLIENT_EVENT__
  3. #include <string>
  4. #include <map>
  5. #include <iostream>
  6. #include <list>
  7. #include "onvifclientdevice.hpp"
  8. #include "../onvifgen/soapStub.h"
  9. #include "../onvifgen/soapPullPointSubscriptionBindingProxy.h"
  10. #include "../onvifgen/soapPullPointSubscriptionBindingService.h"
  11. #include "../gsoap/wsseapi.h"
  12. #include "../gsoap/wsaapi.h"
  13. using namespace std;
  14. class ONVIFLIB_API OnvifClientEventNotify : public PullPointSubscriptionBindingService
  15. {
  16. public:
  17. OnvifClientEventNotify(struct soap* pData);
  18. public:
  19. //TODO add callback to here
  20. virtual int Notify(_wsnt__Notify *wsnt__Notify)
  21. {
  22. printf("\nMessage size %d\n", wsnt__Notify->NotificationMessage.size());
  23. if(wsnt__Notify->NotificationMessage.size() > 0 )
  24. {
  25. m_EventCnt ++;
  26. printf("\nONVIF CPP Lib Event %d host %s __mixed: %s\n", m_EventCnt, host,
  27. wsnt__Notify->NotificationMessage[0]->Topic->__mixed);
  28. printf("\t__any: %s\n", wsnt__Notify->NotificationMessage[0]->Topic->__any);
  29. printf("\t__anyAttribute: %s\n", wsnt__Notify->NotificationMessage[0]->Topic->__anyAttribute);
  30. printf("\tDialect: %s\n", wsnt__Notify->NotificationMessage[0]->Topic->Dialect.c_str());
  31. printf("\tMessage %s\n", wsnt__Notify->NotificationMessage[0]->Message.__any);
  32. }
  33. return SOAP_OK;
  34. }
  35. public:
  36. virtual PullPointSubscriptionBindingService *copy()
  37. {
  38. return NULL;
  39. }
  40. /// Web service operation 'PullMessages' (returns error code or SOAP_OK)
  41. virtual int PullMessages(_tev__PullMessages *tev__PullMessages, _tev__PullMessagesResponse *tev__PullMessagesResponse)
  42. {return SOAP_OK;}
  43. /// Web service operation 'Seek' (returns error code or SOAP_OK)
  44. virtual int Seek(_tev__Seek *tev__Seek, _tev__SeekResponse *tev__SeekResponse)
  45. {return SOAP_OK;}
  46. /// Web service operation 'SetSynchronizationPoint' (returns error code or SOAP_OK)
  47. virtual int SetSynchronizationPoint(_tev__SetSynchronizationPoint *tev__SetSynchronizationPoint, _tev__SetSynchronizationPointResponse *tev__SetSynchronizationPointResponse)
  48. {return SOAP_OK;}
  49. /// Web service operation 'GetServiceCapabilities' (returns error code or SOAP_OK)
  50. virtual int GetServiceCapabilities(_tev__GetServiceCapabilities *tev__GetServiceCapabilities, _tev__GetServiceCapabilitiesResponse *tev__GetServiceCapabilitiesResponse)
  51. {return SOAP_OK;}
  52. /// Web service operation 'CreatePullPointSubscription' (returns error code or SOAP_OK)
  53. virtual int CreatePullPointSubscription(_tev__CreatePullPointSubscription *tev__CreatePullPointSubscription, _tev__CreatePullPointSubscriptionResponse *tev__CreatePullPointSubscriptionResponse)
  54. {return SOAP_OK;}
  55. /// Web service operation 'GetEventProperties' (returns error code or SOAP_OK)
  56. virtual int GetEventProperties(_tev__GetEventProperties *tev__GetEventProperties, _tev__GetEventPropertiesResponse *tev__GetEventPropertiesResponse)
  57. {return SOAP_OK;}
  58. /// Web service operation 'Renew' (returns error code or SOAP_OK)
  59. virtual int Renew(_wsnt__Renew *wsnt__Renew, _wsnt__RenewResponse *wsnt__RenewResponse)
  60. {return SOAP_OK;}
  61. /// Web service operation 'Unsubscribe' (returns error code or SOAP_OK)
  62. virtual int Unsubscribe(_wsnt__Unsubscribe *wsnt__Unsubscribe, _wsnt__UnsubscribeResponse *wsnt__UnsubscribeResponse)
  63. {return SOAP_OK;}
  64. /// Web service operation 'Subscribe' (returns error code or SOAP_OK)
  65. virtual int Subscribe(_wsnt__Subscribe *wsnt__Subscribe, _wsnt__SubscribeResponse *wsnt__SubscribeResponse)
  66. {return SOAP_OK;}
  67. /// Web service operation 'GetCurrentMessage' (returns error code or SOAP_OK)
  68. virtual int GetCurrentMessage(_wsnt__GetCurrentMessage *wsnt__GetCurrentMessage, _wsnt__GetCurrentMessageResponse *wsnt__GetCurrentMessageResponse)
  69. {return SOAP_OK;}
  70. /// Web service operation 'GetMessages' (returns error code or SOAP_OK)
  71. virtual int GetMessages(_wsnt__GetMessages *wsnt__GetMessages, _wsnt__GetMessagesResponse *wsnt__GetMessagesResponse)
  72. {return SOAP_OK;}
  73. /// Web service operation 'DestroyPullPoint' (returns error code or SOAP_OK)
  74. virtual int DestroyPullPoint(_wsnt__DestroyPullPoint *wsnt__DestroyPullPoint, _wsnt__DestroyPullPointResponse *wsnt__DestroyPullPointResponse)
  75. {return SOAP_OK;}
  76. /// Web service one-way operation 'Notify' (return error code, SOAP_OK (no response), or send_Notify_empty_response())
  77. virtual int Notify_(_wsnt__Notify *wsnt__Notify)
  78. {return SOAP_OK;}
  79. /// Web service operation 'CreatePullPoint' (returns error code or SOAP_OK)
  80. virtual int CreatePullPoint(_wsnt__CreatePullPoint *wsnt__CreatePullPoint, _wsnt__CreatePullPointResponse *wsnt__CreatePullPointResponse)
  81. {return SOAP_OK;}
  82. /// Web service operation 'Renew' (returns error code or SOAP_OK)
  83. virtual int Renew_(_wsnt__Renew *wsnt__Renew, _wsnt__RenewResponse *wsnt__RenewResponse)
  84. {return SOAP_OK;}
  85. /// Web service operation 'Unsubscribe' (returns error code or SOAP_OK)
  86. virtual int Unsubscribe_(_wsnt__Unsubscribe *wsnt__Unsubscribe, _wsnt__UnsubscribeResponse *wsnt__UnsubscribeResponse)
  87. {return SOAP_OK;}
  88. /// Web service operation 'PauseSubscription' (returns error code or SOAP_OK)
  89. virtual int PauseSubscription(_wsnt__PauseSubscription *wsnt__PauseSubscription, _wsnt__PauseSubscriptionResponse *wsnt__PauseSubscriptionResponse)
  90. {return SOAP_OK;}
  91. /// Web service operation 'ResumeSubscription' (returns error code or SOAP_OK)
  92. virtual int ResumeSubscription(_wsnt__ResumeSubscription *wsnt__ResumeSubscription, _wsnt__ResumeSubscriptionResponse *wsnt__ResumeSubscriptionResponse)
  93. {return SOAP_OK;}
  94. private:
  95. int m_EventCnt;
  96. };
  97. class ONVIFLIB_API OnvifClientEvent
  98. {
  99. public:
  100. OnvifClientEvent(OnvifClientDevice &device);
  101. ~OnvifClientEvent();
  102. public:
  103. /* Add function to here */
  104. int Subscribe(string &notifyUrl);
  105. int UnSubscribe();
  106. int Renew();
  107. private:
  108. OnvifClientDevice &m_Device;
  109. string m_RenewEndpoint;
  110. PullPointSubscriptionBindingProxy eventBinding;
  111. };
  112. #endif