From 9252c6cd87053b596018e6f7a019530203c92808 Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Tue, 21 Feb 2017 11:42:41 +0100 Subject: [PATCH] Script execution --- script/local.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/script/local.py b/script/local.py index fd9526d..a8f751f 100644 --- a/script/local.py +++ b/script/local.py @@ -28,7 +28,7 @@ class RobotTCP(TcpDevice): rx = self.sendReceive(tx, None, self.trailer , 0, self.timeout, self.retries).strip() self.getLogger().finer("RX = " + str(rx)) if rx[:3] != id: - raise Exception("Received invalid message id") + raise Exception("Received invalid message id: " + str(rx[:3]) + " - expecting:" + id ) if rx[3] == "*": raise Exception(rx[4:]) return rx[4:] @@ -41,7 +41,14 @@ class RobotTCP(TcpDevice): msg = msg + "," + str(arg) ret = self.call(msg) return ret; - + + def get_event(): + id = "EVT" + rx = self.sendReceive(id + " ", None, self.trailer , 0, self.timeout, self.retries).strip() + if rx[:3] != id: + raise Exception("Received invalid message id: " + str(rx[:3]) + " - expecting:" + id ) + if len(rx) < 5: return None + return rx[4:] def mount(self, puck, sample): return self.execute('Mount', puck, sample)