|
1 /* |
|
2 * Copyright (c) 2008-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CCHUIAPIIMPL_H |
|
20 #define C_CCHUIAPIIMPL_H |
|
21 |
|
22 #include <cch.h> |
|
23 #include <e32base.h> |
|
24 #include <cchuiobserver.h> |
|
25 |
|
26 #include "mcchuinoteresultobserver.h" |
|
27 |
|
28 class CCchUiSpsHandler; |
|
29 class CCchUiCchHandler; |
|
30 class CCCHUiNoteHandler; |
|
31 class CCchUiClientObserver; |
|
32 class CCchUiConnectionHandler; |
|
33 |
|
34 /** |
|
35 * CchUiApiImpl class |
|
36 * Implementation class for CchUiApi. |
|
37 * Do the actual things of CchUiApi |
|
38 * |
|
39 * @since @since S60 5.0 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CCchUiApiImpl ) : public CBase, |
|
42 public MCchUiNoteResultObserver, |
|
43 public MCchServiceStatusObserver |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @param aObserver reference to observer insterested in CCH UI events |
|
50 */ |
|
51 static CCchUiApiImpl* NewL( CCch& aCch ); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 virtual ~CCchUiApiImpl(); |
|
57 |
|
58 /** |
|
59 * Adds observer for listening cchui events. |
|
60 * |
|
61 * @since S60 5.0 |
|
62 * @param aObserver Event observing class |
|
63 */ |
|
64 void AddObserverL( MCchUiObserver& aObserver ); |
|
65 |
|
66 /** |
|
67 * Removes the observer of cchui events. |
|
68 * |
|
69 * @since S60 5.0 |
|
70 * @param aObserver Event observing class |
|
71 */ |
|
72 void RemoveObserver( MCchUiObserver& aObserver ); |
|
73 |
|
74 /** |
|
75 * Shows specific dialog or note. |
|
76 * |
|
77 * @since S60 5.0 |
|
78 * @param aServiceId service id of the service that the |
|
79 * note is shown for. Service id is used to fetch |
|
80 * service specific data. |
|
81 * @param aDialog specifies dialog to be shown |
|
82 */ |
|
83 void ShowDialogL( |
|
84 TUint32 aServiceId, |
|
85 MCchUiObserver::TCchUiDialogType aDialog ); |
|
86 |
|
87 /** |
|
88 * Configures visualization params. |
|
89 * |
|
90 * @since S60 5.0 |
|
91 * @param aAllowedNotes array of allowed notes |
|
92 * @param aAllowedSubServices allowed sub services |
|
93 * @return None |
|
94 */ |
|
95 void ConfigureVisualizationL( |
|
96 RArray<MCchUiObserver::TCchUiDialogType>& aAllowedNotes, |
|
97 RArray<TCCHSubserviceType>& aAllowedSubServices ); |
|
98 |
|
99 /** |
|
100 * Cancels all notes. Same behaviour can be achieved by deleting |
|
101 * this instance. Client can use this method to dismiss note and keep this |
|
102 * API instance in order to show some other notes in the future. |
|
103 * If there is nothing to dismiss, call to this method does nothing. |
|
104 * |
|
105 * @since S60 5.0 |
|
106 */ |
|
107 void CancelNotes(); |
|
108 |
|
109 /** |
|
110 * Starts observing events for specific service defined by aServiceId |
|
111 * |
|
112 * @since S60 5.0 |
|
113 * @param aService, service identifier |
|
114 * @param aEnableResult, enable result error code |
|
115 */ |
|
116 void ManualEnableResultL( TUint aServiceId, TInt aEnableResult ); |
|
117 |
|
118 |
|
119 // from base class MCchUiNoteResultObserver |
|
120 |
|
121 /** |
|
122 * From MCchUiNoteResultObserver. |
|
123 * Called when certain dialog has completed without errors. |
|
124 * |
|
125 * @since S60 5.0 |
|
126 * @param aCompleteCode Complete code. |
|
127 * @param aResultParams Result params of the dialog. |
|
128 */ |
|
129 void DialogCompletedL( |
|
130 TInt aCompleteCode, |
|
131 TCCHUiNotifierParams aResultParams ); |
|
132 |
|
133 // from base class MCchServiceStatusObserver |
|
134 |
|
135 /** |
|
136 * Observer implementation for service specific events. |
|
137 * by aServiceId. |
|
138 * |
|
139 * @since S60 5.0 |
|
140 * @param aServiceId service id |
|
141 * @param aType sub service type |
|
142 * @param aServiceStatus service status |
|
143 */ |
|
144 void ServiceStatusChanged( |
|
145 TInt aServiceId, |
|
146 TCCHSubserviceType aType, |
|
147 const TCchServiceStatus& aServiceStatus ); |
|
148 |
|
149 protected: // constructor |
|
150 |
|
151 CCchUiApiImpl(); |
|
152 |
|
153 void ConstructL( CCch& aCch ); |
|
154 |
|
155 protected: // functions |
|
156 /** |
|
157 * Handles authentication failed dialog result. |
|
158 * |
|
159 * @since S60 5.0 |
|
160 * @param aCompleteCode Complete code of the dialog. |
|
161 * @param aResultParams Result parameters from the dialog. |
|
162 */ |
|
163 void DoHandleAuthenticationFailedCompleteL( |
|
164 TInt aCompleteCode, |
|
165 TCCHUiNotifierParams aResultParams ); |
|
166 |
|
167 /** |
|
168 * Handles no connections dialog result. |
|
169 * |
|
170 * @since S60 5.0 |
|
171 * @param aCompleteCode Complete code of the dialog. |
|
172 * @param aResultParams Result parameters from the dialog. |
|
173 */ |
|
174 void DoHandleNoConnectionsCompleteL( |
|
175 TInt aCompleteCode, |
|
176 TCCHUiNotifierParams aResultParams ); |
|
177 |
|
178 /** |
|
179 * Handles change connection confirmation note result. |
|
180 * |
|
181 * @since S60 5.0 |
|
182 * @param aCompleteCode Complete code of the dialog. |
|
183 * @param aResultParams Result parameters from the dialog. |
|
184 */ |
|
185 void DoHandleConfirmChangeConnectionCompleteL( |
|
186 TInt aCompleteCode, |
|
187 TCCHUiNotifierParams aResultParams ); |
|
188 |
|
189 /** |
|
190 * Handles change connection query result. |
|
191 * |
|
192 * @since S60 5.0 |
|
193 * @param aCompleteCode Complete code of the dialog. |
|
194 * @param aResultParams Result parameters from the dialog. |
|
195 */ |
|
196 void DoHandleChangeConnectionCompleteL( |
|
197 TInt aCompleteCode, |
|
198 TCCHUiNotifierParams aResultParams ); |
|
199 |
|
200 /** |
|
201 * Handles service specific error. |
|
202 * |
|
203 * @since S60 5.0 |
|
204 * @param aServiceId service id |
|
205 * @param aType subservice type |
|
206 * @param aServiceStatus service status |
|
207 */ |
|
208 void DoHandleServiceErrorL( |
|
209 TInt aServiceId, |
|
210 TCCHSubserviceType aType, |
|
211 const TCchServiceStatus& aServiceStatus ); |
|
212 |
|
213 /** |
|
214 * Handles service specific status event. |
|
215 * |
|
216 * @since S60 5.0 |
|
217 * @param aServiceId service id |
|
218 * @param aType subservice type |
|
219 * @param aServiceStatus service status |
|
220 */ |
|
221 void DoHandleServiceEventL( |
|
222 TInt aServiceId, |
|
223 TCCHSubserviceType aType, |
|
224 const TCchServiceStatus& aServiceStatus ); |
|
225 |
|
226 /** |
|
227 * Handles search wlan dialog result. |
|
228 * |
|
229 * @since S60 5.0 |
|
230 * @param aCompleteCode Complete code of the dialog. |
|
231 * @param aResultParams Result parameters from the dialog. |
|
232 */ |
|
233 void HandleSearchWlanCompleteL( |
|
234 TInt& aCompleteCode, |
|
235 TCCHUiNotifierParams& aResultParams ); |
|
236 |
|
237 /** |
|
238 * Handles search access points error code. |
|
239 * |
|
240 * @since S60 5.0 |
|
241 * @param aErr error code to handle. |
|
242 * @param aCompleteCode Complete code of the dialog. |
|
243 * @param aResultParams Result parameters from the dialog. |
|
244 */ |
|
245 void HandleSearchAccessPointsErrorL( |
|
246 TInt aErr, |
|
247 TInt& aCompleteCode, |
|
248 TCCHUiNotifierParams& aResultParams ); |
|
249 |
|
250 /** |
|
251 * Handles search wlan dialog result when use gprs selected. |
|
252 * |
|
253 * @since S60 5.0 |
|
254 * @param aCompleteCode Complete code of the dialog. |
|
255 * @param aResultParams Result parameters from the dialog. |
|
256 */ |
|
257 void HandleCopyGprsCompleteL( |
|
258 TInt& aCompleteCode, |
|
259 TCCHUiNotifierParams& aResultParams ); |
|
260 |
|
261 /** |
|
262 * Handle changing to new connection. |
|
263 * |
|
264 * @since S60 5.0 |
|
265 * @param aCompleteCode Complete code of the dialog. |
|
266 * @param aResultParams Result parameters from the dialog. |
|
267 */ |
|
268 void HandleChangeConnectionL( |
|
269 TInt& aCompleteCode, |
|
270 TCCHUiNotifierParams& aResultParams ); |
|
271 |
|
272 /** |
|
273 * Informs event to all observers. |
|
274 * |
|
275 * @since S60 5.0 |
|
276 * @param aServiceId service id. |
|
277 */ |
|
278 void InformObserversL( TInt aServiceId ); |
|
279 |
|
280 /** |
|
281 * Checks if specific dialog is allowed. If client has not configured, |
|
282 * all dialogs are allowed. |
|
283 * |
|
284 * @since S60 5.0 |
|
285 * @param aDialog dialog to be checked. |
|
286 * @return TBool, ETrue if aDialog is allowed |
|
287 */ |
|
288 TBool DialogIsAllowed( MCchUiObserver::TCchUiDialogType aDialog ); |
|
289 |
|
290 /** |
|
291 * Checks if specific sub service is allowed. If client has not configured, |
|
292 * only voip sub service is allowed. |
|
293 * |
|
294 * @since S60 5.0 |
|
295 * @param aSubService sub service to be checked. |
|
296 * @return TBool, ETrue if aSubService is allowed |
|
297 */ |
|
298 TBool SubServiceIsAllowed( TCCHSubserviceType aSubService ); |
|
299 |
|
300 /** |
|
301 * Checks subservice state is allowed for showing dialogs. |
|
302 * |
|
303 * @since S60 5.0 |
|
304 * @param aState sub service state |
|
305 * @return TBool, ETrue if state is allowed for showing dialogs |
|
306 */ |
|
307 TBool StateIsAllowed( const TCCHSubserviceState aState ); |
|
308 |
|
309 /** |
|
310 * Handles re-enabling of service. |
|
311 * |
|
312 * @since S60 5.0 |
|
313 * @param aServiceId service id |
|
314 */ |
|
315 void HandleServiceReEnablingL( TUint aServiceId ); |
|
316 |
|
317 /** |
|
318 * Handles manual enable errors. |
|
319 * |
|
320 * @since S60 5.0 |
|
321 * @param aService, service identifier |
|
322 * @param aEnableResult, enable result error code |
|
323 */ |
|
324 void HandleManualEnableErrorL( TUint aServiceId, TInt aEnableResult ); |
|
325 |
|
326 private: // data |
|
327 |
|
328 /** |
|
329 * Array of encapsulated observers (clients) |
|
330 * Own. |
|
331 */ |
|
332 RPointerArray<CCchUiClientObserver> iObservers; |
|
333 |
|
334 /** |
|
335 * CCH handler. |
|
336 * Own. |
|
337 */ |
|
338 CCchUiCchHandler* iCCHHandler; |
|
339 |
|
340 /** |
|
341 * Controller class for dialogs. |
|
342 * Own. |
|
343 */ |
|
344 CCCHUiNoteHandler* iNoteController; |
|
345 |
|
346 /** |
|
347 * Service settings handler. |
|
348 * Own. |
|
349 */ |
|
350 CCchUiSpsHandler* iSpsHandler; |
|
351 |
|
352 /** |
|
353 * Connection handler. Handles iaps & snaps. |
|
354 * Own. |
|
355 */ |
|
356 CCchUiConnectionHandler* iConnectionHandler; |
|
357 |
|
358 /** |
|
359 * Own. Stores service ids of the monitored services |
|
360 */ |
|
361 RArray<TUint> iObservervedServices; |
|
362 |
|
363 /** |
|
364 * Own. Stores allowed notes (client provided) |
|
365 */ |
|
366 RArray<MCchUiObserver::TCchUiDialogType> iAllowedNotes; |
|
367 |
|
368 /** |
|
369 * Own. Stores allowed sub services (client provided) |
|
370 */ |
|
371 RArray<TCCHSubserviceType> iAllowedSubServices; |
|
372 |
|
373 /** |
|
374 * Flag for indicating if re-enabling of service needs |
|
375 * after service disabled event. |
|
376 */ |
|
377 TBool iReEnableService; |
|
378 |
|
379 /** |
|
380 * For iap id which can be removed when change connection |
|
381 * performed succesfully. |
|
382 */ |
|
383 TInt iRemovableConnection; |
|
384 |
|
385 /** |
|
386 * Service which we have added cch observer. |
|
387 */ |
|
388 TInt iObservedService; |
|
389 |
|
390 /** |
|
391 * Stores last cchui operation result. |
|
392 */ |
|
393 MCchUiObserver::TCchUiOperationResult iLastOperationResult; |
|
394 |
|
395 CCHUI_UNIT_TEST( UT_CchUi ) |
|
396 }; |
|
397 |
|
398 #endif // C_CCHUIAPIIMPL_H |
|
399 |
|
400 |