summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorRyan T. Hamilton <astrobokonon@gmail.com>2020-09-28 16:49:20 -0700
committerRyan T. Hamilton <astrobokonon@gmail.com>2020-09-28 16:49:20 -0700
commit66d55738c1315b223d3e5ed6bc710f8b1e443836 (patch)
tree3ac6592229dae433dd813bd33d794bbaf65d0b5e /shared-bindings
parentdeefeecb454931a1476be0f852b78dfea0975d92 (diff)
Enable DNS info
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/wifi/Radio.c17
-rw-r--r--shared-bindings/wifi/Radio.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c
index 6c4e6a4f6..8c556aafe 100644
--- a/shared-bindings/wifi/Radio.c
+++ b/shared-bindings/wifi/Radio.c
@@ -227,6 +227,22 @@ const mp_obj_property_t wifi_radio_ipv4_address_obj = {
(mp_obj_t)&mp_const_none_obj },
};
+//| ipv4_dns: Optional[ipaddress.IPv4Address]
+//| """IP v4 Address of the DNS server in use when connected to an access point. None otherwise."""
+//|
+STATIC mp_obj_t wifi_radio_get_ipv4_dns(mp_obj_t self) {
+ return common_hal_wifi_radio_get_ipv4_dns(self);
+
+}
+MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ipv4_dns_obj, wifi_radio_get_ipv4_dns);
+
+const mp_obj_property_t wifi_radio_ipv4_dns_obj = {
+ .base.type = &mp_type_property,
+ .proxy = { (mp_obj_t)&wifi_radio_get_ipv4_dns_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj },
+};
+
//| def ping(self, ip, *, timeout: float = 0.5) -> float:
//| """Ping an IP to test connectivity. Returns echo time in seconds.
//| Returns None when it times out."""
@@ -268,6 +284,7 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = {
// { MP_ROM_QSTR(MP_QSTR_connect_to_enterprise), MP_ROM_PTR(&wifi_radio_connect_to_enterprise_obj) },
{ MP_ROM_QSTR(MP_QSTR_ap_rssi), MP_ROM_PTR(&wifi_radio_ap_rssi_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ipv4_dns), MP_ROM_PTR(&wifi_radio_ipv4_dns_obj) },
{ MP_ROM_QSTR(MP_QSTR_ipv4_gateway), MP_ROM_PTR(&wifi_radio_ipv4_gateway_obj) },
{ MP_ROM_QSTR(MP_QSTR_ipv4_subnet), MP_ROM_PTR(&wifi_radio_ipv4_subnet_obj) },
{ MP_ROM_QSTR(MP_QSTR_ipv4_address), MP_ROM_PTR(&wifi_radio_ipv4_address_obj) },
diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h
index 3c8ecbebd..fd0807a86 100644
--- a/shared-bindings/wifi/Radio.h
+++ b/shared-bindings/wifi/Radio.h
@@ -54,6 +54,7 @@ extern void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self)
extern wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t* ssid, size_t ssid_len, uint8_t* password, size_t password_len, uint8_t channel, mp_float_t timeout, uint8_t* bssid, size_t bssid_len);
extern mp_obj_t common_hal_wifi_radio_get_ap_rssi(wifi_radio_obj_t *self);
+extern mp_obj_t common_hal_wifi_radio_get_ipv4_dns(wifi_radio_obj_t *self);
extern mp_obj_t common_hal_wifi_radio_get_ipv4_gateway(wifi_radio_obj_t *self);
extern mp_obj_t common_hal_wifi_radio_get_ipv4_subnet(wifi_radio_obj_t *self);
extern mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self);