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