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')
from utils.wait import wait from adapters.wifi.wifi_configuration import SecurityType from adapters.wifi.wifi_configuration import WifiConfiguration import time from adapters.bluetooth.bluetooth_device import BluetoothDevice def print_hi(name): # Use a breakpoint in the code line below to debug your script. print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. # Press the green button in the gutter to run the script. if __name__ == '__main__': controller = RemoteController("N0AA003759K70700223") adapter = controller.get_wifi_adapter() adapter.enable() wait(condition=lambda: adapter.is_enabled(), max_timeout=15, waiting_for='wifi enabled', error_msg='wifi disabled') net_id = adapter.add_network("RNS_AES", "12345678", SecurityType.PASS) adapter.enable_network(net_id=net_id) time.sleep(15) adapter.remove_network(net_id=net_id)