This section describes the MQTT System Service Interface
- MQTT service status enum
- MQTT event enum
- MQTT message configuration struct
- MQTT message enum
- MQTT QoS enum
- MQTT publish retain enum
- MQTT frame struct
States involved in the operation of the MQTT state machine.
typedef enum
{
SYS_RNWF_MQTT_CONFIG, /**<Configure the MQTT Broker parameters*/
SYS_RNWF_MQTT_CONNECT, /**<Connect to the MQTT Broker */
SYS_RNWF_MQTT_RECONNECT, /**<Request reconnect to the MQTT Cloud*/
SYS_RNWF_MQTT_DISCONNECT, /**<Trigger Disconnect from MQTT Broker*/
SYS_RNWF_MQTT_SUBSCRIBE_QOS0, /**<Subscribe to QoS0 Topics */
SYS_RNWF_MQTT_SUBSCRIBE_QOS1, /**<Subscribe to QoS1 Topics */
SYS_RNWF_MQTT_SUBSCRIBE_QOS2, /**<Subscribe to QoS2 Topics */
SYS_RNWF_MQTT_PUBLISH, /**<Publis to MQTT Broker*/
SYS_RNWF_MQTT_SET_CALLBACK, /**<Configure the MQTT Application Callback*/
}SYS_RNWF_MQTT_SERVICE_t;
Events involved in the operation of the MQTT state machine
typedef enum
{
SYS_RNWF_MQTT_CONNECTED, /**<Connected to MQTT broker event */
SYS_RNWF_MQTT_DISCONNECTED, /**<Disconnected from MQTT broker event*/
SYS_RNWF_MQTT_SUBCRIBE_MSG, /**<Event to report received MQTT message*/
}SYS_RNWF_MQTT_EVENT_t;
Defines the configuration parameters required to establish connection with MQTT Broker
typedef struct
{
const char *url; /**<MQTT Broker/Server URL */
uint16_t port; /**<MQTT Broker/Server Port */
const char *clientid;
const char *username; /**<MQTT User Name Credential */
const char *password; /**<MQTT Password Credential */
uint8_t tls_idx;
uint8_t *tls_conf;
}SYS_RNWF_MQTT_CFG_t;
typedef enum
{
SYS_RNWF_NEW_MSG, /**New message*/
SYS_RNWF_DUP_MSG /**Duplicate message*/
}SYS_RNWF_MQTT_MSG_t;
typedef enum
{
SYS_RNWF_MQTT_QOS0, /**<No-Ack, Best effort delivery(No Guarantee)*/
SYS_RNWF_MQTT_QOS1, /**<Pub-Ack, sent untill PUBACK from broker(possible duplicates) */
SYS_RNWF_MQTT_QOS2, /**<Highest service, no duplicate with guarantee */
}SYS_RNWF_MQTT_QOS_t;
Sets whether the published message is retained at the broker or
not.
typedef enum
{
SYS_RNWF_NO_RETAIN, /**<Publish message is not saved at broker */
SYS_RNWF_RETAIN, /**<Publish message is saved at broker */
}SYS_RNWF_MQTT_RETAIN_t;
typedef struct
{
SYS_RNWF_MQTT_MSG_t isNew; /**<Indicates message is new or duplicate */
SYS_RNWF_MQTT_QOS_t qos; /**<QoS type for the message ::RNWF_MQTT_QOS_t */
SYS_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 */
}SYS_RNWF_MQTT_FRAME_t;