Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

Bluetooth Service Management Framework

Introduction

the Qt Extended Bluetooth infrastructure includes a framework for creating and managing Bluetooth services inside Qt Extended. This framework allows Bluetooth services to be handled consistently within Qt Extended. It also provides mechanisms to allow programmers to easily create and register custom Bluetooth services within the framework, and control and configure existing Bluetooth services.

To create and register a custom Bluetooth service within this framework, simply subclass QBluetoothAbstractService. The service will then be treated as any other Qt Extended system Bluetooth service, which means:

Architecture

It is not necessary to understand the architecture of the framework to create a custom Bluetooth service or access information about existing services. However, this may be useful if you need to delve into the source code.

Essentially, there are three distinct components in the framework, as shown in this diagram:

At the core is the Bluetooth Service Manager. This manager is created as a Qt Extended task by QPE at start-up and thus is always present. It takes the central role within the framework: it is contacted whenever Qt Extended Bluetooth services are started, stopped, etc. and acts upon requests by external parties to start and stop services. It communicates with other components within the framework using the Qt Extended Interprocess Communication (IPC) mechanisms.

The service manager is also responsible for storing and loading persistent service settings in the BluetoothServices.conf configuration file. A default configuration file is provided at etc/default/Trolltech/BluetoothServices.conf. This can be modified to provide default settings for services.

Each Qt Extended Bluetooth service has a two-way communication link with the Bluetooth Service Manager. A service notifies the manager when significant service events have occured, such as when the service has started or stopped. The manager notifies a service when it should perform a particular operation, such as when the service should be started or stopped.

All communication between the Bluetooth services and the service manager is handled internally within QBluetoothAbstractService. When a custom Bluetooth service is created by subclassing QBluetoothAbstractService, all IPC communication aspects will be initialised transparently, and communication with the service manager will appear to the custom class as signals and method invocations. (The IPC aspects are handled through the use of QtopiaIpcAdaptor.)

Finally, the QBluetoothServiceController class in the Bluetooth library provides service access for external parties. Interested parties can use this class to control a Bluetooth service (e.g. start or stop it) or access information about the service (e.g. its security options or state). For example, the Qt Extended Bluetooth settings application uses this class to start and stop any Qt Extended Bluetooth service and modify its security settings.

Creating a custom Bluetooth service

To create a custom Qt Extended Bluetooth service, simply subclass QBluetoothAbstractService. See Tutorial: Creating a Bluetooth service for more information.

Bluetooth can be used as a transport for the OBEX protocol. To create OBEX services over Bluetooth, subclass QObexServerSession and use a QBluetoothRfcommSocket when constructing the server session's QObexSocket. See the QObexServerSession documentation for more details on implementing an OBEX service.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3