Soletta™ Framework
|
MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. More...
Data Structures | |
struct | sol_mqtt_config |
Server Configuration. More... | |
struct | sol_mqtt_handlers |
MQTT callback handlers. More... | |
struct | sol_mqtt_message |
MQTT Message. More... | |
Macros | |
#define | SOL_MQTT_MESSAGE_CHECK_API_VERSION(msg_,...) |
Macro used to check if a struct struct sol_mqtt_message has the expected API version. More... | |
Typedefs | |
typedef struct sol_mqtt | sol_mqtt |
MQTT Object. More... | |
typedef struct sol_mqtt_config | sol_mqtt_config |
Server Configuration. More... | |
typedef struct sol_mqtt_handlers | sol_mqtt_handlers |
MQTT callback handlers. More... | |
typedef struct sol_mqtt_message | sol_mqtt_message |
MQTT Message. More... | |
Enumerations | |
enum | sol_mqtt_conn_status { SOL_MQTT_DISCONNECTED = -1, SOL_MQTT_CONNECTED = 0, SOL_MQTT_WRONG_PROTOCOL = 1, SOL_MQTT_ID_REJECTED = 2, SOL_MQTT_UNAVAILABLE = 3 } |
Connection status. More... | |
enum | sol_mqtt_qos { SOL_MQTT_QOS_AT_MOST_ONCE = 0, SOL_MQTT_QOS_AT_LEAST_ONCE = 1, SOL_MQTT_QOS_EXACTLY_ONCE = 2 } |
MQTT QOS level for message delivery. More... | |
Functions | |
struct sol_mqtt * | sol_mqtt_connect (const struct sol_mqtt_config *config) |
Connect to a MQTT broker. More... | |
void | sol_mqtt_disconnect (struct sol_mqtt *mqtt) |
Disconnect from MQTT Broker. More... | |
int | sol_mqtt_get_connection_status (const struct sol_mqtt *mqtt) |
Get connection status. More... | |
int | sol_mqtt_publish (const struct sol_mqtt *mqtt, struct sol_mqtt_message *message) |
Send the Broker a message to be published in a given topic. More... | |
int | sol_mqtt_reconnect (struct sol_mqtt *mqtt) |
Reestablish the connection to the MQTT broker. More... | |
int | sol_mqtt_subscribe (const struct sol_mqtt *mqtt, const char *topic, sol_mqtt_qos qos) |
Ask the Broker to be subscribed to a given topic. More... | |
MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol.
It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium. For example, it has been used in sensors communicating to a broker via satellite link, over occasional dial-up connections with healthcare providers, and in a range of home automation and small device scenarios. It is also ideal for mobile applications because of its small size, low power usage, minimised data packets, and efficient distribution of information to one or many receivers
#define SOL_MQTT_MESSAGE_CHECK_API_VERSION | ( | msg_, | |
... | |||
) |
Macro used to check if a struct struct
sol_mqtt_message has the expected API version.
In case it has wrong version, it'll return extra arguments passed to the macro.
MQTT Object.
This object is the abstraction of a MQTT session. This is the base structure for all MQTT operations and is obtained through the sol_mqtt_connect() API.
typedef struct sol_mqtt_config sol_mqtt_config |
Server Configuration.
typedef struct sol_mqtt_handlers sol_mqtt_handlers |
MQTT callback handlers.
typedef struct sol_mqtt_message sol_mqtt_message |
MQTT Message.
This object is the abstraction of a MQTT message and is the base for publishing and receiving data to/from the broker.
enum sol_mqtt_conn_status |
Connection status.
enum sol_mqtt_qos |
MQTT QOS level for message delivery.
struct sol_mqtt* sol_mqtt_connect | ( | const struct sol_mqtt_config * | config | ) |
Connect to a MQTT broker.
config | Configuration and callbacks |
Referenced by main().
void sol_mqtt_disconnect | ( | struct sol_mqtt * | mqtt | ) |
Disconnect from MQTT Broker.
mqtt | MQTT Object; |
Terminate the connection to the broker and free the resources associated to the mqtt object.
Referenced by main().
int sol_mqtt_get_connection_status | ( | const struct sol_mqtt * | mqtt | ) |
Get connection status.
mqtt | MQTT Object |
Referenced by iio_gyroscope_reader_cb(), and on_connect().
int sol_mqtt_publish | ( | const struct sol_mqtt * | mqtt, |
struct sol_mqtt_message * | message | ||
) |
Send the Broker a message to be published in a given topic.
mqtt | MQTT Object |
message | Message to be published. The memory associated to this object should be handled by the caller. |
Referenced by iio_gyroscope_reader_cb(), and publish_callback().
int sol_mqtt_reconnect | ( | struct sol_mqtt * | mqtt | ) |
Reestablish the connection to the MQTT broker.
mqtt | MQTT Object |
Referenced by try_reconnect().
int sol_mqtt_subscribe | ( | const struct sol_mqtt * | mqtt, |
const char * | topic, | ||
sol_mqtt_qos | qos | ||
) |
Ask the Broker to be subscribed to a given topic.
mqtt | MQTT Object |
topic | Null terminated string with the topic to subscribe to |
qos | MQTT QOS that should be used by the subscribe message |
Referenced by on_connect().