diff options
| author | microDev <70126934+microDev1@users.noreply.github.com> | 2020-10-14 11:11:59 +0530 |
|---|---|---|
| committer | microDev <70126934+microDev1@users.noreply.github.com> | 2020-10-14 11:11:59 +0530 |
| commit | 18fbff4f57e0c0b25ecaa3e1064c71b7a09f320b (patch) | |
| tree | a27ef32b644ea4d638e76ffadcd4e75c2b4dbad3 /ports | |
| parent | ceb531086ed2e5d1e2ee1f1439820a5145fd981e (diff) | |
Update wifi hostname method
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/esp32s2/common-hal/wifi/Radio.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 61d63e1f2..5e349c09d 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -104,6 +104,15 @@ void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self) { self->current_scan = NULL; } +mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) { + const char *hostname = NULL; + esp_netif_get_hostname(self->netif, &hostname); + if (hostname == NULL) { + return mp_const_none; + } + return mp_obj_new_str(hostname, strlen(hostname)); +} + void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname) { esp_netif_set_hostname(self->netif, hostname); } |
