CStartupProperties Class Reference

class CStartupProperties : public CBase

A parameter class containing application/process starter information that is shared among client applications, system components and client/server processes. This class is used to pass multiple different types of data to API's in only one parameter while ensuring proper data initialization, memory allocation and serializing over IPC when required.

When an instance of this class is created it contains default values for all properties. The usage of this class for different scenarios only requires calling setter functions to overrride parameters which has non-default values.

Instead of this use CSsmStartupProperties

Inherits from

Nested Classes and Structures

Public Member Functions
~CStartupProperties ()
IMPORT_C TActionOnCommandFailure ActionOnCommandFailure ()
IMPORT_C TPtrC Args ()
IMPORT_C void ExternalizeL ( CBufBase &)
IMPORT_C TPtrC FileName ()
IMPORT_C void InternalizeL (const TPtrC8 &)
IMPORT_C TBool Monitored ()
IMPORT_C CStartupProperties * NewL ()
IMPORT_C CStartupProperties * NewL (const TDesC &, const TDesC &)
IMPORT_C CStartupProperties * NewL ( TResourceReader &)
IMPORT_C CStartupProperties * NewLC ()
IMPORT_C CStartupProperties * NewLC (const TDesC &, const TDesC &)
IMPORT_C CStartupProperties * NewLC ( TResourceReader &)
IMPORT_C TInt NoOfRetries ()
IMPORT_C TRecoveryMethod RecoveryMethod ()
IMPORT_C void Reset ()
IMPORT_C TInt RestartMode ()
IMPORT_C void SetActionOnCommandFailure ( TActionOnCommandFailure )
IMPORT_C void SetFileParamsL (const TDesC &, const TDesC &)
IMPORT_C void SetMonitored ( TBool )
IMPORT_C void SetNoOfRetries ( TInt )
IMPORT_C void SetRecoveryParams ( TRecoveryMethod , TInt )
IMPORT_C void SetStartInBackground ( TBool )
IMPORT_C void SetStartMethod ( TStartMethod )
IMPORT_C void SetStartupType ( TStartupType )
IMPORT_C void SetTimeout ( TInt )
IMPORT_C void SetViewless ( TBool )
IMPORT_C TInt Size ()
IMPORT_C TBool StartInBackground ()
IMPORT_C TStartMethod StartMethod ()
IMPORT_C TStartupType StartupType ()
IMPORT_C TInt Timeout ()
IMPORT_C TInt Version ()
IMPORT_C TBool Viewless ()
Private Member Functions
CStartupProperties ()
void ConstructFromResourceL ( TResourceReader &)
void ConstructL ()
void DoSanityCheck ( TStartupCommandType )
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
HBufC * iArgs
HBufC * iFileName
TBool iMonitored
TInt iNoOfRetries
TRecoveryPolicy iRecoveryMethod
TInt iRestartMode
TBool iStartInBackground
TStartMethod iStartMethod
TStartupType iStartupType
TInt iTimeout
TInt iVersion
TBool iViewless

Constructor & Destructor Documentation

CStartupProperties()

CStartupProperties ( ) [private]

~CStartupProperties()

IMPORT_C ~CStartupProperties ( )

Destructor for CStartupProperties class

Member Functions Documentation

ActionOnCommandFailure()

IMPORT_C TActionOnCommandFailure ActionOnCommandFailure ( ) const

Accessor function returning the legacy fail_on_error property used by the old resource structs START_APP_INFO and START_PROCESS_INFO.

Args()

IMPORT_C TPtrC Args ( ) const

Accessor function returning arguments property

ConstructFromResourceL(TResourceReader &)

void ConstructFromResourceL ( TResourceReader & aSource ) [private]

Parameters

TResourceReader & aSource

ConstructL()

void ConstructL ( ) [private]

DoSanityCheck(TStartupCommandType)

void DoSanityCheck ( TStartupCommandType aCommandType ) const [private]

Parameters

TStartupCommandType aCommandType

ExternalizeL(CBufBase &)

IMPORT_C void ExternalizeL ( CBufBase & aBufPtr ) const

Externalize the class into a buffer. This function has to be updated every time a member has been added to the class to maintain binary compatibility.

Parameters

CBufBase & aBufPtr A buffer of sufficient size to contain the externalized class data on function return

FileName()

IMPORT_C TPtrC FileName ( ) const

Accessor function returning filename property

InternalizeL(const TPtrC8 &)

