Skip to content

Commit ea4febe

Browse files
committed
esp32/modnetwork: Implement wlan.isconnected() method.
1 parent 41534f1 commit ea4febe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

esp32/modnetwork.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,12 @@ STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
295295
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_scan_obj, esp_scan);
296296

297297
STATIC mp_obj_t esp_isconnected(mp_obj_t self_in) {
298-
return mp_const_none;
298+
wlan_if_obj_t *self = MP_OBJ_TO_PTR(self_in);
299+
require_if(self_in, WIFI_IF_STA);
300+
tcpip_adapter_ip_info_t info;
301+
tcpip_adapter_get_ip_info(self->if_id, &info);
302+
return mp_obj_new_bool(info.ip.addr != 0);
299303
}
300-
301304
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_isconnected_obj, esp_isconnected);
302305

303306
STATIC mp_obj_t esp_ifconfig(size_t n_args, const mp_obj_t *args) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy