SparkFun_Swarm_Satellite_Arduino_Library
Public Member Functions | Public Attributes | List of all members
SWARM_M138 Class Reference

#include <SparkFun_Swarm_Satellite_Arduino_Library.h>

Public Member Functions

 SWARM_M138 (void)
 Class to communicate with the Swarm M138 satellite modem.
 
bool begin (HardwareSerial &hardSerial)
 Begin communication with the Swarm M138 modem. More...
 
bool begin (byte deviceAddress=SFE_QWIIC_SWARM_DEFAULT_I2C_ADDRESS, TwoWire &wirePort=Wire)
 Begin communication with the Swarm M138 modem. More...
 
void enableDebugging (Stream &debugPort=Serial)
 Enable debug messages on the chosen serial port Calling this function with nothing sets the debug port to Serial You can also call it with other streams like Serial1, SerialUSB, etc. More...
 
void disableDebugging (void)
 Disable debug messages.
 
Swarm_M138_Error_e getConfigurationSettings (char *settings)
 Read the modem device ID and name using the $CS message. More...
 
Swarm_M138_Error_e getDeviceID (uint32_t *id)
 Read the modem device ID using the $CS message. More...
 
bool isConnected (void)
 Check if the modem is connected and responding by getting the configuration settings. More...
 
Swarm_M138_Error_e getDateTime (Swarm_M138_DateTimeData_t *dateTime)
 Get the most recent $DT message. More...
 
Swarm_M138_Error_e getDateTimeRate (uint32_t *rate)
 Query the current $DT rate. More...
 
Swarm_M138_Error_e setDateTimeRate (uint32_t rate)
 Set the rate of $DT Date/Time messages. More...
 
Swarm_M138_Error_e getFirmwareVersion (char *version)
 Read the modem firmware version using the $FV message. More...
 
Swarm_M138_Error_e getGpsJammingIndication (Swarm_M138_GPS_Jamming_Indication_t *jamming)
 Get the most recent $GJ message. More...
 
Swarm_M138_Error_e getGpsJammingIndicationRate (uint32_t *rate)
 Query the current $GJ rate. More...
 
Swarm_M138_Error_e setGpsJammingIndicationRate (uint32_t rate)
 Set the rate of $GJ jamming indication messages. More...
 
Swarm_M138_Error_e getGeospatialInfo (Swarm_M138_GeospatialData_t *info)
 Get the most recent $GN message. More...
 
Swarm_M138_Error_e getGeospatialInfoRate (uint32_t *rate)
 Query the current $GN rate. More...
 
Swarm_M138_Error_e setGeospatialInfoRate (uint32_t rate)
 Set the rate of $GN geospatial information messages. More...
 
Swarm_M138_Error_e getGPIO1Mode (Swarm_M138_GPIO1_Mode_e *mode)
 Get the current GPIO1 pin mode using the $GP message. More...
 
Swarm_M138_Error_e setGPIO1Mode (Swarm_M138_GPIO1_Mode_e mode)
 Get the current GPIO1 pin mode using the $GP message. More...
 
Swarm_M138_Error_e getGpsFixQuality (Swarm_M138_GPS_Fix_Quality_t *fixQuality)
 Get the most recent $GS message. More...
 
Swarm_M138_Error_e getGpsFixQualityRate (uint32_t *rate)
 Query the current $GS rate. More...
 
Swarm_M138_Error_e setGpsFixQualityRate (uint32_t rate)
 Set the rate of $GS GPS fix quality messages. More...
 
Swarm_M138_Error_e powerOff (void)
 The Modem enters a low power mode until power is completely removed and restored. More...
 
Swarm_M138_Error_e getPowerStatus (Swarm_M138_Power_Status_t *powerStatus)
 Get the most recent $PW message. More...
 
Swarm_M138_Error_e getPowerStatusRate (uint32_t *rate)
 Query the current $PW rate. More...
 
Swarm_M138_Error_e setPowerStatusRate (uint32_t rate)
 Set the rate of $PW power status messages. More...
 
Swarm_M138_Error_e getTemperature (float *temperature)
 Get the modem temperature. More...
 
Swarm_M138_Error_e restartDevice (bool dbinit=false)
 Restart the modem. More...
 
Swarm_M138_Error_e getReceiveTest (Swarm_M138_Receive_Test_t *rxTest)
 Get the most recent $RT message. More...
 
Swarm_M138_Error_e getReceiveTestRate (uint32_t *rate)
 Query the current $RT rate. More...
 
Swarm_M138_Error_e setReceiveTestRate (uint32_t rate)
 Set the rate of $RT receive test messages. More...
 
Swarm_M138_Error_e sleepMode (uint32_t seconds)
 Instruct the modem to sleep for this many seconds. More...
 
Swarm_M138_Error_e sleepMode (Swarm_M138_DateTimeData_t sleepUntil, bool dateAndTime=true)
 Instruct the modem to sleep until this date and time. More...
 
