atair720.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef __ATAIR720__
  2. #define __ATAIR720__
  3. #include <stdint.h>
  4. #include "type-spec.h"
  5. #include "queue.h"
  6. #define AT_AIR720_DEBUG_EN 1
  7. #ifdef AT_AIR720_DEBUG_EN
  8. #define AT_AIR720_DEBUG(fmt, x...) \
  9. do \
  10. { \
  11. printf(fmt,##x); \
  12. }while(0)
  13. #define AT_AIR720_DEBUG_NB(fmt, x...) \
  14. do \
  15. { \
  16. UART4_SendNByte(fmt,##x); \
  17. }while(0)
  18. #define AT_AIR720_DEBUG_String(fmt, x...) \
  19. do \
  20. { \
  21. UART4_SendString(fmt,##x); \
  22. }while(0)
  23. #define AT_AIR720_DEBUG_1B(fmt, x...) \
  24. do \
  25. { \
  26. UART4_SendByte(fmt,##x); \
  27. }while(0)
  28. #define AT_AIR720_DEBUG_H(fmt, x...) \
  29. do \
  30. { \
  31. USART_printfHex(fmt,##x); \
  32. }while(0)
  33. #define AT_AIR720_DEBUG_F(fmt, x...) \
  34. do \
  35. { \
  36. printf("%s %s(Line %d): "fmt,__FILE__,__FUNCTION__,__LINE__, ##x); \
  37. }while(0)
  38. #else
  39. #define AT_AIR720_DEBUG(fmt, x...)
  40. #define AT_AIR720_DEBUG_1B(fmt, x...)
  41. #define AT_AIR720_DEBUG_NB(fmt, x...)
  42. #define AT_AIR720_DEBUG_String(fmt, x...)
  43. #define AT_AIR720_DEBUG_H(fmt, x...)
  44. #define AT_AIR720_DEBUG_F(fmt, x...)
  45. #endif
  46. void thread_atair720(void* parameter);
  47. void Air720_Init(void);
  48. #define buflen 256
  49. #define loraidbuflen 20
  50. typedef struct USART_BUF{
  51. unsigned char rxbufindex;
  52. //unsigned char txbufindex;
  53. unsigned char rxbuf[buflen];
  54. //unsigned char txbuf[buflen];
  55. } USART_BUF_t;
  56. uint16_t UDP_0D_frame_l(uint8_t td);
  57. uint16_t UDP_0D_frame_N(uint8_t td);
  58. uint16_t UDP_0D_frame_NT(uint8_t td);
  59. void AT_aire720_process(DEV_WORK_MODE_T *pmode);
  60. typedef enum
  61. {
  62. AT_AIRE720_STATE_IDLE=0,
  63. AT_AIRE720_STATE_INIT,
  64. AT_AIRE720_STATE_CONNECTING,
  65. AT_AIRE720_STATE_CONNECT_OK,
  66. AT_AIRE720_STATE_RE_CONNECT,
  67. } tAT_AIRE720_StateCodes;//AT_aire720_State
  68. typedef struct{
  69. uint8_t rsv;
  70. uint8_t firmWareType; //固件,类型,0:APP,1:BootLoader,2:SET配置区
  71. uint8_t desDeviceType; //被升级设备类型(1Byte)
  72. uint8_t desDeviceID[4]; //被升级设备ID(4Byte)
  73. uint8_t desDeviceChannel; //被升级设备通道号(1Byte)
  74. uint8_t softWareOldVer[4]; //前版本(4Byte)
  75. uint8_t softWareNewVer[4]; //后版本(4Byte)
  76. uint8_t srcUrlLen; //固件路径URL的长度(1B)
  77. uint8_t ppath[80]; //固件路径URL
  78. }tUpdare_Paras;
  79. int8_t Air720_Update_Down(void);
  80. uint8_t air_send_IMEI_Cmd(uint16_t waittime);
  81. uint8_t air_send_ICCID_Cmd(uint16_t waittime);
  82. extern sequeue_t * Air720_Send_Sq;
  83. extern tCounterTimeOut_t time_gw_force_rst;
  84. void set_at_aire720_workState(tAT_AIRE720_StateCodes mode);
  85. #endif