interfaces/modemServices/c/le_sms.h File Reference
#include "legato.h"
#include "le_mdm_defs.h"

Go to the source code of this file.

Typedefs

typedef struct le_sms_Msg * le_sms_msg_Ref_t
typedef struct le_sms_msg_List * le_sms_msg_ListRef_t
typedef struct
le_sms_msg_RxMessageHandler * 
le_sms_msg_RxMessageHandlerRef_t
typedef void(* le_sms_msg_RxMessageHandlerFunc_t )(le_sms_msg_Ref_t msgRef, void *contextPtr)

Functions

le_sms_msg_Ref_t le_sms_msg_Create (void)
void le_sms_msg_Delete (le_sms_msg_Ref_t msgRef)
le_sms_msg_Format_t le_sms_msg_GetFormat (le_sms_msg_Ref_t msgRef)
le_result_t le_sms_msg_SetDestination (le_sms_msg_Ref_t msgRef, const char *destPtr)
le_result_t le_sms_msg_GetSenderTel (le_sms_msg_Ref_t msgRef, char *telPtr, size_t len)
le_result_t le_sms_msg_GetTimeStamp (le_sms_msg_Ref_t msgRef, char *timestampPtr, size_t len)
size_t le_sms_msg_GetUserdataLen (le_sms_msg_Ref_t msgRef)
size_t le_sms_msg_GetPDULen (le_sms_msg_Ref_t msgRef)
le_result_t le_sms_msg_SetText (le_sms_msg_Ref_t msgRef, const char *textPtr)
le_result_t le_sms_msg_SetBinary (le_sms_msg_Ref_t msg, const uint8_t *binPtr, size_t len)
le_result_t le_sms_msg_SetPDU (le_sms_msg_Ref_t msgRef, const uint8_t *pduPtr, size_t len)
le_result_t le_sms_msg_GetText (le_sms_msg_Ref_t msgRef, char *textPtr, size_t len)
le_result_t le_sms_msg_GetBinary (le_sms_msg_Ref_t msgRef, uint8_t *binPtr, size_t *lenPtr)
le_result_t le_sms_msg_GetPDU (le_sms_msg_Ref_t msgRef, uint8_t *pduPtr, size_t *lenPtr)
le_sms_msg_RxMessageHandlerRef_t le_sms_msg_AddRxMessageHandler (le_sms_msg_RxMessageHandlerFunc_t handlerFuncPtr, void *contextPtr)
void le_sms_msg_RemoveRxMessageHandler (le_sms_msg_RxMessageHandlerRef_t handlerRef)
le_result_t le_sms_msg_Send (le_sms_msg_Ref_t msgRef)
le_result_t le_sms_msg_DeleteFromStorage (le_sms_msg_Ref_t msgRef)
le_sms_msg_ListRef_t le_sms_msg_CreateRxMsgList (void)
void le_sms_msg_DeleteList (le_sms_msg_ListRef_t msgListRef)
le_sms_msg_Ref_t le_sms_msg_GetFirst (le_sms_msg_ListRef_t msgListRef)
le_sms_msg_Ref_t le_sms_msg_GetNext (le_sms_msg_ListRef_t msgListRef)
le_sms_msg_Status_t le_sms_msg_GetStatus (le_sms_msg_Ref_t msgRef)
void le_sms_msg_MarkRead (le_sms_msg_Ref_t msgRef)
void le_sms_msg_MarkUnread (le_sms_msg_Ref_t msgRef)

Detailed Description

Legato SMS Services include file.

Copyright (C) Sierra Wireless, Inc. 2013. All rights reserved. Use of this work is subject to license.


Typedef Documentation

typedef struct le_sms_msg_List* le_sms_msg_ListRef_t

Opaque type for SMS Message Listing.

typedef struct le_sms_Msg* le_sms_msg_Ref_t

Declare a reference type for referring to SMS Message objects.

typedef void(* le_sms_msg_RxMessageHandlerFunc_t)(le_sms_msg_Ref_t msgRef, void *contextPtr)

Prototype for handler functions used to report that a new message has been received.

