Module sms

This module provides the ability to send and receive SMS (Short Message Service) messages via the embedded radio module.

Type sms

sms.init()

Initialize the module.

sms.register(callback, senderp, messagep)

Registers a callback on SMS reception.

sms.send(recipient, message, format)

Sends an SMS.

sms.unregister(id)

Cancels a callback registration on SMS reception.

Type sms

Field(s)

sms.init()

Initialize the module.

No service provided by this module will work unless this initializer function has been called first.

Return values

  1. a true value upon success

  2. nil followed by an error message otherwise.

sms.register(callback, senderp, messagep)

Registers a callback on SMS reception.

New SMS will be notified if the content (sender or message) of the SMS matches the given patterns.

Parameters

  • callback : function to be called on sms reception matching both patterns with recepient and message as parameters. Callback signature: callback(recipient_string, message_string).

  • senderp : string lua pattern that matches the sender address; nil means "no filtering".

  • messagep : string lua pattern that matches the message (sms content), nil means "no filtering".

Return values

  1. id (can be any Lua non-nil value) should be used only to call sms.unregister.

  2. nil followed by an error message otherwise.

sms.send(recipient, message, format)

Sends an SMS.

Multiple SMS sending is done automatically if the message cannot be held in one SMS.

Parameters

  • recipient : string, number/name of the SMS recipient.

  • message : string containing the message (binary).

  • format : string defining the format to use to send the message. Accepted values are "7bits", "8bits" or "ucs2", supported formats may differ depending on the hardware and network capabilities.

Return values

  1. "ok" on success.

  2. nil followed by an error message otherwise.

sms.unregister(id)

Cancels a callback registration on SMS reception.

Parameter

Return values

  1. "ok" on success.

  2. nil followed by an error message otherwise.