• 大小: 54.75MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-05-24
  • 语言: C/C++
  • 标签: onvif  

资源简介

onvif 客户端demo,实现设备信息获取,告警订阅等功能,大华可直接测试使用 Windows操作系统下,VS 2010 C++

资源截图

代码片段和文件信息

// test.cpp : Defines the entry point for the console application.
//

#include “stdafx.h“
#include 
#include “OnvifAPIAll/DeviceBinding.nsmap“
#include “OnvifAPIAll/wsseapi.h“
#include “OnvifAPIAll/wsaapi.h“

#include “OnvifAPIAll/soapDeviceBindingProxy.h“
#include “OnvifAPIAll/soapMediaBindingProxy.h“
#include “OnvifAPIAll/soapPTZBindingProxy.h“

#include “OnvifAPIAll/soapEventBindingProxy.h“
#include “OnvifAPIAll/soapNotificationProducerBindingProxy.h“
#include “OnvifAPIAll/soapDiscoveryLookupBindingProxy.h“

using namespace std;

#pragma comment(lib“Rpcrt4.lib“)


#define DEV_PASSWORD “admin“
#define MAX_HOSTNAME_LEN 128

void PrintErr(struct soap* _psoap)
{
fflush(stdout);
fprintf(stdout“error:%d faultstring:%s faultcode:%s faultsubcode:%s faultdetail:%s\r\n“_psoap->error*soap_faultstring(_psoap)*soap_faultcode(_psoap)
*soap_faultsubcode(_psoap)*soap_faultdetail(_psoap));
}

int _tmain(int argc char* argv[])
{

bool blSupportPTZ = false;
char szHostName[MAX_HOSTNAME_LEN] = {0};

DeviceBinding proxyDevice;

MediaBinding proxyMedia;

PTZBinding proxyPTZ;

EventBinding proxyEvent;
NotificationProducerBinding proxyNP;

if (argc > 1)
{
strcat(szHostName“http://“);
strcat(szHostNameargv[1]);
strcat(szHostName“/onvif/device_service“);

proxyDevice.endpoint = szHostName;
}
else
{
proxyDevice.endpoint = “http://172.16.12.197/onvif/device_service“;
}

/*soap_register_plugin(proxyDevice.soapsoap_wsse);
soap_register_plugin(proxyMedia.soapsoap_wsse);
soap_register_plugin(proxyPTZ.soapsoap_wsse);
soap_register_plugin(proxyEvent.soapsoap_wsse);
soap_register_plugin(proxyNP.soapsoap_wsse);

soap_register_plugin(proxyEvent.soapsoap_wsa);
soap_register_plugin(proxyNP.soapsoap_wsa);*/

struct soap *soap = soap_new();

//if(SOAP_OK != soap_wsse_add_UsernameTokenDigest(proxyDevice.soap NULL “admin“ DEV_PASSWORD))
//{
// return -1;
//}

//if(SOAP_OK != soap_wsse_add_Timestamp(proxyDevice.soap “Time“ 10)) // 10 seconds lifetime
//{
// return -1;
//}

#if 1
//Get WSDL URL
_tds__GetWsdlUrl *tds__GetWsdlUrl = soap_new__tds__GetWsdlUrl(soap-1);
_tds__GetWsdlUrlResponse *tds__GetWsdlUrlResponse = soap_new__tds__GetWsdlUrlResponse(soap-1);

if(SOAP_OK == proxyDevice.__tds__GetWsdlUrl(tds__GetWsdlUrltds__GetWsdlUrlResponse))
{
//fflush(stdout);
fprintf(stdout“-------------------WsdlUrl-------------------\r\n“);
fprintf(stdout“WsdlUrl:%s\r\n “tds__GetWsdlUrlResponse->WsdlUrl.c_str());
}
else
{
PrintErr(proxyDevice.soap);
}

soap_destroy(soap); // remove deserialized class instances (C++ only)
soap_end(soap); // clean up and remove deserialized data

#endif
  /*if(SOAP_OK != soap_wsse_add_UsernameTokenDigest(proxyDevice.soap NULL “admin“ DEV_PASSWORD))
  {
  return -1;
  }*/

//Capability exchange
_tds__GetCapabilities *tds__GetCapabilities = soap_new__tds__

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    1025536  2009-04-29 02:35  OnvifClient\Debug\libeay32.dll

     文件    6880256  2014-05-26 11:24  OnvifClient\Debug\OnvifClient.exe

     文件    8730744  2014-05-26 11:24  OnvifClient\Debug\OnvifClient.ilk

     文件    3582734  2014-05-26 11:24  OnvifClient\Debug\OnvifClient.map

     文件   34008064  2014-05-26 11:24  OnvifClient\Debug\OnvifClient.pdb

     文件     200704  2009-04-29 02:36  OnvifClient\Debug\ssleay32.dll

     文件  104267776  2014-05-26 11:23  OnvifClient\ipch\onvifclient-b7060d4f\onvifclient-425a772d.ipch

     文件      20478  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\cl.command.1.tlog

     文件     624816  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\CL.read.1.tlog

     文件       6258  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\CL.write.1.tlog

     文件     126756  2014-05-14 10:34  OnvifClient\OnvifClient\Debug\dom.obj

     文件     121324  2014-05-14 10:34  OnvifClient\OnvifClient\Debug\duration.obj

     文件          2  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link-cvtres.read.1.tlog

     文件          2  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link-cvtres.write.1.tlog

     文件          2  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link.7844-cvtres.read.1.tlog

     文件          2  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link.7844-cvtres.write.1.tlog

     文件          2  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link.7844.read.1.tlog

     文件          2  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link.7844.write.1.tlog

     文件       6626  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link.command.1.tlog

     文件      12994  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link.read.1.tlog

     文件       3922  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\link.write.1.tlog

     文件     427301  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\main.obj

     文件        842  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\mt.command.1.tlog

     文件        770  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\mt.read.1.tlog

     文件        378  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\mt.write.1.tlog

     文件        406  2014-05-05 16:22  OnvifClient\OnvifClient\Debug\OnvifClient.exe.embed.manifest

     文件        472  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\OnvifClient.exe.embed.manifest.res

     文件        381  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\OnvifClient.exe.intermediate.manifest

     文件         48  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\OnvifClient.lastbuildstate

     文件       5759  2014-05-26 11:24  OnvifClient\OnvifClient\Debug\OnvifClient.log

............此处省略2458个文件信息

评论

共有 条评论