From ccd80c586151e53a7423b81e4ce6397e30d3182a Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Tue, 11 Apr 2023 13:11:33 +0530 Subject: [PATCH] ports/psoc6/tests/network_wlan.py: Added wlan test for psoc6 port. Signed-off-by: NikhitaR-IFX --- ports/psoc6/tests/network_wlan.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ports/psoc6/tests/network_wlan.py diff --git a/ports/psoc6/tests/network_wlan.py b/ports/psoc6/tests/network_wlan.py new file mode 100644 index 000000000000..f7d721f3b306 --- /dev/null +++ b/ports/psoc6/tests/network_wlan.py @@ -0,0 +1,21 @@ +import network + +print("Testing PSoC6 Network module") + +sta_if = network.WLAN(network.STA_IF) + +ssid = "OnePlus 9 5G" +password = "psoc-mpy" +ifconfig_params = ("192.168.255.75", "255.255.255.0", "192.168.255.73", "192.168.255.73") + +if not sta_if.isconnected(): + print("Status: ", isconnected()) + print("Connecting to hotspot...") + sta_if.ifconfig(ifconfig_params) + sta_if.connect(ssid, password) + if sta_if.ifconfig() == ifconfig_params: + print("ifconfig params match") + if sta_if.active() == 1: + print("Successfully connected") + +sta_if.disconnect()