Home · All Classes · Annotated · Functions

Bluetooth Support

Introduction

Qtopia supports the BlueZ Bluetooth framework (Version 2.19 and later). It consists of several daemons and tools that allow the system to manipulate local Bluetooth devices and discover remote devices and services.

BlueZ libraries and daemons must be installed and running prior to Qtopia startup as Qtopia relies on information provided by the daemons to detect local host adapters and services.

BlueZ consists of three main daemons as follows:

DaemonDesciption
hcid
  • maintains the local Bluetooth host adapter
  • initiates remote device discovery
  • handles all aspects of the Bluetooth security and authentication mechanisms.
sdpd
  • maintains a database of services supported by the local host
  • communicates with sdp services on remote Bluetooth hosts in order to discover services presence.
rfcommd
  • binds RFCOMM Bluetooth connections to a local serial port.

Note: This daemon is not currently used by Qtopia.

Each Bluetooth device or local Bluetooth host adapter has an associated Bluetooth address that is stored as a six byte array and is commonly represented as six hexadecimal bytes separated by colons. For example: FF:FF:FF:FF:FF:FF.

BlueZ and Qtopia support multiple local Bluetooth host adapters, however the most common case is to use a single adapter.

Integration

Qtopia Bluetooth currently supports GAP, SDAP and OPP profiles with GAP and SDAP relying heavily on the hcid and sdpd BlueZ daemons.

A communication layer exists between Qtopia and the BlueZ subsystems to receive notification of events, such as a PIN number request. Qtopia also communicates with the BlueZ subsystem by calling the tools hcitool and hciconfig. Qtopia compiles its own custom version of these tools and they must be run as root (to run as root utilize setuid binaries). The configuration file hcid.conf must enable authentication and encryption by setting the auth and encrypt variables as follows:

    auth enable;
    encrypt enable;

Additionally, Qtopia needs to be notified whenever the hcid daemon requests user input for a PIN. The pin_helper setting in hcid.conf can be used for this as follows:

    # QPEDIR should be replaced with your Qtopia installation directory
    pin_helper $QPEDIR/image/opt/Qtopia/bin/btpinhelper;

In the above example, the btpinhelper script run by the hcid daemon communicates with Qtopia requesting the user PIN input which is then passed back to the hcid daemon.

Functionality

Device Configuration

The local host adapter can be controlled through the QBluetoothLocalDevice class where the adapter can be switched on/off and device visibility can be controlled. Visibility is controlled by two variables:

  1. page scan - controls whether remote devices can connect to the local device.
  2. inquiry scan - controls whether remote devices can discover the local device.

This indicates that the discoverable state is controlled by setting the inquiry scan appropriately.

GAP

Qtopia fully supports Bluetooth GAP which handles the discovery and establishment of connections between Bluetooth devices. GAP defines how secure connections are established between two devices by a mechanism referred to as pairing and also defines the basic user interface paradigm that must be used by all Bluetooth devices.

Qtopia Bluetooth API allows its clients to discover remote devices and various relevant attributes, such as device name, device manufacturer, Bluetooth protocol version supported, etc. Additionally, establishment of trust relationships by pairing remote devices is also supported.

The functionality used to implement this profile is accessible through the QBluetoothLocalDevice class.

SDAP

SDAP describes how an application should use the Service Discovery Protocol (SDP) to discover services on a remote device. Using the Qtopia Bluetooth API, clients can enable any application to discover services running on a remote device.

Two discovery modes are supported:

  1. searching - searching for a specific service or services
  2. browsing - searching for any services accessible from the public browse group.

Object Push Profile (OPP)

Qtopia supports only the Object Push feature of OPP in both client and server modes and uses the OpenOBEX library to implement this service. The user can send and receive files over Bluetooth. If a file is received, the user can monitor the progress of the file transfer, and choose to accept or discard the file received. If a business card is received, the user has the option of saving it in his or her address book or discarding.

See also QSDPService, QSDAP, and QSDP.


Copyright © 2006 Trolltech Trademarks
Qtopia 4.1.7