Creating a DM profile using Symbian C++
Article Metadata
Tested with
Nokia 5800 XpressMusic
Compatibility
S60 5th Edition
Article
Contents |
Overview
This article gives an overview of creating a DM profile programmatically.
Description
For configuring various settings remotely it is necessary to have a DM profile on the device. The server profile on the device helps in configuring APs, SIP/VoIP Settings, etc. remotely.
Solution
The SyncML Client API available in the SDK API Plug-in can be used for creating a DM profile. RsyncMLDevManProfile is the class for creating the DM profile. The following code snippet gives an overview of how to create a DM profile.
Headers required
#include<syncmlclient.h> #include<syncmlclientdm.h> #include<syncmldef.h>
Library to be included
LIBRARY syncmlclientapi.lib
Code Snippet for profile creation
RSyncMLDevManProfile profile;
profile.CreateL( syncMLSession );
// To set profile display name
profile.SetDisplayNameL(_L("Funambol"));
// To set User name
profile.SetUserNameL(_L8("funambol"));
// To set password
profile.SetPasswordL(_L8("funambol"));
//To set Server Id
profile.SetServerIdL(_L8("funambol"));
//To set Server password
profile.SetPasswordL(_L8("srvpwd"));
// To set Protocol Version to be used when synchronizing
TSmlProtocolVersion protocol = ESmlVersion1_1_2;
profile.SetProtocolVersionL( protocol );
// To sets the server-alerted notification user interaction.
TSmlServerAlertedAction action = ESmlConfirmSync;
profile.SetSanUserInteractionL( action );
// To save modifications
profile.UpdateL();
// close profile
profile.Close();
The settings of an existing profile (or profiles) can be accessed as follows:
RArray<TSmlProfileId> arr;
RSyncMLDevManProfile profile;
// Get the list of available profiles into an array
TRAPD(err, syncMLSession.ListProfilesL(arr, ESmlDevMan));
if (err == KErrNone)
{
TInt count = arr.Count();
TBuf<20> proCount;
proCount.AppendNum(count); //Gives available no. of DM profiles
}
TInt count;
for (int i=0;i<arr.Count();i++)
{
TRAPD(error,profile.OpenL(syncMLSession,arr[i], ESmlOpenReadWrite));
if(KErrNone != error)
{
User::Leave(error);
}
TBuf<50> displayName;
//Gives the profile name
displayName.Append(profile.DisplayName());
TBuf8<50> serverID;
//Gives the server name
serverID.Append(profile.ServerId());
//Other settings like profileId, username, password etc can also be
//obtained in a simlar fashion
// To save modifications
profile.UpdateL();
// close profile
profile.Close();
}
Required capabilities: WriteDeviceData ReadDeviceData ReadUserData WriteUserData LocalServices NetworkServices


(no comments yet)