summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/12-09-2011/gsmselftest1.py
diff options
context:
space:
mode:
authortt412011-09-05 01:34:27 +0200
committertt412011-09-05 01:34:27 +0200
commit310e98501ed13c8fae7bdc53b8c96b8d326c34e9 (patch)
treea3f8646dad2e76cdb120c8b2bdc18981a748c6bf /For Weekly Test/12-09-2011/gsmselftest1.py
parentfix error inserting for device name (diff)
downloadgsm-selftest-310e98501ed13c8fae7bdc53b8c96b8d326c34e9.tar.gz
gsm-selftest-310e98501ed13c8fae7bdc53b8c96b8d326c34e9.tar.xz
gsm-selftest-310e98501ed13c8fae7bdc53b8c96b8d326c34e9.zip
add gsm device detecting feature
Diffstat (limited to 'For Weekly Test/12-09-2011/gsmselftest1.py')
-rw-r--r--For Weekly Test/12-09-2011/gsmselftest1.py62
1 files changed, 61 insertions, 1 deletions
diff --git a/For Weekly Test/12-09-2011/gsmselftest1.py b/For Weekly Test/12-09-2011/gsmselftest1.py
index aa72974..81d23cf 100644
--- a/For Weekly Test/12-09-2011/gsmselftest1.py
+++ b/For Weekly Test/12-09-2011/gsmselftest1.py
@@ -1,15 +1,19 @@
#! /usr/bin/env python
-import sys
+from serial import * #serial port library
+import sys
import ControllerClass
import DbClass
import PingClass
import trueTableClass
import initTestClass
+import usbDetectClass
from time import sleep
global resultsList
resultsList = list()
+GSMListPrefix = [['GSMExt.Tm','0151'],['GSMExt.Tm','0160'],['GSMExt.Tm','0170'],['GSMExt.Tm','0171'],['GSMExt.Tm','0175'],['GSMExt.Voda','0152'],['GSMExt.Voda','0162'],['GSMExt.Voda','0172'],['GSMExt.Voda','0173'],['GSMExt.Voda','0174'],['GSMExt.Eplus','0157'],['GSMExt.Eplus','0177'],['GSMExt.Eplus','0155'],['GSMExt.Eplus','0163'],['GSMExt.Eplus','0178'],['GSMExt.O2','0159'],['GSMExt.O2','0176'],['GSMExt.O2','0179']]
+
def allPing():
@@ -138,6 +142,59 @@ def regularTest():
regulartest = initTestClass.doTheTest()
regulartest.smartTest()
+def findPort(portName):
+ global connect
+ global prefix
+ global num
+ global IMEI
+ global portClass
+ sleep(0.5)
+ portLog = os.popen('dmesg | grep \'pl2303 converter now attached to '+portName+'\'').read()
+ sleep(0.5)
+ if portLog != '':
+ connect = 1
+ portClass = usbDetectClass.serialPort(portName)
+ portClass.findNumber()
+ portClass.findIMEI()
+ IMEI = portClass.IMEI
+ num = portClass.number
+ number = portClass.number
+ prefix = number[0:4]
+ else:
+ connect = 0
+
+def updateDevice():
+
+ while True:
+ print "Mobile device configuration"
+ print "Menu: s = start device configuration, q = quit"
+
+ input = sys.stdin.readline().rstrip("\r\n")
+ print ''
+ if input == 's':
+ i = 0
+ while i !=10:
+ portName ='ttyUSB'+str(i)
+ findPort(portName)
+ i=i+1
+ if connect == 1:
+ for listNum in GSMListPrefix:
+ if prefix == listNum[1]:
+ print 'Device Name :', listNum[0]
+ print 'IME :',IMEI
+ print 'Phone Number :',num
+ print 'Port Name : /dev/'+portName
+
+ newPortName = '/dev/'+portName
+ portClass.initUpdate(listNum[0], newPortName, num)
+ print '\n'
+
+
+
+ if input == "q":
+ break
+ sys.exit()
+
if len(sys.argv) > 1:
command = sys.argv[1]
@@ -161,6 +218,9 @@ if len(sys.argv) > 1:
elif command == '--smart':
regularTest()
+ elif command == '--devconf':
+ updateDevice()
+
elif command == '--help':
file = open('help.txt', 'r')
print file.read()