Example #1
0
    def __init__(self, port):
        print("Device: Initializing myself as a new device on port %s..." %
              port)
        self.port = port
        self.em = EventsManager()
        self.components = {}  #Dict componentID:component

        self.abort = False
        self.deviceMessageQueue = []
        self.serialConnection = SerialConnection(port, self.addToMessageQueue)
        self.processMessageQueue()

        self.sendCommand({
            "command": "devices",
            "params": None
        })  #request info about what components are on the device
        self.sendCommand({
            "command": "interval",
            "params": 2
        })  #sets the data-sending rate to 1 second
        print("Device: Done Initializing.")
Example #2
0
 def setUpClass(cls):
     print "making serial connection"
     cls.ser = SerialConnection("root", "chip", "/dev/chip_usb")
     cls.ser.connect()