in src/ble/ble_scanner.py [0:0]
def scan_ble_devices(self, scan_secs):
# create a list of unique devices that the scanner discovered during thescan
devices = self.scanner.scan(scan_secs)
# Get relevent info for each device found in the scan
devices_info = {}
for dev in devices:
# Creat object for devuce with initil info
devices_info[dev.addr] = {
"address-type" : dev.addrType,
"rssi-db" : dev.rssi
}
# For each of the device's advertising data items, get a description of the data type and value of the data itself
# getScanData returns a list of tupples: adtype, desc, value
# where AD Type means “advertising data type,” as defined by Bluetooth convention:
# https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile
# desc is a human-readable description of the data type and value is the data itself
devices_info[dev.addr]['ad-data-types'] = {}
for (adtype, desc, value) in dev.getScanData():
if adtype == 255 and value:
value = self.int_string_to_chr(value)
devices_info[dev.addr]['ad-data-types'][adtype] = {
"adtype-value" : value,
"descption" : desc
}
return devices_info