Namespaces

Variants
Actions

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 over the next few weeks. Thanks for all your past and future contributions.

Working with Device Management Settings

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: symbianyucca (09 Jan 2008)
Last edited: hamishwillee (06 Feb 2012)


Contents

FINDING SETTINGS ACCOUNTS

Each DDF for different Device Management objects are different, thus each of them work a bit differently. In general you could divide them into two different categories:

1. Settings that have multiple instances
2. Settings that have just one instances

Settings with Multiple instances usually have nodes marked as “<X> *” in the graphical presentation of the DDF tree. “<X> *” means that there are zero-to-many objects and they are runtime instances. To get the names for all of the instances available, you need to call ChildURIListL() with the URL pointing to the <X>.

void ChildURIListL(const TDesC8& aUrl)
{
iErrorCode = MSmlDmAdapter::EOk;
 
CArrayFixSeg<TSmlDmMappingInfo>* lst = new CArrayFixSeg<TSmlDmMappingInfo>(1);
CleanupStack::PushL(lst);
TInt resultsRef(0), statusRef(0);
 
if(aUrl.Length())
iSmlDmAdapter->ChildURIListL(aUrl, KNullDesC8, *lst, resultsRef, statusRef);
else
iSmlDmAdapter->ChildURIListL(iName, KNullDesC8, *lst, resultsRef, statusRef);
 
CleanupStack::PopAndDestroy( lst );
}


For example with Email, VoIP & SIP to get all settings accounts, you would call the ChildURIListL() with URL set to the root name, and the setting account names and their Local UID (LUid) values would be returned via the SetMappingL() function.

With the settings that only have one instance, there is no need to call ChildURIListL() for the different settings account, simply because there is only one account, and the whole settings tree is static.

Note that some documentations could be a bit misleading, for example the OMA device management DDF for Nokia Remote customization, shows that the Customization plug-in has multiple settings implemented in one plug-in (such as Themes, startup etc.), but in practice they are all implemented in separate plug-ins, thus check the plug-ins with the example application.

READING SETTING ITEMS VALUES


To read individual settings items, you can use FetchLeafObjectL() function. The Url should be set to the individual leaf name with full path (that includes the root name as well) and the LUid (if available) should be set to the LUid value given with the Url in the SetMappingL() function. Also the LUid value could be fetched by calling GetLuidAllocL() function n of the plug-in and supplying the URL with the full identifier pointing to the <X> Node. In case the LUid is not available you can use KNullDesC8 as a LUid.

Note that you should define right Mime type for the identifier value, when fetching it. The results will be returned via the SetResultsL() function.

CREATING NEW SETTING ACCOUNTS

you just need to call AddNodeObjectL() with Url set to the full name of the new Settings account (including the root), with accounts you usually set the LUid to KNullDesC8, since new account can not have LUid set until it has been made.

The LUid is returned via the SetMappingL() function , right after the account is created. Note that when creating new settings accounts, some accounts (for example VoIP) will also return mappings to all internal Nodes, thus you will get the SetMappingL() function called multiple times when making these kind of settings accounts.

Also not that some accounts will require some settings items to be set before the actual account can be made. One example of these kinds of settings accounts is email, which requires you to define the account Type before any settings accounts can be created, thus creating a email account would look something like this:

void AddEmailAccountL(const TDesC8& aName)
{
iSmlDmAdapter->StartAtomicL();
iSmlDmAdapter->AddNodeObjectL(_L8("Email/POP12345"),KNullDesC8,0);
iSmlDmAdapter->UpdateLeafObjectL(_L8("Email/POP12345/Mpro"),KNullDesC8,_L8("POP"),_L8("text/plain"),0);
 
iErrorCode = MSmlDmAdapter::EOk;
iSmlDmAdapter->CompleteOutstandingCmdsL();
 
if(iErrorCode == MSmlDmAdapter::EOk)
{
iSmlDmAdapter->CommitAtomicL();
 
HBufC8* tmpLuid= GetLuidAllocL(_L8("Email/POP12345"));
CleanupStack::PushL(tmpLuid);
 
iSmlDmAdapter->StartAtomicL();
iErrorCode = MSmlDmAdapter::EOk;
 
iSmlDmAdapter->UpdateLeafObjectL(_L8("Email/POP12345/Name"),*tmpLuid,aName,_L8("text/plain"),0);
 
iSmlDmAdapter->CompleteOutstandingCmdsL();
 
if(iErrorCode == MSmlDmAdapter::EOk)
iSmlDmAdapter->CommitAtomicL();
else
iSmlDmAdapter->RollbackAtomicL();
 
CleanupStack::PopAndDestroy(tmpLuid);
}
else
{
iSmlDmAdapter->RollbackAtomicL();
}
}

DELETING SETTINGS ACCOUNTS

For deleting nodes or accounts you just need to call DeleteObjectL() with right Url and LUid values.

That functionality is not supported on MfE DM adapters.


Example Applications

Example source code for settings with multiple account: File:DM Example 01.zip

Example source code for settings having only one account: File:DM Example 02.zip

Example used for reading the UID values for the plug-ins: File:DM GetPlugIns.zip (The Uid value is needed to be added into the source codes of DM_Examples)



This page was last modified on 6 February 2012, at 05:07.
89 page views in the last 30 days.

Was this page helpful?

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

 

Thank you!

We appreciate your feedback.

×