yincheng.zhong
2024-08-27 fc78430a35be252a1cd5a29b5b66290a68cd9ca3
keil/include/src/TCPClient.c
@@ -19,6 +19,7 @@
#include "Uart.h"
#include "mk_4G.h"
#include "mk_trace.h"
#include "dw_app_anchor.h"
/*******************************************************************************
 *                                  Macro                                      *
 *******************************************************************************/
@@ -37,6 +38,7 @@
 *                             Local Variable                                  *
 *******************************************************************************/
HIDO_INT32 l_i32TCPClientID = 0;
extern uint8_t gps_power_state;
static E_TCPClientState l_eTCPClientState = TCP_CLIENT_STATE_IDLE;
static HIDO_UINT32 l_u32HeartBeatTick = 0;
static HIDO_UINT8 l_au8CmdBuff[1024];
@@ -58,6 +60,8 @@
 * Author            : www.hido-studio.com
 * Modified Date:    : 2021年1月9日
 *******************************************************************************/
extern uint8_t gps_4g_flag;
extern Operation_step UWB_work_state;
 Commend_Datestruct TCP_command;
static HIDO_INT32 TCPClient_DataProc(HIDO_UINT8 *_u8Data, HIDO_UINT32 _u32Len)
{
@@ -84,13 +88,18 @@
                 g_com_map[ALARM_DISTANCE1]=TCP_command.warnDistance;
                 g_com_map[ALARM_DISTANCE2]=TCP_command.alarmDistance;//这个距离double和uint格式不符
                 g_com_map[SEND_4G_FREQUENCY]=1000/TCP_command.frequency;
                UWB_work_state = UN_BIND;
                 save_com_map_to_flash();
                }
                break;
                case UNBIND:
                g_com_map[BIND_DEV_ID] = 0;
                UWB_work_state = UN_BIND;
                save_com_map_to_flash();
               // bind_resetbreak();
                case OPEN_GNSS:
                 gnss_forceopen();
                GpsConrol(1,1); //4Gflag, on
                case CLOSE_VIBRATION:
                // vibration_close();
                case QUARY_INFORMATION:
@@ -101,38 +110,6 @@
            }
        }
     }
    //根据指令去执行
       //
#if 0
 if(STRCMP(_u8Data, "$control,") == 0)
    {
        u32SplitCnt = HIDO_UtilStrSplit((HIDO_CHAR *)_u8Data, ',', apcSplitStr, HIDO_ARRARY_COUNT(apcSplitStr));
     if(u32SplitCnt < 3)
        {
            return HIDO_ERR;
        }
        /* ?豸ID??? */
        if(HIDO_UtilHexStrToInt(apcSplitStr[1]) == g_com_map[DEV_ID])
        {
            if(strcmp(apcSplitStr[2],"beeper")==0)
            {
                    beepontime = HIDO_UtilStrToInt(apcSplitStr[3]);
            }
        }
    }else if(STRCMP(_u8Data, "$userdata,") == 0)
    {
        if(DBG_GetMode() == DBG_MODE_CFG)
        HIDO_Debug2("%s\r\n", l_au8CmdBuff);
    }
#endif
    return HIDO_OK;
}
@@ -296,9 +273,9 @@
}
void AIR780E_Reset(void)
{
    gps_air780_power_change(0,0);//开启gps,4G
    gps_air780_power_change(gps_power_state,0);//开启gps,4G
    delay_us(1500000);
    gps_air780_power_change(0,1);//开启gps,4G
    gps_air780_power_change(gps_power_state,1);//开启gps,4G
}
uint8_t IfTCPConnected(void)
{