|
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" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __TIMEWMOD_H__ |
|
17 #define __TIMEWMOD_H__ |
|
18 |
|
19 // System includes |
|
20 #include <e32base.h> |
|
21 |
|
22 // Constants |
|
23 const TInt KMaxClockAlarms = 8; |
|
24 |
|
25 /** |
|
26 * From the old T32Alm.h file. Encapsulates the idea of |
|
27 * a "Not set" alarm, which the new AlarmServer doesn't |
|
28 * support. |
|
29 */ |
|
30 enum TTimeWClockAlarmState |
|
31 { |
|
32 ETimeWClockAlarmStateNotSet = 0, |
|
33 ETimeWClockAlarmStateSet, |
|
34 ETimeWClockAlarmStateDisabled |
|
35 }; |
|
36 |
|
37 /** |
|
38 * |
|
39 */ |
|
40 enum TTimeWAlarmSoundState |
|
41 { |
|
42 ETimeWAlarmSoundOn = 0, |
|
43 ETimeWAlarmSoundOff, |
|
44 ETimeWAlarmQuietPeriod |
|
45 }; |
|
46 |
|
47 /** |
|
48 * |
|
49 */ |
|
50 enum TInternalClockAlarmFlags |
|
51 { |
|
52 EClockAlarmFlagsIsSet = 1 |
|
53 }; |
|
54 |
|
55 enum TModelPanic |
|
56 { |
|
57 EModelWorld = 0, |
|
58 EModelObserver, |
|
59 EModelOutOfRange, |
|
60 EModel |
|
61 }; |
|
62 enum TModelFault |
|
63 { |
|
64 EModelfIdleObj = 0, |
|
65 EModelfPriorityInvalid, |
|
66 EModelfIdleArgument, |
|
67 EModelfNoNotifier, |
|
68 EModelfOutOfRange, |
|
69 EModelfTime, |
|
70 EModelfTryingToChangeStateOfNullClockAlarm, |
|
71 EModelfTryingToGetInfoAboutNullClockAlarm, |
|
72 EModelfTryingToOrphanClockAlarm |
|
73 }; |
|
74 |
|
75 GLREF_C void Panic(TModelPanic aPanic); |
|
76 GLREF_C void Fault(TModelFault aFault); |
|
77 |
|
78 class MTimewModelObserver |
|
79 { |
|
80 public: |
|
81 virtual void HandleUpdate(TInt aNotification)=0; |
|
82 }; |
|
83 |
|
84 class CIntermediateObserver : public CBase, public MTimewModelObserver |
|
85 { |
|
86 public: |
|
87 CIntermediateObserver(); |
|
88 virtual void HandleUpdate(TInt aNotification); |
|
89 void SetTimewModelObserver(MTimewModelObserver* aObserver); |
|
90 protected: |
|
91 void Notify(TInt aNotification); |
|
92 private: |
|
93 MTimewModelObserver* iObserver; |
|
94 }; |
|
95 |
|
96 class CIdleObserver : public CIntermediateObserver |
|
97 { |
|
98 public: |
|
99 CIdleObserver(); |
|
100 ~CIdleObserver(); |
|
101 void ConstructL(MTimewModelObserver* aObserver,TInt aPriority); |
|
102 public: |
|
103 void CancelIdleRefresh(); |
|
104 virtual void HandleUpdate(TInt aNotification); |
|
105 protected: |
|
106 virtual void DoIdleCancel(); |
|
107 virtual void DoIdleNotify(); |
|
108 private: |
|
109 void StartIdleRefresh(); |
|
110 static TInt IdleCallBack(TAny* aPtr); |
|
111 private: |
|
112 TInt iNotification; |
|
113 CIdle* iIdle; |
|
114 }; |
|
115 |
|
116 class CModelResponder; |
|
117 class CModelBase : public CBase |
|
118 { |
|
119 protected: |
|
120 CModelBase(); |
|
121 |
|
122 public: |
|
123 ~CModelBase(); |
|
124 |
|
125 public: |
|
126 void Stop(); |
|
127 void Start(); |
|
128 void SetTimewModelObserver(MTimewModelObserver* aObserver); |
|
129 |
|
130 protected: |
|
131 void Notify(TInt aNotification); |
|
132 virtual void ProcessResponder(TInt aStatus)=0; |
|
133 void SetResponderActive(CModelResponder* aResponder); |
|
134 |
|
135 private: |
|
136 void DoObserverNotify(TInt aNotification); |
|
137 |
|
138 private: |
|
139 TBool iDoingViewNotify; |
|
140 MTimewModelObserver* iObserver; |
|
141 CModelResponder* iResponder; |
|
142 friend class CModelResponder; |
|
143 }; |
|
144 |
|
145 #endif |