×
Namespaces

Variants
Actions

Turn Bluetooth On

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: neois (03 May 2007)
Last edited: hamishwillee (30 May 2013)

Useful code, let's try it. I have already try this code in Symbian 1st and 2nd Edition but not Symbian 3rd Edition.

#include <e32std.h>
 
#define KPowerModeSettingNotifierUid 0x100059E2
 
void TurnBluetoothOnL() {
TPckgBuf<TBool> pckg;
RNotifier iNotifier;
TPckgBuf<TBool> iNotifierResult;
TRequestStatus status;
 
User::LeaveIfError(iNotifier.Connect());
iNotifier.StartNotifierAndGetResponse(status, KPowerModeSettingNotifierUid, pckg, iNotifierResult);
User::WaitForRequest(status);
User::LeaveIfError(status.Int());
 
iNotifier.CancelNotifier(KPowerModeSettingNotifierUid);
iNotifier.Close();
User::LeaveIfError(iNotifierResult[0]);
}
 
void MainMethod() {
TRAPD(err, TurnBluetoothOnL());
if (err != KErrNone)
{
// Handle Error Here
}
// Bluetooth is already on
}
This page was last modified on 30 May 2013, at 07:36.
42 page views in the last 30 days.