-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_send.py
24 lines (18 loc) · 876 Bytes
/
test_send.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import asyncio
from bleak import BleakScanner, BleakClient
async def discover_descriptors(device_name):
async with BleakScanner() as scanner:
devices = await scanner.discover()
for device in devices:
if device.name == device_name:
print("Device found!")
async with BleakClient(device.address) as client:
desired_handle = None
for service in client.services:
if service.uuid == "afc05da0-0cd4-11e6-a148-3e1d05defe78":
desired_handle = service.handle
await client.write_gatt_char(
"f4c48032-0056-11e6-8d22-5e5517507c66", desired_handle
)
asyncio.run(discover_descriptors("BoostedRmt99BAF6E3"))
# asyncio.run(discover_descriptors("BoostedRmt99AF11C6"))