bluetooth-lowenergygatttool

Gatttool Non-Interactive mode, multiple char-write-req


I would like to retrieve the data of a stryd footpod. I would like to listen to 2 separate uuid's. In interactive mode, I would connect using

sudo gatttool -t random -b XX:XX:XX:XX:XX:XX -I
connect
char-write-req 0x001a 0100
char-write-req 0x000f 0100

However, as I use this as part of a perl script, I would like to leverage non-interactive mode.

Starting gatttool with a single handle works fine:

gatttool -t random -i hci0 -b XX:XX:XX:XX:XX:XX --char-write-req --handle=0x001a  --value=0100 --listen

However how do I pass both handles at the same time? Following does not work.

gatttool -t random -i hci0 -b XX:XX:XX:XX:XX:XX --char-write-req --handle=0x001a  --value=0100 --char-write-req --handle=0x000f  --value=0100 --listen

Thanks!


Solution

  • Found the solution on http://www.humbug.in/2014/using-gatttool-manualnon-interactive-mode-read-ble-devices/

    gatttool -t random -i hci0 -b XX:XX:XX:XX:XX:XX --char-write-req --handle=0x001a  --value=0100; sleep 1; gatttool -t random -i hci0 -b XX:XX:XX:XX:XX:XX --char-write-req --handle=0x000f  --value=0100 --listen
    

    Does the trick!