ec800m.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef _EC800M_H
  2. #define _EC800M_H
  3. #include "gd32f10x.h"
  4. #define AT(cmd) "AT+"##cmd
  5. #define RSP_READY "RDY"
  6. #define RSP_OK "OK"
  7. #define RSP_CONNECT "CONNECT"
  8. #define CLIENTID "device_test"
  9. #define CMD_SET_PDP "AT+QICSGP=1,1,\"CTNET\",\"\",\"\",1\r\n" // UNINET?? CMNET?? CTNET??
  10. #define CMD_SET_ACTIVE "AT+QIACT=1\r\n"
  11. #define CMD_SET_URL "AT+QHTTPURL=%d\r\n"
  12. #define CMD_GET "AT+QHTTPGET=100\r\n"
  13. #define CMD_GET_TO_FILE "AT+QHTTPREADFILE=\"UFS:http.txt\",80\r\n"
  14. #define CMD_HTTP_GET "QHTTPGET:"
  15. #define CMD_READ_FILE "AT+QFDWL=http.txt\r\n"
  16. #define CMD_READ_OTA_MSG_FILE "AT+QFDWL=otaMSG.txt\r\n"
  17. #define CMD_READ_OTA_DATA_FILE "AT+QFDWL=otaDATA.txt\r\n"
  18. #define CMD_DEL_OTA_MSG_FILE "AT+QFDEL=otaMSG.txt\r\n"
  19. #define CMD_DEL_OTA_DATA_FILE "AT+QFDEL=otaDATA.txt\r\n"
  20. #define ATI "ATI"
  21. #define CMD_MQTT_DISCONNECT "AT+QMTDISC=0\r\n"
  22. // ??MQTT??3.1.1 ??????--4(mqtt 3.1.1 )3(mqtt 3.1)
  23. #define CMD_MQTT_VERSION "AT+QMTCFG=\"version\",0,4\r\n"
  24. #define CMD_MQTT_KEEPALIVE "AT+QMTCFG=\"qmtping\",0,30\r\n" // 30????
  25. #define CMD_MQTT_OPENET "AT+QMTOPEN=0,\"36.134.23.11\",1883\r\n"
  26. // #define CMD_MQTT_CONNECT "AT+QMTCONN=0,\"%s\",\"%s\",\"%s\"\r\n"// ?????clientid,username,password
  27. #define CMD_MQTT_CONNECT "AT+QMTCONN=0,\"device_test\",\"\",\"\"\r\n"
  28. #define CMD_MQTT_RECEIVE "AT+QMTCFG=\"recv/mode\",0,0,1\r\n"
  29. #define CMD_MQTT_SEND "AT+QMTCFG=\"send/mode\",0,0,1\r\n"
  30. // ???? ???????--??????--
  31. #define CMD_MQTT_SUBSCRIBE "AT+QMTSUB=0,1,\"%s\",0\r\n" // ????????
  32. #define CMD_SERVICE_Operatortyp "AT+COPS?\r\n"
  33. #define CMD_SERVICE_Networktyp "AT+CREG?\r\n"//7
  34. #define CMD_SERVICE_Networkstatu "AT+COPS?\r\n"
  35. #define CMD_SERVICE_SIMcardstatus "AT+CLCK=\"SC\",2\r\n"
  36. #define CMD_SERVICE_SIMcardICCID "AT+QCCID\r\n"
  37. #define CMD_SERVICE_IMEInumber "AT+GSN\r\n"
  38. #define CMD_SERVICE_Signalstrength "AT+CSQ\r\n"
  39. #define AT_CMD_HEAD "AT"
  40. #define AT_CMD_CFG "+QMTCFG="
  41. #define AT_CMD_TEST "?"
  42. #define AT_CMD_VER "version"
  43. //#define AT_CMD_T "AT+QMTCFG=?\r\n"
  44. #define AT_CMD_T "ATI\r\n"
  45. #define true 1
  46. #define false 0
  47. void EC800MPwoerOn(void);
  48. void EC800MSendCmd(char *buf, uint16_t len);
  49. void EC800MWaitReady(void);
  50. bool WaitResponse(char * expectStr, int timeout);
  51. #endif