Gatttool in non interactive mode

1.5k Views Asked by At

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?

0

There are 0 best solutions below