利用gSoap搭建ONVIF客户端代码框架

搭建 ONVIF IPC客户端开发框架

基本环境搭建

系统:Vmware workstations 安装ubuntu系统,系统版本:ubutu 18.04.3 LTS。
软件:安装gcc、g++、make、openssl、ssh2等基本工具。

下载gSoap源码

gSoap 工具下载地址:http://sourceforge.net/projects/gsoap2
下载gSoap工具的版本是:gsoap_2.8.97

gSoap源码编译

3.1 源码解压

unzip gsoap_2.8.97.zip  #源码解压

3.2 安装gSoap编译依赖工具

3.2.1 阅读gSoap解压的INSTALL.txt文件中,关于《Installing gSOAP on Unix/Linux》的说明,防止安装出现问题,先检查下依赖是否安装,依赖的工具如下:

- Automake tools installed (make and GNU m4)
- Bison installed from www.gnu.org/software/bison or Yacc
- Flex installed from flex.sourceforge.net
- OpenSSL from www.openssl.org or GNUTLS from www.gnu.org/software/gnutls
- Optionally Zlib to support compression from www.zlib.net.

3.2.2 在步骤1已经安装过make工具,所以先安装Bison工具:

apt-get install bison

3.2.3 安装Flex工具

apt-get install flex

3.2.4 安装OpenSSL

apt-get install openssl 

在这里插入图片描述
发现系统已经自带了openssl工具,且是最新的openssl库,满足INSTALL.txt的要求,故不需要安装openssl了。

3.2.5 安装zlib工具

apt-get install zlib1g-dev  #注:zlib工具的名称是zlib1g-dev,而不是zlib

3.2.6 gSoap源码编译

cd gsoap-2.8/
./configure --with-openssl
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用gSOAP生成ONVIF框架代码需要遵循以下步骤: 1. 下载gSOAP工具包并安装到本地。 2. 下载ONVIF设备WSDL文件,例如https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl。 3. 使用gSOAP工具包中的wsdl2h工具将WSDL文件转换为头文件。 4. 使用soapcpp2工具生成ONVIF框架代码,例如: ```bash soapcpp2 -Iimport devicemgmt.h ``` 5. 在生成的代码中实现ONVIF设备的具体操作。 以下是在Linux系统中使用gSOAP生成ONVIF框架代码的示例: 1. 下载gSOAP工具包并安装到本地: ```bash wget https://sourceforge.net/projects/gsoap2/files/gSOAP/gsoap_2.8.112.zip unzip gsoap_2.8.112.zip cd gsoap-2.8 ./configure make sudo make install ``` 2. 下载ONVIF设备WSDL文件: ```bash wget https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl ``` 3. 使用wsdl2h工具将WSDL文件转换为头文件: ```bash wsdl2h -o onvif.h devicemgmt.wsdl ``` 4. 使用soapcpp2工具生成ONVIF框架代码: ```bash soapcpp2 -Iimport onvif.h ``` 5. 在生成的代码中实现ONVIF设备的具体操作。 在生成的代码中,每个ONVIF操作都有对应的函数,例如`SOAP_FMAC5 int SOAP_FMAC6 __tds__GetDeviceInformation(struct soap* soap, _tds__GetDeviceInformation* tds__GetDeviceInformation, _tds__GetDeviceInformationResponse &tds__GetDeviceInformationResponse)`就是获取设备信息的函数。您可以在这些函数中实现具体的操作。 另外,生成的代码中还有一些辅助函数和结构体,您也可以根据需要使用它们。 例如,以下代码片段演示了如何创建一个SOAP客户端并调用`__tds__GetDeviceInformation`函数: ```c++ #include "soapDeviceBindingProxy.h" const char* endpoint = "http://192.168.1.100/onvif/device_service"; DeviceBindingProxy proxy; proxy.soap_endpoint = endpoint; _tds__GetDeviceInformation tds__GetDeviceInformation; _tds__GetDeviceInformationResponse tds__GetDeviceInformationResponse; proxy.__tds__GetDeviceInformation(&tds__GetDeviceInformation, tds__GetDeviceInformationResponse); // 处理返回值 ``` 在使用时,需要将`endpoint`替换为实际的设备IP地址和ONVIF服务端口号。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值