RDscStore Class Reference

class RDscStore

Represents a DSC client interface to manipulate the DSC(Dynamic Start-up Configuration) database. A thread uses this class to set up a connection with the DSC database.

Is used to store DSC items that contain the information needed to launch After Market Application (AMA).

Multiple DSCs can be stored in the DSC database identified by different DSC IDs. A default DSC Uid, KDefaultSymbianDsc, is provided.

All items within a DSC are unique. A duplicate item is defined as having the same filename and arguments as another already in that particular DSC.

Uses transaction mechanism provided by the data source to ensure that DSC items will be added in a consistent manner to maintain data integrity.

Requires PlatSec capabilities to add, delete DSC, and to read, add, update, or remove the items in a DSC.

Public Member Functions
RDscStore()
IMPORT_C voidAddItemL(CDscItem &, TDscPosition)
IMPORT_C voidAddItemL(CDscItem &)
IMPORT_C voidClose()
IMPORT_C voidCreateDscL(const TUid &, const TDesC &)
IMPORT_C voidCreateDscL()
IMPORT_C voidDeleteDscL(const TUid &)
IMPORT_C voidDeleteItemL(const CDscItem &)
IMPORT_C TBoolDscExistsL(const TUid &)
IMPORT_C TBoolDscExistsL()
IMPORT_C voidEnumClose()
IMPORT_C voidEnumOpenLC(const TUid &)
IMPORT_C voidEnumOpenLC()
IMPORT_C CDscItem *EnumReadNextL()
IMPORT_C voidGetDscDescriptionL(const TUid &, TDes &)
IMPORT_C voidGetMaxStringLength(TInt &)
IMPORT_C TBoolIsOpened()
IMPORT_C TBoolItemExistsL(const CDscItem &)
IMPORT_C voidOpenL()
IMPORT_C voidReadItemL(CDscItem &)
IMPORT_C voidUpdateItemL(const CDscItem &)
Private Member Functions
RDscStore(const RDscStore &)
voidCheckDbIsOpenL()
RDscStore &operator=(const RDscStore &)
Private Attributes
CDscDatabase *iDscDatabase
TAny *iSpare

Constructor & Destructor Documentation

RDscStore()

IMPORT_CRDscStore()

RDscStore(const RDscStore &)

RDscStore(const RDscStore &)[private]

Parameters

const RDscStore &

Member Functions Documentation

AddItemL(CDscItem &, TDscPosition)

IMPORT_C voidAddItemL(CDscItem &aItem,
TDscPositionaPos
)
Add an item to a DSC list.
leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
leave
KErrNotFound - the DSC does not exist
leave
KErrArgument - aItem is invalid
leave
KErrAlreadyExists - an item with the same fileName and args already exists in the DSC
capability
ReadDeviceData and WriteDeviceData
RDbNamedDatabase

Parameters

CDscItem & aItemthe item to be added to the database. At least DscId and Filename has to be set before calling this function. ItemId will be assigned by the database.
TDscPosition aPosthe position in the DSC to add the item - either EFirst or ELast

AddItemL(CDscItem &)

IMPORT_C voidAddItemL(CDscItem &aItem)

Append an item to the end of a DSC RDscStore::AddItemL(CDscItem& aItem,TDscPosition aPos)

Parameters

CDscItem & aItem

CheckDbIsOpenL()

voidCheckDbIsOpenL()const [private]

check the database is already open

Close()

IMPORT_C voidClose()

Close the connection with the DSC database RDbNamedDatabase RDbView RDbs

CreateDscL(const TUid &, const TDesC &)

IMPORT_C voidCreateDscL(const TUid &aDscId,
const TDesC &aDescription
)
Create a new DSC in the DSC database
leave
KErrArgument - invalid parameter passed
leave
KErrAlreadyExists - the DSC already exists
leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
capability
WriteDeviceData
RDbNamedDatabase

Parameters

const TUid & aDscIdthe Id of the DSC to be added to the database
const TDesC & aDescriptionthe description of the DSC being added

CreateDscL()

IMPORT_C voidCreateDscL()

Create a new DSC in the DSC database using the default DSC Id KDefaultSymbianDsc RDscStore::CreateDscL(const TUid& aDscId, const TDesC& aDescription)

DeleteDscL(const TUid &)

IMPORT_C voidDeleteDscL(const TUid &aDscId)
Delete a DSC and all associated DSC items from the DSC database
leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
leave
KErrNotFound - the DSC does not exist in the database
capability
ReadDeviceData and WriteDeviceData
RDbNamedDatabase

Parameters

const TUid & aDscIdthe ID of the DSC to be deleted

DeleteItemL(const CDscItem &)

IMPORT_C voidDeleteItemL(const CDscItem &aItem)

Delete a DSC item matching specified DscId and ItemId, or specified DscId and Filename and ArgList. If ItemId is not set, will check existance using DscId and Filename+ArgList. No wildcards can be used in Filename or ArgList, only exact matching.

leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
leave
KErrNotFound - DSC or item does not exist
capability
ReadDeviceData and WriteDeviceData
RDbNamedDatabase

Parameters

const CDscItem & aItemitem to be deleted

DscExistsL(const TUid &)

IMPORT_C TBoolDscExistsL(const TUid &aDscId)const
Check the existance of a DSC in the DSC database
leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
capability
ReadDeviceData
RDbNamedDatabase

Parameters

const TUid & aDscIdthe ID of the DSC being checked

DscExistsL()

IMPORT_C TBoolDscExistsL()const

