File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
ports/esp32s2/common-hal/wifi Expand file tree Collapse file tree 3 files changed +25
-0
lines changed 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) {
35
35
return mp_obj_new_str (cstr , strlen (cstr ));
36
36
}
37
37
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
+
38
44
mp_obj_t common_hal_wifi_network_get_rssi (wifi_network_obj_t * self ) {
39
45
return mp_obj_new_int (self -> record .rssi );
40
46
}
Original file line number Diff line number Diff line change @@ -58,6 +58,23 @@ const mp_obj_property_t wifi_network_ssid_obj = {
58
58
};
59
59
60
60
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
+
61
78
//| rssi: int
62
79
//| """Signal strength of the network"""
63
80
//|
@@ -94,6 +111,7 @@ const mp_obj_property_t wifi_network_channel_obj = {
94
111
95
112
STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table [] = {
96
113
{ 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 ) },
97
115
{ MP_ROM_QSTR (MP_QSTR_rssi ), MP_ROM_PTR (& wifi_network_rssi_obj ) },
98
116
{ MP_ROM_QSTR (MP_QSTR_channel ), MP_ROM_PTR (& wifi_network_channel_obj ) },
99
117
};
Original file line number Diff line number Diff line change 36
36
const mp_obj_type_t wifi_network_type ;
37
37
38
38
extern 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 );
39
40
extern mp_obj_t common_hal_wifi_network_get_rssi (wifi_network_obj_t * self );
40
41
extern mp_obj_t common_hal_wifi_network_get_channel (wifi_network_obj_t * self );
41
42
You can’t perform that action at this time.
0 commit comments