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

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;
}
173 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved