|
|
|
@ -128,11 +128,8 @@ void _hf_send_update(uint8_t slot, void *data)
|
|
|
|
|
uint8_t err_cnt = 0;
|
|
|
|
|
uint16_t index = 0;
|
|
|
|
|
int fd = -1;
|
|
|
|
|
int fd1 = -1;
|
|
|
|
|
int32_t len = 0;
|
|
|
|
|
|
|
|
|
|
fd1 = open("test", O_RDWR | O_CREAT | O_TRUNC, 0777);
|
|
|
|
|
|
|
|
|
|
/* 打开文件 */
|
|
|
|
|
fd = open(msg->name, O_RDONLY, 0777);
|
|
|
|
|
if (-1 == fd)
|
|
|
|
@ -146,7 +143,6 @@ void _hf_send_update(uint8_t slot, void *data)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_HF_ERR, "Can't open %s\r\n", msg->name);
|
|
|
|
|
close(fd);
|
|
|
|
|
close(fd1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -156,7 +152,7 @@ void _hf_send_update(uint8_t slot, void *data)
|
|
|
|
|
{
|
|
|
|
|
head->sum++;
|
|
|
|
|
}
|
|
|
|
|
printh("#1 type %d sum %d\r\n", head->type, head->sum);
|
|
|
|
|
DBG(DBG_M_PD_HF, "#1 type %d sum %d\r\n", head->type, head->sum);
|
|
|
|
|
|
|
|
|
|
/* 初始化报文头 */
|
|
|
|
|
head_data.cmd_type = DAU_REQUEST;
|
|
|
|
@ -180,7 +176,7 @@ void _hf_send_update(uint8_t slot, void *data)
|
|
|
|
|
head->len = len;
|
|
|
|
|
head_data.pkt_id = dau->pkt_id;
|
|
|
|
|
head_data.len = sizeof(dau_pkt_head_t) + sizeof(hf_upate_t) + len;
|
|
|
|
|
printh("#2 index %d len %d\r\n", index, len);
|
|
|
|
|
DBG(DBG_M_PD_HF, "#2 index %d len %d\r\n", index, len);
|
|
|
|
|
|
|
|
|
|
/* 发送报文, 等待数据回复 */
|
|
|
|
|
while(1)
|
|
|
|
@ -192,7 +188,6 @@ void _hf_send_update(uint8_t slot, void *data)
|
|
|
|
|
if (err_cnt >= HF_SEND_ERR_CNT)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_HF_ERR, "Send error cnt %d.\r\n", err_cnt);
|
|
|
|
|
close(fd1);
|
|
|
|
|
close(fd);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -205,14 +200,11 @@ void _hf_send_update(uint8_t slot, void *data)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
write(fd1, data_update, len);
|
|
|
|
|
|
|
|
|
|
dau->pkt_id++;
|
|
|
|
|
index++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close(fd);
|
|
|
|
|
close(fd1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -455,6 +447,32 @@ void _hf_recv_info_get(uint8_t slot, char *pkt, uint16_t len)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 升级结果报文接收 */
|
|
|
|
|
void _hf_recv_update_rv(uint8_t slot, char *pkt, uint16_t len)
|
|
|
|
|
{
|
|
|
|
|
hf_upate_rv_t *data = (hf_upate_rv_t*)(pkt + sizeof(dau_pkt_head_t));
|
|
|
|
|
hf_upate_rv_t *param = NULL;
|
|
|
|
|
|
|
|
|
|
/* 申请内存 */
|
|
|
|
|
param = XMALLOC(MTYPE_CSG, sizeof(hf_upate_rv_t));
|
|
|
|
|
if (!param)
|
|
|
|
|
{
|
|
|
|
|
DBG(DBG_M_PD_HF_ERR, "XMALLOC ERROR!\r\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 装填数据 */
|
|
|
|
|
memcpy(param, &data, sizeof(hf_upate_rv_t));
|
|
|
|
|
|
|
|
|
|
/* 发送给后台 */
|
|
|
|
|
if (dau_msg_send_cmd(DAU_SEND_UPDATE_RV, slot, param) != E_NONE)
|
|
|
|
|
{
|
|
|
|
|
XFREE(MTYPE_CSG, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 心跳报文接收 */
|
|
|
|
|
void _hf_recv_heartbeat(uint8_t slot, char *pkt, uint16_t len)
|
|
|
|
|
{
|
|
|
|
@ -898,7 +916,7 @@ static hf_recv_fun_cb _hf_command[] =
|
|
|
|
|
_hf_recv_info_set, // DAU_C_DEV_INFO_SET 6
|
|
|
|
|
_hf_recv_info_get, // DAU_C_DEV_INFO_GET 7
|
|
|
|
|
NULL, // 8
|
|
|
|
|
NULL, // DAU_C_UPDATE_RESULT 9
|
|
|
|
|
_hf_recv_update_rv, // DAU_C_UPDATE_RESULT 9
|
|
|
|
|
_hf_recv_heartbeat, // DAU_C_HEARTBEAT 10
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -1033,6 +1051,18 @@ void hf_show_cfg(uint8_t slot)
|
|
|
|
|
/* 显示端口配置 */
|
|
|
|
|
void hf_show_port(uint8_t slot, uint8_t port)
|
|
|
|
|
{
|
|
|
|
|
#if 0
|
|
|
|
|
dau_send_msg_t msg;
|
|
|
|
|
hf_upate_msg_t *data = XMALLOC_Q(MTYPE_CSG, sizeof(hf_upate_msg_t));
|
|
|
|
|
|
|
|
|
|
data->type = 1;
|
|
|
|
|
snprintf(data->name, HF_FILE_NAME_LEN, "gisMonitor_V1.19");
|
|
|
|
|
msg.type = DAU_SEND_UPDATE;
|
|
|
|
|
msg.data = data;
|
|
|
|
|
fifo_write(daus[slot].fifo_send, &msg, sizeof(dau_send_msg_t));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
|
hf_data_t *hf_data = (hf_data_t*)daus[slot].private_data;
|
|
|
|
|
hf_cfg_port_t *cfg = &hf_data->port[port];
|
|
|
|
|
|
|
|
|
@ -1052,7 +1082,7 @@ void hf_show_port(uint8_t slot, uint8_t port)
|
|
|
|
|
printh("Event thr high: thr %d sum %d\r\n", cfg->event_thr_h, cfg->event_counter_thr_h);
|
|
|
|
|
printh("Event cnt low: sum %d sec %d thr %d sum %d\r\n\n", cfg->event_counter_l, cfg->event_sec_l,
|
|
|
|
|
cfg->event_thr_l, cfg->event_counter_thr_l);
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|