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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
23 #ifndef __EIKALSUP_H__
24 #define __EIKALSUP_H__
28 #include <uikon/eiksvfty.h>
29 #include <asaltdefs.h>
30 #include <uikon/eikalsrv.h>
32 /** Patchable ROM constant for the default number of minutes to snooze. See uikon.iby.
34 IMPORT_C extern const TInt KEikAlarmDefaultSnoozeInMinutes; // default snooze increment in minutes
36 /** @internalComponent */
37 const TInt KEikUseDefaultAlarmSnoozeIncrement = -1; // Use ROM constant KAlarmDefaultSnoozeInMinutes
39 /** Provides an interface between the alarm server and applications that need to
40 handle expiring alarms.
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
48 NONSHARABLE_CLASS(CEikAlmControlSupervisor) : public CBase
51 /** The priority of the periodic timer that is used to count down the snooze period. */
54 /** The timer's priority. This value is between EPriorityStandard and EPriorityUserInput. */
55 ESnoozeCountDownPriority = 0x00000001
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();
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;
79 IMPORT_C virtual void CEikAlmControlSupervisor_Reserved1();
80 IMPORT_C virtual void CEikAlmControlSupervisor_Reserved2();
82 CEikAlmControlSupervisor();
83 void ConstructL(MEikServAlarmFactory& aAlarmControl, CEikServAlarmAlertSession* aSession);
85 void StartTimeCountDown();
86 static TInt CallbackSnoozeDecrement(TAny *aAlarmAlert);
87 void DecrementSnoozeMinutes();
88 void SetAlertState(TInt aAlarmServerStateFlags);
89 void StartPlayAlarmL(const RMessage2& aMessage);
92 TTime ReturnTimeToSnooze(TInt aMinutesToSnooze);
93 void UpdateAlarmInfoL(const RMessage2& aMessage);
94 void SetVisibility(TBool aVisible);
96 CPeriodic* iMinuteCountDown;
97 TInt iPauseSoundMinutes;
98 TTime iPauseSoundDueTime;
102 CEikServAlarmAlertSession* iSession;
105 MEikServAlarm* iAlarmAlert;
108 /** Gets the number of minutes remaining in the alarm's snooze period, before
109 the alarm is due to expire again.
111 @return The number of minutes remaining in the alarm's snooze period. */
112 inline TInt CEikAlmControlSupervisor::PauseSoundMinutes() const
114 return(iPauseSoundMinutes);
117 /** Gets the end time for the alarm server's quiet period.
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
123 @return The end time for the quiet period (if any). */
124 inline TTime CEikAlmControlSupervisor::QuietPeriodEndTime() const
126 return(iSession->QuietPeriodEndTime());
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); }
138 Deprecated in 7.0s. Use CEikAlmControlSupervisor::CmdTaskAwayFromAlarmL() instead
139 because RMessage::WriteL() could leave. */
140 inline TBool CEikAlmControlSupervisor::CmdTaskAwayFromAlarm()
141 { return CmdTaskAwayFromAlarmL(); }
143 #endif // __EIKALSUP_H__