×
Namespaces

Variants
Actions

Profiles Engine API

From Nokia Developer 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}}.

The article is believed to be still valid for the original topic scope.


Article Metadata
Code ExampleCompatibility
Platform(s):
FNWiki
Article
Created: ltomuta (17 Jun 2007)
Last edited: lpvalente (12 Jul 2014)

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

ProfileEngine API's are mainly used to get the list of available profiles on the mobile, get the information about the active profile, to get information of the profile change, set a profile and related information about it.

Header files

#include <mprofileengine.h>
#include <mprofilesnamesarray.h>
#include <mprofile.h>
#include <mprofilename.h>
#include <mprofiletones.h>

Link against

profileeng.lib

Capabilities required for activating new profile: WriteDeviceData

Use cases

These API's are used to show the Profiles. Also used to retrieve information of the currently Active Profile,its Id, Ringtone, MessageAlertTone. They can also be used to set a particular Profile active.

Example code

Before using the API's first we create an instance of MProfileEngine using "CreateProfileEngineL()" API


MProfileEngine* lProfileEngine = CreateProfileEngineL();


Free the resources using "Release()" API


lProfileEngine->Release();


or alternatively first Push it onto CleanupStack and then PopAndDestroy()


CleanupReleasePushL( *lProfileEngine );
....
CleanupStack::PopAndDestroy();


The following code snippet is used to get the available profiles on the phone.


MProfilesNamesArray* profilesNamesArray = 
lProfileEngine->ProfilesNamesArrayLC();
TInt lCount = profilesNamesArray->MdcaCount();
 
for(TInt i=0;i<lCount;i++)
{
TBuf<20> lName;
lName= profilesNamesArray->ProfileName(i)->Name();
CEikonEnv::Static()->AlertWin(_L("Available Profiles:"),lName);
lName.Zero();
}
 
CleanupStack::PopAndDestroy(profilesNamesArray);


The following code snippet is used to list the details of the Active profile and its properties like Profile Name, Id, etc.,


MProfile* lProfile =  lProfileEngine->ActiveProfileL();
CleanupReleasePushL( *lProfile );
 
const MProfileName& lMProfileName = lProfile->ProfileName();
TBuf<10> lProfileName = lMProfileName.Name();
CEikonEnv::Static()->AlertWin(_L("Profile Name:"),lProfileName);
 
TInt lId = lMProfileName.Id();
TBuf<10> lProfileId;
lProfileId.AppendNum(lId);
CEikonEnv::Static()->AlertWin(_L("its Profile Id:"),lProfileId);
 
const MProfileTones& lMProfileTones = lProfile->ProfileTones();
TBuf<255> lProfileTone1 = lMProfileTones.RingingTone1();
CEikonEnv::Static()->AlertWin(_L("Profile Ringtone1:"), lProfileTone1);
 
TBuf<255> lProfileMsgalrt = lMProfileTones.MessageAlertTone();
CEikonEnv::Static()->AlertWin(_L("ProfileMsgAlrtToneName:"),lProfileMsgalrt);
 
CleanupStack::PopAndDestroy();


The following code snippet is used to set the Profile:

We pass the Id of the Profile Name to set the Profile active.

lProfileEngine->SetActiveProfileL(0);


The following link is useful in getting notifications of profile change:Profile Change


Example project

File:ProfileEngine SampleCode.zip

  
 

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×