簡體   English   中英

無法在 Bluetoothctl 中為讀/寫特性工作獲取寫入

[英]Not working acquire-write for Read/Write characteristic in Bluetoothctl

我通過 bluetoothctl 連接到智能手表。 我列出了所有屬性。 然后獲取目標 UUID 的信息(6e400002-b5a3-f393-e0a9-e50e24dcca9e)。 我看到它具有讀寫能力(讀/寫)。 我用“select-attribute”命令選擇了屬性。 但我未能獲得寫入:org.bluez.Error.NotSupported。

為什么我不能這樣做?

linaro@linaro-alip:~$ bluetoothctl
Agent registered
[bluetooth]# pair 00:18:80:81:FE:81
Attempting to pair with 00:18:80:81:FE:81
[CHG] Device 00:18:80:81:FE:81 Connected: yes
[CHG] Device 00:18:80:81:FE:81 Paired: yes
Pairing successful
[CHG] Device 00:18:80:81:FE:81 ServicesResolved: yes
[Cordio]# menu gatt
[Cordio]# list-attributes
Primary Service
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020
    6e400000-b5a3-f393-e0a9-e50e24dcca9e
    Vendor specific
Characteristic
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0024
    6e400002-b5a3-f393-e0a9-e50e24dcca9e
    Nordic UART TX
Characteristic
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0021
    6e400001-b5a3-f393-e0a9-e50e24dcca9e
    Nordic UART Service
Descriptor
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0021/desc0023
    00002902-0000-1000-8000-00805f9b34fb
    Client Characteristic Configuration
Primary Service
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0010
    00001801-0000-1000-8000-00805f9b34fb
    Generic Attribute Profile
Characteristic
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0010/char0011
    00002a05-0000-1000-8000-00805f9b34fb
    Service Changed
Descriptor
    /org/bluez/hci0/dev_00_18_80_81_FE_81/service0010/char0011/desc0013
    00002902-0000-1000-8000-00805f9b34fb
    Client Characteristic Configuration
[Cordio]# attribute-info 6e400002-b5a3-f393-e0a9-e50e24dcca9e
Characteristic - Nordic UART TX
    UUID: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
    Service: /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020
    Value:
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00 00 00 00                                      ....            
    Flags: read
    Flags: write
[Cordio]# select-attribute 6e400002-b5a3-f393-e0a9-e50e24dcca9e
[Cordio:/service0020/char0024]# write 0x55
Attempting to write /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0024
[Cordio:/service0020/char0024]# acquire-write
Failed to acquire write: org.bluez.Error.NotSupported
[Cordio:/service0020/char0024]# read
Attempting to read /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0024
[CHG] Attribute /org/bluez/hci0/dev_00_18_80_81_FE_81/service0020/char0024 Value:
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00 00 00 00                                      ....            
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00 00 00 00                                      ....            
      

你的日志看起來有點奇怪。 根據UART/Serial Port Emulation over BLE 規范,特性./service0020/char0024 aka UUID 6e400002-b5a3-f393-e0a9-e50e24dcca9e是 RX 特性,它是只寫的。

無論如何,您日志中的數據與北歐規范中記錄的信息不匹配。

它不適用於 'write' 標志,僅支持 'write-without-response'。

來自文檔:對於客戶端,它僅適用於具有 WriteAcquired 屬性的特征,該屬性依賴於 write-without-response 標志。

我解決了問題,

首先,我認為 write 命令不起作用,因為我無法得到響應(原始數據),但它正在工作。

因為當另一個UUID(6e400001-b5a3-f393-e0a9-e50e24dcca9e)設置為'notify'(獲取-通知)時,原始數據開始來自智能手表。

謝謝大家的回答。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM