Managing a Dynamic Startup Configuration

Introduction

Managing a Dynamic Startup Configuration (DSC) corresponds to the process of adding, modifying and removing items from a DSC. For example, a device creator can add an AMC (After Market Component) to a DSC, which is required to be started at phone boot time along with other AMCs. Another example can be a device creator wishing to change the start up behavior of an AMC, so that it can start in the background.

You can use RDscStore and CDscItem to manage a DSC. CDscItem is dependant upon common startup classes CStartupProperties, TStartupMethod, TStartupType and TRestartAction.

Usage of RDscStore is straightforward. You need to create an instance of RDscStore, call OpenL() and use the functions as appropriate. Most of the functions leave with error codes, rather than returning. The error code is typically KErrNotReady, if the DSC database is not set up, or the code returned by the encapsulated database client.

Note that RDscStore is NOT derived from RSessionBase.

Procedure

Adding an item to a DSC

  1. Create the DSC item using CDscItem.

    TUid        iDscUid;
    iDscUid = TUid::Uid(KDefaultSymbianDsc);
    
    //Create the instance
    CDscItem* dscItem = CDscItem::NewL();
    CleanupStack::PushL(dscItem);
    
    dscItem->SetDscId(iDscUid);
    
    //Define the name of the AMC    
    _LIT( filename, "mypackage.exe"); 
    
    //Arguments for the AMC
    TPtrC    amaArgs;
    ...
    
    //Set the file parameters for the AMC
    dscItem->SetFileParamsL(filename, amaArgs);
    
    //Set the start-up properties for the AMC
    dscItem->SetStartupTypeL(TStartupType::EStartProcess);
    dscItem->SetStartMethodL(TStartMethod::EFireAndForget);
    dscItem->SetNoOfRetriesL(TNoOfRetries::ERetry0);
    
    ...
    
    CleanupStack::PopAndDestroy(dscItem);
  2. Add the DSC item to the DSC using RDscStore::AddItemL().

    RDscStore    dscClient;
    dscClient.OpenL();
    CleanupClosePushL(dscClient);
    
    ...
    
    dscClient.AddItemL(*dscItem);
    CleanupStack::PopAndDestroy();

Modifying an item in a DSC

  1. Make changes to the DSC item as per your requirement using the functions of CDscItem.

    CDscItem* dscItem = CDscItem::NewL();
    CleanupStack::PushL(dscItem);
    
    //Change the start-up properties for the AMC
    dscItem->SetStartupTypeL(TStartupType::EStartApp);
    dscItem->SetStartMethodL(TStartMethod::EWaitForStart);
    dscItem->SetNoOfRetriesL(TNoOfRetries::ERetry1);
    
    ...
    
    CleanupStack::PopAndDestroy(dscItem);
  2. Pass the updated DSC item to the DSC using RDscStore::UpdateItemL().

    RDscStore    dscClient;
    dscClient.OpenL();
    CleanupClosePushL(dscClient);
    
    ...
    
    dscClient.UpdateItemL(*dscItem);
    CleanupStack::PopAndDestroy();