|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Defines class CNcnMsgWaitingManager. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CNCNMSGWAITINGMANAGER_H |
|
21 #define CNCNMSGWAITINGMANAGER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "MNcnMsgWaitingManager.h" |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <etelmm.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CNcnModelBase; |
|
31 #ifdef _DEBUG |
|
32 class CNcnMsgWaitingManagerObserver; |
|
33 #endif |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * CNcnMsgWaitingManager is responsible of handling |
|
39 * message related indicators and counts. It uses |
|
40 * ETEL MM API to store indicator and message count values. |
|
41 */ |
|
42 class CNcnMsgWaitingManager : |
|
43 public CActive, |
|
44 public MNcnMsgWaitingManager |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @param aModel Reference to ncn model |
|
51 */ |
|
52 static CNcnMsgWaitingManager* NewL( CNcnModelBase &aModel ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CNcnMsgWaitingManager(); |
|
58 |
|
59 public: // From CActive |
|
60 |
|
61 /** |
|
62 * RunL |
|
63 */ |
|
64 void RunL(); |
|
65 |
|
66 /** |
|
67 * RunError |
|
68 * @param aError the error returned |
|
69 * @return error |
|
70 */ |
|
71 TInt RunError( TInt aError ); |
|
72 |
|
73 /** |
|
74 * DoCancel |
|
75 */ |
|
76 void DoCancel(); |
|
77 |
|
78 public: // From MNcnMsgWaitingManager |
|
79 |
|
80 /** |
|
81 * SetIndicator |
|
82 * Method is used to enable / disable indicator. |
|
83 * @param aIndicator Id of the indicator that should be enabled / disabled. See MNcnMsgWaitingManager for ids. |
|
84 * @param aEnable ETrue if indicator should be enabled. |
|
85 * @return error |
|
86 */ |
|
87 TInt SetIndicator( const TNcnIndicator aIndicator, TBool aEnable ); |
|
88 |
|
89 /** |
|
90 * SetMessageCount |
|
91 * Method is used to store new message count for certain message types. |
|
92 * @param aMsgType Message type which count is updated. See MNcnMsgWaitingManager for ids. |
|
93 * @param aCount Number of new messages. |
|
94 * @param aEnableIndicator ETrue if indicator should be enabled for certain message type. |
|
95 * @return error |
|
96 */ |
|
97 TInt SetMessageCount( const TNcnMessageType aMsgType, TUint aCount, TBool aEnableIndicator ); |
|
98 |
|
99 /** |
|
100 * GetIndicator |
|
101 * Method returns indicator status (enabled/disabled). |
|
102 * @param aIndicator Indicator id. See MNcnMsgWaitingManager for ids. |
|
103 * @param aEnabled ETrue if indicator is enabled. |
|
104 * @return error |
|
105 */ |
|
106 TInt GetIndicator( const TNcnIndicator aIndicator, TBool& aEnabled ); |
|
107 |
|
108 /** |
|
109 * GetMessageCount |
|
110 * Method returns new message count for certain message type |
|
111 * @param aMsgType Message type. See MNcnMsgWaitingManager for ids. |
|
112 * @param aCount Number of new messages. |
|
113 * @return error |
|
114 */ |
|
115 TInt GetMessageCount( const TNcnMessageType aMsgType, TUint& aCount ); |
|
116 |
|
117 /** |
|
118 * ConstructionReady |
|
119 * Returns ETrue, if initial settings have been read from RMobilePhone. Otherwise returns EFalse. |
|
120 */ |
|
121 TBool ConstructionReady(); |
|
122 |
|
123 /** |
|
124 * GetFirstIndicatorStatus |
|
125 * Indicator statuses are fetched only after SIM has been verified to be in the ESimUsable state. |
|
126 */ |
|
127 void GetFirstIndicatorStatus(); |
|
128 |
|
129 |
|
130 private: // Constructors and destructor |
|
131 |
|
132 /** |
|
133 * C++ default constructor. |
|
134 * @param aMsvSessionHandler Msv session handler reference. |
|
135 */ |
|
136 CNcnMsgWaitingManager( CNcnModelBase &aModel ); |
|
137 |
|
138 /** |
|
139 * 2nd. phase constructor. |
|
140 */ |
|
141 void ConstructL( ); |
|
142 |
|
143 private: // Type definitions |
|
144 |
|
145 /** |
|
146 * Current state indicating what kind of operation is on-going. |
|
147 */ |
|
148 enum TNcnWaitingManagerState |
|
149 { |
|
150 ENcnIdle, |
|
151 ENcnGetIndicator, |
|
152 ENcnSetIndicator, |
|
153 ENcnSetCount, |
|
154 ENcnGetCount, |
|
155 ENcnNotifyMsgWaiting |
|
156 }; // TNcnWaitingManagerState |
|
157 |
|
158 /** |
|
159 * Work Queue element. |
|
160 */ |
|
161 struct TNcnReqQueueElement |
|
162 { |
|
163 TNcnReqQueueElement(TNcnWaitingManagerState aCmd, TInt aField, TBool aParam1, TUint aParam2 = 0 ) |
|
164 { |
|
165 iCmd = aCmd; |
|
166 iField = aField; |
|
167 iParam1 = aParam1; |
|
168 iParam2 = aParam2; |
|
169 } |
|
170 |
|
171 TNcnWaitingManagerState iCmd; |
|
172 TInt iField; // See TNcnIndicator or TNcnMessageType in MNcnMsgWaitingManager |
|
173 TBool iParam1; // ETrue/EFalse if indicator should be enabled |
|
174 TUint iParam2; // Used only for count operations. Tells if indicator should be enabled/disabled. |
|
175 }; // TNcnReqQueueElement |
|
176 |
|
177 private: // Internal methods. |
|
178 |
|
179 /** |
|
180 * Enable / disable indicator |
|
181 */ |
|
182 void DoSetIndicator( TInt aId, TBool aEnable ); |
|
183 |
|
184 private: // Data |
|
185 |
|
186 // Current state |
|
187 TNcnWaitingManagerState iState; |
|
188 |
|
189 // Reference to ncn model |
|
190 CNcnModelBase &iModel; |
|
191 |
|
192 // Needed to initialize iMobilePhone |
|
193 RTelServer iTelServer; |
|
194 |
|
195 // Needed to initialize iMobilePhone |
|
196 RTelServer::TPhoneInfo iPhoneInfo; |
|
197 |
|
198 // Used to store indicator flags and message counts. |
|
199 RMobilePhone iMobilePhone; |
|
200 |
|
201 // Struct is a container for indicator flags and message counts |
|
202 RMobilePhone::TMobilePhoneMessageWaitingV1 iMsgWaiting; |
|
203 |
|
204 // Package for iMsgWaitingV1 |
|
205 RMobilePhone::TMobilePhoneMessageWaitingV1Pckg iMsgWaitingPckg; |
|
206 |
|
207 // Request Queue |
|
208 RArray<TNcnReqQueueElement> iReqQueue; |
|
209 |
|
210 #ifdef _DEBUG |
|
211 |
|
212 CNcnMsgWaitingManagerObserver *iObserver; |
|
213 #endif |
|
214 |
|
215 TBool iConstructionReady; |
|
216 |
|
217 }; // CNcnMsgWaitingManager |
|
218 |
|
219 #endif // CNCNMSGWAITINGMANAGER_H |
|
220 |
|
221 // End of File |