/******************************************************************************
* 函数名称: soap_tr2_get_profiles_handle()
* 函数描述: tr2:GetProfiles 请求的处理函数
* 输 入: soap -- soap结构体
* 输 出: N/A
* 返 回 值: ERROR/OK
******************************************************************************/
LOCAL S32 soap_tr2_get_profiles_handle(SOAP_CONTEXT *soap)
{
S32 ret = OK;
S32 i = 0;
void *ptrs_to_free[ONVIF_MAX_FREE_NUM] = {0};
TR2_GET_PROFILES_RESPONSE profile_res = {0};
char data_path[LEN_INFO] = {0};
ONVIF_PROFILE onvif_profile[TR2_PROFILE_NUM];
ONVIF_VSCONF onvif_vsconf[TR2_PROFILE_NUM];
VIDEO_MAIN video_main;
VIDEO_MINOR video_minor;
char *name;
char *encode_type;
char *resolution;
U32 framerate;
U16 bitrate;
BITRATE_TYPE bitrate_type;
U8 quality;
MOTION_DETECT md;
OD_ALARM od;
TT_CONFIG *ma_module = NULL;
TT_CONFIG *ta_module = NULL;
TT_CONFIG *motion_rule = NULL;
TT_CONFIG *tamper_rule = NULL;
char *md_region = NULL;
TR2_MEDIA_PROFILE* cur_profile = NULL;
TT_VIDEO_SOURCE_CONFIG* cur_video_source = NULL;
TT_VIDEO_ENCODER_2_CONFIG* cur_video_encoder = NULL;
TT_VIDEO_ANALYTICS_CONFIG* cur_analytics = NULL;
#ifdef AUDIO_ENABLE
ONVIF_ASCONF onvif_asconf[TR2_PROFILE_NUM];
AUDIO_CONFIG_MICROPHONE audio_mic;
TT_AUDIO_SOURCE_CONFIG* cur_audio_source = NULL;
TT_AUDIO_ENCODER_2_CONFIG* cur_audio_encoder = NULL;
#endif
#if 0
TT_PTZ_CONFIG* cur_PTZ = NULL;
TT_METADATA_CONFIG* cur_metadata = NULL;
TT_AUDIO_OUTPUT_CONFIG* cur_audio_output = NULL;
TT_AUDIO_DECODER_CONFIG* cur_audio_decoder = NULL;
#endif
if (soap == NULL)
{
ONVIF_WARN("soap == NULL.");
return ERROR;
}
if (OK != soap_usernametoken_auth(soap, UM_NORMAL_USER))
{
ONVIF_TRACE("Auth failed\n");
soap_fault(soap, "SOAP-ENV:Sender", "ter:NotAuthorized", NULL, "Authority failure");
soap->error = 400;
return ERROR;
}
if (NULL == (md_region = md_get_active_cells_alloc_no_json()))
{
ONVIF_ERROR("md get active_cels failed.");
return ERROR;
}
if (ERROR == register_ptrs_to_free(md_region, ptrs_to_free, ONVIF_MAX_FREE_NUM))
{
ONVIF_ERROR("register_ptrs_to_free failed.");
ret = ERROR;
goto free_out;
}
memset(&profile_res, 0, sizeof(TR2_GET_PROFILES_RESPONSE));
profile_res.size = TR2_PROFILE_NUM; /* profile_1 and profile_2 */
if (NULL == (profile_res.profiles = MALLOC_AND_REGISTER(TR2_MEDIA_PROFILE,
profile_res.size, ptrs_to_free, ONVIF_MAX_FREE_NUM)))
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
if (0 == ds_read(VIDEO_MAIN_PATH, &video_main, sizeof(VIDEO_MAIN)))
{
ONVIF_ERROR("ds_read %s failed.", VIDEO_MAIN_PATH);
ret = ERROR;
goto free_out;
}
if (0 == ds_read(VIDEO_MINOR_PATH, &video_minor, sizeof(VIDEO_MINOR)))
{
ONVIF_ERROR("ds_read %s failed.", VIDEO_MINOR_PATH);
ret = ERROR;
goto free_out;
}
#ifdef AUDIO_ENABLE
if (0 == ds_read(AUDIO_CONFIG_MICROPHONE_PATH, &audio_mic, sizeof(AUDIO_CONFIG_MICROPHONE)))
{
ONVIF_ERROR("ds_read %s failed.", AUDIO_CONFIG_MICROPHONE_PATH);
ret = ERROR;
goto free_out;
}
#endif
if (0 == ds_read(MOTION_DETECT_PATH, &md, sizeof(MOTION_DETECT)))
{
ONVIF_ERROR("ds_read %s failed.", MOTION_DETECT_PATH);
ret = ERROR;
goto free_out;
}
if (0 == ds_read(OD_ALARM_PATH, &od, sizeof(OD_ALARM)))
{
ONVIF_ERROR("ds_read %s failed.", OD_ALARM_PATH);
ret = ERROR;
goto free_out;
}
for (i = 0; i < profile_res.size; ++i)
{
/* profile */
memset(&onvif_profile[i], 0, sizeof(ONVIF_PROFILE));
snprintf(data_path, LEN_INFO, "/onvif/profile_%d", i + 1);
if (0 == ds_read((const char*)data_path, &onvif_profile[i], sizeof(ONVIF_PROFILE)))
{
ONVIF_ERROR("ds_read %s failed.", data_path);
ret = ERROR;
goto free_out;
}
cur_profile = &profile_res.profiles[i];
cur_profile->name = onvif_profile[i].name;
cur_profile->token = onvif_profile[i].token;
cur_profile->fixed = onvif_profile[i].fixed;
/* video source */
memset(&onvif_vsconf[i], 0, sizeof(ONVIF_VSCONF));
snprintf(data_path, LEN_INFO, "/onvif/%s", onvif_profile[i].vsconf);
if (0 == ds_read((const char*)data_path, &onvif_vsconf[i], sizeof(ONVIF_VSCONF)))
{
ONVIF_ERROR("ds_read %s failed.", data_path);
ret = ERROR;
goto free_out;
}
if (NULL == (cur_profile->configurations.video_source = MALLOC_AND_REGISTER(
TT_VIDEO_SOURCE_CONFIG, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM)))
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_video_source = cur_profile->configurations.video_source;
cur_video_source->name = onvif_vsconf[i].name;
cur_video_source->use_count = onvif_vsconf[i].uCount;
cur_video_source->token = onvif_vsconf[i].token;
cur_video_source->source_token = onvif_vsconf[i].sToken;
cur_video_source->bounds = MALLOC_AND_REGISTER(TT_INT_RECTANGLE,
1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cur_video_source->bounds)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_video_source->bounds->x = onvif_vsconf[i].bX;
cur_video_source->bounds->y = onvif_vsconf[i].bY;
cur_video_source->bounds->width = onvif_vsconf[i].bW;
cur_video_source->bounds->height = onvif_vsconf[i].bH;
/* video encoder */
if (0 == strcmp(onvif_profile[i].veconf, "main"))
{
name = video_main.name;
encode_type = video_main.encode_type;
resolution = video_main.resolution;
framerate = video_main.frame_rate;
bitrate = video_main.bitrate;
bitrate_type = video_main.bitrate_type;
quality = video_main.quality;
}
else
{
name = video_minor.name;
encode_type = video_minor.encode_type;
resolution = video_minor.resolution;
framerate = video_minor.frame_rate;
bitrate = video_minor.bitrate;
bitrate_type = video_minor.bitrate_type;
quality = video_minor.quality;
}
if (NULL == (cur_profile->configurations.video_encoder = MALLOC_AND_REGISTER(
TT_VIDEO_ENCODER_2_CONFIG, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM)))
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_video_encoder = cur_profile->configurations.video_encoder;
cur_video_encoder->name = name;
cur_video_encoder->use_count = 1;
if (0 == strcmp(encode_type, "H264"))
{
cur_video_encoder->encoding = TR2_VIDEO_ENCODING_MIME_NAME_H264;
}
else if (0 == strcmp(encode_type, "H265"))
{
cur_video_encoder->encoding = TR2_VIDEO_ENCODING_MIME_NAME_H265;
}
else
{
ONVIF_ERROR("unknown encode type.");
ret = ERROR;
goto free_out;
}
if (2 != sscanf(resolution, "%d*%d",
&cur_video_encoder->resolution.width, &cur_video_encoder->resolution.height))
{
ret = ERROR;
goto free_out;
}
if(1 != framerate >> 16)
{
cur_video_encoder->rate_control.frame_rate_limit = 1;
}
else
{
cur_video_encoder->rate_control.frame_rate_limit = framerate & 0x0000ffff;
}
cur_video_encoder->rate_control.bitrate_limit = bitrate;
if (BITRATE_TYPE_CBR == bitrate_type)
{
cur_video_encoder->rate_control.constant_bitrate = TRUE;
}
else
{
cur_video_encoder->rate_control.constant_bitrate = FALSE;
}
cur_video_encoder->multicast.address = MALLOC_AND_REGISTER(TT_IP_ADDRESS,
1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cur_video_encoder->multicast.address)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_video_encoder->multicast.address->ipv4_address = "0.0.0.0";
cur_video_encoder->multicast.address->ipv6_address = NULL;
cur_video_encoder->multicast.address->type = 0;
cur_video_encoder->multicast.port = 0;
cur_video_encoder->multicast.ttl = 0;
cur_video_encoder->multicast.auto_start = 0;
cur_video_encoder->quality = quality;
cur_video_encoder->gov_length = VIDEO_H264_GOV;
cur_video_encoder->token = onvif_profile[i].veconf;
#ifdef AUDIO_ENABLE
/* audio source */
memset(&onvif_asconf[i], 0, sizeof(ONVIF_ASCONF));
snprintf(data_path, LEN_INFO, "/onvif/%s", onvif_profile[i].asconf);
if (0 == ds_read((const char*)data_path, &onvif_asconf[i], sizeof(ONVIF_ASCONF)))
{
ONVIF_ERROR("ds_read %s failed.", data_path);
ret = ERROR;
goto free_out;
}
if (NULL == (cur_profile->configurations.audio_source = MALLOC_AND_REGISTER(
TT_AUDIO_SOURCE_CONFIG, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM)))
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_audio_source = cur_profile->configurations.audio_source;
cur_audio_source->name = onvif_asconf[i].name;
cur_audio_source->use_count = onvif_asconf[i].uCount;
cur_audio_source->token = onvif_asconf[i].token;
cur_audio_source->source_token = onvif_asconf[i].sToken;
/* audio encoder */
if (NULL == (cur_profile->configurations.audio_encoder = MALLOC_AND_REGISTER(
TT_AUDIO_ENCODER_2_CONFIG, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM)))
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_audio_encoder = cur_profile->configurations.audio_encoder;
if (0 == strcmp("G711alaw", audio_mic.encode_type))
{
cur_audio_encoder->encoding = AUDIO_ENCODING_TYPE_G711;
}
else if (0 == strcmp("G711ulaw", audio_mic.encode_type))
{
cur_audio_encoder->encoding = AUDIO_ENCODING_TYPE_G711;
}
else if (0 == strcmp("G711", audio_mic.encode_type))
{
cur_audio_encoder->encoding = AUDIO_ENCODING_TYPE_G711;
}
else if (0 == strcmp("G726", audio_mic.encode_type))
{
cur_audio_encoder->encoding = AUDIO_ENCODING_TYPE_G726;
}
else if (0 == strncmp("AAC", audio_mic.encode_type, 3))
{
cur_audio_encoder->encoding = AUDIO_ENCODING_TYPE_AAC;
}
else
{
ret = ERROR;
goto free_out;
}
cur_audio_encoder->multicast.address = MALLOC_AND_REGISTER(TT_IP_ADDRESS,
1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cur_audio_encoder->multicast.address)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_audio_encoder->multicast.address->ipv4_address = "0.0.0.0";
cur_audio_encoder->multicast.address->ipv6_address = NULL;
cur_audio_encoder->multicast.address->type = 0;
cur_audio_encoder->multicast.port = 0;
cur_audio_encoder->multicast.ttl = 0;
cur_audio_encoder->multicast.auto_start = 0;
cur_audio_encoder->bitrate = audio_mic.bitrate * 1024;
cur_audio_encoder->sample_rate = audio_mic.sampling_rate * 1000;
cur_audio_encoder->token = MALLOC_AND_REGISTER(char, ONVIF_PROFILE_INFO_LEN + 1,
ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cur_audio_encoder->token)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
strncpy(cur_audio_encoder->token, onvif_asconf[i].sToken, ONVIF_PROFILE_INFO_LEN + 1);
cur_audio_encoder->name = MALLOC_AND_REGISTER(char, 2 * ONVIF_PROFILE_INFO_LEN + 1,
ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cur_audio_encoder->name)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
strncpy(cur_audio_encoder->name, onvif_asconf[i].name, 2 * ONVIF_PROFILE_INFO_LEN + 1);
cur_audio_encoder->use_count = onvif_asconf[i].uCount;
#endif
/* analytics */
if (NULL == (cur_profile->configurations.analytics = MALLOC_AND_REGISTER(
TT_VIDEO_ANALYTICS_CONFIG, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM)))
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_analytics = cur_profile->configurations.analytics;
cur_analytics->name = "VideoAnalyticsName";
cur_analytics->use_count = 2;
cur_analytics->token = "VideoAnalyticsToken";
if (NULL == (cur_analytics->analytics_engine_config =
MALLOC_AND_REGISTER(TT_ANALYTICS_ENGINE_CONFIG, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM)))
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_analytics->analytics_engine_config->size_analytics_module = 2;
cur_analytics->analytics_engine_config->analytics_module =
MALLOC_AND_REGISTER(TT_CONFIG,
cur_analytics->analytics_engine_config->size_analytics_module, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cur_analytics->analytics_engine_config->analytics_module)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
/* AnalyticsModule-MyCellMotionModule*/
ma_module = &cur_analytics->analytics_engine_config->analytics_module[0];
ma_module->name = "MyCellMotionModule";
ma_module->type = "tt:CellMotionEngine";
ma_module->parameters =
MALLOC_AND_REGISTER(TT_ITEM_LIST, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == ma_module->parameters)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
ma_module->parameters->element_item_cnt = 1;
ma_module->parameters->simple_item_cnt = 2;
ma_module->parameters->simple_item =
MALLOC_AND_REGISTER(TT_ITEM_LIST_SIMPLE,
ma_module->parameters->simple_item_cnt, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == ma_module->parameters->simple_item)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
strncpy(ma_module->parameters->simple_item[0].name, "Sensitivity", LEN_INFO);
snprintf(ma_module->parameters->simple_item[0].value, LEN_INFO, "%d", md.digital_sensitivity);
strncpy(ma_module->parameters->simple_item[1].name, "Enabled", LEN_INFO);
snprintf(ma_module->parameters->simple_item[1].value, LEN_INFO, "%s", md.enabled?"on":"off");
ma_module->parameters->element_item = MALLOC_AND_REGISTER(
TT_ITEM_LIST_ELEMENT, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == ma_module->parameters->element_item)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
strncpy(ma_module->parameters->element_item->name, "Layout", LEN_INFO);
/* celllayout */
TT_CELL_LAYOUT *cell_layout = MALLOC_AND_REGISTER(
TT_CELL_LAYOUT, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cell_layout)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cell_layout->columns = CELL_LAYOUT_COLS_STR;
cell_layout->rows= CELL_LAYOUT_ROWS_STR;
cell_layout->transformation = MALLOC_AND_REGISTER(
TT_TRANSFORMATION, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cell_layout->transformation)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cell_layout->transformation->translate = MALLOC_AND_REGISTER(
TT_VECTOR, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cell_layout->transformation->translate)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cell_layout->transformation->translate->x =
MALLOC_AND_REGISTER(float, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
cell_layout->transformation->translate->y =
MALLOC_AND_REGISTER(float, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
*(cell_layout->transformation->translate->x) = -1;
*(cell_layout->transformation->translate->y) = -1;
cell_layout->transformation->scale =
MALLOC_AND_REGISTER(TT_VECTOR, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cell_layout->transformation->scale)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cell_layout->transformation->scale->x =
MALLOC_AND_REGISTER(float, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
cell_layout->transformation->scale->y =
MALLOC_AND_REGISTER(float, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
*(cell_layout->transformation->scale->x) = 0.09f;
*(cell_layout->transformation->scale->y) = 0.11f;
/* get cell_layout string */
ONVIF_BUF tmp_xml_buf = {0};
char *tmp_str = NULL;
S32 tmp_xml_buf_size = 0;
if (OK != onvif_create_buf(&tmp_xml_buf, ONVIF_DISCV_BUF_LEN))
{
ONVIF_ERROR("create tmp xml buf error..");
tmp_xml_buf.start = NULL;
tmp_xml_buf.last = NULL;
tmp_xml_buf.end = NULL;
ret = ERROR;
goto free_out;
}
if (OK != soap_out_tt_cell_layout(&tmp_xml_buf, cell_layout))
{
ONVIF_ERROR("soap_out_tt_cell_layout error..");
onvif_free_buf(&tmp_xml_buf);
ret = ERROR;
goto free_out;
}
tmp_xml_buf_size = tmp_xml_buf.last - tmp_xml_buf.start + 1;
tmp_str = MALLOC_AND_REGISTER(char, tmp_xml_buf_size, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == tmp_str)
{
ONVIF_ERROR("malloc_and_register failed.");
onvif_free_buf(&tmp_xml_buf);
ret = ERROR;
goto free_out;
}
strncpy(tmp_str, (char *)tmp_xml_buf.start, tmp_xml_buf_size);
onvif_free_buf(&tmp_xml_buf);
ma_module->parameters->element_item->any = tmp_str;
/* AnalyticsModule MyTamperDetecModule*/
ta_module = &cur_analytics->analytics_engine_config->analytics_module[1];
ta_module->name = "MyTamperDetecModule";
ta_module->type= "tt:TamperEngine";
ta_module->parameters = MALLOC_AND_REGISTER(TT_ITEM_LIST, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == ta_module->parameters)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
ta_module->parameters->simple_item_cnt = 2;
ta_module->parameters->simple_item = MALLOC_AND_REGISTER(
TT_ITEM_LIST_SIMPLE, ta_module->parameters->simple_item_cnt, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == ta_module->parameters->simple_item)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
strncpy(ta_module->parameters->simple_item[0].name, "Sensitivity", LEN_INFO);
snprintf(ta_module->parameters->simple_item[0].value, LEN_INFO, "%d", od.digital_sensitivity);
strncpy(ta_module->parameters->simple_item[1].name, "Enabled", LEN_INFO);
snprintf(ta_module->parameters->simple_item[1].value, LEN_INFO, "%s", od.enabled?"on":"off");
/* RuleEngineConfiguration */
cur_analytics->rule_engine_config = MALLOC_AND_REGISTER(TT_RULE_ENGINE_CONFIG, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cur_analytics->rule_engine_config )
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
cur_analytics->rule_engine_config->size_rule= 2;
cur_analytics->rule_engine_config->rule = MALLOC_AND_REGISTER(TT_CONFIG,
cur_analytics->rule_engine_config->size_rule, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == cur_analytics->rule_engine_config->rule)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
/* MyMotionDetectorRule */
motion_rule = &cur_analytics->rule_engine_config->rule[0];
motion_rule->name = "MyMotionDetectorRule";
motion_rule->type = "tt:CellMotionDetector";
motion_rule->parameters = MALLOC_AND_REGISTER(TT_ITEM_LIST, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == motion_rule->parameters)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
motion_rule->parameters->element_item_cnt = 0;
motion_rule->parameters->simple_item_cnt = 4;
motion_rule->parameters->simple_item = MALLOC_AND_REGISTER(TT_ITEM_LIST_SIMPLE,
motion_rule->parameters->simple_item_cnt, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == motion_rule->parameters->simple_item)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
strncpy(motion_rule->parameters->simple_item[0].name, "ActiveCells", LEN_INFO);
strncpy(motion_rule->parameters->simple_item[0].value, md_region, LEN_INFO);
strncpy(motion_rule->parameters->simple_item[1].name, "MinCount", LEN_INFO);
strncpy(motion_rule->parameters->simple_item[1].value, "5", LEN_INFO);
strncpy(motion_rule->parameters->simple_item[2].name, "AlarmOnDelay", LEN_INFO);
strncpy(motion_rule->parameters->simple_item[2].value, "1000", LEN_INFO);
strncpy(motion_rule->parameters->simple_item[3].name, "AlarmOffDelay", LEN_INFO);
strncpy(motion_rule->parameters->simple_item[3].value, "1000", LEN_INFO);
/* MyTamperDetectorRule */
tamper_rule = &cur_analytics->rule_engine_config->rule[1];
tamper_rule->name = "MyTamperDetectorRule";
tamper_rule->type = "tt:TamperDetector";
tamper_rule->parameters = MALLOC_AND_REGISTER(TT_ITEM_LIST, 1, ptrs_to_free, ONVIF_MAX_FREE_NUM);
if (NULL == tamper_rule->parameters)
{
ONVIF_ERROR("malloc_and_register failed.");
ret = ERROR;
goto free_out;
}
tamper_rule->parameters->element_item_cnt = 0;
tamper_rule->parameters->simple_item_cnt = 0;
/* PTZ */
/* metadata */
/* audio_output */
/* audio_decoder */
}
ret = soap_generate_xml((p_out_fun)(soap_out_tr2_get_profiles_rsp), soap, &profile_res);
free_out:
free_ptrs(ptrs_to_free, ONVIF_MAX_FREE_NUM);
return ret;
}
解释代码
最新发布