Exemplo n.º 1
0
    def execute(self):
        class Listener:
            @staticmethod
            def on_add_device(device):
                print('Add Device:')
                print(device)

            @staticmethod
            def on_remove_device(device):
                print('Remove Device:')
                print(device)

        event_stream = get_device_manager().start_monitor(Listener())
        input('')
        get_device_manager().stop_monitor(event_stream)

        return Quit()
Exemplo n.º 2
0
    def execute(self):
        class Listener:
            @staticmethod
            def on_add_device(device):
                print('Add Device:')
                print(device)

            @staticmethod
            def on_remove_device(device):
                print('Remove Device:')
                print(device)

        get_device_manager().set_device_listener(Listener())
        input('')
        get_device_manager().set_device_listener(None)

        return Quit()
Exemplo n.º 3
0
 def execute(self):
     device = get_device_manager().select_device()
     return self.do_execute(device)
Exemplo n.º 4
0
 def execute(self):
     get_device_manager().print_devices()
     return Quit()
Exemplo n.º 5
0
 def execute(self):
     get_device_manager().print_devices()
     idx = int(input('请选择相应的设备:'))
     device = get_device_manager().get_device(idx)
     return self.do_execute(device)