|
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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef __EIKALSUP_H__ |
|
24 #define __EIKALSUP_H__ |
|
25 |
|
26 // System includes |
|
27 #include <e32base.h> |
|
28 #include <uikon/eiksvfty.h> |
|
29 #include <asaltdefs.h> |
|
30 #include <uikon/eikalsrv.h> |
|
31 |
|
32 /** Patchable ROM constant for the default number of minutes to snooze. See uikon.iby. |
|
33 @publishedPartner */ |
|
34 IMPORT_C extern const TInt KEikAlarmDefaultSnoozeInMinutes; // default snooze increment in minutes |
|
35 |
|
36 /** @internalComponent */ |
|
37 const TInt KEikUseDefaultAlarmSnoozeIncrement = -1; // Use ROM constant KAlarmDefaultSnoozeInMinutes |
|
38 |
|
39 /** Provides an interface between the alarm server and applications that need to |
|
40 handle expiring alarms. |
|
41 |
|
42 When an alarm has expired, this class handles silencing, acknowledging and snoozing it, |
|
43 and users switching to another application (which causes the alarm to be snoozed for a |
|
44 default period). |
|
45 |
|
46 @publishedPartner |
|
47 @released */ |
|
48 NONSHARABLE_CLASS(CEikAlmControlSupervisor) : public CBase |
|
49 { |
|
50 public: |
|
51 /** The priority of the periodic timer that is used to count down the snooze period. */ |
|
52 enum TPriority |
|
53 { |
|
54 /** The timer's priority. This value is between EPriorityStandard and EPriorityUserInput. */ |
|
55 ESnoozeCountDownPriority = 0x00000001 |
|
56 }; |
|
57 public: //exported API |
|
58 inline TInt PauseSoundMinutes() const; |
|
59 inline TTime QuietPeriodEndTime() const; |
|
60 IMPORT_C void CmdAcknowledgeAlarm(); |
|
61 IMPORT_C void CmdPauseAlarmSoundL(TInt aNumMinutes = KEikUseDefaultAlarmSnoozeIncrement); |
|
62 IMPORT_C void CmdSilenceAlarmSound(); |
|
63 IMPORT_C TBool CmdTaskAwayFromAlarmL(); // use default snooze time |
|
64 IMPORT_C TBool CmdTaskAwayFromAlarmL(TInt aMinutesToSnooze); |
|
65 IMPORT_C TDesC8& AlarmData() const; |
|
66 IMPORT_C void CmdAcknowledgeAllAlarms(); |
|
67 public: // deprecated |
|
68 inline TBool CmdTaskAwayFromAlarm(); // deprecated |
|
69 inline void CmdPauseAlarmSound(TInt aNumMinutes = KEikUseDefaultAlarmSnoozeIncrement); // deprecated |
|
70 public: // internal to Symbian |
|
71 static CEikAlmControlSupervisor* NewLC(MEikServAlarmFactory& aAlarmControlFactory, CEikServAlarmAlertSession* aSession); |
|
72 ~CEikAlmControlSupervisor(); |
|
73 void CancelTimeCountDown(); |
|
74 void SynchronizeCountDownTimer(); |
|
75 void ServiceL(const RMessage2& aMessage); |
|
76 TBool IsVisible() const; |
|
77 TAlarmId AlarmId() const; |
|
78 protected: |
|
79 IMPORT_C virtual void CEikAlmControlSupervisor_Reserved1(); |
|
80 IMPORT_C virtual void CEikAlmControlSupervisor_Reserved2(); |
|
81 private: |
|
82 CEikAlmControlSupervisor(); |
|
83 void ConstructL(MEikServAlarmFactory& aAlarmControl, CEikServAlarmAlertSession* aSession); |
|
84 |
|
85 void StartTimeCountDown(); |
|
86 static TInt CallbackSnoozeDecrement(TAny *aAlarmAlert); |
|
87 void DecrementSnoozeMinutes(); |
|
88 void SetAlertState(TInt aAlarmServerStateFlags); |
|
89 void StartPlayAlarmL(const RMessage2& aMessage); |
|
90 void StopPlayAlarm(); |
|
91 |
|
92 TTime ReturnTimeToSnooze(TInt aMinutesToSnooze); |
|
93 void UpdateAlarmInfoL(const RMessage2& aMessage); |
|
94 void SetVisibility(TBool aVisible); |
|
95 private: |
|
96 CPeriodic* iMinuteCountDown; |
|
97 TInt iPauseSoundMinutes; |
|
98 TTime iPauseSoundDueTime; |
|
99 |
|
100 HBufC8* iAlarmData; |
|
101 TBool iVisible; |
|
102 CEikServAlarmAlertSession* iSession; |
|
103 TAlarmId iAlarmId; |
|
104 |
|
105 MEikServAlarm* iAlarmAlert; |
|
106 }; |
|
107 |
|
108 /** Gets the number of minutes remaining in the alarm's snooze period, before |
|
109 the alarm is due to expire again. |
|
110 |
|
111 @return The number of minutes remaining in the alarm's snooze period. */ |
|
112 inline TInt CEikAlmControlSupervisor::PauseSoundMinutes() const |
|
113 { |
|
114 return(iPauseSoundMinutes); |
|
115 } |
|
116 |
|
117 /** Gets the end time for the alarm server's quiet period. |
|
118 |
|
119 During a quiet period, any alarms that are due to expire are |
|
120 deferred until the quiet period is over. Not all UIs support |
|
121 this feature. |
|
122 |
|
123 @return The end time for the quiet period (if any). */ |
|
124 inline TTime CEikAlmControlSupervisor::QuietPeriodEndTime() const |
|
125 { |
|
126 return(iSession->QuietPeriodEndTime()); |
|
127 } |
|
128 |
|
129 /** @deprecated |
|
130 |
|
131 Deprecated in 7.0s. Use CEikAlmControlSupervisor::CmdPauseAlarmSoundL() instead |
|
132 because RMessage::WriteL() could leave. */ |
|
133 inline void CEikAlmControlSupervisor::CmdPauseAlarmSound(TInt aNumMinutes) |
|
134 { CmdPauseAlarmSoundL(aNumMinutes); } |
|
135 |
|
136 /** @deprecated |
|
137 |
|
138 Deprecated in 7.0s. Use CEikAlmControlSupervisor::CmdTaskAwayFromAlarmL() instead |
|
139 because RMessage::WriteL() could leave. */ |
|
140 inline TBool CEikAlmControlSupervisor::CmdTaskAwayFromAlarm() |
|
141 { return CmdTaskAwayFromAlarmL(); } |
|
142 |
|
143 #endif // __EIKALSUP_H__ |