![]() |
Thingstream Client Library
BLD4131-v2.13
|
Callbacks the SDK makes into the application to report events. More...
Functions | |
void | Thingstream_Application_subscribeCallback (ThingstreamTopic topic, ThingstreamQualityOfService_t qos, uint8_t *payload, uint16_t payloadlen) |
void | Thingstream_Application_registerCallback (const char *topicName, ThingstreamTopic topic) |
void | Thingstream_Application_disconnectCallback (void) |
void | Thingstream_Application_serverTimeCallback (uint32_t unixEpochTime) |
void | Thingstream_Application_modemCallback (const char *response, uint16_t len) |
Callbacks the SDK makes into the application to report events.
Note: it is not permitted to call Thingstream_Client_xxx() APIs from within these callback routines.
Default versions of Thingstream_Application_modemCallback(), Thingstream_Application_registerCallback() and Thingstream_Application_subscribeCallback() are provided for backwards compatability. If the application doesn't need to receive these events, it saves a little space to implement empty functions to override the default versions.
void Thingstream_Application_disconnectCallback | ( | void | ) |
This API is called by the SDK when the server sends a disconnect message. This result is usually also made available via the return code of a client call, but a publish with quality ThingstreamQOS0, no reply from the server is expected.
This callback will only be called from inside one of the Thingstream apis.
void Thingstream_Application_modemCallback | ( | const char * | response, |
uint16_t | len | ||
) |
This application supplied routine will be called when the modem transport receives:
Note that any newline characters have been stripped from the response, and that response[len] is a zero byte.
It is not permitted to call any Thingstream_xxx() apis from within this callback.
response | the modem response |
len | the length of the response |
void Thingstream_Application_registerCallback | ( | const char * | topicName, |
ThingstreamTopic | topic | ||
) |
This API is called by the SDK when the server sends the Client a mapping between the name of a topic and the topic ID. This mapping is sent just prior to the first message of that topic during the current connection.
This callback will only be called from inside one of the Thingstream apis (usually from Thingstream_Client_run() or Thingstream_Client_ping()).
It is not permitted to call other Thingstream_Client_xxx() apis from within this callback.
Any data passed to the callback may be overwritten as soon as this callback returns.
topicName | the name of the topic |
topic | the ThingstreamTopic that matches the topicName |
void Thingstream_Application_serverTimeCallback | ( | uint32_t | unixEpochTime | ) |
This application supplied routine will be called when the Thingstream SDK receives a time packet from the server.
The server currently sends a time packet in response to the device calling:
but time packets may be sent more frequently in the future.
unixEpochTime | the number of seconds since 00:00:00 UTC on 1 Jan 1970 |
void Thingstream_Application_subscribeCallback | ( | ThingstreamTopic | topic, |
ThingstreamQualityOfService_t | qos, | ||
uint8_t * | payload, | ||
uint16_t | payloadlen | ||
) |
This API is called by the SDK when the server sends the Client a message. The application should define this routine if it wishes to receive inbound messages.
This callback will only be called from inside one of the Thingstream apis (usually from Thingstream_Client_run() or Thingstream_Client_ping()).
It is not permitted to call other Thingstream_Client_xxx() apis from within this callback.
Any data passed to the callback may be overwritten as soon as this callback returns.
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 |