Setting the profile tones in active profile using Profile Engine Wrapper API
Article Metadata
Tested with
Devices(s): Tested on Nokia N95,
Nokia N96,
Nokia 5800 XpressMusic
Nokia N96,
Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 5th Edition
S60 3rd Edition, FP2
S60 5th Edition
Article
Keywords: MProEngEngine
Created: User:Nokia Developer KB
(27 Jan 2009)
Last edited: hamishwillee
(01 Aug 2012)
Contents |
Overview
The Profiles Engine Wrapper API allows applications to control profile-specific data.
Description
The Profiles Engine Wrapper API provides information such as different alert tones, vibrating alert, and warning tones of existing profiles in the device. Furthermore, it can be used to manipulate the settings of the profiles.
This code snippet shows how to get and set ringing type, keypad volume, ringing volume, vibrating alert, warning and game tones in the active profile using these APIs.
Header files
#include <MProEngEngine.h>
#include <ProEngFactory.h>
#include <MProEngProfile.h>
#include <MProEngToneSettings.h>
Library Files
LIBRARY ProfileEngine.lib
Capability
WriteDeviceData
Code Snippet
// Create an engine instance:
MProEngEngine* engine = ProEngFactory::NewEngineLC();
// Get the settings of the active profile:
MProEngProfile* activeProfile = engine->ActiveProfileLC();
MProEngToneSettings& ts = activeProfile->ToneSettings();
//Gets the state of vibrating alert setting
TBool ringingType( ts.VibratingAlert() );
if(ringingType)
{
CEikonEnv::Static()->InfoWinL(_L(""),_L("On"));
}
else
{
CEikonEnv::Static()->InfoWinL(_L(""),_L("Off"));
}
// Sets the state of vibrating alert setting as ON
TInt err = ts.SetVibratingAlert( ETrue);
TBuf<20> ebuf;
ebuf.Num(err);
if(err)
{
CEikonEnv::Static()->InfoWinL(_L(""),ebuf);
}
else
{
CEikonEnv::Static()->InfoWinL(_L(""),_L("Set");
}
// Gets the ringing type
TProfileRingingType rType = ts.RingingType();
// Sets the ringing type to silent
ts.SetRingingType(EProfileRingingTypeSilent);
// Gets the keypad volume
TProfileKeypadVolume keyVolume = ts.KeypadVolume();
// Sets the keypad volume
ts.SetKeypadVolume(EProfileKeypadVolumeLevel2);
// Gets the ringing volume
TProfileRingingVolume ringVol = ts.RingingVolume();
// Sets the ringing volume
ts.SetRingingVolume(EProfileRingingVolumeLevel5);
// Gets the state of warning and game tones setting
TBool warnTone = ts.WarningAndGameTones();
// Sets the state of warning and game tones setting as ON
ts.SetWarningAndGameTones(ETrue);
// Commit the change in Profiles data
activeProfile->CommitChangeL();
// Release the resources used:
CleanupStack::PopAndDestroy(2); // activeProfile, engine

