satengine/SatServer/Engine/src/CSatSIconSubSession.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
   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     LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \
   222     if ( iInfo.iLength == iIconData->Length() )
   223           infoLength: %x", iInfo.iLength )
   223         {
   224 
   224         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \
   225     LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \
   225              length equal" )
   226           dataLength: %x", iIconData->Length() )
   226         // Get the clut and convert the icon data to bitmap.
   227 
   227         if ( RSat::KBasic == iInfo.iCoding )
   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() )
       
   237             {
   228             {
   238             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   229             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   239              get the basic clut" )
   230                  get the clut" )
   240             // Basic icon does not have CLUT.
   231             // Basic icon does not have CLUT.
   241             iClut = KNullDesC8().AllocL();
   232             iClut = KNullDesC8().AllocL();
       
   233 
   242             // Complete icon.
   234             // Complete icon.
   243             NotifyGetClutL();
   235             NotifyGetClutL();
   244             }
   236             }
   245         else
   237         else
   246             {
   238             {
   247             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   239             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   248                 notify failure basic" )
   240                  others" )
   249             NotifyFailure( KErrCorrupt );
   241             TPtr8 iconDataPtr( iIconData->Des() );
   250             }
   242 
   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             {
       
   260             // Create buffer for clut. Each clut entry contains
   243             // Create buffer for clut. Each clut entry contains
   261             // intensity of red, green and blue. The value of 0 is
   244             // intensity of red, green and blue. The value of 0 is
   262             // interpreted as 256 clut entries. (ETSI TS 131 102 V4.10.0).
   245             // interpreted as 256 clut entries. (ETSI TS 131 102 V4.10.0).
   263             TInt numberOfClutEntries( iconDataPtr[KClutEntrySize] );
   246             TInt numberOfClutEntries( iconDataPtr[KClutEntrySize] );
   264             LOG2( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   247             LOG2( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   265                   numberOfClutEntries: %i", numberOfClutEntries )
   248                   numberOfClutEntries: %i", numberOfClutEntries )
   266             if ( 0 == numberOfClutEntries )
   249             if ( 0 == numberOfClutEntries )
   267                 {
   250                 {
   268                 numberOfClutEntries = KDefaultNumberOfClutEntries;
   251                 numberOfClutEntries = KDefaultNumberOfClutEntries;
   269                 }
   252                 }
   270     
   253 
   271             // Start getting the icon color lookup table from SIM.
   254             // Start getting the icon color lookup table from SIM.
   272             TInt length = numberOfClutEntries * KClutEntrySize;
   255             iClut = HBufC8::NewL( numberOfClutEntries * KClutEntrySize );
   273             // In some situation the length we get from the icon information
   256 
   274             // includes the length of the CLUT and some time it doesn't
   257             if ( iconDataPtr.Length() >= KNumberOfCLUTByte + 1 )
   275             // Both situation a valid.
       
   276             if ( ( iInfo.iLength == iIconData->Length() )
       
   277                  || ( iInfo.iLength == iIconData->Length() + length ) )  
       
   278                 {
   258                 {
   279                 iClut = HBufC8::NewL( length );
       
   280     
       
   281                 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   259                 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   282                      get clut" )
   260                      get clut" )
   283                 const TUint offset( iconDataPtr[KColourDepthByte] << 8 |
   261                 const TUint offset( iconDataPtr[KColourDepthByte] << 8 |
   284                     iconDataPtr[KNumberOfCLUTByte] );
   262                     iconDataPtr[KNumberOfCLUTByte] );
   285                 TPtr8 clutPtr( iClut->Des() );
   263                 TPtr8 clutPtr( iClut->Des() );
   291                 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   269                 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   292                      others notify failure" )
   270                      others notify failure" )
   293                 NotifyFailure( KErrCorrupt );
   271                 NotifyFailure( KErrCorrupt );
   294                 }
   272                 }
   295             }
   273             }
   296         else
   274         }
   297             {
   275     else
   298             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   276         {
   299                  others notify failure" )
   277         LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
   300             NotifyFailure( KErrCorrupt );
   278              notify failure" )
   301             }
   279         NotifyFailure( KErrCorrupt );
   302         }
   280         }
   303 
   281 
   304     LOG( SIMPLE,
   282     LOG( SIMPLE,
   305         "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL exiting" )
   283         "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL exiting" )
   306     }
   284     }