|
1 /* |
|
2 * Copyright (c) 2002-20010 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: This class handles the communication between server and user |
|
15 * interface |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CSATUIOBSERVER_H |
|
21 #define CSATUIOBSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <msatuiobserver.h> |
|
25 #include <rsatuisession.h> |
|
26 #include <RSatSession.h> |
|
27 #include "satappcommonconstant.h" |
|
28 // CONSTANTS |
|
29 //256 max length-header information fields |
|
30 const TInt KAdditionalInfoMaxSize = 244; |
|
31 const TInt KMaxPlayToneLength = 50; |
|
32 |
|
33 enum TIconCommand |
|
34 { |
|
35 EIconSetUpMenuContext = 1, |
|
36 EIconSetUpMenuItems, |
|
37 EIconDisplayText, |
|
38 EIconGetInput, |
|
39 EIconGetInkey, |
|
40 EIconGetYesNo, |
|
41 EIconPlayTone, |
|
42 EIconNotification, |
|
43 EIconConfirmCommand |
|
44 }; |
|
45 |
|
46 // FORWARD DECLARATIONS |
|
47 class MSatUiAdapter; |
|
48 class MSatUiActionImplementer; |
|
49 class CSatUiIconHandler; |
|
50 class CFbsBitmap; |
|
51 |
|
52 // CLASS DECLARATION |
|
53 |
|
54 /** |
|
55 * This class implements the methods specified in the MSatUiObserver. |
|
56 */ |
|
57 |
|
58 class CSatUiObserver : public CBase, |
|
59 public MSatUiObserver |
|
60 { |
|
61 public: // Constructors and destructor |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 */ |
|
66 static CSatUiObserver* NewL(); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 virtual ~CSatUiObserver(); |
|
72 |
|
73 public: // New functions |
|
74 |
|
75 /** |
|
76 * Sets the UI. |
|
77 * @param aImplementer Pointer to be set. |
|
78 */ |
|
79 void SetImplementer(MSatUiActionImplementer* aImplementer); |
|
80 |
|
81 /** |
|
82 * Returns the adapter provided by SatCli. |
|
83 */ |
|
84 MSatUiAdapter* Adapter(); |
|
85 |
|
86 |
|
87 /** |
|
88 * Return current profile state. |
|
89 * @return current profile state. |
|
90 */ |
|
91 TInt ProfileState(); |
|
92 |
|
93 public: // Functions from base classes |
|
94 |
|
95 /** |
|
96 * From MSatUiObserver Notification of the SAT Display Text command. |
|
97 * @param aText The text string to be displayed. |
|
98 * @param aSimApplicationName Sim Application name |
|
99 * @param aIconId The id of icon. |
|
100 * @param aRequestedIconDisplayed Informs if icon is not used. |
|
101 * @param aSustainedText Indicates is this text sustained ie. no timers |
|
102 * used if ETrue. |
|
103 * @param aDuration Duration for showing the text |
|
104 * @param aWaitUserToClear Indication if user is needed to clear |
|
105 * message |
|
106 * @return The response to this command. |
|
107 */ |
|
108 TSatUiResponse DisplayTextL( const TDesC& aText, |
|
109 const TDesC& aSimApplicationName, |
|
110 const TSatIconId& aIconId, |
|
111 TBool& aRequestedIconDisplayed, |
|
112 const TBool aSustainedText, |
|
113 const TTimeIntervalSeconds aDuration, |
|
114 const TBool aWaitUserToClear ); |
|
115 |
|
116 /** |
|
117 * From MSatUiObserver Notification of the SAT Get Inkey command. |
|
118 * @param aText The query text. |
|
119 * @param aCharacterSet The character range allowed. |
|
120 * @param aInput The input character. |
|
121 * @param aHelpIsAvailable A flag indicating if SAT help is available |
|
122 * @param aIconId The id of icon. |
|
123 * @param aRequestedIconDisplayed Informs if icon is not used. |
|
124 * @param aDuration Duration for showing the dialog. |
|
125 * @param aImmediateDigitResponse Indication if Immediate digit response |
|
126 * is needed. |
|
127 * @return The response of to this command. |
|
128 */ |
|
129 TSatUiResponse GetInkeyL( const TDesC& aText, |
|
130 const TSatCharacterSet aCharacterSet, TChar& aInput, |
|
131 const TBool aHelpIsAvailable, |
|
132 const TSatIconId& aIconId, |
|
133 TBool& aRequestedIconDisplayed, |
|
134 TUint& aDuration, |
|
135 const TBool aImmediateDigitResponse ); |
|
136 |
|
137 /** |
|
138 * From MSatUiObserver Notification of the SAT Get Input command. |
|
139 * @param aText The query text. |
|
140 * @param aCharacterSet The character range allowed. |
|
141 * @param aInput The input string. |
|
142 * @param aMinLength The minimum length of the input allowed. |
|
143 * @param aMaxLength The maximum length of the input allowed. |
|
144 * @param aHideInput A flag indicating if the input should be hidden. |
|
145 * @param aHelpIsAvailable A flag indicating if SAT help is available. |
|
146 * @param aIconId The id of icon. |
|
147 * @param aRequestedIconDisplayed Informs if icon is not used. |
|
148 * @return The response to this command. |
|
149 */ |
|
150 TSatUiResponse GetInputL( const TDesC& aText, |
|
151 const TSatCharacterSet aCharacterSet, TDes& aInput, |
|
152 const TInt aMinLength, const TInt aMaxLength, |
|
153 const TBool aHideInput, |
|
154 const TBool aHelpIsAvailable, |
|
155 const TSatIconId& aIconId, |
|
156 TBool& aRequestedIconDisplayed ); |
|
157 |
|
158 /** |
|
159 * From MSatUiObserver Notification of the SAT Set Up Menu command. |
|
160 * @param aText The title text. |
|
161 * @param aMenuItems The array of menu item captions. |
|
162 * @param aMenuItemNextActions The array of menu item next action |
|
163 * indicator codes. |
|
164 * @param aHelpIsAvailable A flag indicating if SAT help is available. |
|
165 * @param aIconId The id of title icon. |
|
166 * @param aMenuIcons List of icon identifiers for menu items. |
|
167 * @param aIconListQualifier Indicates how to use icons in the icon list. |
|
168 * @param aSelectionPreference Specifies is the soft keys preferred. |
|
169 * @return The response to this command. |
|
170 */ |
|
171 TSatUiResponse SetUpMenuL( const TDesC& aText, |
|
172 const MDesCArray& aMenuItems, |
|
173 const CArrayFixFlat<TSatAction>* aMenuItemNextActions, |
|
174 const TBool aHelpIsAvailable, |
|
175 const TSatIconId& aIconId, |
|
176 const CArrayFixFlat<TInt>* aMenuIcons, |
|
177 const enum TSatIconQualifier aIconListQualifier, |
|
178 const enum TSatSelectionPreference aSelectionPreference ); |
|
179 |
|
180 /** |
|
181 * From MSatUiObserver Notification of the SAT Select Item command. |
|
182 * @param aText The title text. |
|
183 * @param aMenuItems The array of menu item captions. |
|
184 * @param aMenuItemNextActions The array of menu item next action |
|
185 * indicator codes. |
|
186 * @param aDefaultItem The item selected by default. |
|
187 * @param aSelection The item index selected by the user. |
|
188 * @param aHelpIsAvailable A flag indicating if help is available. |
|
189 * @param aIconId The id of title icon. |
|
190 * @param aMenuIcons List of icon identifiers for menu items. |
|
191 * @param aIconListQualifier Indicates how to use icons in the icon list. |
|
192 * @param aRequestedIconDisplayed Informs if icon is not used. |
|
193 * @param aSelectionPreference Specifies is the soft keys preferred. |
|
194 * @return The response to this command. |
|
195 */ |
|
196 TSatUiResponse SelectItemL( const TDesC& aText, |
|
197 const MDesCArray& aMenuItems, |
|
198 const CArrayFixFlat<TSatAction>* aMenuItemNextActions, |
|
199 const TInt aDefaultItem, TUint8& aSelection, |
|
200 const TBool aHelpIsAvailable, |
|
201 const TSatIconId& aIconId, |
|
202 const CArrayFixFlat<TInt>* aMenuIcons, |
|
203 const enum TSatIconQualifier aIconListQualifier, |
|
204 TBool& aRequestedIconDisplayed, |
|
205 const enum TSatSelectionPreference aSelectionPreference ); |
|
206 |
|
207 /** |
|
208 * From MSatUiObserver Notification of the SAT Play Tone command. |
|
209 * @param aText The text to be displayed. |
|
210 * @param aTone The tone to be played. |
|
211 * @param aDuration The duration of the tone to be played. |
|
212 * @param aIconId The id of icon. |
|
213 * @param aRequestedIconDisplayed Informs if icon is not used. |
|
214 * @return The response to this command. |
|
215 */ |
|
216 TSatUiResponse PlayTone( const TDesC& aText, |
|
217 const TSatTone aTone, |
|
218 const TTimeIntervalMicroSeconds aDuration, |
|
219 const TSatIconId& aIconId, |
|
220 TBool& aRequestedIconDisplayed ); |
|
221 |
|
222 /** |
|
223 * From MSatUiObserver General confirmation request |
|
224 * @param aCommandId ID of the quering command |
|
225 * @param aAlphaIdStatus Alpha Identifier status |
|
226 * @param aText The text to be displayed. |
|
227 * @param aAdditionalText Additional text to be used in queries. |
|
228 * @param aActionAccepted Indicates whether the command was accepted. |
|
229 * @param aIconId The id of icon. |
|
230 * @param aRequestedIconDisplayed Informs if icon is not used. |
|
231 * @param aTerminatedByUser Informs if end key is used. |
|
232 */ |
|
233 void ConfirmCommand( |
|
234 const TSatSQueryCommand aCommandId, |
|
235 const TSatAlphaIdStatus aAlphaIdStatus, |
|
236 const TDesC& aText, |
|
237 const TDesC& aAdditionalText, |
|
238 TBool& aActionAccepted, |
|
239 const TSatIconId& aIconId, |
|
240 TBool& aRequestedIconDisplayed, |
|
241 TBool& aTerminatedByUser ); |
|
242 |
|
243 /** |
|
244 * From MSatUiObserver General notification |
|
245 * @param aCommandId ID of the notifying command |
|
246 * @param aAlphaIdStatus Alpha Identifier status |
|
247 * @param aText Alpha Identifier |
|
248 * @param aIconId The id of icon. |
|
249 * @param aRequestedIconDisplayed Informs if icon is not used. |
|
250 * @param aControlResult Control result of the MoSm and CallControl |
|
251 * @return The response of the UI to this command. |
|
252 */ |
|
253 TSatUiResponse Notification( |
|
254 const TSatSNotifyCommand aCommandId, |
|
255 const TSatAlphaIdStatus aAlphaIdStatus, |
|
256 const TDesC& aText, |
|
257 const TSatIconId& aIconId, |
|
258 TBool& aRequestedIconDisplayed, |
|
259 const TSatControlResult aControlResult ); |
|
260 |
|
261 /** |
|
262 * From MSatUiObserverGeneral event notification. Used for example to |
|
263 * tell UI that command has completed its execution. |
|
264 * @param aEventId, identifies the event |
|
265 * @param aEventStatus, status of the event, used as additional info for |
|
266 * the event |
|
267 * @param aError, possible error code that may affect on event handling. |
|
268 * This is also used as additional info |
|
269 */ |
|
270 void EventNotification( |
|
271 const TSatSEvent aEventId, |
|
272 const TSatSEventStatus aEventStatus, |
|
273 const TInt aError ); |
|
274 |
|
275 private: |
|
276 |
|
277 /** |
|
278 * C++ default constructor. |
|
279 */ |
|
280 CSatUiObserver(); |
|
281 |
|
282 /** |
|
283 * Symbian OS constructor. |
|
284 */ |
|
285 void ConstructL(); |
|
286 |
|
287 /** |
|
288 * Fetch icon information. |
|
289 * @param aIconId Id for icons |
|
290 * @param aIconCommand Command type for icon. |
|
291 * @return Pointer to selected FbsBitmap icon |
|
292 */ |
|
293 CFbsBitmap* FetchIcon( const TUint8 aIconId, |
|
294 const enum TIconCommand aIconCommand ); |
|
295 |
|
296 /** |
|
297 * Gets default text's resource id |
|
298 * @param aCommandId Identifies the command |
|
299 * @param aControl Used only for MoSm and Call Control |
|
300 * @return Resource id for the default text |
|
301 */ |
|
302 TInt DefaultAlphaIdL( |
|
303 const TSatSNotifyCommand aCommandId, |
|
304 const TSatControlResult aControlResult) const; |
|
305 |
|
306 /** |
|
307 * Get size for the icon in popup window. |
|
308 * @param aSize Reference to the size of icon place. |
|
309 * @param aIconCommand Dialog information |
|
310 * @return TBool Returns EFalse if popup window is not supported |
|
311 * in current layout. |
|
312 */ |
|
313 TBool GetPopUpWindowIconSize( TSize& aSize, |
|
314 const TIconCommand aIconCommand ); |
|
315 |
|
316 /** |
|
317 * Creates scalable bitmap. |
|
318 * @param aBitMapToConvert Reference icon to be scaled. |
|
319 * @param aIconCommand Dialog information |
|
320 */ |
|
321 void GetScalableBitmapL( CFbsBitmap*& aBitMapToConvert, |
|
322 const TIconCommand aIconCommand ); |
|
323 |
|
324 /** |
|
325 * Handles scalable bitmap. |
|
326 * @param aBitMapToConvert Reference icon to be scaled. |
|
327 * @param aIconCommand Dialog information |
|
328 * @param aRequestedIconDisplayed Informs if icon is not shown. |
|
329 */ |
|
330 void GetScalableBitmap( |
|
331 CFbsBitmap*& aBitMapToConvert, |
|
332 const TIconCommand aIconCommand, |
|
333 TBool& aRequestedIconDisplayed ); |
|
334 |
|
335 /** |
|
336 * Handles scalable bitmap. |
|
337 * @param aBitMapToConvert Reference icon to be scaled. |
|
338 * @param aIconCommand Dialog information |
|
339 */ |
|
340 void GetScalableBitmap( |
|
341 CFbsBitmap*& aBitMapToConvert, |
|
342 const TIconCommand aIconCommand ); |
|
343 |
|
344 public: // Data |
|
345 |
|
346 //wait scheduler |
|
347 CActiveSchedulerWait iWait; |
|
348 |
|
349 private: // Data |
|
350 |
|
351 // play tone sequence |
|
352 TBuf8<KMaxPlayToneLength> iSequence; |
|
353 |
|
354 |
|
355 //Ref: Interface to the UI-part |
|
356 MSatUiActionImplementer* iActionImplementer; |
|
357 |
|
358 // own: used with refresh started and finished |
|
359 TBool iRefresh; |
|
360 |
|
361 // own: session to sat client |
|
362 RSatUiSession iSat; |
|
363 |
|
364 //Ref: Adapter provided by SAT Client |
|
365 MSatUiAdapter* iAdapter; |
|
366 |
|
367 //Own: Session |
|
368 RSatSession iSatSession; |
|
369 |
|
370 //Own: Current Iconididentifier |
|
371 TInt iIconIdIdentifier; |
|
372 |
|
373 //Own: SetupMenu and SelectItem items icon |
|
374 //CAknIconArray* iItemIcons; |
|
375 |
|
376 //Own: Icon fetching handler |
|
377 //CSatUiIconHandler* iIconHandler; |
|
378 |
|
379 // own: used to signal that icons are supported |
|
380 TBool iIconSupport; |
|
381 |
|
382 //Own: used to indicate if ESatSClearScreenEvent occurs |
|
383 TBool iClearScreenEvent; |
|
384 |
|
385 }; |
|
386 |
|
387 #endif // CSATUIOBSERVER_H |
|
388 |
|
389 // End of File |