CStartSafe Class Reference

class CStartSafe : public CBase

Used to start a process or application reliably. Which means, if the starting fails after designated number of attempts then system restarts or an error is returned. Instead of this use CSsmStartSafe

Inherits from

Public Member Functions
~CStartSafe()
IMPORT_C voidInitAppArcServer(TRequestStatus &)
IMPORT_C CStartSafe *NewL()
IMPORT_C voidStartAndMonitorL(const CStartupProperties &, RProcess &, TInt &)
IMPORT_C voidStartL(const CStartupProperties &, RProcess &, TInt &)
IMPORT_C voidStartL(const CStartupProperties &, RProcess &, TRequestStatus &)
Private Member Functions
CStartSafe()
TInt AwaitProcessStartup(RProcess &, TInt, TRequestStatus &)
TInt AwaitRendezvous(RProcess &, TInt)
voidConstructL()
voidDoFireAndForgetL(const CStartupProperties &, RProcess &)
voidDoStartAppL(const CStartupProperties &, RProcess &)
TInt DoStartAppWithRetries(const CStartupProperties &, RProcess &, TInt &)
voidDoStartProcessL(const CStartupProperties &, RProcess &)
TInt DoStartProcessWithRetries(const CStartupProperties &, RProcess &, TInt &)
voidDoWaitForStartL(const CStartupProperties &, RProcess &, TInt &)
voidGetHandleAndWaitForProcessL(const CStartupProperties &, RProcess &, TThreadId &, TRequestStatus &)
voidGetProcessHandleL(RProcess &, const TThreadId &)
voidInstituteRestartL(const CStartupProperties &)
voidLoadApStartLibL()
voidShootBadProcess(RProcess &, const TRequestStatus &)
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
RLibrary iApStartLib
CApaStarter *iApaStarter

Constructor & Destructor Documentation

CStartSafe()

CStartSafe()[private]

~CStartSafe()

~CStartSafe()[virtual]

Member Functions Documentation

AwaitProcessStartup(RProcess &, TInt, TRequestStatus &)

TInt AwaitProcessStartup(RProcess &aProcess,
TIntaTimeout,
TRequestStatus &aCommandTrs
)[private]

Await completion of the TRS either unconditionally, or allow aTimeout for aProcess to start.

Parameters

RProcess & aProcess
TInt aTimeout
TRequestStatus & aCommandTrs

AwaitRendezvous(RProcess &, TInt)

TInt AwaitRendezvous(RProcess &aProcess,
TIntaTimeout
)[private]

Parameters

RProcess & aProcess
TInt aTimeout

ConstructL()

voidConstructL()[private]

DoFireAndForgetL(const CStartupProperties &, RProcess &)

voidDoFireAndForgetL(const CStartupProperties &aStartupProperties,
RProcess &aProcess
)[private]

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess

DoStartAppL(const CStartupProperties &, RProcess &)

voidDoStartAppL(const CStartupProperties &aStartupProperties,
RProcess &aProcess
)[private]

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess

DoStartAppWithRetries(const CStartupProperties &, RProcess &, TInt &)

TInt DoStartAppWithRetries(const CStartupProperties &aStartupProperties,
RProcess &aProcess,
TInt &aNumRetried
)[private]

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess
TInt & aNumRetried

DoStartProcessL(const CStartupProperties &, RProcess &)

voidDoStartProcessL(const CStartupProperties &aStartupProperties,
RProcess &aProcess
)[private]

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess

DoStartProcessWithRetries(const CStartupProperties &, RProcess &, TInt &)

TInt DoStartProcessWithRetries(const CStartupProperties &aStartupProperties,
RProcess &aProcess,
TInt &aNumRetried
)[private]

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess
TInt & aNumRetried

DoWaitForStartL(const CStartupProperties &, RProcess &, TInt &)

voidDoWaitForStartL(const CStartupProperties &aStartupProperties,
RProcess &aProcess,
TInt &aNumRetried
)[private]

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess
TInt & aNumRetried

GetHandleAndWaitForProcessL(const CStartupProperties &, RProcess &, TThreadId &, TRequestStatus &)

voidGetHandleAndWaitForProcessL(const CStartupProperties &aStartupProperties,
RProcess &aProcess,
TThreadId &aThreadId,
TRequestStatus &aCommandTrs
)[private]

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess
TThreadId & aThreadId
TRequestStatus & aCommandTrs