IMPORT_C void InternalizeL ( const TPtrC8 & aBufPtr )

Internalize the class from a buffer. This function has to be updated every time a member has been added to the class to maintain binary compatibility.

Parameters

const TPtrC8 & aBufPtr A buffer containing the externalized class data

Monitored()

IMPORT_C TBool Monitored ( ) const

Accessor function returning monitored property

NewL()

IMPORT_C CStartupProperties * NewL ( ) [static]

Used to create an instance of CStartupProperties class.

NewL(const TDesC &, const TDesC &)

IMPORT_C CStartupProperties * NewL ( const TDesC & aFileName,
const TDesC & aArgs
) [static]

Used to create an instance of CStartupProperties class with the specified process filename and arguments.

Parameters

const TDesC & aFileName A file name containing full path to be used to start up a component.
const TDesC & aArgs A string that will be used as an argument to the component when starting.

NewL(TResourceReader &)

IMPORT_C CStartupProperties * NewL ( TResourceReader & aSource ) [static]
Used to create an instance of CStartupProperties class from a resource definition. Supported resource structs are START_PROCESS_INFO , START_PROCESS_INFO2 , START_APP_INFO and START_APP_INFO2 .
panic
EInvalidCommandType if the Command type is invalid
panic
EInvalidStartMethod if the start method is invalid
panic
EInvalidTimeout if start method is not EWaitForStart then timeout value should be zero
panic
EInvalidNoOfRetries if start method is not EWaitForStart then no_of_retries should be zero
panic
EInvalidRecoveryMethod if the Recovery method called after a command failure is invalid

Parameters

TResourceReader & aSource The resource reader with which to access the resource values

NewLC()

IMPORT_C CStartupProperties * NewLC ( ) [static]

Used to create an instance of CStartupProperties class. The new instance is put on the CleanupStack .

NewLC(const TDesC &, const TDesC &)

IMPORT_C CStartupProperties * NewLC ( const TDesC & aFileName,
const TDesC & aArgs
) [static]

Used to create an instance of CStartupProperties class with the specified process filename and arguments. The new instance is pushed onto the CleanupStack . CStartupProperties::NewL(const TDesC& aFileName, const TDesC& aArgs)

Parameters

const TDesC & aFileName
const TDesC & aArgs

NewLC(TResourceReader &)

IMPORT_C CStartupProperties * NewLC ( TResourceReader & aSource ) [static]

Used to create an instance of CStartupProperties class from a resource definition. The new instance is put on the CleanupStack . CStartupProperties::NewL(TResourceReader& aResourceReader)

Parameters

TResourceReader & aSource

NoOfRetries()

IMPORT_C TInt NoOfRetries ( ) const

Accessor function returning number of retries property. Only valid when TStartMethod = EWaitForStart .

RecoveryMethod()

IMPORT_C TRecoveryMethod RecoveryMethod ( ) const

Accessor function returning recovery method property read from the retry_failure_recovery_method property in the resource structs START_PROCESS_INFO2 and START_APP_INFO2.

Reset()

IMPORT_C void Reset ( )

Reset all variables in this instance back to constructor defaults.

RestartMode()

IMPORT_C TInt RestartMode ( ) const

Accessor function returning restart mode property

SetActionOnCommandFailure(TActionOnCommandFailure)

IMPORT_C void SetActionOnCommandFailure ( TActionOnCommandFailure aActionOnCommandFailure )

Action to be taken on command failure. Provides backward compatibility with earlier SSC format. Used to set the fail_on_error fields within START_PROCESS_INFO, START_APP_INFO, START_DLL_INFO, and MULTIPLE_WAIT structures.

Parameters

TActionOnCommandFailure aActionOnCommandFailure Action to be taken if the system starter command fails.

SetFileParamsL(const TDesC &, const TDesC &)

IMPORT_C void SetFileParamsL ( const TDesC & aFileName,
const TDesC & aArgs
)

Sets file parameters

Parameters

const TDesC & aFileName A file name containing full path to be used to start up a component.
const TDesC & aArgs A string that will be used as an argument to the component when starting.

SetMonitored(TBool)

IMPORT_C void SetMonitored ( TBool aMonitored )

Sets the monitoring parameter. Monitoring a component means the System Monitor server observes the component and takes action when it exits. When a monitored component exits, the System Monitor server will try to restart it the number of times specified in NoOfRetries . If the number of retries is 0, or the number of retries have been exhausted, the TRecoveryMethod is executed.

Parameters

