|
|
|
@ -431,225 +431,167 @@ void _csg_reboot_recv(char *pkt)
|
|
|
|
|
说明:修改本地ip 设备ID 服务器地址时需要重启。
|
|
|
|
|
*/
|
|
|
|
|
int32_t _csg_dev_info_set_recv(char *pkt)
|
|
|
|
|
{
|
|
|
|
|
int change_ip = 0;
|
|
|
|
|
REBOOT_MSG boottype = REBOOT_NONE;
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
csg_dev_info_t *pinfo = (csg_dev_info_t *)(pkt + CSG_HEAD_LEN);
|
|
|
|
|
device_info.dev_id = pinfo->dev_id;
|
|
|
|
|
device_info.mask = pinfo->mask;
|
|
|
|
|
device_info.gw = pinfo->gw;
|
|
|
|
|
|
|
|
|
|
if (strncmp((char *)(pinfo->hostname), device_info.hostname, sizeof(device_info.hostname)))
|
|
|
|
|
{
|
|
|
|
|
snprintf((char*)device_info.hostname, FILE_NAME_LEN, "%s", pinfo->hostname);
|
|
|
|
|
boottype = REBOOT_REMOTE_HOST_NAME_CHANGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (device_info.ip != pinfo->ip)
|
|
|
|
|
{
|
|
|
|
|
device_info.ip = pinfo->ip;
|
|
|
|
|
change_ip++;
|
|
|
|
|
boottype = REBOOT_REMOTE_IP_CHANGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (csg.server_ip != pinfo->server_ipv4)
|
|
|
|
|
{
|
|
|
|
|
csg.server_ip = pinfo->server_ipv4;
|
|
|
|
|
boottype = REBOOT_REMOTE_SERVER_IP_CHANGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (csg.server_port != pinfo->server_port)
|
|
|
|
|
{
|
|
|
|
|
csg.server_port = pinfo->server_port;
|
|
|
|
|
boottype = REBOOT_REMOTE_SERVER_IP_CHANGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
csg_ack_t ack = {0};
|
|
|
|
|
ack.result = TRUE;
|
|
|
|
|
memcpy(pkt + sizeof(csg_pkt_head_t), (char *)&ack, sizeof(csg_ack_t));
|
|
|
|
|
_csg_send_data(CSG_REPLY, head->cmd, pkt, sizeof(csg_ack_t), 0);
|
|
|
|
|
|
|
|
|
|
vtysh_config_save();
|
|
|
|
|
if (change_ip)
|
|
|
|
|
{
|
|
|
|
|
uint8_t mac[MAC_ADDR_LEN] = {0};
|
|
|
|
|
mac_generate_from_ip(device_info.ip, mac);
|
|
|
|
|
memcpy(device_info.mac, mac, MAC_ADDR_LEN);
|
|
|
|
|
vtysh_eth0_save();
|
|
|
|
|
}
|
|
|
|
|
vtysh_device_save();
|
|
|
|
|
|
|
|
|
|
if (boottype)
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
csg_dev_info_t *param = (csg_dev_info_t*)(pkt + sizeof(csg_pkt_head_t));
|
|
|
|
|
csg_dev_info_t *data = NULL;
|
|
|
|
|
uint8_t slot = head->slot - 1;
|
|
|
|
|
if (slot > PD_SLOTS_MAX)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG, "slot:%d error\r\n", head->slot);
|
|
|
|
|
return E_BAD_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = XMALLOC(MTYPE_CSG, sizeof(csg_dev_info_t));
|
|
|
|
|
if (!data)
|
|
|
|
|
{
|
|
|
|
|
reboot_system(LOG_CSG, boottype);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
DBG(DBG_M_PD_CSG_ERR, "XMALLOC ERROR!\r\n");
|
|
|
|
|
return E_MEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy(data, param, sizeof(csg_dev_info_t));
|
|
|
|
|
if (_csg_msg_send_dau(slot, DAU_SEND_INFO_SET, data) != E_NONE)
|
|
|
|
|
{
|
|
|
|
|
XFREE(MTYPE_CSG, data);
|
|
|
|
|
}
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 厂家参数查询报文处理. */
|
|
|
|
|
int32_t _csg_dev_info_get_recv(char *pkt)
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
csg_dev_info_t *pinfo = (csg_dev_info_t *)(pkt + sizeof(csg_pkt_head_t));
|
|
|
|
|
pinfo->type_m = device_info.type_m;
|
|
|
|
|
pinfo->type_s = device_info.type_s;
|
|
|
|
|
pinfo->dev_id = device_info.dev_id;
|
|
|
|
|
strcpy(pinfo->hostname, device_info.hostname);
|
|
|
|
|
pinfo->factory_date = device_info.factory_date;
|
|
|
|
|
pinfo->deployment_date = device_info.deployment_date;
|
|
|
|
|
snprintf((char*)pinfo->app_version, DEV_VERSION_STR_LEN, "%s", device_info.app_version);
|
|
|
|
|
snprintf((char*)pinfo->app_compile_time, DEV_VERSION_STR_LEN, "%s", device_info.app_compile_time);
|
|
|
|
|
snprintf((char*)pinfo->hardware_version, DEV_VERSION_STR_LEN, "%s", device_info.hardware_version);
|
|
|
|
|
snprintf((char*)pinfo->FPGA_version, DEV_VERSION_STR_LEN, "%s", device_info.FPGA_version);
|
|
|
|
|
pinfo->ip = device_info.ip;
|
|
|
|
|
pinfo->mask = device_info.mask;
|
|
|
|
|
pinfo->gw = device_info.gw;
|
|
|
|
|
memcpy(pinfo->mac, device_info.mac, sizeof(pinfo->mac));
|
|
|
|
|
//info.server_port = device_info.server_port;
|
|
|
|
|
//info.server_ipv4 = device_info.server_ipv4;
|
|
|
|
|
pinfo->server_port = csg.server_port;
|
|
|
|
|
pinfo->server_ipv4 = csg.server_ip;
|
|
|
|
|
|
|
|
|
|
_csg_send_data(CSG_REPLY, head->cmd, pkt, sizeof(csg_dev_info_t), 0);
|
|
|
|
|
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
int *data = NULL;
|
|
|
|
|
uint8_t slot = head->slot - 1;
|
|
|
|
|
if (slot > PD_SLOTS_MAX)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG, "slot:%d error\r\n", head->slot);
|
|
|
|
|
return E_BAD_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = XMALLOC(MTYPE_CSG, sizeof(int));
|
|
|
|
|
if (!data)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG_ERR, "XMALLOC ERROR!\r\n");
|
|
|
|
|
return E_MEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_csg_msg_send_dau(slot, DAU_SEND_INFO_GET, data) != E_NONE)
|
|
|
|
|
{
|
|
|
|
|
XFREE(MTYPE_CSG, data);
|
|
|
|
|
}
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 配置用户参数报文报文处理. */
|
|
|
|
|
int32_t _csg_config_set_recv(char *pkt)
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
csg_config_global_t *pnet = (csg_config_global_t *)(pkt + CSG_HEAD_LEN);
|
|
|
|
|
|
|
|
|
|
pd_config.config.power_frequency = pnet->power_frequency;
|
|
|
|
|
pd_config.config.trend_period = pnet->trend_period * 60;
|
|
|
|
|
pd_config.config.sync_mode = pnet->sync_mode;
|
|
|
|
|
pd_config.config.heartbeat_period = pnet->heartbeat_period;
|
|
|
|
|
pd_config.config.pps_mode = pnet->pps_mode;
|
|
|
|
|
pd_config.config.protocol_type = pnet->protocol_type;
|
|
|
|
|
pd_config.config.event_storage = pnet->event_storage;
|
|
|
|
|
pd_config.config.trend_storage = pnet->trend_storage;
|
|
|
|
|
|
|
|
|
|
vtysh_config_save();
|
|
|
|
|
|
|
|
|
|
csg_ack_t ack = {0};
|
|
|
|
|
ack.result = TRUE;
|
|
|
|
|
memcpy(pkt + sizeof(csg_pkt_head_t), (char *)&ack, sizeof(csg_ack_t));
|
|
|
|
|
|
|
|
|
|
_csg_send_data(CSG_PRV_REPLY, head->cmd, pkt, sizeof(csg_ack_t), 0);
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
csg_config_global_t *param = (csg_config_global_t*)(pkt + sizeof(csg_pkt_head_t));
|
|
|
|
|
csg_config_global_t *data = NULL;
|
|
|
|
|
uint8_t slot = head->slot - 1;
|
|
|
|
|
if (slot > PD_SLOTS_MAX)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG, "slot:%d error\r\n", head->slot);
|
|
|
|
|
return E_BAD_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = XMALLOC(MTYPE_CSG, sizeof(csg_config_global_t));
|
|
|
|
|
if (!data)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG_ERR, "XMALLOC ERROR!\r\n");
|
|
|
|
|
return E_MEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy(data, param, sizeof(csg_config_global_t));
|
|
|
|
|
if (_csg_msg_send_dau(slot, DAU_SEND_CFG_SET, data) != E_NONE)
|
|
|
|
|
{
|
|
|
|
|
XFREE(MTYPE_CSG, data);
|
|
|
|
|
}
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 查询用户参数查询报文处理. */
|
|
|
|
|
int32_t _csg_config_get_recv(char *pkt)
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
csg_config_global_t config = {0};
|
|
|
|
|
config.power_frequency = pd_config.config.power_frequency;
|
|
|
|
|
config.sync_mode = pd_config.config.sync_mode;
|
|
|
|
|
config.heartbeat_period = pd_config.config.heartbeat_period;
|
|
|
|
|
config.pps_mode = pd_config.config.pps_mode;
|
|
|
|
|
config.protocol_type = pd_config.config.protocol_type;
|
|
|
|
|
config.trend_period = pd_config.config.trend_period / 60;
|
|
|
|
|
config.trend_storage = pd_config.config.trend_storage;
|
|
|
|
|
config.event_storage = pd_config.config.event_storage;
|
|
|
|
|
memcpy(pkt + sizeof(csg_pkt_head_t), (char *)&config, sizeof(csg_config_global_t));
|
|
|
|
|
_csg_send_data(CSG_PRV_REPLY, head->cmd, pkt, sizeof(csg_config_global_t), 0);
|
|
|
|
|
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
int *data = NULL;
|
|
|
|
|
uint8_t slot = head->slot - 1;
|
|
|
|
|
if (slot > PD_SLOTS_MAX)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG, "slot:%d error\r\n", head->slot);
|
|
|
|
|
return E_BAD_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = XMALLOC(MTYPE_CSG, sizeof(int));
|
|
|
|
|
if (!data)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG_ERR, "XMALLOC ERROR!\r\n");
|
|
|
|
|
return E_MEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_csg_msg_send_dau(slot, DAU_SEND_CFG_GET, data) != E_NONE)
|
|
|
|
|
{
|
|
|
|
|
XFREE(MTYPE_CSG, data);
|
|
|
|
|
}
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 通道提交端口参数设置. */
|
|
|
|
|
int32_t _csg_port_config_set_recv(char *pkt)
|
|
|
|
|
{
|
|
|
|
|
//uint8_t vport = *(uint8_t*)(pkt + CSG_HEAD_LEN);
|
|
|
|
|
uint8_t unit = 0;
|
|
|
|
|
uint8_t port = 0;
|
|
|
|
|
//csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
csg_config_port_t *pnet = (csg_config_port_t *)(pkt + CSG_HEAD_LEN);
|
|
|
|
|
|
|
|
|
|
pd_config.config_port[unit][port].vport = pnet->vport;
|
|
|
|
|
pd_config.config_port[unit][port].port_type = pnet->port_type;
|
|
|
|
|
pd_config.config_port[unit][port].filter = pnet->filter;
|
|
|
|
|
pd_config.config_port[unit][port].sensor_type = pnet->sensor_type;
|
|
|
|
|
pd_config.config_port[unit][port].is_auto_noise = pnet->is_auto_noise;
|
|
|
|
|
pd_config.config_port[unit][port].denoise_type = pnet->denoise_type;
|
|
|
|
|
pd_config.config_port[unit][port].denoise_variance = pnet->denoise_variance;
|
|
|
|
|
|
|
|
|
|
pd_config.config_port[unit][port].event_counter_h = pnet->event_counter_h;
|
|
|
|
|
pd_config.config_port[unit][port].event_sec_h = pnet->event_sec_h;
|
|
|
|
|
pd_config.config_port[unit][port].event_thr_h = pnet->event_thr_h;
|
|
|
|
|
pd_config.config_port[unit][port].event_counter_thr_h = pnet->event_counter_thr_h;
|
|
|
|
|
|
|
|
|
|
pd_config.config_port[unit][port].event_counter_l = pnet->event_counter_l;
|
|
|
|
|
pd_config.config_port[unit][port].event_sec_l = pnet->event_sec_l;
|
|
|
|
|
pd_config.config_port[unit][port].event_thr_l = pnet->event_thr_l;
|
|
|
|
|
pd_config.config_port[unit][port].event_counter_thr_l = pnet->event_counter_thr_l;
|
|
|
|
|
|
|
|
|
|
pd_config.config_port[unit][port].burst_time = pnet->burst_time;
|
|
|
|
|
pd_config.config_port[unit][port].burst_thr = pnet->burst_thr;
|
|
|
|
|
pd_config.config_port[unit][port].denoise_manual = pnet->denoise_manual;
|
|
|
|
|
pd_config.config_port[unit][port].denoise_auto = pnet->denoise_auto;
|
|
|
|
|
|
|
|
|
|
pd_config.config_real[unit][port].filter_cfg = pd_config.config_port[unit][port].filter;
|
|
|
|
|
//dau_port_filter_set(unit, port);
|
|
|
|
|
|
|
|
|
|
vtysh_config_save();
|
|
|
|
|
|
|
|
|
|
//csg_config_port_ack_t ack = {0};
|
|
|
|
|
//ack.vport = pnet->vport;
|
|
|
|
|
//ack.result = TRUE;
|
|
|
|
|
//memcpy(pkt + sizeof(csg_pkt_head_t), (char *)&ack, sizeof(csg_config_port_ack_t));
|
|
|
|
|
//_csg_send_data(CSG_PRV_REPLY, head->cmd, pkt, sizeof(csg_config_port_ack_t));
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
csg_config_port_t *param = (csg_config_port_t*)(pkt + sizeof(csg_pkt_head_t));
|
|
|
|
|
csg_config_port_t *data = NULL;
|
|
|
|
|
uint8_t slot = head->slot - 1;
|
|
|
|
|
if (slot > PD_SLOTS_MAX)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG, "slot:%d error\r\n", head->slot);
|
|
|
|
|
return E_BAD_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = XMALLOC(MTYPE_CSG, sizeof(csg_config_port_t));
|
|
|
|
|
if (!data)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG_ERR, "XMALLOC ERROR!\r\n");
|
|
|
|
|
return E_MEM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy(data, param, sizeof(csg_config_port_t));
|
|
|
|
|
if (_csg_msg_send_dau(slot, DAU_SEND_PORT_SET, data) != E_NONE)
|
|
|
|
|
{
|
|
|
|
|
XFREE(MTYPE_CSG, data);
|
|
|
|
|
}
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 按通道提交端口参数查询结果. */
|
|
|
|
|
int32_t _csg_port_config_get_recv(char *pkt)
|
|
|
|
|
{
|
|
|
|
|
uint8_t vport = *(uint8_t*)(pkt + CSG_HEAD_LEN);
|
|
|
|
|
uint8_t unit = 0;
|
|
|
|
|
uint8_t port = 0;
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
//csg_config_port_t *pnet = (csg_config_port_t *)(pkt + CSG_HEAD_LEN);
|
|
|
|
|
|
|
|
|
|
//if (dau_vport_to_port(pnet->vport, &unit, &port) != E_NONE)
|
|
|
|
|
{
|
|
|
|
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
|
|
|
|
uint8_t *param = (uint8_t *)(pkt + sizeof(csg_pkt_head_t));
|
|
|
|
|
uint8_t *data = NULL;
|
|
|
|
|
uint8_t slot = head->slot - 1;
|
|
|
|
|
if (slot > PD_SLOTS_MAX)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG, "slot:%d error\r\n", head->slot);
|
|
|
|
|
return E_BAD_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = XMALLOC(MTYPE_CSG, sizeof(int));
|
|
|
|
|
if (!data)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_CSG_ERR, "Pkt port %d error!\r\n", vport);
|
|
|
|
|
return E_ERROR;
|
|
|
|
|
}
|
|
|
|
|
csg_config_port_t config = {0};
|
|
|
|
|
config.vport = pd_config.config_port[unit][port].vport;
|
|
|
|
|
config.port_type = pd_config.config_port[unit][port].port_type;
|
|
|
|
|
config.filter = pd_config.config_port[unit][port].filter;
|
|
|
|
|
config.sensor_type = pd_config.config_port[unit][port].sensor_type;
|
|
|
|
|
config.is_auto_noise = pd_config.config_port[unit][port].is_auto_noise;
|
|
|
|
|
config.denoise_type = pd_config.config_port[unit][port].denoise_type;
|
|
|
|
|
config.denoise_variance = pd_config.config_port[unit][port].denoise_variance;
|
|
|
|
|
|
|
|
|
|
config.event_counter_h = pd_config.config_port[unit][port].event_counter_h;
|
|
|
|
|
config.event_sec_h = pd_config.config_port[unit][port].event_sec_h;
|
|
|
|
|
config.event_thr_h = pd_config.config_port[unit][port].event_thr_h;
|
|
|
|
|
config.event_counter_thr_h = pd_config.config_port[unit][port].event_counter_thr_h;
|
|
|
|
|
|
|
|
|
|
config.event_counter_l = pd_config.config_port[unit][port].event_counter_l;
|
|
|
|
|
config.event_sec_l = pd_config.config_port[unit][port].event_sec_l;
|
|
|
|
|
config.event_thr_l = pd_config.config_port[unit][port].event_thr_l;
|
|
|
|
|
config.event_counter_thr_l = pd_config.config_port[unit][port].event_counter_thr_l;
|
|
|
|
|
|
|
|
|
|
config.burst_time = pd_config.config_port[unit][port].burst_time;
|
|
|
|
|
config.burst_thr = pd_config.config_port[unit][port].burst_thr;
|
|
|
|
|
config.denoise_manual = pd_config.config_port[unit][port].denoise_manual;
|
|
|
|
|
config.denoise_auto = pd_config.config_port[unit][port].denoise_auto;
|
|
|
|
|
|
|
|
|
|
memcpy(pkt + sizeof(csg_pkt_head_t), (char *)&config, sizeof(csg_config_port_t));
|
|
|
|
|
|
|
|
|
|
_csg_send_data(CSG_PRV_REPLY, head->cmd, pkt, sizeof(pd_config_port_t), 0);
|
|
|
|
|
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
DBG(DBG_M_PD_CSG_ERR, "XMALLOC ERROR!\r\n");
|
|
|
|
|
return E_MEM;
|
|
|
|
|
}
|
|
|
|
|
*data = *param;
|
|
|
|
|
|
|
|
|
|
if (_csg_msg_send_dau(slot, DAU_SEND_CFG_GET, data) != E_NONE)
|
|
|
|
|
{
|
|
|
|
|
XFREE(MTYPE_CSG, data);
|
|
|
|
|
}
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 解析HUF实时图谱召唤报文. */
|
|
|
|
|
int32_t _csg_real_image_recv(char *pkt)
|
|
|
|
@ -1133,6 +1075,76 @@ void *_csg_send_prps_handle(void *arg)
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* trend 发送平台线程 */
|
|
|
|
|
void *_csg_send_trend_handle(void *arg)
|
|
|
|
|
{
|
|
|
|
|
dau_send_msg_t *recv_msg = NULL;
|
|
|
|
|
|
|
|
|
|
/* 等待初始化完成 */
|
|
|
|
|
while(!is_system_init)
|
|
|
|
|
{
|
|
|
|
|
sleep(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
csg.send_cb = _csg_send_process;
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
if (fifo_read(csg.fifo_trend_id, (void**)&recv_msg) != 0)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_DAU_ERR, "ERROR at fifo %d read!\r\n", csg.fifo_trend_id);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 响应其他报文 */
|
|
|
|
|
if (csg.send_cb)
|
|
|
|
|
{
|
|
|
|
|
csg.send_cb(recv_msg->type, recv_msg->slot, recv_msg->data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 释放数据内存, 注意一定要在 fifo_push 之前调用, 因为 fifo_push 后 recv_msg 已被释放. */
|
|
|
|
|
XFREE(MTYPE_CSG, recv_msg->data);
|
|
|
|
|
fifo_push(csg.fifo_trend_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* event 发送平台线程 */
|
|
|
|
|
void *_csg_send_event_handle(void *arg)
|
|
|
|
|
{
|
|
|
|
|
dau_send_msg_t *recv_msg = NULL;
|
|
|
|
|
|
|
|
|
|
/* 等待初始化完成 */
|
|
|
|
|
while(!is_system_init)
|
|
|
|
|
{
|
|
|
|
|
sleep(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
csg.send_cb = _csg_send_process;
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
if (fifo_read(csg.fifo_event_id, (void**)&recv_msg) != 0)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_DAU_ERR, "ERROR at fifo %d read!\r\n", csg.fifo_event_id);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 响应其他报文 */
|
|
|
|
|
if (csg.send_cb)
|
|
|
|
|
{
|
|
|
|
|
csg.send_cb(recv_msg->type, recv_msg->slot, recv_msg->data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 释放数据内存, 注意一定要在 fifo_push 之前调用, 因为 fifo_push 后 recv_msg 已被释放. */
|
|
|
|
|
XFREE(MTYPE_CSG, recv_msg->data);
|
|
|
|
|
fifo_push(csg.fifo_event_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 后台接收处理函数. */
|
|
|
|
|
void *_csg_recv_handle(void *arg)
|
|
|
|
@ -1356,9 +1368,17 @@ int32_t csg_handle_init_after(void)
|
|
|
|
|
snprintf(param.thread_name, THREAD_NAME_LEN, "CSG_SEND_CMD");
|
|
|
|
|
create_thread(_csg_send_cmd_handle, ¶m);
|
|
|
|
|
|
|
|
|
|
param.priority = 65;
|
|
|
|
|
param.priority = 80;
|
|
|
|
|
snprintf(param.thread_name, THREAD_NAME_LEN, "CSG_SEND_PRPS");
|
|
|
|
|
create_thread(_csg_send_prps_handle, ¶m);
|
|
|
|
|
|
|
|
|
|
param.priority = 70;
|
|
|
|
|
snprintf(param.thread_name, THREAD_NAME_LEN, "CSG_SEND_TREND");
|
|
|
|
|
create_thread(_csg_send_trend_handle, ¶m);
|
|
|
|
|
|
|
|
|
|
param.priority = 75;
|
|
|
|
|
snprintf(param.thread_name, THREAD_NAME_LEN, "CSG_SEND_EVENT");
|
|
|
|
|
create_thread(_csg_send_event_handle, ¶m);
|
|
|
|
|
|
|
|
|
|
return E_NONE;
|
|
|
|
|
}
|
|
|
|
|