Gatttool中--char-desc和--characteristics之间的区别

3

gatttool --help-all 命令的说明如下:

Usage:
  gatttool [OPTION...]

Help Options:
  -h, --help                                Show help options
  --help-all                                Show all help options
  --help-gatt                               Show all GATT commands
  --help-params                             Show all Primary Services/Characteristics arguments
  --help-char-read-write                    Show all Characteristics Value/Descriptor Read/Write arguments

GATT commands
  --primary                                 Primary Service Discovery
  --characteristics                         Characteristics Discovery
  --char-read                               Characteristics Value/Descriptor Read
  --char-write                              Characteristics Value Write Without Response (Write Command)
  --char-write-req                          Characteristics Value Write (Write Request)
  --char-desc                               Characteristics Descriptor Discovery
  --listen                                  Listen for notifications and indications

Primary Services/Characteristics arguments
  -s, --start=0x0001                        Starting handle(optional)
  -e, --end=0xffff                          Ending handle(optional)
  -u, --uuid=0x1801                         UUID16 or UUID128(optional)

Characteristics Value/Descriptor Read/Write arguments
  -a, --handle=0x0001                       Read/Write characteristic by handle(required)
  -n, --value=0x0001                        Write characteristic value (required for write operation)

Application Options:
  -i, --adapter=hciX                        Specify local adapter interface
  -b, --device=MAC                          Specify remote Bluetooth address
  -t, --addr-type=[public | random]         Set LE address type. Default: public
  -m, --mtu=MTU                             Specify the MTU size
  -p, --psm=PSM                             Specify the PSM for GATT/ATT over BR/EDR
  -l, --sec-level=[low | medium | high]     Set security level. Default: low
  -I, --interactive                         Use interactive mode

--characteristics指的是“特征发现”,而--char-desc指的是“特征描述符”,它们有什么区别呢?

如果我对同一个BLE设备运行它们两个,我会得到相同UUID的不同句柄吗?例如:

gatttool --device=C4:7C:8D:62:D3:19 --characteristics
...
handle = 0x0032, char properties = 0x0a, char value handle = 0x0033, uuid = 00001a00-0000-1000-8000-00805f9b34fb
...

gatttool --device=C4:7C:8D:62:D3:19 --char-desc
...
handle = 0x0033, uuid = 00001a00-0000-1000-8000-00805f9b34fb
...

在使用read/write(-a参数)时,我应该使用来自--characteristics还是--char-desc的句柄?

1个回答

2
将以下文本翻译成中文:

将描述符视为有关特征的元数据,或者是“定义属性,用于描述特征值”。例如,您可能具有包含某些测量值的特征,然后还具有说明该值的可接受范围的描述符。

如果您读取特征,则会获取值本身;如果读取范围描述符,则会获取有效范围。

一些描述符已经被纳入蓝牙规范,并分配了编号,而一些可能是自定义的,没有通用文档。

一个不错的参考资料: https://www.bluetooth.com/specifications/gatt/descriptors

更具体地针对上述范围示例: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.valid_range.xml


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接