我想向一个相机发送Hello消息,通过相机有无回应来判断该相机是否在线。
一下是我的代码,
wsddProxy oProxy("http://192.168.6.54/onvif/device_service");
oProxy.recv_timeout = 2;
oProxy.header = soap_new_SOAP_ENV__Header(&oProxy);
soap_default_SOAP_ENV__Header(&oProxy, oProxy.header);
oProxy.header->wsa__RelatesTo=0;
oProxy.header->wsa__From = 0;
oProxy.header->wsa__ReplyTo = 0;
oProxy.header->wsa__FaultTo = 0;
oProxy.header->wsdd__AppSequence = 0;
oProxy.header->wsa__MessageID = (char*)soap_malloc(&oProxy, 256 );
oProxy.header->wsa__To = (char*)soap_malloc(&oProxy, 256 );
oProxy.header->wsa__Action = (char*)soap_malloc(&oProxy, 256 );
strcpy_s(oProxy.header->wsa__Action, 250 , "http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe");
strcpy_s(oProxy.header->wsa__To, 250 , "urn:schemas-xmlsoap-org:ws:2005:04:discovery");
strcpy_s(oProxy.header->wsa__MessageID, 250 , "uuid:" + GlobalFunction::CreateGUID());
wsdd__ProbeType oSendParam;
soap_default_wsdd__ProbeType(&oProxy, &oSendParam);
//oSendParam.Types = "tdn:NetworkVideoTransmitter";
oSendParam.Types = "tdn:Device";
__wsdd__ProbeMatches oReceiveParam;
soap_default___wsdd__ProbeMatches(&oProxy, &oReceiveParam);
oProxy.Probe(&oSendParam);
int n = oProxy.recv_ProbeMatches(oReceiveParam);
if (SOAP_OK == n) // 接收到Device反馈
{
}
n的返回值总是-1,是我的soap_endpoint错误,还是什么问题。对Onvif了解的很少,文档看的不是很懂,求帮助!