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.

181 lines
5.5 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "onvifclientimaging.hpp"
  2. ONVIFLIB_API inline int OnvifClientImaging::Stop(_timg__StopResponse &StopResponse,string VideoSourceToken)
  3. {
  4. string strUrl;
  5. string strUser;
  6. string strPass;
  7. if (m_Device.GetUserPasswd(strUser, strPass) == false
  8. || m_Device.GetImagingUrl(strUrl) == false)
  9. {
  10. return SOAP_ERR;
  11. }
  12. ImageProxy.soap_endpoint = strUrl.c_str();
  13. soap_wsse_add_Security(&ImageProxy);
  14. soap_wsse_add_UsernameTokenDigest(&ImageProxy, "Id", strUser.c_str() , strPass.c_str());
  15. _timg__Stop StopReq;
  16. StopReq.VideoSourceToken = VideoSourceToken;
  17. return ImageProxy.Stop(&StopReq,&StopResponse);
  18. }
  19. //(focus)
  20. ONVIFLIB_API inline int OnvifClientImaging::GetMoveOptions(_timg__GetMoveOptionsResponse &GetMoveOptionsResponse,string VideoSourceToken)
  21. {
  22. string strUrl;
  23. string strUser;
  24. string strPass;
  25. if (m_Device.GetUserPasswd(strUser, strPass) == false
  26. || m_Device.GetImagingUrl(strUrl) == false)
  27. {
  28. return SOAP_ERR;
  29. }
  30. ImageProxy.soap_endpoint = strUrl.c_str();
  31. soap_wsse_add_Security(&ImageProxy);
  32. soap_wsse_add_UsernameTokenDigest(&ImageProxy, "Id", strUser.c_str() , strPass.c_str());
  33. _timg__GetMoveOptions GetMoveOptionsReq;
  34. GetMoveOptionsReq.VideoSourceToken = VideoSourceToken;
  35. return ImageProxy.GetMoveOptions(&GetMoveOptionsReq,&GetMoveOptionsResponse);
  36. }
  37. //move (focus)
  38. ONVIFLIB_API inline int OnvifClientImaging::Move(_timg__MoveResponse &MoveResponse, tt__FocusMove &Focus, string VideoSourceToken)
  39. {
  40. string strUrl;
  41. string strUser;
  42. string strPass;
  43. if (m_Device.GetUserPasswd(strUser, strPass) == false
  44. || m_Device.GetImagingUrl(strUrl) == false)
  45. {
  46. return SOAP_ERR;
  47. }
  48. ImageProxy.soap_endpoint = strUrl.c_str();
  49. soap_wsse_add_Security(&ImageProxy);
  50. soap_wsse_add_UsernameTokenDigest(&ImageProxy, "Id", strUser.c_str() , strPass.c_str());
  51. _timg__Move MoveReq;
  52. MoveReq.Focus = &Focus;
  53. MoveReq.VideoSourceToken = VideoSourceToken;
  54. return ImageProxy.Move(&MoveReq,&MoveResponse);
  55. }
  56. ONVIFLIB_API inline int OnvifClientImaging::GetStatus(_timg__GetStatusResponse &GetImagingStatusResponse, string VideoSourceToken)
  57. {
  58. string strUrl;
  59. string strUser;
  60. string strPass;
  61. if (m_Device.GetUserPasswd(strUser, strPass) == false
  62. || m_Device.GetImagingUrl(strUrl) == false)
  63. {
  64. return SOAP_ERR;
  65. }
  66. ImageProxy.soap_endpoint = strUrl.c_str();
  67. soap_wsse_add_Security(&ImageProxy);
  68. soap_wsse_add_UsernameTokenDigest(&ImageProxy, "Id", strUser.c_str() , strPass.c_str());
  69. _timg__GetStatus GetImagingStatusReq;
  70. GetImagingStatusReq.VideoSourceToken = VideoSourceToken;
  71. return ImageProxy.GetStatus(&GetImagingStatusReq,&GetImagingStatusResponse);
  72. }
  73. ONVIFLIB_API inline int OnvifClientImaging::SetImagingSettings(_timg__SetImagingSettingsResponse &SetImagingSettingsResponse, string VideoSourceToken, tt__ImagingSettings20 &ImagingSettings,bool ForcePersistence)
  74. {
  75. string strUrl;
  76. string strUser;
  77. string strPass;
  78. if (m_Device.GetUserPasswd(strUser, strPass) == false
  79. || m_Device.GetImagingUrl(strUrl) == false)
  80. {
  81. return SOAP_ERR;
  82. }
  83. ImageProxy.soap_endpoint = strUrl.c_str();
  84. soap_wsse_add_Security(&ImageProxy);
  85. soap_wsse_add_UsernameTokenDigest(&ImageProxy, "Id", strUser.c_str() , strPass.c_str());
  86. _timg__SetImagingSettings SetImagingSettingsReq;
  87. SetImagingSettingsReq.VideoSourceToken = VideoSourceToken;
  88. SetImagingSettingsReq.ImagingSettings = &ImagingSettings;
  89. SetImagingSettingsReq.ForcePersistence = &ForcePersistence;
  90. return ImageProxy.SetImagingSettings(&SetImagingSettingsReq,&SetImagingSettingsResponse);
  91. }
  92. ONVIFLIB_API inline int OnvifClientImaging::GetServiceCapabilities(_timg__GetServiceCapabilitiesResponse &GetServiceCapResponse)
  93. {
  94. string strUrl;
  95. string strUser;
  96. string strPass;
  97. if (m_Device.GetUserPasswd(strUser, strPass) == false
  98. || m_Device.GetImagingUrl(strUrl) == false)
  99. {
  100. return SOAP_ERR;
  101. }
  102. ImageProxy.soap_endpoint = strUrl.c_str();
  103. soap_wsse_add_Security(&ImageProxy);
  104. soap_wsse_add_UsernameTokenDigest(&ImageProxy, "Id", strUser.c_str() , strPass.c_str());
  105. _timg__GetServiceCapabilities GetServiceCapReq;
  106. return ImageProxy.GetServiceCapabilities(&GetServiceCapReq,&GetServiceCapResponse);
  107. }
  108. ONVIFLIB_API inline int OnvifClientImaging::GetOptions(_timg__GetOptionsResponse &GetOptionsResponse, string videoSourceToken)
  109. {
  110. string strUrl;
  111. string strUser;
  112. string strPass;
  113. if (m_Device.GetUserPasswd(strUser, strPass) == false
  114. || m_Device.GetImagingUrl(strUrl) == false)
  115. {
  116. return SOAP_ERR;
  117. }
  118. ImageProxy.soap_endpoint = strUrl.c_str();
  119. soap_wsse_add_Security(&ImageProxy);
  120. soap_wsse_add_UsernameTokenDigest(&ImageProxy, "Id", strUser.c_str() , strPass.c_str());
  121. _timg__GetOptions GetOptionsReq;
  122. GetOptionsReq.VideoSourceToken = videoSourceToken;
  123. return ImageProxy.GetOptions(&GetOptionsReq,&GetOptionsResponse);
  124. }
  125. ONVIFLIB_API inline int OnvifClientImaging::GetImagingSettings(_timg__GetImagingSettingsResponse &ImagingSettingsResponse, string videoSourceToken)
  126. {
  127. string strUrl;
  128. string strUser;
  129. string strPass;
  130. if (m_Device.GetUserPasswd(strUser, strPass) == false
  131. || m_Device.GetImagingUrl(strUrl) == false)
  132. {
  133. return SOAP_ERR;
  134. }
  135. ImageProxy.soap_endpoint = strUrl.c_str();
  136. soap_wsse_add_Security(&ImageProxy);
  137. soap_wsse_add_UsernameTokenDigest(&ImageProxy, "Id", strUser.c_str() , strPass.c_str());
  138. _timg__GetImagingSettings ImagingSettingsReq;
  139. ImagingSettingsReq.VideoSourceToken = videoSourceToken;
  140. return ImageProxy.GetImagingSettings(&ImagingSettingsReq,&ImagingSettingsResponse);
  141. }
  142. inline OnvifClientImaging::OnvifClientImaging(OnvifClientDevice &device)
  143. : m_Device(device)
  144. {
  145. }
  146. inline OnvifClientImaging::~OnvifClientImaging()
  147. {
  148. }