Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
Structure to describe an MQTT-SN transport. More...
#include <mqtt_sn.h>
Data Fields | |
int(* | init )(struct mqtt_sn_transport *transport) |
Will be called once on client init to initialize the transport. | |
void(* | deinit )(struct mqtt_sn_transport *transport) |
Will be called on client deinit. | |
int(* | sendto )(struct mqtt_sn_client *client, void *buf, size_t sz, const void *dest_addr, size_t addrlen) |
Will be called by the library when it wants to send a message. | |
ssize_t(* | recvfrom )(struct mqtt_sn_client *client, void *rx_buf, size_t rx_len, void *src_addr, size_t *addrlen) |
Will be called by the library when it wants to receive a message. | |
int(* | poll )(struct mqtt_sn_client *client) |
Check if incoming data is available. | |
Structure to describe an MQTT-SN transport.
MQTT-SN does not require transports to be reliable or to hold a connection. Transports just need to be frame-based, so you can use UDP, ZigBee, or even a simple UART, given some kind of framing protocol is used.
void(* mqtt_sn_transport::deinit) (struct mqtt_sn_transport *transport) |
Will be called on client deinit.
Use this to close sockets or similar. May be NULL.
int(* mqtt_sn_transport::init) (struct mqtt_sn_transport *transport) |
Will be called once on client init to initialize the transport.
Use this to open sockets or similar. May be NULL.
int(* mqtt_sn_transport::poll) (struct mqtt_sn_client *client) |
Check if incoming data is available.
If poll() returns a positive number, recv must not block.
May be NULL, but recv should not block then either.
ssize_t(* mqtt_sn_transport::recvfrom) (struct mqtt_sn_client *client, void *rx_buf, size_t rx_len, void *src_addr, size_t *addrlen) |
Will be called by the library when it wants to receive a message.
Implementations should follow recvfrom conventions with the exception of a NULL src_addr being a broadcast message.
int(* mqtt_sn_transport::sendto) (struct mqtt_sn_client *client, void *buf, size_t sz, const void *dest_addr, size_t addrlen) |
Will be called by the library when it wants to send a message.
Implementations should follow sendto conventions with exceptions. When dest_addr == NULL, message should be broadcast with addrlen being the broadcast radius. This should also handle setting up/destroying connections as required when the address changes.