![]() |
Thingstream Client Library
BLD4131-v2.13
|
A modem driver (implemented as a ThingstreamTransport instance) that supports both USSD and UDP communication. More...
Macros | |
#define | MODEM2_USSD_BUFFER_LEN |
#define | MODEM2_UDP_BUFFER_LEN |
#define | Thingstream_UssdInit |
Modem2 Transport flags | |
Flags that can be passed to Thingstream_createModem2Transport() | |
#define | MODEM_PREFER_USSD (0x100) |
#define | MODEM_SKIP_INFO_INIT (0x200) |
#define | MODEM2_LOG_PARSED (0x400) |
#define | MODEM2_LOG_PARSING (0x800) |
Typedefs | |
typedef const struct ThingstreamModem2UdpConfig_s * | ThingstreamModem2UdpInit(uint32_t version, struct ThingstreamModem2SharedState_s *gState) |
Functions | |
ThingstreamTransport * | Thingstream_createModem2Transport (ThingstreamTransport *inner, uint16_t flags, uint8_t *buffer, uint16_t bufSize, ThingstreamModem2UdpInit udpConfigInit, ThingstreamPrintf_t logger) |
ThingstreamTransportResult | Thingstream_Modem2_sendLine (ThingstreamTransport *self, const char *line, uint32_t millis) |
uint32_t | Thingstream_Modem2_getCUSDErrors (ThingstreamTransport *self, uint32_t andClear) |
uint32_t | Thingstream_Modem2_getSeriousErrors (ThingstreamTransport *self, uint32_t andClear) |
ThingstreamTransportResult | Thingstream_Modem2_setBearerMSS (ThingstreamTransport *self, uint16_t mss) |
void | Thingstream_Application_modemBinaryCallback (const uint8_t *data, uint16_t len) |
void | Thingstream__dontUseLineBufferTransportWithModem2 (void) |
A modem driver (implemented as a ThingstreamTransport instance) that supports both USSD and UDP communication.
This driver is used with a hardware specific modem configuration. See the list of supported modems.
Example code initializing the stack and sending a test message:
#define MODEM2_LOG_PARSED (0x400) |
If MODEM2_LOG_PARSED is in the flags passed to Thingstream_createModem2Transport() then the modem driver will log items that it successfully parsed from the bytes received from the underlying modem hardware.
This flag bit is ignored if the SDK has been built without the matching support.
#define MODEM2_LOG_PARSING (0x800) |
If MODEM2_LOG_PARSING is in the flags passed to Thingstream_createModem2Transport() then the modem driver will log parsing steps of bytes received from the underlying modem hardware.
Note that this produces a very large amount of logging.
This flag bit is ignored if the SDK has been built without the matching support.
#define MODEM2_UDP_BUFFER_LEN |
Recommended buffer size for udp sessions.
#define MODEM2_USSD_BUFFER_LEN |
Recommended buffer size for ussd-only sessions.
#define MODEM_PREFER_USSD (0x100) |
If MODEM_PREFER_USSD is in the Thingstream_createModem2Transport() flags then the modem driver will prefer to use USSD for the network connection.
#define MODEM_SKIP_INFO_INIT (0x200) |
If MODEM_SKIP_INFO_INIT is in the Thingstream_createModem2Transport() flags then the modem driver skip those commands in the init string that are for diagnostics and information.
typedef const struct ThingstreamModem2UdpConfig_s* ThingstreamModem2UdpInit(uint32_t version, struct ThingstreamModem2SharedState_s *gState) |
Type definition for the hardware specific configuration initialisation routine. When calling Thingstream_createModem2Transport() the application must select the appropriate routine to match the hardware.
See the list of modem initialisation routines.
For other modems please contact suppo rt@t hings trea m.io
void Thingstream__dontUseLineBufferTransportWithModem2 | ( | void | ) |
The symbol Thingstream__dontUseLineBufferTransportWithModem2 is used for link-time checking.
If your application gets multiple definition (or duplicate symbol) errors for this symbol then your application may have attempted to create a SDK transport stack with both the modem2 transport and the line buffer transport.
These two transports are incompatible so your application should be using the ring buffer transport instead.
If your application needs to link both modem2 transport and line buffer transports (e.g. you are using line buffer outside the SDK transport stack) then please use Thingstream_createLineBufferTransport() instead of the legacy line_buffer_transport_create() api.
void Thingstream_Application_modemBinaryCallback | ( | const uint8_t * | data, |
uint16_t | len | ||
) |
This application supplied routine will be called when the modem transport receives binary data. If the application does not provide this routine then the binary data will be sent to the Thingstream_Application_modemCallback().
This feature is not supported for all modems, contact suppo for more details. rt@t hings trea m.io
data | the binary data |
len | the length of the binary data |
ThingstreamTransport* Thingstream_createModem2Transport | ( | ThingstreamTransport * | inner, |
uint16_t | flags, | ||
uint8_t * | buffer, | ||
uint16_t | bufSize, | ||
ThingstreamModem2UdpInit | udpConfigInit, | ||
ThingstreamPrintf_t | logger | ||
) |
Create an instance of the modem transport.
inner | the inner transport instance to use |
flags | a set of control flags. See common modem flags and modem2 flags. Set flags to '0' to get the default settings. |
buffer | the transport buffer to be used by outer transports |
bufSize | the size of the transport buffer. When using UDP we suggest a buffer size of MODEM2_UDP_BUFFER_LEN but when only USSD the buffer size should be MODEM2_USSD_BUFFER_LEN. |
udpConfigInit | the initialisation routine for a particular udp modem. See list of modem initialisation routines. |
logger | the function to use for debug logging |
uint32_t Thingstream_Modem2_getCUSDErrors | ( | ThingstreamTransport * | self, |
uint32_t | andClear | ||
) |
Return the number of accumulated +CUSD: errors.
self | this Transport instance |
andClear | if non-zero, then clear the count. |
uint32_t Thingstream_Modem2_getSeriousErrors | ( | ThingstreamTransport * | self, |
uint32_t | andClear | ||
) |
Return the number of accumulated serious errors (those that trigger a modem reset to recover)
self | this Transport instance |
andClear | if non-zero, then clear the count. |
ThingstreamTransportResult Thingstream_Modem2_sendLine | ( | ThingstreamTransport * | self, |
const char * | line, | ||
uint32_t | millis | ||
) |
Send the line to the modem and wait for an OK response. The application can implement Thingstream_Application_modemCallback() to receive any response from the modem caused by the sent line.
self | this instance of modem transport |
line | a null-terminated line to send to the modem ("\r\n" will be added) |
millis | the maximum number of milliseconds to run |
ThingstreamTransportResult Thingstream_Modem2_setBearerMSS | ( | ThingstreamTransport * | self, |
uint16_t | mss | ||
) |
Set the maximum sector size for the UDP transmissions. This must be called before the Thingstream stack is initialised.
self | this Transport instance |
mss | the maximum-sector-size for the UDP transmissions |