1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 WARNING: For internal use ONLY. Compatibility is not guaranteed in future releases.
22 #ifndef __EIKALSRV_H__
23 #define __EIKALSRV_H__
26 #include <asaltdefs.h>
27 #include <asshddefs.h>
29 class MEikServAlarmFactory;
31 class CEikServAlarmAlertSession;
35 WARNING: Class for internal use ONLY. Compatibility is not guaranteed in future releases.
37 NONSHARABLE_CLASS(CEikServAlarmAlertServer) : public CPolicyServer
40 IMPORT_C static CEikServAlarmAlertServer* NewL(MEikServAlarmFactory* aAlarmControlFactory);
41 IMPORT_C static CEikServAlarmAlertServer* NewL(MEikServAlarmFactory* aAlarmControlFactory, TInt aMaxAlarms);
42 ~CEikServAlarmAlertServer();
43 IMPORT_C void HandleSwitchOnEvent();
44 IMPORT_C void TaskKeyPressedL();
45 inline TBool AlarmAlertIsVisible() const;
46 inline void SessionDied();
47 IMPORT_C void SetQuietPeriodL(TTime aQuietPeriodEndTime);
48 IMPORT_C void ClearAllAlarmsL();
49 public: // from CPolicyServer
50 CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
52 CEikServAlarmAlertServer(TInt aPriority, MEikServAlarmFactory& aAlarmControlFactory, TInt aMaxAlarms);
54 CEikServAlarmAlertSession* iSession; // iSession does not *own* what it points to
55 MEikServAlarmFactory& iAlarmControlFactory;
60 class CEikAlmControlSupervisor;
63 Helper class for CEikServAlarmAlertSession. Holds response data for queuing
65 WARNING: Class for internal use ONLY. Compatibility is not guaranteed in future releases.
67 NONSHARABLE_CLASS(TAlarmResponse)
70 TAlarmResponse (TASAltAlertServerResponse aCode, TAlarmId aId, TTime aTime);
71 TASAltAlertServerResponse ResponseCode () const;
72 TAlarmId AlarmId () const;
73 TTime TimeToSnooze() const;
75 TASAltAlertServerResponse iCode;
80 // supposed to be maximum one response in a queue, because client should resubmit request
81 // for response as soon as it receive previous
82 const TInt KAlertResponseQueueSize = 20;
85 Represents a session for a client thread on the server-side.
87 WARNING: Class for internal use ONLY. Compatibility is not guaranteed in future releases.
89 NONSHARABLE_CLASS(CEikServAlarmAlertSession) : public CSession2
92 static CEikServAlarmAlertSession* NewL(MEikServAlarmFactory& aAlarmControlFactory, TInt aMaxAlarms);
93 ~CEikServAlarmAlertSession();
94 void TaskKeyPressedL();
95 void HandleSwitchOnEvent();
96 inline TBool AlarmAlertIsVisible() const;
98 void SetQuietPeriodL(TTime aQuietPeriodEndTime);
99 inline TTime QuietPeriodEndTime() const;
100 void RespondEventL(TASAltAlertServerResponse aCode);
101 void RespondEventL(TASAltAlertServerResponse aCode, TAlarmId aId, TTime aTimeToSnooze = 0);
102 void ClearAllAlarmsL();
104 CEikServAlarmAlertServer* AlarmAlertServer() const;
106 virtual void ServiceL(const RMessage2 &aMessage);
108 CEikServAlarmAlertSession(MEikServAlarmFactory& aAlarmControl, TInt aMaxAlarms);
109 void QueueEventL (TASAltAlertServerResponse& aCode,TAlarmId& aId, TTime& aTimeToSnooze);
110 TInt FindAlarm(TAlarmId aAlarmId) const;
111 void DeleteAlarmL(const RMessage2& aMessage);
112 void UpdateVisibility();
115 MEikServAlarmFactory& iAlarmControlFactory;
116 TTime iQuietPeriodEndTime;
118 RPointerArray<CEikAlmControlSupervisor> iAlarmSupervisors;
119 RArray <TAlarmResponse> iResponseQueue;
123 /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
124 inline TBool CEikServAlarmAlertServer::AlarmAlertIsVisible() const
125 { return iSession->AlarmAlertIsVisible(); }
127 /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
128 inline TBool CEikServAlarmAlertSession::AlarmAlertIsVisible() const
131 /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
132 inline void CEikServAlarmAlertServer::SessionDied()
135 /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
136 inline TTime CEikServAlarmAlertSession::QuietPeriodEndTime() const
137 { return iQuietPeriodEndTime; }
139 #endif //__EIKALSRV_H__