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 void InitAppArcServer ( TRequestStatus &)
IMPORT_C CStartSafe * NewL ()
IMPORT_C void StartAndMonitorL (const CStartupProperties &, RProcess &, TInt &)
IMPORT_C void StartL (const CStartupProperties &, RProcess &, TInt &)
IMPORT_C void StartL (const CStartupProperties &, RProcess &, TRequestStatus &)
Private Member Functions
CStartSafe ()
TInt AwaitProcessStartup ( RProcess &, TInt , TRequestStatus &)
TInt AwaitRendezvous ( RProcess &, TInt )
void ConstructL ()
void DoFireAndForgetL (const CStartupProperties &, RProcess &)
void DoStartAppL (const CStartupProperties &, RProcess &)
TInt DoStartAppWithRetries (const CStartupProperties &, RProcess &, TInt &)
void DoStartProcessL (const CStartupProperties &, RProcess &)
TInt DoStartProcessWithRetries (const CStartupProperties &, RProcess &, TInt &)
void DoWaitForStartL (const CStartupProperties &, RProcess &, TInt &)
void GetHandleAndWaitForProcessL (const CStartupProperties &, RProcess &, TThreadId &, TRequestStatus &)
void GetProcessHandleL ( RProcess &, const TThreadId &)
void InstituteRestartL (const CStartupProperties &)
void LoadApStartLibL ()
void ShootBadProcess ( 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,
TInt aTimeout,
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,
TInt aTimeout
) [private]

Parameters

RProcess & aProcess
TInt aTimeout

ConstructL()

void ConstructL ( ) [private]

DoFireAndForgetL(const CStartupProperties &, RProcess &)

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

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess

DoStartAppL(const CStartupProperties &, RProcess &)

void DoStartAppL ( 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 &)

void DoStartProcessL ( 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 &)

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

Parameters

const CStartupProperties & aStartupProperties
RProcess & aProcess
TInt & aNumRetried

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

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

Parameters

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

GetProcessHandleL(RProcess &, const TThreadId &)

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

Parameters

RProcess & aProcess
const TThreadId & aThreadId

InitAppArcServer(TRequestStatus &)

IMPORT_C void InitAppArcServer ( TRequestStatus & aStatus )

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

Parameters

TRequestStatus & aStatus Command Status

InstituteRestartL(const CStartupProperties &)

void InstituteRestartL ( 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()

void LoadApStartLibL ( ) [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 &)

void ShootBadProcess ( 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 void StartAndMonitorL ( 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 & aStartupProperties Startup properties provided by the caller.
RProcess & aProcess The newly created process.
TInt & aNumRetried The number of retries made in starting the process.

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

IMPORT_C void StartL ( 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 & aStartupProperties Startup properties provided by the caller.
RProcess & aProcess The newly created process.
TInt & aNumRetried Number of retries made for starting the process.

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

IMPORT_C void StartL ( 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 & aStartupProperties Startup properties provided by the caller.
RProcess & aProcess The newly created process.
TRequestStatus & aCommandTrs The 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]