Thingstream Client Library  BLD4131-v2.13
Data Fields
ThingstreamTransport Struct Reference

#include <transport_api.h>

Data Fields

ThingstreamTransportState_t_state
 
ThingstreamTransportResult(* init )(ThingstreamTransport *self, uint16_t version)
 
ThingstreamTransportResult(* shutdown )(ThingstreamTransport *self)
 
ThingstreamTransportResult(* get_buffer )(ThingstreamTransport *self, uint8_t **buffer, uint16_t *len)
 
const char *(* get_client_id )(ThingstreamTransport *self)
 
ThingstreamTransportResult(* send )(ThingstreamTransport *self, uint16_t flags, uint8_t *data, uint16_t len, uint32_t millis)
 
ThingstreamTransportResult(* register_callback )(ThingstreamTransport *self, ThingstreamTransportCallback_t callback, void *cookie)
 
ThingstreamTransportResult(* unused_slot )(ThingstreamTransport *self)
 
ThingstreamTransportResult(* run )(ThingstreamTransport *self, uint32_t millis)
 

Detailed Description

Type definition for a transport instance.

Type representing a transport instance.

Field Documentation

◆ _state

ThingstreamTransportState_t* ThingstreamTransport::_state

Internal representation of the transport state. For portability, ThingstreamTransport implementations should not access this directly, but rather cast it to their concrete type definitions.

◆ get_buffer

ThingstreamTransportResult(* ThingstreamTransport::get_buffer) (ThingstreamTransport *self, uint8_t **buffer, uint16_t *len)

Obtain a buffer to write data into.

Parameters
bufferwhere to write the buffer pointer
lenwhere the write the buffer length
Returns
a ThingstreamTransportResult status code (success / fail)

◆ get_client_id

const char*(* ThingstreamTransport::get_client_id) (ThingstreamTransport *self)

Obtain the client ID from the transport. This is useful for cases where the transport implementation can obtain a unique ID, such as reading the IMSI from an attached cellular modem. The returned pointer remains valid until shutdown of the transport.

Returns
the client ID as a C string, never NULL

◆ init

ThingstreamTransportResult(* ThingstreamTransport::init) (ThingstreamTransport *self, uint16_t version)

Initialize the transport. This may involve the setup on GPIO, UART ports, interrupts and other platform dependencies.

Parameters
versionthe transport API version
Returns
a ThingstreamTransportResult status code (success / fail)

◆ register_callback

ThingstreamTransportResult(* ThingstreamTransport::register_callback) (ThingstreamTransport *self, ThingstreamTransportCallback_t callback, void *cookie)

Register a callback function that will be called when this transport has data to send to its next outermost ThingstreamTransport.

Parameters
callbackthe callback function
cookiea opaque value passed to the callback function
Returns
a ThingstreamTransportResult status code (success / fail)

◆ run

ThingstreamTransportResult(* ThingstreamTransport::run) (ThingstreamTransport *self, uint32_t millis)

Allow the transport instance to run for at most the given number of milliseconds.

Parameters
millisthe maximum number of milliseconds to run (a value of zero processes all pending operations).
Returns
a ThingstreamTransportResult status code (success / fail)

◆ send

ThingstreamTransportResult(* ThingstreamTransport::send) (ThingstreamTransport *self, uint16_t flags, uint8_t *data, uint16_t len, uint32_t millis)

Send the data to the next innermost ThingstreamTransport or hardware device.

Parameters
flagsan indication of the type of the data, zero is normal.
dataa pointer to the data
lenthe length of the raw data
millisthe maximum number of milliseconds to run
Returns
a ThingstreamTransportResult status code (success / fail)

◆ shutdown

ThingstreamTransportResult(* ThingstreamTransport::shutdown) (ThingstreamTransport *self)

Shutdown the transport (i.e. the opposite of initialize)

Returns
a ThingstreamTransportResult status code (success / fail)

◆ unused_slot

ThingstreamTransportResult(* ThingstreamTransport::unused_slot) (ThingstreamTransport *self)
Deprecated:
Slot no longer used.

The documentation for this struct was generated from the following file: