From 6d22caa71dc84daa97965a421935538d5fcf4a32 Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Mon, 20 Feb 2017 17:38:26 +0100 Subject: [PATCH] Script execution --- script/local.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script/local.py b/script/local.py index bceba50..4df0345 100644 --- a/script/local.py +++ b/script/local.py @@ -16,24 +16,28 @@ class RobotTCP(TcpDevice): self.trailer = "\n" self.msg_id = 0 - def sendReceive(self, msg): + def call(self, msg): tx = self.header if (self.header != None) else "" id = "%03d" % self.msg_id self.msg_id = (self.msg_id+1)%1000 tx = tx + id + " " + msg + if (len(tx)>127): + raise Exception("Exceeded maximum message size") self.getLogger().finer("TX = " + str(tx)) if (self.trailer != None): tx = tx + self.trailer 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") - return rx[3:] + return rx[4:] def execute(self, command, *argv): msg = str(command) + #if len(argv>10): + # raise Exception("Exceeded maximum number of parameters") for arg in argv: msg = msg + "," + str(arg) - ret = self.sendReceive(msg) + ret = self.call(msg) return ret;