1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
18 // INCLUDES |
18 // INCLUDES |
19 // |
19 // |
20 |
20 |
21 |
21 |
22 |
22 |
23 |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "csaticontsyTraces.h" |
|
27 #endif |
|
28 |
|
29 #include <satcs.h> // ETel Ipcs |
23 #include <satcs.h> // ETel Ipcs |
30 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
24 #include "cmmmessagemanagerbase.h" // Message manager class for forwarding req. |
31 //#include <TSatIconInfo.h> // For icon color coding |
25 //#include <TSatIconInfo.h> // For icon color coding |
|
26 #include "TfLogger.h" // For TFLOGSTRING |
32 |
27 |
33 #include "CSatDataPackage.h" // Parameter packing |
28 #include "CSatDataPackage.h" // Parameter packing |
34 #include "CSatIconTsy.h" // Class header |
29 #include "CSatIconTsy.h" // Class header |
35 #include "CSatTsyReqHandleStore.h" |
30 #include "CSatTsyReqHandleStore.h" |
36 #include "msattsy_ipcdefs.h" // Sat Tsy specific request types |
31 #include "msattsy_ipcdefs.h" // Sat Tsy specific request types |
46 CSatIconTsy* CSatIconTsy::NewL |
41 CSatIconTsy* CSatIconTsy::NewL |
47 ( |
42 ( |
48 CSatTsy* aSatTsy |
43 CSatTsy* aSatTsy |
49 ) |
44 ) |
50 { |
45 { |
51 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_NEWL_1, "CSAT: CSatIconTsy::NewL"); |
46 TFLOGSTRING("CSAT: CSatIconTsy::NewL"); |
52 CSatIconTsy* const satIconTsy = new ( ELeave ) CSatIconTsy(); |
47 CSatIconTsy* const satIconTsy = new ( ELeave ) CSatIconTsy(); |
53 CleanupStack::PushL( satIconTsy ); |
48 CleanupStack::PushL( satIconTsy ); |
54 satIconTsy->iSatTsy = aSatTsy; |
49 satIconTsy->iSatTsy = aSatTsy; |
55 satIconTsy->ConstructL(); |
50 satIconTsy->ConstructL(); |
56 CleanupStack::Pop( satIconTsy ); |
51 CleanupStack::Pop( satIconTsy ); |
57 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_NEWL_2, "CSAT: CSatIconTsy::NewL, end of method"); |
52 TFLOGSTRING("CSAT: CSatIconTsy::NewL, end of method"); |
58 return satIconTsy; |
53 return satIconTsy; |
59 } |
54 } |
60 |
55 |
61 |
56 |
62 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
67 CSatIconTsy::~CSatIconTsy |
62 CSatIconTsy::~CSatIconTsy |
68 ( |
63 ( |
69 void |
64 void |
70 ) |
65 ) |
71 { |
66 { |
72 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_DTOR_1, "CSAT: CSatIconTsy::~CSatIconTsy"); |
67 TFLOGSTRING("CSAT: CSatIconTsy::~CSatIconTsy"); |
73 // Unregister. |
68 // Unregister. |
74 iSatTsy->MessageManager()->RegisterTsyObject( |
69 iSatTsy->MessageManager()->RegisterTsyObject( |
75 CMmMessageManagerBase::ESatIconTsyObjType, NULL ); |
70 CMmMessageManagerBase::ESatIconTsyObjType, NULL ); |
76 } |
71 } |
77 |
72 |
83 void CSatIconTsy::ConstructL |
78 void CSatIconTsy::ConstructL |
84 ( |
79 ( |
85 void |
80 void |
86 ) |
81 ) |
87 { |
82 { |
88 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_CONSTRUCTL_1, "CSAT: CSatIconTsy::ConstructL\n" ); |
83 TFLOGSTRING("CSAT: CSatIconTsy::ConstructL\n" ); |
89 iIconReqTypeOngoing = ERequestTypeUnknown; |
84 iIconReqTypeOngoing = ERequestTypeUnknown; |
90 // Register. |
85 // Register. |
91 iSatTsy->MessageManager()->RegisterTsyObject( |
86 iSatTsy->MessageManager()->RegisterTsyObject( |
92 CMmMessageManagerBase::ESatIconTsyObjType, this ); |
87 CMmMessageManagerBase::ESatIconTsyObjType, this ); |
93 |
88 |
120 const TInt aIpc, // IPC number of request |
115 const TInt aIpc, // IPC number of request |
121 const TDataPackage& aPackage // Contains parameters for request |
116 const TDataPackage& aPackage // Contains parameters for request |
122 ) |
117 ) |
123 { |
118 { |
124 |
119 |
125 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_DOEXTFUNCL_1, "CSAT: CSatIconTsy::DoExtFuncL.\n \t\t\t IPC:%d\n \t\t\t Handle:%d", aIpc, aTsyReqHandle); |
120 TFLOGSTRING3("CSAT: CSatIconTsy::DoExtFuncL.\n \t\t\t IPC:%d\n \ |
|
121 \t\t\t Handle:%d", aIpc, aTsyReqHandle); |
126 |
122 |
127 TInt ret( KErrNone ); |
123 TInt ret( KErrNone ); |
128 |
124 |
129 TAny* dataPtr = aPackage.Ptr1(); |
125 TAny* dataPtr = aPackage.Ptr1(); |
130 TAny* dataPtr2 = aPackage.Ptr2(); |
126 TAny* dataPtr2 = aPackage.Ptr2(); |
188 // In case the request was ongoing, continue.. |
185 // In case the request was ongoing, continue.. |
189 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
186 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
190 { |
187 { |
191 if ( KErrNone == aResult && iconLength ) |
188 if ( KErrNone == aResult && iconLength ) |
192 { |
189 { |
193 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETICON_2, "CSAT: CSatIconTsy::CompleteGetIcon, Icon data length: %d", iconLength); |
190 TFLOGSTRING2("CSAT: CSatIconTsy::CompleteGetIcon,\ |
|
191 Icon data length: %d", iconLength); |
194 // Check the size... |
192 // Check the size... |
195 if ( iIconData->MaxLength() >= iconLength ) |
193 if ( iIconData->MaxLength() >= iconLength ) |
196 { |
194 { |
197 iIconData->Copy( icon->Ptr(), iconLength ); |
195 iIconData->Copy( icon->Ptr(), iconLength ); |
198 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETICON_3, "CSAT: CSatIconTsy::CompleteGetIcon, iIconData length: %d", iIconData->Length() ); |
196 TFLOGSTRING2("CSAT: CSatIconTsy::CompleteGetIcon,\ |
|
197 iIconData length: %d", iIconData->Length() ); |
199 iRecordData.Copy( *iIconData ); |
198 iRecordData.Copy( *iIconData ); |
200 } |
199 } |
201 else // Data is too big for client's buffer |
200 else // Data is too big for client's buffer |
202 { |
201 { |
203 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETICON_4, "CSAT: CSatIconTsy::CompleteGetIcon, Icon data length exceeded"); |
202 TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetIcon,\ |
|
203 Icon data length exceeded"); |
204 aResult = KErrOverflow; |
204 aResult = KErrOverflow; |
205 iIconData->Zero(); |
205 iIconData->Zero(); |
206 } |
206 } |
207 } |
207 } |
208 else |
208 else |
209 { |
209 { |
210 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETICON_5, "CSAT: CSatIconTsy::CompleteGetIcon, Error occured in LSAT, or Icon length is 0"); |
210 TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetIcon,\ |
|
211 Error occured in LSAT, or Icon length is 0"); |
211 // Reset the length |
212 // Reset the length |
212 iIconData->Zero(); |
213 iIconData->Zero(); |
213 } |
214 } |
214 |
215 |
215 iIconData = NULL; |
216 iIconData = NULL; |
226 ( |
227 ( |
227 CSatDataPackage* aDataPackage, |
228 CSatDataPackage* aDataPackage, |
228 TInt aResult |
229 TInt aResult |
229 ) |
230 ) |
230 { |
231 { |
231 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETIMAGEINSTANCE_1, "CSAT: CSatIconTsy::CompleteGetImageInstance"); |
232 TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetImageInstance"); |
232 TPtrC8* icon = NULL; |
233 TPtrC8* icon = NULL; |
233 TDes8* info; |
234 TDes8* info; |
234 |
235 |
235 // Unpack parameters |
236 // Unpack parameters |
236 aDataPackage->UnPackData( &icon, &info ); |
237 aDataPackage->UnPackData( &icon, &info ); |
247 if ( KErrNone == aResult && iconLength > 0 ) |
248 if ( KErrNone == aResult && iconLength > 0 ) |
248 { |
249 { |
249 // Check the size.... |
250 // Check the size.... |
250 if ( iIconData->MaxLength() >= iconLength ) |
251 if ( iIconData->MaxLength() >= iconLength ) |
251 { |
252 { |
252 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETIMAGEINSTANCE_2, "CSAT: CSatIconTsy::CompleteGetImageInstance, Icon length: %d", iconLength); |
253 TFLOGSTRING2("CSAT: CSatIconTsy::CompleteGetImageInstance,\ |
|
254 Icon length: %d", iconLength); |
253 // Icon body |
255 // Icon body |
254 if( info->Length() == KIconInfoLength ) |
256 if( info->Length() == KIconInfoLength ) |
255 { |
257 { |
256 TInt colorCoding = iRecordData[ KImageCodingSchemeByteNr + |
258 TInt colorCoding = iRecordData[ KImageCodingSchemeByteNr + |
257 ( iImageInstanceNoInRecord - 1 ) * |
259 ( iImageInstanceNoInRecord - 1 ) * |
258 KImageInstanceFileLength ]; |
260 KImageInstanceFileLength ]; |
259 // There is difference in the header length |
261 // There is difference in the header length |
260 // between the color and b&w icons |
262 // between the color and b&w icons |
261 if ( RSat::KBasic == colorCoding ) |
263 if ( RSat::KBasic == colorCoding ) |
262 { |
264 { |
263 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETIMAGEINSTANCE_3, "CSAT: CSatIconTsy::CompleteGetImageInstance,B&W"); |
265 TFLOGSTRING("CSAT: CSatIconTsy::\ |
|
266 CompleteGetImageInstance,B&W"); |
264 iIconData->Copy( ( *info ).Mid( 0, 2) ); |
267 iIconData->Copy( ( *info ).Mid( 0, 2) ); |
265 } |
268 } |
266 else |
269 else |
267 { |
270 { |
268 iIconData->Copy( *info ); |
271 iIconData->Copy( *info ); |
276 iIconData->Copy( *icon ); |
279 iIconData->Copy( *icon ); |
277 } |
280 } |
278 } |
281 } |
279 else // Data is too big for client's buffer |
282 else // Data is too big for client's buffer |
280 { |
283 { |
281 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETIMAGEINSTANCE_4, "CSAT: CSatIconTsy::CompleteGetImageInstance, Icon length exceeded"); |
284 TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetImageInstance,\ |
|
285 Icon length exceeded"); |
282 aResult = KErrOverflow; |
286 aResult = KErrOverflow; |
283 iIconData->Zero(); |
287 iIconData->Zero(); |
284 } |
288 } |
285 } |
289 } |
286 else |
290 else |
287 { |
291 { |
288 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETIMAGEINSTANCE_5, "CSAT: CSatIconTsy::CompleteGetImageInstance, Error occured in LSAT or Icon length is 0"); |
292 TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetImageInstance,\ |
|
293 Error occured in LSAT or Icon length is 0"); |
289 // Reset the length |
294 // Reset the length |
290 iIconData->Zero(); |
295 iIconData->Zero(); |
291 } |
296 } |
292 |
297 |
293 iIconData = NULL; |
298 iIconData = NULL; |
328 { |
333 { |
329 iIconData->Copy( *clut ); |
334 iIconData->Copy( *clut ); |
330 } |
335 } |
331 else // Data is too big for client's buffer |
336 else // Data is too big for client's buffer |
332 { |
337 { |
333 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETCLUT_2, "CSAT: CSatIconTsy::CompleteGetClut, Clut length exceeded"); |
338 TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetClut,\ |
|
339 Clut length exceeded"); |
334 aResult = KErrOverflow; |
340 aResult = KErrOverflow; |
335 iIconData->Zero(); |
341 iIconData->Zero(); |
336 } |
342 } |
337 } |
343 } |
338 else |
344 else |
339 { |
345 { |
340 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_COMPLETEGETCLUT_3, "CSAT: CSatIconTsy::CompleteGetClut, Error occured in LSAT or Icon length is 0"); |
346 TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetClut,\ |
|
347 Error occured in LSAT or Icon length is 0"); |
341 // Reset the length |
348 // Reset the length |
342 iIconData->Zero(); |
349 iIconData->Zero(); |
343 } |
350 } |
344 |
351 |
345 iIconData = NULL; |
352 iIconData = NULL; |
360 const TTsyReqHandle aTsyReqHandle, |
367 const TTsyReqHandle aTsyReqHandle, |
361 TUint8* aRecordNumber, |
368 TUint8* aRecordNumber, |
362 RSat::TIcon* aIconEf |
369 RSat::TIcon* aIconEf |
363 ) |
370 ) |
364 { |
371 { |
365 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_GETICONL_1, "CSAT: CSatIconTsy::GetIconL"); |
372 TFLOGSTRING("CSAT: CSatIconTsy::GetIconL"); |
366 TInt ret = KErrNone; |
373 TInt ret = KErrNone; |
367 |
374 |
368 iImageInstanceNoInRecord = 0; |
375 iImageInstanceNoInRecord = 0; |
369 |
376 |
370 // Get possibly existing request handle |
377 // Get possibly existing request handle |
372 TsyReqHandle( CSatTsy::ESatGetIconReqType ); |
379 TsyReqHandle( CSatTsy::ESatGetIconReqType ); |
373 |
380 |
374 // In case the request was ongoing, complete right away.. |
381 // In case the request was ongoing, complete right away.. |
375 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
382 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
376 { |
383 { |
377 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_GETICONL_2, "CSAT: CSatIcon::GetIconL, KErrServerBusy"); |
384 TFLOGSTRING("CSAT: CSatIcon::GetIconL, KErrServerBusy"); |
378 iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy); |
385 iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy); |
379 } |
386 } |
380 else |
387 else |
381 { |
388 { |
382 // Save the request handle |
389 // Save the request handle |
439 const TTsyReqHandle aTsyReqHandle, |
446 const TTsyReqHandle aTsyReqHandle, |
440 TDesC8* aInstanceInfo, |
447 TDesC8* aInstanceInfo, |
441 TDes8* aInstance |
448 TDes8* aInstance |
442 ) |
449 ) |
443 { |
450 { |
444 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_GETIMAGEINSTANCEL_1, "CSAT: CSatIconTsy::GetImageInstanceL"); |
451 TFLOGSTRING("CSAT: CSatIconTsy::GetImageInstanceL"); |
445 TInt ret = KErrNone; |
452 TInt ret = KErrNone; |
446 |
453 |
447 // Get possibly existing request handle |
454 // Get possibly existing request handle |
448 TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()-> |
455 TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()-> |
449 TsyReqHandle( CSatTsy::ESatGetImageInstanceReqType ); |
456 TsyReqHandle( CSatTsy::ESatGetImageInstanceReqType ); |
450 |
457 |
451 // In case the request was ongoing, complete right away.. |
458 // In case the request was ongoing, complete right away.. |
452 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
459 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
453 { |
460 { |
454 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_GETIMAGEINSTANCEL_2, "CSAT: CSatIcon::GetImageInstanceL, KErrServerBusy"); |
461 TFLOGSTRING("CSAT: CSatIcon::GetImageInstanceL, KErrServerBusy"); |
455 iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy); |
462 iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy); |
456 } |
463 } |
457 else |
464 else |
458 { |
465 { |
459 TInt iconNumber = iRecordData[0]; |
466 TInt iconNumber = iRecordData[0]; |
525 const TTsyReqHandle aTsyReqHandle, |
532 const TTsyReqHandle aTsyReqHandle, |
526 RSat::TInstanceNumberAndOffset* /*aNumberAndOffset*/, |
533 RSat::TInstanceNumberAndOffset* /*aNumberAndOffset*/, |
527 TDes8* aClut |
534 TDes8* aClut |
528 ) |
535 ) |
529 { |
536 { |
530 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_GETCLUTL_1, "CSAT: CSatIconTsy::GetClutL"); |
537 TFLOGSTRING("CSAT: CSatIconTsy::GetClutL"); |
531 TInt ret = KErrNone; |
538 TInt ret = KErrNone; |
532 |
539 |
533 // Get possibly existing request handle |
540 // Get possibly existing request handle |
534 TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()-> |
541 TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()-> |
535 TsyReqHandle( CSatTsy::ESatGetImageInstanceReqType ); |
542 TsyReqHandle( CSatTsy::ESatGetImageInstanceReqType ); |
536 |
543 |
537 // In case the request was ongoing, complete right away.. |
544 // In case the request was ongoing, complete right away.. |
538 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
545 if ( CSatTsy::ESatReqHandleUnknown != reqHandle ) |
539 { |
546 { |
540 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATICONTSY_GETCLUTL_2, "CSAT: CSatIcon::GetClutL : KErrServerBusy"); |
547 TFLOGSTRING("CSAT: CSatIcon::GetClutL : KErrServerBusy"); |
541 iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy); |
548 iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy); |
542 } |
549 } |
543 else |
550 else |
544 { |
551 { |
545 // Save the request handle |
552 // Save the request handle |