62
62
_GET_IPADDR_CMD = const (0x21 )
63
63
_GET_MACADDR_CMD = const (0x22 )
64
64
_GET_CURR_SSID_CMD = const (0x23 )
65
+ _GET_CURR_BSSID_CMD = const (0x24 )
65
66
_GET_CURR_RSSI_CMD = const (0x25 )
66
67
_GET_CURR_ENCT_CMD = const (0x26 )
67
68
83
84
_START_SCAN_NETWORKS = const (0x36 )
84
85
_GET_FW_VERSION_CMD = const (0x37 )
85
86
_GET_TIME = const (0x3B )
87
+ _GET_IDX_BSSID_CMD = const (0x3C )
88
+ _GET_IDX_CHAN_CMD = const (0x3D )
86
89
_PING_CMD = const (0x3E )
87
90
88
91
_SEND_DATA_TCP_CMD = const (0x44 )
@@ -351,7 +354,7 @@ def start_scan_networks(self):
351
354
352
355
def get_scan_networks (self ):
353
356
"""The results of the latest SSID scan. Returns a list of dictionaries with
354
- 'ssid', 'rssi' and 'encryption' entries, one for each AP found"""
357
+ 'ssid', 'rssi', 'encryption', bssid, and channel entries, one for each AP found"""
355
358
self ._send_command (_SCAN_NETWORKS )
356
359
names = self ._wait_response_cmd (_SCAN_NETWORKS )
357
360
#print("SSID names:", names)
@@ -362,6 +365,10 @@ def get_scan_networks(self):
362
365
a_p ['rssi' ] = struct .unpack ('<i' , rssi )[0 ]
363
366
encr = self ._send_command_get_response (_GET_IDX_ENCT_CMD , ((i ,),))[0 ]
364
367
a_p ['encryption' ] = encr [0 ]
368
+ bssid = self ._send_command_get_response (_GET_IDX_BSSID_CMD , ((i ,),))[0 ]
369
+ a_p ['bssid' ] = bssid
370
+ chan = self ._send_command_get_response (_GET_IDX_CHAN_CMD , ((i ,),))[0 ]
371
+ a_p ['channel' ] = chan [0 ]
365
372
APs .append (a_p )
366
373
return APs
367
374
@@ -431,6 +438,12 @@ def ssid(self):
431
438
resp = self ._send_command_get_response (_GET_CURR_SSID_CMD , [b'\xFF ' ])
432
439
return resp [0 ]
433
440
441
+ @property
442
+ def bssid (self ):
443
+ """The MAC-formatted service set ID of the access point we're connected to"""
444
+ resp = self ._send_command_get_response (_GET_CURR_BSSID_CMD , [b'\xFF ' ])
445
+ return resp [0 ]
446
+
434
447
@property
435
448
def rssi (self ):
436
449
"""The receiving signal strength indicator for the access point we're
0 commit comments