def main(): disp = Dispatcher() Tasklet.new(disp.loop)() host = Host(disp, "/dev/ttySP1") disp.add_host(host) while True: host.send([0x45])
def route(self, request): hint = getattr(request, "routeHint", None) if hint == "relays": return self.relayscontrol elif hint == "main": return self.maincontrol else: return Dispatcher.route(self, request)
def __init__(self): Dispatcher.__init__(self) self.relays = [0, 0, 0, 0]