admin管理员组

文章数量:1291187

I am using Bleak Library in Python in Windows OS to read data from a BLE device continuously which is advertising 18bytes of data every 5seconds. But I am missing some advertisement packets. Below is the code I am using. Can someone suggest why some packets are missed

ble_address = "DEVICE MAC ADDRESS"
async def run():
    found = False
    while(1):
     devices = await BleakScanner.discover(1,return_adv=True)
     for d in devices:
        if(d == ble_address):
            print(f"{datetime.datetime.now()}: {devices[d][1]}")
            data = devices[d][1].manufacturer_data
            print([hex(x) for x in list(data[1318])])
            found = True
            break
asyncio.run(run())

output:

2025-01-24 20:37:10.801869: AdvertisementData(manufacturer_data={1318: b'wxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x00'}, rssi=-22)

['0x77', '0x78', '0x79', '0x7a', '0x7b', '0x7c', '0x7d', '0x7e', '0x7f', '0x80', '0x81', '0x82', '0x83', '0x84', '0x85', '0x86', '0x87', '0x88', '0x0']

I expected all the advertisement frames to be captured, but many frames are missing from the data

本文标签: