get more bluetooth info
This commit is contained in:
29
test.py
29
test.py
@@ -4,7 +4,34 @@ import asyncio
|
|||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
devices = await bleak.BleakScanner.discover()
|
devices = await bleak.BleakScanner.discover()
|
||||||
print(devices)
|
try:
|
||||||
|
this_device = await BleakScanner.find_device_by_address(device.address, timeout=20)
|
||||||
|
async with BleakClient(this_device) as client:
|
||||||
|
print(f'Services found for device')
|
||||||
|
print(f'\tDevice address:{device.address}')
|
||||||
|
print(f'\tDevice name:{device.name}')
|
||||||
|
|
||||||
|
print('\tServices:')
|
||||||
|
for service in client.services:
|
||||||
|
print()
|
||||||
|
print(f'\t\tDescription: {service.description}')
|
||||||
|
print(f'\t\tService: {service}')
|
||||||
|
|
||||||
|
print('\t\tCharacteristics:')
|
||||||
|
for c in service.characteristics:
|
||||||
|
print()
|
||||||
|
print(f'\t\t\tUUID: {c.uuid}'),
|
||||||
|
print(f'\t\t\tDescription: {c.uuid}')
|
||||||
|
print(f'\t\t\tHandle: {c.uuid}'),
|
||||||
|
print(f'\t\t\tProperties: {c.uuid}')
|
||||||
|
|
||||||
|
print('\t\tDescriptors:')
|
||||||
|
for descrip in c.descriptors:
|
||||||
|
print(f'\t\t\t{descrip}')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Could not connect to device with info: {device}")
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
Reference in New Issue
Block a user