/******************************************************************************** * File Name: ModemTask.h * Function Describe: Header file for ModemTask.c * Explain: * Writer: ShiLiangWen * Date: 2015-8-2 *******************************************************************************/ #ifndef __MODEM_TASK_H #define __MODEM_TASK_H //------------------------------------------------------------------------------- #include #include "MsgQueue.h" #include "Modem.h" #define MODEM_TASK_STK_SIZE 220 #define MODEM_UART_TASK_STK_SIZE 100 #define MODEM_MSG_DATA_BUF_LEN 1100 //1100 //消息数据缓冲区最大长度,此数据缓冲区将被多个消息队列共用 typedef enum MODEM_STEP{ STEP_CARD=0,//SIM/UIM卡 STEP_CSQ, STEP_CREG, //注册网络 STEP_PDP, //PDP拨号 STEP_QUERY_PDP, //查询PDP STEP_OPEN_USOCKET,//打开UDP端口 // STEP_DNS, //域名解析 STEP_SOCKET,//连接服务器 // STEP_LOGIN, //登陆服务器 // STEP_SERVICE//应用服务器 }MODEM_STEP; //typedef enum {INVALID=0,OPEN=1,CLOSE=2} STATUE; typedef struct SUT_MODEM_STATUS { MODEM_STEP Step; M_STATUE WorkStatus; M_STATUE CardStatus; M_STATUE CregStatus; M_STATUE PDPStatus; M_STATUE SocketStatus; M_STATUE ServerStatus; unsigned char OnceWorked;//只要开机过就为1,生产快速测试用 unsigned short ATTimeoutCt;//模块AT不响应超时次数 unsigned short RebootModemCt;//模块重启次数 unsigned short CheckCardCt;//检查卡次数 unsigned short CheckCSQCt;//检查卡次数 unsigned short PDPCloseCt; unsigned char GetDNSCt; unsigned short FoTaGetFileInfoCt;//升级次数计数器 unsigned short CmdNum;//命令流水号 unsigned short RecvCmdNum;//接收到的命令流水号 unsigned char CtrlReSendCt; //控制重发计数器 unsigned short CtrlIntervalSendCt;//控制间隔发送计数器 unsigned short ServerOfflineCt;//服务器离线计数器 unsigned char CSQ; unsigned short UartInactiveCt; unsigned short UnauthorizedCt; }SUT_MODEM_STATUS; extern SUT_MODEM_STATUS sutModemStatus; extern OS_TID idModemTask; extern U64 stkModemTask[MODEM_TASK_STK_SIZE]; extern OS_TID idModemUartTask; extern U64 stkModemUartTask[MODEM_UART_TASK_STK_SIZE]; extern char ModemMsgQueueDataBuffer[MODEM_MSG_DATA_BUF_LEN]; extern SUT_MSG_QUEUE ModemMsgQueue; extern OS_SEM ModemUartSem; extern unsigned char g_ucModemTaskSleep; void AtHandle(char *pMsg,unsigned short MsgLen); __task void ModemUartTask(void); __task void ModemTask(void); int CheckAKey(void); int stou(char *s); unsigned short atous(char *pMsg); void TraceData(unsigned char *pData,unsigned short DataLen); //------------------------------------------------------------------------------- #endif