#include "returncodes.h"
Typedefs | |
typedef enum swi_sms_Format | swi_sms_Format_t |
The encoding format to send the SMS. | |
typedef rc_ReturnCode_t(* | swi_sms_ReceptionCB_t )(const char *senderPtr, const char *messagePtr) |
SMS reception callback. | |
typedef void * | swi_sms_regId_t |
Registration identifier. | |
Enumerations | |
enum | swi_sms_Format { SWI_SMS_7BITS, SWI_SMS_8BITS, SWI_SMS_UCS2 } |
The encoding format to send the SMS. More... | |
Functions | |
rc_ReturnCode_t | swi_sms_Init () |
Initializes the module. | |
rc_ReturnCode_t | swi_sms_Destroy () |
Destroys the Sms library. | |
rc_ReturnCode_t | swi_sms_Send (const char *recipientPtr, const char *messagePtr, swi_sms_Format_t format) |
Sends an SMS. | |
rc_ReturnCode_t | swi_sms_Register (swi_sms_ReceptionCB_t callback, const char *senderPatternPtr, const char *messagePatternPtr, swi_sms_regId_t *regIdPtr) |
Registers a callback on SMS reception. | |
rc_ReturnCode_t | swi_sms_Unregister (swi_sms_regId_t regId) |
Cancels a callback registration on SMS reception. |
typedef enum swi_sms_Format swi_sms_Format_t |
The encoding format to send the SMS.
Supported formats depend on network operator. As a SMS payload has a limited size(140 bytes) and each format encode a character on various number of bits, the choice of encoding format impacts the number of characters sent into one SMS.
typedef rc_ReturnCode_t(* swi_sms_ReceptionCB_t)(const char *senderPtr,const char *messagePtr) |
SMS reception callback.
String parameters will be released after the callback have returned.
senderPtr | [IN] phone number of the SMS sender | |
messagePtr | [IN] message content |
typedef void* swi_sms_regId_t |
Registration identifier.
Used to identify an registration so that it can be unregistered afterwards.
enum swi_sms_Format |
The encoding format to send the SMS.
Supported formats depend on network operator. As a SMS payload has a limited size(140 bytes) and each format encode a character on various number of bits, the choice of encoding format impacts the number of characters sent into one SMS.
rc_ReturnCode_t swi_sms_Destroy | ( | ) |
Destroys the Sms library.
rc_ReturnCode_t swi_sms_Init | ( | ) |
Initializes the module.
A call to init is mandatory to enable SMS library APIs.
rc_ReturnCode_t swi_sms_Register | ( | swi_sms_ReceptionCB_t | callback, | |
const char * | senderPatternPtr, | |||
const char * | messagePatternPtr, | |||
swi_sms_regId_t * | regIdPtr | |||
) |
Registers a callback on SMS reception.
The callback will be called in a new pthread.
New SMS will be notified if the content (sender or message) of the SMS matches the given patterns.
callback | [IN] function to be called on sms reception matching both patterns. |
senderPatternPtr | [IN] string, regex pattern that matches the sender address, NULL means "no filtering". |
messagePatternPtr | [IN] string, regex pattern that matches the message, NULL means "no filtering". |
regIdPtr | [OUT] identifier of the registration, to be used to cancel it afterward using SMS_Unregister function. |
rc_ReturnCode_t swi_sms_Send | ( | const char * | recipientPtr, | |
const char * | messagePtr, | |||
swi_sms_Format_t | format | |||
) |
Sends an SMS.
RC_SERVICE_UNAVAILABLE when network status made the SMS sending fail
RC_BAD_FORMAT when selected SMS format is not supported.
recipientPtr | [IN] phone number to send the SMS to. |
messagePtr | [IN] string containing the message |
format | [IN] the format to use to send the message, see SMS_Format for accepted values. Supported formats may differ depending on the hardware and network capabilities. |
rc_ReturnCode_t swi_sms_Unregister | ( | swi_sms_regId_t | regId | ) |
Cancels a callback registration on SMS reception.
regId | [IN] identifier of the registration to cancel, the id returned by previous SMS_Register call. |