123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #ifndef __ML307A_H
- #define __ML307A_H
- #include "main.h"
- #include <stdbool.h> // bool
- //extern bool reset4Gmodule;
- //extern bool module4G_F;
- extern bool MgnssFlag;
- //extern bool resetBTmodule;
- void USART_SendString(UART_HandleTypeDef *huart,char *str);// 封装串口发送4G AT命令函数
- uint8_t sendCmd_4G(char *pCmd, char *pRes, uint32_t timeOut, uint8_t sendNum);// 发送4G串口命令
- uint8_t sendCmd_4G_2(char *pCmd, char *pRes1, char *pRes2, uint32_t timeOut, uint8_t sendNum);
- //uint8_t sendCmd_4G_2(char *pCmd, char **pRes, uint32_t timeOut, uint8_t sendNum);
- //uint8_t sendCmd_4G_3(char *pCmd, char **pRes, uint32_t timeOut, uint8_t sendNum, char **receivedRes);
- uint8_t sendCmd_4G_3(char *pCmd, char *pRes1, char *pRes2, uint32_t timeOut, uint8_t sendNum);
- void process_uart3_buffer(void);
- int wait_uart3_multi_response(const char* keywords[], int keyword_count, char* buffer, uint16_t buffer_len, uint32_t timeout_ms);
- void extract_and_parse_trdtc(const char* buffer);
- void process_MIPURC_data(uint8_t *buf, uint16_t len);
- void parse_JT808_frame(uint8_t *frame, uint16_t length);
- void parse_JT808_8103(uint8_t *payload, uint16_t length);
- int hexStringToBytes(const char *hexStr, uint8_t *outBytes, int maxLen);
- uint8_t mqttconn(char *IpAddr, uint16_t port, char *ID, char *User, char *Passwd, char* pRes);// 封装MQTT连接至MQTT服务器
- void MQTTCONN(void);// MQTT连接至MQTT服务器,订阅
- uint8_t MQTT_PUB(uint8_t connect_id, char *topic, char *mesg, char* pRes);// 发布消息QoS=0;
- void MQTTDISCONN(void);// 断开MQTT连接
- void tcpconn(char *value, uint8_t cid, char *IPaddr, uint16_t port, uint8_t tcpConnmode);// 建立TCP连接
- void TCPCONN(void);
- void GNSSLOC(void);
- void ML307A_INIT(void);
- void ML307A_Init(void);
- void ML307AReset(void);
- //*tt808
- #define JIALONGip "121.199.29.128"
- #define JIALONGport 7342 //测试平台
- //#define JLPTPORT 9021 //正式平台
- //#define JLPTIP "118.31.22.26"//徐工平台
- //#define JLPTPORT 8901
- #define MQTTADDR "127.0.0.1"
- #define MQTTPORT 1883
- #define MQTTUSER "0527"
- #define MQTTPSWD "05270527"
- //*订阅b
- //#define PCMQTTTOPIC_PREFIX "DCCtopic/#"
- #define Publish_Topic "DCCtopic/#"
- #define Subscribe_Topic "DCCtopic/b"
- #define MessageID_authentication 0x0102 //鉴权
- #define MessageID_heartbeat 0x0002 //心跳
- #define MessageID_location 0x0200 //地址
- #define MessageID_Retrans 0x0704 //地址补传
- #define MessageID_Getauth 0x0223 //权限获取
- #define TCPJMFSRSA 0x001
- #define TCPJMFSNULL 0x000
- #define TT808FLAG 0x7E
- #define TCPHeadBYTE 0x2A
- #define TCPTAILBYTE 0x23
- #define XXID_pttyyd 0x8001 //通用应答
- #define XXID_ptxxtc 0x8900 //下行透传
- #define XXID_zdtyyd 0x0001 //终端通用应答
- void Send_AT_Command(char *command) ;
- void Receive_Response(char *buffer, uint16_t size);
- int Check_Response(char *buffer, uint16_t size);
- int Send_Command_Check_Response(char *command, char *response_buffer, uint16_t buffer_size) ;
- void MQTT_Process(void);
- bool checkForMATREADY(void);
- void ML307A_MQTT_Init(void);
- void ML307A_NET_Init(void);
- void check_network_connection(void);
- #endif /*__ML307A_H*/
|