Veethree D7 SDK
Loading...
Searching...
No Matches
Bluetooth Basics

< Bluetooth

Official Linux Bluetooth protocol stack- BlueZ supports Bluetooth communication on the D7. BlueZ includes tools like bluetoothctl, btmgmt, hciconfig, btmon, sdptool, rfcomm, obexctl, etc.

Note: This document provides basic usage commands. Although Arch Linux is not used on the D7, ArchWiki Bluetooth provides more details on BlueZ usage and troubleshooting.

Basic commands

To get started with using Bluetooth on the D7, run the following commands on the shell.

Starting Bluetooth and device identification

To check if BlueZ daemon (bluetoothd) is running:

$ systemctl status bluetooth

If Bluetooth daemon is not running, start service:

$ systemctl start bluetooth

To get Bluetooth adapter status and configuration information:

$ hciconfig

If the device status is DOWN, Bluetooth adapter is powered off, to power on:

$ hciconfig hci0 up

Or using bluetoothctl:

$ bluetoothctl
[bluetooth]# power on
[bluetooth]# quit

If powered on, the command hciconfig should show UP RUNNING and BD Address should not be empty.

To get more information like device name, profile UUIDs, public MAC etc:

$ bluetoothctl show

Scanning and pairing

bluetoothctl interactive command line tool is used to scan and pair Bluetooth devices. To pair with a remote device, start the interactive tool:

$ bluetoothctl

Before pairing, register an agent to handle PIN codes, passkey confirmations, or authorization prompts when pairing:

[bluetooth]# agent on

To initiate a pairing request to another device, the remote device's public MAC address should be on D7's scan/cache list. To scan for devices:

[bluetooth]# scan on

To get a list of devices scanned:

[bluetooth]# devices

From this list, select the remote device MAC address you want to pair with as:

[bluetooth]# pair <MAC>

If the device requires authorization, registered agent will handle it.

To stop scanning:

[bluetooth]# scan off

To allow a remote device to initiate pairing, register the agent and make the D7 discoverable:

[bluetooth]# discoverable on

To remove a paired device:

[bluetooth]# remove <MAC>

Note: QML Bluetooth application included in ~/d7-sdk/examples/gui/qml-bluetooth/ provides an equivalent GUI app to enable bluetooth, scan/pair and make device discoverable.