Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Archived:Bluetooth Engine API for S60 3rd Edition FP2

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Code ExampleCompatibility
S60 3rd Edition FP2
Created: User:Technical writer 1 (07 Jul 2008)
Last edited: hamishwillee (30 May 2013)
ID CS001064 Creation date July 7, 2008
Platform S60 3rd Edition, FP2 Tested on devices Nokia 6210 Navigator  
Category Symbian C++ Subcategory Bluetooth

Note.pngNote: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.



The main purpose of the Bluetooth Engine is to provide a higher-level abstraction API for Bluetooth applications and services. The Bluetooth Engine API provides access to Bluetooth settings, Bluetooth device management, and Bluetooth connection settings.

The Bluetooth API for S60 3rd Edition, FP1 and older devices is available here. Note that there is a compatibility break because the Bluetooth architecture has changed starting from S60 3rd Edition, Feature Pack 2.

Header files in the package:

 #include <btengsettings.h>
#include <bt_sock.h>
#include <btdevice.h>
#include <btengconnman.h>
#include <btengconstants.h>
#include <btengdevman.h>
#include <btengdiscovery.h>
#include <btengdomaincrkeys.h>
#include <btmanclient.h>
#include <btsdp.h>

Libraries in the package:

 bluetooth.lib btdevice.lib btengdevman.lib<br>
btengdiscovery.lib btengconnman.lib btmanclient.lib<br>
btengsettings.lib sdpagent.lib sdpdatabase.lib<br>

Use cases

The API can be used to:

  • get/set the Bluetooth device local name
  • get/set the Bluetooth power state
  • get/set the Bluetooth visibility mode
  • add the device to the Bluetooth Registry
  • delete the device from the Bluetooth Registry
  • get all the devices from the Bluetooth Registry

Example code

The following code snippet can be used to retrieve the Bluetooth device local name:

 CBTEngSettings* lBtSettings = CBTEngSettings::NewL();
TBuf<32> lBTLocalName;
TInt lErrCode = lBtSettings->GetLocalName(lBTLocalName);
if ( lErrCode == KErrNone )
CEikonEnv::InfoWinL(_L("BT Name"),lBTLocalName);
TBuf<8> lErrCodeBuf;
CEikonEnv::InfoWinL(_L("GetLocalBTName Error "), lErrCodeBuf);

The following code snippet can be used to delete all Bluetooth devices from the registry:

 // Derive your class from M-Class MBTEngDevManObserver and implement
// all virtual functions
iBTEngDevMan = CBTEngDevMan::NewL(this);
// Search criteria find and delete all
TBTRegistrySearch lSearchCriteria;
TInt lErrCode = iBTEngDevMan->DeleteDevices(lSearchCriteria);
if ( lErrCode == KErrNone )
TInt lErrCodeBuf;
lErrCodeBuf.AppendNum(lErrCode );
CEikonEnv::InfoWinL(_L("DeleteBTDevices Error"), lErrCodeBuf);

Example project

The following example application needs the WriteDeviceData capability and the btengsettings.lib library. The following features have been implemented in this application:

  • get/set Bluetooth device local name
  • get/set Bluetooth power state
  • get/set Bluetoth visibility mode

The application has been tested with the Nokia 6210 Navigator.

This page was last modified on 30 May 2013, at 23:44.
68 page views in the last 30 days.