Ejemplo n.º 1
0
def bluetooth_scan():
    controller = RemoteController("N0AA003759K70700223")

    bluetooth = controller.get_bluetooth_adapter()

    bluetooth.enable()

    wait(condition=lambda: bluetooth.is_enabled(),
         max_timeout=15,
         waiting_for='bluetooth enabled',
         error_msg='bluetooth disabled')

    bluetooth.start_discovery()

    wait(condition=lambda: bluetooth.is_discovering(),
         max_timeout=15,
         waiting_for='bluetooth discovering',
         error_msg='bluetooth not discovering')

    time.sleep(10)

    bluetooth.cancel_discovery()

    list_devices = bluetooth.get_discovered_devices()

    for device in list_devices:
        device.get_pair_state()
        device.get_name()
        device.get_type()
        device.get_bluetooth_class()
        print("---------------------------------")
Ejemplo n.º 2
0
def remove_paired_devices_test():
    # TODO before test pair device
    controller = RemoteController("N0AA003759K70700223")

    bluetooth = controller.get_bluetooth_adapter()

    bluetooth.remove_all_paired_devices()

    assert len(bluetooth.get_paired_devices()) == 0
Ejemplo n.º 3
0
def bluetooth_pair():
    controller = RemoteController("N0AA003759K70700223")
    controller2 = RemoteController("N0AA003759K70700223")

    bluetooth = controller.get_bluetooth_adapter()
    bluetooth2 = controller2.get_bluetooth_adapter()

    bluetooth.enable()
    bluetooth2.enable()

    wait(condition=lambda: bluetooth.is_enabled(),
         max_timeout=15,
         waiting_for='bluetooth enabled',
         error_msg='bluetooth disabled')

    wait(condition=lambda: bluetooth2.is_enabled(),
         max_timeout=15,
         waiting_for='bluetooth enabled',
         error_msg='bluetooth disabled')

    bluetooth.pair(bluetooth2.get_address())

    time.sleep(5)
Ejemplo n.º 4
0
def bluetooth_discoverable():
    controller = RemoteController("N0AA003759K70700223")

    bluetooth = controller.get_bluetooth_adapter()

    bluetooth.enable()

    wait(condition=lambda: bluetooth.is_enabled(),
         max_timeout=15,
         waiting_for='bluetooth enabled',
         error_msg='bluetooth disabled')

    bluetooth.start_discoverable(120)

    wait(condition=lambda: bluetooth.is_discoverable(),
         max_timeout=15,
         waiting_for='bluetooth discoverable',
         error_msg='bluetooth not discoverable')
Ejemplo n.º 5
0
def bluetooth_enable_disable():
    controller = RemoteController("N0AA003759K70700223")

    controller.start_view(Actions.ACTION_BLUETOOTH_SETTINGS)

    bluetooth = controller.get_bluetooth_adapter()

    bluetooth.enable()

    wait(condition=lambda: bluetooth.is_enabled(),
         max_timeout=15,
         waiting_for='bluetooth enabled',
         error_msg='bluetooth disabled')

    bluetooth.disable()

    wait(condition=lambda: not bluetooth.is_enabled(),
         max_timeout=15,
         waiting_for='bluetooth disabled',
         error_msg='bluetooth enabled')
Ejemplo n.º 6
0
def bluetooth_change_name():
    controller = RemoteController("N0AA003759K70700223")

    controller.start_view(Actions.ACTION_BLUETOOTH_SETTINGS)

    bluetooth = controller.get_bluetooth_adapter()

    bluetooth.enable()

    wait(condition=lambda: bluetooth.is_enabled(),
         max_timeout=15,
         waiting_for='bluetooth enabled',
         error_msg='bluetooth disabled')

    previous_name = bluetooth.get_name()

    bluetooth.set_name("TestName")

    assert bluetooth.get_name() == "TestName"

    bluetooth.set_name(previous_name)