python ble scanner windows nordic
# pip install blatann
from blatann import BleDevice
from blatann.examples import example_utils
import time
from blatann.nrf.nrf_types.gatt import BLEGattCharacteristic
from pc_ble_driver_py.ble_driver import BLEGattExecWriteFlag, BLEGattWriteOperation, BLEGattcWriteParams
logger = example_utils.setup_logger(level="INFO")
def main(serial_port):
# Create and open the device
address = ""
ble_device = BleDevice(serial_port)
ble_device.open()
ble_device.scanner.set_default_scan_params(timeout_seconds=4)
# Start scanning and iterate through the reports as they're received
for report in ble_device.scanner.start_scan().scan_reports:
if not report.duplicate:
stringreport = str(report)
logger.info(report)
print(str(report.peer_address))
print(str(report.device_name))
if __name__ == '__main__':
main("COM11")