Swarm_M138_Error_e getRxMessageCount (uint16_t *count, bool unread=false)
 Return the count of all messages (default) or unread messages (unread = true) More...
 
Swarm_M138_Error_e deleteRxMessage (uint64_t msg_id)
 Delete the RX message with the specified ID. More...
 
Swarm_M138_Error_e deleteAllRxMessages (bool read=true)
 Delete all read RX messages (default) or all messages (read = false) More...
 
Swarm_M138_Error_e markRxMessage (uint64_t msg_id)
 Mark the RX message with the specified ID as read. More...
 
Swarm_M138_Error_e markAllRxMessages (void)
 Mark all RX messages as read. More...
 
Swarm_M138_Error_e getMessageNotifications (bool *enabled)
 Query if message notifications are enabled. More...
 
Swarm_M138_Error_e setMessageNotifications (bool enable)
 Enable / disable receive message notifications. More...
 
Swarm_M138_Error_e readMessage (uint64_t msg_id, char *asciiHex, size_t len, uint32_t *epoch=NULL, uint16_t *appID=NULL)
 Read the message with the specified ID. More...
 
Swarm_M138_Error_e readOldestMessage (char *asciiHex, size_t len, uint64_t *msg_id, uint32_t *epoch=NULL, uint16_t *appID=NULL)
 Read the oldest unread message. More...
 
Swarm_M138_Error_e readNewestMessage (char *asciiHex, size_t len, uint64_t *msg_id, uint32_t *epoch=NULL, uint16_t *appID=NULL)
 Read the newest unread message. More...
 
Swarm_M138_Error_e getUnsentMessageCount (uint16_t *count)
 Return the count of all unsent messages. More...
 
Swarm_M138_Error_e deleteTxMessage (uint64_t msg_id)
 Delete the TX message with the specified ID. More...
 
Swarm_M138_Error_e deleteAllTxMessages (void)
 Delete all unsent messages. More...
 
Swarm_M138_Error_e listTxMessage (uint64_t msg_id, char *asciiHex, size_t len, uint32_t *epoch=NULL, uint16_t *appID=NULL)
 List the unsent message with the specified ID. More...
 
Swarm_M138_Error_e listTxMessagesIDs (uint64_t *ids, uint16_t maxCount)
 List the IDs of all the unsent messages. More...
 
Swarm_M138_Error_e transmitText (const char *data, uint64_t *msg_id)
 Queue a printable text message for transmission. More...
 
Swarm_M138_Error_e transmitText (const char *data, uint64_t *msg_id, uint16_t appID)
 Queue a printable text message for transmission with an appID. More...
 
Swarm_M138_Error_e transmitTextHold (const char *data, uint64_t *msg_id, uint32_t hold)
 Queue a printable text message for transmission with a hold duration. More...
 
Swarm_M138_Error_e transmitTextHold (const char *data, uint64_t *msg_id, uint32_t hold, uint16_t appID)
 Queue a printable text message for transmission with a hold duration and an appID. More...
 
Swarm_M138_Error_e transmitTextExpire (const char *data, uint64_t *msg_id, uint32_t epoch)
 Queue a printable text message for transmission with an expiry time (epoch) More...
 
Swarm_M138_Error_e transmitTextExpire (const char *data, uint64_t *msg_id, uint32_t epoch, uint16_t appID)
 Queue a printable text message for transmission with an expiry time (epoch) and an appID. More...
 
Swarm_M138_Error_e transmitBinary (const uint8_t *data, size_t len, uint64_t *msg_id)
 Queue a binary message for transmission. More...
 
Swarm_M138_Error_e transmitBinary (const uint8_t *data, size_t len, uint64_t *msg_id, uint16_t appID)
 Queue a binary message for transmission with an appID. More...
 
Swarm_M138_Error_e transmitBinaryHold (const uint8_t *data, size_t len, uint64_t *msg_id, uint32_t hold)
 Queue a binary message for transmission with a hold duration. More...
 
Swarm_M138_Error_e transmitBinaryHold (const uint8_t *data, size_t len, uint64_t *msg_id, uint32_t hold, uint16_t appID)
 Queue a binary message for transmission with a hold duration and an appID. More...
 
Swarm_M138_Error_e transmitBinaryExpire (const uint8_t *data, size_t len, uint64_t *msg_id, uint32_t epoch)
 Queue a binary message for transmission with an expiry time (epoch) More...
 
Swarm_M138_Error_e transmitBinaryExpire (const uint8_t *data, size_t len, uint64_t *msg_id, uint32_t epoch, uint16_t appID)
 Queue a binary message for transmission with an expiry time (epoch) and an appID. More...
 
bool checkUnsolicitedMsg (void)
 Check for the arrival of new serial data. Parse it. Process any unsolicited messages. Call the callback(s) - if enabled. More...
 
