24
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Name : CSatIconTsy.cpp
|
|
15 |
// Part of : Common SIM ATK TSY / commonsimatktsy
|
|
16 |
// Icon related functionality of Sat Tsy
|
|
17 |
// Version : 1.0
|
|
18 |
// INCLUDES
|
|
19 |
//
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
#include <satcs.h> // ETel Ipcs
|
|
24 |
#include "cmmmessagemanagerbase.h" // Message manager class for forwarding req.
|
|
25 |
//#include <TSatIconInfo.h> // For icon color coding
|
|
26 |
#include "TfLogger.h" // For TFLOGSTRING
|
|
27 |
|
|
28 |
#include "CSatDataPackage.h" // Parameter packing
|
|
29 |
#include "CSatIconTsy.h" // Class header
|
|
30 |
#include "CSatTsyReqHandleStore.h"
|
|
31 |
#include "msattsy_ipcdefs.h" // Sat Tsy specific request types
|
|
32 |
|
|
33 |
#include <etelsat.h>
|
|
34 |
|
|
35 |
|
|
36 |
// -----------------------------------------------------------------------------
|
|
37 |
// CSatIconTsy::NewL
|
|
38 |
// Two-phased constructor.
|
|
39 |
// -----------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
CSatIconTsy* CSatIconTsy::NewL
|
|
42 |
(
|
|
43 |
CSatTsy* aSatTsy
|
|
44 |
)
|
|
45 |
{
|
|
46 |
TFLOGSTRING("CSAT: CSatIconTsy::NewL");
|
|
47 |
CSatIconTsy* const satIconTsy = new ( ELeave ) CSatIconTsy();
|
|
48 |
CleanupStack::PushL( satIconTsy );
|
|
49 |
satIconTsy->iSatTsy = aSatTsy;
|
|
50 |
satIconTsy->ConstructL();
|
|
51 |
CleanupStack::Pop( satIconTsy );
|
|
52 |
TFLOGSTRING("CSAT: CSatIconTsy::NewL, end of method");
|
|
53 |
return satIconTsy;
|
|
54 |
}
|
|
55 |
|
|
56 |
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
// CSatIconTsy::~CSatIconTsy
|
|
59 |
// Destructor
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
CSatIconTsy::~CSatIconTsy
|
|
63 |
(
|
|
64 |
void
|
|
65 |
)
|
|
66 |
{
|
|
67 |
TFLOGSTRING("CSAT: CSatIconTsy::~CSatIconTsy");
|
|
68 |
// Unregister.
|
|
69 |
iSatTsy->MessageManager()->RegisterTsyObject(
|
|
70 |
CMmMessageManagerBase::ESatIconTsyObjType, NULL );
|
|
71 |
}
|
|
72 |
|
|
73 |
// -----------------------------------------------------------------------------
|
|
74 |
// CSatIconTsy::ConstructL
|
|
75 |
// Symbian 2nd phase constructor. Initialises internal attributes.
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
void CSatIconTsy::ConstructL
|
|
79 |
(
|
|
80 |
void
|
|
81 |
)
|
|
82 |
{
|
|
83 |
TFLOGSTRING("CSAT: CSatIconTsy::ConstructL\n" );
|
|
84 |
iIconReqTypeOngoing = ERequestTypeUnknown;
|
|
85 |
// Register.
|
|
86 |
iSatTsy->MessageManager()->RegisterTsyObject(
|
|
87 |
CMmMessageManagerBase::ESatIconTsyObjType, this );
|
|
88 |
|
|
89 |
iIconData = NULL;
|
|
90 |
iRecordData.Zero();
|
|
91 |
iImageInstanceNoInRecord = 0;
|
|
92 |
}
|
|
93 |
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
// CSatIconTsy::CSatIconTsy
|
|
96 |
// C++ constructor
|
|
97 |
// -----------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
CSatIconTsy::CSatIconTsy
|
|
100 |
(
|
|
101 |
void
|
|
102 |
)
|
|
103 |
{
|
|
104 |
// None
|
|
105 |
}
|
|
106 |
|
|
107 |
// -----------------------------------------------------------------------------
|
|
108 |
// CSatIcon::DoExtFunc
|
|
109 |
// Icon specific functionality of CSatTsy::DoExtFuncL
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
TInt CSatIconTsy::DoExtFuncL
|
|
113 |
(
|
|
114 |
const TTsyReqHandle aTsyReqHandle, // Request handle
|
|
115 |
const TInt aIpc, // IPC number of request
|
|
116 |
const TDataPackage& aPackage // Contains parameters for request
|
|
117 |
)
|
|
118 |
{
|
|
119 |
|
|
120 |
TFLOGSTRING3("CSAT: CSatIconTsy::DoExtFuncL.\n \t\t\t IPC:%d\n \
|
|
121 |
\t\t\t Handle:%d", aIpc, aTsyReqHandle);
|
|
122 |
|
|
123 |
TInt ret( KErrNone );
|
|
124 |
|
|
125 |
TAny* dataPtr = aPackage.Ptr1();
|
|
126 |
TAny* dataPtr2 = aPackage.Ptr2();
|
|
127 |
|
|
128 |
switch ( aIpc )
|
|
129 |
{
|
|
130 |
case ESatGetIcon:
|
|
131 |
{
|
|
132 |
ret = GetIconL( aTsyReqHandle,
|
|
133 |
reinterpret_cast<TUint8*>( dataPtr ),
|
|
134 |
reinterpret_cast<RSat::TIcon*>( dataPtr2 ) );
|
|
135 |
break;
|
|
136 |
}
|
|
137 |
case ESatGetImageInstance:
|
|
138 |
{
|
|
139 |
ret = GetImageInstanceL( aTsyReqHandle,
|
|
140 |
aPackage.Des1n(), aPackage.Des2n() );
|
|
141 |
break;
|
|
142 |
}
|
|
143 |
case ESatGetClut:
|
|
144 |
{
|
|
145 |
ret = GetClutL( aTsyReqHandle,
|
|
146 |
reinterpret_cast<RSat::TInstanceNumberAndOffset*>( dataPtr ),
|
|
147 |
aPackage.Des2n() );
|
|
148 |
break;
|
|
149 |
}
|
|
150 |
default:
|
|
151 |
{
|
|
152 |
TFLOGSTRING2("CSAT: CSatIconTsy::DoExtFuncL unsupported IPC %d",
|
|
153 |
aIpc);
|
|
154 |
break;
|
|
155 |
}
|
|
156 |
}
|
|
157 |
|
|
158 |
return ret;
|
|
159 |
|
|
160 |
}
|
|
161 |
|
|
162 |
// -----------------------------------------------------------------------------
|
|
163 |
// CSatIconTsy::CompleteGetIconData
|
|
164 |
// Completes GetIcon request
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CSatIconTsy::CompleteGetIcon
|
|
168 |
(
|
|
169 |
CSatDataPackage* aDataPackage,
|
|
170 |
TInt aResult
|
|
171 |
)
|
|
172 |
{
|
|
173 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetIcon");
|
|
174 |
TPtrC8* icon = NULL;
|
|
175 |
TInt iconLength = 0;
|
|
176 |
|
|
177 |
// Unpack parameters
|
|
178 |
aDataPackage->UnPackData( &icon );
|
|
179 |
iconLength = icon->Length();
|
|
180 |
|
|
181 |
// Reset req handle. Returns the deleted req handle.
|
|
182 |
TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()->
|
|
183 |
ResetTsyReqHandle( CSatTsy::ESatGetIconReqType );
|
|
184 |
|
|
185 |
// In case the request was ongoing, continue..
|
|
186 |
if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
|
|
187 |
{
|
|
188 |
if ( KErrNone == aResult && iconLength )
|
|
189 |
{
|
|
190 |
TFLOGSTRING2("CSAT: CSatIconTsy::CompleteGetIcon,\
|
|
191 |
Icon data length: %d", iconLength);
|
|
192 |
// Check the size...
|
|
193 |
if ( iIconData->MaxLength() >= iconLength )
|
|
194 |
{
|
|
195 |
iIconData->Copy( icon->Ptr(), iconLength );
|
|
196 |
TFLOGSTRING2("CSAT: CSatIconTsy::CompleteGetIcon,\
|
|
197 |
iIconData length: %d", iIconData->Length() );
|
|
198 |
iRecordData.Copy( *iIconData );
|
|
199 |
}
|
|
200 |
else // Data is too big for client's buffer
|
|
201 |
{
|
|
202 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetIcon,\
|
|
203 |
Icon data length exceeded");
|
|
204 |
aResult = KErrOverflow;
|
|
205 |
iIconData->Zero();
|
|
206 |
}
|
|
207 |
}
|
|
208 |
else
|
|
209 |
{
|
|
210 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetIcon,\
|
|
211 |
Error occured in LSAT, or Icon length is 0");
|
|
212 |
// Reset the length
|
|
213 |
iIconData->Zero();
|
|
214 |
}
|
|
215 |
|
|
216 |
iIconData = NULL;
|
|
217 |
iSatTsy->ReqCompleted( reqHandle, aResult );
|
|
218 |
}
|
|
219 |
}
|
|
220 |
|
|
221 |
// -----------------------------------------------------------------------------
|
|
222 |
// CSatIconTsy::CompleteGetImageInstance
|
|
223 |
// Completes GetImageInstance request
|
|
224 |
// -----------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
void CSatIconTsy::CompleteGetImageInstance
|
|
227 |
(
|
|
228 |
CSatDataPackage* aDataPackage,
|
|
229 |
TInt aResult
|
|
230 |
)
|
|
231 |
{
|
|
232 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetImageInstance");
|
|
233 |
TPtrC8* icon = NULL;
|
|
234 |
TDes8* info;
|
|
235 |
|
|
236 |
// Unpack parameters
|
|
237 |
aDataPackage->UnPackData( &icon, &info );
|
|
238 |
// Get icon data length
|
|
239 |
TUint8 iconLength = icon->Length();
|
|
240 |
|
|
241 |
// Reset req handle. Returns the deleted req handle.
|
|
242 |
TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()->
|
|
243 |
ResetTsyReqHandle( CSatTsy::ESatGetImageInstanceReqType );
|
|
244 |
|
|
245 |
// In case the request was ongoing, continue..
|
|
246 |
if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
|
|
247 |
{
|
|
248 |
if ( KErrNone == aResult && iconLength > 0 )
|
|
249 |
{
|
|
250 |
// Check the size....
|
|
251 |
if ( iIconData->MaxLength() >= iconLength )
|
|
252 |
{
|
|
253 |
TFLOGSTRING2("CSAT: CSatIconTsy::CompleteGetImageInstance,\
|
|
254 |
Icon length: %d", iconLength);
|
|
255 |
// Icon body
|
|
256 |
if( info->Length() == KIconInfoLength )
|
|
257 |
{
|
|
258 |
TInt colorCoding = iRecordData[ KImageCodingSchemeByteNr +
|
|
259 |
( iImageInstanceNoInRecord - 1 ) *
|
|
260 |
KImageInstanceFileLength ];
|
|
261 |
// There is difference in the header length
|
|
262 |
// between the color and b&w icons
|
|
263 |
if ( RSat::KBasic == colorCoding )
|
|
264 |
{
|
|
265 |
TFLOGSTRING("CSAT: CSatIconTsy::\
|
|
266 |
CompleteGetImageInstance,B&W");
|
|
267 |
iIconData->Copy( ( *info ).Mid( 0, 2) );
|
|
268 |
}
|
|
269 |
else
|
|
270 |
{
|
|
271 |
iIconData->Copy( *info );
|
|
272 |
}
|
|
273 |
|
|
274 |
iIconData->Append( *icon );
|
|
275 |
}
|
|
276 |
// Clut and record
|
|
277 |
else
|
|
278 |
{
|
|
279 |
iIconData->Copy( *icon );
|
|
280 |
}
|
|
281 |
}
|
|
282 |
else // Data is too big for client's buffer
|
|
283 |
{
|
|
284 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetImageInstance,\
|
|
285 |
Icon length exceeded");
|
|
286 |
aResult = KErrOverflow;
|
|
287 |
iIconData->Zero();
|
|
288 |
}
|
|
289 |
}
|
|
290 |
else
|
|
291 |
{
|
|
292 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetImageInstance,\
|
|
293 |
Error occured in LSAT or Icon length is 0");
|
|
294 |
// Reset the length
|
|
295 |
iIconData->Zero();
|
|
296 |
}
|
|
297 |
|
|
298 |
iIconData = NULL;
|
|
299 |
iIconReqTypeOngoing = ERequestTypeUnknown;
|
|
300 |
|
|
301 |
iSatTsy->ReqCompleted( reqHandle, aResult );
|
|
302 |
}
|
|
303 |
}
|
|
304 |
|
|
305 |
// -----------------------------------------------------------------------------
|
|
306 |
// CSatIconTsy::CompleteGetClut
|
|
307 |
// Completes GetClut request
|
|
308 |
// -----------------------------------------------------------------------------
|
|
309 |
//
|
|
310 |
void CSatIconTsy::CompleteGetClut
|
|
311 |
(
|
|
312 |
CSatDataPackage* aDataPackage,
|
|
313 |
TInt aResult
|
|
314 |
)
|
|
315 |
{
|
|
316 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetClut");
|
|
317 |
TPtrC8* clut = NULL;
|
|
318 |
|
|
319 |
// Unpack parameters
|
|
320 |
aDataPackage->UnPackData( &clut );
|
|
321 |
|
|
322 |
// Reset req handle. Returns the deleted req handle.
|
|
323 |
TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()->
|
|
324 |
ResetTsyReqHandle( CSatTsy::ESatGetClutReqType );
|
|
325 |
|
|
326 |
// In case the request was ongoing, continue..
|
|
327 |
if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
|
|
328 |
{
|
|
329 |
if ( KErrNone == aResult && clut->Length() > 0)
|
|
330 |
{
|
|
331 |
// Check the size....
|
|
332 |
if ( iIconData->MaxLength() >= clut->Length() )
|
|
333 |
{
|
|
334 |
iIconData->Copy( *clut );
|
|
335 |
}
|
|
336 |
else // Data is too big for client's buffer
|
|
337 |
{
|
|
338 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetClut,\
|
|
339 |
Clut length exceeded");
|
|
340 |
aResult = KErrOverflow;
|
|
341 |
iIconData->Zero();
|
|
342 |
}
|
|
343 |
}
|
|
344 |
else
|
|
345 |
{
|
|
346 |
TFLOGSTRING("CSAT: CSatIconTsy::CompleteGetClut,\
|
|
347 |
Error occured in LSAT or Icon length is 0");
|
|
348 |
// Reset the length
|
|
349 |
iIconData->Zero();
|
|
350 |
}
|
|
351 |
|
|
352 |
iIconData = NULL;
|
|
353 |
iIconReqTypeOngoing = ERequestTypeUnknown;
|
|
354 |
|
|
355 |
iSatTsy->ReqCompleted( reqHandle, aResult );
|
|
356 |
}
|
|
357 |
}
|
|
358 |
|
|
359 |
// -----------------------------------------------------------------------------
|
|
360 |
// CSatIconTsy::GetIconL
|
|
361 |
// This method gets the content of the EF_IMG record specified
|
|
362 |
// by aRecordnumber
|
|
363 |
// -----------------------------------------------------------------------------
|
|
364 |
//
|
|
365 |
TInt CSatIconTsy::GetIconL
|
|
366 |
(
|
|
367 |
const TTsyReqHandle aTsyReqHandle,
|
|
368 |
TUint8* aRecordNumber,
|
|
369 |
RSat::TIcon* aIconEf
|
|
370 |
)
|
|
371 |
{
|
|
372 |
TFLOGSTRING("CSAT: CSatIconTsy::GetIconL");
|
|
373 |
TInt ret = KErrNone;
|
|
374 |
|
|
375 |
iImageInstanceNoInRecord = 0;
|
|
376 |
|
|
377 |
// Get possibly existing request handle
|
|
378 |
TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()->
|
|
379 |
TsyReqHandle( CSatTsy::ESatGetIconReqType );
|
|
380 |
|
|
381 |
// In case the request was ongoing, complete right away..
|
|
382 |
if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
|
|
383 |
{
|
|
384 |
TFLOGSTRING("CSAT: CSatIcon::GetIconL, KErrServerBusy");
|
|
385 |
iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy);
|
|
386 |
}
|
|
387 |
else
|
|
388 |
{
|
|
389 |
// Save the request handle
|
|
390 |
iSatTsy->SaveReqHandle( aTsyReqHandle, CSatTsy::ESatGetIconReqType );
|
|
391 |
|
|
392 |
iIconData = aIconEf;
|
|
393 |
iIconReqTypeOngoing = EGetIconReq;
|
|
394 |
iRecordNumber = *aRecordNumber;
|
|
395 |
|
|
396 |
// Length is zero -> NAA will return all the contents of a given file
|
|
397 |
TUint16 length( 0 );
|
|
398 |
|
|
399 |
// If the Elementary File pointed by File ID is linear fixed or cyclic,
|
|
400 |
// then the least significant OffSet byte denotes the record number,
|
|
401 |
// while the most significant OffSet byte denotes the start byte within
|
|
402 |
// that record.
|
|
403 |
TUint8 highByte = *aRecordNumber;
|
|
404 |
TUint8 lowByte = 0x00; // Start byte
|
|
405 |
TUint16 offset( static_cast<TUint16>( ( highByte << 8 ) + lowByte ) );
|
|
406 |
|
|
407 |
// File ID
|
|
408 |
TBuf8<KFilePathLength> simFilePath;
|
|
409 |
|
|
410 |
// The 16bit values are appended in little endian
|
|
411 |
// this is the correct way to map them into 8bit values
|
|
412 |
simFilePath.Append( TUint8 ( KMasterFile >> 8) );
|
|
413 |
// lint -e{778} Constant expression evaluates to 0 in operation
|
|
414 |
simFilePath.Append( TUint8 ( KMasterFile & 0xff ) );
|
|
415 |
simFilePath.Append( TUint8 ( KDedicatedFile >> 8) );
|
|
416 |
simFilePath.Append( TUint8 ( KDedicatedFile & 0xff ) );
|
|
417 |
simFilePath.Append( TUint8 ( KDedicatedFileGraphics >> 8) );
|
|
418 |
simFilePath.Append( TUint8 ( KDedicatedFileGraphics & 0xff ) );
|
|
419 |
simFilePath.Append( TUint8 ( KElementaryFileImg >> 8) );
|
|
420 |
simFilePath.Append( TUint8 ( KElementaryFileImg & 0xff ) );
|
|
421 |
|
|
422 |
TIconInfo iconInfoPkg;
|
|
423 |
iconInfoPkg.iOffset = offset;
|
|
424 |
iconInfoPkg.iLength = length;
|
|
425 |
iconInfoPkg.iSimFilePath.Copy( simFilePath );
|
|
426 |
|
|
427 |
// Pack data
|
|
428 |
CSatDataPackage dataPackage;
|
|
429 |
dataPackage.PackData( &iconInfoPkg );
|
|
430 |
ret = iSatTsy->MessageManager()->HandleRequestL(
|
|
431 |
ESatTsyGetIconData, &dataPackage );
|
|
432 |
}
|
|
433 |
|
|
434 |
return ret;
|
|
435 |
}
|
|
436 |
|
|
437 |
|
|
438 |
// -----------------------------------------------------------------------------
|
|
439 |
// CSatIconTsy::GetImageInstanceL
|
|
440 |
// This method gets the image instance specified by the
|
|
441 |
// InstanceNumber, Offset and Length
|
|
442 |
// -----------------------------------------------------------------------------
|
|
443 |
//
|
|
444 |
TInt CSatIconTsy::GetImageInstanceL
|
|
445 |
(
|
|
446 |
const TTsyReqHandle aTsyReqHandle,
|
|
447 |
TDesC8* aInstanceInfo,
|
|
448 |
TDes8* aInstance
|
|
449 |
)
|
|
450 |
{
|
|
451 |
TFLOGSTRING("CSAT: CSatIconTsy::GetImageInstanceL");
|
|
452 |
TInt ret = KErrNone;
|
|
453 |
|
|
454 |
// Get possibly existing request handle
|
|
455 |
TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()->
|
|
456 |
TsyReqHandle( CSatTsy::ESatGetImageInstanceReqType );
|
|
457 |
|
|
458 |
// In case the request was ongoing, complete right away..
|
|
459 |
if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
|
|
460 |
{
|
|
461 |
TFLOGSTRING("CSAT: CSatIcon::GetImageInstanceL, KErrServerBusy");
|
|
462 |
iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy);
|
|
463 |
}
|
|
464 |
else
|
|
465 |
{
|
|
466 |
TInt iconNumber = iRecordData[0];
|
|
467 |
TBool iconFound( EFalse );
|
|
468 |
TInt pos( KImageInstanceIdOffset );
|
|
469 |
|
|
470 |
// Save the request handle
|
|
471 |
iSatTsy->SaveReqHandle( aTsyReqHandle,
|
|
472 |
CSatTsy::ESatGetImageInstanceReqType );
|
|
473 |
|
|
474 |
iIconData = aInstance;
|
|
475 |
iIconReqTypeOngoing = EGetImageInstanceReq;
|
|
476 |
|
|
477 |
RSat::TInstanceInfoV2Pckg* aPckg = REINTERPRET_CAST(
|
|
478 |
RSat::TInstanceInfoV2Pckg*, aInstanceInfo );
|
|
479 |
RSat::TInstanceInfoV2& instanceInfo = ( *aPckg ) ();
|
|
480 |
|
|
481 |
// Calculate position for icon imageinstance selected from record.
|
|
482 |
while( iconNumber && !iconFound )
|
|
483 |
{
|
|
484 |
// If the instance number, offset and length of the previously
|
|
485 |
// received record data match with the one received from the
|
|
486 |
// client, it means that the icon is found and request can be made
|
|
487 |
if( ( static_cast<TUint16>( instanceInfo.iInstanceNumber ) ==
|
|
488 |
static_cast<TUint16>(
|
|
489 |
iRecordData[ pos ] << 8 | iRecordData[ pos + 1 ] ) ) &&
|
|
490 |
( static_cast<TUint16>( instanceInfo.iOffset ) ==
|
|
491 |
static_cast<TUint16>(
|
|
492 |
iRecordData[ pos + 2 ] << 8 | iRecordData[ pos + 3 ] ) ) &&
|
|
493 |
( static_cast<TUint16>( instanceInfo.iLength ) ==
|
|
494 |
static_cast<TUint16>(
|
|
495 |
iRecordData[ pos + 4 ] << 8 | iRecordData[ pos + 5 ] ) ) )
|
|
496 |
{
|
|
497 |
iconFound = ETrue;
|
|
498 |
}
|
|
499 |
|
|
500 |
pos += KImageInstanceFileLength;
|
|
501 |
iconNumber--;
|
|
502 |
}
|
|
503 |
|
|
504 |
iImageInstanceNoInRecord = iRecordData[0] - iconNumber;
|
|
505 |
|
|
506 |
// Check icon data length
|
|
507 |
if( ( KIconDataMaxSize > instanceInfo.iLength ) && iconFound )
|
|
508 |
{
|
|
509 |
TBuf8<KGetIconDataPckgLength> data( 0 );
|
|
510 |
data.Append( iRecordNumber );
|
|
511 |
data.Append( iImageInstanceNoInRecord );
|
|
512 |
// Pack data
|
|
513 |
CSatDataPackage dataPackage;
|
|
514 |
dataPackage.PackData( &data );
|
|
515 |
ret = iSatTsy->MessageManager()->HandleRequestL(
|
|
516 |
ESatTsyGetImageInstance, &dataPackage );
|
|
517 |
}
|
|
518 |
}
|
|
519 |
|
|
520 |
return ret;
|
|
521 |
}
|
|
522 |
|
|
523 |
|
|
524 |
// -----------------------------------------------------------------------------
|
|
525 |
// CSatIconTsy::GetClutL
|
|
526 |
// This method gets the CLUT (Color look-up table) specified
|
|
527 |
// by aInstanceNumber and Offset.
|
|
528 |
// -----------------------------------------------------------------------------
|
|
529 |
//
|
|
530 |
TInt CSatIconTsy::GetClutL
|
|
531 |
(
|
|
532 |
const TTsyReqHandle aTsyReqHandle,
|
|
533 |
RSat::TInstanceNumberAndOffset* /*aNumberAndOffset*/,
|
|
534 |
TDes8* aClut
|
|
535 |
)
|
|
536 |
{
|
|
537 |
TFLOGSTRING("CSAT: CSatIconTsy::GetClutL");
|
|
538 |
TInt ret = KErrNone;
|
|
539 |
|
|
540 |
// Get possibly existing request handle
|
|
541 |
TTsyReqHandle reqHandle = iSatTsy->GetSatReqHandleStore()->
|
|
542 |
TsyReqHandle( CSatTsy::ESatGetImageInstanceReqType );
|
|
543 |
|
|
544 |
// In case the request was ongoing, complete right away..
|
|
545 |
if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
|
|
546 |
{
|
|
547 |
TFLOGSTRING("CSAT: CSatIcon::GetClutL : KErrServerBusy");
|
|
548 |
iSatTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy);
|
|
549 |
}
|
|
550 |
else
|
|
551 |
{
|
|
552 |
// Save the request handle
|
|
553 |
iSatTsy->SaveReqHandle( aTsyReqHandle, CSatTsy::ESatGetClutReqType );
|
|
554 |
|
|
555 |
iIconData = aClut;
|
|
556 |
iIconReqTypeOngoing = EGetClutReq;
|
|
557 |
|
|
558 |
// Icon sequence number counted
|
|
559 |
// Check icon data length
|
|
560 |
if( KIconDataMaxSize > ( *aClut ).MaxLength() )
|
|
561 |
{
|
|
562 |
TBuf8<KGetIconDataPckgLength> data( 0 );
|
|
563 |
data.Append( iRecordNumber );
|
|
564 |
data.Append( iImageInstanceNoInRecord );
|
|
565 |
// Pack data
|
|
566 |
CSatDataPackage dataPackage;
|
|
567 |
dataPackage.PackData( &data );
|
|
568 |
ret = iSatTsy->MessageManager()->HandleRequestL( ESatTsyGetClut,
|
|
569 |
&dataPackage );
|
|
570 |
}
|
|
571 |
}
|
|
572 |
|
|
573 |
iImageInstanceNoInRecord = 0;
|
|
574 |
return ret;
|
|
575 |
}
|
|
576 |
|
|
577 |
// End of File
|
|
578 |
|
|
579 |
|