Telit Easy Script Python r18 PDF
Telit Easy Script Python r18 PDF
GC Family ( Compact )
GC864-QUAD
GC864-QUAD V2
GC864-DUAL V2
GE/GL Family ( Embedded )
GE864-QUAD
GE864-QUAD V2
GE864-QUAD Automotive V2
GE864-DUAL V2
GE864-GPS
GE865-QUAD
GE866-QUAD
GL865-DUAL
GL865-QUAD
GL868-DUAL
GL865-DUAL V3
GL865-QUAD V3
GL868-DUAL V3
GE910-QUAD V3
GT Family ( Terminal )
GT863-PY
GT864-PY
10.01.xx1
16.01.xx1
10.01.xx1
Note: the present document covers the SW versions shown in the Applicability Table and may
mention features which are not present or behave differently in previous SW versions.
1.
INTRODUCTION ......................................................................................................................................................... 9
1.1.
1.2.
1.3.
1.4.
1.5.
1.6.
1.7.
2.
SCOPE ......................................................................................................................................................................... 9
AUDIENCE.................................................................................................................................................................... 9
CONTACT INFORMATION, SUPPORT .................................................................................................................................. 9
DOCUMENT ORGANIZATION .......................................................................................................................................... 10
TEXT CONVENTIONS..................................................................................................................................................... 10
RELATED DOCUMENTS ................................................................................................................................................. 11
DOCUMENT HISTORY ................................................................................................................................................... 11
3.
3.3.8.
MDM2.getCTS() ............................................................................................................................................. 34
3.3.9.
MDM2.getDSR()............................................................................................................................................. 34
3.3.10.
MDM2.getRI() ................................................................................................................................................ 35
3.3.11.
MDM2.setRTS(RTS_value) ............................................................................................................................. 35
3.3.12.
MDM2.setDTR(DTR_value) ............................................................................................................................ 35
3.4.
SER BUILT-IN MODULE ................................................................................................................................................. 36
3.4.1.
SER.send(string) ............................................................................................................................................. 36
3.4.2.
SER.receive(timeout)...................................................................................................................................... 37
3.4.3.
SER.read() ...................................................................................................................................................... 37
3.4.4.
SER.sendbyte(byte) ........................................................................................................................................ 38
3.4.5.
SER.receivebyte(timeout) .............................................................................................................................. 38
3.4.6.
SER.readbyte() ............................................................................................................................................... 38
3.4.7.
SER.set_speed(speed, <char format>) ........................................................................................................... 39
3.4.8.
SER.setDCD(DCD_value) ................................................................................................................................ 39
3.4.9.
SER.setCTS(CTS_value) ................................................................................................................................... 40
3.4.10.
SER.setDSR(DSR_value) ................................................................................................................................. 40
3.4.11.
SER.setRI(RI_value) ........................................................................................................................................ 40
3.4.12.
SER.getRTS() .................................................................................................................................................. 41
3.4.13.
SER.getDTR() .................................................................................................................................................. 41
3.5.
SER2 BUILT-IN MODULE ............................................................................................................................................... 42
3.5.1.
SER2.send(string) ........................................................................................................................................... 42
3.5.2.
SER2.receive(timeout) ................................................................................................................................... 43
3.5.3.
SER2.read() .................................................................................................................................................... 43
3.5.4.
SER2.sendbyte(byte) ...................................................................................................................................... 44
3.5.5.
SER2.receivebyte(timeout) ............................................................................................................................ 44
3.5.6.
SER2.readbyte() ............................................................................................................................................. 45
3.5.7.
SER2.set_speed(speed, <format>) ................................................................................................................. 45
3.6.
GPIO BUILT-IN MODULE ............................................................................................................................................... 46
3.6.1.
GPIO.setIOvalue(GPIOnumber, value) ........................................................................................................... 46
3.6.2.
GPIO.getIOvalue(GPIOnumber) ..................................................................................................................... 47
3.6.3.
GPIO.setIOdir(GPIOnumber, value, direction) ............................................................................................... 47
3.6.4.
GPIO.getIOdir(GPIOnumber) ......................................................................................................................... 47
3.6.5.
GPIO.getADC(adcNumber) ............................................................................................................................ 48
3.6.6.
GPIO.setDAC(enable, value) .......................................................................................................................... 48
3.6.7.
GPIO.setVAUX(vauxNumber, enable) ............................................................................................................ 48
3.6.8.
GPIO.getAXE() ................................................................................................................................................ 49
3.6.9.
GPIO.setSLED(status, onDuration, offDuration) ............................................................................................ 49
3.6.10.
GPIO.getCBC() ................................................................................................................................................ 50
3.7.
MOD BUILT-IN MODULE .............................................................................................................................................. 51
3.7.1.
MOD.secCounter() ......................................................................................................................................... 51
3.7.2.
MOD.sleep(sleeptime) ................................................................................................................................... 52
3.7.3.
MOD.watchdogEnable(timeout) ................................................................................................................... 52
3.7.4.
MOD.watchdogReset() .................................................................................................................................. 52
3.7.5.
MOD.watchdogDisable() ............................................................................................................................... 53
3.7.6.
MOD.powerSaving(timeout).......................................................................................................................... 53
3.7.7.
MOD.powerSavingExitCause() ....................................................................................................................... 53
3.7.8.
MOD.encBase64(dataToCode) ...................................................................................................................... 54
3.8.
IIC BUILT-IN MODULE ................................................................................................................................................... 55
3.8.1.
IIC.new(SDA_pin, SCL_pin, <ADDR>).............................................................................................................. 56
3.8.2.
IIC.init() .......................................................................................................................................................... 56
3.8.3.
IIC.readwrite(string, read_len) ...................................................................................................................... 57
3.8.4.
IIC.sendbyte(byte) .......................................................................................................................................... 58
3.8.5.
IIC.send(string) ............................................................................................................................................... 58
3.8.6.
IIC.dev_read(addr, len) .................................................................................................................................. 59
3.8.7.
IIC.dev_write(addr, string) ............................................................................................................................. 59
3.8.8.
IIC.dev_gen_read(addr, start, len) ................................................................................................................. 60
3.8.9.
IIC.dev_gen_write(addr, start, string) ........................................................................................................... 60
3.9.
SPI BUILT-IN MODULE .................................................................................................................................................. 61
3.9.1.
SPI.new(SCLK_pin, MOSI_pin, MISO_pin, <SS0>, <SS1>,<SS7>) .................................................................. 62
3.9.2.
SPI.init (CPOL, CPHA, <SSPOL>, <SS>) ............................................................................................................ 63
3.9.3.
SPI.readwrite(string, <read_len>, <SS>) ........................................................................................................ 64
3.9.4.
SPI.sendbyte(byte, <SS_number>) ................................................................................................................. 66
3.9.5.
SPI.readbyte(<SS_number>) .......................................................................................................................... 66
3.9.6.
SPI.send(string, <SS_number>) ...................................................................................................................... 67
3.9.7.
SPI.read(len, <SS_number>) .......................................................................................................................... 67
3.10. GPS BUILT-IN MODULE................................................................................................................................................. 68
3.10.1.
GPS. powerOnOff(newStatus)........................................................................................................................ 68
3.10.2.
GPS.getPowerOnOff() .................................................................................................................................... 69
3.10.3.
GPS.resetMode(mode) ................................................................................................................................... 69
3.10.4.
GPS.getActualPosition() ................................................................................................................................. 69
3.10.5.
GPS.powerSavingMode(mode, pushToFixPeriod).......................................................................................... 70
3.10.6.
GPS.powerSavingWakeUp() .......................................................................................................................... 70
3.10.7.
GPS.getLastGGA() .......................................................................................................................................... 70
3.10.8.
GPS.getLastGLL() ........................................................................................................................................... 71
3.10.9.
GPS.getLastGSA() ........................................................................................................................................... 71
3.10.10. GPS.getLastGSV() ........................................................................................................................................... 71
3.10.11. GPS.getLastRMC() .......................................................................................................................................... 72
3.10.12. GPS.getLastVTG()........................................................................................................................................... 72
3.10.13. GPS.getPosition() ........................................................................................................................................... 72
4.
5.
5.1.
TECHNICAL CHARACTERISTICS......................................................................................................................................... 95
5.1.1.
General .......................................................................................................................................................... 95
5.2.
PYTHON SUPPORTED FEATURES ...................................................................................................................................... 96
5.2.1.
Operators, statements, functions .................................................................................................................. 96
5.2.2.
Truth Value Testing........................................................................................................................................ 97
5.2.3.
Boolean Operations ....................................................................................................................................... 97
5.2.4.
Comparisons .................................................................................................................................................. 97
5.2.5.
Numeric Types: Integers ................................................................................................................................ 98
5.2.6.
Numeric Types: Long Integers ....................................................................................................................... 98
5.2.7.
Numeric Types: Float ..................................................................................................................................... 99
5.2.8.
Numeric Types: Complex ............................................................................................................................... 99
5.2.9.
Sequence Types: Strings................................................................................................................................. 99
5.2.10.
Sequence Types: Tuples ...............................................................................................................................100
5.2.11.
Sequence Types: Lists ...................................................................................................................................100
5.2.12.
Mapping Types: Dictionaries .......................................................................................................................101
5.2.13.
Other Built-in Types: File Objects .................................................................................................................102
5.2.14.
Other Built-in Types: Modules .....................................................................................................................102
5.2.15.
Other Built-in Types: Classes ........................................................................................................................103
5.2.16.
Other Built-in Types: Functions ....................................................................................................................103
5.2.17.
Other Built-in Types: Methods .....................................................................................................................104
5.2.18.
Other Built-in Types: Type Objects ...............................................................................................................104
5.2.19.
Other Built-in Types: Null Object .................................................................................................................104
5.2.20.
Other Built-in Types: Ellipsis Object .............................................................................................................104
5.2.21.
Other Built-in Types: Buffer Objects ............................................................................................................104
5.2.22.
Other Built-in Types: Range Objects ............................................................................................................104
5.2.23.
Other Built-in Internal Types: Code Objects .................................................................................................105
5.2.24.
Other Built-in Internal Types: Frame Objects...............................................................................................105
5.2.25.
Other Built-in Internal Types: Traceback Objects ........................................................................................105
5.2.26.
Other Built-in Internal Types: Slice Objects..................................................................................................106
5.2.27.
Built-in Exceptions .......................................................................................................................................106
5.2.28.
Built-in Functions .........................................................................................................................................107
5.2.29.
Built-in Modules: marshal............................................................................................................................108
5.2.30.
Built-in Modules: imp...................................................................................................................................109
5.2.31.
Built-in Modules: __main__.........................................................................................................................109
5.2.32.
Built-in Modules: __builtin__.......................................................................................................................109
5.2.33.
Built-in Modules: sys ....................................................................................................................................110
5.2.34.
Built-in Modules: md5 .................................................................................................................................111
5.2.35.
Built-in Modules: binascii .............................................................................................................................111
5.2.36.
Library Modules ...........................................................................................................................................111
6.
7.
7.2.
8.
i = 1;
li = 9999999999L;
s = 'Hello'
L = [1, 5, 3, 9, 14];
print D['a']
a = 7
a = str(2*a) + ' bytes'
# 7 (integer)
# '14 bytes' (string)
**
<<
>>
&
is
in
<
<=
>
-=
*=
/=
>=
==
!=
not
and
or
+=
%=
**=
<<=
>>=
&=
^=
|=
()
[ ]
{ }
[:]
``
lambda
if a > 0:
b = 1
c = 2
my_list = [1,
['abc', 2],
-3+6j]
print my_list
if a > b:
print 'a is greater than b.'
elif a < b:
print 'a is lower than b.'
else:
print 'a equals b.'
if 2 <= a <= 7:
print 'a is in the interval [2, 7].'
numbers = [ ]
i = 0
while i < 100:
numbers.append(i)
i = i + 1
# or
numbers = [ ]
for i in range(100):
numbers.append(i)
numbers = range(100)
i += 1
complex
float
docstring
marshal
imp
_main_
_builtin_
sys
md5
binascii
import MDM
a = MDM.send('AT', 0)
b = MDM.sendbyte(0x0d, 0)
c = MDM.receive(10)
a = MDM.send('AT', 5)
a = MDM.receive(15)
a = MDM.read()
b = MDM.sendbyte(0x0d, 0)
b = MDM2.receivebyte(20)
b = MDM.readbyte()
cd = MDM.getDCD()
cts = MDM.getCTS()
dsr = MDM.getDSR()
ri = MDM.getRI()
MDM.setRTS(1)
MDM.setDTR(0)
import MDM2
a = MDM2.send('AT', 0)
b = MDM2.sendbyte(0x0d, 0)
c = MDM2.receive(10)
a = MDM2.send('AT', 5)
a = MDM2.receive(15)
a = MDM2.read()
b = MDM2.sendbyte(0x0d, 0)
b = MDM2.receivebyte(20)
b = MDM2.readbyte()
cd = MDM2.getDCD()
cts = MDM2.getCTS()
dsr = MDM2.getDSR()
ri = MDM2.getRI()
MDM2.setRTS(1)
MDM2.setDTR(0)
import SER
a
b
c
d
=
=
=
=
SER.set_speed('9600')
SER.send('test')
SER.sendbyte(0x0d)
SER.receive(10)
a = SER.send('test')
a = SER.receive(15)
a = SER.read()
b = SER.sendbyte(0x0d)
b = SER.receivebyte(20)
b = SER.readbyte()
b = SER.set_speed('115200')
SER.setDCD(1)
SER.setCTS(1)
SER.setDSR(1)
SER.setRI(1)
rts = SER.getRTS()
dtr = SER.getDTR()
import SER2
a = SER2.send('test')
b = SER2.sendbyte(0x0d)
c = SER2.receive(10)
a = SER2.send('test')
a = SER2.receive(15)
a = SER2.read()
b = SER2.sendbyte(0x0d)
b = SER2.receivebyte(20)
b = SER2.readbyte()
b = SER2.set_speed('115200')
import GPIO
a = GPIO.getIOvalue(5)
b = GPIO.setIOvalue(4, 1)
b = GPIO.setIOvalue(4, 1)
b = GPIO.getIOvalue(5)
c = GPIO.setIOdir(4, 0, 0)
d = GPIO.getIOdir(7)
mV = GPIO.getADC(2)
res = GPIO.setVAUX(1, 1)
hf = GPIO.getAXE()
0
1
2
3
ALWAYS OFF
ALWAYS ON
AUTO
BLINKING
(chargerStatus, batteryVoltage).
cbc = GPIO.getCBC()
import MOD
MOD.sleep(15)
a = MOD.secCounter()
MOD.sleep(15)
MOD.watchdogEnable(50)
MOD.watchdogReset()
MOD.watchdogDisable()
MOD.powerSaving(100)
MOD.powerSavingExitCause()
dataCoded = MOD.encBase64(dataToCode)
import IIC
myIIC1 = IIC.new(3,4,0x50)
status = myIIC1.init()
bus1 = IIC.new(3,4)
bus2 = IIC.new(5,6)
a = bus1.init()
a = bus1.sendbyte(123)
a = bus1.send('test')
a = bus1.dev_read(114,10)
a = bus1.dev_write(114,'123456789')
a = bus1.dev_gen_read(114,122, 10)
import SPI
status = mySPIobject.init(0, 0, 0)
status = mySPIobject.init(0, 0, 0, 1)
status = mySPIobject.init(0, 0, 0, 0)
#start
import
import
import
import
of SPI example
SPI
MOD
MDM
GPIO
CMD_WRITE = '\x02'
CMD_READ = '\x03'
CMD_RESET = '\xC0'
REG_ADDR_X = '\x0E'
REG_ADDR_Y = '\x0F'
a = bus3.sendbyte(123)
b=bus4.sendbyte(111,1)
a = bus3.readbyte()
b = bus4.readbyte(1)
a = bus3.send('test')
a = bus4.read(10,0)
import GPS
position = GPS.getActualPosition()
GPS.powerOnOff(0)
status = GPS.getPowerOnOff()
res = GPS.resetMode(1)
lastPosition = GPS.getActualPosition()
res = GPS.powerSavingWakeUp()
gga = GPS.getLastGGA()
gll = GPS.getLastGLL()
gsa = GPS.getLastGSA()
gsv = GPS.getLastGSV()
rms = GPS.getLastRMC()
vtg = GPS.getLastVTG()
pos = GPS.getPosition()
import MDM
print 'Hello World!'
result = MDM.send('AT\r', 0)
print result
c = MDM.receive(10)
print c
AT#WSCRIPT=a.py,110
>>>
AT#LSCRIPT?
AT#ESCRIPT?
AT#ESCRIPT=a.py
OK
< script_name >: file name
AT#RSCRIPT=a.py
AT#LSCRIPT
AT#DSCRIPT=a.py
AT#REBOOT
AT#STARTMODESCR=2
AT#SSCTRACE=0
AT#CMUXSCR=1,<bitrate>
AT#STARTMODESCR=1,10
complex
float
docstring
marshal
imp
__main__
__builtin__
sys
md5
x or y
x and y
not x
<
<=
>
>=
==
<>
!=
is
is not
x
x
x
x
x
+ y
- y
* y
/ y
% y
-x
+x
abs(x)
int(x)
long(x)
divmod(x, y)
pow(x, y)
x ** y
x | y
x ^ y
x & y
x << n
x >> n
~x
x
x
x
x
x
+ y
- y
* y
/ y
% y
-x
+x
abs(x)
int(x)
long(x)
divmod(x, y)
pow(x, y)
x ** y
x | y
x ^ y
x & y
x << n
x >> n
~x
x in s
x not in s
s + t
s * n, n * s
s[i]
s[i:j]
len(s)
min(s)
max(s)
s.capitalize()
s.count(sub[, start[, end]])
s.endswith(suffix[, start[,
end]])
s.find(sub[, start[, end]])
s.index(sub[, start[, end ]])
s.join(seq)
s.lstrip()
s.lower()
s.replace(old, new[,
maxsplit])
s.rfind(sub[, start[, end]])
s.rindex(sub[, start[, end]])
s.rstrip()
s.split([sep [,maxsplit]])
s.startswith(prefix[, start[,
end]])
s.strip()
s.swapcase()
s.translate(table[,
deletechars])
s.upper()
x in s
x not in s
s + t
s * n, n * s
s[i]
s[i:j]
len(s)
min(s)
max(s)
x in s
x not in s
s + t
s * n, n * s
s[i]
s[i:j]
len(s)
min(s)
max(s)
s[i] = x
s[i:j] = t
del s[i:j]
s.append(x)
s.extend(x)
s.count(x)
s.index(x)
s.insert(i, x)
s.pop([i])
s.remove(x)
s.reverse()
s.sort([cmpfunc])
__methods__
len(a)
a[k]
a[k] = x
del a[k]
a.clear()
a.copy()
a.has_key(k)
a.items()
a.keys()
a.update(b)
a.values()
a.get(k[, x])
__methods__
f.close()
f.flush()
f.isatty()
f.fileno()
f.read([size])
f.readline([size])
f.readlines([sizehint])
f.seek(offset[,
whence])
f.tell()
f.write(str)
f.writelines(list)
f.truncate([size])
__methods__
softspace
mode
name
closed
__dict__
__name__
__dict__
__name__
__bases__
__module__
im_func
im_self
im_class
__init__(self [, args...])
__del__(self)
__repr__(self)
__str__(self)
__cmp__(self, other)
__hash__(self)
__nonzero__(self)
__getattr__(self, name)
__setattr__(self, name,
value)
__delattr__(self, name)
func_code
func_globals
func_name
func_defaults
__name__
__name__
__self__
co_argcount
co_nlocals
co_stacksize
co_flags
co_code
co_consts
co_names
co_varnames
co_filename
co_name
co_firstlineno
co_lnotab
f_back
f_code
f_builtins
f_globals
f_locals
f_lasti
f_lineno
f_restricted
f_trace
f_exc_type
f_exc_value
f_exc_traceback
tb_next
tb_frame
tb_lasti
tb_lineno
start
stop
step
Exception
StandardError
ArithmeticError
LookupError
AssertionError
AttributeError
EOFError
FloatingPointError
EnvironmentError
IOError
OSError
ImportError
IndexError
KeyError
KeyboardInterrupt
MemoryError
RemovedFeatureError
NameError
OverflowError
RuntimeError
NotImplementedError
SyntaxError
SystemError
SystemExit
UnboundLocalError
TypeError
ValueError
ZeroDivisionError
RemovedFeatureError
Exception
abs(x)
cmp(x, y)
round(x [, n])
(returns error)
vars([object])
ord(c)
__import__(name[, globals[, locals[,
fromlist]]])
callable(object)
coerce(x, y)
compile(string, filename, kind)
complex(real [, imag])
(returns error)
delattr(object, name)
divmod(a, b)
eval(expression[, globals[, locals]])
execfile(file[, globals[, locals]])
filter(function, list)
float(x)
(returns error)
globals()
input([prompt])
int(x)
intern(string)
issubclass(class1, class2)
locals()
long(x)
oct(x)
open(filename[, mode[, bufsize]])
raw_input([prompt])
reload(module)
dump(value,file)
load(file)
dumps(value)
loads(string)
find_module(name[, path])
get_magic()
get_suffixes()
load_module(name, file, filename, description)
new_module(name)
PY_SOURCE
PY_COMPILED
C_BUILTIN
PY_FROZEN
exc_info()
exit([arg])
getrefcount(object)
setcheckinterval(interval)
stdin
stdout
stderr
__stdin__
__stdout__
__stderr__
version
hexversion
copyright
platform
executable
prefix
exec_prefix
maxint
builtin_module_names
removed_features
argv
exc_type
exc_value
exc_traceback
exitfunc
last_type
last_value
last_traceback
modules
path
tracebacklimit
hexversion
removed_features
Hexversion
hexversion
Removed_features
ComplexType
FloatType
DocStrings
new([arg])
md5([arg])
update(arg)
digest()
copy()
a2b_uu(string)
b2a_uu(data)
a2b_base64(string)
b2a_base64(data)
a2b_hqx(string)
rledecode_hqx(data)
rlecode_hqx(data)
b2a_hqx(data)
crc_hqx(data,crc)
Error
Incomplete
filename
unlink(test.txt)
oldfilename
oldfilename
oldfilename
newfilename
rename(test1.txt, test2.txt)
unlink(test.txt)
flashflush()
newfilename
newfilename
filename