Go to the documentation of this file.
98 #ifndef EMCUTE_DEFAULT_PORT
102 #define EMCUTE_DEFAULT_PORT (1883U)
105 #ifndef EMCUTE_BUFSIZE
114 #define EMCUTE_BUFSIZE (512U)
117 #ifndef EMCUTE_TOPIC_MAXLEN
124 #define EMCUTE_TOPIC_MAXLEN (196U)
127 #ifndef EMCUTE_KEEPALIVE
136 #define EMCUTE_KEEPALIVE (360)
139 #ifndef EMCUTE_T_RETRY
145 #define EMCUTE_T_RETRY (15U)
148 #ifndef EMCUTE_N_RETRY
154 #define EMCUTE_N_RETRY (3U)
243 const void *will_msg,
size_t will_msg_len,
unsigned flags);
355 void emcute_run(uint16_t port,
const char *
id);
@ EMCUTE_RETAIN
retain flag
@ EMCUTE_TIMEOUT
error: timeout
@ EMCUTE_OVERFLOW
error: ran out of buffer space
Data-structure for keeping track of topics we register to.
int emcute_willupd_topic(const char *topic, unsigned flags)
Update the last will topic.
const char * name
topic string (currently ACSII only)
@ EMCUTE_DUP
duplicate flag
emcute_cb_t cb
function called when receiving messages
int emcute_sub(emcute_sub_t *sub, unsigned flags)
Subscribe to the given topic.
struct emcute_sub emcute_sub_t
Data-structure for keeping track of topics we register to.
@ EMCUTE_REJECT
error: operation was rejected by broker
int emcute_willupd_msg(const void *data, size_t len)
Update the last will message.
void emcute_run(uint16_t port, const char *id)
Run emCute, will 'occupy' the calling thread.
int emcute_pub(emcute_topic_t *topic, const void *buf, size_t len, unsigned flags)
Publish data on the given topic.
Common IP-based transport layer end point.
@ EMCUTE_QOS_2
QoS level 2.
@ EMCUTE_TIT_MASK
topic ID type mask
@ EMCUTE_WILL
will flag, used during CONNECT
uint16_t id
topic id, as assigned by the gateway
@ EMCUTE_NOGW
error: not connected to a gateway
emcute_topic_t topic
topic we subscribe to
@ EMCUTE_QOS_0
QoS level 0.
@ EMCUTE_NOTSUP
error: feature not supported
int emcute_reg(emcute_topic_t *topic)
Get a topic ID for the given topic name from the gateway.
void(* emcute_cb_t)(const emcute_topic_t *topic, void *data, size_t len)
Signature for callbacks fired when publish messages are received.
@ EMCUTE_TIT_SHORT
topic ID: short
@ EMCUTE_QOS_MASK
QoS level mask.
int emcute_discon(void)
Disconnect from the gateway we are currently connected to.
@ EMCUTE_TIT_NORMAL
topic ID: normal
@ EMCUTE_OK
everything went as expect
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)
@ EMCUTE_TIT_PREDEF
topic ID: pre-defined
@ EMCUTE_QOS_1
QoS level 1.
void * arg
optional custom argument
const char * emcute_type_str(uint8_t type)
Return the string representation of the given type value.
struct emcute_sub * next
next subscription (saved in a list)
int emcute_unsub(emcute_sub_t *sub)
Unsubscripbe the given topic.
@ EMCUTE_CS
clean session flag