112#ifndef CONFIG_EMCUTE_DEFAULT_PORT
113#define CONFIG_EMCUTE_DEFAULT_PORT (1883U)
124#ifndef CONFIG_EMCUTE_BUFSIZE
125#define CONFIG_EMCUTE_BUFSIZE (512U)
133#ifndef CONFIG_EMCUTE_TOPIC_MAXLEN
134#define CONFIG_EMCUTE_TOPIC_MAXLEN (196U)
144#ifndef CONFIG_EMCUTE_KEEPALIVE
145#define CONFIG_EMCUTE_KEEPALIVE (360)
158#ifndef CONFIG_EMCUTE_T_RETRY
159#define CONFIG_EMCUTE_T_RETRY (15U)
171#ifndef CONFIG_EMCUTE_N_RETRY
172#define CONFIG_EMCUTE_N_RETRY (3U)
262 const void *will_msg,
size_t will_msg_len,
unsigned flags);
int emcute_willupd_topic(const char *topic, unsigned flags)
Update the last will topic.
int emcute_discon(void)
Disconnect from the gateway we are currently connected to.
int emcute_willupd_msg(const void *data, size_t len)
Update the last will message.
int emcute_unsub(emcute_sub_t *sub)
Unsubscripbe the given topic.
int emcute_reg(emcute_topic_t *topic)
Get a topic ID for the given topic name from the gateway.
const char * emcute_type_str(uint8_t type)
Return the string representation of the given type value.
void(* emcute_cb_t)(const emcute_topic_t *topic, void *data, size_t len)
Signature for callbacks fired when publish messages are received.
int emcute_con(sock_udp_ep_t *remote, bool clean, const char *will_topic, const void *will_msg, size_t will_msg_len, unsigned flags)
Connect to a given MQTT-SN gateway (CONNECT)
int emcute_pub(emcute_topic_t *topic, const void *buf, size_t len, unsigned flags)
Publish data on the given topic.
struct emcute_sub emcute_sub_t
Data-structure for keeping track of topics we register to.
void emcute_run(uint16_t port, const char *id)
Run emCute, will 'occupy' the calling thread.
@ EMCUTE_CS
clean session flag
@ EMCUTE_RETAIN
retain flag
@ EMCUTE_QOS_2
QoS level 2.
@ EMCUTE_QOS_1
QoS level 1.
@ EMCUTE_DUP
duplicate flag
@ EMCUTE_QOS_MASK
QoS level mask.
@ EMCUTE_QOS_0
QoS level 0.
@ EMCUTE_TIT_NORMAL
topic ID: normal
@ EMCUTE_TIT_SHORT
topic ID: short
@ EMCUTE_TIT_MASK
topic ID type mask
@ EMCUTE_TIT_PREDEF
topic ID: pre-defined
@ EMCUTE_WILL
will flag, used during CONNECT
@ EMCUTE_NOGW
error: not connected to a gateway
@ EMCUTE_NOTSUP
error: feature not supported
@ EMCUTE_OVERFLOW
error: ran out of buffer space
@ EMCUTE_OK
everything went as expect
@ EMCUTE_TIMEOUT
error: timeout
@ EMCUTE_REJECT
error: operation was rejected by broker
Common IP-based transport layer end point.
Data-structure for keeping track of topics we register to.
emcute_topic_t topic
topic we subscribe to
struct emcute_sub * next
next subscription (saved in a list)
emcute_cb_t cb
function called when receiving messages
void * arg
optional custom argument
const char * name
topic string (currently ASCII only)
uint16_t id
topic id, as assigned by the gateway