Snapdragon® Telematics Application Framework (TelAF) Interface Specification
|
The SMS service can be used to send/receive SMS messages and access messages from storage. SMS is an easy and fast way to communicate or transmit data between devices in a cellular network.
The functions of this API are provided by the tafSMSSvc application service.
The following example illustrates how to bind to the SMS service.
bindings: { clientExe.clientComponent.taf_sms -> tafSMSSvc.taf_sms }
Before setting up and sending messages via these APIs, you need to create a message object by calling taf_sms_Create()
When a message object is no longer used, call taf_sms_Delete to free the resources and delete the object.
There are 3 types of message formats can be assigned, either text messages (7-bit), binary messages (8-bit), or UCS2 messages (16-bit). You can directly encode messages in PDU format as well. Message data length is set with these APIs accordingly. For text messages, the maximum supported character length is 160 characters. For binary messages, the maximum supported length is 140 bytes. For UCS2 messages, the maximum supported characters is 70 characters.
The following example illustrates creating, setting up, and deleting a message object.
When a message is ready, taf_sms_Send() can be called to send it. taf_sms_Send() is returned with modem feedback and with a maximum 10 second timeout.
A message object can only be used once for sending, no matter what the sending result is. Message objects need to be deleted by the caller.
To receive incoming messages, register a handler function with taf_sms_AddRxMsgHandler() and follow the handler type definition: void (*taf_sms_RxMsgHandlerFunc_t)(taf_sms_MsgRef_t msg)
A message object is created automatically when an incoming message is received, the registered handler is triggered and further processes on the received message.
To remove the handler function, call taf_sms_RemoveRxMsgHandler(). Callers have to delete the message object when the message is no longer needed.
SMS service provides three types of storage to store messages: HLOS, SIM, and NONE. HLOS is set as the default and it encrypts received messages and stores them in the file system. SIM is for storing messages in SIM. NONE storage specifies that a message notification is provided, but not stored in the system.
Preferred storage configuration is persistent in service config tree and can be accessed by the following APIs.
To receive storage indications, register a handler function with taf_sms_AddFullStorageEventHandler() and follow the handler type definition of taf_sms_FullStorageHandlerFunc_t
To remove the handler function, call taf_sms_RemoveFullStorageEventHandler().
HLOS storage provides more functions to maintain messsage configurations.
#0 – Create the message, the following manipulation will use the returned message reference from service.
#1 – Set the message content.
#2 – Set the receiver's phone number.
#3 – Set the message callback to get the sending result.
#4 – Send the message.
#5 – Delete the message object if it is not used anymore.
#0 – Set preferred storage to one of the storage types.
#1 – Set the message receiving handler to be able to receive any messages sent to the application.
#2 – Get the new message notification with the message reference.
#3 – Get the PDU data with the specified message reference.
#0 – Create the Rx message list for listing the messages stored in SIM and HLOS.
#1 – Get message reference of the first message from Rx message list.
#2 – Get the message reference of the next message from the Rx message list.
#3 – Delete the message with the specified message reference.
#4 – Delete the Rx message list after all manipulations are complete.