33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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 accessing icon data in SIM.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <fbs.h>
|
|
22 |
#include <centralrepository.h>
|
|
23 |
#include <etelsat.h>
|
|
24 |
#include <rsatservice.h>
|
|
25 |
#include <rsatsession.h>
|
|
26 |
#include <tsaticoninfo.h>
|
|
27 |
|
|
28 |
#include "tsatinternaliconinfo.h"
|
|
29 |
#include "SatSOpcodes.h"
|
|
30 |
#include "SatLog.h"
|
|
31 |
#include "SATPrivateCRKeys.h"
|
|
32 |
#include "csatpluginmonitor.h"
|
|
33 |
|
|
34 |
// CONSTANTS
|
|
35 |
// Length of the one icon info,
|
|
36 |
// defined in chapter 4.6.1.1 ETSI TS 131 102 V4.10.0 (2003-09)
|
|
37 |
const TInt KInfoLength = 9;
|
|
38 |
const TInt KMaxIconSizeNotRead = -1;
|
|
39 |
|
|
40 |
// Icon description must follow ETSI TS 131 102 V4.10.0 specification
|
|
41 |
const TUint8 KBitsInByte( 8 );
|
|
42 |
const TUint8 KIconWidth( 0 );
|
|
43 |
const TUint8 KIconHeigth( 1 );
|
|
44 |
const TUint8 KImageCodingScheme( 2 );
|
|
45 |
const TUint8 KHighFileId( 3 );
|
|
46 |
const TUint8 KLowFileId( 4 );
|
|
47 |
const TUint8 KHighIconOffset( 5 );
|
|
48 |
const TUint8 KLowIconOffset( 6 );
|
|
49 |
const TUint8 KHighIconLength( 7 );
|
|
50 |
const TUint8 KLowIconLength( 8 );
|
|
51 |
|
|
52 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
53 |
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
// RSatService::RSatService
|
|
56 |
// C++ default constructor can NOT contain any code, that
|
|
57 |
// might leave.
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
EXPORT_C RSatService::RSatService() :
|
|
61 |
RSubSessionBase(),
|
|
62 |
iMaxIconDataSize( KMaxIconSizeNotRead )
|
|
63 |
{
|
|
64 |
}
|
|
65 |
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
// RSatService::OpenL
|
|
68 |
// Connects a sub-session to SatServer.
|
|
69 |
// (other items were commented in a header).
|
|
70 |
// -----------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
EXPORT_C void RSatService::OpenL( const RSatSession& aSession )
|
|
73 |
{
|
|
74 |
LOG( SIMPLE, "SATCLIENT: RSatService::OpenL calling" )
|
|
75 |
#ifdef ENABLE_SAT_LOGGING
|
|
76 |
RProcess test;
|
|
77 |
LOG2( SIMPLE,
|
|
78 |
"SATCLIENT: RSatService::OpenL UID of calling process: 0x%x",
|
|
79 |
test.SecureId().iId )
|
|
80 |
test.Close();
|
|
81 |
#endif
|
|
82 |
|
|
83 |
const TIpcArgs args( TIpcArgs::ENothing );
|
|
84 |
User::LeaveIfError(
|
|
85 |
CreateSubSession( aSession, ESatSOpenIconSubSession, args ) );
|
|
86 |
|
|
87 |
TInt err( KErrNone );
|
|
88 |
CRepository* repository = NULL;
|
|
89 |
|
|
90 |
// Which UID to monitor.
|
|
91 |
TRAP( err, repository = CRepository::NewL( KCRUidSatServer ); );
|
|
92 |
LOG2( SIMPLE,
|
|
93 |
"SATCLIENT: RSatService::OpenL: new CRepository err: %d",
|
|
94 |
err )
|
|
95 |
|
|
96 |
if ( repository )
|
|
97 |
{
|
|
98 |
err = repository->StartTransaction(
|
|
99 |
CRepository::EReadWriteTransaction );
|
|
100 |
LOG2( SIMPLE,
|
|
101 |
"SATCLIENT: RSatService::OpenL StartTransaction err: %d",
|
|
102 |
err )
|
|
103 |
if ( KErrNone == err )
|
|
104 |
{
|
|
105 |
err = repository->Get( KSatMaxIconDataSize, iMaxIconDataSize );
|
|
106 |
LOG2( SIMPLE,
|
|
107 |
"SATCLIENT: RSatService::OpenL: GetMaxIconDataSize err: %d",
|
|
108 |
err )
|
|
109 |
}
|
|
110 |
|
|
111 |
LOG2( SIMPLE,
|
|
112 |
"SATCLIENT: RSatService::OpenL Iconsize limit:%d",
|
|
113 |
iMaxIconDataSize )
|
|
114 |
|
|
115 |
delete repository;
|
|
116 |
repository = NULL;
|
|
117 |
}
|
|
118 |
|
|
119 |
// Monitor the idle mode text
|
|
120 |
iSatPluginMonitor = CSatPluginMonitor::NewL();
|
|
121 |
|
|
122 |
LOG( SIMPLE, "SATCLIENT: RSatService::OpenL exiting" )
|
|
123 |
}
|
|
124 |
|
|
125 |
// -----------------------------------------------------------------------------
|
|
126 |
// RSatService::Close
|
|
127 |
// Closes the sub-session
|
|
128 |
// (other items were commented in a header).
|
|
129 |
// -----------------------------------------------------------------------------
|
|
130 |
//
|
|
131 |
EXPORT_C void RSatService::Close()
|
|
132 |
{
|
|
133 |
LOG( SIMPLE, "SATCLIENT: RSatService::Close calling" )
|
|
134 |
#ifdef ENABLE_SAT_LOGGING
|
|
135 |
RProcess test;
|
|
136 |
LOG2( SIMPLE,
|
|
137 |
"SATCLIENT: RSatService::Close UID of calling process: 0x%x",
|
|
138 |
test.SecureId().iId )
|
|
139 |
test.Close();
|
|
140 |
#endif
|
|
141 |
|
|
142 |
delete iSatPluginMonitor;
|
|
143 |
iSatPluginMonitor = NULL;
|
|
144 |
CloseSubSession( ESatSCloseIconSubSession );
|
|
145 |
|
|
146 |
LOG( SIMPLE, "SATCLIENT: RSatService::Close exiting" )
|
|
147 |
}
|
|
148 |
|
|
149 |
// -----------------------------------------------------------------------------
|
|
150 |
// RSatService::NotifySetupIdleModeTextChange
|
|
151 |
// Get notified of idle mode text change.
|
|
152 |
// (other items were commented in a header).
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
//
|
|
155 |
EXPORT_C TInt RSatService::NotifySetupIdleModeTextChange(
|
|
156 |
TRequestStatus& aStatus )
|
|
157 |
{
|
|
158 |
TInt err( KErrNotReady );
|
|
159 |
LOG( SIMPLE,
|
|
160 |
"SATCLIENT: RSatService::NotifySetupIdleModeTextChange calling" )
|
|
161 |
|
|
162 |
// New the SATMonitor to monitor the P&S key.
|
|
163 |
// IsActive checked also here to avoid a Codescanner warning.
|
|
164 |
if ( iSatPluginMonitor && !iSatPluginMonitor->IsActive() )
|
|
165 |
{
|
|
166 |
err = iSatPluginMonitor->Start( aStatus );
|
|
167 |
}
|
|
168 |
LOG( SIMPLE,
|
|
169 |
"SATCLIENT: RSatService::NotifySetupIdleModeTextChange exiting" )
|
|
170 |
|
|
171 |
return err;
|
|
172 |
}
|
|
173 |
|
|
174 |
// -----------------------------------------------------------------------------
|
|
175 |
// RSatService::NotifySetupIdleModeTextChangeCancel
|
|
176 |
// Cancel notified of idle mode text change.
|
|
177 |
// (other items were commented in a header).
|
|
178 |
// -----------------------------------------------------------------------------
|
|
179 |
//
|
|
180 |
EXPORT_C void RSatService::NotifySetupIdleModeTextChangeCancel()
|
|
181 |
{
|
|
182 |
LOG( SIMPLE,
|
|
183 |
"SATCLIENT: RSatService::NotifySetupIdleModeTextChangeCancel calling" )
|
|
184 |
|
|
185 |
if ( iSatPluginMonitor )
|
|
186 |
{
|
|
187 |
iSatPluginMonitor->Cancel();
|
|
188 |
}
|
|
189 |
|
|
190 |
LOG( SIMPLE,
|
|
191 |
"SATCLIENT: RSatService::NotifySetupIdleModeTextChangeCancel exiting" )
|
|
192 |
}
|
|
193 |
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
// RSatService::GetSetupIdleModeTextL
|
|
196 |
// Get text after bootup
|
|
197 |
// (other items were commented in a header).
|
|
198 |
// -----------------------------------------------------------------------------
|
|
199 |
//
|
|
200 |
EXPORT_C TBool RSatService::GetSetupIdleModeTextL( HBufC*& aText,
|
|
201 |
TSatIconQualifier& aIconQualifier,
|
|
202 |
TUint8& aRecordNumber )
|
|
203 |
{
|
|
204 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL calling" )
|
|
205 |
#ifdef ENABLE_SAT_LOGGING
|
|
206 |
RProcess test;
|
|
207 |
LOG2( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL \
|
|
208 |
UID of calling process: 0x%x",
|
|
209 |
test.SecureId().iId )
|
|
210 |
test.Close();
|
|
211 |
#endif
|
|
212 |
|
|
213 |
TBool ret ( ETrue );
|
|
214 |
TSatIconQualifier satIconQualifier( ESatIconNoIcon );
|
|
215 |
TUint8 satRecordNumber( NULL );
|
|
216 |
TInt iconQualifier( KSatIdleIconQInit );
|
|
217 |
TInt recordNumber( KErrNotFound );
|
|
218 |
|
|
219 |
// 1. Read icon qualifier, icon id and text
|
|
220 |
if ( iSatPluginMonitor )
|
|
221 |
{
|
|
222 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL read key" )
|
|
223 |
TInt result =
|
|
224 |
iSatPluginMonitor->GetIdleModeIconQualifier( iconQualifier );
|
|
225 |
|
|
226 |
// Read icon id.
|
|
227 |
if ( KSatIdleIconQNoIcon != iconQualifier )
|
|
228 |
{
|
|
229 |
result = iSatPluginMonitor->GetIdleModeIconId( recordNumber );
|
|
230 |
}
|
|
231 |
// Read the text on default.
|
|
232 |
result = iSatPluginMonitor->GetIdleModeText( aText );
|
|
233 |
|
|
234 |
}
|
|
235 |
|
|
236 |
// 2. Convert icon qualifier.
|
|
237 |
// Form enum TSatIdleModeTextIconQualifierValue defined in
|
|
238 |
// satinternalpskeys.h to enum TSatIconQualifier defined in rsatservice.h
|
|
239 |
// NOTE: the value are different.
|
|
240 |
switch ( iconQualifier )
|
|
241 |
{
|
|
242 |
case KSatIdleIconQInit: // go through
|
|
243 |
case KSatIdleIconQNoIcon:
|
|
244 |
{
|
|
245 |
satIconQualifier = RSatService::ESatIconNoIcon;
|
|
246 |
break;
|
|
247 |
}
|
|
248 |
case KSatIdleIconQSelfExplanatory:
|
|
249 |
{
|
|
250 |
satIconQualifier = RSatService::ESatIconSelfExplanatory;
|
|
251 |
break;
|
|
252 |
}
|
|
253 |
case KSatIdleIconQNotSelfExplanatory:
|
|
254 |
{
|
|
255 |
satIconQualifier = RSatService::ESatIconNotSelfExplanatory;
|
|
256 |
break;
|
|
257 |
}
|
|
258 |
default:
|
|
259 |
{
|
|
260 |
satIconQualifier = RSatService::ESatIconNoIcon;
|
|
261 |
break;
|
|
262 |
}
|
|
263 |
}
|
|
264 |
|
|
265 |
// 3. Convert icon id
|
|
266 |
if ( 0 <= recordNumber )
|
|
267 |
{
|
|
268 |
// The PS key is published in TInt, and the value in etelsat.h is TUint8
|
|
269 |
// the revode number have to be cast to TUint8
|
|
270 |
satRecordNumber = static_cast<TUint8>( recordNumber );
|
|
271 |
LOG2( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL\
|
|
272 |
convert icon id: %i", satRecordNumber )
|
|
273 |
}
|
|
274 |
else
|
|
275 |
{
|
|
276 |
satIconQualifier = RSatService::ESatIconNoIcon;
|
|
277 |
satRecordNumber = NULL;
|
|
278 |
}
|
|
279 |
|
|
280 |
// 4. Inspect icon qualifier, icon id and text.
|
|
281 |
if ( RSatService::ESatIconNoIcon == satIconQualifier)
|
|
282 |
{
|
|
283 |
LOG( SIMPLE,
|
|
284 |
"SATCLIENT: RSatService::GetSetupIdleModeTextL ESatIconNoIcon" )
|
|
285 |
aIconQualifier = ESatIconNoIcon;
|
|
286 |
aRecordNumber = NULL;
|
|
287 |
}
|
|
288 |
else if ( RSatService::ESatIconNotSelfExplanatory == satIconQualifier &&
|
|
289 |
!aText )
|
|
290 |
{
|
|
291 |
LOG( SIMPLE,
|
|
292 |
"SATCLIENT: RSatService::GetSetupIdleModeTextL \
|
|
293 |
ESatIconNotSelfExplanatory but no text" )
|
|
294 |
User::LeaveIfError( KErrNotFound );
|
|
295 |
}
|
|
296 |
else
|
|
297 |
{
|
|
298 |
aIconQualifier = satIconQualifier;
|
|
299 |
aRecordNumber = satRecordNumber;
|
|
300 |
}
|
|
301 |
|
|
302 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetSetupIdleModeTextL exiting" )
|
|
303 |
return ret;
|
|
304 |
}
|
|
305 |
|
|
306 |
|
|
307 |
// -----------------------------------------------------------------------------
|
|
308 |
// RSatService::GetIconInfoL
|
|
309 |
// Sends aRecordNumber to SatServer and waits for the icon informations.
|
|
310 |
// (other items were commented in a header).
|
|
311 |
// -----------------------------------------------------------------------------
|
|
312 |
//
|
|
313 |
EXPORT_C void RSatService::GetIconInfoL(
|
|
314 |
TUint8 aRecordNumber,
|
|
315 |
RIconEf& aIconEf ) const
|
|
316 |
{
|
|
317 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetIconInfoL calling" )
|
|
318 |
#ifdef ENABLE_SAT_LOGGING
|
|
319 |
RProcess test;
|
|
320 |
LOG2( SIMPLE,
|
|
321 |
"SATCLIENT: RSatService::GetIconInfoL UID of calling process: 0x%x",
|
|
322 |
test.SecureId().iId )
|
|
323 |
test.Close();
|
|
324 |
#endif
|
|
325 |
|
|
326 |
// Inform client that icons are not supported at all
|
|
327 |
if ( 0 >= iMaxIconDataSize )
|
|
328 |
{
|
|
329 |
LOG( SIMPLE, "SATCLIENT:M RSatService::GetIconInfoL KErrNotSupported" )
|
|
330 |
User::Leave( KErrNotSupported );
|
|
331 |
}
|
|
332 |
|
|
333 |
TPckgC<TUint8> recordNumberPckg( aRecordNumber );
|
|
334 |
RSat::TIcon iconEf;
|
|
335 |
TPckg<RSat::TIcon> iconEfPckg( iconEf );
|
|
336 |
|
|
337 |
const TIpcArgs args( &recordNumberPckg, &iconEfPckg );
|
|
338 |
|
|
339 |
// Get the icon info
|
|
340 |
const TInt error( SendReceive( ESatSGetIconInfo, args ) );
|
|
341 |
|
|
342 |
LOG2( SIMPLE, "SATCLIENT: RSatService::GetIconInfo with error %i", error )
|
|
343 |
User::LeaveIfError( error );
|
|
344 |
|
|
345 |
// Check that data is valid.
|
|
346 |
CheckInfoValidityL( iconEf );
|
|
347 |
|
|
348 |
if ( 0 < iconEf.Length() )
|
|
349 |
{
|
|
350 |
LOG( SIMPLE,
|
|
351 |
"SATCLIENT: RSatService::GetIconInfoL iconEf.Length() > 0" )
|
|
352 |
const TInt infoCount( iconEf[0] );
|
|
353 |
LOG2( SIMPLE,
|
|
354 |
"SATCLIENT: RSatService::GetIconInfo infoCount: %i", infoCount )
|
|
355 |
for ( TInt i = 0; i < infoCount; i++ )
|
|
356 |
{
|
|
357 |
// Icon info is 9 bytes long and first byte is number of
|
|
358 |
// icon info descriptors.
|
|
359 |
const TInt KStart( i * KInfoLength + 1 );
|
|
360 |
|
|
361 |
// Extract the info and append to aIconEf.
|
|
362 |
const TPtrC8 info( iconEf.Mid( KStart, KInfoLength ) );
|
|
363 |
|
|
364 |
TSatIconInfo satIconInfo;
|
|
365 |
SetIconInfoL( satIconInfo, info );
|
|
366 |
aIconEf.AppendL( satIconInfo );
|
|
367 |
}
|
|
368 |
|
|
369 |
}
|
|
370 |
|
|
371 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetIconInfoL exiting" )
|
|
372 |
}
|
|
373 |
|
|
374 |
// -----------------------------------------------------------------------------
|
|
375 |
// RSatService::GetIconL
|
|
376 |
// Sends icon information to SatServer and waits the icon bitmap handle.
|
|
377 |
// SatServer is notified when the bitmap is duplicated, so that server knows
|
|
378 |
// that it can free the bitmap. If the server does not get the notification
|
|
379 |
// of bitmap duplication then server will free the bitmap when next
|
|
380 |
// icon is fetched.
|
|
381 |
// (other items were commented in a header).
|
|
382 |
// -----------------------------------------------------------------------------
|
|
383 |
//
|
|
384 |
EXPORT_C CFbsBitmap* RSatService::GetIconL(
|
|
385 |
const TSatIconInfo& aIconInfo ) const
|
|
386 |
{
|
|
387 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetIconL calling" )
|
|
388 |
#ifdef ENABLE_SAT_LOGGING
|
|
389 |
RProcess test;
|
|
390 |
LOG2( SIMPLE,
|
|
391 |
"SATCLIENT: RSatService::GetIconL UID of calling process: 0x%x",
|
|
392 |
test.SecureId().iId )
|
|
393 |
test.Close();
|
|
394 |
#endif
|
|
395 |
|
|
396 |
CFbsBitmap* bitmap = NULL;
|
|
397 |
|
|
398 |
// Icon data size is checked
|
|
399 |
// If under or same as the maximum size, icon is fetched
|
|
400 |
// Otherwise null is returned.
|
|
401 |
if ( ( aIconInfo.DataLength() <= iMaxIconDataSize ) )
|
|
402 |
{
|
|
403 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetIconL icon fetch started" )
|
|
404 |
TInt bitmapHandle( 0 );
|
|
405 |
TPckg<TInt> bitmapHandlePckg( bitmapHandle );
|
|
406 |
|
|
407 |
TSatInternalIconInfo interIconInfo;
|
|
408 |
TSatInternalIconInfoPckg interIconPckg( interIconInfo );
|
|
409 |
FillInternalIconInfo( aIconInfo, interIconInfo );
|
|
410 |
|
|
411 |
|
|
412 |
TIpcArgs args( &interIconPckg, &bitmapHandlePckg );
|
|
413 |
|
|
414 |
// Fetch the handle of the icon.
|
|
415 |
User::LeaveIfError( SendReceive( ESatSGetIconInstance, args ) );
|
|
416 |
|
|
417 |
// Duplicate the bitmap and notify server that bitmap is duplicated.
|
|
418 |
// After the duplication the bitmap is owned by the client.
|
|
419 |
args.Set( 0, TIpcArgs::ENothing );
|
|
420 |
args.Set( 1, TIpcArgs::ENothing );
|
|
421 |
bitmap = new( ELeave )CFbsBitmap();
|
|
422 |
CleanupStack::PushL( bitmap );
|
|
423 |
User::LeaveIfError( bitmap->Duplicate( bitmapHandle ) );
|
|
424 |
User::LeaveIfError( Send( ESatSIconInstanceGot, args ) );
|
|
425 |
CleanupStack::Pop( bitmap );
|
|
426 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetIconL icon fetch exit" )
|
|
427 |
}
|
|
428 |
|
|
429 |
LOG( SIMPLE, "SATCLIENT: RSatService::GetIconL exiting" )
|
|
430 |
return bitmap;
|
|
431 |
}
|
|
432 |
|
|
433 |
// -----------------------------------------------------------------------------
|
|
434 |
// RSatService::SetIdleModeTextResponse
|
|
435 |
// Sends SetUpIdleModeText response to Server.
|
|
436 |
// (other items were commented in a header).
|
|
437 |
// -----------------------------------------------------------------------------
|
|
438 |
//
|
|
439 |
EXPORT_C void RSatService::SetIdleModeTextResponse(
|
|
440 |
const TSATIdleResult& aResult ) const
|
|
441 |
{
|
|
442 |
LOG( SIMPLE, "SATCLIENT: RSatService::SetIdleModeTextResponse calling" )
|
|
443 |
|
|
444 |
#ifdef ENABLE_SAT_LOGGING
|
|
445 |
RProcess test;
|
|
446 |
LOG2( SIMPLE, "SATCLIENT: RSatService::SetIdleModeTextResponse \
|
|
447 |
UID of calling process: 0x%x",
|
|
448 |
test.SecureId().iId )
|
|
449 |
test.Close();
|
|
450 |
#endif
|
|
451 |
|
|
452 |
TInt responseValue( aResult );
|
|
453 |
|
|
454 |
// Build IPC package
|
|
455 |
const TIpcArgs args( responseValue );
|
|
456 |
|
|
457 |
// Send the SetUpIdleMode response
|
|
458 |
TInt err = SendReceive( ESatSIdleModeResponse, args );
|
|
459 |
LOG2( SIMPLE,
|
|
460 |
"SATCLIENT: RSatService::SetIdleModeTextResponse error while sending \
|
|
461 |
response to SAT Engine: %d", err )
|
|
462 |
LOG( SIMPLE, "SATCLIENT: RSatService::SetIdleModeTextResponse exiting" )
|
|
463 |
}
|
|
464 |
|
|
465 |
// -----------------------------------------------------------------------------
|
|
466 |
// RSatService::CheckDataValidityL
|
|
467 |
// Checks that data is valid.
|
|
468 |
// (other items were commented in a header).
|
|
469 |
// -----------------------------------------------------------------------------
|
|
470 |
//
|
|
471 |
void RSatService::CheckInfoValidityL( const TDesC8& aIconEf ) const
|
|
472 |
{
|
|
473 |
LOG( SIMPLE, "SATCLIENT: RSatService::CheckInfoValidityL calling" )
|
|
474 |
|
|
475 |
TInt err( KErrCorrupt );
|
|
476 |
TInt realLength( aIconEf.Length() );
|
|
477 |
TInt requiredLength( aIconEf[0] * KInfoLength + 1 );
|
|
478 |
|
|
479 |
LOG2( SIMPLE,
|
|
480 |
"SATCLIENT: RSatService::CheckInfoValidityL realLength=%d",
|
|
481 |
realLength )
|
|
482 |
LOG2( SIMPLE,
|
|
483 |
"SATCLIENT: RSatService::CheckInfoValidityL requiredLength=%d",
|
|
484 |
requiredLength )
|
|
485 |
|
|
486 |
// The length can be more than required, but the lenght has to be
|
|
487 |
// at least required length.
|
|
488 |
if ( 0 < realLength && realLength >= requiredLength )
|
|
489 |
{
|
|
490 |
err = KErrNone;
|
|
491 |
}
|
|
492 |
User::LeaveIfError( err );
|
|
493 |
|
|
494 |
LOG( SIMPLE, "SATCLIENT: RSatService::CheckInfoValidityL exiting" )
|
|
495 |
}
|
|
496 |
|
|
497 |
// -----------------------------------------------------------------------------
|
|
498 |
// RSatService::SetIconInfo
|
|
499 |
// Set aIconSatData to TSatIconInfo.
|
|
500 |
// (other items were commented in a header).
|
|
501 |
// -----------------------------------------------------------------------------
|
|
502 |
//
|
|
503 |
void RSatService::SetIconInfoL( TSatIconInfo& aContainer,
|
|
504 |
const TDesC8& aIconSatData ) const
|
|
505 |
{
|
|
506 |
LOG( SIMPLE, "SATCLIENT: RSatService::SetIconInfo calling" )
|
|
507 |
TInt err( KErrCorrupt );
|
|
508 |
|
|
509 |
if ( KLowIconLength <= aIconSatData.Size() )
|
|
510 |
{
|
|
511 |
LOG( SIMPLE, "SATCLIENT: RSatService::SetIconInfo valid descriptor" )
|
|
512 |
|
|
513 |
TUint16 integer( 0 );
|
|
514 |
TSize size( 0, 0 );
|
|
515 |
|
|
516 |
// 1. icon size
|
|
517 |
size.SetSize( aIconSatData[KIconWidth], aIconSatData[KIconHeigth] );
|
|
518 |
aContainer.SetIconSize( size );
|
|
519 |
|
|
520 |
// 2. code scheme
|
|
521 |
aContainer.SetCodingScheme( static_cast<TSatIconInfo::TCodingScheme>(
|
|
522 |
aIconSatData[KImageCodingScheme] ) );
|
|
523 |
|
|
524 |
// 3. file identifier
|
|
525 |
// High byte
|
|
526 |
integer = static_cast<TUint16>(
|
|
527 |
aIconSatData[KHighFileId] << KBitsInByte );
|
|
528 |
// Low byte
|
|
529 |
integer |= aIconSatData[KLowFileId];
|
|
530 |
aContainer.SetFileIdentifier( integer );
|
|
531 |
|
|
532 |
// 4. offset
|
|
533 |
// High byte
|
|
534 |
integer = static_cast<TUint16>(
|
|
535 |
aIconSatData[KHighIconOffset] << KBitsInByte );
|
|
536 |
// Low byte
|
|
537 |
integer |= aIconSatData[KLowIconOffset];
|
|
538 |
aContainer.SetOffset( integer );
|
|
539 |
|
|
540 |
// 5. length
|
|
541 |
// High byte
|
|
542 |
integer = static_cast<TUint16>(
|
|
543 |
aIconSatData[KHighIconLength] << KBitsInByte );
|
|
544 |
// Low byte
|
|
545 |
integer |= aIconSatData[KLowIconLength];
|
|
546 |
aContainer.SetDataLength( integer );
|
|
547 |
err = KErrNone;
|
|
548 |
}
|
|
549 |
User::LeaveIfError( err );
|
|
550 |
LOG( SIMPLE, "SATCLIENT: RSatService::SetIconInfo exiting" )
|
|
551 |
}
|
|
552 |
|
|
553 |
// -----------------------------------------------------------------------------
|
|
554 |
// RSatService::llInternalIconInfo
|
|
555 |
// Convert TSatIconinfo to TSatInternalIconInfo.
|
|
556 |
// (other items were commented in a header).
|
|
557 |
// -----------------------------------------------------------------------------
|
|
558 |
//
|
|
559 |
void RSatService::FillInternalIconInfo( const TSatIconInfo& aIconInfo,
|
|
560 |
TSatInternalIconInfo& aInternalIconInfo ) const
|
|
561 |
{
|
|
562 |
LOG( SIMPLE, "SATCLIENT: RSatService::FillInternalIconInfo calling" )
|
|
563 |
|
|
564 |
// Fill the fields
|
|
565 |
aInternalIconInfo.iWidth = aIconInfo.IconSize().iWidth;
|
|
566 |
aInternalIconInfo.iHeight = aIconInfo.IconSize().iHeight;
|
|
567 |
if ( TSatIconInfo::EBasic == aIconInfo.CodingScheme() )
|
|
568 |
{
|
|
569 |
aInternalIconInfo.iCodingScheme = TSatInternalIconInfo::EBasic;
|
|
570 |
}
|
|
571 |
else
|
|
572 |
{
|
|
573 |
aInternalIconInfo.iCodingScheme = TSatInternalIconInfo::EColor;
|
|
574 |
}
|
|
575 |
aInternalIconInfo.iFileIdentifier = aIconInfo.FileIdentifier();
|
|
576 |
aInternalIconInfo.iOffset = aIconInfo.Offset();
|
|
577 |
aInternalIconInfo.iLength = aIconInfo.DataLength();
|
|
578 |
|
|
579 |
LOG( SIMPLE, "SATCLIENT: RSatService::FillInternalIconInfo exit" )
|
|
580 |
}
|
|
581 |
|
|
582 |
// End of File
|