Write device GATT value
Used to write a value to a specified Handle on a connected device.
Refer RESTful-API Write the Value of a Specific Characteristic.
Example
1import asyncio
2import cassiablue
3
4
5async def main():
6 print("start gatt write")
7 addr = "20:00:00:00:00:01"
8 handle = "45"
9 value = "0100"
10 ok, ret = await cassiablue.gatt_write(addr, handle, value)
11 print("gatt write done:", type(ok), ok, type(ret), ret)
12
13
14asyncio.run(main())
API
- async cassiablue.gatt_write(addr: str, handle: str, value: str) tuple[ok: bool, result: str]
Used to write a value to a specified Handle on a connected device.
- Parameters:
addr: Device MAC Address
handle: Handle to be written
value: Value to be written
- Returns:
ok: Whether the operation was successful
result: Execution result