|
1 /* |
|
2 * Copyright (c) 2008 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: Sub-session for SAT services. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef RSATSERVICE_H |
|
19 #define RSATSERVICE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32std.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class CFbsBitmap; |
|
26 class RSatSession; |
|
27 class TSatIconInfo; |
|
28 class TSatInternalIconInfo; |
|
29 class CSatPluginMonitor; |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 /** |
|
34 * Array containing the icon information |
|
35 */ |
|
36 typedef RArray<TSatIconInfo> RIconEf; |
|
37 |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * <b>Sub-session for SAT services to SIM</b> |
|
43 * |
|
44 * In order to use SAT Service API, services of an another API is needed: |
|
45 * <ul> |
|
46 * <li><b>SAT Client API</b> \n For connecting SAT Session <BR> |
|
47 * </ul> |
|
48 * |
|
49 * Idle mode text client needs to monitor for idle mode content |
|
50 * changes and call SetIdleModeTextResponse() |
|
51 * if content is updated. |
|
52 * Result needs to be reported also if there already is |
|
53 * initial content after startup, when change notification has not been |
|
54 * requested yet. |
|
55 * Example sequence for Idle mode client: |
|
56 * 1. Startup |
|
57 * 2. Request notification for idle mode content updates from. |
|
58 * 3. Try to get initial idle mode text. |
|
59 * 4. Use initial content, if there was some. |
|
60 * 5. Report result if there was content. |
|
61 * Later: |
|
62 * 6. Idle mode text change notification request is completed. |
|
63 * 7. Renew notification request. |
|
64 * 8. Read new content. |
|
65 * 9. Use new content. |
|
66 * 10. Report result. |
|
67 * |
|
68 * @code |
|
69 * // How to connect to SAT service : |
|
70 * // How to request notification on SetupIdleModeText change: |
|
71 * |
|
72 * RSatSession satSession; |
|
73 * RSatService satService; |
|
74 * // Connect session |
|
75 * satSession.ConnectL(); |
|
76 * satService.OpenL( satSession ); |
|
77 * // Start observing asynchronously for changes |
|
78 * satService.NotifySetupIdleModeTextChange( status ); |
|
79 * |
|
80 * //How to read Idle Mode Text and icon: |
|
81 * |
|
82 * // Read text and icon after startup and when notified about change. |
|
83 * TSatIconQualifier iconQualif( ESatIconNoIcon ); |
|
84 * TUint8 recordId( 0 ); |
|
85 * TInt error( KErrNone ); |
|
86 * HBufC* text = NULL; |
|
87 * satService.GetSetupIdleModeTextL( |
|
88 * text, iconQualif, recordId ); |
|
89 * CFbsBitmap* icon = NULL; |
|
90 * if ( text ) |
|
91 * { |
|
92 * // Use text, take care of cleanup. |
|
93 * } |
|
94 * if ( ESatIconNoIcon != iconQualif ) |
|
95 * { |
|
96 * // There's an icon to be displayed. |
|
97 * // Get icon records into array. |
|
98 * RIconEf iconInfos; |
|
99 * CleanupStack::PushL( TCleanupItem( |
|
100 * LocalArrayCleanupFunction, iconInfos ) |
|
101 * satService.GetIconInfoL( recordId, iconInfos ); |
|
102 * |
|
103 * // Resolve which icon to use using icon infos. |
|
104 * // Then get the icon you selected. |
|
105 * icon = satService.GetIconL( iconInfos[ 0 ] ); |
|
106 * CleanupStack::PopAndDestroy(); // iconInfos |
|
107 * |
|
108 * if ( ESatIconSelfExplanatory == iconQualif ) |
|
109 * { |
|
110 * // Only icon should be displayed. |
|
111 * } |
|
112 * else if ( ESatIconNotSelfExplanatory == iconQualif ) |
|
113 * { |
|
114 * // Both text and icon should be displayed. |
|
115 * } |
|
116 * } |
|
117 * // else: only text should be displayed |
|
118 * |
|
119 * // Display text and/or icon, take care of their cleanup. |
|
120 * |
|
121 * @endcode |
|
122 * |
|
123 * |
|
124 * @lib SatClient.lib |
|
125 * @since 5.1 |
|
126 */ |
|
127 class RSatService : public RSubSessionBase |
|
128 { |
|
129 |
|
130 public: // Enumerations |
|
131 |
|
132 /** |
|
133 * Result options for idle mode text setup. |
|
134 */ |
|
135 enum TSATIdleResult |
|
136 { |
|
137 |
|
138 /** |
|
139 * Text and Icon were set up successfully |
|
140 */ |
|
141 ESATIdleSuccess = 0x00, |
|
142 |
|
143 /** |
|
144 * Text was set up successfully, but requested icon was not |
|
145 * displayed |
|
146 */ |
|
147 ESATIdleSuccessRequestedIconNotDisplayed = 0x04, |
|
148 |
|
149 /** |
|
150 * Text could not be displayed - temporary problem |
|
151 */ |
|
152 ESATIdleMeUnableToProcessCmd = 0x20, |
|
153 |
|
154 /** |
|
155 * Text could not be displayed - permanent problem |
|
156 */ |
|
157 ESATIdleCmdBeyondMeCapabilities = 0x30 |
|
158 }; |
|
159 |
|
160 /** |
|
161 * Specifies icon role. |
|
162 */ |
|
163 enum TSatIconQualifier |
|
164 { |
|
165 |
|
166 /** |
|
167 * Icon is not available. |
|
168 */ |
|
169 ESatIconNoIcon = 1, |
|
170 |
|
171 /** |
|
172 * Icon is self-explanatory, |
|
173 * i.e. if displayed, it replaces the text string. |
|
174 */ |
|
175 ESatIconSelfExplanatory, |
|
176 |
|
177 /** |
|
178 * Icon is not self-explanatory, |
|
179 * i.e. if displayed, it shall be displayed together with |
|
180 * the text string. |
|
181 */ |
|
182 ESatIconNotSelfExplanatory |
|
183 }; |
|
184 |
|
185 public: // Constructors |
|
186 |
|
187 /** |
|
188 * C++ default constructor. |
|
189 */ |
|
190 IMPORT_C RSatService(); |
|
191 |
|
192 public: // New functions |
|
193 |
|
194 /** |
|
195 * Opens the sub-session. |
|
196 * |
|
197 * @since 5.1 |
|
198 * @param aSession Sub-session. |
|
199 * @leave Error value returned by RSubSessionBase::CreateSubSession. |
|
200 */ |
|
201 IMPORT_C void OpenL( const RSatSession& aSession ); |
|
202 |
|
203 /** |
|
204 * Closes the sub-session. |
|
205 * |
|
206 * @since 5.1 |
|
207 */ |
|
208 IMPORT_C void Close(); |
|
209 |
|
210 /** |
|
211 * Requests notification when idle mode text or image are |
|
212 * updated. |
|
213 * |
|
214 * Idle client needs to monitor for setup idle mode content updates. |
|
215 * When a request is completed, the Idle client |
|
216 * can read new content using GetSetupIdleModeTextL and must |
|
217 * report idle mode content displaying result using |
|
218 * SetIdleModeTextResponse(). |
|
219 * |
|
220 * @since 5.1 |
|
221 * @param aStatus Request to be completed on update. |
|
222 * @return KErrNone or a system-wide error code. |
|
223 * On an error request is not accepted so don't set requester active. |
|
224 */ |
|
225 IMPORT_C TInt NotifySetupIdleModeTextChange( |
|
226 TRequestStatus& aStatus ); |
|
227 |
|
228 /** |
|
229 * Cancels notification request for setup idle mode |
|
230 * text or image change. |
|
231 * |
|
232 * @since 5.1 |
|
233 */ |
|
234 IMPORT_C void NotifySetupIdleModeTextChangeCancel(); |
|
235 |
|
236 /** |
|
237 * Get idle mode text and icon. |
|
238 * |
|
239 * Icon and text should be displayed depending on how aIconQualifier |
|
240 * specifies icon role. Result must be reported using |
|
241 * RSatService::SetIdleModeTextResponse(). |
|
242 * Notice: result needs to be reported also if content is available |
|
243 * already after startup when client requests notification for the |
|
244 * first time. |
|
245 * If unable to display icon, then only text can be displayed (adjust |
|
246 * reported result value). |
|
247 * |
|
248 * @since 5.1 |
|
249 * @param aText New text, if available. Ownership transferred. |
|
250 * NULL if no text to display. |
|
251 * @param aIconQualifier Specifies if icon, text or both are preferred. |
|
252 * @param aRecordNumber Record id for icon. |
|
253 * @return Reserved for future use. |
|
254 * @leave KErrNotFound ESatIconNotSelfExplanatory icon without text. |
|
255 */ |
|
256 IMPORT_C TBool GetSetupIdleModeTextL( |
|
257 HBufC*& aText, |
|
258 TSatIconQualifier& aIconQualifier, |
|
259 TUint8& aRecordNumber ); |
|
260 |
|
261 /** |
|
262 * Gets the information of icons from the SIM. |
|
263 * |
|
264 * @since 5.1 |
|
265 * @param aRecordNumber Record number from proactive command. |
|
266 * @param aIconEf Contains the icon information. |
|
267 * @leave Error value returned by RSubSessionBase::SendReceive. |
|
268 * @leave KErrCorrupt if the info is invalid. |
|
269 */ |
|
270 IMPORT_C void GetIconInfoL( TUint8 aRecordNumber, |
|
271 RIconEf& aIconEf ) const; |
|
272 |
|
273 /** |
|
274 * Gets the bitmap of selected icon from SIM. Client should determine |
|
275 * the suitable icon using GetIconInfoL. |
|
276 * |
|
277 * @since 5.1 |
|
278 * @param aIconInfo Information of the selected icon. |
|
279 * @leave Error value returned by RSubSessionBase::SendReceive. |
|
280 * @leave Error value returned by CFbsBitmap::Duplicate. |
|
281 * @leave Error value returned by RSubSessionBase::Send. |
|
282 * @return Bitmap of the icon. The client is responsible for deleting |
|
283 * the pointer. |
|
284 */ |
|
285 IMPORT_C CFbsBitmap* GetIconL( const TSatIconInfo& aIconInfo ) const; |
|
286 |
|
287 /** |
|
288 * Sets SetUpIdleModeText response. |
|
289 * |
|
290 * This must be called by the Idle client application after |
|
291 * IdleModeText has been modified by SAT, meaning |
|
292 * when RSatService::NotifySetupIdleModeTextChange() is completed. |
|
293 * Also needs to be called if GetSetupIdleModeTextL() returned |
|
294 * content and RSatService::NotifySetupIdleModeTextChange() |
|
295 * notification was not requested yet. |
|
296 * |
|
297 * @since 5.1 |
|
298 * @param aResult Result of displaying idle mode text and icon. |
|
299 */ |
|
300 IMPORT_C void SetIdleModeTextResponse( |
|
301 const TSATIdleResult& aResult ) const; |
|
302 |
|
303 |
|
304 private: // New functions |
|
305 |
|
306 /** |
|
307 * Checks that the data from SIM is valid. |
|
308 * |
|
309 * @since 5.1 |
|
310 * @param aData Icon info to be checked. |
|
311 * @leave KErrCorrupt if the info is invalid. |
|
312 */ |
|
313 void CheckInfoValidityL( const TDesC8& aData ) const; |
|
314 |
|
315 /** |
|
316 * Set ETSI specified bitmap data to TSatIconInfo. |
|
317 * |
|
318 * @since 5.1 |
|
319 * @param aContainer Client side Icon info. |
|
320 * @param aIconSatData RSat::TIcon data from server. |
|
321 */ |
|
322 void SetIconInfoL( TSatIconInfo& aContainer, |
|
323 const TDesC8& aIconSatData ) const; |
|
324 |
|
325 /** |
|
326 * Convert TSatIconinfo to TSatInternalIconInfo. |
|
327 * |
|
328 * @since 5.1 |
|
329 * @param aIconInfo user side icon info. |
|
330 * @param aInternalIconINfo sat side icon info. |
|
331 */ |
|
332 void FillInternalIconInfo( const TSatIconInfo& aIconInfo, |
|
333 TSatInternalIconInfo& aInternalIconInfo ) const; |
|
334 |
|
335 private: |
|
336 |
|
337 /** |
|
338 * Prohibit copy constructor if not deriving from CBase. |
|
339 */ |
|
340 RSatService( const RSatService& ); |
|
341 |
|
342 /** |
|
343 * Prohibit assigment operator if not deriving from CBase. |
|
344 */ |
|
345 RSatService& operator=( const RSatService& ); |
|
346 |
|
347 private: // Data |
|
348 |
|
349 /** |
|
350 * Arguments for asynchronous message. |
|
351 */ |
|
352 TIpcArgs iArgs; |
|
353 |
|
354 /** |
|
355 * Maximum support icon size. |
|
356 */ |
|
357 TInt iMaxIconDataSize; |
|
358 |
|
359 /** |
|
360 * SetupIdleMode content monitoring. |
|
361 * Own |
|
362 */ |
|
363 CSatPluginMonitor* iSatPluginMonitor; |
|
364 |
|
365 }; |
|
366 |
|
367 #endif // RSATSERVICE_H |
|
368 |
|
369 // End of File |