TBool aMonitored ETrue if the component should be monitored for failure

SetNoOfRetries(TInt)

IMPORT_C void SetNoOfRetries ( TInt aNumRetries )

Sets failure parameter NoOfRetries . Only valid when TStartMethod = EWaitForStart .

Parameters

TInt aNumRetries Number of retries to attempt if the component fails to start for the first time during system startup. Also determines if a monitored component should be restarted when it fails. Only valid when TStartMethod = EWaitForStart.

SetRecoveryParams(TRecoveryMethod, TInt)

IMPORT_C void SetRecoveryParams ( TRecoveryMethod aRecoveryMethod,
TInt aRestartMode
)

Sets recovery parameters. When a component being monitored exits and the system fails to restart the component within the specified number of retries, the TRecoveryMethod is executed. Used to set the retry_failure_recovery_method within START_PROCESS_INFO2 and START_APP_INFO2 structures.

Parameters

TRecoveryMethod aRecoveryMethod The method to use to recover when a monitored component fails.
TInt aRestartMode The startup mode to restart the OS if recovery method is ERestartOSWithMode. If aRecoveryMethod==ERestartOS this parameter should be zero.

SetStartInBackground(TBool)

IMPORT_C void SetStartInBackground ( TBool aStartInBackground )

Sets extra startup start in background parameter only needed if starting an application

Parameters

TBool aStartInBackground ETrue if the application should start in the background

SetStartMethod(TStartMethod)

IMPORT_C void SetStartMethod ( TStartMethod aStartMethod )

Sets startup method parameter.

Parameters

TStartMethod aStartMethod The method to be used to start up the component.

SetStartupType(TStartupType)

IMPORT_C void SetStartupType ( TStartupType aType )

Sets startup type parameter

Parameters

TStartupType aType EStartProcess for starting processes, EStartApp for starting applications

SetTimeout(TInt)

IMPORT_C void SetTimeout ( TInt aTimeout )

Sets failure parameter Timeout. Used together with start-method EWaitStart to determine how long to wait for the component being started to rendevouz before aborting an attempt.

Parameters

TInt aTimeout The time in milliseconds to wait before terminating a component that's taking longer to start (rendezvouz) than this specified timeout value. A value of zero means "do not time this component out". Only valid when TStartMethod = EWaitForStart.

SetViewless(TBool)

IMPORT_C void SetViewless ( TBool aViewless )

Sets extra startup viewless parameter only needed if starting an application

Parameters

TBool aViewless ETrue if the application should be viewless

Size()

IMPORT_C TInt Size ( ) const

StartInBackground()

IMPORT_C TBool StartInBackground ( ) const

Accessor function returning start in background property

StartMethod()

IMPORT_C TStartMethod StartMethod ( ) const

Accessor function returning start method property

StartupType()

IMPORT_C TStartupType StartupType ( ) const

Accessor function returning startup type property

Timeout()

IMPORT_C TInt Timeout ( ) const

Accessor function returning timeout property. Only valid when TStartMethod = EWaitForStart .

Version()

IMPORT_C TInt Version ( ) const

Accessor function returning internal version of the parameter object

Viewless()

IMPORT_C TBool Viewless ( ) const

Accessor function returning viewless property

Member Data Documentation

HBufC * iArgs

HBufC * iArgs [private]

Application arguments

HBufC * iFileName

HBufC * iFileName [private]

Path to the application

TBool iMonitored

TBool iMonitored [private]

Whether the application should be monitored

TInt iNoOfRetries

TInt iNoOfRetries [private]

No of retries if the server/app/process fails to start

TRecoveryPolicy iRecoveryMethod

TRecoveryPolicy iRecoveryMethod [private]

How to recover monitored application

TInt iRestartMode

TInt iRestartMode [private]

Which startup mode to restart the OS if recovery mode is RestartOSWithMode

TBool iStartInBackground

TBool iStartInBackground [private]

Whether the application should be started in the background.

TStartMethod iStartMethod

TStartMethod iStartMethod [private]

Whether system starter should wait for application to signal completion or use 'fire and forget' mode.

TStartupType iStartupType

TStartupType iStartupType [private]

What to start, application or process.

TInt iTimeout

TInt iTimeout [private]

Whether to kill a process that's taking too long. a value of zero means "do not time this process out".

TInt iVersion

TInt iVersion [private]

Internal version for the CStartupProperties object

TBool iViewless

TBool iViewless [private]

Whether the application should be started viewless.