def wifi_scan_results(): controller = RemoteController("N0AA003759K70700223") controller.start_view(Actions.ACTION_WIFI_SETTINGS) wifi = controller.get_wifi_adapter() wifi.enable() wait(condition=lambda: wifi.is_enabled(), max_timeout=15, waiting_for='wifi enabled', error_msg='wifi disabled') wifi.start_scan() time.sleep(6) for scan_result in wifi.get_scan_results(): print(scan_result) wifi.disable() wait(condition=lambda: not wifi.is_enabled(), max_timeout=15, waiting_for='wifi enabled', error_msg='wifi disabled')
def wifi_connect_network(): controller = RemoteController("N0AA003759K70700223") controller.start_view(Actions.ACTION_WIFI_SETTINGS) wifi = controller.get_wifi_adapter() wifi.enable() wait(condition=lambda: wifi.is_enabled(), max_timeout=15, waiting_for='wifi enabled', error_msg='wifi disabled') net_id = wifi.add_network("RNS_AES", "12345678", SecurityType.PASS) wifi.enable_network(net_id=net_id) wait(condition=lambda: wifi.is_network_connected(), max_timeout=15, waiting_for='wifi enabled', error_msg='wifi disabled') for net in wifi.get_configured_networks(): print(net.SSID) wifi.remove_network(net_id=net_id) wifi.disable() wait(condition=lambda: not wifi.is_enabled(), max_timeout=15, waiting_for='wifi enabled', error_msg='wifi disabled')
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')
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)