esp32/modnetwork: Implement dhcp_hostname for WLAN.config().
This commit is contained in:
parent
4e469085c1
commit
27fa9881a9
|
@ -445,6 +445,11 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
|
|||
cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
|
||||
break;
|
||||
}
|
||||
case QS(MP_QSTR_dhcp_hostname): {
|
||||
const char *s = mp_obj_str_get_str(kwargs->table[i].value);
|
||||
ESP_EXCEPTIONS(tcpip_adapter_set_hostname(self->if_id, s));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
goto unknown;
|
||||
}
|
||||
|
@ -494,6 +499,12 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
|
|||
req_if = WIFI_IF_AP;
|
||||
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
|
||||
break;
|
||||
case QS(MP_QSTR_dhcp_hostname): {
|
||||
const char *s;
|
||||
ESP_EXCEPTIONS(tcpip_adapter_get_hostname(self->if_id, &s));
|
||||
val = mp_obj_new_str(s, strlen(s));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
goto unknown;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue