From 90a0b8850d19253363a881eabf6c89a418a5780d Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Mon, 13 Mar 2017 15:20:37 +0100 Subject: [PATCH] Closedown --- script/test/onewire.py | 61 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/script/test/onewire.py b/script/test/onewire.py index 12d5418..c3d9a73 100644 --- a/script/test/onewire.py +++ b/script/test/onewire.py @@ -1,12 +1,57 @@ +class Detector(ReadonlyRegisterBase) + def __init__(self): + self.status = -1 + self.det1 = -1 + self.det2 = -1 + self.det3 = -1 + self.det4 = -1 + -onewire.flush() -onewire.write("get,owb,listall1\n") -count = 1 -while (True): - print onewire.waitString("\n", 1000) +class Esera(TcpDevice): + def __init__(self, name, server, timeout = 1000, retries = 1): + TcpDevice.__init__(self, name, server) + setMode(self.Mode.FullDuplex) + self.detectors = [] + for i in range(30): + self.detectors.append(Detector()) - print count - count = count + 1 - \ No newline at end of file + def start(self): + onewire.write("set,sys,run,1\n") + + def stop(self): + onewire.write("set,sys,run,0\n") + + def list(self): + onewire.write("get,owb,listall1\n") + + def doInitialize(self): + self.stop() + time.sleep(0.1) + self.flush() + self.detectors = [] + for i in range(30): + self.detectors.append(Detector()) + self.list() + self.start() + + def onString(self, str): + print str + + + + +#count = 1 +#while (True): +# print onewire.waitString("\n", 1000)# +# +# print count +# count = count + 1 + + + + + + +add_device(Esera("onewire", "129.129.126.100:1000"), force = True) \ No newline at end of file