satengine/SatServer/Engine/src/CSatSIconSubSession.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     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:  Handles the icon sub-session IPC.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include    <fbs.h>
       
    20 #include    <rsatservice.h>
       
    21 #include    <e32property.h>
       
    22 
       
    23 #include    "tsatinternaliconinfo.h"
       
    24 #include    "SATInternalPSKeys.h"
       
    25 #include    "CSatSIconSubSession.h"
       
    26 #include    "MSatSIconAPI.h"
       
    27 #include    "SatSOpcodes.h"
       
    28 #include    "CSatSSession.h"
       
    29 #include    "CSatSIconConverter.h"
       
    30 #include    "EnginePanic.h"
       
    31 #include    "SatLog.h"
       
    32 #include    "TSatEventMediator.h"
       
    33 #include    "MSatUtils.h"
       
    34 
       
    35 const TUint8 KClutEntrySize = 3;
       
    36 const TUint KDefaultNumberOfClutEntries = 256;
       
    37 const TUint8 KColourDepthByte = 4;
       
    38 const TUint8 KNumberOfCLUTByte = KColourDepthByte + 1;
       
    39 
       
    40 // ======== MEMBER FUNCTIONS ========
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CSatSIconSubSession::CSatSIconSubSession
       
    44 // C++ default constructor can NOT contain any code, that
       
    45 // might leave.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CSatSIconSubSession::CSatSIconSubSession(
       
    49     CSatSSession& aSession,
       
    50     TSatEventMediator& aEventMediator ) :
       
    51     CSatSSubSession( aSession ),
       
    52     iEventMediator( aEventMediator )
       
    53     {
       
    54     LOG( SIMPLE, "SATENGINE: \
       
    55         CSatSIconSubSession::CSatSIconSubSession calling - exiting" )
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CSatSIconSubSession::NewL
       
    60 // Two-phased constructor.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CSatSIconSubSession* CSatSIconSubSession::NewL(
       
    64     CSatSSession& aSession,
       
    65     TSatEventMediator& aEventMediator )
       
    66     {
       
    67     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NewL calling" )
       
    68 
       
    69     CSatSIconSubSession* self =
       
    70         new( ELeave ) CSatSIconSubSession( aSession, aEventMediator );
       
    71 
       
    72     CleanupStack::PushL( self );
       
    73     self->ConstructL();
       
    74     CleanupStack::Pop( /* self */ );
       
    75 
       
    76     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NewL exiting" )
       
    77     return self;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CSatSIconSubSession::ConstructL
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 void CSatSIconSubSession::ConstructL()
       
    85     {
       
    86     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::ConstructL calling" )
       
    87 
       
    88     iIconAPI = iSession.CreateIconHandlerL();
       
    89 
       
    90     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::ConstructL exiting" )
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CSatSIconSubSession::~CSatSIconSubSession
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 CSatSIconSubSession::~CSatSIconSubSession()
       
    98     {
       
    99     LOG( SIMPLE,
       
   100         "SATENGINE: CSatSIconSubSession::~CSatSIconSubSession calling" )
       
   101         
       
   102     delete iBitmap;
       
   103     delete iIconAPI;
       
   104     delete iClut;
       
   105     delete iIconData;
       
   106 
       
   107     LOG( SIMPLE,
       
   108         "SATENGINE: CSatSIconSubSession::~CSatSIconSubSession exiting" )
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CSatSIconSubSession::GetIconInfo
       
   113 // Gets the icon info from SIM.
       
   114 // (other items were commented in a header).
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CSatSIconSubSession::GetIconInfo()
       
   118     {
       
   119     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInfo calling" )
       
   120 
       
   121     // Read the recordnumber from client.
       
   122     TUint8 recordNumber( 0 );
       
   123     TPckg<TUint8> recordPckg( recordNumber );
       
   124     TRAPD( err, iMessage.ReadL( 0, recordPckg ) );
       
   125     LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInfo \
       
   126           err: %i", err )
       
   127     if ( KErrNone == err )
       
   128         {
       
   129         // Start getting the icon info from SIM.
       
   130         iIconEf.SetLength( NULL );
       
   131         iIconAPI->GetIconInfo( recordNumber, iIconEf, *this );
       
   132         }
       
   133     else
       
   134         {
       
   135         iSession.PanicClient( iMessage, ESatSBadDescriptor );
       
   136         }
       
   137 
       
   138     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInfo exiting" )
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CSatSIconSubSession::NotifyGetIconInfo
       
   143 // Notification from icon observer
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 void CSatSIconSubSession::NotifyGetIconInfo()
       
   147     {
       
   148     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInfo calling" )
       
   149 
       
   150     // Send the icon info data got to client.
       
   151     TPckg<RSat::TIcon> infoPckg( iIconEf );    
       
   152     Write( iMessage, 1, infoPckg );
       
   153     iMessage.Complete( KErrNone );
       
   154 
       
   155     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInfo exiting" )
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CSatSIconSubSession::GetIconInstanceL
       
   160 // Gets the icon from SIM.
       
   161 // (other items were commented in a header).
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 void CSatSIconSubSession::GetIconInstanceL()
       
   165     {
       
   166     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL calling" )
       
   167 
       
   168     TSatInternalIconInfo info;
       
   169     // Read the icon info from client.
       
   170     TSatInternalIconInfoPckg infoPckg( info );
       
   171     TRAPD( err, iMessage.ReadL( 0, infoPckg ) );
       
   172 
       
   173     iInfo.iInstanceNumber = info.iFileIdentifier;
       
   174     iInfo.iOffset = info.iOffset;
       
   175     iInfo.iLength = info.iLength;
       
   176 
       
   177     if ( TSatInternalIconInfo::EBasic == info.iCodingScheme )
       
   178         {
       
   179         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL \
       
   180              basic CodingScheme" )
       
   181         iInfo.iCoding = RSat::KBasic;
       
   182         }
       
   183     else
       
   184         {
       
   185         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL \
       
   186              colour CodingScheme" )
       
   187         iInfo.iCoding = RSat::KColour;
       
   188         }
       
   189 
       
   190     iInfo.iImgWidth = static_cast<TUint8>( info.iWidth );
       
   191     iInfo.iImgHeight = static_cast<TUint8>( info.iHeight );
       
   192     iInfo.iFileId = info.iFileIdentifier;
       
   193     LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL \
       
   194           err: %i", err )
       
   195     if ( KErrNone == err )
       
   196         {
       
   197         // Create buffer for the icon data.
       
   198         iIconData = HBufC8::NewL( iInfo.iLength );
       
   199         TPtr8 iconDataPtr( iIconData->Des() );
       
   200 
       
   201         // Start getting the icon data from SIM.
       
   202         iIconAPI->GetIconInstance( iInfo, iconDataPtr, *this );
       
   203         }
       
   204     else
       
   205         {
       
   206         iSession.PanicClient( iMessage, ESatSBadDescriptor );
       
   207         }
       
   208 
       
   209     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::GetIconInstanceL exiting" )
       
   210     }
       
   211 
       
   212 // -----------------------------------------------------------------------------
       
   213 // CSatSIconSubSession::NotifyGetIconInstanceL
       
   214 // Notification from icon observer
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 void CSatSIconSubSession::NotifyGetIconInstanceL()
       
   218     {
       
   219     LOG( SIMPLE,
       
   220         "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL calling" )
       
   221 
       
   222     LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \
       
   223           infoLength: %x", iInfo.iLength )
       
   224 
       
   225     LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \
       
   226           dataLength: %x", iIconData->Length() )
       
   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() )
       
   237             {
       
   238             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   239              get the basic clut" )
       
   240             // Basic icon does not have CLUT.
       
   241             iClut = KNullDesC8().AllocL();
       
   242             // Complete icon.
       
   243             NotifyGetClutL();
       
   244             }
       
   245         else
       
   246             {
       
   247             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   248                 notify failure basic" )
       
   249             NotifyFailure( KErrCorrupt );
       
   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             {
       
   260             // Create buffer for clut. Each clut entry contains
       
   261             // intensity of red, green and blue. The value of 0 is
       
   262             // interpreted as 256 clut entries. (ETSI TS 131 102 V4.10.0).
       
   263             TInt numberOfClutEntries( iconDataPtr[KClutEntrySize] );
       
   264             LOG2( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   265                   numberOfClutEntries: %i", numberOfClutEntries )
       
   266             if ( 0 == numberOfClutEntries )
       
   267                 {
       
   268                 numberOfClutEntries = KDefaultNumberOfClutEntries;
       
   269                 }
       
   270     
       
   271             // Start getting the icon color lookup table from SIM.
       
   272             TInt length = numberOfClutEntries * KClutEntrySize;
       
   273             // In some situation the length we get from the icon information
       
   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 ) )  
       
   278                 {
       
   279                 iClut = HBufC8::NewL( length );
       
   280     
       
   281                 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   282                      get clut" )
       
   283                 const TUint offset( iconDataPtr[KColourDepthByte] << 8 |
       
   284                     iconDataPtr[KNumberOfCLUTByte] );
       
   285                 TPtr8 clutPtr( iClut->Des() );
       
   286                 iIconAPI->GetClut(
       
   287                     iInfo.iInstanceNumber, offset, clutPtr, *this );
       
   288                 }
       
   289             else
       
   290                 {
       
   291                 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   292                      others notify failure" )
       
   293                 NotifyFailure( KErrCorrupt );
       
   294                 }
       
   295             }
       
   296         else
       
   297             {
       
   298             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   299                  others notify failure" )
       
   300             NotifyFailure( KErrCorrupt );
       
   301             }
       
   302         }
       
   303 
       
   304     LOG( SIMPLE,
       
   305         "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL exiting" )
       
   306     }
       
   307 
       
   308 // -----------------------------------------------------------------------------
       
   309 // CSatSIconSubSession::NotifyGetClutL
       
   310 // Notification from icon observer
       
   311 // -----------------------------------------------------------------------------
       
   312 //
       
   313 void CSatSIconSubSession::NotifyGetClutL()
       
   314     {
       
   315     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetClutL calling" )
       
   316 
       
   317     // Create icon converter.
       
   318     CSatSIconConverter* converter =
       
   319         CSatSIconConverter::CreateConverterL(
       
   320             static_cast<RSat::TImageCoding>( iInfo.iCoding ) );
       
   321     CleanupStack::PushL( converter );
       
   322 
       
   323     if ( NULL != iBitmap )
       
   324         {
       
   325         delete iBitmap; // Delete the bitmap
       
   326         iBitmap = NULL;
       
   327         }
       
   328 
       
   329     iBitmap = converter->ConvertL( *iIconData, *iClut );
       
   330 
       
   331     // Send the bitmap handle to client.
       
   332     TPckg<TInt> handlePckg( iBitmap->Handle() );
       
   333     Write( iMessage, 1, handlePckg );
       
   334 
       
   335     CleanupStack::PopAndDestroy( converter );
       
   336 
       
   337         delete iClut;
       
   338         iClut = NULL;
       
   339         
       
   340         delete iIconData;
       
   341         iIconData = NULL;
       
   342 
       
   343     iMessage.Complete( KErrNone );
       
   344     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetClutL exiting" )
       
   345     }
       
   346 
       
   347 // -----------------------------------------------------------------------------
       
   348 // CSatSIconSubSession::NotifyFailure
       
   349 // Notification from icon observer
       
   350 // -----------------------------------------------------------------------------
       
   351 //
       
   352 void CSatSIconSubSession::NotifyFailure( TInt errorCode )
       
   353     {
       
   354     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyFailure calling" )
       
   355 
       
   356     if ( NULL != iMessage.Handle() )
       
   357         {
       
   358         LOG(
       
   359             SIMPLE,
       
   360             "SATENGINE: CSatSIconSubSession::NotifyFailure Message!" )
       
   361         iMessage.Complete( errorCode );
       
   362         }
       
   363     else
       
   364         {
       
   365         LOG(
       
   366             SIMPLE,
       
   367             "SATENGINE: CSatSIconSubSession::NotifyFailure No Message!" )
       
   368         }
       
   369 
       
   370     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyFailure exiting" )
       
   371     }
       
   372 
       
   373 // -----------------------------------------------------------------------------
       
   374 // CSatSIconSubSession::HandleCommandL
       
   375 // Handles the icon sub-session requests.
       
   376 // (other items were commented in a header).
       
   377 // -----------------------------------------------------------------------------
       
   378 //
       
   379 void CSatSIconSubSession::HandleCommandL( const RMessage2& aMessage )
       
   380     {
       
   381     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::HandleCommandL calling" )
       
   382 
       
   383     switch ( aMessage.Function() )
       
   384         {
       
   385         case ESatSGetIconInfo:
       
   386             {
       
   387             LOG( NORMAL, "SATENGINE:   ESatSGetIconInfo" )
       
   388             if ( NULL != iMessage.Handle() )
       
   389                 {
       
   390                 LOG( SIMPLE,
       
   391                     "SATENGINE:   Request already pending (GetIconInfo)" )
       
   392                 iSession.PanicClient( aMessage, ESatSBadRequest );
       
   393                 }
       
   394             else
       
   395                 {
       
   396                 LOG( SIMPLE,
       
   397                     "SATENGINE:   Request handling (GetIconInfo)" )
       
   398                 iMessage = aMessage;
       
   399                 GetIconInfo();
       
   400                 }
       
   401             break;
       
   402             }
       
   403 
       
   404         case ESatSGetIconInstance:
       
   405             {
       
   406             LOG( NORMAL, "SATENGINE:   ESatSGetIconInstance" )
       
   407             TBool mode = IconFetchingMode();
       
   408             
       
   409             NotifyIconFetchingMode( mode );
       
   410                         
       
   411             if ( NULL != iMessage.Handle() )
       
   412                 {
       
   413                 LOG( SIMPLE,
       
   414                     "SATENGINE:   Request already pending (GetIconInstance)" )
       
   415                 iSession.PanicClient( aMessage, ESatSBadRequest );
       
   416                 }
       
   417             else
       
   418                 {
       
   419                 LOG( SIMPLE,
       
   420                     "SATENGINE:   Request handling (GetIconInstance)" )
       
   421                 iMessage = aMessage;
       
   422                 GetIconInstanceL();
       
   423                 }
       
   424             break;
       
   425             }
       
   426 
       
   427         // Client issues ESatSIconInstanceGot when the client
       
   428         // has duplicated the icon and then the bitmap can be
       
   429         // deleted.
       
   430         case ESatSIconInstanceGot:
       
   431             {
       
   432             LOG( NORMAL, "SATENGINE:   ESatSIconInstanceGot" )
       
   433             // Free the bitmap.
       
   434             delete iBitmap;
       
   435             iBitmap = NULL;
       
   436             aMessage.Complete( KErrNone );
       
   437             break;
       
   438             }
       
   439 
       
   440         // Response for SetUpIdleModeText
       
   441         case ESatSIdleModeResponse:
       
   442             {
       
   443             LOG( NORMAL, "SATENGINE:   ESatSIdleModeResponse" )
       
   444             // Send the response to Proactive SetUpIdleModeText handler
       
   445             SendSetUpIdleModeResponse( aMessage.Int0() );
       
   446             aMessage.Complete( KErrNone );
       
   447             break;
       
   448             }
       
   449 
       
   450         default:
       
   451             {
       
   452             LOG( SIMPLE, "SATENGINE:   Bad function - default" )
       
   453             iSession.PanicClient( aMessage, ESatSBadRequest );
       
   454             }
       
   455         }
       
   456 
       
   457     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::HandleCommandL exiting" )
       
   458     }
       
   459 
       
   460 // -----------------------------------------------------------------------------
       
   461 // CSatSIconSubSession::SendSetUpIdleModeResponse
       
   462 // Notification from icon observer
       
   463 // -----------------------------------------------------------------------------
       
   464 //
       
   465 void CSatSIconSubSession::SendSetUpIdleModeResponse( TInt aResponse ) const
       
   466     {
       
   467     LOG( SIMPLE,
       
   468         "SATENGINE: CSatSIconSubSession::SendSetUpIdleModeResponse calling" )
       
   469 
       
   470     // Send the response through Event handling procedure.
       
   471     switch ( aResponse )
       
   472         {
       
   473         case RSatService::ESATIdleSuccess:
       
   474             {
       
   475             LOG( NORMAL, "SATENGINE:   Success" )
       
   476             iEventMediator.Notify(
       
   477                 MSatUtils::EIdleModeResponseSuccess );
       
   478             break;
       
   479             }
       
   480 
       
   481         case RSatService::ESATIdleSuccessRequestedIconNotDisplayed:
       
   482             {
       
   483             LOG( NORMAL, "SATENGINE:   Success no icon" )
       
   484             iEventMediator.Notify(
       
   485                 MSatUtils::EIdleModeResponseSuccessNoIcon );
       
   486             break;
       
   487             }
       
   488 
       
   489         case RSatService::ESATIdleMeUnableToProcessCmd:
       
   490             {
       
   491             LOG( NORMAL, "SATENGINE:   Unable to process" )
       
   492             iEventMediator.Notify(
       
   493                 MSatUtils::EIdleModeResponseUnableToProcess );
       
   494             break;
       
   495             }
       
   496 
       
   497         case RSatService::ESATIdleCmdBeyondMeCapabilities:
       
   498             {
       
   499             LOG( NORMAL, "SATENGINE:   Beyond capabilities" )
       
   500             iEventMediator.Notify(
       
   501                 MSatUtils::EIdleModeResponseBeyondCapabilities );
       
   502             break;
       
   503             }
       
   504 
       
   505         default:
       
   506             {
       
   507             LOG( NORMAL, "SATENGINE:   Unknown response" )
       
   508             break;
       
   509             }
       
   510         }
       
   511 
       
   512     LOG( SIMPLE,
       
   513         "SATENGINE: CSatSIconSubSession::SendSetUpIdleModeResponse exiting" )
       
   514     }
       
   515 
       
   516 // -----------------------------------------------------------------------------
       
   517 // CSatSIconSubSession::Write
       
   518 // Writes descriptor to client address space and panics the client if
       
   519 // writing fails.
       
   520 // -----------------------------------------------------------------------------
       
   521 //
       
   522 void CSatSIconSubSession::Write( const RMessage2& aMessage,
       
   523                                  TInt aParam,
       
   524                                  const TDesC8& aDes ) const
       
   525     {
       
   526     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::Write calling" )
       
   527 
       
   528     TRAPD( err, aMessage.WriteL( aParam, aDes ) );
       
   529     LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::Write \
       
   530           err: %i", err )
       
   531     if ( KErrNone != err )
       
   532         {
       
   533         iSession.PanicClient( aMessage, ESatSBadDescriptor );
       
   534         }
       
   535 
       
   536     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::Write exiting" )
       
   537     }
       
   538 
       
   539 // -----------------------------------------------------------------------------
       
   540 // CSatSIconSubSession::CompleteError
       
   541 // Completion of iMessage for handler
       
   542 // -----------------------------------------------------------------------------
       
   543 //
       
   544 TInt CSatSIconSubSession::CompleteError( TInt aError ) const
       
   545     {
       
   546     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError calling" )
       
   547     TInt err( KErrCompletion );
       
   548 
       
   549     if ( NULL != iMessage.Handle() )
       
   550         {
       
   551         iMessage.Complete( aError );
       
   552         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError iMessage \
       
   553             completed" )
       
   554         err = KErrNone;
       
   555         }
       
   556 
       
   557     LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError exiting, \
       
   558           err: %i", err )
       
   559     return err;
       
   560     }
       
   561 // -----------------------------------------------------------------------------
       
   562 // Get icon fetching mode which is in synchronous or asynchronous mode.
       
   563 // -----------------------------------------------------------------------------
       
   564 TBool CSatSIconSubSession::IconFetchingMode()
       
   565     {
       
   566     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode calling" )
       
   567 
       
   568     TInt cancelledUsingEndKey( 0 );
       
   569     TBool isSyncMode( EFalse );
       
   570     
       
   571     TInt error = RProperty::Get( KPSUidSatServerInternal,
       
   572         KSatAppClosedUsingEndKey, cancelledUsingEndKey );
       
   573     
       
   574     LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
       
   575           P&S key: %i", cancelledUsingEndKey )
       
   576         
       
   577     LOG2( NORMAL,
       
   578         "SATENGINE: CSatSIconSubSession::IconFetchingMode \
       
   579         subscribe KSatUiCancelledUsingEndKey and return: %d", error )
       
   580             
       
   581     if ( cancelledUsingEndKey )
       
   582         {
       
   583         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
       
   584              cancell UsingEndKey" )
       
   585         isSyncMode = ETrue;
       
   586         }
       
   587     else
       
   588         {
       
   589         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
       
   590              don't cancell UsingEndKey" )
       
   591         isSyncMode = EFalse;
       
   592         }
       
   593         
       
   594     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode exiting" )
       
   595 
       
   596     return isSyncMode;
       
   597     }
       
   598     
       
   599 // -----------------------------------------------------------------------------
       
   600 // Notify CSatIconHandler to fetch icons from NAA synchronously or
       
   601 // asynchrounously.
       
   602 // -----------------------------------------------------------------------------
       
   603 void CSatSIconSubSession::NotifyIconFetchingMode( TBool aMode )
       
   604     {
       
   605     LOG( SIMPLE, 
       
   606         "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode calling" )
       
   607 
       
   608     iIconAPI->SetIconFetchingMode( aMode );
       
   609 
       
   610     if ( aMode )
       
   611         {
       
   612         TInt error = RProperty::Set( KPSUidSatServerInternal,
       
   613             KSatAppClosedUsingEndKey, KSatAppTerminatedNormal );
       
   614         LOG2( SIMPLE,"CSatSIconSubSession::NotifyIconFetchingMode \
       
   615               P&S key: %i", KSatAppTerminatedNormal )
       
   616             
       
   617         LOG2( NORMAL,
       
   618             "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode \
       
   619             publish KSatUiCancelledUsingEndKey and return: %d", error )
       
   620         }
       
   621 
       
   622     LOG( SIMPLE, 
       
   623         "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode exiting" )
       
   624     }