Thingstream Client Library  BLD4131-v2.13
Functions
Callbacks into the application

Callbacks the SDK makes into the application to report events. More...

Collaboration diagram for Callbacks into the application:

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)
 

Detailed Description

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.

Function Documentation

◆ Thingstream_Application_disconnectCallback()

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.

◆ Thingstream_Application_modemCallback()

void Thingstream_Application_modemCallback ( const char *  response,
uint16_t  len 
)

This application supplied routine will be called when the modem transport receives:

  • any response during Thingstream_Modem2_sendLine()
  • or a line starting with +CSQ, +COPS, +CREG, +CGREG, +CEREG
  • or any line that is not recognized by the modem driver.

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.

Parameters
responsethe modem response
lenthe length of the response

◆ Thingstream_Application_registerCallback()

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.

Parameters
topicNamethe name of the topic
topicthe ThingstreamTopic that matches the topicName

◆ Thingstream_Application_serverTimeCallback()

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.

Parameters
unixEpochTimethe number of seconds since 00:00:00 UTC on 1 Jan 1970

◆ Thingstream_Application_subscribeCallback()

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.

Parameters
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