|
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 an abstract class CNcnModelBase. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCNMODELBASE_H |
|
20 #define NCNMODELBASE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "NcnDebug.h" |
|
24 #include "MNcnUI.h" |
|
25 #include "MNcnNotifier.h" |
|
26 #include <e32base.h> |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 /* |
|
31 * The internal status bits of ncn model are defined here. |
|
32 * The status information is intended to be stored in bits of one unsigned integer |
|
33 * so that each status is presented by one bit. |
|
34 */ |
|
35 const TUint8 KNcnIdleState = 0x04; // The current status of idle state (yes or no) |
|
36 const TUint8 KNcnSmsServicePresent = 0x08; // If the sms service is present and operational |
|
37 const TUint8 KNcnSimChanged = 0x10; // Has the sim card changed between the last two boots |
|
38 const TUint8 KNcnSimServiceCentreFetched = 0x20; // Indicates if the sim sc operation was performed |
|
39 const TUint8 KNcnBootPhase = 0x40; // Indicates if the ncn is still in its construction phase |
|
40 const TUint8 KNcnSystemRefresh = 0x80; // Indicates if system refresh is needed and |
|
41 // sim sc operation is performed. |
|
42 const TUint KNcnLastVmi = 0x100; // Last line vmi arrived: 0 = line1, 1 = line 2 |
|
43 const TUint KNcnArrayCleared = 0x200; |
|
44 const TUint KNcnReadSimSc = 0x400; // If set SIM service center number is refreshed in boot |
|
45 |
|
46 const TUint KNcnOfflineSupport = 0x01; // Flag for offline support |
|
47 const TUint KNcnSendFileInCall = 0x04; // Flag for SFI support |
|
48 const TUint KNcnIdSimCard = 0x08; // Flag for SIM-card support |
|
49 const TUint KNcnAudioMessaging = 0x10; // Flag for Audio messaging support |
|
50 |
|
51 // FORWARD DECLARATIONS |
|
52 class CNcnMsvSessionObserverBase; |
|
53 class CNcnCRHandler; |
|
54 class CNcnSNNotifier; |
|
55 class CNcnPublishAndSubscribeObserver; |
|
56 class CNcnOutboxObserver; |
|
57 class MNcnNotificationObserver; |
|
58 class CNcnHandlerAudio; |
|
59 class CMsgSimOperation; |
|
60 class CNcnMsvSessionHandler; |
|
61 class CVoiceMailManager; |
|
62 class MNcnMsgWaitingManager; |
|
63 |
|
64 // CLASS DECLARATION |
|
65 |
|
66 /** |
|
67 * The main Ncn subsystem class |
|
68 */ |
|
69 class CNcnModelBase : public CActive |
|
70 { |
|
71 public: // Constructors and destructor |
|
72 |
|
73 // Types of messages to keep count |
|
74 enum |
|
75 { |
|
76 EIndexMissedCalls = 0, |
|
77 EIndexNewEmails, |
|
78 EIndexUnreadMessages, |
|
79 EIndexNewAudioMessages, |
|
80 EIndexLast |
|
81 }; |
|
82 public: // Constructors and destructor |
|
83 |
|
84 /** |
|
85 * Class factory. |
|
86 */ |
|
87 static CNcnModelBase* NewL(); |
|
88 |
|
89 /** |
|
90 * Destructor. |
|
91 */ |
|
92 virtual ~CNcnModelBase(); |
|
93 |
|
94 public: // New functions |
|
95 |
|
96 /** |
|
97 * The status of idle state is passed to the model through this method. |
|
98 * @param aCurrentState The current status of idle state (on/off). |
|
99 */ |
|
100 void SetIdleState( const TBool aCurrentState ); |
|
101 |
|
102 /** |
|
103 * Stores indicator status to file |
|
104 * @param aVariable |
|
105 * @param aState |
|
106 */ |
|
107 void StoreIndicatorStatus( const TUid& aVariable, const TInt aState ); |
|
108 |
|
109 /** |
|
110 * Notifies Publish and Subscribe. |
|
111 * @param aVariable |
|
112 * @param aState |
|
113 */ |
|
114 void NotifyPublishAndSubscribe( const TUid& aVariable, const TInt aState ); |
|
115 |
|
116 /** |
|
117 * Notifies Publish and Subscribe. |
|
118 * @param aCategory |
|
119 * @param aVariable |
|
120 * @param aState |
|
121 */ |
|
122 void NotifyPublishAndSubscribe( const TUid& aCategory, const TUid& aVariable, const TInt aState ); |
|
123 |
|
124 /** |
|
125 * Notifies Publish and Subscribe. |
|
126 * @param aCategory |
|
127 * @param aVariable |
|
128 * @param aState |
|
129 */ |
|
130 void NotifyPublishAndSubscribe( const TUid& aCategory, const TUint aVariable, const TInt aState ); |
|
131 |
|
132 /** |
|
133 * Stores indicator status to file and notifies Publish and Subscribe |
|
134 * @param aVariable |
|
135 * @param aState |
|
136 */ |
|
137 void StoreIndicatorStatusAndNotifyPublishAndSubscribe( const TUid& aVariable, const TInt aState ); |
|
138 |
|
139 /** |
|
140 * By this method the model is being told that the SMS service is present. |
|
141 */ |
|
142 void SmsServicePresent( const TBool aSmsServicePresent ); |
|
143 |
|
144 /** |
|
145 * Checks if the offered feature is supported. |
|
146 */ |
|
147 TBool IsSupported( TUint aFeature ) const; |
|
148 |
|
149 /** |
|
150 * Stops playing of soundfile |
|
151 */ |
|
152 void StopMsgReceivedTonePlaying(); |
|
153 |
|
154 /** |
|
155 * Inform playing state to Shared Data |
|
156 */ |
|
157 void MsgReceivedTonePlaying( TUint aAlertTonePlaying ); |
|
158 |
|
159 /** |
|
160 * Turns on specified feature flag |
|
161 */ |
|
162 void AddLocalVariationSupport( TUint aFeature ); |
|
163 |
|
164 /** |
|
165 * Sends message to offline sender of new network status |
|
166 * @since Series60 2.6 |
|
167 */ |
|
168 void NotifyOfflineSenderL( const TInt& aNetworkBars ); |
|
169 |
|
170 /** |
|
171 * Fetches given string for Uid |
|
172 * @since Series60 3.0 |
|
173 */ |
|
174 TInt GetCRString( |
|
175 const TUid& aUid, |
|
176 const TUint32 aKey, |
|
177 TDes& aValue ) const; |
|
178 |
|
179 /** |
|
180 * Fetches given P&S string for Uid |
|
181 * @since Series60 3.0 |
|
182 */ |
|
183 TInt GetPSString( |
|
184 const TUid& aUid, |
|
185 const TUint32 aKey, |
|
186 TDes& aValue ) const; |
|
187 |
|
188 /** |
|
189 * Fetches given integer value for Uid |
|
190 * @since Series60 3.0 |
|
191 */ |
|
192 TInt GetCRInteger( |
|
193 const TUid& aUid, |
|
194 const TUint32 aKey, |
|
195 TInt& aValue) const; |
|
196 |
|
197 /** |
|
198 * Sets new value for CR key. |
|
199 * @param aUid Uid to be used |
|
200 * @param aKey Which value is to be stored |
|
201 * @param aValue New value to be stored |
|
202 * @return System wide error. KErrNone when no errors. |
|
203 */ |
|
204 TInt SetCRInt( const TUid& aUid, |
|
205 const TUint32& aKey, |
|
206 TInt& aValue ) const; |
|
207 |
|
208 /** |
|
209 * Plays the alert tone provided in parameter |
|
210 * @since Series60 2.6 |
|
211 * @param aAlertTone Sound to be played |
|
212 * @return result of playing. KErrNone when no errors. |
|
213 */ |
|
214 TInt PlayAlertToneL( const TUint aAlertTone ) const; |
|
215 |
|
216 /** |
|
217 * This method turns the SIM card support on/off. If this method |
|
218 * is never called, model will assume sim card is not supported. |
|
219 * @since Series60 2.8 |
|
220 * @param aSimSupported Information regarding current SIM card |
|
221 * support status |
|
222 */ |
|
223 void SetSimSupported( const TBool aSimSupported ); |
|
224 |
|
225 /** |
|
226 * Get SIM status. Is SIM present or not |
|
227 * @since Series60 3.1 |
|
228 * @return True if SIM is present |
|
229 */ |
|
230 TBool IsSIMPresent(); |
|
231 |
|
232 /** |
|
233 * This method returns a reference to the notification API observer. |
|
234 * @return observer reference |
|
235 */ |
|
236 MNcnNotificationObserver& NotificationObserver(); |
|
237 |
|
238 /** |
|
239 * Returns a reference to Msv session handler. |
|
240 * @return A reference to Msv session handler. |
|
241 */ |
|
242 CNcnMsvSessionHandler& MsvSessionHandler(); |
|
243 |
|
244 /** |
|
245 * Returns a reference to Ncn UI. |
|
246 * @return A reference to Ncn UI. |
|
247 */ |
|
248 MNcnUI& NcnUI(); |
|
249 |
|
250 /** |
|
251 * Returns a reference to Ncn notifier. |
|
252 * @return A reference to Ncn notifier. |
|
253 */ |
|
254 MNcnNotifier& NcnNotifier(); |
|
255 |
|
256 /** |
|
257 * Returns a reference to Message Waiting Manager |
|
258 * @return A reference to Message Waiting Manager. |
|
259 */ |
|
260 MNcnMsgWaitingManager& MsgWaitingManager(); |
|
261 |
|
262 /** |
|
263 * Returns a reference to Voicemail Manager |
|
264 * @return A reference to Voicemail Manager. |
|
265 */ |
|
266 CVoiceMailManager& VoiceMailManager(); |
|
267 |
|
268 |
|
269 public: // Virtual functions |
|
270 |
|
271 /** |
|
272 * Sim changed status is given by this method |
|
273 * @since Series60 2.6 |
|
274 * @param aSimChanged Information of current SIM state |
|
275 */ |
|
276 virtual void SetSimChanged( const TBool aSimChanged ) = 0; |
|
277 |
|
278 /** |
|
279 * By this method the model is being told about the current |
|
280 * SMS initialisation phase. |
|
281 * @since Series60 2.6 |
|
282 * @param aSmsInitialisationPhase Current initialisation state |
|
283 */ |
|
284 virtual void SetSmsInitialisationState( |
|
285 const TInt aSmsInitialisationPhase ) = 0; |
|
286 |
|
287 /** |
|
288 * This method performs the sim sms service centre fetching operation. |
|
289 * @since Series60 2.6 |
|
290 */ |
|
291 virtual void PerformSimServiceCentreFetching() = 0; |
|
292 |
|
293 /** |
|
294 * This method forces to call sms service centre fetching operation. |
|
295 * @since Series60 2.6 |
|
296 */ |
|
297 virtual void ForceToPerformSimServiceCentreFetching() = 0; |
|
298 |
|
299 /** |
|
300 * This method checks if the SMSC fetching is needed |
|
301 * @since Series60 2.6 |
|
302 */ |
|
303 virtual void CheckIfSimSCOperationRequired() = 0; |
|
304 |
|
305 protected: |
|
306 /** |
|
307 * C++ default constructor. |
|
308 */ |
|
309 CNcnModelBase(); |
|
310 |
|
311 /** |
|
312 * By default Symbian OS constructor is private. |
|
313 */ |
|
314 virtual void ConstructL(); |
|
315 |
|
316 /** |
|
317 * Cancels the request. |
|
318 */ |
|
319 virtual void DoCancel(); |
|
320 |
|
321 /** |
|
322 * Handles the event. |
|
323 */ |
|
324 virtual void RunL(); |
|
325 |
|
326 /** |
|
327 * Fetches the initial Sim support state from System Agent/ |
|
328 * Publish and Subscribe before the actual SA/PS observer |
|
329 * is created |
|
330 */ |
|
331 virtual void FetchInitialSimSupportStateL(); |
|
332 |
|
333 protected: // Virtual functions |
|
334 |
|
335 /** |
|
336 * Create Central repository connection |
|
337 * @since Series60 3.0 |
|
338 */ |
|
339 virtual void CreateCRConnectionL() = 0; |
|
340 |
|
341 protected: |
|
342 |
|
343 // Pointer to Msv session handler. Owned. |
|
344 CNcnMsvSessionHandler* iMsvSessionHandler; |
|
345 |
|
346 // Pointer to Ncn ui instance. Owned. |
|
347 MNcnUI* iNcnUI; |
|
348 |
|
349 // Pointer to Ncn notifier instance. Owned. |
|
350 MNcnNotifier* iNcnNotifier; |
|
351 |
|
352 //Manager for voice mail message handling |
|
353 CVoiceMailManager* iVoiceMailManager; |
|
354 |
|
355 //Manager for handling message indicators and counts. |
|
356 MNcnMsgWaitingManager* iMsgWaitingManager; |
|
357 |
|
358 // A pointer to the CNcnMsvSessionObserver instance. Owned. |
|
359 CNcnMsvSessionObserverBase* iNcnMsvSessionObserver; |
|
360 // A pointer to the CNcnCRHandler instance. Owned. |
|
361 CNcnCRHandler* iNcnCRHandler; |
|
362 // A pointer to the CNcnOutboxObserver instance. Owned. |
|
363 CNcnOutboxObserver* iNcnOutboxObserver; |
|
364 // A pointer to the MNcnNotificationObserver instance. Owned. |
|
365 MNcnNotificationObserver* iNcnNotificationObserver; |
|
366 // A pointer to the CNcnPublishAndSubscribeObserver instance. Owned. |
|
367 CNcnPublishAndSubscribeObserver* iNcnPublishAndSubscribeObserver; |
|
368 // By this class we perform the sim service centre fetching. Owmed. |
|
369 CMsgSimOperation* iMsgSimOperation; |
|
370 // Tells the sms initialisation phase. |
|
371 TInt iSmsInitialisationPhase; |
|
372 // The Ncn status bits are stored into this unsigned integer. |
|
373 TUint iNcnStatusBits; |
|
374 // Featurelist for ncnlist |
|
375 TUint iNcnFeatureFlags; |
|
376 |
|
377 private: |
|
378 |
|
379 /** |
|
380 * Checks if SIM service center number should be refreshed in boot. |
|
381 * @since Series60 3.0 |
|
382 */ |
|
383 void CheckIfSimSCShouldBeRead(); |
|
384 |
|
385 }; |
|
386 |
|
387 #endif // NCNMODELBASE_H |
|
388 |
|
389 // End of File |