mirror of https://github.com/ARMmbed/mbed-os.git
Add option to set up SMS encoding
parent
033fffea84
commit
14f8d15242
|
|
@ -62,6 +62,11 @@ public:
|
|||
CellularSMSMmodeText
|
||||
};
|
||||
|
||||
enum CellularSMSEncoding {
|
||||
CellularSMSEncoding7Bit,
|
||||
CellularSMSEncoding8Bit,
|
||||
};
|
||||
|
||||
/** Does all the necessary initializations needed for receiving and sending SMS.
|
||||
*
|
||||
* @param mode enumeration for choosing the correct mode: text/pdu
|
||||
|
|
@ -69,7 +74,8 @@ public:
|
|||
* NSAPI_ERROR_NO_MEMORY on memory failure
|
||||
* NSAPI_ERROR_DEVICE_ERROR on other failures
|
||||
*/
|
||||
virtual nsapi_error_t initialize(CellularSMSMmode mode) = 0;
|
||||
virtual nsapi_error_t initialize(CellularSMSMmode mode,
|
||||
CellularSMSEncoding encoding = CellularSMSEncoding::CellularSMSEncoding7Bit) = 0;
|
||||
|
||||
/** Send the SMS with the given parameters
|
||||
*
|
||||
|
|
|
|||
|
|
@ -245,8 +245,11 @@ nsapi_error_t AT_CellularSMS::set_csdh(int show_header)
|
|||
return _at.at_cmd_discard("+CSDH", "=", "%d", show_header);
|
||||
}
|
||||
|
||||
nsapi_error_t AT_CellularSMS::initialize(CellularSMSMmode mode)
|
||||
nsapi_error_t AT_CellularSMS::initialize(CellularSMSMmode mode,
|
||||
CellularSMSEncoding encoding)
|
||||
{
|
||||
_use_8bit_encoding = (encoding == CellularSMSEncoding8Bit);
|
||||
|
||||
_at.set_urc_handler("+CMTI:", callback(this, &AT_CellularSMS::cmti_urc));
|
||||
_at.set_urc_handler("+CMT:", callback(this, &AT_CellularSMS::cmt_urc));
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ public:
|
|||
public:
|
||||
// from CellularSMS
|
||||
|
||||
virtual nsapi_error_t initialize(CellularSMSMmode mode);
|
||||
virtual nsapi_error_t initialize(CellularSMSMmode mode,
|
||||
CellularSMSEncoding encoding = CellularSMSEncoding7Bit);
|
||||
|
||||
virtual nsapi_size_or_error_t send_sms(const char *phone_number, const char *message, int msg_len);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue