当前位置:网站首页>海思[Hi3531]onvif协议实现基于gsoap和openssl_代码篇
海思[Hi3531]onvif协议实现基于gsoap和openssl_代码篇
2022-07-21 17:26:00 【I&You】
海思[Hi3531]onvif协议实现基于gsoap和openssl_代码篇
onvif的openssl和gsoap的环境搭建可以参考上一篇
海思[Hi3531]onvif协议实现基于gsoap和openssl
编写代码
直接附上main函数代码
int result = 0;
struct soap soap;
soap_init(&soap);
enum xsd__boolean ForceStorage;
//******************************************************************
char * ip;
char Mediaddr[256] = "";
char profile[256] = "";
struct _tds__GetCapabilities req;
struct _tds__GetCapabilitiesResponse rep;
req.Category = (enum tt__CapabilityCategory *)soap_malloc(&soap, sizeof(int));
//申请4个字节内存
req.__sizeCategory = 1;//元素序列的类型
*(req.Category) = (enum tt__CapabilityCategory)0;//0意味着要获取全部类型信息的枚举
char endpoint[255];
memset(endpoint, '\0', 255);
if (argc > 1)
{
ip = argv[1];
}
else
{
ip = "192.168.1.18";
}
sprintf(endpoint, "http://%s/onvif/device_service", ip);
//这里输入想要获取信息的模块的地址
soap_call___tds__GetCapabilities(&soap, endpoint, NULL, &req, &rep);
if (soap.error)
{
printf("[%s][%d]--->>> soap result: %d, %s, %s\n", __func__, __LINE__,
soap.error, *soap_faultcode(&soap),
*soap_faultstring(&soap));
}
else
{
printf("get capability success\n");
printf("Mediaddr_XAddr====%s\n", rep.Capabilities->Media->XAddr);
strcpy(Mediaddr, rep.Capabilities->Media->XAddr);
}
printf("\n");
return result;
Makefile文件编写
Makefile.inc文件内容:
SHELL = /bin/bash
CC := arm-hisiv500-linux-gcc
CPP := arm-hisiv500-linux-g++
LD := arm-hisiv500-linux-ld
AR := arm-hisiv500-linux-ar
STRIP := strip
CFLAGS += -c -g -Wall -DWITH_DOM -DWITH_OPENSSL -DDEBUG
CFLAGS += $(INCLUDE)
# openssl目录名
OPENSSL_DIR = /usr/local/ssl
# 源文件
SOURCES_ONVIF += \
../onvif/soapC.c \
../onvif/soapClient.c \
../onvif/stdsoap2.c \
../onvif/wsaapi.c \
../onvif/dom.c \
../onvif/mecevp.c \
../onvif/smdevp.c \
../onvif/threads.c \
../onvif/wsseapi.c \
../onvif/duration.c
# 目标文件
OBJECTS_ONVIF := $(patsubst %.c,$(TEMPDIR)%.o,$(filter %.c, $(SOURCES_ONVIF)))
# 头文件路径
INCLUDE += -I../onvif/ \
-I$(OPENSSL_DIR)/include \
# 静态库链接OpenSSL
LDLIBS += $(OPENSSL_DIR)/lib/libssl.a \
$(OPENSSL_DIR)/lib/libcrypto.a \
-ldl -lm \
# 链接库(其他)
LDLIBS += -lpthread
%.o: %.cpp
@echo " CPP " [email protected];
@$(CPP) $(CFLAGS) -c -o [email protected] $<
%.o: %.c
@echo " CC " [email protected];
@$(CC) $(CFLAGS) -c -o [email protected] $<
.PHONY: all clean
makefile文件内容:
include Makefile.inc
PROGRAM = PTZ
SOURCES += myptz.c
OBJECTS := $(patsubst %.c,$(TEMPDIR)%.o,$(filter %.c, $(SOURCES)))
all: $(OBJECTS_ONVIF) $(OBJECTS_COMM) $(OBJECTS)
$(CC) -o $(PROGRAM) $(OBJECTS_ONVIF) $(OBJECTS_COMM) $(OBJECTS) $(LDLIBS)
clean:
rm -f $(OBJECTS_ONVIF)
rm -f $(OBJECTS_COMM)
rm -f $(OBJECTS)
rm -f $(PROGRAM)
烧录程序
编译完成后会生成如图执行文件
如果有网口你可以用nfs文件系统或者tftp传输程序,没的话就用SecureCRT串口传输
边栏推荐
- How to open an account for agricultural futures? Who can open Everbright futures?
- Activiti default model ER diagram
- [C语言] 文件操作《一》
- 指针的深度解刨《五》
- Cloud security daily 220721: Cisco hybrid cloud operation and maintenance management solution found the vulnerability of executing arbitrary commands, which needs to be upgraded as soon as possible
- Vscode add custom comment
- Experimental support for decorators is a feature that is subject to change in a future release. Set
- Soft test intermediate [Database System Engineer] Chapter 2: basic knowledge of program language, self-study soft test notes, overview of program language, basic translation of program language, diffe
- Self study golang [3.8 use go language to find the longest substring without repeated characters] exercise code
- 胜率高达93.98%的TPS交易策略
猜你喜欢
Experimental support for decorators is a feature that is subject to change in a future release. Set
指针深度解刨《三》(数组的认知)
Weak foundation, shaking earth and mountains, Niu Ke brushes the title "II"
Self study golang [3.8 use go language to find the longest substring without repeated characters] exercise code
文件操作《二》(5000字总结篇)
vscode 配置代码自动格式化加修复
How does pytorch convert a variable or tensor to numpy?
Ten year traders' heavy recommendation: simple and easy to operate breakthrough callback strategy
不断提升认知,从而达到交易的最高级别——稳定盈利(终)
更新版本号和静态资源(web内嵌页面的存放地址)
随机推荐
js 判断数据是否为空
函数栈帧的形成和销毁(26张图助你深入理解函数栈帧)
量化交易中的三类行情
Several applications of Martin strategy
Vscode add custom comment
Original one bit multiplier
In quantitative trading, it is judged by the moving average system that the upward (downward) momentum is weakened
v-7
Cannot read property ‘type‘ of undefined Occurred while linting **\index.jsx:1
The foundation of writing notes in C language is not solid, and the earth is shaking
What is RPA? Recommend automated tools that allow e-commerce operators to operate 10 times more efficiently
Excel中时间戳和时间的转换
Quantify three types of market in trading
2022年华泰开户网上办理安全吗?
【踩坑】npm安装报错解决办法
指针的深度解刨《七》(函数指针相关知识)
QML drag pictures and objects across windows
scrollIntoView
IO 模型详解(通俗易懂)
MySQL builds temporary tables through parameters