Qt 5.6 | Qt Bluetooth

Qt 5.6.2 Reference Documentation

# Qt Bluetooth

The Bluetooth API provides connectivity between Bluetooth enabled devices.

Currently, the API is supported on the following platforms: Android, iOS, Linux (BlueZ 4.x/5.x) and macOS.

## Overview

Bluetooth is a short-range (less than 100 meters) wireless technology. It has a reasonably high data transfer rate of 2.1 Mbit/s, which makes it ideal for transferring data between devices. Bluetooth connectivity is based on basic device management, such as scanning for devices, gathering information about them, and exchanging data between them.

Qt 5.5 contains the first full release of the new Qt Bluetooth Low Energy API. Further details can be found in the Bluetooth Low Energy Overview section.

## Getting Started

To use the C++ library in your application, add the following configuration option to your `.pro` file:

      QT += bluetooth

To use the classes of the module in your application you need the following import statement in your `.qml` file:

      import QtBluetooth 5.2

## Related Information

### Building Qt Bluetooth

Despite the fact that the module can be built for all Qt platforms, the module is not ported to all of them. Not supported platforms such as Windows desktop employ a fake or dummy backend which is automatically selected when the platform is not supported. The dummy backend reports appropriate error messages and values which allow the Qt Bluetooth developer to detect at runtime that the current platform is not supported. The dummy backend is also selected on Linux if BlueZ development headers are not found during build time or Qt was built without Qt D-Bus support.

The usage of the dummy backend is highlighted via an appropriate warning while building and running.

### Guides

- Classic Bluetooth Overview
- Bluetooth Low Energy Overview

### Reference

- QML Types
- C++ Classes

### Logging Categories

The QtBluetooth module exports the following logging categories:

Logging Category | Description
--- | ---
qt.bluetooth | Enables logging of cross platform code path in QtBluetooth
qt.bluetooth.android | Enables logging of the Android implementation
qt.bluetooth.bluez | Enables logging of the BLuez/Linux implementation
qt.bluetooth.ios | Enables logging of the iOS implementation
qt.bluetooth.osx | Enables logging of the macOS implementation

### Examples

- QML
  - QML Bluetooth Scanner
  - QML Bluetooth Picture Push
  - QML Bluetooth PingPong
  - QML Bluetooth Chat
  - Bluetooth Low Energy Heart Listener
  - Bluetooth Low Energy Scanner
- C++
  - Bluetooth Chat
  - Bluetooth Scanner
  - Bluetooth File Transfer