@@ -310,7 +310,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station);
310
310
//| authmode: Optional[AuthMode] = None,
311
311
//| max_connections: Optional[int] = 4
312
312
//| ) -> None:
313
- //| """Starts an Access Point with the specified ssid and password.
313
+ //| """Starts running an access point with the specified ssid and password.
314
314
//|
315
315
//| If ``channel`` is given, the access point will use that channel unless
316
316
//| a station is already operating on a different channel.
@@ -376,14 +376,24 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_
376
376
STATIC MP_DEFINE_CONST_FUN_OBJ_KW (wifi_radio_start_ap_obj , 1 , wifi_radio_start_ap );
377
377
378
378
//| def stop_ap(self) -> None:
379
- //| """Stops the Access Point ."""
379
+ //| """Stops the access point ."""
380
380
//| ...
381
381
STATIC mp_obj_t wifi_radio_stop_ap (mp_obj_t self ) {
382
382
common_hal_wifi_radio_stop_ap (self );
383
383
return mp_const_none ;
384
384
}
385
385
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_stop_ap_obj , wifi_radio_stop_ap );
386
386
387
+ //| ap_active: bool
388
+ //| """True if running as an access point. (read-only)"""
389
+ STATIC mp_obj_t wifi_radio_get_ap_active (mp_obj_t self ) {
390
+ return mp_obj_new_bool (common_hal_wifi_radio_get_ap_active (self ));
391
+ }
392
+ MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ap_active_obj , wifi_radio_get_ap_active );
393
+
394
+ MP_PROPERTY_GETTER (wifi_radio_ap_active_obj ,
395
+ (mp_obj_t )& wifi_radio_get_ap_active_obj );
396
+
387
397
//| def connect(
388
398
//| self,
389
399
//| ssid: Union[str | ReadableBuffer],
@@ -464,44 +474,50 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m
464
474
}
465
475
STATIC MP_DEFINE_CONST_FUN_OBJ_KW (wifi_radio_connect_obj , 1 , wifi_radio_connect );
466
476
477
+ //| connected: bool
478
+ //| """True if connected to an access point (read-only)."""
479
+ STATIC mp_obj_t wifi_radio_get_connected (mp_obj_t self ) {
480
+ return mp_obj_new_bool (common_hal_wifi_radio_get_connected (self ));
481
+ }
482
+ MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_connected_obj , wifi_radio_get_connected );
483
+
484
+ MP_PROPERTY_GETTER (wifi_radio_connected_obj ,
485
+ (mp_obj_t )& wifi_radio_get_connected_obj );
486
+
467
487
//| ipv4_gateway: Optional[ipaddress.IPv4Address]
468
- //| """IP v4 Address of the station gateway when connected to an access point. None otherwise."""
488
+ //| """IP v4 Address of the station gateway when connected to an access point. None otherwise. (read-only) """
469
489
STATIC mp_obj_t wifi_radio_get_ipv4_gateway (mp_obj_t self ) {
470
490
return common_hal_wifi_radio_get_ipv4_gateway (self );
471
-
472
491
}
473
492
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ipv4_gateway_obj , wifi_radio_get_ipv4_gateway );
474
493
475
494
MP_PROPERTY_GETTER (wifi_radio_ipv4_gateway_obj ,
476
495
(mp_obj_t )& wifi_radio_get_ipv4_gateway_obj );
477
496
478
497
//| ipv4_gateway_ap: Optional[ipaddress.IPv4Address]
479
- //| """IP v4 Address of the access point gateway, when enabled. None otherwise."""
498
+ //| """IP v4 Address of the access point gateway, when enabled. None otherwise. (read-only) """
480
499
STATIC mp_obj_t wifi_radio_get_ipv4_gateway_ap (mp_obj_t self ) {
481
500
return common_hal_wifi_radio_get_ipv4_gateway_ap (self );
482
-
483
501
}
484
502
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ipv4_gateway_ap_obj , wifi_radio_get_ipv4_gateway_ap );
485
503
486
504
MP_PROPERTY_GETTER (wifi_radio_ipv4_gateway_ap_obj ,
487
505
(mp_obj_t )& wifi_radio_get_ipv4_gateway_ap_obj );
488
506
489
507
//| ipv4_subnet: Optional[ipaddress.IPv4Address]
490
- //| """IP v4 Address of the station subnet when connected to an access point. None otherwise."""
508
+ //| """IP v4 Address of the station subnet when connected to an access point. None otherwise. (read-only) """
491
509
STATIC mp_obj_t wifi_radio_get_ipv4_subnet (mp_obj_t self ) {
492
510
return common_hal_wifi_radio_get_ipv4_subnet (self );
493
-
494
511
}
495
512
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ipv4_subnet_obj , wifi_radio_get_ipv4_subnet );
496
513
497
514
MP_PROPERTY_GETTER (wifi_radio_ipv4_subnet_obj ,
498
515
(mp_obj_t )& wifi_radio_get_ipv4_subnet_obj );
499
516
500
517
//| ipv4_subnet_ap: Optional[ipaddress.IPv4Address]
501
- //| """IP v4 Address of the access point subnet, when enabled. None otherwise."""
518
+ //| """IP v4 Address of the access point subnet, when enabled. None otherwise. (read-only) """
502
519
STATIC mp_obj_t wifi_radio_get_ipv4_subnet_ap (mp_obj_t self ) {
503
520
return common_hal_wifi_radio_get_ipv4_subnet_ap (self );
504
-
505
521
}
506
522
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ipv4_subnet_ap_obj , wifi_radio_get_ipv4_subnet_ap );
507
523
@@ -538,10 +554,9 @@ STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_a
538
554
STATIC MP_DEFINE_CONST_FUN_OBJ_KW (wifi_radio_set_ipv4_address_obj , 1 , wifi_radio_set_ipv4_address );
539
555
540
556
//| ipv4_address: Optional[ipaddress.IPv4Address]
541
- //| """IP v4 Address of the station when connected to an access point. None otherwise."""
557
+ //| """IP v4 Address of the station when connected to an access point. None otherwise. (read-only) """
542
558
STATIC mp_obj_t _wifi_radio_get_ipv4_address (mp_obj_t self ) {
543
559
return common_hal_wifi_radio_get_ipv4_address (self );
544
-
545
560
}
546
561
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ipv4_address_obj , _wifi_radio_get_ipv4_address );
547
562
@@ -552,7 +567,6 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_address_obj,
552
567
//| """IP v4 Address of the access point, when enabled. None otherwise."""
553
568
STATIC mp_obj_t wifi_radio_get_ipv4_address_ap (mp_obj_t self ) {
554
569
return common_hal_wifi_radio_get_ipv4_address_ap (self );
555
-
556
570
}
557
571
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ipv4_address_ap_obj , wifi_radio_get_ipv4_address_ap );
558
572
@@ -563,7 +577,6 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_address_ap_obj,
563
577
//| """IP v4 Address of the DNS server to be used."""
564
578
STATIC mp_obj_t wifi_radio_get_ipv4_dns (mp_obj_t self ) {
565
579
return common_hal_wifi_radio_get_ipv4_dns (self );
566
-
567
580
}
568
581
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ipv4_dns_obj , wifi_radio_get_ipv4_dns );
569
582
@@ -582,7 +595,6 @@ MP_PROPERTY_GETSET(wifi_radio_ipv4_dns_obj,
582
595
//| """Network object containing BSSID, SSID, authmode, channel, country and RSSI when connected to an access point. None otherwise."""
583
596
STATIC mp_obj_t wifi_radio_get_ap_info (mp_obj_t self ) {
584
597
return common_hal_wifi_radio_get_ap_info (self );
585
-
586
598
}
587
599
MP_DEFINE_CONST_FUN_OBJ_1 (wifi_radio_get_ap_info_obj , wifi_radio_get_ap_info );
588
600
@@ -656,12 +668,14 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = {
656
668
657
669
{ MP_ROM_QSTR (MP_QSTR_start_ap ), MP_ROM_PTR (& wifi_radio_start_ap_obj ) },
658
670
{ MP_ROM_QSTR (MP_QSTR_stop_ap ), MP_ROM_PTR (& wifi_radio_stop_ap_obj ) },
671
+ { MP_ROM_QSTR (MP_QSTR_ap_active ), MP_ROM_PTR (& wifi_radio_ap_active_obj ) },
659
672
660
673
{ MP_ROM_QSTR (MP_QSTR_start_dhcp ), MP_ROM_PTR (& wifi_radio_start_dhcp_client_obj ) },
661
674
{ MP_ROM_QSTR (MP_QSTR_stop_dhcp ), MP_ROM_PTR (& wifi_radio_stop_dhcp_client_obj ) },
662
675
663
676
{ MP_ROM_QSTR (MP_QSTR_connect ), MP_ROM_PTR (& wifi_radio_connect_obj ) },
664
677
// { MP_ROM_QSTR(MP_QSTR_connect_to_enterprise), MP_ROM_PTR(&wifi_radio_connect_to_enterprise_obj) },
678
+ { MP_ROM_QSTR (MP_QSTR_connected ), MP_ROM_PTR (& wifi_radio_connected_obj ) },
665
679
666
680
{ MP_ROM_QSTR (MP_QSTR_ap_info ), MP_ROM_PTR (& wifi_radio_ap_info_obj ) },
667
681
{ MP_ROM_QSTR (MP_QSTR_ipv4_dns ), MP_ROM_PTR (& wifi_radio_ipv4_dns_obj ) },
@@ -674,9 +688,6 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = {
674
688
675
689
{ MP_ROM_QSTR (MP_QSTR_set_ipv4_address ), MP_ROM_PTR (& wifi_radio_set_ipv4_address_obj ) },
676
690
677
- // { MP_ROM_QSTR(MP_QSTR_access_point_active), MP_ROM_PTR(&wifi_radio_access_point_active_obj) },
678
- // { MP_ROM_QSTR(MP_QSTR_start_access_point), MP_ROM_PTR(&wifi_radio_start_access_point_obj) },
679
-
680
691
{ MP_ROM_QSTR (MP_QSTR_ping ), MP_ROM_PTR (& wifi_radio_ping_obj ) },
681
692
};
682
693
0 commit comments