# HG changeset patch # User Malte Bayer # Date 1322863714 -3600 # Node ID 646ee4dc3a6b5cfa8def19d9129da9ccd6c40669 # Parent 84f6f059255570d22d85a406de73b7883359096f started communication class and CLI diff -r 84f6f0592555 -r 646ee4dc3a6b slotUI/SlotCli.py --- /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 +""" diff -r 84f6f0592555 -r 646ee4dc3a6b slotUI/freeslot.py --- 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