void setDateTimeCallback (void(*swarmDateTimeCallback)(const Swarm_M138_DateTimeData_t *dateTime))
 Set up the callback for the $DT Date Time message. More...
 
void setGpsJammingCallback (void(*swarmGpsJammingCallback)(const Swarm_M138_GPS_Jamming_Indication_t *jamming))
 Set up the callback for the $GJ jamming indication message. More...
 
void setGeospatialInfoCallback (void(*swarmGeospatialCallback)(const Swarm_M138_GeospatialData_t *info))
 Set up the callback for the $GN geospatial information message. More...
 
void setGpsFixQualityCallback (void(*swarmGpsFixQualityCallback)(const Swarm_M138_GPS_Fix_Quality_t *fixQuality))
 Set up the callback for the $GS GPS fix quality message. More...
 
void setPowerStatusCallback (void(*swarmPowerStatusCallback)(const Swarm_M138_Power_Status_t *status))
 Set up the callback for the $PW power status message. More...
 
void setReceiveMessageCallback (void(*swarmReceiveMessageCallback)(const uint16_t *appID, const int16_t *rssi, const int16_t *snr, const int16_t *fdev, const char *asciiHex))
 Set up the callback for the $RD receive data message. More...
 
void setReceiveTestCallback (void(*swarmReceiveTestCallback)(const Swarm_M138_Receive_Test_t *rxTest))
 Set up the callback for the $RT receive test message. More...
 
void setSleepWakeCallback (void(*swarmSleepWakeCallback)(Swarm_M138_Wake_Cause_e cause))
 Set up the callback for the $SL WAKE sleep mode messages. More...
 
void setModemStatusCallback (void(*swarmModemStatusCallback)(Swarm_M138_Modem_Status_e status, const char *data))
 Set up the callback for the $M138 modem status messages. More...
 
void setTransmitDataCallback (void(*swarmTransmitDataCallback)(const int16_t *rssi_sat, const int16_t *snr, const int16_t *fdev, const uint64_t *msg_id))
 Set up the callback for $TD SENT messages. More...
 
const char * modemStatusString (Swarm_M138_Modem_Status_e status)
 Convert modem status enum into printable text. More...
 
const char * modemErrorString (Swarm_M138_Error_e error)
 Convert modem error enum into printable text. More...
 
const char * commandErrorString (const char *ERR)
 Convert command error into a printable description. More...
 

Public Attributes

char * commandError
 

Detailed Description

Communication interface for the Swarm M138 satellite modem.

Member Function Documentation

◆ begin() [1/2]

bool SWARM_M138::begin ( byte  deviceAddress = SFE_QWIIC_SWARM_DEFAULT_I2C_ADDRESS,
TwoWire &  wirePort = Wire 
)

Begin communication with the Swarm M138 modem.

Parameters
deviceAddressThe I2C address of the Qwiic Swarm. Default is SFE_QWIIC_SWARM_DEFAULT_I2C_ADDRESS 0x52.
wirePortThe TwoWire (I2C) port used to communicate with the Power Board. Default is Wire.
Returns
True if communication with the modem was successful, otherwise false

◆ begin() [2/2]

bool SWARM_M138::begin ( HardwareSerial &  hardSerial)

Begin communication with the Swarm M138 modem.

Begin – initialize module and ensure it's connected

Parameters
hardSerialThe hardware serial port to be used to communicate with the modem
Returns
True if communication with the modem was successful, otherwise false

◆ checkUnsolicitedMsg()

bool SWARM_M138::checkUnsolicitedMsg ( void  )

Check for the arrival of new serial data. Parse it. Process any unsolicited messages. Call the callback(s) - if enabled.

Process unsolicited messages from the modem. Call the callbacks if required

Returns
True if at least one unsolicited message was processed, otherwise false

◆ commandErrorString()

const char * SWARM_M138::commandErrorString ( const char *  ERR)

Convert command error into a printable description.

Parameters
ERRThe command error as const char *
Returns
A pointer to the command error description in string (const char) format

◆ deleteAllRxMessages()

Swarm_M138_Error_e SWARM_M138::deleteAllRxMessages ( bool  read = true)

Delete all read RX messages (default) or all messages (read = false)

Parameters
readIf true (default): deletes the read messages If false: deletes all messages
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ deleteAllTxMessages()

Swarm_M138_Error_e SWARM_M138::deleteAllTxMessages ( void  )

Delete all unsent messages.

Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ deleteRxMessage()

Swarm_M138_Error_e SWARM_M138::deleteRxMessage ( uint64_t  msg_id)

Delete the RX message with the specified ID.

Parameters
msg_idThe ID of the message to be deleted
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ deleteTxMessage()

Swarm_M138_Error_e SWARM_M138::deleteTxMessage ( uint64_t  msg_id)

Delete the TX message with the specified ID.

