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 void AddItemL ( CDscItem &, TDscPosition )
IMPORT_C void AddItemL ( CDscItem &)
IMPORT_C void Close ()
IMPORT_C void CreateDscL (const TUid &, const TDesC &)
IMPORT_C void CreateDscL ()
IMPORT_C void DeleteDscL (const TUid &)
IMPORT_C void DeleteItemL (const CDscItem &)
IMPORT_C TBool DscExistsL (const TUid &)
IMPORT_C TBool DscExistsL ()
IMPORT_C void EnumClose ()
IMPORT_C void EnumOpenLC (const TUid &)
IMPORT_C void EnumOpenLC ()
IMPORT_C CDscItem * EnumReadNextL ()
IMPORT_C void GetDscDescriptionL (const TUid &, TDes &)
IMPORT_C void GetMaxStringLength ( TInt &)
IMPORT_C TBool IsOpened ()
IMPORT_C TBool ItemExistsL (const CDscItem &)
IMPORT_C void OpenL ()
IMPORT_C void ReadItemL ( CDscItem &)
IMPORT_C void UpdateItemL (const CDscItem &)
Private Member Functions
RDscStore (const RDscStore &)
void CheckDbIsOpenL ()
RDscStore & operator= (const RDscStore &)
Private Attributes
CDscDatabase * iDscDatabase
TAny * iSpare

Constructor & Destructor Documentation

RDscStore()

IMPORT_C RDscStore ( )

RDscStore(const RDscStore &)

RDscStore ( const RDscStore & ) [private]

Parameters

const RDscStore &

Member Functions Documentation

AddItemL(CDscItem &, TDscPosition)

IMPORT_C void AddItemL ( CDscItem & aItem,
TDscPosition aPos
)
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 & aItem the 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 aPos the position in the DSC to add the item - either EFirst or ELast

AddItemL(CDscItem &)

IMPORT_C void AddItemL ( CDscItem & aItem )

Parameters

CDscItem & aItem

CheckDbIsOpenL()

void CheckDbIsOpenL ( ) const [private]

check the database is already open

Close()

IMPORT_C void Close ( )

Close the connection with the DSC database RDbNamedDatabase RDbView RDbs

CreateDscL(const TUid &, const TDesC &)

IMPORT_C void CreateDscL ( 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 & aDscId the Id of the DSC to be added to the database
const TDesC & aDescription the description of the DSC being added

CreateDscL()

IMPORT_C void CreateDscL ( )

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 void DeleteDscL ( 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 & aDscId the ID of the DSC to be deleted

DeleteItemL(const CDscItem &)

IMPORT_C void DeleteItemL ( 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 & aItem item to be deleted

DscExistsL(const TUid &)

IMPORT_C TBool DscExistsL ( 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 & aDscId the ID of the DSC being checked

DscExistsL()

IMPORT_C TBool DscExistsL ( ) const

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

EnumClose()

IMPORT_C void EnumClose ( )

Close an open enumeration.

capability
None
EnumOpenLC()

EnumOpenLC(const TUid &)

IMPORT_C void EnumOpenLC ( 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 & aDscId the ID of the DSC to be opened for enumeration

EnumOpenLC()

IMPORT_C void EnumOpenLC ( )

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 void GetDscDescriptionL ( 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 & aDscId the ID of the DSC being checked
TDes & aDescription the description returned from the DSC database

GetMaxStringLength(TInt &)

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

Parameters

TInt & aStringLength The result is supplied via this integer.

IsOpened()

IMPORT_C TBool IsOpened ( ) const

Check if a database connection is opened

ItemExistsL(const CDscItem &)

IMPORT_C TBool ItemExistsL ( 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 & aItem the item to be checked in the DSC database

OpenL()

IMPORT_C void OpenL ( )
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 void ReadItemL ( 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 & aItem item to be retrieved

UpdateItemL(const CDscItem &)

IMPORT_C void UpdateItemL ( 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 & aItem item 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]