Python/ltrx apis

From Lantronix Wiki!
Revision as of 12:57, 11 March 2015 by Ltrxmg42 (talk | contribs) (Created page with "== Overview == Lantronix provides Python modules with APIs to access features of the PremierWave device more easily from your program. Note that these APIs require firmware ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Lantronix provides Python modules with APIs to access features of the PremierWave device more easily from your program.

Note that these APIs require firmware version 7.10 or later.

LtrxCellular

Send and receive SMS messages.

<nowiki>

import sys import os from ltrxlib import LtrxCellular

try:

   cell = LtrxCellular()
   print 'calling sendSMS()...'
   cell.sendSMS("1112223333", "Hello!")
   print 'calling receiveSMS'
   msg = cell.receiveSMS()
   print 'message: ' + msg

LtrxDsal

Access to the Digital input/outputs on the device.

<nowiki>

import sys import os from ltrxlib import LtrxDsal

try:

   dsal = LtrxDsal()
   print 'Reading Digital Input 1...'
   state = dsal.readDigitalInput(1)
   print 'state=' + str(state)
   print 'Reading Digital Input 2...'
   state = dsal.readDigitalInput(2)
   print 'state=' + str(state)
   print 'Setting relay to true'
   result = dsal.setRelay(1, True)
 
   state = dsal.readRelay(1)
   print 'Relay is' + state
   print 'Setting relay to false...'
   dsal.setRelay(1, False)
   print 'Reading Relay...'
   state = dsal.readRelay(1,)
   print 'Relay is' + state
 
   print 'Reading temperature...'
   temp = dsal.readInternalTemperature(1)