GetProcessHandleL(RProcess &, const TThreadId &)

voidGetProcessHandleL(RProcess &aProcess,
const TThreadId &aThreadId
)[private]

Parameters

RProcess & aProcess
const TThreadId & aThreadId

InitAppArcServer(TRequestStatus &)

IMPORT_C voidInitAppArcServer(TRequestStatus &aStatus)

Waits for AppArc Server initialise. Note: This function is synchronous.

Parameters

TRequestStatus & aStatusCommand Status

InstituteRestartL(const CStartupProperties &)

voidInstituteRestartL(const CStartupProperties &aStartupProperties)[private]

Make a call to restart the system.

RestartSys currently requires the guard-time KStartSafeRestartTimeout. The Leave() should never eventuate, except in case of a restart problem.

Parameters

const CStartupProperties & aStartupProperties

LoadApStartLibL()

voidLoadApStartLibL()[private]

Load the library. Locate and call the ordinal corresponding to CApStart::NewL().

Note: We do not leave in the case of being unable to load the libray, but assume Apparc is not present. iApaStarter is checked for NULL before use passim and appropriate error code supplied if it is. The return code is derived from the loader-server (Base) and is not closely specified in RLibrary docs or code.

NewL()

IMPORT_C CStartSafe *NewL()[static]

Used to create an instance of CStartSafe class

ShootBadProcess(RProcess &, const TRequestStatus &)

voidShootBadProcess(RProcess &aProcess,
const TRequestStatus &aStatus
)[private]

See if the process rendezvoused with an error code and is still alive. If so then Kill() it.

Parameters

RProcess & aProcess
const TRequestStatus & aStatus

StartAndMonitorL(const CStartupProperties &, RProcess &, TInt &)

IMPORT_C voidStartAndMonitorL(const CStartupProperties &aStartupProperties,
RProcess &aProcess,
TInt &aNumRetried
)

Used to start a process or application and initiate monitoring. Use this for EFireAndForget or EWaitForStart. The case of EDeferredWaitForStart is treated as for EFireAndForget. The number-of-retries parameter in aStartupProperties applies to the startup procedure. If monitoring is not successfully setup, the started process is killed and this function leaves with the error code supplied by the system-monitor.

leave
KErrArgument if the monitor flag is not set in aStartupProperties.
leave
Another of the system-wide error codes

Parameters

const CStartupProperties & aStartupPropertiesStartup properties provided by the caller.
RProcess & aProcessThe newly created process.
TInt & aNumRetriedThe number of retries made in starting the process.

StartL(const CStartupProperties &, RProcess &, TInt &)

IMPORT_C voidStartL(const CStartupProperties &aStartupProperties,
RProcess &aProcess,
TInt &aNumRetried
)

Used to start a process or application using EFireAndForget or EWaitForStart. The case of EDeferredWaitForStart is treated as EFireAndForget.

panic
ETimerValueInvalid if the timer value is invalid(<0)
leave
KErrNoMemory if no memory.
leave
KErrArgument if the TStartMethod enumeration in aStartupProperties is out of range.
leave
KErrTimedOut if the Application or process failed to rendezvous within the interval specified in aStartupProperties.
leave
KErrAbort if the startup and rendezvous was unsuccessful _and the call to restart the system was also unsuccessful. Otherwise,one of the system-wide error codes

Parameters

const CStartupProperties & aStartupPropertiesStartup properties provided by the caller.
RProcess & aProcessThe newly created process.
TInt & aNumRetriedNumber of retries made for starting the process.

StartL(const CStartupProperties &, RProcess &, TRequestStatus &)

IMPORT_C voidStartL(const CStartupProperties &aStartupProperties,
RProcess &aProcess,
TRequestStatus &aCommandTrs
)

Used to start a process or application using EDeferredWaitForStart. Note: Retries are not attempted in this asynchronous form of the function.

leave
KErrNotSupported if ApStart is not installed on the device.
leave
KErrArgument if the CStartupProperties StartupType is not recognised, otherwise one of the system-wide error codes

Parameters

const CStartupProperties & aStartupPropertiesStartup properties provided by the caller.
RProcess & aProcessThe newly created process.
TRequestStatus & aCommandTrsThe request-status which is completed by the process rendezvous, or by this function in case of error.

Member Data Documentation

RLibrary iApStartLib

RLibrary iApStartLib[private]

CApaStarter * iApaStarter

CApaStarter *iApaStarter[private]