Parameters
msg_idThe ID of the message to be deleted
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ enableDebugging()

void SWARM_M138::enableDebugging ( Stream &  debugPort = Serial)

Enable debug messages on the chosen serial port Calling this function with nothing sets the debug port to Serial You can also call it with other streams like Serial1, SerialUSB, etc.

Debug prints

Parameters
debugPortThe serial port to be used for the debug messages

◆ getConfigurationSettings()

Swarm_M138_Error_e SWARM_M138::getConfigurationSettings ( char *  settings)

Read the modem device ID and name using the $CS message.

Commands Configuration Settings

Parameters
settingsA pointer to where the settings will be stored It is recommended that the user allocates at least SWARM_M138_MEM_ALLOC_CS bytes to store the settings
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getDateTime()

Swarm_M138_Error_e SWARM_M138::getDateTime ( Swarm_M138_DateTimeData_t dateTime)

Get the most recent $DT message.

Date/Time

Parameters
dateTimeA pointer to a Swarm_M138_DateTimeData_t struct which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getDateTimeRate()

Swarm_M138_Error_e SWARM_M138::getDateTimeRate ( uint32_t *  rate)

Query the current $DT rate.

Parameters
rateA pointer to a uint32_t which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getDeviceID()

Swarm_M138_Error_e SWARM_M138::getDeviceID ( uint32_t *  id)

Read the modem device ID using the $CS message.

Parameters
idThe address of the uint32_t where the ID will be stored
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getFirmwareVersion()

Swarm_M138_Error_e SWARM_M138::getFirmwareVersion ( char *  version)

Read the modem firmware version using the $FV message.

Firmware Version

Parameters
settingsA pointer to where the settings will be stored It is recommended that the user allocates at least SWARM_M138_MEM_ALLOC_FV bytes to store the settings
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getGeospatialInfo()

Swarm_M138_Error_e SWARM_M138::getGeospatialInfo ( Swarm_M138_GeospatialData_t info)

Get the most recent $GN message.

Geospatial information

Parameters
infoA pointer to a Swarm_M138_GeospatialData_t struct which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getGeospatialInfoRate()

Swarm_M138_Error_e SWARM_M138::getGeospatialInfoRate ( uint32_t *  rate)

Query the current $GN rate.

Parameters
rateA pointer to a uint32_t which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getGPIO1Mode()

Swarm_M138_Error_e SWARM_M138::getGPIO1Mode ( Swarm_M138_GPIO1_Mode_e mode)

Get the current GPIO1 pin mode using the $GP message.

GPIO1 Control

Parameters
modeA pointer to a Swarm_M138_GPIO1_Mode_e enum where the mode will be stored
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getGpsFixQuality()

Swarm_M138_Error_e SWARM_M138::getGpsFixQuality ( Swarm_M138_GPS_Fix_Quality_t fixQuality)

Get the most recent $GS message.

GPS fix quality

Parameters
fixQualityA pointer to a Swarm_M138_GPS_Fix_Quality_t struct which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getGpsFixQualityRate()

Swarm_M138_Error_e SWARM_M138::getGpsFixQualityRate ( uint32_t *  rate)

Query the current $GS rate.

Parameters
rateA pointer to a uint32_t which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getGpsJammingIndication()

Swarm_M138_Error_e SWARM_M138::getGpsJammingIndication ( Swarm_M138_GPS_Jamming_Indication_t jamming)

Get the most recent $GJ message.

GPS Jamming/Spoofing Indication

Parameters
dateTimeA pointer to a Swarm_M138_DateTimeData_t struct which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getGpsJammingIndicationRate()

Swarm_M138_Error_e SWARM_M138::getGpsJammingIndicationRate ( uint32_t *  rate)

Query the current $GJ rate.

Parameters
rateA pointer to a uint32_t which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getMessageNotifications()

Swarm_M138_Error_e SWARM_M138::getMessageNotifications ( bool *  enabled)

Query if message notifications are enabled.

Parameters
enabledA pointer to a bool to hold the status
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ getPowerStatus()

Swarm_M138_Error_e SWARM_M138::getPowerStatus ( Swarm_M138_Power_Status_t powerStatus)

Get the most recent $PW message.

Power Status

Parameters
powerStatusA pointer to a Swarm_M138_Power_Status_t struct which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getPowerStatusRate()

Swarm_M138_Error_e SWARM_M138::getPowerStatusRate ( uint32_t *  rate)

Query the current $PW rate.

Parameters
rateA pointer to a uint32_t which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getReceiveTest()

Swarm_M138_Error_e SWARM_M138::getReceiveTest ( Swarm_M138_Receive_Test_t rxTest)

Get the most recent $RT message.

Receive Test

Parameters
rxTestA pointer to a Swarm_M138_Receive_Test_t struct which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getReceiveTestRate()

