#ifndef _MQTTCLIENT_H #define _MQTTCLIENT_H #include "stdint.h" #define MQTT_SENDBUF_LENGTH 10 * 1024 #define MQTT_RECVBUF_LENTH 512 extern uint8_t mqtt_sendBuf[MQTT_SENDBUF_LENGTH]; extern uint8_t mqtt_recvbuffer[MQTT_RECVBUF_LENTH]; extern uint8_t mqtt_publishQos1_status; extern uint16_t mqtt_publishQos1_packid; extern uint8_t mqtt_publishQos2_status; extern uint16_t mqtt_publishQos2_packid; extern uint8_t mqtt_subscribe_status; extern uint16_t mqtt_subscribe_packid; extern uint8_t mqtt_unsubscribe_status; extern uint16_t mqtt_unsubscribe_packid; extern uint8_t mqtt_pingreq_status; extern uint16_t mqtt_recvPublishQos1_packid; extern uint16_t mqtt_recvPublishQos2_packid; uint16_t mqtt_getPacketId(void); int mqtt_connectToMqttServer(int sock); int mqtt_subscribeTopic(int sock, char *topic, int qos); int mqtt_subscribeTopic_SUBACK(uint8_t *pbuf, int buflen); int mqtt_unSubscribeTopic(int sock, char *topic); int mqtt_unSubscribeTopic_UNSUBACK(uint8_t *pbuf, int buflen); int mqtt_publishMessage_qos0(int sock, char *topic, uint8_t *msg, int msg_len); int mqtt_publishMessage_qos1(int sock, char *topic, uint8_t *msg, int msg_len); int mqtt_publishMessage_qos1_PUBACK(uint8_t *pbuf, int buflen); int mqtt_publishMessage_qos2_PUBREL(int sock, uint16_t id); int mqtt_publishMessage_qos2(int sock, char *topic, uint8_t *msg, int msg_len); int mqtt_publishMessage_qos2_PUBREC(uint8_t *pbuf, int buflen); int mqtt_publishMessage_qos2_PUBCOMP(uint8_t *pbuf, int buflen); int mqtt_recvPublishMessage_qos1_PUBACK(int sock, uint16_t id); int mqtt_recvPublishMessage_qos2_PUBREC(int sock, uint16_t id); int mqtt_recvPublishMessage_qos2_PUBREL(int sock, uint8_t *pbuf, int buflen); int mqtt_recvPublishMessage_qos2_PUBCOMP(int sock, uint16_t id); int mqtt_pingReq(int sock); int mqtt_pingResponse(void); void mqtt_disconnectServer(int sock); #endif