ModemTask.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /********************************************************************************
  2. * File Name: ModemTask.h
  3. * Function Describe: Header file for ModemTask.c
  4. * Explain:
  5. * Writer: ShiLiangWen
  6. * Date: 2015-8-2
  7. *******************************************************************************/
  8. #ifndef __MODEM_TASK_H
  9. #define __MODEM_TASK_H
  10. //-------------------------------------------------------------------------------
  11. #include <rtl.h>
  12. #include "MsgQueue.h"
  13. #include "Modem.h"
  14. #define MODEM_TASK_STK_SIZE 220
  15. #define MODEM_UART_TASK_STK_SIZE 100
  16. #define MODEM_MSG_DATA_BUF_LEN 1100 //1100 //消息数据缓冲区最大长度,此数据缓冲区将被多个消息队列共用
  17. typedef enum MODEM_STEP{
  18. STEP_CARD=0,//SIM/UIM卡
  19. STEP_CSQ,
  20. STEP_CREG, //注册网络
  21. STEP_PDP, //PDP拨号
  22. STEP_QUERY_PDP, //查询PDP
  23. STEP_OPEN_USOCKET,//打开UDP端口
  24. // STEP_DNS, //域名解析
  25. STEP_SOCKET,//连接服务器
  26. // STEP_LOGIN, //登陆服务器
  27. // STEP_SERVICE//应用服务器
  28. }MODEM_STEP;
  29. //typedef enum {INVALID=0,OPEN=1,CLOSE=2} STATUE;
  30. typedef struct SUT_MODEM_STATUS
  31. {
  32. MODEM_STEP Step;
  33. M_STATUE WorkStatus;
  34. M_STATUE CardStatus;
  35. M_STATUE CregStatus;
  36. M_STATUE PDPStatus;
  37. M_STATUE SocketStatus;
  38. M_STATUE ServerStatus;
  39. unsigned char OnceWorked;//只要开机过就为1,生产快速测试用
  40. unsigned short ATTimeoutCt;//模块AT不响应超时次数
  41. unsigned short RebootModemCt;//模块重启次数
  42. unsigned short CheckCardCt;//检查卡次数
  43. unsigned short CheckCSQCt;//检查卡次数
  44. unsigned short PDPCloseCt;
  45. unsigned char GetDNSCt;
  46. unsigned short FoTaGetFileInfoCt;//升级次数计数器
  47. unsigned short CmdNum;//命令流水号
  48. unsigned short RecvCmdNum;//接收到的命令流水号
  49. unsigned char CtrlReSendCt; //控制重发计数器
  50. unsigned short CtrlIntervalSendCt;//控制间隔发送计数器
  51. unsigned short ServerOfflineCt;//服务器离线计数器
  52. unsigned char CSQ;
  53. unsigned short UartInactiveCt;
  54. unsigned short UnauthorizedCt;
  55. }SUT_MODEM_STATUS;
  56. extern SUT_MODEM_STATUS sutModemStatus;
  57. extern OS_TID idModemTask;
  58. extern U64 stkModemTask[MODEM_TASK_STK_SIZE];
  59. extern OS_TID idModemUartTask;
  60. extern U64 stkModemUartTask[MODEM_UART_TASK_STK_SIZE];
  61. extern char ModemMsgQueueDataBuffer[MODEM_MSG_DATA_BUF_LEN];
  62. extern SUT_MSG_QUEUE ModemMsgQueue;
  63. extern OS_SEM ModemUartSem;
  64. extern unsigned char g_ucModemTaskSleep;
  65. void AtHandle(char *pMsg,unsigned short MsgLen);
  66. __task void ModemUartTask(void);
  67. __task void ModemTask(void);
  68. int CheckAKey(void);
  69. int stou(char *s);
  70. unsigned short atous(char *pMsg);
  71. void TraceData(unsigned char *pData,unsigned short DataLen);
  72. //-------------------------------------------------------------------------------
  73. #endif