0

我正在尝试使用 gatttool 在蓝牙 le 设备上连接和设置值。我在非交互模式下需要这个,但只能让交互模式工作:

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 在非交互模式下可以做到这一点吗?

4

0 回答 0