写入设备GATT特征值

用于写入指定连接设备指定Handle的值。

参考RESTful-API Write the Value of a Specific Characteristic

示例

 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]

用于写入指定连接设备指定Handle的值。

Parameters:
  • addr: 设备MAC地址

  • handle: 待写入Handle

  • value: 待写入的值

返回:

  • ok: 是否执行成功

  • result: 执行结果