Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
AT_CellularSMS Class Reference
Class AT_CellularSMS. More...
#include <AT_CellularSMS.h>
Inherits mbed::CellularSMS, and mbed::AT_CellularBase.
Public Types | |
enum | SupportedFeature |
Cellular module need to define an array of unsupported features if any, by default all features are supported. More... | |
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. | |
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. | |
virtual void | set_sms_callback (Callback< void()> func) |
Callback which is called when new sms is received. | |
virtual nsapi_error_t | set_cpms (const char *memr, const char *memw, const char *mems) |
CPMS preferred message storage. | |
virtual nsapi_error_t | set_csca (const char *sca, int type) |
CSCA - set Service Center Address. | |
virtual nsapi_size_or_error_t | set_cscs (const char *chr_set) |
Set command sets the current character set used by the device. | |
virtual nsapi_error_t | delete_all_messages () |
Deletes all messages from the currently set memory/SIM. | |
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. | |
virtual nsapi_error_t | initialize (CellularSMSMmode mode)=0 |
Does all the necessary initializations needed for receiving and sending sms. | |
ATHandler & | get_at_handler () |
Getter for at handler. | |
device_err_t | get_device_error () const |
Gets the device error that happened when using AT commands/responses. | |
Static Protected Attributes | |
static const SupportedFeature * | _unsupported_features |
Check if some functionality is supported by a cellular module. |
Detailed Description
Class AT_CellularSMS.
Class for SMS sending, reading and deleting.
Definition at line 33 of file AT_CellularSMS.h.
Member Enumeration Documentation
enum SupportedFeature [inherited] |
Cellular module need to define an array of unsupported features if any, by default all features are supported.
- Parameters:
-
features Array of type SupportedFeature with last element FEATURE_END_MARK
Definition at line 51 of file AT_CellularBase.h.
Member Function Documentation
nsapi_error_t delete_all_messages | ( | ) | [virtual] |
Deletes all messages from the currently set memory/SIM.
- Returns:
- possible error code
Implements CellularSMS.
Definition at line 599 of file AT_CellularSMS.cpp.
ATHandler & get_at_handler | ( | ) | [inherited] |
Getter for at handler.
Common method for all AT-classes.
- Returns:
- reference to ATHandler
Definition at line 27 of file AT_CellularBase.cpp.
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
Definition at line 32 of file AT_CellularBase.cpp.
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:
-
buf preallocated buffer for sms message content buf_len length of allocated buf phone_num preallocated buffer for phone number where sms was sent phone_len length of allocated phone_num buffer time_stamp preallocated 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_len length of allocated time_stamp buffer buf_size if method return error NSAPI_ERROR_NO_MEMORY because the given buf was not big enough this will hold the size which is enough. Otherwise zero.
- Returns:
- possible error code or size of buf. Will return SMS_ERROR_MULTIPART_ALL_PARTS_NOT_READ if sms was multipart but not all parts are present/failed to read.
Implements CellularSMS.
Definition at line 723 of file AT_CellularSMS.cpp.
virtual nsapi_error_t initialize | ( | CellularSMSMmode | mode ) | [pure virtual, inherited] |
Does all the necessary initializations needed for receiving and sending sms.
- Parameters:
-
mode enumeration for choosing the correct mode: text/pdu
- Returns:
- zero on success
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_number Phone number where to send sms message SMS message content msg_len Length of the message
- Returns:
- possible error code or length of the sent sms
Implements CellularSMS.
Definition at line 410 of file AT_CellularSMS.cpp.
nsapi_error_t set_cpms | ( | const char * | memr, |
const char * | memw, | ||
const char * | mems | ||
) | [virtual] |
CPMS preferred message storage.
- Parameters:
-
memr memory from which messages are read and deleted "SM" - SIM SMS memory storage (default) "ME" - NVM SMS storage memw memory to which writing and sending operations are made "SM" - SIM SMS memory storage (default) "ME" - NVM SMS storage mems memory to which received SMs are preferred to be stored "SM" - SIM SMS memory storage (default) "ME" - NVM SMS storage
- Returns:
- 1 for success, 0 for failure
Implements CellularSMS.
Definition at line 542 of file AT_CellularSMS.cpp.
nsapi_error_t set_csca | ( | const char * | sca, |
int | type | ||
) | [virtual] |
CSCA - set Service Center Address.
- Parameters:
-
sca Service Center Address to be used for mobile originated SMS transmissions. type 129 - national numbering scheme, 145 - international numbering scheme (contains the character "+")
- Returns:
- 1 for success, 0 for failure
Implements CellularSMS.
Definition at line 556 of file AT_CellularSMS.cpp.
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_set preferred 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. Otherwise negative errorcode.
Implements CellularSMS.
Definition at line 569 of file AT_CellularSMS.cpp.
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.
Definition at line 279 of file AT_CellularSMS.cpp.
void set_sms_callback | ( | Callback< void()> | func ) | [virtual] |
Callback which is called when new sms is received.
SMS can be fetched via method get_sms().
- Remarks:
- In PDU mode there can be multipart sms and callback is called for every received part.
- Parameters:
-
func Callback function which is called when new sms is received.
Implements CellularSMS.
Definition at line 537 of file AT_CellularSMS.cpp.
Field Documentation
AT_CellularBase::SupportedFeature const * _unsupported_features [static, protected, inherited] |
Check if some functionality is supported by a cellular module.
For example, most of standard AT commands are optional and not implemented by all cellular modules.
- Parameters:
-
feature check for feature to support
- Returns:
- true on supported, otherwise false
Definition at line 66 of file AT_CellularBase.h.
Generated on Tue Jul 12 2022 12:47:31 by
