コード例 #1
0
class RemoteControl:
    def __init__(self, usb_port_number):
        self.com = CommunicationGroup09(usb_port_number)
        self.com.open(self.handle_message)
        self.display = TerminalDisplay(self)

    def run(self):
        self.display.run()
        self.close()

    def close(self):
        self.display.close()
        self.com.close()

    @staticmethod
    def handle_message(message):
        print("MESSAGE RECEIVED: '{}'".format(message))

    def handle_input(self, character):
        self.com.send_command(character)
コード例 #2
0
 def __init__(self, usb_port_number):
     self.com = CommunicationGroup09(usb_port_number)
     self.com.open(self.handle_message)
     self.display = TerminalDisplay(self)