GB28181平台、视频监控平台
依照GB/T28181国标实现的一个GB28181接入功能,局域网里的监控摄像头只要连网,就可以接入到该平台,实现远程控制和调阅。
可以对监控视频流进行转发,用于其他业务平台的集成调用,也可以转发给 AI智能分析系统,用于进一步分析和智能化使用,用于智慧城市、智慧交通、智慧园区、智慧农业、智慧林业等。
hi_s32 main(int argc, char *argv[])
{
LOGI("GB28281 start \n");
srand((int)time(NULL)); //每次执行种子不同,生成不同的随机数
initConfig();//读取配置参数文件
// char parameter[20]="clientUa=",value[30]={'\0'};
// // readConfigFile(parameter,value);
// writeConfigFile(parameter,"hbuas");
// initConfig();//读取配置参数文件
sipServerInit(&sipServerConfig);
sipClientInit(&sipClientConfig);
if(init_sip_client(&sipClientConfig,&sipServerConfig) != 0)
{
LOGI("init_sip_client failed \n");
}
static hi_bool allowReg = HI_TRUE;
hi_u64 lastKeepaliveTimestamp = 0;
hi_u64 curTimestamp = 0;
hi_u64 interval = 3000;// 客户端发送keepalive检测的间隔,单位:毫秒
while(!sipClientConfig.quit)
{
// 首次发起注册
if (allowReg && !sipClientConfig.mRegistered) {
allowReg = HI_FALSE;
if(request_register(&sipClientConfig,&sipServerConfig) != 0)
{
LOGI("request_register failed \n");
}
sleep(5);
}
// 心跳机制 start (开发过程中,为防止影响抓包,可以先注释)
if(sipClientConfig.mRegistered){
curTimestamp = getCurTimestamp();
if(lastKeepaliveTimestamp == 0){
lastKeepaliveTimestamp = curTimestamp;
} else {
if((curTimestamp - lastKeepaliveTimestamp) > interval){
request_message_keepalive(&sipClientConfig,&sipServerConfig);
lastKeepaliveTimestamp = curTimestamp;
}
}
}
// 心跳机制 end
eXosip_event_t* evtp = eXosip_event_wait(sipClientConfig.mSipCtx, 0, 20);
if (!evtp) {
eXosip_automatic_action(sipClientConfig.mSipCtx);
osip_usleep(100000);
continue;
}
eXosip_automatic_action(sipClientConfig.mSipCtx);
sip_event_handle(evtp,&sipClientConfig,&sipServerConfig);
eXosip_event_free(evtp); // 释放
}
printf("hello AAA \n");
}