22 lines
870 B
Python
22 lines
870 B
Python
import asyncio
|
|
from bleak import BleakScanner, BleakError
|
|
|
|
VENDOR_PREFIXES = ['00:25:DF', '00:58:28', '00:C0:D4', '84:70:03' 'C0:1C:6A']
|
|
|
|
async def main():
|
|
print("Scanning for BLE devices...")
|
|
try:
|
|
devices = await BleakScanner.discover()
|
|
print(f"Found {len(devices)} devices:")
|
|
filtered_devices = [device for device in devices if any(device.address.upper().startswith(prefix) for prefix in VENDOR_PREFIXES)]
|
|
if filtered_devices:
|
|
for device in filtered_devices:
|
|
print(f"MAC Address: {device.address}, Name: {device.name}")
|
|
else:
|
|
print("No devices found with the specified vendor prefixes.")
|
|
except BleakError as e:
|
|
print(f"Error: {e}")
|
|
print("Make sure Bluetooth is enabled and a Bluetooth adapter is present.")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main()) |