我正嘗試使用bluez的gattool寫入BLE自定義板上的某些演示特徵。具體而言,我希望寫出一個特點,並將價值讀回來。下面是我在做什麼(其中0x25爲特徵的手柄):GATT工具無法讀取/寫入特徵
bluepy$ gatttool -b EC:24:B8:23:1C:39 -I
[ ][EC:24:B8:23:1C:39][LE]> connect
[CON][EC:24:B8:23:1C:39][LE]> char-read-hnd 0x0025
[CON][EC:24:B8:23:1C:39][LE]> Characteristic value/descriptor: 01
[CON][EC:24:B8:23:1C:39][LE]> char-write-cmd 0x25 0x02
[CON][EC:24:B8:23:1C:39][LE]> char-read-hnd 0x0025
[CON][EC:24:B8:23:1C:39][LE]> Characteristic value/descriptor: 00
有誰知道爲什麼看了特徵值是00,而不是02(的char-write-cmd
秒參數)?
任何幫助將不勝感激。
'gatttool'非常挑剔。嘗試'char-write-cmd 0x25 02'來代替(也就是說,值中沒有'0x')。 – kaylum
我會避免使用'gatttool',因爲我從來沒有很好的體驗過它。試試'bluetoothctl'或者'btgatt-client',看看你是否發現對你更好。另外請注意描述符與值不同。 – Zimano
檢查你是否有寫權限,並且char-write-cmd沒有任何響應,所以char-write-req更好;如果你沒有權限,它會提示錯誤 – Jagdish