@@ -700,14 +700,27 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_stations_ap_obj, wifi_radio_get_station
700
700
MP_PROPERTY_GETTER (wifi_radio_stations_ap_obj ,
701
701
(mp_obj_t )& wifi_radio_get_stations_ap_obj );
702
702
703
- //| def start_dhcp(self) -> None:
704
- //| """Starts the station DHCP client."""
703
+ //| def start_dhcp(self, *, ipv4: bool = supports_ipv4, ipv6: bool = supports_ipv6) -> None:
704
+ //| """Starts the station DHCP client.
705
+ //|
706
+ //| If specified
707
+ //| """
705
708
//| ...
706
- static mp_obj_t wifi_radio_start_dhcp_client (mp_obj_t self ) {
707
- common_hal_wifi_radio_start_dhcp_client (self );
709
+ static mp_obj_t wifi_radio_start_dhcp_client (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
710
+ enum { ARG_ipv4 , ARG_ipv6 };
711
+ static const mp_arg_t allowed_args [] = {
712
+ { MP_QSTR_ipv4 , MP_ARG_KW_ONLY | MP_ARG_BOOL , { .u_bool = MP_ROM_TRUE } },
713
+ { MP_QSTR_ipv6 , MP_ARG_KW_ONLY | MP_ARG_BOOL , { .u_bool = CIRCUITPY_SOCKETPOOL_IPV6 ? MP_ROM_TRUE : MP_ROM_FALSE } },
714
+ };
715
+
716
+ wifi_radio_obj_t * self = MP_OBJ_TO_PTR (pos_args [0 ]);
717
+ mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
718
+ mp_arg_parse_all (n_args - 1 , pos_args + 1 , kw_args , MP_ARRAY_SIZE (allowed_args ), allowed_args , args );
719
+
720
+ common_hal_wifi_radio_start_dhcp_client (self , args [ARG_ipv4 ].u_bool , args [ARG_ipv6 ].u_bool );
708
721
return mp_const_none ;
709
722
}
710
- MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_start_dhcp_client_obj , wifi_radio_start_dhcp_client );
723
+ static MP_DEFINE_CONST_FUN_OBJ_KW (wifi_radio_start_dhcp_client_obj , 1 , wifi_radio_start_dhcp_client ) ;
711
724
712
725
//| def stop_dhcp(self) -> None:
713
726
//| """Stops the station DHCP client. Needed to assign a static IP address."""
0 commit comments