started communication class and CLI

Fri, 02 Dec 2011 23:08:34 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Fri, 02 Dec 2011 23:08:34 +0100
changeset 25
646ee4dc3a6b
parent 24
84f6f0592555
child 26
4af697fa5ea9

started communication class and CLI

slotUI/SlotCli.py file | annotate | diff | comparison | revisions
slotUI/freeslot.py file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/slotUI/SlotCli.py	Fri Dec 02 23:08:34 2011 +0100
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+"""
+Freeslot project
+Command line interface
+"""
--- a/slotUI/freeslot.py	Fri Dec 02 22:52:10 2011 +0100
+++ b/slotUI/freeslot.py	Fri Dec 02 23:08:34 2011 +0100
@@ -3,3 +3,42 @@
 Blackbox communication library
 """
 
+class SerialCommunicator():
+    def __init__(self, device, speed):
+        self.device = device
+        self.speed = speed
+        self.port = None
+        self.connected = False
+
+    def connect(self):
+        if self.connected:
+            return True
+
+    def disconnect(self):
+        return True
+
+    def write(self):
+        return True
+
+    def read(self):
+        return True
+
+class Blackbox():
+    def __init__(self):
+        self.com = None
+        self.info = None
+
+    def connect(self, device="/dev/ttyUSB0", speed=115200):
+        if self.com == None:
+            self.com = SerialCommunicator(device, speed)
+        self.com.connect()
+        self.info = self.readinfo()
+
+    def disconnect():
+        self.com.disconnect()
+
+    def readinfo():
+        """
+        Read complete Information from connected box
+        """
+        return None
\ No newline at end of file

mercurial