You Are Here:

Community: Wiki

This page was last modified on 22 September 2009, at 10:17.

Working with Device Management Settings

From Forum Nokia Wiki

Reviewer Approved   


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.


Example Applications

Example source code for settings with multiple account: DM_Example_01.zip

Example source code for settings having only one account: DM_Example_02.zip

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



Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fFileE3aMicrokernelE5fArchitectureE2eGIFX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