Swarm_M138_Error_e SWARM_M138::getReceiveTestRate ( uint32_t *  rate)

Query the current $RT rate.

Parameters
rateA pointer to a uint32_t which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getRxMessageCount()

Swarm_M138_Error_e SWARM_M138::getRxMessageCount ( uint16_t *  count,
bool  unread = false 
)

Return the count of all messages (default) or unread messages (unread = true)

Messages Received Management

Parameters
countA pointer to a uint16_t which will hold the message count
unreadIf false (default): returns the count of all messages If true: returns the count of the unread messages
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ getTemperature()

Swarm_M138_Error_e SWARM_M138::getTemperature ( float *  temperature)

Get the modem temperature.

Parameters
temperatureA pointer to a float which will hold the result
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ getUnsentMessageCount()

Swarm_M138_Error_e SWARM_M138::getUnsentMessageCount ( uint16_t *  count)

Return the count of all unsent messages.

Messages To Transmit Management

Parameters
countA pointer to a uint16_t which will hold the message count
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ isConnected()

bool SWARM_M138::isConnected ( void  )

Check if the modem is connected and responding by getting the configuration settings.

Returns
True if successful False if unsuccessful

◆ listTxMessage()

Swarm_M138_Error_e SWARM_M138::listTxMessage ( uint64_t  msg_id,
char *  asciiHex,
size_t  len,
uint32_t *  epoch = NULL,
uint16_t *  appID = NULL 
)

List the unsent message with the specified ID.

Parameters
msg_idThe ID of the message to be listed
asciiHexA pointer to a char array to hold the message
lenThe maximum message length which asciiHex can hold
epochOptional: a pointer to a uint32_t to hold the epoch at which the modem received the message
appIDOptional: a pointer to a uint16_t to hold the message appID if there is one
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ listTxMessagesIDs()

Swarm_M138_Error_e SWARM_M138::listTxMessagesIDs ( uint64_t *  ids,
uint16_t  maxCount 
)

List the IDs of all the unsent messages.

Parameters
idsA pointer to an array of uint64_t to hold the message IDs. Call getUnsentMessageCount first so you know how many IDs to expect and allocate storage for them. Listing all the messages through the backlog could blow up the memory, so this function reads the returned text one byte at a time and extracts the IDs from that.
maxCountStop after listing the IDs for this many messages Set this to the size of your uint64_t array
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ markAllRxMessages()

Swarm_M138_Error_e SWARM_M138::markAllRxMessages ( void  )

Mark all RX messages as read.

Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ markRxMessage()

Swarm_M138_Error_e SWARM_M138::markRxMessage ( uint64_t  msg_id)

Mark the RX message with the specified ID as read.

Parameters
msg_idThe ID of the message to be marked as read
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ modemErrorString()

const char * SWARM_M138::modemErrorString ( Swarm_M138_Error_e  error)

Convert modem error enum into printable text.

Parameters
errorThe modem error (enumerated)
Returns
A pointer to the modem error in string (const char) format

◆ modemStatusString()

const char * SWARM_M138::modemStatusString ( Swarm_M138_Modem_Status_e  status)

Convert modem status enum into printable text.

Convert modem status enum etc. into printable text

Parameters
statusThe modem status (enumerated)
Returns
A pointer to the modem status in string (const char) format

◆ powerOff()

Swarm_M138_Error_e SWARM_M138::powerOff ( void  )

The Modem enters a low power mode until power is completely removed and restored.

Power Off

Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ readMessage()

Swarm_M138_Error_e SWARM_M138::readMessage ( uint64_t  msg_id,
char *  asciiHex,
size_t  len,
uint32_t *  epoch = NULL,
uint16_t *  appID = NULL 
)

Read the message with the specified ID.

Parameters
msg_idThe ID of the message to be read
asciiHexA pointer to a char array to hold the message
lenThe maximum message length which asciiHex can hold
epochOptional: a pointer to a uint32_t to hold the epoch at which the modem received the message
appIDOptional: a pointer to a uint16_t to hold the message appID if there is one
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ readNewestMessage()

Swarm_M138_Error_e SWARM_M138::readNewestMessage ( char *  asciiHex,
size_t  len,
uint64_t *  msg_id,
uint32_t *  epoch = NULL,
uint16_t *  appID = NULL 
)

Read the newest unread message.

Parameters
asciiHexA pointer to a char array to hold the message
lenThe maximum message length which asciiHex can hold
msg_idA pointer to a uint64_t to hold the message ID
epochOptional: a pointer to a uint32_t to hold the epoch at which the modem received the message
appIDOptional: a pointer to a uint16_t to hold the message appID if there is one
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ readOldestMessage()

Swarm_M138_Error_e SWARM_M138::readOldestMessage ( char *  asciiHex,
size_t  len,
uint64_t *  msg_id,
uint32_t *  epoch = NULL,
uint16_t *  appID = NULL 
)

Read the oldest unread message.

