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 #ifndef __ALMMOD_H__ |
|
17 #define __ALMMOD_H__ |
|
18 |
|
19 // System includes |
|
20 #include <asclisession.h> |
|
21 |
|
22 // User includes |
|
23 #include "timewmod.h" |
|
24 |
|
25 // Constants |
|
26 const TInt KArrayOfAlarmIdsGranularity = 64; |
|
27 const TInt KPriorityAlarmIdleObserver=-0x0010; |
|
28 const TInt KPriorityAlarmResponder=-0x0005; // Idle observer priority must be lower than this |
|
29 |
|
30 // The alarm model gives a general notification only |
|
31 // |
|
32 class CAlmIdleObserver : public CIdleObserver |
|
33 { |
|
34 public: |
|
35 static CAlmIdleObserver* NewL(MTimewModelObserver* aObserver,TInt aIdlePriority); |
|
36 }; |
|
37 |
|
38 class CAlmModel : public CModelBase |
|
39 { |
|
40 public: |
|
41 ~CAlmModel(); |
|
42 static CAlmModel* NewL(MTimewModelObserver* aObserver,TInt aResponderPriority); |
|
43 virtual void ProcessResponder(TInt aStatus); |
|
44 public: |
|
45 TInt AlarmQuietPeriodMinutes() const; |
|
46 TInt AlarmQuietPeriodSet(TInt aMinutes); |
|
47 inline void AlarmQuietPeriodCancel(); |
|
48 TTime AlarmQuietPeriodEnd() const; |
|
49 // |
|
50 void AlarmSoundToggle(); |
|
51 TInt AlarmSoundStateSet(TBool aSoundOn); |
|
52 TTimeWAlarmSoundState AlarmSoundState() const; |
|
53 // |
|
54 TInt ClockAlarmDelete(TInt aAlarmIndex); |
|
55 TInt ClockAlarmEnable(TInt aAlarmIndex,TTimeWClockAlarmState aClockAlarmState); |
|
56 TTimeWClockAlarmState ClockAlarmState(TInt aAlarmIndex) const; |
|
57 TInt ClockAlarmSet(TInt aAlarmIndex,const TASShdAlarm& aInfo); |
|
58 TInt ClockAlarmInfo(TInt aAlarmIndex,TASShdAlarm& aInfo); |
|
59 // |
|
60 void NextAlarmResetListL(); |
|
61 void NextAlarmClearList(); |
|
62 TInt NextAlarmNumber() const; |
|
63 TInt NextAlarmDelete(TInt aIndex); |
|
64 TBool NextAlarmCanDelete(TInt aIndex) const; |
|
65 TInt NextAlarm(TFullName& aOwner, TASShdAlarm& aInfo) const; |
|
66 TInt NextAlarmInfo(TInt aIndex, TFullName& aOwner, TASShdAlarm& aInfo) const; |
|
67 // |
|
68 TInt OrphanAlarmNumber() const; |
|
69 inline TInt UnacknowledgedAlarmNumber() const; |
|
70 // |
|
71 void ReviewAlarmResetListL(); |
|
72 void ReviewAlarmClearList(); |
|
73 TInt ReviewAlarmNumber() const; |
|
74 TInt ReviewAlarmInfo(TInt aIndex, TASShdAlarm& aInfo) const; |
|
75 |
|
76 private: |
|
77 CAlmModel(); |
|
78 void ConstructL(MTimewModelObserver* aObserver,TInt aResponderPriority); |
|
79 |
|
80 private: |
|
81 |
|
82 /** |
|
83 * The list of clock alarms. Note that although there is always 8 |
|
84 * alarms in this list, not all will be active. |
|
85 */ |
|
86 RPointerArray<TASShdAlarm> iClockAlarms; |
|
87 |
|
88 /** |
|
89 * |
|
90 */ |
|
91 RASCliSession iAlmSvr; |
|
92 |
|
93 /** |
|
94 * |
|
95 */ |
|
96 TRequestStatus iStatus; |
|
97 |
|
98 /** |
|
99 * |
|
100 */ |
|
101 RArray<TAlarmId> iNextAlarmIds; |
|
102 |
|
103 /** |
|
104 * |
|
105 */ |
|
106 RArray<TAlarmId> iReviewAlarmIds; |
|
107 }; |
|
108 |
|
109 |
|
110 TInt CAlmModel::UnacknowledgedAlarmNumber() const |
|
111 { |
|
112 TInt count = iAlmSvr.AlarmCountByState(EAlarmStateWaitingToNotify); |
|
113 return (count + iAlmSvr.AlarmCountByState(EAlarmStateNotifying)); |
|
114 } |
|
115 |
|
116 void CAlmModel::AlarmQuietPeriodCancel() |
|
117 { |
|
118 iAlmSvr.CancelAlarmSilence(); |
|
119 } |
|
120 |
|
121 #endif |
|