3.1.7.8.2 MQTT System Service Interface
This section describes the MQTT System Service Interface
MQTT Service Status Enum
States involved in the operation of the MQTT state
machine.
typedef enum { RNWF_MQTT_CONFIG, /**<Configure the MQTT Broker parameters*/ RNWF_MQTT_CONNECT, /**<Connect to the MQTT Broker */ RNWF_MQTT_RECONNECT, /**<Request reconnect to the MQTT Cloud*/ RNWF_MQTT_DISCONNECT, /**<Trigger Disconnect from MQTT Broker*/ RNWF_MQTT_SUBSCRIBE_QOS0, /**<Subscribe to QoS0 Topics */ RNWF_MQTT_SUBSCRIBE_QOS1, /**<Subscribe to QoS1 Topics */ RNWF_MQTT_SUBSCRIBE_QOS2, /**<Subscribe to QoS2 Topics */ RNWF_MQTT_PUBLISH, /**<Publis to MQTT Broker*/ RNWF_MQTT_SET_CALLBACK, /**<Configure the MQTT Application Callback*/ }RNWF_MQTT_SERVICE_t;
MQTT Event Enum
Events involved in the operation of the MQTT state machine
typedef enum { RNWF_MQTT_CONNECTED, /**<Connected to MQTT broker event */ RNWF_MQTT_DISCONNECTED, /**<Disconnected from MQTT broker event*/ RNWF_MQTT_SUBCRIBE_MSG, /**<Event to report received MQTT message*/ RNWF_MQTT_SUBCRIBE_ACK, RNWF_MQTT_PUBLIC_ACK, RNWF_MQTT_DPS_STATUS, }RNWF_MQTT_EVENT_t;
MQTT Message Configuration Struct
Defines the configuration parameters required to establish connection with MQTT Broker
typedef struct { const char *url; /**<MQTT Broker/Server URL */ const char *clientid; const char *username; /**<MQTT User Name Credential */ const char *password; /**<MQTT Password Credential */ uint16_t port; /**<MQTT Broker/Server Port */ uint8_t tls_idx; uint8_t azure_dps; uint8_t *tls_conf; }RNWF_MQTT_CFG_t;
MQTT Message Enum
typedef enum { NEW_MSG, /**New message*/ DUP_MSG /**Duplicate message*/ }RNWF_MQTT_MSG_t;
MQTT QoS Enum
typedef enum { MQTT_QOS0, /**<No-Ack, Best effort delivery(No Guarantee)*/ MQTT_QOS1, /**<Pub-Ack, sent untill PUBACK from broker(possible duplicates) */ MQTT_QOS2, /**<Highest service, no duplicate with guarantee */ }RNWF_MQTT_QOS_t;
MQTT Publish Retain Enum
Sets whether the published message is retained at the broker or
not.
typedef enum { NO_RETAIN, /**<Publish message is not saved at broker */ RETAIN, /**<Publish message is saved at broker */ }RNWF_MQTT_RETAIN_t;
MQTT Frame Struct
typedef struct { RNWF_MQTT_MSG_t isNew; /**<Indicates message is new or duplicate */ RNWF_MQTT_QOS_t qos; /**<QoS type for the message ::RNWF_MQTT_QOS_t */ RNWF_MQTT_RETAIN_t isRetain; /**<Retain flag for the publish message */ const uint8_t *topic; /**<Publish topic for the message */ const uint8_t *message; /**<Indicates message is new or duplicate */ }RNWF_MQTT_FRAME_t;