slotUI/freeslot.py

changeset 25
646ee4dc3a6b
parent 23
6edcf4666e3b
child 26
4af697fa5ea9
equal deleted inserted replaced
24:84f6f0592555 25:646ee4dc3a6b
1 """ 1 """
2 FreeSlot project 2 FreeSlot project
3 Blackbox communication library 3 Blackbox communication library
4 """ 4 """
5 5
6 class SerialCommunicator():
7 def __init__(self, device, speed):
8 self.device = device
9 self.speed = speed
10 self.port = None
11 self.connected = False
12
13 def connect(self):
14 if self.connected:
15 return True
16
17 def disconnect(self):
18 return True
19
20 def write(self):
21 return True
22
23 def read(self):
24 return True
25
26 class Blackbox():
27 def __init__(self):
28 self.com = None
29 self.info = None
30
31 def connect(self, device="/dev/ttyUSB0", speed=115200):
32 if self.com == None:
33 self.com = SerialCommunicator(device, speed)
34 self.com.connect()
35 self.info = self.readinfo()
36
37 def disconnect():
38 self.com.disconnect()
39
40 def readinfo():
41 """
42 Read complete Information from connected box
43 """
44 return None

mercurial