Skip to content

Instantly share code, notes, and snippets.

@jdevoo
Last active November 24, 2019 12:33

Revisions

  1. jdevoo revised this gist Nov 24, 2019. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions thingy.md
    Original file line number Diff line number Diff line change
    @@ -16,5 +16,15 @@ handle 0x40 is the CCCD to get notifications from the motion service (0406 raw d

    by writing 0100 (msb first?) to the handle, we can subscribe to the values in hex

    # bash
    ```
    IFS=$'\n'
    while true; do
    timeout 10s gatttool -b FD:19:AF:BA:73:C0 -t random --char-write-req --handle 0x40 --value 0100 --listen | cut -d ' ' -f 6-11
    echo $(date +'%F %T')
    sleep 185s
    done
    ```

    # node
    `sudo setcap cap_net_raw+eip $(eval readlink -f /opt/node-v8.16.2-linux-armv7l/bin/node)`
  2. jdevoo revised this gist Nov 23, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions thingy.md
    Original file line number Diff line number Diff line change
    @@ -5,8 +5,10 @@ obtain mac with `hcitool lescan` (here FD:19:AF:BA:73:C0)

    spot the following lines (see [source](https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial))

    ```
    handle = 0x003f, uuid = ef680406-9b35-4933-9b10-52ffa9740042
    handle = 0x0040, uuid = 00002902-0000-1000-8000-00805f9b34fb
    ```

    handle 0x40 is the CCCD to get notifications from the motion service (0406 raw data characteristic)

  3. jdevoo revised this gist Nov 23, 2019. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions thingy.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # gatttool
    obtain mac with hcitool lescan (here FD:19:AF:BA:73:C0)
    obtain mac with `hcitool lescan` (here FD:19:AF:BA:73:C0)

    gatttool -b FD:19:AF:BA:73:C0 -t random --char-desc
    `gatttool -b FD:19:AF:BA:73:C0 -t random --char-desc`

    spot the following lines (see [source](https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial))

    @@ -10,9 +10,9 @@ handle = 0x0040, uuid = 00002902-0000-1000-8000-00805f9b34fb

    handle 0x40 is the CCCD to get notifications from the motion service (0406 raw data characteristic)

    gatttool -b FD:19:AF:BA:73:C0 -t random --char-write-req --handle 0x40 --value 0100 --listen
    `gatttool -b FD:19:AF:BA:73:C0 -t random --char-write-req --handle 0x40 --value 0100 --listen`

    by writing 0100 (msb first?) to the handle, we can subscribe to the values in hex

    # node
    sudo setcap cap_net_raw+eip $(eval readlink -f /opt/node-v8.16.2-linux-armv7l/bin/node)
    `sudo setcap cap_net_raw+eip $(eval readlink -f /opt/node-v8.16.2-linux-armv7l/bin/node)`
  4. jdevoo created this gist Nov 23, 2019.
    18 changes: 18 additions & 0 deletions thingy.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # gatttool
    obtain mac with hcitool lescan (here FD:19:AF:BA:73:C0)

    gatttool -b FD:19:AF:BA:73:C0 -t random --char-desc

    spot the following lines (see [source](https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial))

    handle = 0x003f, uuid = ef680406-9b35-4933-9b10-52ffa9740042
    handle = 0x0040, uuid = 00002902-0000-1000-8000-00805f9b34fb

    handle 0x40 is the CCCD to get notifications from the motion service (0406 raw data characteristic)

    gatttool -b FD:19:AF:BA:73:C0 -t random --char-write-req --handle 0x40 --value 0100 --listen

    by writing 0100 (msb first?) to the handle, we can subscribe to the values in hex

    # node
    sudo setcap cap_net_raw+eip $(eval readlink -f /opt/node-v8.16.2-linux-armv7l/bin/node)