| | |
| | | *******************************************************************************/ |
| | | extern uint8_t gps_4g_flag,search_open_flag; |
| | | extern Operation_step UWB_work_state; |
| | | uint16_t air780e_send_second; |
| | | Commend_Datestruct TCP_command; |
| | | uint8_t result; |
| | | uint8_t query_open_flag; |
| | | char applyid[10]; |
| | | static HIDO_INT32 TCPClient_DataProc(HIDO_UINT8 *_u8Data, HIDO_UINT32 _u32Len) |
| | | { |
| | |
| | | |
| | | break; |
| | | case QUARY_INFORMATION: |
| | | query_open_flag=1; |
| | | //?? |
| | | |
| | | break; |
| | | case CHANGE_POLL_FREQUENCY: |
| | | |
| | | g_com_map[SEND_4G_SECOND]=TCP_command.frequency*60; |
| | | g_com_map[SEND_4G_MINUTE]=TCP_command.frequency; |
| | | air780e_send_second=g_com_map[SEND_4G_MINUTE]*60; |
| | | break; |
| | | } |
| | | result = 1; |
| | |
| | | * Author : www.hido-studio.com |
| | | * Modified Date: : 2021?1?9? |
| | | *******************************************************************************/ |
| | | extern uint8_t bat_percent,taglist_num; |
| | | extern uint8_t bat_percent,taglist_num,userkey_state; |
| | | |
| | | uint8_t alarm_type; |
| | | extern double jd,wd; |
| | | extern int32_t distance; |
| | |
| | | { |
| | | HIDO_CHAR acHeart[200]; |
| | | HIDO_UINT32 u32HeartLen; |
| | | if(alarm_type) |
| | | if(alarm_type==1) |
| | | { |
| | | u32HeartLen = snprintf(acHeart, sizeof(acHeart), "$message,alarm,%04x,%d,%04x,%d,%02u%%,%d,%d,%lf,%lf,%s,%d,%d,0\r\n", \ |
| | | g_com_map[DEV_ID],GetUWBBindState(),g_com_map[BIND_DEV_ID],alarm_type,bat_percent,g_com_map[ALARM_DISTANCE1],g_com_map[ALARM_DISTANCE2],jd,wd,applyid,result,distance); |
| | | u32HeartLen = snprintf(acHeart, sizeof(acHeart), "$message,alarm,%04x,%d,%04x,%d,%02u%%,%d,%d,%lf,%lf,%s,%d,%d,%d,0\r\n", \ |
| | | g_com_map[DEV_ID],GetUWBBindState(),g_com_map[BIND_DEV_ID],alarm_type,bat_percent,g_com_map[ALARM_DISTANCE1],g_com_map[ALARM_DISTANCE2],jd,wd,applyid,result,distance,userkey_state); |
| | | } else { |
| | | u32HeartLen = snprintf(acHeart, sizeof(acHeart), "$message,heart,%04x,%d,%04x,%d,%02u%%,%d,%d,%lf,%lf,%s,%d,%d,0\r\n", \ |
| | | g_com_map[DEV_ID],GetUWBBindState(),g_com_map[BIND_DEV_ID],alarm_type,bat_percent,g_com_map[ALARM_DISTANCE1],g_com_map[ALARM_DISTANCE2],jd,wd,applyid,result,distance); |
| | | u32HeartLen = snprintf(acHeart, sizeof(acHeart), "$message,heart,%04x,%d,%04x,%d,%02u%%,%d,%d,%lf,%lf,%s,%d,%d,%d,0\r\n", \ |
| | | g_com_map[DEV_ID],GetUWBBindState(),g_com_map[BIND_DEV_ID],alarm_type,bat_percent,g_com_map[ALARM_DISTANCE1],g_com_map[ALARM_DISTANCE2],jd,wd,applyid,result,distance,userkey_state); |
| | | } |
| | | if(query_open_flag) |
| | | { |
| | | u32HeartLen = snprintf(acHeart, sizeof(acHeart), "$message,query,%04x,%d,%04x,%d,%02u%%,%d,%d,%lf,%lf,%s,%d,%d,%d,0\r\n", \ |
| | | g_com_map[DEV_ID],GetUWBBindState(),g_com_map[BIND_DEV_ID],alarm_type,bat_percent,g_com_map[ALARM_DISTANCE1],g_com_map[ALARM_DISTANCE2],jd,wd,applyid,result,distance,userkey_state); |
| | | } |
| | | userkey_state=0; |
| | | query_open_flag=0;//关闭查询模式 |
| | | Socket_Send(l_i32TCPClientID, (HIDO_UINT8 *)acHeart, u32HeartLen); |
| | | |
| | | } |
| | | |
| | | void TCPReceiveMessageReply(void) |
| | |
| | | if(alarm_type == 2) |
| | | alarm_type = 0; |
| | | } |
| | | |
| | | HIDO_UINT32 u32CurTick; |
| | | HIDO_INT32 TCPClient_Poll(void) |
| | | { |
| | | if (Internet_IsIPReady() == HIDO_TRUE) |
| | | { |
| | | HIDO_UINT32 u32CurTick = HIDO_TimerGetTick(); |
| | | u32CurTick = HIDO_TimerGetTick(); |
| | | if (TCP_CLIENT_STATE_IDLE == l_eTCPClientState) |
| | | { |
| | | if (!TCPfail_flag) |
| | |
| | | |
| | | |
| | | |
| | | //if ((u32CurTick - l_u32HeartBeatTick) >= HIDO_TIMER_TICK_S(15)||flag_first_TCPconnect) |
| | | if ((u32CurTick - l_u32HeartBeatTick) >= HIDO_TIMER_TICK_S(g_com_map[SEND_4G_SECOND])||flag_first_TCPconnect) |
| | | //if ((u32CurTick - l_u32HeartBeatTick) >= HIDO_TIMER_TICK_S(15)||flag_first_TCPconnect) |
| | | if ((u32CurTick - l_u32HeartBeatTick) >= HIDO_TIMER_TICK_S(air780e_send_second)||flag_first_TCPconnect) |
| | | { |
| | | flag_first_TCPconnect = 0; |
| | | l_u32HeartBeatTick = u32CurTick; |