![]() |
Thingstream Client Library
BLD4131-v2.13
|
APIs to set/clear callbacks that will be called when the server sends the Client messages or topic name to id mappings. More...
Macros | |
#define | Thingstream_Client_clearSubscribeCallback(client) Thingstream_Client_setSubscribeCallback((client), NULL, NULL) |
#define | Thingstream_Client_clearRegisterCallback(client) Thingstream_Client_setRegisterCallback((client), NULL, NULL) |
Typedefs | |
typedef void(* | ThingstreamSubscribeCallback_t) (void *cookie, ThingstreamTopic topic, ThingstreamQualityOfService_t qos, uint8_t *payload, uint16_t payloadlen) |
typedef void(* | ThingstreamRegisterCallback_t) (void *cookie, const char *topicName, ThingstreamTopic topic) |
Functions | |
void | Thingstream_Client_setSubscribeCallback (ThingstreamClient *client, ThingstreamSubscribeCallback_t callback, void *cookie) |
void | Thingstream_Client_setRegisterCallback (ThingstreamClient *client, ThingstreamRegisterCallback_t callback, void *cookie) |
APIs to set/clear callbacks that will be called when the server sends the Client messages or topic name to id mappings.
We recommend that the application provides implementions of Thingstream_Application_subscribeCallback() to receive messages from the server, and Thingstream_Application_registerCallback() to receive topic mappings from the server.
#define Thingstream_Client_clearRegisterCallback | ( | client | ) | Thingstream_Client_setRegisterCallback((client), NULL, NULL) |
Clear the register message callback function. Note that calling this will indicate to the stack that the application no longer wishes to accept inbound register messages.
client | the ThingstreamClient instance |
#define Thingstream_Client_clearSubscribeCallback | ( | client | ) | Thingstream_Client_setSubscribeCallback((client), NULL, NULL) |
Clear the subscribe message callback function. Note that calling this will indicate to the stack that the client no longer wishes to accept inbound subscription messages.
client | the ThingstreamClient instance |
typedef void(* ThingstreamRegisterCallback_t) (void *cookie, const char *topicName, ThingstreamTopic topic) |
Type definition of the "inbound register message" callback
cookie | the cookie passed to Thingstream_Client_setRegisterCallback() |
topicName | the name of the topic |
topic | the ThingstreamTopic type and id |
typedef void(* ThingstreamSubscribeCallback_t) (void *cookie, ThingstreamTopic topic, ThingstreamQualityOfService_t qos, uint8_t *payload, uint16_t payloadlen) |
Type definition of the "inbound subscribed message" callback
cookie | the cookie passed to Thingstream_Client_setSubscribeCallback() |
topic | the ThingstreamTopic that this message was sent to |
qos | the ThingstreamQualityOfService_t of the message |
payload | a pointer to the payload data |
payloadlen | the length of the payload |
void Thingstream_Client_setRegisterCallback | ( | ThingstreamClient * | client, |
ThingstreamRegisterCallback_t | callback, | ||
void * | cookie | ||
) |
Set the function that will be called when an inbound register message is received. The register message is sent by the server when it knows that the client does not have a valid mapping between the topic name and topic id for a message to be published.
The callback function will be passed the topic and cookie.
client | the ThingstreamClient instance |
callback | the ThingstreamRegisterCallback_t function |
cookie | a caller supplied opaque item passed when callback is called. |
void Thingstream_Client_setSubscribeCallback | ( | ThingstreamClient * | client, |
ThingstreamSubscribeCallback_t | callback, | ||
void * | cookie | ||
) |
Set the function that will be called when a new inbound subscription message is received. The callback function will be passed the topic, payload and cookie.
client | the ThingstreamClient instance |
callback | the ThingstreamSubscribeCallback_t function |
cookie | a caller supplied opaque item passed when callback is called. |