epoc32/include/mw/uikon/eikalsrv.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/uikon/eikalsrv.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,133 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @internalComponent
    1.24 +*/
    1.25 +
    1.26 +#ifndef __EIKALSRV_H__
    1.27 +#define __EIKALSRV_H__
    1.28 +
    1.29 +#include <e32base.h>
    1.30 +#include <asaltdefs.h>
    1.31 +#include <asshddefs.h>
    1.32 +
    1.33 +class MEikServAlarmFactory;
    1.34 +class MEikServAlarm;
    1.35 +class CEikServAlarmAlertSession;
    1.36 +
    1.37 +/** 
    1.38 +@internalComponent
    1.39 +*/
    1.40 +NONSHARABLE_CLASS(CEikServAlarmAlertServer) : public CPolicyServer
    1.41 +	{
    1.42 +public:
    1.43 +	IMPORT_C static CEikServAlarmAlertServer* NewL(MEikServAlarmFactory* aAlarmControlFactory);
    1.44 +	IMPORT_C static CEikServAlarmAlertServer* NewL(MEikServAlarmFactory* aAlarmControlFactory, TInt aMaxAlarms);
    1.45 +	~CEikServAlarmAlertServer();
    1.46 +	IMPORT_C void HandleSwitchOnEvent();
    1.47 +	IMPORT_C void TaskKeyPressedL();
    1.48 +	inline TBool AlarmAlertIsVisible() const;
    1.49 +	inline void SessionDied();
    1.50 +	IMPORT_C void SetQuietPeriodL(TTime aQuietPeriodEndTime);
    1.51 +	IMPORT_C void ClearAllAlarmsL();	
    1.52 +public: // from CPolicyServer
    1.53 +	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
    1.54 +private:
    1.55 +	CEikServAlarmAlertServer(TInt aPriority, MEikServAlarmFactory& aAlarmControlFactory,  TInt aMaxAlarms);
    1.56 +private:
    1.57 +	CEikServAlarmAlertSession* iSession; // iSession does not *own* what it points to
    1.58 +	MEikServAlarmFactory& iAlarmControlFactory;
    1.59 +	TInt iMaxAlarms;
    1.60 +	};
    1.61 +
    1.62 +
    1.63 +class CEikAlmControlSupervisor;
    1.64 +
    1.65 +/** 
    1.66 +Helper class for CEikServAlarmAlertSession. Holds response data for queuing
    1.67 +@internalComponent
    1.68 +*/
    1.69 +NONSHARABLE_CLASS(TAlarmResponse)
    1.70 +	{
    1.71 +public:	
    1.72 +	TAlarmResponse (TASAltAlertServerResponse  aCode,  TAlarmId aId, TTime aTime);
    1.73 +	TASAltAlertServerResponse ResponseCode () const;
    1.74 +	TAlarmId AlarmId () const;
    1.75 +	TTime TimeToSnooze() const;
    1.76 +private:
    1.77 +	TASAltAlertServerResponse  iCode;
    1.78 +	TAlarmId iId;
    1.79 +	TTime iTime;
    1.80 +	};
    1.81 +	
    1.82 +// supposed to be maximum one response in a queue, because client should resubmit request 
    1.83 +// for response as soon	as it receive previous 
    1.84 +const TInt KAlertResponseQueueSize = 20;	
    1.85 +
    1.86 +/**
    1.87 +Represents a session for a client thread on the server-side.
    1.88 +@internalComponent 
    1.89 +*/
    1.90 +NONSHARABLE_CLASS(CEikServAlarmAlertSession) : public CSession2
    1.91 +	{
    1.92 +public:
    1.93 +	static CEikServAlarmAlertSession* NewL(MEikServAlarmFactory& aAlarmControlFactory, TInt aMaxAlarms);
    1.94 +	~CEikServAlarmAlertSession();
    1.95 +	void TaskKeyPressedL();
    1.96 +	void HandleSwitchOnEvent();
    1.97 +	inline TBool AlarmAlertIsVisible() const;
    1.98 +
    1.99 +	void SetQuietPeriodL(TTime aQuietPeriodEndTime);
   1.100 +	inline TTime QuietPeriodEndTime() const; 
   1.101 +	void RespondEventL(TASAltAlertServerResponse aCode);
   1.102 +	void RespondEventL(TASAltAlertServerResponse aCode, TAlarmId aId, TTime aTimeToSnooze = 0);
   1.103 +	void ClearAllAlarmsL();
   1.104 +private:
   1.105 +	CEikServAlarmAlertServer* AlarmAlertServer() const;
   1.106 +	void ConstructL();
   1.107 +	virtual void ServiceL(const RMessage2 &aMessage);
   1.108 +
   1.109 +	CEikServAlarmAlertSession(MEikServAlarmFactory& aAlarmControl, TInt aMaxAlarms);
   1.110 +	void QueueEventL (TASAltAlertServerResponse&  aCode,TAlarmId& aId, TTime& aTimeToSnooze);
   1.111 +	TInt FindAlarm(TAlarmId aAlarmId) const;
   1.112 +	void DeleteAlarmL(const RMessage2& aMessage);
   1.113 +	void UpdateVisibility();
   1.114 +private:
   1.115 +	TBool iVisible;
   1.116 +	MEikServAlarmFactory& iAlarmControlFactory;
   1.117 +	TTime iQuietPeriodEndTime;
   1.118 +	TInt iMaxAlarms;
   1.119 +	RPointerArray<CEikAlmControlSupervisor> iAlarmSupervisors;
   1.120 +	RArray <TAlarmResponse> iResponseQueue;
   1.121 +	RMessage2 iMessage;
   1.122 +	};
   1.123 +
   1.124 +inline TBool CEikServAlarmAlertServer::AlarmAlertIsVisible() const 
   1.125 +	{ return iSession->AlarmAlertIsVisible(); }
   1.126 +
   1.127 +inline TBool CEikServAlarmAlertSession::AlarmAlertIsVisible() const 
   1.128 +	{ return iVisible; }
   1.129 +
   1.130 +inline void CEikServAlarmAlertServer::SessionDied() 
   1.131 +	{ iSession = NULL; }
   1.132 +
   1.133 +inline TTime CEikServAlarmAlertSession::QuietPeriodEndTime() const 
   1.134 +	{ return iQuietPeriodEndTime; }
   1.135 +
   1.136 +#endif //__EIKALSRV_H__