|
1 /* |
|
2 * Copyright (c) 2005-2006 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 image handler. |
|
15 * Does image saving and loading. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "CPhSrvSubSessionImageHandler.h" |
|
23 #include "CPhSrvSession.h" |
|
24 #include "CPhSrvServer.h" |
|
25 #include <e32property.h> |
|
26 #include <PhCltTypes.h> |
|
27 #include "PhSrvDebugInfo.h" |
|
28 |
|
29 // CONSTANTS |
|
30 _LIT( KPhSrvImageDriveRom, "z:" ); |
|
31 _LIT( KPhSrvVTImageName, "vtstillimage" ); |
|
32 _LIT( KPhSrvVTDefaultImageName, "vtdefaultimage." ); |
|
33 _LIT( KPhSrvImageSuffix, ".mbm" ); |
|
34 _LIT( KPhSrvImageWildCard, "*" ); |
|
35 _LIT( KPhSrvLogoMncMccSeparator, "_" ); |
|
36 _LIT( KPhSrvLogoTypeIndicatorOTA, "OTA" ); |
|
37 _LIT( KPhSrvLogoTypeIndicatorProg, "Prog" ); |
|
38 _LIT( KPhSrvOperatorLogoPrefix, "Logo" ); |
|
39 const TInt KPhSrvNameMaxLen = 1024; |
|
40 |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CPhSrvSubSessionImageHandler::CPhSrvSubSessionImageHandler |
|
45 // |
|
46 // Constructor. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CPhSrvSubSessionImageHandler::CPhSrvSubSessionImageHandler( |
|
50 CPhSrvSession& aSession ) |
|
51 : CPhSrvSubSessionBase( aSession, EPhSrvSubSessionTypeImageHandler ) |
|
52 { |
|
53 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Ctor" ) |
|
54 } |
|
55 |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CPhSrvSubSessionImageHandler::~CPhSrvSubSessionImageHandler |
|
59 // |
|
60 // Destructor. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CPhSrvSubSessionImageHandler::~CPhSrvSubSessionImageHandler() |
|
64 { |
|
65 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Dtor" ) |
|
66 iVTBitMaps.ResetAndDestroy(); |
|
67 iOperatorLogos.ResetAndDestroy(); |
|
68 PhoneSession().PhoneServer().DisconnectFBS(); |
|
69 iFs.Close(); |
|
70 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Dtor>" ) |
|
71 } |
|
72 |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CPhSrvSubSessionImageHandler::NewL |
|
76 // |
|
77 // Two-phased constructor. |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 CPhSrvSubSessionBase* CPhSrvSubSessionImageHandler::NewL( |
|
81 CPhSrvSession& aSession ) |
|
82 { |
|
83 _DPRINT( 4, "CPhSrvSubSessionImageHandler::NewL" ) |
|
84 CPhSrvSubSessionBase* self = |
|
85 new( ELeave ) CPhSrvSubSessionImageHandler( aSession ); |
|
86 _DPRINT( 4, "CPhSrvSubSessionImageHandler::NewL>" ) |
|
87 return self; |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CPhSrvSubSessionImageHandler::ImageSaved |
|
92 // |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CPhSrvSubSessionImageHandler::ImageSaved( TInt aResult ) |
|
96 { |
|
97 iImageSaver = NULL; |
|
98 // Message for save request |
|
99 iSaveVtImageMessage.Complete( aResult ); |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CPhSrvSubSessionImageHandler::PhSrvMessageDecoderCanProcessMessage |
|
104 // |
|
105 // Framework function. Returns ETrue for the op codes that |
|
106 // this subsession can handle. |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 TBool CPhSrvSubSessionImageHandler::PhSrvMessageDecoderCanProcessMessage( |
|
110 TInt aFunction ) |
|
111 { |
|
112 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::CanProcess", aFunction ) |
|
113 switch( aFunction ) |
|
114 { |
|
115 case EPhoneServerImageHandlerSubSessionOpen: |
|
116 case EPhoneServerImageHandlerSubSessionClose: |
|
117 case EPhoneServerImageHandlerSubSessionSave: |
|
118 case EPhoneServerImageHandlerSubSessionLoad: |
|
119 case EPhoneServerImageHandlerSubSessionCommitLoad: |
|
120 case EPhoneServerOpenVtImage: |
|
121 // new saving scheme |
|
122 case EPhoneServerSaveVtImage: |
|
123 case EPhoneServerSaveVtImageCancel: |
|
124 return ETrue; |
|
125 |
|
126 default: |
|
127 return EFalse; |
|
128 } |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CPhSrvSubSessionImageHandler::PhSrvMessageProcessorHandleMessageL |
|
133 // |
|
134 // Framework function. Handle any op-codes here. |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 void CPhSrvSubSessionImageHandler::PhSrvMessageProcessorHandleMessageL( |
|
138 const RMessage2& aMessage ) |
|
139 { |
|
140 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Handle", |
|
141 aMessage.Function() ) |
|
142 TBool permissionStatus ( EFalse ); |
|
143 |
|
144 // Check needed capabilities |
|
145 TBool hasCapWriteDeviceData( EFalse ); |
|
146 hasCapWriteDeviceData = aMessage.HasCapability( ECapabilityWriteDeviceData ); |
|
147 TBool hasCapReadDeviceData( EFalse ); |
|
148 hasCapReadDeviceData = aMessage.HasCapability( ECapabilityReadDeviceData ); |
|
149 |
|
150 switch( aMessage.Function() ) |
|
151 { |
|
152 case EPhoneServerImageHandlerSubSessionClose: |
|
153 CmdSubSessionClose( aMessage ); |
|
154 permissionStatus = ETrue; |
|
155 break; |
|
156 |
|
157 case EPhoneServerImageHandlerSubSessionSave: |
|
158 if ( hasCapWriteDeviceData ) |
|
159 { |
|
160 CmdSubSessionSaveImagesL( aMessage ); |
|
161 permissionStatus = ETrue; |
|
162 } |
|
163 break; |
|
164 |
|
165 case EPhoneServerImageHandlerSubSessionCommitLoad: |
|
166 if ( hasCapReadDeviceData ) |
|
167 { |
|
168 CmdSubSessionCommitLoadL( aMessage ); |
|
169 permissionStatus = ETrue; |
|
170 } |
|
171 break; |
|
172 |
|
173 |
|
174 case EPhoneServerImageHandlerSubSessionLoad: |
|
175 if ( hasCapReadDeviceData ) |
|
176 { |
|
177 CmdSubSessionLoadImagesL( aMessage ); |
|
178 permissionStatus = ETrue; |
|
179 } |
|
180 break; |
|
181 case EPhoneServerOpenVtImage: |
|
182 if ( hasCapReadDeviceData ) |
|
183 { |
|
184 CmdSubSessionOpenDefaultVtImageL( aMessage ); |
|
185 permissionStatus = ETrue; |
|
186 } |
|
187 break; |
|
188 case EPhoneServerSaveVtImage: |
|
189 if ( hasCapWriteDeviceData ) |
|
190 { |
|
191 CmdSubSessionSaveVtImageL( aMessage ); |
|
192 permissionStatus = ETrue; |
|
193 } |
|
194 break; |
|
195 case EPhoneServerSaveVtImageCancel: |
|
196 if ( hasCapWriteDeviceData ) |
|
197 { |
|
198 permissionStatus = ETrue; |
|
199 if ( iImageSaver ) |
|
200 { |
|
201 // saving in progress, cancel it. |
|
202 iImageSaver->Cancel(); |
|
203 } |
|
204 else |
|
205 { |
|
206 // nothing to cancel or too late cancellation |
|
207 iSaveVtImageMessage.Complete( KErrNotReady ); |
|
208 } |
|
209 } |
|
210 break; |
|
211 default: |
|
212 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Handle: PANIC" ) |
|
213 PhoneSession().PanicClient( |
|
214 aMessage, |
|
215 EPhCltServerInitiatedPanicInvalidRequest ); |
|
216 break; |
|
217 } |
|
218 |
|
219 // If caps are not ok |
|
220 if( !permissionStatus ) |
|
221 { |
|
222 aMessage.Complete( KErrPermissionDenied ); |
|
223 } |
|
224 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Handle>" ) |
|
225 } |
|
226 |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CPhSrvSubSessionImageHandler::CmdSubSessionClose |
|
230 // |
|
231 // Close the sub-session. |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 void CPhSrvSubSessionImageHandler::CmdSubSessionClose( |
|
235 const RMessage2& aMessage ) |
|
236 { |
|
237 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Close" ) |
|
238 PhoneSession().CloseSubSession( aMessage ); |
|
239 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Close>" ) |
|
240 } |
|
241 |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // CPhSrvSubSessionImageHandler::CmdSubSessionSaveImagesL |
|
245 // |
|
246 // |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 void CPhSrvSubSessionImageHandler::CmdSubSessionSaveImagesL( |
|
250 const RMessage2& aMessage ) |
|
251 { |
|
252 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Save" ) |
|
253 TPhCltImageArray handles; |
|
254 TPckg< TPhCltImageArray > pHandles( handles ); |
|
255 |
|
256 Read( aMessage, 0, pHandles ); |
|
257 |
|
258 // Version check in here, if multiple possibilities. |
|
259 switch( pHandles().iType ) |
|
260 { |
|
261 case EPhCltTypeVTStill: |
|
262 DoSaveVTImageL( handles ); |
|
263 break; |
|
264 case EPhCltTypeOperatorLogo: |
|
265 DoSaveOperatorLogoL( handles ); |
|
266 break; |
|
267 default: |
|
268 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Save US" ) |
|
269 User::Leave( KErrNotSupported ); |
|
270 } |
|
271 |
|
272 // Leave is propagated into framework. |
|
273 aMessage.Complete( KErrNone ); |
|
274 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Save>" ) |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CPhSrvSubSessionImageHandler::CmdSubSessionLoadImagesL |
|
279 // |
|
280 // |
|
281 // ----------------------------------------------------------------------------- |
|
282 // |
|
283 void CPhSrvSubSessionImageHandler::CmdSubSessionLoadImagesL( |
|
284 const RMessage2& aMessage ) |
|
285 { |
|
286 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Load" ) |
|
287 TPhCltImageArray handles; |
|
288 TPckg< TPhCltImageArray > pHandles( handles ); |
|
289 |
|
290 Read( aMessage, 0, pHandles ); |
|
291 |
|
292 // Version check in here, if multiple possibilities. |
|
293 switch( pHandles().iType ) |
|
294 { |
|
295 case EPhCltTypeVTStill: |
|
296 case EPhCltTypeVTDefault: |
|
297 DoLoadVTImagesL( handles ); |
|
298 break; |
|
299 case EPhCltTypeOperatorLogo: |
|
300 DoLoadOperatorLogoL( handles ); |
|
301 break; |
|
302 default: |
|
303 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Load US" ) |
|
304 User::Leave( KErrNotSupported ); |
|
305 } |
|
306 |
|
307 Write( aMessage, 0, pHandles ); |
|
308 aMessage.Complete( KErrNone ); |
|
309 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Load>" ) |
|
310 } |
|
311 |
|
312 // ----------------------------------------------------------------------------- |
|
313 // CPhSrvSubSessionImageHandler::CmdSubSessionOpenDefaultVtImageL |
|
314 // |
|
315 // |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 void CPhSrvSubSessionImageHandler::CmdSubSessionOpenDefaultVtImageL( |
|
319 const RMessage2& aMessage ) |
|
320 { |
|
321 _DPRINT( 4, |
|
322 "CPhSrvSubSessionImageHandler::CmdSubSessionOpenDefaultVtImageL<" ) |
|
323 TBool defaultImage( ETrue ); |
|
324 TPckg< TBool > pckg( defaultImage ); |
|
325 Read( aMessage, 1, pckg ); |
|
326 |
|
327 // Currently only default still image uses file handle sharing. User |
|
328 // defined image uses legacy scheme. If user defined image is attempted |
|
329 // to open here, complete with error. |
|
330 if ( !defaultImage ) |
|
331 { |
|
332 User::Leave( KErrNotSupported ); |
|
333 } |
|
334 |
|
335 RFs fs; |
|
336 RFile defaultVtImageFile; |
|
337 TFileName fileName; |
|
338 |
|
339 // File extension may be any supported file type. Resolve which one is used. |
|
340 User::LeaveIfError( ResolveDefaultVtImageFileName( fileName ) ); |
|
341 |
|
342 // Open separate session because ownwership of transferred file's |
|
343 // session goes with the file (when file is closed by the client, |
|
344 // related session is also closed) |
|
345 User::LeaveIfError( fs.Connect() ); |
|
346 CleanupClosePushL( fs ); |
|
347 |
|
348 User::LeaveIfError( defaultVtImageFile.Open( fs, fileName, EFileRead ) ); |
|
349 |
|
350 // Transfer file handle to client by writing file handle value to |
|
351 // message argument 0 |
|
352 User::LeaveIfError( |
|
353 defaultVtImageFile.TransferToClient( aMessage, 0 ) ); |
|
354 defaultVtImageFile.Close(); // file handle duplicated for client |
|
355 CleanupStack::PopAndDestroy(); // fs, can be closed, handle duplicated |
|
356 |
|
357 _DPRINT( 4, |
|
358 "CPhSrvSubSessionImageHandler::CmdSubSessionOpenDefaultVtImageL>" ) |
|
359 } |
|
360 |
|
361 // ----------------------------------------------------------------------------- |
|
362 // CPhSrvSubSessionImageHandler::ResolveDefaultVtImageFileName |
|
363 // |
|
364 // Resolves file name of default VT image. Extension cannot be known |
|
365 // in advance and directory entries must be read and parsed. |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 TInt CPhSrvSubSessionImageHandler::ResolveDefaultVtImageFileName( |
|
369 TDes& aFileName ) |
|
370 { |
|
371 _DPRINT( 4, "CPhSrvSubSessionImageHandler::ResolveDefaultVtImageFileName<" ) |
|
372 CDir* entries = NULL; |
|
373 TFileName path = KPhSrvImageDriveRom(); |
|
374 |
|
375 // read directory entries in the server private path |
|
376 path.Append( iFilePath ); |
|
377 TInt result = iFs.GetDir( path, KEntryAttNormal, EDirsLast, entries ); |
|
378 if ( result == KErrNone && entries ) |
|
379 { |
|
380 const TInt entryCount( entries->Count() ); |
|
381 // go through entries and stop when VT image file is found |
|
382 for ( TInt index = 0; index < entryCount; index++ ) |
|
383 { |
|
384 const TEntry& entry = ( *entries )[index]; |
|
385 if ( entry.iName.Find( KPhSrvVTDefaultImageName() ) > KErrNotFound ) |
|
386 { |
|
387 aFileName = path; |
|
388 aFileName.Append( entry.iName ); |
|
389 // fileName now contains full path |
|
390 index = entryCount; // break loop |
|
391 result = KErrNone; |
|
392 } |
|
393 } |
|
394 } |
|
395 delete entries; |
|
396 _DPRINT( 4, "CPhSrvSubSessionImageHandler::ResolveDefaultVtImageFileName>" ) |
|
397 return result; |
|
398 } |
|
399 |
|
400 // ----------------------------------------------------------------------------- |
|
401 // CPhSrvSubSessionImageHandler::CmdSubSessionSaveVtImageL |
|
402 // |
|
403 // |
|
404 // ----------------------------------------------------------------------------- |
|
405 // |
|
406 void CPhSrvSubSessionImageHandler::CmdSubSessionSaveVtImageL( |
|
407 const RMessage2& aMessage ) |
|
408 { |
|
409 TFileName sourceFile; |
|
410 TPckg<TFileName> pckg( sourceFile ); |
|
411 |
|
412 Read( aMessage, 0, pckg ); |
|
413 CPhSrvImageSaver* saver = CPhSrvImageSaver::NewL( iFs, iFilePath, *this ); |
|
414 CleanupStack::PushL( saver ); |
|
415 saver->SaveImageL( sourceFile ); |
|
416 CleanupStack::Pop(); |
|
417 iImageSaver = saver; |
|
418 } |
|
419 |
|
420 // ----------------------------------------------------------------------------- |
|
421 // CPhSrvSubSessionImageHandler::CmdSubSessionCommitLoadL |
|
422 // |
|
423 // |
|
424 // ----------------------------------------------------------------------------- |
|
425 // |
|
426 void CPhSrvSubSessionImageHandler::CmdSubSessionCommitLoadL( |
|
427 const RMessage2& aMessage ) |
|
428 { |
|
429 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Commit" ) |
|
430 TPhCltImageArray handles; |
|
431 TPckg< TPhCltImageArray > pHandles( handles ); |
|
432 |
|
433 Read( aMessage, 0, pHandles ); |
|
434 |
|
435 switch ( pHandles().iType ) |
|
436 { |
|
437 case EPhCltTypeVTStill: |
|
438 case EPhCltTypeVTDefault: |
|
439 DoCommitLoadVTL(); |
|
440 break; |
|
441 case EPhCltTypeOperatorLogo: |
|
442 DoCommitLoadLogo( handles ); |
|
443 break; |
|
444 default: |
|
445 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Commit US" ) |
|
446 User::Leave( KErrNotSupported ); |
|
447 } |
|
448 aMessage.Complete( KErrNone ); |
|
449 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Commit" ) |
|
450 } |
|
451 |
|
452 // ----------------------------------------------------------------------------- |
|
453 // CPhSrvSubSessionImageHandler::DoCommitLoadVTL |
|
454 // |
|
455 // |
|
456 // ----------------------------------------------------------------------------- |
|
457 // |
|
458 void CPhSrvSubSessionImageHandler::DoCommitLoadVTL() |
|
459 { |
|
460 _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitVT" ) |
|
461 iVTBitMaps.ResetAndDestroy(); |
|
462 _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitVT>" ) |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // CPhSrvSubSessionImageHandler::DoCommitLoadLogo |
|
467 // |
|
468 // |
|
469 // ----------------------------------------------------------------------------- |
|
470 // |
|
471 void CPhSrvSubSessionImageHandler::DoCommitLoadLogo( TPhCltImageArray& aImages ) |
|
472 { |
|
473 _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitLogo" ) |
|
474 for ( TInt i = 0; i < iOperatorLogos.Count(); i ++ ) |
|
475 { |
|
476 if ( aImages.iImages[ EPhCltExtCountryCodeIndex ] == |
|
477 iOperatorLogos[ i ]->iCountryCode && |
|
478 aImages.iImages[ EPhCltExtNetworkCodeIndex ] == |
|
479 iOperatorLogos[ i ]->iNetworkCode ) |
|
480 { |
|
481 _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitLogo found" ) |
|
482 delete iOperatorLogos[ i ]; |
|
483 iOperatorLogos.Remove( i ); |
|
484 break; |
|
485 } |
|
486 } |
|
487 _DPRINT( 4, "CPhSrvSubSessionImageHandler::CommitLogo>" ) |
|
488 } |
|
489 |
|
490 // ----------------------------------------------------------------------------- |
|
491 // CPhSrvSubSessionImageHandler::DoSaveVTImage |
|
492 // |
|
493 // |
|
494 // ----------------------------------------------------------------------------- |
|
495 // |
|
496 void CPhSrvSubSessionImageHandler::DoSaveVTImageL( TPhCltImageArray& aImages ) |
|
497 { |
|
498 _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveVT" ) |
|
499 HBufC* hbuf = HBufC::NewLC(KPhSrvNameMaxLen); |
|
500 TPtr buf = hbuf->Des(); |
|
501 for ( TInt i = 0; i < aImages.iImageCount; i++ ) |
|
502 { |
|
503 buf.Zero(); |
|
504 buf.Append( iDriveName ); |
|
505 buf.Append( iFilePath ); |
|
506 buf.Append( KPhSrvVTImageName ); |
|
507 buf.AppendNum( i ); |
|
508 buf.Append( KPhSrvImageSuffix ); |
|
509 buf.ZeroTerminate(); |
|
510 #ifdef __PHENG_DEBUG_INFO__ |
|
511 RDebug::Print( _L("CPhSrvSubSessionImageHandler::SaveVT: %S"), &buf ); |
|
512 #endif |
|
513 CFbsBitmap* bitMap = new ( ELeave ) CFbsBitmap(); |
|
514 CleanupStack::PushL( bitMap ); |
|
515 User::LeaveIfError( bitMap->Duplicate( aImages.iImages[ i ] ) ); |
|
516 User::LeaveIfError( bitMap->Save( buf ) ); |
|
517 CleanupStack::PopAndDestroy( bitMap ); |
|
518 } |
|
519 CleanupStack::PopAndDestroy( hbuf ); |
|
520 _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveVT>" ) |
|
521 } |
|
522 |
|
523 // ----------------------------------------------------------------------------- |
|
524 // CPhSrvSubSessionImageHandler::DoLoadVTImagesL |
|
525 // |
|
526 // Loads images. |
|
527 // ----------------------------------------------------------------------------- |
|
528 // |
|
529 void CPhSrvSubSessionImageHandler::DoLoadVTImagesL( TPhCltImageArray& aImages ) |
|
530 { |
|
531 _DPRINT( 4, "CPhSrvSubSessionImageHandler::LoadVT" ) |
|
532 // Load the images from file. |
|
533 const TBool loadDefaultImage = aImages.iType == EPhCltTypeVTDefault; |
|
534 DoReadVTImagesL( loadDefaultImage ); |
|
535 |
|
536 // Copy handles. |
|
537 aImages.iImageCount = iVTBitMaps.Count(); |
|
538 for ( TInt i = 0; i < aImages.iImageCount; i++ ) |
|
539 { |
|
540 aImages.iImages[ i ] = iVTBitMaps[ i ]->Handle(); |
|
541 _DDPRINT( 4, |
|
542 "CPhSrvSubSessionImageHandler::LoadVT: ", aImages.iImages[ i ] ) |
|
543 } |
|
544 _DPRINT( 4, "CPhSrvSubSessionImageHandler::LoadVT>" ) |
|
545 } |
|
546 |
|
547 // ----------------------------------------------------------------------------- |
|
548 // CPhSrvSubSessionImageHandler::DoReadVTImagesL |
|
549 // |
|
550 // Loads images. |
|
551 // ----------------------------------------------------------------------------- |
|
552 // |
|
553 void CPhSrvSubSessionImageHandler::DoReadVTImagesL( const TBool aDefaultImage ) |
|
554 { |
|
555 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT is default=", aDefaultImage ) |
|
556 iVTBitMaps.ResetAndDestroy(); |
|
557 |
|
558 TPtrC path; // pointer to sub-string of searchPath containing drive+path |
|
559 |
|
560 // Search path = drive + path + file-name (with wildcard) + extension |
|
561 HBufC* searchPath = ConstructVTImageSearchPathLC( |
|
562 aDefaultImage, path ); |
|
563 |
|
564 #ifdef __PHENG_DEBUG_INFO__ |
|
565 TPtr ptr = searchPath->Des(); // temp pointer to avoid lvalue compile warning |
|
566 RDebug::Print( _L( |
|
567 "CPhSrvSubSessionImageHandler::ReadVT: %S"), ( &ptr )); |
|
568 #endif |
|
569 RDir dir; |
|
570 User::LeaveIfError( dir.Open( iFs, *searchPath, KEntryAttNormal ) ); |
|
571 CleanupClosePushL( dir ); |
|
572 |
|
573 TEntryArray entryArray; |
|
574 TInt readResult = dir.Read( entryArray ); |
|
575 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT res: ", readResult ) |
|
576 HBufC* hbitmapName = HBufC::NewLC( KMaxFileName ); |
|
577 TPtr bitmapName = hbitmapName->Des(); |
|
578 |
|
579 // If directory entry array read successfully... |
|
580 while( ( readResult == KErrNone ) || ( readResult == KErrEof ) ) |
|
581 { |
|
582 const TInt arrayLength = entryArray.Count(); |
|
583 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DoReadVTImagesL count: ", arrayLength ) |
|
584 // ...go through directory entries |
|
585 for( TInt i = 0; i < arrayLength; i++ ) |
|
586 { |
|
587 const TEntry& entry = entryArray[ i ]; |
|
588 const TDesC& name = entry.iName; |
|
589 TBool load = EFalse; |
|
590 // If client wanted default image, load it only |
|
591 if ( aDefaultImage && |
|
592 name.FindF( KPhSrvVTDefaultImageName ) == 0 ) |
|
593 { |
|
594 /* Next two statements for stopping to process |
|
595 directory entries */ |
|
596 i = arrayLength; |
|
597 readResult = KErrEof; |
|
598 load = ETrue; |
|
599 } |
|
600 // If client wanted still image, load it (or them) |
|
601 else if ( !aDefaultImage && |
|
602 name.FindF( KPhSrvVTImageName ) == 0 ) |
|
603 { |
|
604 load = ETrue; |
|
605 } |
|
606 if ( load ) |
|
607 { |
|
608 CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap(); |
|
609 CleanupStack::PushL( bitmap ); |
|
610 bitmapName = path; // initialize the file path |
|
611 bitmapName.Append( name ); |
|
612 #ifdef __PHENG_DEBUG_INFO__ |
|
613 RDebug::Print( _L( |
|
614 "CPhSrvSubSessionImageHandler::ReadVT BM: %S"), |
|
615 &bitmapName ); |
|
616 #endif |
|
617 User::LeaveIfError( bitmap->Load( bitmapName ) ); |
|
618 User::LeaveIfError( iVTBitMaps.Append( bitmap ) ); |
|
619 CleanupStack::Pop(); // bitmap |
|
620 } |
|
621 } |
|
622 |
|
623 if ( readResult == KErrEof ) |
|
624 { |
|
625 _DPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT EOF" ) |
|
626 break; |
|
627 } |
|
628 readResult = dir.Read( entryArray ); |
|
629 } |
|
630 CleanupStack::PopAndDestroy( 3 ); // hbitmapName, dir, search path |
|
631 if( ( readResult != KErrNone ) && ( readResult != KErrEof ) ) |
|
632 { |
|
633 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT Leave", readResult ) |
|
634 User::Leave( readResult ); |
|
635 } |
|
636 _DPRINT( 4, "CPhSrvSubSessionImageHandler::ReadVT>" ) |
|
637 } |
|
638 |
|
639 // ----------------------------------------------------------------------------- |
|
640 // CPhSrvSubSessionImageHandler::DoSaveOperatorLogoL |
|
641 // |
|
642 // |
|
643 // ----------------------------------------------------------------------------- |
|
644 // |
|
645 void CPhSrvSubSessionImageHandler::DoSaveOperatorLogoL( TPhCltImageArray& aImages ) |
|
646 { |
|
647 _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveLogo" ) |
|
648 // Check the values prior saving, |
|
649 // to check whether deletion is actually ongoing |
|
650 const TPhCltCountryCode mcc = aImages.iImages[ EPhCltExtCountryCodeIndex ]; |
|
651 const TPhCltNetworkCode mnc= aImages.iImages[ EPhCltExtNetworkCodeIndex ]; |
|
652 const TInt handle = aImages.iImages[ EPhCltExtOperatorLogoIndex ]; |
|
653 const TPhCltExtOperatorLogoType logoType = |
|
654 ( TPhCltExtOperatorLogoType )aImages.iImages[ EPhCltExtLogoTypeIndex ]; |
|
655 |
|
656 // Only OTA logos can be saved and deleted. |
|
657 if ( logoType == EPhCltLogoTypeProgrammable ) |
|
658 { |
|
659 _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveLogo PROG" ) |
|
660 User::Leave( KErrAccessDenied ); |
|
661 } |
|
662 |
|
663 _DPRINT( 4, "PhSrvImageHandler::SaveLogo test delete " ) |
|
664 // Check if this a delete command. |
|
665 // If no logo deleted, then this is save command. |
|
666 if ( !DeleteLogoL( mcc, mnc, logoType, handle ) ) |
|
667 { |
|
668 _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveLogo Save" ) |
|
669 HBufC* hbuf = HBufC::NewLC(KPhSrvNameMaxLen); |
|
670 TPtr buf = hbuf->Des(); |
|
671 ConstructLogoFileNameL( mcc, mnc, logoType, buf ); |
|
672 CFbsBitmap* bitMap = new ( ELeave ) CFbsBitmap(); |
|
673 CleanupStack::PushL( bitMap ); |
|
674 User::LeaveIfError( bitMap->Duplicate( |
|
675 aImages.iImages[ EPhCltExtOperatorLogoIndex ] ) ); |
|
676 User::LeaveIfError( bitMap->Save( buf ) ); |
|
677 CleanupStack::PopAndDestroy( 2, hbuf ); // hbuf, bitMap |
|
678 NotifyListeners( // Error ignored. |
|
679 mcc, mnc, TTelephonyOTALogoUpdate::EPSTelephonyLogoChanged ); |
|
680 // new P&S key update |
|
681 NotifyListeners( // Error ignored. |
|
682 mcc, mnc, TTelOTALogoUpdate::EPSTelephonyLogoChanged ); |
|
683 } |
|
684 _DPRINT( 4, "CPhSrvSubSessionImageHandler::SaveLogo>" ) |
|
685 } |
|
686 |
|
687 // ----------------------------------------------------------------------------- |
|
688 // CPhSrvSubSessionImageHandler::DoLoadOperatorLogoL |
|
689 // |
|
690 // Loads images. |
|
691 // ----------------------------------------------------------------------------- |
|
692 // |
|
693 void CPhSrvSubSessionImageHandler:: |
|
694 DoLoadOperatorLogoL( TPhCltImageArray& aImages ) |
|
695 { |
|
696 _DPRINT( 4, "CPhSrvSubSessionImageHandler::LoadLogo" ) |
|
697 // Construct the file path first. |
|
698 HBufC* hbuf = HBufC::NewLC(KPhSrvNameMaxLen); |
|
699 TPtr buf = hbuf->Des(); |
|
700 TInt err( KErrNone ); |
|
701 ConstructLogoFileNameL( aImages.iImages[ EPhCltExtCountryCodeIndex ], |
|
702 aImages.iImages[ EPhCltExtNetworkCodeIndex ], |
|
703 ( TPhCltExtOperatorLogoType ) aImages.iImages[ EPhCltExtLogoTypeIndex ], |
|
704 buf ); |
|
705 |
|
706 // Load the image. |
|
707 CFbsBitmap* bitMap = new ( ELeave ) CFbsBitmap(); |
|
708 CleanupStack::PushL( bitMap ); |
|
709 err = bitMap->Load( buf ); |
|
710 if ( err == KErrPathNotFound ) |
|
711 { |
|
712 err = KErrNotFound; |
|
713 } |
|
714 User::LeaveIfError( err ); |
|
715 |
|
716 CPhSrvOperatorLogoContainer* logoContainer = |
|
717 new (ELeave)CPhSrvOperatorLogoContainer( |
|
718 aImages.iImages[ EPhCltExtCountryCodeIndex ], |
|
719 aImages.iImages[ EPhCltExtNetworkCodeIndex ], |
|
720 ( TPhCltExtOperatorLogoType ) aImages.iImages[ EPhCltExtLogoTypeIndex ], |
|
721 bitMap ); |
|
722 aImages.iImages[ EPhCltExtOperatorLogoIndex ] = bitMap->Handle(); |
|
723 aImages.iImageCount = 1; |
|
724 iOperatorLogos.Append( logoContainer ); |
|
725 |
|
726 CleanupStack::Pop( bitMap ); |
|
727 CleanupStack::PopAndDestroy( hbuf ); |
|
728 |
|
729 _DPRINT( 4, "CPhSrvSubSessionImageHandler::LoadLogo>" ) |
|
730 } |
|
731 |
|
732 // ----------------------------------------------------------------------------- |
|
733 // CPhSrvSubSessionImageHandler::MakeImageDirL |
|
734 // |
|
735 // Creates directory structure. |
|
736 // ----------------------------------------------------------------------------- |
|
737 // |
|
738 void CPhSrvSubSessionImageHandler::MakeImageDirL() |
|
739 { |
|
740 _DPRINT( 4, "CPhSrvSubSessionImageHandler::MakeDir" ) |
|
741 TDriveNumber sysDrive; |
|
742 User::LeaveIfError( BaflUtils::GetSystemDrive( sysDrive ) ); |
|
743 iDriveName.Format( _L("%c:"), sysDrive +'A' ); |
|
744 const TInt err( iFs.CreatePrivatePath( sysDrive ) ); |
|
745 if ( err != KErrAlreadyExists && err != KErrNone ) |
|
746 { |
|
747 User::Leave( err ); |
|
748 } |
|
749 _DPRINT( 4, "CPhSrvSubSessionImageHandler::MakeDir>" ) |
|
750 } |
|
751 |
|
752 // ----------------------------------------------------------------------------- |
|
753 // CPhSrvSubSessionImageHandler::ConstructVTImageSearchPathLC |
|
754 // |
|
755 // Construct search path for VT image. |
|
756 // ----------------------------------------------------------------------------- |
|
757 // |
|
758 HBufC* CPhSrvSubSessionImageHandler::ConstructVTImageSearchPathLC( |
|
759 const TBool aDefaultImage, |
|
760 TPtrC& aPath ) const |
|
761 { |
|
762 _DPRINT( 4, "CPhSrvSubSessionImageHandler::ConstructVTImageSearchPathLC<" ) |
|
763 HBufC* hfilePath = HBufC::NewLC( KMaxFileName ); |
|
764 TPtr filePath = hfilePath->Des(); |
|
765 |
|
766 filePath = iFilePath; // = "\private\<phone server uid>\" |
|
767 |
|
768 if ( aDefaultImage ) |
|
769 { |
|
770 // = "z:\private\<phone server uid>\" |
|
771 // == |
|
772 filePath.Insert( 0, KPhSrvImageDriveRom ); |
|
773 |
|
774 aPath.Set( filePath ); |
|
775 |
|
776 // = "z:\private\<phone server uid>\vtdefaultimage" |
|
777 // ============== |
|
778 filePath.Append( KPhSrvVTDefaultImageName() ); |
|
779 } |
|
780 else |
|
781 { |
|
782 // = "c:\private\<phone server uid>\" |
|
783 // == |
|
784 filePath.Insert( 0, iDriveName ); |
|
785 |
|
786 aPath.Set( filePath ); |
|
787 |
|
788 // = "c:\private\<phone server uid>\vtstillimage" |
|
789 // ============ |
|
790 filePath.Append( KPhSrvVTImageName() ); |
|
791 } |
|
792 // = "c:\private\<phone server uid>\<still|default>*" |
|
793 // = |
|
794 filePath.Append( KPhSrvImageWildCard() ); |
|
795 |
|
796 // = "c:\private\<phone server uid>\<still|default>*.mbm" |
|
797 // ==== |
|
798 filePath.Append( KPhSrvImageSuffix() ); |
|
799 _DPRINT( 4, "CPhSrvSubSessionImageHandler::ConstructVTImageSearchPathLC>" ) |
|
800 return hfilePath; |
|
801 } |
|
802 |
|
803 // ----------------------------------------------------------------------------- |
|
804 // CPhSrvSubSessionImageHandler::ConstructL |
|
805 // |
|
806 // 2nd phase construction. |
|
807 // ----------------------------------------------------------------------------- |
|
808 // |
|
809 void CPhSrvSubSessionImageHandler::ConstructL() |
|
810 { |
|
811 _DPRINT( 4, "CPhSrvSubSessionImageHandler::CtorL" ) |
|
812 PhoneSession().PhoneServer().ConnectFBS(); |
|
813 User::LeaveIfError( iFs.Connect() ); |
|
814 User::LeaveIfError( iFs.ShareProtected() ); |
|
815 MakeImageDirL(); |
|
816 User::LeaveIfError( iFs.PrivatePath( iFilePath ) ); |
|
817 _DPRINT( 4, "CPhSrvSubSessionImageHandler::CtorL>" ) |
|
818 } |
|
819 |
|
820 // ----------------------------------------------------------------------------- |
|
821 // CPhSrvSubSessionImageHandler::DeleteLogoL |
|
822 // |
|
823 // Checks if logo(s) should be deleted, and deletes them if needed. |
|
824 // ----------------------------------------------------------------------------- |
|
825 // |
|
826 TBool CPhSrvSubSessionImageHandler::DeleteLogoL( |
|
827 const TPhCltCountryCode aCountryCode, |
|
828 const TPhCltNetworkCode aNetworkCode, |
|
829 const TPhCltExtOperatorLogoType aLogoType, |
|
830 const TInt aFileHandle ) |
|
831 { |
|
832 _DPRINT( 4, "PhSrvImageHandler::DeleteLogoL" ) |
|
833 TBool deleted = EFalse; |
|
834 |
|
835 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo ", aCountryCode ) |
|
836 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo ", aNetworkCode ) |
|
837 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo ", aLogoType ) |
|
838 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo ", aFileHandle ) |
|
839 |
|
840 // Check if all, one or none. |
|
841 if ( aFileHandle == KPhCltDeleteOperatorLogo ) |
|
842 { |
|
843 HBufC* hbuf = HBufC::NewLC(KPhSrvNameMaxLen); |
|
844 TPtr buf = hbuf->Des(); |
|
845 if ( aCountryCode == KPhCltDeleteOperatorLogo && |
|
846 aNetworkCode == KPhCltDeleteOperatorLogo ) |
|
847 { |
|
848 // Delete all logos. |
|
849 TFindFile* finder = new(ELeave) TFindFile(iFs); |
|
850 CleanupStack::PushL(finder); |
|
851 |
|
852 HBufC* hfilePath = HBufC::NewLC(KMaxFileName); |
|
853 TPtr filePath = hfilePath->Des(); |
|
854 filePath = iDriveName; |
|
855 filePath.Append( iFilePath ); |
|
856 |
|
857 buf.Append( KPhSrvOperatorLogoPrefix ); |
|
858 buf.Append( KPhSrvLogoMncMccSeparator ); |
|
859 buf.Append( KPhSrvImageWildCard ); |
|
860 #ifdef __PHENG_DEBUG_INFO__ |
|
861 RDebug::Print( _L( |
|
862 "CPhSrvSubSessionImageHandler::DelLogo: %S"), &buf ); |
|
863 #endif |
|
864 CDir* foundFiles = NULL; |
|
865 const TInt err = finder->FindWildByDir( buf, filePath, foundFiles ); |
|
866 if ( err != KErrNone ) |
|
867 { |
|
868 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo Leave", err ) |
|
869 delete foundFiles; |
|
870 foundFiles = NULL; |
|
871 User::Leave( err ); |
|
872 } |
|
873 for ( TInt i = 0; i < foundFiles->Count(); i++ ) |
|
874 { |
|
875 const TEntry& entry = foundFiles->operator[ ]( i ); |
|
876 #ifdef __PHENG_DEBUG_INFO__ |
|
877 RDebug::Print( _L( |
|
878 "CPhSrvSubSessionImageHandler::DelLogo: rem %S"), &entry.iName ); |
|
879 #endif |
|
880 BaflUtils::DeleteFile( iFs, entry.iName ); |
|
881 } |
|
882 delete foundFiles; |
|
883 deleted = ETrue; |
|
884 NotifyListeners( // Error ignored. |
|
885 KPhCltDeleteOperatorLogo, KPhCltDeleteOperatorLogo, |
|
886 TTelephonyOTALogoUpdate::EPSTelephonyAllLogosDeleted ); |
|
887 // new P&S key update |
|
888 NotifyListeners( // Error ignored. |
|
889 KPhCltDeleteOperatorLogo, KPhCltDeleteOperatorLogo, |
|
890 TTelOTALogoUpdate::EPSTelephonyAllLogosDeleted ); |
|
891 |
|
892 CleanupStack::PopAndDestroy( 2, hfilePath ); // finder, hfilePath |
|
893 } |
|
894 else |
|
895 { |
|
896 // Delete specified logo. |
|
897 ConstructLogoFileNameL( |
|
898 aCountryCode, aNetworkCode, aLogoType, buf ); |
|
899 BaflUtils::DeleteFile( iFs, buf ); |
|
900 deleted = ETrue; |
|
901 NotifyListeners( aCountryCode, aNetworkCode, |
|
902 TTelephonyOTALogoUpdate::EPSTelephonyLogoDeleted ); |
|
903 NotifyListeners( // Error ignored. |
|
904 KPhCltDeleteOperatorLogo, KPhCltDeleteOperatorLogo, |
|
905 TTelOTALogoUpdate::EPSTelephonyAllLogosDeleted ); |
|
906 } |
|
907 |
|
908 CleanupStack::PopAndDestroy( hbuf ); |
|
909 } |
|
910 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::DelLogo>", deleted ) |
|
911 return deleted; |
|
912 } |
|
913 |
|
914 // ----------------------------------------------------------------------------- |
|
915 // CPhSrvSubSessionImageHandler::ConstructLogoFileNameL |
|
916 // |
|
917 // Creates operator logo file name. |
|
918 // ----------------------------------------------------------------------------- |
|
919 // |
|
920 void CPhSrvSubSessionImageHandler::ConstructLogoFileNameL( |
|
921 const TPhCltCountryCode aCountryCode, |
|
922 const TPhCltNetworkCode aNetworkCode, |
|
923 const TPhCltExtOperatorLogoType aLogoType, |
|
924 TDes& aFileName ) |
|
925 { |
|
926 _DPRINT( 4, "CPhSrvSubSessionImageHandler::LogoName") |
|
927 aFileName.Zero(); |
|
928 if ( aLogoType == EPhCltLogoTypeOTA ) |
|
929 { |
|
930 aFileName.Append( iDriveName ); |
|
931 } |
|
932 else |
|
933 { |
|
934 aFileName.Append( KPhSrvImageDriveRom ); |
|
935 } |
|
936 aFileName.Append( iFilePath ); |
|
937 aFileName.Append( KPhSrvOperatorLogoPrefix ); |
|
938 aFileName.Append( KPhSrvLogoMncMccSeparator ); |
|
939 aFileName.AppendNum( aCountryCode ); |
|
940 aFileName.Append( KPhSrvLogoMncMccSeparator ); |
|
941 aFileName.AppendNum( aNetworkCode ); |
|
942 aFileName.Append( KPhSrvLogoMncMccSeparator ); |
|
943 AppendLogoTypeAsTextL( aLogoType, aFileName ); |
|
944 aFileName.Append( KPhSrvImageSuffix ); |
|
945 #ifdef __PHENG_DEBUG_INFO__ |
|
946 RDebug::Print( _L( |
|
947 "CPhSrvSubSessionImageHandler::LogoName: %S"), &aFileName ); |
|
948 #endif |
|
949 } |
|
950 |
|
951 // ----------------------------------------------------------------------------- |
|
952 // CPhSrvSubSessionImageHandler::AppendLogoTypeAsTextL |
|
953 // |
|
954 // Appends logo type to buffer. |
|
955 // ----------------------------------------------------------------------------- |
|
956 // |
|
957 void CPhSrvSubSessionImageHandler:: |
|
958 AppendLogoTypeAsTextL( |
|
959 const TPhCltExtOperatorLogoType aLogoType, TDes& aType ) |
|
960 { |
|
961 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::LogoType: ", aLogoType ) |
|
962 switch ( aLogoType ) |
|
963 { |
|
964 case EPhCltLogoTypeOTA: |
|
965 aType.Append( KPhSrvLogoTypeIndicatorOTA ); |
|
966 break; |
|
967 case EPhCltLogoTypeProgrammable: |
|
968 aType.Append( KPhSrvLogoTypeIndicatorProg ); |
|
969 break; |
|
970 default: |
|
971 User::Leave( KErrNotSupported ); |
|
972 break; |
|
973 } |
|
974 _DPRINT( 4, "CPhSrvSubSessionImageHandler::LogoType>" ) |
|
975 } |
|
976 |
|
977 |
|
978 // ----------------------------------------------------------------------------- |
|
979 // CPhSrvSubSessionImageHandler::NotifyListeners |
|
980 // |
|
981 // Updates publish & subscribe information with event happened. |
|
982 // ----------------------------------------------------------------------------- |
|
983 // |
|
984 TInt CPhSrvSubSessionImageHandler:: |
|
985 NotifyListeners( const TPhCltCountryCode aCountryCode, |
|
986 const TPhCltNetworkCode aNetworkCode, |
|
987 const TTelephonyOTALogoUpdate::TPSOperatorLogoUpdateEvent aEvent ) |
|
988 { |
|
989 TInt err( KErrNone ); |
|
990 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aCountryCode ) |
|
991 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aNetworkCode ) |
|
992 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aEvent ) |
|
993 // If not exist define key |
|
994 if ( !iPropertyDefined ) |
|
995 { |
|
996 err = RProperty::Define( KPSUidPhoneClientServerInformation, |
|
997 KTelOperatorLogoUpdated, RProperty::EByteArray, ECapability_None, ECapabilityWriteDeviceData); |
|
998 |
|
999 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify defined: ", err ) |
|
1000 if ( err == KErrAlreadyExists ) |
|
1001 { |
|
1002 // No error. |
|
1003 err = KErrNone; |
|
1004 } |
|
1005 } |
|
1006 |
|
1007 // Set event |
|
1008 if ( err == KErrNone ) |
|
1009 { |
|
1010 TTelephonyOTALogoUpdate update; |
|
1011 TTelephonyOTALogoUpdate::TOTALogoUpdatePckg logoUpdate( update ); |
|
1012 logoUpdate().iEvent = aEvent; |
|
1013 logoUpdate().iMCC = aCountryCode; |
|
1014 logoUpdate().iMNC = aNetworkCode; |
|
1015 iPropertyDefined = ETrue; |
|
1016 err = RProperty::Set( |
|
1017 KPSUidPhoneClientServerInformation, KTelOperatorLogoUpdated, logoUpdate ); |
|
1018 } |
|
1019 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify> ", err ) |
|
1020 return err; |
|
1021 } |
|
1022 |
|
1023 // ----------------------------------------------------------------------------- |
|
1024 // CPhSrvSubSessionImageHandler::NotifyListeners |
|
1025 // |
|
1026 // Updates publish & subscribe information with event happened. |
|
1027 // New P&S key used. |
|
1028 // ----------------------------------------------------------------------------- |
|
1029 // |
|
1030 TInt CPhSrvSubSessionImageHandler:: |
|
1031 NotifyListeners( const TPhCltCountryCode aCountryCode, |
|
1032 const TPhCltNetworkCode aNetworkCode, |
|
1033 const TTelOTALogoUpdate::TPSOperatorLogoUpdateEvent aEvent ) |
|
1034 { |
|
1035 TInt err( KErrNone ); |
|
1036 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aCountryCode ) |
|
1037 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aNetworkCode ) |
|
1038 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify ", aEvent ) |
|
1039 // If not exist define key |
|
1040 if ( !iPropertyDefined ) |
|
1041 { |
|
1042 err = RProperty::Define( KPSUidPhoneClientServerInformation, |
|
1043 KTelOperatorLogoUpdated, RProperty::EByteArray, ECapability_None, ECapabilityWriteDeviceData); |
|
1044 |
|
1045 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify defined: ", err ) |
|
1046 if ( err == KErrAlreadyExists ) |
|
1047 { |
|
1048 // No error. |
|
1049 err = KErrNone; |
|
1050 } |
|
1051 } |
|
1052 |
|
1053 // Set event |
|
1054 if ( err == KErrNone ) |
|
1055 { |
|
1056 TTelOTALogoUpdate update; |
|
1057 TTelOTALogoUpdate::TOTALogoUpdatePckg logoUpdate( update ); |
|
1058 logoUpdate().iEvent = aEvent; |
|
1059 logoUpdate().iMCC = aCountryCode; |
|
1060 logoUpdate().iMNC = aNetworkCode; |
|
1061 iPropertyDefined = ETrue; |
|
1062 err = RProperty::Set( |
|
1063 KPSUidPhoneClientServerInformation, KTelOperatorLogoUpdated, logoUpdate ); |
|
1064 } |
|
1065 _DDPRINT( 4, "CPhSrvSubSessionImageHandler::Notify> ", err ) |
|
1066 return err; |
|
1067 } |
|
1068 |
|
1069 // ----------------------------------------------------------------------------- |
|
1070 // CPhSrvOperatorLogoContainer::CPhSrvOperatorLogoContainer |
|
1071 // |
|
1072 // Constructor. |
|
1073 // ----------------------------------------------------------------------------- |
|
1074 // |
|
1075 CPhSrvSubSessionImageHandler:: |
|
1076 CPhSrvOperatorLogoContainer::CPhSrvOperatorLogoContainer( |
|
1077 const TPhCltCountryCode aCountryCode, |
|
1078 const TPhCltNetworkCode aNetworkCode, |
|
1079 const TPhCltExtOperatorLogoType aLogoType, |
|
1080 CFbsBitmap* aBitmap ) : |
|
1081 iBitmap( aBitmap ), iCountryCode( aCountryCode ), |
|
1082 iNetworkCode( aNetworkCode ), iLogoType( aLogoType ) |
|
1083 { |
|
1084 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Container::Ctor" ) |
|
1085 } |
|
1086 |
|
1087 // ----------------------------------------------------------------------------- |
|
1088 // CPhSrvOperatorLogoContainer::~CPhSrvOperatorLogoContainer |
|
1089 // |
|
1090 // Destructor. |
|
1091 // ----------------------------------------------------------------------------- |
|
1092 // |
|
1093 CPhSrvSubSessionImageHandler:: |
|
1094 CPhSrvOperatorLogoContainer::~CPhSrvOperatorLogoContainer( ) |
|
1095 { |
|
1096 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Container::Dtor" ) |
|
1097 delete iBitmap; |
|
1098 iBitmap = NULL; |
|
1099 _DPRINT( 4, "CPhSrvSubSessionImageHandler::Container::Dtor>" ) |
|
1100 } |
|
1101 |
|
1102 // End of File |