×
Namespaces

Variants
Actions
Revision as of 08:52, 19 July 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A simple way of discovering and selecting a single Bluetooth device

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: giridharn (28 May 2007)
Last edited: hamishwillee (19 Jul 2012)

An easy way of discovering and selecting a single Bluetooth device from a GUI component, is that of reusing a Notifier.

Following, is an example of how to achieve this simply, using synchronous operations. In your application you should probably make use of this technique using active objects.

The example below initiates a discovery for devices that support the Serial Port Profile.

void GetDeviceAddressL()
{
RNotifier btNotifier;
User::LeaveIfError(btNotifier.Connect());
 
TBTDeviceSelectionParamsPckg selectionFilter;
TBTDeviceResponseParamsPckg selectionResponse;
 
selectionFilter().SetUUID(KSerialPortUUID);
 
TRequestStatus status;
btNotifier.StartNotifierAndGetResponse( status, KDeviceSelectionNotifierUid,
selectionFilter, selectionResponse);
User::WaitForRequest(status);
 
btNotifier.Close();
 
User::LeaveIfError(status.Int());
 
// use the response data ....
TBTDeviceName dname = selectionResponse().DeviceName();
TBTDeviceClass dclass = selectionResponse().DeviceClass();
// ... etc...
 
return;
}
This page was last modified on 19 July 2012, at 08:52.
71 page views in the last 30 days.
×