File tree Expand file tree Collapse file tree
ports/esp32s2/common-hal/wifi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ mp_obj_t common_hal_wifi_network_get_ssid(wifi_network_obj_t *self) {
3535 return mp_obj_new_str (cstr , strlen (cstr ));
3636}
3737
38+ #define MAC_ADDRESS_LENGTH 6
39+
40+ mp_obj_t common_hal_wifi_network_get_bssid (wifi_network_obj_t * self ) {
41+ return mp_obj_new_bytes (self -> record .bssid , MAC_ADDRESS_LENGTH );
42+ }
43+
3844mp_obj_t common_hal_wifi_network_get_rssi (wifi_network_obj_t * self ) {
3945 return mp_obj_new_int (self -> record .rssi );
4046}
Original file line number Diff line number Diff line change @@ -58,6 +58,23 @@ const mp_obj_property_t wifi_network_ssid_obj = {
5858};
5959
6060
61+ //| bssid: bytes
62+ //| """BSSID of the network (usually the AP's MAC address)"""
63+ //|
64+ STATIC mp_obj_t wifi_network_get_bssid (mp_obj_t self ) {
65+ return common_hal_wifi_network_get_bssid (self );
66+
67+ }
68+ MP_DEFINE_CONST_FUN_OBJ_1 (wifi_network_get_bssid_obj , wifi_network_get_bssid );
69+
70+ const mp_obj_property_t wifi_network_bssid_obj = {
71+ .base .type = & mp_type_property ,
72+ .proxy = { (mp_obj_t )& wifi_network_get_bssid_obj ,
73+ (mp_obj_t )& mp_const_none_obj ,
74+ (mp_obj_t )& mp_const_none_obj },
75+ };
76+
77+
6178//| rssi: int
6279//| """Signal strength of the network"""
6380//|
@@ -94,6 +111,7 @@ const mp_obj_property_t wifi_network_channel_obj = {
94111
95112STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table [] = {
96113 { MP_ROM_QSTR (MP_QSTR_ssid ), MP_ROM_PTR (& wifi_network_ssid_obj ) },
114+ { MP_ROM_QSTR (MP_QSTR_bssid ), MP_ROM_PTR (& wifi_network_bssid_obj ) },
97115 { MP_ROM_QSTR (MP_QSTR_rssi ), MP_ROM_PTR (& wifi_network_rssi_obj ) },
98116 { MP_ROM_QSTR (MP_QSTR_channel ), MP_ROM_PTR (& wifi_network_channel_obj ) },
99117};
Original file line number Diff line number Diff line change 3636const mp_obj_type_t wifi_network_type ;
3737
3838extern mp_obj_t common_hal_wifi_network_get_ssid (wifi_network_obj_t * self );
39+ extern mp_obj_t common_hal_wifi_network_get_bssid (wifi_network_obj_t * self );
3940extern mp_obj_t common_hal_wifi_network_get_rssi (wifi_network_obj_t * self );
4041extern mp_obj_t common_hal_wifi_network_get_channel (wifi_network_obj_t * self );
4142
You can’t perform that action at this time.
0 commit comments