Parameters:
msgRefMessage reference.
contextPtrWhatever context information that the event handler may require.
typedef struct le_sms_msg_RxMessageHandler* le_sms_msg_RxMessageHandlerRef_t

Reference type for New Message Handler references.


Function Documentation

Register an handler function for SMS message reception.

Returns:
Handler reference, which is only needed for later removal of the handler.
Note:
Doesn't return on failure, so there's no need to check the return value for errors.
Parameters:
[in]handlerFuncPtrhandler function for message.
contextPtrreception. [IN] Handler's context.

Create an SMS Message data structure.

Returns:
Reference to the new Message object.
Note:
On failure, the process exits, so you don't have to worry about checking the returned reference for validity.

Create an object's reference of the list of received messages saved in the SMS message storage area.

Returns:
Reference to the List object. Null pointer if no messages have been retrieved.

Delete a Message data structure.

It deletes the Message data structure and all the allocated memory is freed. If several users own the Message object (e.g., several handler functions registered for SMS message reception), the Message object will only be deleted if one User owns the Message object.

Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.

Delete an SMS message from the storage area.

Verifies first if the parameter is valid, then it checks the modem state can support message deleting.

Returns:
LE_NOT_POSSIBLE Current modem state does not support message deleting.
LE_FAULT Function failed to perform the deletion.
LE_NO_MEMORY Message storage is not available.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefMessage to delete.

Delete the list of the Messages retrieved from the message storage.

Note:
On failure, the process exits, so you don't have to worry about checking the returned reference for validity.
Parameters:
[in]msgListRefMessages list.
le_result_t le_sms_msg_GetBinary ( le_sms_msg_Ref_t  msgRef,
uint8_t *  binPtr,
size_t *  lenPtr 
)

Get the binary Message.

Output parameters are updated with the binary message content and the length of the raw binary message in bytes. If the binary data exceed the value of 'len' input parameter, a LE_OVERFLOW error code is returned and 'raw' is filled until 'len' bytes.

Returns:
LE_FORMAT_ERROR Message is not in binary format
LE_OVERFLOW Message length exceed the maximum length.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
[out]binPtrBinary message.
[in,out]lenPtrLength of the binary message in bytes.

Get the first Message object reference in the list of messages retrieved with le_sms_msg_CreateRxMsgList().

Returns:
NULL No message found.
le_sms_msg_Ref_t Message object reference.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgListRefMessages list.

Get the message format (text or PDU).

Returns:
Message format.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.

Get the next Message object reference in the list of messages retrieved with le_sms_msg_CreateRxMsgList().

Returns:
NULL No message found.
le_sms_msg_Ref_t Message object reference.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgListRefMessages list.
le_result_t le_sms_msg_GetPDU ( le_sms_msg_Ref_t  msgRef,
uint8_t *  pduPtr,
size_t *  lenPtr 
)

Get the PDU message.

Output parameters are updated with the PDU message content and the length of the PDU message in bytes. If the PDU data exceed the value of 'len' input parameter, a LE_OVERFLOW error code is returned and 'pdu' is filled until 'len' bytes.

Returns:
LE_FORMAT_ERROR Unable to encode the message in PDU.
LE_OVERFLOW Message length exceed the maximum length.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
[out]pduPtrPDU message.
[in,out]lenPtrLength of the PDU message in bytes.

Get the message Length value.

Returns:
Length of the data in bytes of the PDU message.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
le_result_t le_sms_msg_GetSenderTel ( le_sms_msg_Ref_t  msgRef,
char *  telPtr,
size_t  len 
)

Get the Sender Telephone number.

Output parameter is updated with the Telephone number. If the Telephone number string exceeds the value of 'len' parameter, LE_OVERFLOW error code is returned and 'tel' is filled until 'len-1' characters and a null-character is implicitly appended at the end of 'tel'.

Returns:
LE_NOT_PERMITTED Message is not a received message.
LE_OVERFLOW Telephone number length exceed the maximum length.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
[out]telPtrTelephone number string.
[in]lenTelephone number stringlength.

Read the Message status (Received Read, Received Unread, Stored Sent, Stored Unsent).

