summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/tricode/GSMClass.py
diff options
context:
space:
mode:
authorTriatmoko2011-10-30 19:07:53 +0100
committerTriatmoko2011-10-30 19:07:53 +0100
commit25cb0dd78c8eb3743e9565a98f0f118eff29d22d (patch)
treed9818c83ab80325674ca38cdb5978379f5417fb4 /For Weekly Test/tricode/GSMClass.py
parentsmart test picture edit (diff)
downloadgsm-selftest-25cb0dd78c8eb3743e9565a98f0f118eff29d22d.tar.gz
gsm-selftest-25cb0dd78c8eb3743e9565a98f0f118eff29d22d.tar.xz
gsm-selftest-25cb0dd78c8eb3743e9565a98f0f118eff29d22d.zip
GSM external device doesnt work added
Diffstat (limited to 'For Weekly Test/tricode/GSMClass.py')
-rwxr-xr-xFor Weekly Test/tricode/GSMClass.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/For Weekly Test/tricode/GSMClass.py b/For Weekly Test/tricode/GSMClass.py
index e994814..b932ab5 100755
--- a/For Weekly Test/tricode/GSMClass.py
+++ b/For Weekly Test/tricode/GSMClass.py
@@ -16,13 +16,15 @@ class serialPort():
self.signalStrength = 0
#self.callerConnected = -1
self.timer = timeout
+ self.timer1 = timeout
+ self.start = 0
self.debugMode = 0
- def portInit(self):
+ def portInit(self, timeout1):
portName = self.portAddress[-4:]
portExist = os.popen('dmesg | grep ' + portName).read()
-
+ self.timer = timeout1
if portExist == '':
return 0
else:
@@ -40,12 +42,12 @@ class serialPort():
#interCharTimeout=None
#I didn't need to set these variables :)
)
-
+ self.ser.flushOutput() #clean the output buffer from the serial port
self.ser.flushInput() #clean the input buffer for serial port
self.ser.write('AT\r')
received = self.__receiveData()
-
+ self.start=1
if received == 'OK':
self.portExist = 1
return 1 #cellphone is OK, receives commands
@@ -200,6 +202,10 @@ class serialPort():
def __receiveData(self):
def timeout_handler(signum, frame):
raise TimeoutException()
+ if self.start == 0:
+ self.timer = 5
+ else:
+ self.timer = self.timer1
old_handler = signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(self.timer)