2 mdm built-in module, 1 mdm.send(string, timeout), 2 mdm.receive(timeout) – Rainbow Electronics GM862-GPS User Manual
Page 20

Easy Script
in Python
80000ST10020a Rev.8 - 01/10/08
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved
page 20 of 100
2.2 MDM built-in module
MDM built-in module is the interface between Python and the module AT command parser engine.
You need to use MDM built-in module if you want to send AT commands and data from Python script
to the network and receive responses and data from the network during connections.
For the default start configuration echo (ATE0) is disabled and long form (verbose) is return codes
(ATV1).
If you want to use MDM built-in module you need to import it first:
import MDM
then you can use MDM built-in module methods like in the following example:
a = MDM.send('AT', 0)
b = MDM.sendbyte(0x0d, 0)
c = MDM.receive(10)
which sends 'AT' and receives 'OK'.
More details about MDM built-in module methods can be found in the following paragraphs.
2.2.1 MDM.send(string, timeout)
This command sends a string to AT command interface. First input parameter string is a Python string
which is the string to send to AT command interface. Second input parameter timeout is a Python
integer, which is measured in 1/10s, and represents the time of waiting for the string to be sent to AT
command interface, with maximum value of timeout. Waiting time is caused by hardware flow control.
Return value is a Python integer which is -1 if timeout expired otherwise is 1.
Example:
a = MDM.send('AT', 5)
sends string 'AT' to AT command handling, possibly waiting for 0.5 s, assigning return value to a.
NOTE: The buffer available for MDM.send command is 4096 bytes
2
2.2.2 MDM.receive(timeout)
This command receives a string from AT command interface waiting for it until timeout is expired.
Return value will be the first string received no matter of how long the timeout is. Request to Send
2
For the products with the following old Order-Num. 3390250656, 3390250654 and 3990150466 the available
buffer is 2048 bytes