Retrieving remote Bluetooth device information using Symbian C++
Article Metadata
Tested with
Compatibility
Article
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.


(no comments yet)