217 void CSatSIconSubSession::NotifyGetIconInstanceL() |
217 void CSatSIconSubSession::NotifyGetIconInstanceL() |
218 { |
218 { |
219 LOG( SIMPLE, |
219 LOG( SIMPLE, |
220 "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL calling" ) |
220 "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL calling" ) |
221 |
221 |
222 if ( iInfo.iLength == iIconData->Length() ) |
222 LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \ |
223 { |
223 infoLength: %x", iInfo.iLength ) |
224 LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \ |
224 |
225 length equal" ) |
225 LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \ |
226 // Get the clut and convert the icon data to bitmap. |
226 dataLength: %x", iIconData->Length() ) |
227 if ( RSat::KBasic == iInfo.iCoding ) |
227 |
|
228 // Get the CLUT and convert the icon data to bitmap. |
|
229 |
|
230 // basic icon has empty CLUT |
|
231 if ( RSat::KBasic == iInfo.iCoding ) |
|
232 { |
|
233 // For the basi icon the length from the icon info and icon data |
|
234 // body should have the same length but for the clore icon the |
|
235 // length not always same. |
|
236 if ( iInfo.iLength == iIconData->Length() ) |
228 { |
237 { |
229 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
238 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
230 get the clut" ) |
239 get the basic clut" ) |
231 // Basic icon does not have CLUT. |
240 // Basic icon does not have CLUT. |
232 iClut = KNullDesC8().AllocL(); |
241 iClut = KNullDesC8().AllocL(); |
233 |
|
234 // Complete icon. |
242 // Complete icon. |
235 NotifyGetClutL(); |
243 NotifyGetClutL(); |
236 } |
244 } |
237 else |
245 else |
238 { |
246 { |
239 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
247 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
240 others" ) |
248 notify failure basic" ) |
241 TPtr8 iconDataPtr( iIconData->Des() ); |
249 NotifyFailure( KErrCorrupt ); |
242 |
250 } |
|
251 } |
|
252 else // color icon |
|
253 { |
|
254 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
|
255 others" ) |
|
256 TPtr8 iconDataPtr( iIconData->Des() ); |
|
257 |
|
258 if ( iconDataPtr.Length() >= KNumberOfCLUTByte + 1 ) |
|
259 { |
243 // Create buffer for clut. Each clut entry contains |
260 // Create buffer for clut. Each clut entry contains |
244 // intensity of red, green and blue. The value of 0 is |
261 // intensity of red, green and blue. The value of 0 is |
245 // interpreted as 256 clut entries. (ETSI TS 131 102 V4.10.0). |
262 // interpreted as 256 clut entries. (ETSI TS 131 102 V4.10.0). |
246 TInt numberOfClutEntries( iconDataPtr[KClutEntrySize] ); |
263 TInt numberOfClutEntries( iconDataPtr[KClutEntrySize] ); |
247 LOG2( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
264 LOG2( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
248 numberOfClutEntries: %i", numberOfClutEntries ) |
265 numberOfClutEntries: %i", numberOfClutEntries ) |
249 if ( 0 == numberOfClutEntries ) |
266 if ( 0 == numberOfClutEntries ) |
250 { |
267 { |
251 numberOfClutEntries = KDefaultNumberOfClutEntries; |
268 numberOfClutEntries = KDefaultNumberOfClutEntries; |
252 } |
269 } |
253 |
270 |
254 // Start getting the icon color lookup table from SIM. |
271 // Start getting the icon color lookup table from SIM. |
255 iClut = HBufC8::NewL( numberOfClutEntries * KClutEntrySize ); |
272 TInt length = numberOfClutEntries * KClutEntrySize; |
256 |
273 // In some situation the length we get from the icon information |
257 if ( iconDataPtr.Length() >= KNumberOfCLUTByte + 1 ) |
274 // includes the length of the CLUT and some time it doesn't |
|
275 // Both situation a valid. |
|
276 if ( ( iInfo.iLength == iIconData->Length() ) |
|
277 || ( iInfo.iLength == iIconData->Length() + length ) ) |
258 { |
278 { |
|
279 iClut = HBufC8::NewL( length ); |
|
280 |
259 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
281 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ |
260 get clut" ) |
282 get clut" ) |
261 const TUint offset( iconDataPtr[KColourDepthByte] << 8 | |
283 const TUint offset( iconDataPtr[KColourDepthByte] << 8 | |
262 iconDataPtr[KNumberOfCLUTByte] ); |
284 iconDataPtr[KNumberOfCLUTByte] ); |
263 TPtr8 clutPtr( iClut->Des() ); |
285 TPtr8 clutPtr( iClut->Des() ); |