Thingstream Client Library  BLD4131-v2.13
Macros | Typedefs | Functions
Application Callback Backwards Compatibility

APIs to set/clear callbacks that will be called when the server sends the Client messages or topic name to id mappings. More...

Collaboration diagram for Application Callback Backwards Compatibility:

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)
 

Detailed Description

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.

Macro Definition Documentation

◆ Thingstream_Client_clearRegisterCallback

#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.

Parameters
clientthe ThingstreamClient instance

◆ Thingstream_Client_clearSubscribeCallback

#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.

Parameters
clientthe ThingstreamClient instance

Typedef Documentation

◆ ThingstreamRegisterCallback_t

typedef void(* ThingstreamRegisterCallback_t) (void *cookie, const char *topicName, ThingstreamTopic topic)

Type definition of the "inbound register message" callback

Parameters
cookiethe cookie passed to Thingstream_Client_setRegisterCallback()
topicNamethe name of the topic
topicthe ThingstreamTopic type and id
Deprecated:
Alternative Thingstream_Application_registerCallback() is preferred

◆ ThingstreamSubscribeCallback_t

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

Parameters
cookiethe cookie passed to Thingstream_Client_setSubscribeCallback()
topicthe ThingstreamTopic that this message was sent to
qosthe ThingstreamQualityOfService_t of the message
payloada pointer to the payload data
payloadlenthe length of the payload
Deprecated:
Alternative Thingstream_Application_subscribeCallback() is preferred

Function Documentation

◆ Thingstream_Client_setRegisterCallback()

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.

Parameters
clientthe ThingstreamClient instance
callbackthe ThingstreamRegisterCallback_t function
cookiea caller supplied opaque item passed when callback is called.
Deprecated:
Alternative Thingstream_Application_registerCallback() is preferred

◆ Thingstream_Client_setSubscribeCallback()

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.

Parameters
clientthe ThingstreamClient instance
callbackthe ThingstreamSubscribeCallback_t function
cookiea caller supplied opaque item passed when callback is called.
Deprecated:
Alternative Thingstream_Application_subscribeCallback() is preferred