Module:digisms
From Digi Developer
Provides an interface to allow the Digi Cellular SMS handling functionality to pass SMS messages to Python applications for processing. By default SMS is disabled, so you might use the web interface (or other methods) to enable support for SMS. Your cellular data plan must support SMS - by default most data plans DO NOT.
Contents |
Receiving SMS Messages
The module contains a single type named Callback that is initialized with a callback function as follows:
digisms.Callback(cb) -> handle
Returns a handle to be used for deregistration later. The callback will be handled as long as the callback handle exists. If the handle goes out of scope or is deallocated, the callback will be unregistered.
Callback functions should be of the form:
cb(SMSMessage)
An 'SMSMessage' object contains these members:
- message
- Contents of the message
- source_addr
- Source address that sent the message
- timestamp
- Service Center assigned timestamp
The function's return value is ignored.
Transmitting SMS messages
The 'digisms' module provides a 'digisms.send' function to transmit an SMS message over the cellular network.
The send routine is of the form: > send(destination, message)
- destination
- A string that contains the phone number to direct the message to.
- message
- The message to send. Exceeding the maximum character length of a single SMS message will cause the gateway to transmit multiple messages.
Limitations & Suggestions
- Remember, call back functions will be executed in another thread. Shared data will need to be protected from race conditions due to concurrent access.
Availability
Products which support this module
This feature is available as of firmware revision 2.9.0 for cellular gateways with GSM modules. (See also Wiki Page: What is Your Product Firmware Level?)
Products which DO NOT support this module
This feature is not currently supported on:
- Digi ConnectPort X3