Parameters
asciiHexA pointer to a char array to hold the message
lenThe maximum message length which asciiHex can hold
msg_idA pointer to a uint64_t to hold the message ID
epochOptional: a pointer to a uint32_t to hold the epoch at which the modem received the message
appIDOptional: a pointer to a uint16_t to hold the message appID if there is one
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ restartDevice()

Swarm_M138_Error_e SWARM_M138::restartDevice ( bool  dbinit = false)

Restart the modem.

Restart Device

Parameters
dbinitBool: If true, the database will be cleared - to clear the DBXTOHIVEFULL error. Default is false.
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ setDateTimeCallback()

void SWARM_M138::setDateTimeCallback ( void(*)(const Swarm_M138_DateTimeData_t *dateTime)  swarmDateTimeCallback)

Set up the callback for the $DT Date Time message.

Callbacks (called by checkUnsolicitedMsg)

Parameters
swarmDateTimeCallbackThe address of the function to be called when an unsolicited $DT message arrives

◆ setDateTimeRate()

Swarm_M138_Error_e SWARM_M138::setDateTimeRate ( uint32_t  rate)

Set the rate of $DT Date/Time messages.

Parameters
rateThe interval between messages 0 == Disable. Max is 2147483647 (2^31 - 1)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_INVALID_RATE if the rate is invalid SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ setGeospatialInfoCallback()

void SWARM_M138::setGeospatialInfoCallback ( void(*)(const Swarm_M138_GeospatialData_t *info)  swarmGeospatialCallback)

Set up the callback for the $GN geospatial information message.

Parameters
swarmGeospatialCallbackThe address of the function to be called when an unsolicited $GN message arrives

◆ setGeospatialInfoRate()

Swarm_M138_Error_e SWARM_M138::setGeospatialInfoRate ( uint32_t  rate)

Set the rate of $GN geospatial information messages.

Parameters
rateThe interval between messages 0 == Disable. Max is 2147483647 (2^31 - 1)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_INVALID_RATE if the rate is invalid SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ setGPIO1Mode()

Swarm_M138_Error_e SWARM_M138::setGPIO1Mode ( Swarm_M138_GPIO1_Mode_e  mode)

Get the current GPIO1 pin mode using the $GP message.

Parameters
modeA pointer to a Swarm_M138_GPIO1_Mode_e enum where the mode will be stored
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_INVALID_MODE if the pin mode is invalid SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERROR if unsuccessful

◆ setGpsFixQualityCallback()

void SWARM_M138::setGpsFixQualityCallback ( void(*)(const Swarm_M138_GPS_Fix_Quality_t *fixQuality)  swarmGpsFixQualityCallback)

Set up the callback for the $GS GPS fix quality message.

Parameters
swarmGpsFixQualityCallbackThe address of the function to be called when an unsolicited $GS message arrives

◆ setGpsFixQualityRate()

Swarm_M138_Error_e SWARM_M138::setGpsFixQualityRate ( uint32_t  rate)

Set the rate of $GS GPS fix quality messages.

Parameters
rateThe interval between messages 0 == Disable. Max is 2147483647 (2^31 - 1)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_INVALID_RATE if the rate is invalid SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ setGpsJammingCallback()

void SWARM_M138::setGpsJammingCallback ( void(*)(const Swarm_M138_GPS_Jamming_Indication_t *jamming)  swarmGpsJammingCallback)

Set up the callback for the $GJ jamming indication message.

Parameters
swarmGpsJammingCallbackThe address of the function to be called when an unsolicited $GJ message arrives

◆ setGpsJammingIndicationRate()

Swarm_M138_Error_e SWARM_M138::setGpsJammingIndicationRate ( uint32_t  rate)

Set the rate of $GJ jamming indication messages.

Parameters
rateThe interval between messages 0 == Disable. Max is 2147483647 (2^31 - 1)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_INVALID_RATE if the rate is invalid SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ setMessageNotifications()

Swarm_M138_Error_e SWARM_M138::setMessageNotifications ( bool  enable)

Enable / disable receive message notifications.

Parameters
enableIf true: enable $RD message notifications If false: disable $RD message notifications
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ setModemStatusCallback()

void SWARM_M138::setModemStatusCallback ( void(*)(Swarm_M138_Modem_Status_e status, const char *data)  swarmModemStatusCallback)

Set up the callback for the $M138 modem status messages.

Parameters
swarmModemStatusCallbackThe address of the function to be called when an unsolicited $M138 message arrives

◆ setPowerStatusCallback()

void SWARM_M138::setPowerStatusCallback ( void(*)(const Swarm_M138_Power_Status_t *status)  swarmPowerStatusCallback)

Set up the callback for the $PW power status message.

Parameters
swarmPowerStatusCallbackThe address of the function to be called when an unsolicited $PW message arrives

◆ setPowerStatusRate()

