beautypg.com

3 python script operations, 1 executing a python script, 1 write python script – Rainbow Electronics GM862-GPS User Manual

Page 62: 2 download python script

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 62 of 100

3 Python Script Operations

3.1 Executing a Python script



The steps required to have a script running by the python engine of the module are:

• write the python script;

• download the python script into the module NVM;

• enable the python script;
• execute the python script.

3.1.1 Write Python script


A Python script is a simple text file, it can be written with any text editor but for your convenience a
complete Integrated Development Environment (IDE) is included in a software package that Telit
provides called

Telit Python Package

.

Remembering the supported features described in 1.6, it is simple to write the script and test it directly
from the IDE.
The following is the "Hello Word" short Python script that sends the simplest AT command to the AT
command parser, waits for response and then ends.

import MDM
print 'Hello World!'
result = MDM.send('AT\r', 0)
print result
c = MDM.receive(10)
print c

3.1.2 Download Python script


Command: AT#WSCRIPT=“< script_name >“,< size >,< know-how >

• < script_name >: file name

• < size >: file size (number of bytes)

• < know-how >: know how protection, 1 = on, 0 = off (default)