Returns:
Status of the message.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
le_result_t le_sms_msg_GetText ( le_sms_msg_Ref_t  msgRef,
char *  textPtr,
size_t  len 
)

Get the text Message.

Output parameter is updated with the text string. If the text string exceedS the value of 'len' parameter, LE_OVERFLOW error code is returned and 'text' is filled until 'len-1' characters and a null-character is implicitly appended at the end of 'text'.

Returns:
LE_OVERFLOW Message length exceed the maximum length.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
[out]textPtrSMS text.
[in]lenThe maximum length of the text message.
le_result_t le_sms_msg_GetTimeStamp ( le_sms_msg_Ref_t  msgRef,
char *  timestampPtr,
size_t  len 
)

Get the Service Center Time Stamp string.

Output parameter is updated with the Time Stamp string. If the Time Stamp string exceeds the value of 'len' parameter, a LE_OVERFLOW error code is returned and 'timestamp' is filled until 'len-1' characters and a null-character is implicitly appended at the end of 'timestamp'.

Returns:
LE_NOT_PERMITTED Message is not a received message.
LE_OVERFLOW Timestamp number length exceed the maximum length.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
[out]timestampPtrMessage time stamp (in text mode). string format: "yy/MM/dd,hh:mm:ss+/-zz" (Year/Month/Day,Hour:Min:Seconds+/-TimeZone)
[in]lenTimestamp string length.

Get the message Length value.

Returns:
Number of characters for text messages, or the length of the data in bytes for raw binary messages.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.

Mark a message as 'read'.

Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.

Mark a message as 'unread'.

Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.

Unregister a handler function

Note:
Doesn't return on failure, no need to check the return value for errors.
Parameters:
[in]handlerRefHandler reference.

Send an SMS message.

Verifies first if the parameters are valid, then it checks the modem state can support message sending.

Returns:
LE_NOT_POSSIBLE Current modem state does not support message sending.
LE_FORMAT_ERROR Message content is invalid.
LE_FAULT Function failed to send the message.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefMessage(s) to send.
le_result_t le_sms_msg_SetBinary ( le_sms_msg_Ref_t  msg,
const uint8_t *  binPtr,
size_t  len 
)

Set the binary message content.

Returns:
LE_NOT_PERMITTED Message is Read-Only.
LE_BAD_PARAMETER Length of the data is equal to zero.
LE_OUT_OF_RANGE Message is too long.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgPointer to the message data structure.
[in]binPtrBinary data.
[in]lenLength of the data in bytes.
le_result_t le_sms_msg_SetDestination ( le_sms_msg_Ref_t  msgRef,
const char *  destPtr 
)

Set the Telephone destination number.

Telephone number is defined in ITU-T recommendations E.164/E.163. E.164 numbers can have a maximum of fifteen digits and are usually written with a ‘+’ prefix.

Returns:
LE_NOT_PERMITTED Message is Read-Only.
LE_BAD_PARAMETER Telephone destination number length is equal to zero.
LE_OVERFLOW Telephone destination number is too long.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
[in]destPtrTelephone number string.
le_result_t le_sms_msg_SetPDU ( le_sms_msg_Ref_t  msgRef,
const uint8_t *  pduPtr,
size_t  len 
)

Set the PDU message content.

Returns:
LE_NOT_PERMITTED Message is Read-Only.
LE_BAD_PARAMETER Length of the data is equal to zero.
LE_OUT_OF_RANGE Message is too long.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
[in]pduPtrPDU message.
[in]lenLength of the data in bytes.
le_result_t le_sms_msg_SetText ( le_sms_msg_Ref_t  msgRef,
const char *  textPtr 
)

This function must be called to set the Text Message content.

Returns:
LE_NOT_PERMITTED Message is Read-Only.
LE_BAD_PARAMETER Text message length is equal to zero.
LE_OUT_OF_RANGE Message is too long.
LE_OK Function succeeded.
Note:
If the caller is passing a bad pointer into this function, it is a fatal error, the function will not return.
Parameters:
[in]msgRefReference to the message object.
[in]textPtrSMS text.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines