SMS

group LWGSM_SMS

SMS manager.

Enums

enum lwgsm_sms_status_t

SMS status in current memory.

Values:

enumerator LWGSM_SMS_STATUS_ALL

Process all SMS, used for mass delete or SMS list

enumerator LWGSM_SMS_STATUS_READ

SMS status is read

enumerator LWGSM_SMS_STATUS_UNREAD

SMS status is unread

enumerator LWGSM_SMS_STATUS_SENT

SMS status is sent

enumerator LWGSM_SMS_STATUS_UNSENT

SMS status is unsent

enumerator LWGSM_SMS_STATUS_INBOX

SMS status, used only for mass delete operation

Functions

lwgsmr_t lwgsm_sms_enable(const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Enable SMS functionality.

Parameters
  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

lwgsmr_t lwgsm_sms_disable(const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Disable SMS functionality.

Parameters
  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

lwgsmr_t lwgsm_sms_send(const char *num, const char *text, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Send SMS text to phone number.

Parameters
  • num[in] String number

  • text[in] Text to send. Maximal 160 characters

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

lwgsmr_t lwgsm_sms_read(lwgsm_mem_t mem, size_t pos, lwgsm_sms_entry_t *entry, uint8_t update, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Read SMS entry at specific memory and position.

Parameters
  • mem[in] Memory used to read message from

  • pos[in] Position number in memory to read

  • entry[out] Pointer to SMS entry structure to fill data to

  • update[in] Flag indicates update. Set to 1 to change UNREAD messages to READ or 0 to leave as is

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

lwgsmr_t lwgsm_sms_delete(lwgsm_mem_t mem, size_t pos, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Delete SMS entry at specific memory and position.

Parameters
  • mem[in] Memory used to read message from

  • pos[in] Position number in memory to read

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

lwgsmr_t lwgsm_sms_delete_all(lwgsm_sms_status_t status, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Delete all SMS entries with specific status.

Parameters
  • status[in] SMS status. This parameter can be one of all possible types in lwgsm_sms_status_t enumeration

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

lwgsmr_t lwgsm_sms_list(lwgsm_mem_t mem, lwgsm_sms_status_t stat, lwgsm_sms_entry_t *entries, size_t etr, size_t *er, uint8_t update, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

List SMS from SMS memory.

Parameters
  • mem[in] Memory to read entries from. Use LWGSM_MEM_CURRENT to read from current memory

  • stat[in] SMS status to read, either read, unread, sent, unsent or all

  • entries[out] Pointer to array to save SMS entries

  • etr[in] Number of entries to read

  • er[out] Pointer to output variable to save number of entries in array

  • update[in] Flag indicates update. Set to 1 to change UNREAD messages to READ or 0 to leave as is

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

lwgsmr_t lwgsm_sms_set_preferred_storage(lwgsm_mem_t mem1, lwgsm_mem_t mem2, lwgsm_mem_t mem3, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Set preferred storage for SMS.

Parameters
  • mem1[in] Preferred memory for read/delete SMS operations. Use LWGSM_MEM_CURRENT to keep it as is

  • mem2[in] Preferred memory for sent/write SMS operations. Use LWGSM_MEM_CURRENT to keep it as is

  • mem3[in] Preferred memory for received SMS entries. Use LWGSM_MEM_CURRENT to keep it as is

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t otherwise

struct lwgsm_sms_mem_t
#include <lwgsm_private.h>

SMS memory information.

Public Members

uint32_t mem_available

Bit field of available memories

lwgsm_mem_t current

Current memory choice

size_t total

Size of memory in units of entries

size_t used

Number of used entries

struct lwgsm_sms_t
#include <lwgsm_private.h>

SMS structure.

Public Members

uint8_t ready

Flag indicating feature ready by device

uint8_t enabled

Flag indicating feature enabled

lwgsm_sms_mem_t mem[3]

3 memory info for operation,receive,sent storage

struct lwgsm_pb_mem_t
#include <lwgsm_private.h>

SMS memory information.

Public Members

uint32_t mem_available

Bit field of available memories

lwgsm_mem_t current

Current memory choice

size_t total

Size of memory in units of entries

size_t used

Number of used entries

struct lwgsm_sms_entry_t
#include <lwgsm_types.h>

SMS entry structure.

Public Members

lwgsm_mem_t mem

Memory storage

size_t pos

Memory position

lwgsm_datetime_t datetime

Date and time

lwgsm_sms_status_t status

Message status

char number[26]

Phone number

char name[20]

Name in phonebook if exists

char data[161]

Data memory

size_t length

Length of SMS data