beautypg.com

3 mdm2 built-in module, 1 mdm2.send(string, timeout) – Rainbow Electronics GM862-GPS User Manual

Page 25

background image





Easy Script

in Python

80000ST10020a Rev.8 - 01/10/08

Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved

page 25 of 100

2.3 MDM2 built-in module

4


MDM2 built-in module is the second interface between Python and mobile internal AT command
handling. It is used to send AT commands from Python script to mobile and receive AT responses
from mobile to Python script when the classic MDM built-in module already in use.
MDM2 built-in module is independent from activation of CMUX on ASC0. In case you have enabled
CMUX on ASC0 (AT#CMUXSCR=1) then the second CMUX port will be dedicated to MDM2 and no
AT command handling will be possible on that port. Remember that first CMUX port is reserved for
SER module and fourth CMUX port is in use for debug (print statements).

For the default start configuration echo (ATE0) is disabled and long form (verbose) is return codes
(ATV1).
If you want to use MDM2 built-in module you need to import it first:

import MDM2
than you can use MDM2 built-in module methods like in the following example:

a = MDM2.send('AT', 0)
b = MDM2.sendbyte(0x0d, 0)
c = MDM2.receive(10)

which sends 'AT' and receives 'OK'.
More details about MDM2 built-in module methods can be found in the following paragraphs.

2.3.1 MDM2.send(string, timeout)


This command sends a string to AT command interface. First input parameter string is a Python string
that will be 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 = MDM2.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 MDM2.send command is 4096 bytes

4

feature available for the modules with the following Order-Num.: , GM862PYT***-***, GE863PYT***-***,

GE864PYT***-***, GC864PYT***-***, GE864PYH***-***, GM862GPS***-***, G3863GPS***-***, and the old
3990250660 and 3990250657