Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mqtt_sn_transport Struct Reference

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(* msg_send )(struct mqtt_sn_client *client, void *buf, size_t sz)
 Will be called by the library when it wants to send a message.
 
ssize_t(* recv )(struct mqtt_sn_client *client, void *buffer, size_t length)
 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.
 

Detailed Description

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.

Field Documentation

◆ deinit

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.

◆ init

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.

◆ msg_send

int(* mqtt_sn_transport::msg_send) (struct mqtt_sn_client *client, void *buf, size_t sz)

Will be called by the library when it wants to send a message.

◆ poll

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.

Returns
Positive number if data is available, or zero if there is none. Negative values signal errors.

◆ recv

ssize_t(* mqtt_sn_transport::recv) (struct mqtt_sn_client *client, void *buffer, size_t length)

Will be called by the library when it wants to receive a message.

Implementations should follow recv conventions.


The documentation for this struct was generated from the following file: