50
50
//|
51
51
STATIC mp_obj_t wifi_radio_get_enabled (mp_obj_t self ) {
52
52
return mp_obj_new_bool (common_hal_wifi_radio_get_enabled (self ));
53
-
54
53
}
55
54
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_enabled_obj , wifi_radio_get_enabled );
56
55
@@ -102,11 +101,16 @@ STATIC mp_obj_t wifi_radio_stop_scanning_networks(mp_obj_t self_in) {
102
101
}
103
102
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_stop_scanning_networks_obj , wifi_radio_stop_scanning_networks );
104
103
105
- //| def set_hostname(self, hostname: ReadableBuffer) -> None:
106
- //| """Sets hostname for wifi interface. When the hostname is altered after interface started/connected
107
- //| the changes would only be reflected once the interface restarts/reconnects."""
108
- //| ...
104
+ //| hostname: ReadableBuffer
105
+ //| """Hostname for wifi interface. When the hostname is altered after interface started/connected
106
+ //| the changes would only be reflected once the interface restarts/reconnects."""
109
107
//|
108
+ STATIC mp_obj_t wifi_radio_get_hostname (mp_obj_t self_in ) {
109
+ wifi_radio_obj_t * self = MP_OBJ_TO_PTR (self_in );
110
+ return common_hal_wifi_radio_get_hostname (self );
111
+ }
112
+ MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_hostname_obj , wifi_radio_get_hostname );
113
+
110
114
STATIC mp_obj_t wifi_radio_set_hostname (mp_obj_t self_in , mp_obj_t hostname_in ) {
111
115
mp_buffer_info_t hostname ;
112
116
mp_get_buffer_raise (hostname_in , & hostname , MP_BUFFER_READ );
@@ -122,6 +126,13 @@ STATIC mp_obj_t wifi_radio_set_hostname(mp_obj_t self_in, mp_obj_t hostname_in)
122
126
}
123
127
MP_DEFINE_CONST_FUN_OBJ_2 (wifi_radio_set_hostname_obj , wifi_radio_set_hostname );
124
128
129
+ const mp_obj_property_t wifi_radio_hostname_obj = {
130
+ .base .type = & mp_type_property ,
131
+ .proxy = {(mp_obj_t )& wifi_radio_get_hostname_obj ,
132
+ (mp_obj_t )& wifi_radio_set_hostname_obj ,
133
+ (mp_obj_t )& mp_const_none_obj },
134
+ };
135
+
125
136
//| def connect(self, ssid: ReadableBuffer, password: ReadableBuffer = b"", *, channel: Optional[int] = 0, timeout: Optional[float] = None) -> bool:
126
137
//| """Connects to the given ssid and waits for an ip address. Reconnections are handled
127
138
//| automatically once one connection succeeds."""
@@ -236,7 +247,7 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = {
236
247
{ MP_ROM_QSTR (MP_QSTR_start_scanning_networks ), MP_ROM_PTR (& wifi_radio_start_scanning_networks_obj ) },
237
248
{ MP_ROM_QSTR (MP_QSTR_stop_scanning_networks ), MP_ROM_PTR (& wifi_radio_stop_scanning_networks_obj ) },
238
249
239
- { MP_ROM_QSTR (MP_QSTR_set_hostname ), MP_ROM_PTR (& wifi_radio_set_hostname_obj ) },
250
+ { MP_ROM_QSTR (MP_QSTR_hostname ), MP_ROM_PTR (& wifi_radio_hostname_obj ) },
240
251
241
252
{ MP_ROM_QSTR (MP_QSTR_connect ), MP_ROM_PTR (& wifi_radio_connect_obj ) },
242
253
// { MP_ROM_QSTR(MP_QSTR_connect_to_enterprise), MP_ROM_PTR(&wifi_radio_connect_to_enterprise_obj) },
0 commit comments