bluetooth-lowenergy - --char-desc 和 --characteristics 之间的 gatttool 区别

标签 bluetooth-lowenergy gatttool

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 表示 Characteristics Discovery--char-desc 表示 Characteristics Descriptor 现在是什么有区别吗?

如果我在同一个 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 parameter )?

最佳答案

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

如果你读取特征,你将获得值本身;读取范围描述符,然后您将获得有效范围。

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

一个不错的引用: https://www.bluetooth.com/specifications/gatt/descriptors

更具体到上面的范围示例: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.valid_range.xml

关于bluetooth-lowenergy - --char-desc 和 --characteristics 之间的 gatttool 区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43179225/

相关文章:

arduino - ESP32 Arduino BLE 深度 sleep

Android 如何读取 BLE 属性 Readable Writable Notifiable GATT Characteristics

android - startLeScan 替换为当前 api

swift - 如何向服务添加特征

xcode - CoreBluetooth 框架和 IOBluetooth 框架的区别

bluetooth-lowenergy - C 语言的轻量级蓝牙 LE 库

python-3.x - pygatt : Unable to execute device. 订阅()