CServShutdownServer Class Reference

class CServShutdownServer : public CServer2

This class describes an object, which handles requests, such as of MSaveObserver::TSaveType type. When CServShutdownServer::HandleShutdownEventL() gets called, the CServShutdownServer implementation will notify all registered clients, completing their asynchronous messages (CServShutdownSession::iPtr), then it will wait until all clients re-register itself and if this is a beginning of a powerdown sequence, the method will store the locales and the HAL properties subsequently switching off the power.

Inherits from

Public Member Functions
~CServShutdownServer()
IMPORT_C voidCancelPowerOff()
IMPORT_C CArrayFix< TThreadId > *ClientArrayLC()
IMPORT_C voidConstructL()
IMPORT_C voidGetShutdownState(TBool &, TBool &)
IMPORT_C voidHandlePowerNotifRequest(const RThread &)
IMPORT_C voidHandleShutdownEventL(MSaveObserver::TSaveType, TBool, TPowerState)
IMPORT_C TBoolIsClientHung(TThreadId)
IMPORT_C TBoolIsPowerOff()
IMPORT_C CServShutdownServer *NewL()
IMPORT_C voidNotifySave(MSaveObserver::TSaveType)
voidSwitchOff()
Protected Member Functions
CServShutdownServer(TInt)
Private Member Functions
TBool AllSessionsHavePendingRequest()
voidDoSwitchOff()
CSession2 *NewSessionL(const TVersion &, const RMessage2 &)
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
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()
CServer2::CServer2(TInt,TServerType)
CServer2::DoCancel()
CServer2::DoConnect(const RMessage2 &)
CServer2::Extension_(TUint,TAny *&,TAny *)
CServer2::Message()const
CServer2::ReStart()
CServer2::RunError(TInt)
CServer2::RunL()
CServer2::Server()const
CServer2::SetMaster(const CServer2 *)
CServer2::SetPinClientDescriptors(TBool)
CServer2::Start(const TDesC &)
CServer2::StartL(const TDesC &)
CServer2::~CServer2()
Inherited Enumerations
CActive:TPriority
CServer2:TPanic
CServer2:TServerType
Private Attributes
TPowerState iPowerEvent
TBool iPowerOff
CShutdownTimer *iShutdownTimer
Inherited Attributes
CActive::iStatus
CServer2::iSessionIter

Constructor & Destructor Documentation

CServShutdownServer(TInt)

IMPORT_CCServShutdownServer(TIntaPriority)[protected]

Parameters

TInt aPriorityThe active object priority.

~CServShutdownServer()

IMPORT_C~CServShutdownServer()

Destructor. Releases CShutdownTimer object if it has been allocated.

Member Functions Documentation

AllSessionsHavePendingRequest()

TBool AllSessionsHavePendingRequest()const [private]

CancelPowerOff()

IMPORT_C voidCancelPowerOff()

Cancels any power off request.

ClientArrayLC()

IMPORT_C CArrayFix< TThreadId > *ClientArrayLC()
This method creates an array of CArrayFix<TThreadId> type and appends to it the thread id-s of the all registered clients. The created CArrayFix<TThreadId> instance will be pushed on the cleanup stack.
leave
Some system-wide error codes including KErrNoMemory.

ConstructL()

IMPORT_C voidConstructL()[virtual]
Completes the server construction by adding the server to the active scheduler and initializing the CShutdownTimer object if applicable.
leave
See CServer2::StartL() leave error codes.
CServer2::StartL()
panic
KErrNotSupported Incorrect patchable variables configuration.

DoSwitchOff()

voidDoSwitchOff()[private]

This method switches off the power using the Power API. If there is a defined SYSLIBS_TEST macro, the method does nothing.

GetShutdownState(TBool &, TBool &)

IMPORT_C voidGetShutdownState(TBool &aPowerOff,
TBool &aAllSessionsHavePendingRequest
)const

This method returns an information about the shutdown status.

Parameters

TBool & aPowerOffAn output parameter, where iPowerOff value will be stored. It will be non-zero, if a powerdown sequence has been initiated.
TBool & aAllSessionsHavePendingRequestAn output parameter. It will be non-zero, if all clients has pending requests.

HandlePowerNotifRequest(const RThread &)

IMPORT_C voidHandlePowerNotifRequest(const RThread &aClient)

This method iterates through all session instances and checks that all they have pending requests (which means that all clients have completed their powerdown related processing and re-registered itself back to the shutdown server).. If that's true (all sessions have pending requests) and iPowerOff flag is nonzero, the method will call SwitchOff() - the power will be switched off. CServShutdownServer::SwitchOff() CServShutdownSession::HasPendingRequest()

Parameters

const RThread & aClient

HandleShutdownEventL(MSaveObserver::TSaveType, TBool, TPowerState)

IMPORT_C voidHandleShutdownEventL(MSaveObserver::TSaveTypeaAction,
TBoolaPowerOff,
TPowerStateaEvent = EPwStandby
)
This method has to be called, when the registered clients have to be notified that a particular action has to be done, such as MSaveObserver::ESaveData, MSaveObserver::ESaveAll, MSaveObserver::EReleaseRAM,... If this is a beginning of a powerdown sequence, the method will store the locales and the HAL properties. If the requested action is not MSaveObserver::ESaveNone, the method will call CServShutdownServer::NotifySave().
leave
KErrNotSupported Leaves if aEvent is invalid
CServShutdownServer::NotifySave() TPowerState

Parameters

MSaveObserver::TSaveType aActionThe type of the requested action
TBool aPowerOffIf it is non-zero, this is the beginning of a powerdown sequence.
TPowerState aEvent = EPwStandbyThe type of the powerdown event (power off or restart)

IsClientHung(TThreadId)

IMPORT_C TBoolIsClientHung(TThreadIdaId)const

Parameters

TThreadId aIdClient's thread id.

IsPowerOff()

IMPORT_C TBoolIsPowerOff()const

NewL()

IMPORT_C CServShutdownServer *NewL()[static]
Standard phase-one factory method for creating CServShutdownServer instances.
leave
Some system-wide error codes including KErrNoMemory.

NewSessionL(const TVersion &, const RMessage2 &)

CSession2 *NewSessionL(const TVersion &aVersion,
const RMessage2 &aMessage
)const [private, virtual]
This method creates a new server side session object.
leave
KErrNotSupported Unknown shutdown server version
leave
Some system-wide error codes including KErrNoMemory.

Parameters

const TVersion & aVersionShutdown server version number.
const RMessage2 & aMessage

NotifySave(MSaveObserver::TSaveType)

IMPORT_C voidNotifySave(MSaveObserver::TSaveTypeaSaveType)

This method will call SwitchOff(), if there are no sessions, so - no clients. If there are registered clients (sessions), the method will call CServShutdownSession::NotifySave() for each of them. If the timer object has been initialised, it calculates the shutdown timeout value and adds the timer to the active scheduler. CServShutdownServer::SwitchOff() CServShutdownSession::NotifySave()

Parameters

MSaveObserver::TSaveType aSaveTypeThe action, which will be given to the clients, when calling their MSaveObserver::SaveL() implementations.

SwitchOff()

voidSwitchOff()

Member Data Documentation

TPowerState iPowerEvent

TPowerState iPowerEvent[private]

TBool iPowerOff

TBool iPowerOff[private]

CShutdownTimer * iShutdownTimer

CShutdownTimer *iShutdownTimer[private]