Swarm_M138_Error_e SWARM_M138::setPowerStatusRate ( uint32_t  rate)

Set the rate of $PW power status messages.

Parameters
rateThe interval between messages 0 == Disable. Max is 2147483647 (2^31 - 1)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_INVALID_RATE if the rate is invalid SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ setReceiveMessageCallback()

void SWARM_M138::setReceiveMessageCallback ( void(*)(const uint16_t *appID, const int16_t *rssi, const int16_t *snr, const int16_t *fdev, const char *asciiHex)  swarmReceiveMessageCallback)

Set up the callback for the $RD receive data message.

Parameters
swarmReceiveMessageCallbackThe address of the function to be called when an unsolicited $RD message arrives

◆ setReceiveTestCallback()

void SWARM_M138::setReceiveTestCallback ( void(*)(const Swarm_M138_Receive_Test_t *rxTest)  swarmReceiveTestCallback)

Set up the callback for the $RT receive test message.

Parameters
swarmReceiveTestCallbackThe address of the function to be called when an unsolicited $RT message arrives

◆ setReceiveTestRate()

Swarm_M138_Error_e SWARM_M138::setReceiveTestRate ( uint32_t  rate)

Set the rate of $RT receive test messages.

Parameters
rateThe interval between messages 0 == Disable. Max is 2147483647 (2^31 - 1)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_INVALID_RATE if the rate is invalid SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ setSleepWakeCallback()

void SWARM_M138::setSleepWakeCallback ( void(*)(Swarm_M138_Wake_Cause_e cause)  swarmSleepWakeCallback)

Set up the callback for the $SL WAKE sleep mode messages.

Parameters
swarmSleepWakeCallbackThe address of the function to be called when an unsolicited $SL WAKE message arrives

◆ setTransmitDataCallback()

void SWARM_M138::setTransmitDataCallback ( void(*)(const int16_t *rssi_sat, const int16_t *snr, const int16_t *fdev, const uint64_t *msg_id)  swarmTransmitDataCallback)

Set up the callback for $TD SENT messages.

Parameters
swarmTransmitDataCallbackThe address of the function to be called when an unsolicited $TD SENT message arrives

◆ sleepMode() [1/2]

Swarm_M138_Error_e SWARM_M138::sleepMode ( Swarm_M138_DateTimeData_t  sleepUntil,
bool  dateAndTime = true 
)

Instruct the modem to sleep until this date and time.

Parameters
sleepUntilA Swarm_M138_DateTimeData_t struct containing the date and time the modem should sleep until
dateAndTimeIf true (default), the modem will sleep until the specified date and time If false, the modem will sleep until the specified time
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ sleepMode() [2/2]

Swarm_M138_Error_e SWARM_M138::sleepMode ( uint32_t  seconds)

Instruct the modem to sleep for this many seconds.

Sleep Mode

Parameters
secondsThe sleep duration in seconds
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitBinary() [1/2]

Swarm_M138_Error_e SWARM_M138::transmitBinary ( const uint8_t *  data,
size_t  len,
uint64_t *  msg_id 
)

Queue a binary message for transmission.

Parameters
dataThe binary message
lenThe length of the binary message in bytes
msg_idA pointer to a uint64_t which will hold the assigned message ID
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitBinary() [2/2]

Swarm_M138_Error_e SWARM_M138::transmitBinary ( const uint8_t *  data,
size_t  len,
uint64_t *  msg_id,
uint16_t  appID 
)

Queue a binary message for transmission with an appID.

Parameters
dataThe binary message
lenThe length of the binary message in bytes
msg_idA pointer to a uint64_t which will hold the assigned message ID
appIDThe application ID: 0 to 64999
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitBinaryExpire() [1/2]

Swarm_M138_Error_e SWARM_M138::transmitBinaryExpire ( const uint8_t *  data,
size_t  len,
uint64_t *  msg_id,
uint32_t  epoch 
)

Queue a binary message for transmission with an expiry time (epoch)

Parameters
dataThe binary message
lenThe length of the binary message in bytes
msg_idA pointer to a uint64_t which will hold the assigned message ID
epochThe second date after which the message will be expired if it has not been sent. 1577836800 to 2147483647 (2020-01-01 00:00:00 to 2038-01-19 03:14:07)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitBinaryExpire() [2/2]

Swarm_M138_Error_e SWARM_M138::transmitBinaryExpire ( const uint8_t *  data,
size_t  len,
uint64_t *  msg_id,
uint32_t  epoch,
uint16_t  appID 
)

Queue a binary message for transmission with an expiry time (epoch) and an appID.

Parameters
dataThe binary message
lenThe length of the binary message in bytes
msg_idA pointer to a uint64_t which will hold the assigned message ID
epochThe second date after which the message will be expired if it has not been sent. 1577836800 to 2147483647 (2020-01-01 00:00:00 to 2038-01-19 03:14:07)
appIDThe application ID: 0 to 64999
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitBinaryHold() [1/2]

