Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
e2bfa471
Commit
e2bfa471
authored
Jun 22, 2015
by
Bill Owens
Committed by
Paul Sokolovsky
Sep 15, 2015
Browse files
esp8266: Added wlan.isconnected() to maintain parity with other ports.
parent
04fffe65
Changes
2
Hide whitespace changes
Inline
Side-by-side
esp8266/modnetwork.c
View file @
e2bfa471
...
...
@@ -105,6 +105,18 @@ STATIC mp_obj_t esp_scan(mp_obj_t cb_in) {
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
esp_scan_obj
,
esp_scan
);
/// \method isconnected()
/// Return True if connected to an AP and an IP address has been assigned,
/// false otherwise.
STATIC
mp_obj_t
esp_isconnected
()
{
if
(
wifi_station_get_connect_status
()
==
STATION_GOT_IP
)
{
return
mp_const_true
;
}
return
mp_const_false
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
esp_isconnected_obj
,
esp_isconnected
);
STATIC
const
mp_map_elem_t
mp_module_network_globals_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_network
)
},
// MicroPython "network" module interface requires it to contains classes
...
...
@@ -116,6 +128,7 @@ STATIC const mp_map_elem_t mp_module_network_globals_table[] = {
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_disconnect
),
(
mp_obj_t
)
&
esp_disconnect_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_status
),
(
mp_obj_t
)
&
esp_status_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_scan
),
(
mp_obj_t
)
&
esp_scan_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_isconnected
),
(
mp_obj_t
)
&
esp_isconnected_obj
},
#if MODNETWORK_INCLUDE_CONSTANTS
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_STAT_IDLE
),
...
...
esp8266/qstrdefsport.h
View file @
e2bfa471
...
...
@@ -99,6 +99,7 @@ Q(network)
Q
(
WLAN
)
Q
(
scan
)
Q
(
status
)
Q
(
isconnected
)
Q
(
STAT_IDLE
)
Q
(
STAT_CONNECTING
)
Q
(
STAT_WRONG_PASSWORD
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment