Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Public Member Functions | Static Public Member Functions
AT_CellularSMS Class Referenceabstract

Class AT_CellularSMS. More...

#include <AT_CellularSMS.h>

Inheritance diagram for AT_CellularSMS:
CellularSMS AT_CellularBase

Public Member Functions

virtual nsapi_size_or_error_t send_sms (const char *phone_number, const char *message, int msg_len)
 Send the SMS with the given parameters. More...
 
virtual nsapi_size_or_error_t get_sms (char *buf, uint16_t buf_len, char *phone_num, uint16_t phone_len, char *time_stamp, uint16_t time_len, int *buf_size)
 Gets the oldest received sms. More...
 
virtual void set_sms_callback (Callback< void()> func)
 Callback that is called when new SMS is received. More...
 
virtual nsapi_error_t set_cpms (const char *memr, const char *memw, const char *mems)
 CPMS preferred message storage. More...
 
virtual nsapi_error_t set_csca (const char *sca, int type)
 CSCA - set Service Center Address. More...
 
virtual nsapi_size_or_error_t set_cscs (const char *chr_set)
 Set command sets the current character set used by the device. More...
 
virtual nsapi_error_t delete_all_messages ()
 Deletes all messages from the currently set memory/SIM. More...
 
virtual void set_extra_sim_wait_time (int sim_wait_time)
 Some modems need extra time between AT commands and responses, or there will be error -314, SIM busy. More...
 
virtual nsapi_error_t initialize (CellularSMSMmode mode, CellularSMSEncoding encoding=CellularSMSEncoding::CellularSMSEncoding7Bit)=0
 Does all the necessary initializations needed for receiving and sending SMS. More...
 
ATHandlerget_at_handler ()
 Getter for at handler. More...
 
device_err_t get_device_error () const
 Gets the device error that happened when using AT commands/responses. More...
 

Static Public Member Functions

static void set_cellular_properties (const intptr_t *property_array)
 Cellular module need to define an array of cellular properties which defines module supported property values. More...
 
static intptr_t get_property (CellularProperty key)
 Get value for the given key. More...
 

Detailed Description

Class AT_CellularSMS.

Class for SMS sending, reading and deleting.

Definition at line 33 of file AT_CellularSMS.h.

Member Function Documentation

virtual nsapi_error_t delete_all_messages ( )
virtual

Deletes all messages from the currently set memory/SIM.

Returns
NSAPI_ERROR_OK on success NSAPI_ERROR_DEVICE_ERROR on failure

Implements CellularSMS.

ATHandler& get_at_handler ( )
inherited

Getter for at handler.

Common method for all AT-classes.

Returns
reference to ATHandler
device_err_t get_device_error ( ) const
inherited

Gets the device error that happened when using AT commands/responses.

This is at error returned by the device. Returned CME/CMS errors can be found from 3gpp documents 27007 and 27005.

Returns
at error (CME/CMS) while communicating with the device
static intptr_t get_property ( CellularProperty  key)
staticinherited

Get value for the given key.

Parameters
keykey for value to be fetched
Returns
property value for the given key. Value type is defined in enum CellularProperty
virtual nsapi_size_or_error_t get_sms ( char *  buf,
uint16_t  buf_len,
char *  phone_num,
uint16_t  phone_len,
char *  time_stamp,
uint16_t  time_len,
int *  buf_size 
)
virtual

Gets the oldest received sms.

Parameters
bufpreallocated buffer for SMS message content
buf_lenlength of allocated buf
phone_numpreallocated buffer for phone number where SMS was sent
phone_lenlength of allocated phone_num buffer
time_stamppreallocated buffer for TP-Service Centre Time Stamp (format: yy/MM/dd,hh:mm:ss-+zz). +-zz is timezone. The unit of time zone is a quarter of an hour relative to GMT. For example +32 would be GMT+8.
time_lenlength of allocated time_stamp buffer
buf_sizeif method return error NSAPI_ERROR_NO_MEMORY because the given buf was not big enough, this holds the size which is enough. Otherwise zero.
Returns
On success, length of the received SMS, (length of the buf, positive value) NSAPI_ERROR_PARAMETER if invalid parameters NSAPI_ERROR_NO_MEMORY on memory failure SMS_ERROR_MULTIPART_ALL_PARTS_NOT_READ if SMS was multipart but not all parts are present/failed to read. -1 if no SMS was found NSAPI_ERROR_DEVICE_ERROR on other failures