Swarm_M138_Error_e SWARM_M138::transmitBinaryHold ( const uint8_t *  data,
size_t  len,
uint64_t *  msg_id,
uint32_t  hold 
)

Queue a binary message for transmission with a hold duration.

Parameters
dataThe binary message
lenThe length of the binary message in bytes
msg_idA pointer to a uint64_t which will hold the assigned message ID
holdThe hold duration in seconds: 60 to 31536000 (one year) The message expires if it has not been transmitted within the hold duration The default hold duration is 172800 seconds (48 hours)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitBinaryHold() [2/2]

Swarm_M138_Error_e SWARM_M138::transmitBinaryHold ( const uint8_t *  data,
size_t  len,
uint64_t *  msg_id,
uint32_t  hold,
uint16_t  appID 
)

Queue a binary message for transmission with a hold duration and an appID.

Parameters
dataThe binary message
lenThe length of the binary message in bytes
msg_idA pointer to a uint64_t which will hold the assigned message ID
holdThe hold duration in seconds: 60 to 31536000 (one year) The message expires if it has not been transmitted within the hold duration The default hold duration is 172800 seconds (48 hours)
appIDThe application ID: 0 to 64999
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitText() [1/2]

Swarm_M138_Error_e SWARM_M138::transmitText ( const char *  data,
uint64_t *  msg_id 
)

Queue a printable text message for transmission.

Transmit Data

Parameters
dataThe message as printable ASCII characters (0x20 to 0x7E, space to ~)
msg_idA pointer to a uint64_t which will hold the assigned message ID
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitText() [2/2]

Swarm_M138_Error_e SWARM_M138::transmitText ( const char *  data,
uint64_t *  msg_id,
uint16_t  appID 
)

Queue a printable text message for transmission with an appID.

Parameters
dataThe message as printable ASCII characters (0x20 to 0x7E, space to ~)
msg_idA pointer to a uint64_t which will hold the assigned message ID
appIDThe application ID: 0 to 64999
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitTextExpire() [1/2]

Swarm_M138_Error_e SWARM_M138::transmitTextExpire ( const char *  data,
uint64_t *  msg_id,
uint32_t  epoch 
)

Queue a printable text message for transmission with an expiry time (epoch)

Parameters
dataThe message as printable ASCII characters (0x20 to 0x7E, space to ~)
msg_idA pointer to a uint64_t which will hold the assigned message ID
epochThe second date after which the message will be expired if it has not been sent. 1577836800 to 2147483647 (2020-01-01 00:00:00 to 2038-01-19 03:14:07)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitTextExpire() [2/2]

Swarm_M138_Error_e SWARM_M138::transmitTextExpire ( const char *  data,
uint64_t *  msg_id,
uint32_t  epoch,
uint16_t  appID 
)

Queue a printable text message for transmission with an expiry time (epoch) and an appID.

Parameters
dataThe message as printable ASCII characters (0x20 to 0x7E, space to ~)
msg_idA pointer to a uint64_t which will hold the assigned message ID
epochThe second date after which the message will be expired if it has not been sent. 1577836800 to 2147483647 (2020-01-01 00:00:00 to 2038-01-19 03:14:07)
appIDThe application ID: 0 to 64999
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitTextHold() [1/2]

Swarm_M138_Error_e SWARM_M138::transmitTextHold ( const char *  data,
uint64_t *  msg_id,
uint32_t  hold 
)

Queue a printable text message for transmission with a hold duration.

Parameters
dataThe message as printable ASCII characters (0x20 to 0x7E, space to ~)
msg_idA pointer to a uint64_t which will hold the assigned message ID
holdThe hold duration in seconds: 60 to 31536000 (one year) The message expires if it has not been transmitted within the hold duration The default hold duration is 172800 seconds (48 hours)
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

◆ transmitTextHold() [2/2]

Swarm_M138_Error_e SWARM_M138::transmitTextHold ( const char *  data,
uint64_t *  msg_id,
uint32_t  hold,
uint16_t  appID 
)

Queue a printable text message for transmission with a hold duration and an appID.

Parameters
dataThe message as printable ASCII characters (0x20 to 0x7E, space to ~)
msg_idA pointer to a uint64_t which will hold the assigned message ID
holdThe hold duration in seconds: 60 to 31536000 (one year) The message expires if it has not been transmitted within the hold duration The default hold duration is 172800 seconds (48 hours)
appIDThe application ID: 0 to 64999
Returns
SWARM_M138_ERROR_SUCCESS if successful SWARM_M138_ERROR_MEM_ALLOC if the memory allocation fails SWARM_M138_ERROR_ERR if a command ERR is received - error is returned in commandError SWARM_M138_ERROR_ERROR if unsuccessful

The documentation for this class was generated from the following files: