Gatttool在非交互模式下

时间:2017-01-19 21:29:52

标签: linux bluetooth raspberry-pi bluetooth-lowenergy gatttool

我试图使用gatttool连接并设置蓝牙设备上的值。 我需要在非交互模式下使用它,但只能使交互模式工作:

pi@raspberrypi:~/x$ sudo gatttool -I
[                 ][LE]> connect XX:XX:XX:XX:XX:XX
Attempting to connect to XX:XX:XX:XX:XX:XX
Connection successful
[XX:XX:XX:XX:XX:XX][LE]> char-write-req 0x0047 00000000
Characteristic value was written successfully
[XX:XX:XX:XX:XX:XX][LE]> char-write-req 0x003f 2424242a008080
Characteristic value was written successfully
[XX:XX:XX:XX:XX:XX][LE]> exit

但我需要这样的事情:

pi@raspberrypi:~/x$ sudo gatttool -i hci0 -b XX:XX:XX:XX:XX --char-write-req --handle=0x0047 --value=00000000
Characteristic value was written successfully
pi@raspberrypi:~/x$ sudo gatttool -i hci0 -b XX:XX:XX:XX:XX --char-write-req --handle=0x003f --value=2424242a008080
Characteristic Write Request failed: Attribute can't be written

第一个命令是PIN 0000 0000的认证,看起来它正在工作.. 第二个命令失败了,但我不知道为什么。

在非交互模式下使用gatttool可以实现吗?

0 个答案:

没有答案