Implements CellularSMS.

virtual nsapi_error_t initialize ( CellularSMSMmode  mode,
CellularSMSEncoding  encoding = CellularSMSEncoding::CellularSMSEncoding7Bit 
)
pure virtualinherited

Does all the necessary initializations needed for receiving and sending SMS.

Parameters
modeenumeration for choosing the correct mode: text/pdu
Returns
NSAPI_ERROR_OK on success NSAPI_ERROR_NO_MEMORY on memory failure NSAPI_ERROR_DEVICE_ERROR on other failures
virtual nsapi_size_or_error_t send_sms ( const char *  phone_number,
const char *  message,
int  msg_len 
)
virtual

Send the SMS with the given parameters.

Parameters
phone_numberPhone number where to send SMS
messageSMS message content
msg_lenLength of the message
Returns
On success, length of the sent SMS (positive value) NSAPI_ERROR_PARAMETER if invalid parameters NSAPI_ERROR_NO_MEMORY on memory failure NSAPI_ERROR_DEVICE_ERROR on other failures

Implements CellularSMS.

static void set_cellular_properties ( const intptr_t *  property_array)
staticinherited

Cellular module need to define an array of cellular properties which defines module supported property values.

Parameters
property_arrayarray of module properties
virtual nsapi_error_t set_cpms ( const char *  memr,
const char *  memw,
const char *  mems 
)
virtual

CPMS preferred message storage.

Parameters
memrmemory from which messages are read and deleted "SM" - SIM SMS memory storage (default) "ME" - NVM SMS storage
memwmemory to which writing and sending operations are made "SM" - SIM SMS memory storage (default) "ME" - NVM SMS storage
memsmemory to which received SMs are preferred to be stored "SM" - SIM SMS memory storage (default) "ME" - NVM SMS storage
Returns
NSAPI_ERROR_OK on success NSAPI_ERROR_DEVICE_ERROR on failure

Implements CellularSMS.

virtual nsapi_error_t set_csca ( const char *  sca,
int  type 
)
virtual

CSCA - set Service Center Address.

Parameters
scaService Center Address to be used for mobile originated SMS transmissions.
type129 - national numbering scheme, 145 - international numbering scheme (contains the character "+")
Returns
NSAPI_ERROR_OK on success NSAPI_ERROR_DEVICE_ERROR on failure

Implements CellularSMS.

virtual nsapi_size_or_error_t set_cscs ( const char *  chr_set)
virtual

Set command sets the current character set used by the device.

"GSM", "IRA",....

Remarks
Current implementation support only ASCII so choose the correct character set.
Parameters
chr_setpreferred character set list (comma separated). Modem might not support the wanted character set, so chr_set list is looped from start until supported set is found. Used character set index is returned. See more from 3GPP TS 27.005.
Returns
Used character set index from the given list in case of success. NSAPI_ERROR_DEVICE_ERROR on failure

Implements CellularSMS.

virtual void set_extra_sim_wait_time ( int  sim_wait_time)
virtual

Some modems need extra time between AT commands and responses, or there will be error -314, SIM busy.

If SIM busy errors are an issue, this time should be increased. It can also be set to zero to make operations faster and more energy efficient if no errors will follow. By default, wait time is zero.

Parameters
sim_wait_time

Implements CellularSMS.

virtual void set_sms_callback ( Callback< void()>  func)
virtual

Callback that is called when new SMS is received.

SMS can be fetched using method get_sms().

Remarks
In PDU mode, there can be multipart SMS, and callback is called for every received part.
Parameters
funcCallback function that is called when new SMS is received.

Implements CellularSMS.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.