Check the existance of DSC in the DSC database using the default dscId KDefaultSymbianDsc RDscStore::DscExistsL(const TUid& aDscId)

EnumClose()

IMPORT_C voidEnumClose()

Close an open enumeration.

capability
None
EnumOpenLC()

EnumOpenLC(const TUid &)

IMPORT_C voidEnumOpenLC(const TUid &aDscId)

Open a DSC for enumeration. This function must be called before the items in the table can be enumerated using EnumReadNextL(). Only one DSC can be opened for enumeration at a time.

This function will create a read-lock on the database and push it onto the CleanupStack. Call CleanupStack::PopAndDestroy() to close the enumaration and release the database lock. No updates to the database is possible until the read-lock is released.

Usage example:
	RDscStore client;
	client.OpenL();
	CleanupClosePushL(client);
	client.EnumOpenLC();
	while(CDscItem* item = client.EnumReadNextL())
		{
		//Do something...
	 	delete item;
	 	item = NULL;
	 	}
	CleanupStack::PopAndDestroy(); //client.EnumClose()
	CleanupStack::PopAndDestroy(); //client.Close()
leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is already opened for enumeration or is locked by other client
leave
KErrNotFound - the DSC does not exist in the DSC database
capability
ReadDeviceData
RDbNamedDatabase

Parameters

const TUid & aDscIdthe ID of the DSC to be opened for enumeration

EnumOpenLC()

IMPORT_C voidEnumOpenLC()

Open the default DSC for enumeration using default dscId KDefaultSymbianDsc RDscStore::EnumOpenLC(const TUid& aDscId)

EnumReadNextL()

IMPORT_C CDscItem *EnumReadNextL()

Read the next item in the DSC opened for enumeration. An enumeration must have been opened by a call to EnumOpenLC(). The caller takes ownership of the returned object.

leave
one of the system-wide error codes, including: KErrNotReady - the RDscStore is not connected to the DSC database or EnumOpenL() has not been called
capability
ReadDeviceData
RDbNamedDatabase

GetDscDescriptionL(const TUid &, TDes &)

IMPORT_C voidGetDscDescriptionL(const TUid &aDscId,
TDes &aDescription
)const
Accessor function returning the description of aDscId
leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
leave
KErrNotFound - DSC or item does not exist
leave
KErrOverflow - if the length of aDescription is too short. Call MaxStringLength( TInt& aStringLength ) to interrogate the server for the maximum permissible length.
capability
ReadDeviceData
RDbNamedDatabase

Parameters

const TUid & aDscIdthe ID of the DSC being checked
TDes & aDescriptionthe description returned from the DSC database

GetMaxStringLength(TInt &)

IMPORT_C voidGetMaxStringLength(TInt &aStringLength)const
Interrogate the DscDatabase to discover the maximum supported length of a string.
capability
None

Parameters

TInt & aStringLengthThe result is supplied via this integer.

IsOpened()

IMPORT_C TBoolIsOpened()const

Check if a database connection is opened

ItemExistsL(const CDscItem &)

IMPORT_C TBoolItemExistsL(const CDscItem &aItem)const

Check the existance of a DSC item in a DSC list. Uses DscId and ItemId within aItem to determine the item. If ItemId is not set, will check existance using DscId and Filename+Arguments. No wildcards can be used in filename or arguments, only exact matching.

leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
capability
ReadDeviceData
RDbNamedDatabase

Parameters

const CDscItem & aItemthe item to be checked in the DSC database

OpenL()

IMPORT_C voidOpenL()
Opens a connection with the DSC database. This function will create a secure DSC database including DSC and DscItem tables if any do not already exist. If the connection is already open this method will return without error. This should be the first function called on a RDscStore object after it is created. The connection is terminated by calling the Close() member function
leave
With one of the system-wide error codes
capability
ReadDeviceData and WriteDeviceData
RDbNamedDatabase

ReadItemL(CDscItem &)

IMPORT_C voidReadItemL(CDscItem &aItem)

Read an item from the DSC. Uses DscId and ItemId within aItem to determine the item. If ItemId is not set, will check existance using DscId and Filename+Arguments. No wildcards can be used in filename or arguments, only exact matching.

leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
leave
KErrNotFound - DSC or item does not exist
capability
ReadDeviceData
RDbNamedDatabase

Parameters

CDscItem & aItemitem to be retrieved

UpdateItemL(const CDscItem &)

IMPORT_C voidUpdateItemL(const CDscItem &aItem)

Update an item in the DSC. Uses DscId and ItemId within aItem to determine the item. If ItemId is not set, will check existance using DscId and Filename+Arguments. No wildcards can be used in filename or arguments, only exact matching.

ItemId, Filename, ArgList and DscId cannot be updated.

leave
KErrNotReady - the RDscStore is not connected to the DSC database
leave
KErrPermissionDenied - the caller does not have enough rights to do the operation
leave
KErrLocked - the database is opened for enumeration or is locked by other client
leave
KErrNotFound - DSC or item does not exist
leave
KErrArgument - aItem contains invalid settings
capability
ReadDeviceData and WriteDeviceData
RDbNamedDatabase

Parameters

const CDscItem & aItemitem to be updated

operator=(const RDscStore &)

RDscStore &operator=(const RDscStore &)[private]

Parameters

const RDscStore &

Member Data Documentation

CDscDatabase * iDscDatabase

CDscDatabase *iDscDatabase[private]

TAny * iSpare

TAny *iSpare[private]