soap实现ONVIF协议PTZControl的AbsoluteMove失败

weiguian 2020-10-22 09:04:43
请教各位大神,使用gSoap工具生成的ONVIF协议的C代码,想实现摄像头的AbsoluteMove,我用ONVIF Device Test Tool工具测试,我的摄像头是支持AbsoluteMove的,但是我调用soap_call___tptz__AbsoluteMove方法时,返回值永远是12,摄像头也没有动,
有大神知道是什么原因吗?
这是我的代码
struct _tptz__AbsoluteMove *AbsoluteMove;
struct _tptz__AbsoluteMoveResponse *AbsoluteMoveResponse;
AbsoluteMove = (_tptz__AbsoluteMove*)soap_malloc(soap, sizeof(struct _tptz__AbsoluteMove));
AbsoluteMoveResponse = (_tptz__AbsoluteMoveResponse*)soap_malloc(soap, sizeof(struct _tptz__AbsoluteMoveResponse));
soap_default__tptz__AbsoluteMove(soap, AbsoluteMove);//内存清零
soap_default__tptz__AbsoluteMoveResponse(soap, AbsoluteMoveResponse);

AbsoluteMove->ProfileToken = trt__GetProfilesResponse.Profiles->token;
AbsoluteMove->Position = (tt__PTZVector*)soap_malloc(soap, sizeof(struct tt__PTZVector));
AbsoluteMove->Position->PanTilt = (tt__Vector2D*)soap_malloc(soap, sizeof(struct tt__Vector2D));
AbsoluteMove->Position->PanTilt->x = -0.9798;//P这里是随便写的几个数
AbsoluteMove->Position->PanTilt->y = 0.6768;//T
AbsoluteMove->Position->PanTilt->space = (char*)soap_malloc(soap, 128);
strcpy(AbsoluteMove->Position->PanTilt->space, "http://www.onvif.org/ver10/schema");
AbsoluteMove->Speed = (tt__PTZSpeed*)soap_malloc(soap, sizeof(struct tt__PTZSpeed));
AbsoluteMove->Speed->PanTilt = (tt__Vector2D*)soap_malloc(soap, sizeof(struct tt__Vector2D));;
AbsoluteMove->Speed->PanTilt->x = 1.0;//P方向转速
AbsoluteMove->Speed->PanTilt->y = 1.0;//T方向转速
AbsoluteMove->Speed->PanTilt->space = (char*)soap_malloc(soap, 128);
strcpy(AbsoluteMove->Speed->PanTilt->space, "http://www.onvif.org/ver10/schema");

AbsoluteMove->Position->Zoom = (tt__Vector1D*)soap_malloc(soap, sizeof(struct tt__Vector1D));
AbsoluteMove->Position->Zoom->x = 0.7646;//Z
AbsoluteMove->Position->Zoom->space = (char*)soap_malloc(soap, 128);
strcpy(AbsoluteMove->Position->Zoom->space, "http://www.onvif.org/ver10/schema");
AbsoluteMove->Speed->Zoom = (tt__Vector1D*)soap_malloc(soap, sizeof(struct tt__Vector1D));;
AbsoluteMove->Speed->Zoom->x = 1.0;//Z缩放速度
AbsoluteMove->Speed->Zoom->space = (char*)soap_malloc(soap, 128);
strcpy(AbsoluteMove->Speed->Zoom->space, "http://www.onvif.org/ver10/schema");

soap_wsse_add_UsernameTokenDigest(soap, "", UserName.c_str(), PassWord.c_str());
int ret = soap_call___tptz__AbsoluteMove(soap, capa_resp.Capabilities->PTZ->XAddr, NULL, AbsoluteMove, AbsoluteMoveResponse);
if (ret == SOAP_OK)
{
printf("AbsoluteMove----OK\n");
}
...全文
286 点赞 收藏 9
写回复
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
weiguian 2020-11-24
我也很想知道
回复
weiguian 2020-11-23
哦,对的,我把space改了,改成“http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace”和“http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace”这些了,估计我之前的space也不对。可能不加也是可以的。
回复
夏一水@ 2020-11-23
不理解这个space是干什么用的,能给介绍介绍吗?
回复
夏一水@ 2020-11-22
调试好了,不设置spasc就可以使用了
回复
夏一水@ 2020-11-22
我把你的代码完全拷贝过去了,XAddr改成sprintf(endpoint, "http://%s/onvif/PTZ", ip); 其他完全一样,我这个还是返回12,不知道该怎么去调查了
回复
夏一水@ 2020-11-22
我用工具测试了,是支持AbsoluteMove的,代码测试ContinuousMove也是好用的,就是AbsoluteMove移植返回12错误码,特别奇怪
回复
weiguian 2020-11-19
成功了,原来是我的摄像头不支持AbsoluteMove,你可以用ONVIF Device Test Tool工具先测试一下你的摄像头支持不,我换了一个摄像头就好了。
回复
这gsoap得跑一下看看协议通没通再去实现功能,省点时间。
回复
夏一水@ 2020-11-18
楼主,调试成功了吗?我也遇到和你一样的问题,移植返回错误码12,不知道为啥
回复
相关推荐
发帖
其它技术问题
创建于2007-09-28

3843

社区成员

C/C++ 其它技术问题
申请成为版主
帖子事件
创建了帖子
2020-10-22 09:04
社区公告
暂无公告