diff --git a/README.md b/README.md index 4b8d5d3..50e19c8 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,48 @@ All honour for this working MQTT client library goes to Nick O'Leary, all blame for bugs in the C port shall go to me. +## API + + +The library provides the following functions: + + + void mqttClientInit(mqttClient_t *mqttClient, client_t *client, callback_t callback); + +Initializes the MQTT client, handover a client handle according to the definition +from ``platformAdaption.h`` and a callback function for incoming messages. + +Implement this callback function for incoming messages with this footprint: + + typedef void (*callback_t)(char*, uint8_t*, uint16_t); + + + + + bool mqttConnect(mqttClient_t *mqttClient, + uint8_t *address, uint16_t port, + const char *id, + const char *user, const char *pass, + const char *willTopic, uint8_t willQos, + bool willRetain, const char *willMessage, + bool cleanSession); + + + void mqttDisconnect(mqttClient_t *mqttClient); + + bool publish(mqttClient_t *mqttClient, + const char *topic, + const uint8_t *payload, uint16_t plength, + bool retained); + + bool subscribe(mqttClient_t *mqttClient, + const char *topic, uint8_t qos); + + bool unsubscribe(mqttClient_t *mqttClient, + const char* topic); + + bool mqttLoop(mqttClient_t *mqttClient); + + bool mqttConnected(mqttClient_t *mqttClient); + + \ No newline at end of file