码迷,mamicode.com
首页 > 编程语言 > 详细

一个基于Gsoap 的ONIVF C++ 库

时间:2014-05-18 05:26:01      阅读:384      评论:0      收藏:0      [点我收藏+]

标签:onvif   gsoap   

https://github.com/xsmart/onvifcpplib

这个库支持ProfileS 和ProfileG,目前还在开发当中,现在已经支持Event

下面是一个客户端的例子

int _tmain(int argc, _TCHAR* argv[])
{
	int ret;
	/* 192.168.1.1 is the NVT, 192.168.1.234 is the NVC */
	string url = "http://192.168.1.1/onvif/device_service";
	/* Below is where to receive the event */
	string eventNotify = "http://192.168.1.234:9090/subscription-2";
	string user = "admin";
	string pass =  "admin";
	OnvifClientDevice onvifDevice(url, user, pass);
	_tds__GetCapabilitiesResponse capabilitiesResponse;

	onvifDevice.GetCapabilities();

	OnvifClientMedia media(onvifDevice);
	_trt__GetProfilesResponse profiles;
	media.GetProfiles(profiles);

	OnvifClientEvent onvifEvent(onvifDevice);

	onvifEvent.Subscribe(eventNotify);
	
	OnvifClientEventNotify notify(soap_new());
	
    if ((ret = soap_bind(&notify, NULL, 9090, 100) == SOAP_INVALID_SOCKET ) ) 
	{
        printf("OnvifClientEventNotify::soap_bind Binding on %d port failed", 9090);
        return 0;
    }

	//Loop to recevie the event
	while(1)
	{
        if( (ret = soap_accept(&notify)) == SOAP_INVALID_SOCKET) {
            printf("soap_accept accepting failed");
            return 0;
        }

        if ( (soap_begin_serve(&notify)) != SOAP_OK) {
            printf("soap_begin_serve serve %d failed", ret);
            continue;
        }

        ret = notify.dispatch();
        continue;
	}
	return 0;
}

一个基于Gsoap 的ONIVF C++ 库,布布扣,bubuko.com

一个基于Gsoap 的ONIVF C++ 库

标签:onvif   gsoap   

原文地址:http://blog.csdn.net/video_dc/article/details/26080525

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!