0

im trying to use gatttool to connect and set value on a Bluetooth le device. I need this on non-interactive mode, but can only get the interactive mode working:

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

But i need something like this:

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

First command is an authentication with PIN 0000 0000 and this Looks like it is working.. The second command failed, but i dont know why.

Is this possible with gatttool on non-interactive mode?

lite
  • 31
  • 5
  • 2
    The non-interactive one has a disconnect occurring between the two commands. Is the authentication PIN required for the second write to be successful? If so, that's likely the problem. I don't think you can chain more than one read or write in a single command. – Tim Tisdall Jan 20 '17 at 16:56
  • Please refer to my answer to a similar question here: http://stackoverflow.com/questions/40303153/gatttool-non-interactive-mode-char-write/42731796#42731796 – Al Badokhon Mar 11 '17 at 05:47

0 Answers0