×
Namespaces

Variants
Actions

Retrieving remote Bluetooth device information using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): All (S60)
CompatibilityArticle
Keywords: TBTDeviceClass
Created: User:Technical writer 1 (27 Nov 2008)
Last edited: hamishwillee (30 May 2013)

Contents

Overview

Applications can retrieve certain Bluetooth-specific information about remote Bluetooth devices. This information can be used, for example, to filter out certain devices or device classes to optimise the otherwise time-consuming service search.

Description

When Bluetooth is switched on, the device promotes its Class of Device/Service characteristics that another device can retrieve in the device discovery procedure. These characteristics indicate the major and minor device class (for example, phone and smartphone, respectively), and general service classes (for example, networking, object transfer, and audio). Note that this is a high-level categorisation of public services and there is also a concept of Bluetooth profiles and services that should be used by applications to ensure compatibility (for more information on how to discover services, see Archived:Discovering Bluetooth services using Symbian C++.

Solution

In the device discovery, a Socket address class TInquirySockAddr of each remote device is retrieved and TBTDeviceClass (defined in btdevice.h) can be constructed from it. TBTDeviceClass holds information on MajorServiceClass, MajorDeviceClass, and MinorDeviceClass. They can be retrieved as follows:


   // Issue request
iHostResolver.GetByAddress( iInquirySockAddr, iEntry, iStatus );
SetActive();<br>
//Receive result in RunL()
if( iStatus == KErrNone)
{
TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr );
TBTDeviceClass tmpDeviceClass( sa.MajorServiceClass(),
sa.MajorClassOfDevice(), sa.MinorClassOfDevice());
}

Note that there are no direct Bluetooth APIs to retrieve any other device-specific information such as IMEI or phone number. You always need a counter application running on the remote device to query such information of the device.

Additional information

General information on Class of Device/Service is provided in the Bluetooth specification available for registered Bluetooth SIG members at www.bluetooth.org.

This page was last modified on 30 May 2013, at 07:35.
103 page views in the last 30 days.
×