Veethree D7 SDK
Loading...
Searching...
No Matches
Bluetooth Low Energy client

< Bluetooth

This is an example to connect to a BLE peripheral, query services and receive notifications.

Connect to a BLE peripheral

Before connecting to a BLE peripheral, open the D7 shell, enable Bluetooth and create a pairing request to the remote device using commands given in Bluetooth Basics.

  1. Scan for the BLE peripheral on the D7:

    $ btmgmt find -l

    The scan returns a list of BLE peripherals and the response may look like:

    hci0 dev_found: <MAC> type LE Public rssi -50 flags 0x0000
    name <NAME>
  2. Start a session with the BLE peripheral:

    $ gatttool -b <MAC> -I

    if the scan from previous step reported a Random MAC address, instead of Public, pass -t random to the command. The flag -I starts an interactive session.

  3. Connect to the device:

    [00:00:00:00:00:00][LE]> connect
    Attempting to connect to 00:00:00:00:00:00
    Connection successful

If connected to successfully, the session screen will show notifications when they occur from the remote device.

  • List all primary services:

    [00:00:00:00:00:00][LE]> primary
  • List all characteristics:

    [00:00:00:00:00:00][LE]> characteristics
  • Read a characteristic:

    [00:00:00:00:00:00][LE]> char-read-hnd <CHAR VALUE HANDLE>

GUI example

Qt Bluetooth Low Energy Scanner provides GUI app to scan and browse BLE peripherals and this can be run on the D7 to view characteristics of scanned devices.