satengine/SatServer/Engine/src/CSatSIconSubSession.cpp
changeset 0 ff3b6d0fd310
child 6 1b9ee3c7442d
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     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     if ( iInfo.iLength == iIconData->Length() )
       
   223         {
       
   224         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \
       
   225              length equal" )
       
   226         // Get the clut and convert the icon data to bitmap.
       
   227         if ( RSat::KBasic == iInfo.iCoding )
       
   228             {
       
   229             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   230                  get the clut" )
       
   231             // Basic icon does not have CLUT.
       
   232             iClut = KNullDesC8().AllocL();
       
   233 
       
   234             // Complete icon.
       
   235             NotifyGetClutL();
       
   236             }
       
   237         else
       
   238             {
       
   239             LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   240                  others" )
       
   241             TPtr8 iconDataPtr( iIconData->Des() );
       
   242 
       
   243             // Create buffer for clut. Each clut entry contains
       
   244             // intensity of red, green and blue. The value of 0 is
       
   245             // interpreted as 256 clut entries. (ETSI TS 131 102 V4.10.0).
       
   246             TInt numberOfClutEntries( iconDataPtr[KClutEntrySize] );
       
   247             LOG2( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   248                   numberOfClutEntries: %i", numberOfClutEntries )
       
   249             if ( 0 == numberOfClutEntries )
       
   250                 {
       
   251                 numberOfClutEntries = KDefaultNumberOfClutEntries;
       
   252                 }
       
   253 
       
   254             // Start getting the icon color lookup table from SIM.
       
   255             iClut = HBufC8::NewL( numberOfClutEntries * KClutEntrySize );
       
   256 
       
   257             if ( iconDataPtr.Length() >= KNumberOfCLUTByte + 1 )
       
   258                 {
       
   259                 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   260                      get clut" )
       
   261                 const TUint offset( iconDataPtr[KColourDepthByte] << 8 |
       
   262                     iconDataPtr[KNumberOfCLUTByte] );
       
   263                 TPtr8 clutPtr( iClut->Des() );
       
   264                 iIconAPI->GetClut(
       
   265                     iInfo.iInstanceNumber, offset, clutPtr, *this );
       
   266                 }
       
   267             else
       
   268                 {
       
   269                 LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   270                      others notify failure" )
       
   271                 NotifyFailure( KErrCorrupt );
       
   272                 }
       
   273             }
       
   274         }
       
   275     else
       
   276         {
       
   277         LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \
       
   278              notify failure" )
       
   279         NotifyFailure( KErrCorrupt );
       
   280         }
       
   281 
       
   282     LOG( SIMPLE,
       
   283         "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL exiting" )
       
   284     }
       
   285 
       
   286 // -----------------------------------------------------------------------------
       
   287 // CSatSIconSubSession::NotifyGetClutL
       
   288 // Notification from icon observer
       
   289 // -----------------------------------------------------------------------------
       
   290 //
       
   291 void CSatSIconSubSession::NotifyGetClutL()
       
   292     {
       
   293     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetClutL calling" )
       
   294 
       
   295     // Create icon converter.
       
   296     CSatSIconConverter* converter =
       
   297         CSatSIconConverter::CreateConverterL(
       
   298             static_cast<RSat::TImageCoding>( iInfo.iCoding ) );
       
   299     CleanupStack::PushL( converter );
       
   300 
       
   301     if ( NULL != iBitmap )
       
   302         {
       
   303         delete iBitmap; // Delete the bitmap
       
   304         iBitmap = NULL;
       
   305         }
       
   306 
       
   307     iBitmap = converter->ConvertL( *iIconData, *iClut );
       
   308 
       
   309     // Send the bitmap handle to client.
       
   310     TPckg<TInt> handlePckg( iBitmap->Handle() );
       
   311     Write( iMessage, 1, handlePckg );
       
   312 
       
   313     CleanupStack::PopAndDestroy( converter );
       
   314 
       
   315     if ( iClut )
       
   316         {
       
   317         delete iClut;
       
   318         iClut = NULL;
       
   319         }
       
   320 
       
   321     if ( iIconData )
       
   322         {
       
   323         delete iIconData;
       
   324         iIconData = NULL;
       
   325         }
       
   326 
       
   327     iMessage.Complete( KErrNone );
       
   328     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetClutL exiting" )
       
   329     }
       
   330 
       
   331 // -----------------------------------------------------------------------------
       
   332 // CSatSIconSubSession::NotifyFailure
       
   333 // Notification from icon observer
       
   334 // -----------------------------------------------------------------------------
       
   335 //
       
   336 void CSatSIconSubSession::NotifyFailure( TInt errorCode )
       
   337     {
       
   338     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyFailure calling" )
       
   339 
       
   340     if ( NULL != iMessage.Handle() )
       
   341         {
       
   342         LOG(
       
   343             SIMPLE,
       
   344             "SATENGINE: CSatSIconSubSession::NotifyFailure Message!" )
       
   345         iMessage.Complete( errorCode );
       
   346         }
       
   347     else
       
   348         {
       
   349         LOG(
       
   350             SIMPLE,
       
   351             "SATENGINE: CSatSIconSubSession::NotifyFailure No Message!" )
       
   352         }
       
   353 
       
   354     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyFailure exiting" )
       
   355     }
       
   356 
       
   357 // -----------------------------------------------------------------------------
       
   358 // CSatSIconSubSession::HandleCommandL
       
   359 // Handles the icon sub-session requests.
       
   360 // (other items were commented in a header).
       
   361 // -----------------------------------------------------------------------------
       
   362 //
       
   363 void CSatSIconSubSession::HandleCommandL( const RMessage2& aMessage )
       
   364     {
       
   365     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::HandleCommandL calling" )
       
   366 
       
   367     switch ( aMessage.Function() )
       
   368         {
       
   369         case ESatSGetIconInfo:
       
   370             {
       
   371             LOG( NORMAL, "SATENGINE:   ESatSGetIconInfo" )
       
   372             if ( NULL != iMessage.Handle() )
       
   373                 {
       
   374                 LOG( SIMPLE,
       
   375                     "SATENGINE:   Request already pending (GetIconInfo)" )
       
   376                 iSession.PanicClient( aMessage, ESatSBadRequest );
       
   377                 }
       
   378             else
       
   379                 {
       
   380                 LOG( SIMPLE,
       
   381                     "SATENGINE:   Request handling (GetIconInfo)" )
       
   382                 iMessage = aMessage;
       
   383                 GetIconInfo();
       
   384                 }
       
   385             break;
       
   386             }
       
   387 
       
   388         case ESatSGetIconInstance:
       
   389             {
       
   390             LOG( NORMAL, "SATENGINE:   ESatSGetIconInstance" )
       
   391             TBool mode = IconFetchingMode();
       
   392             
       
   393             NotifyIconFetchingMode( mode );
       
   394                         
       
   395             if ( NULL != iMessage.Handle() )
       
   396                 {
       
   397                 LOG( SIMPLE,
       
   398                     "SATENGINE:   Request already pending (GetIconInstance)" )
       
   399                 iSession.PanicClient( aMessage, ESatSBadRequest );
       
   400                 }
       
   401             else
       
   402                 {
       
   403                 LOG( SIMPLE,
       
   404                     "SATENGINE:   Request handling (GetIconInstance)" )
       
   405                 iMessage = aMessage;
       
   406                 GetIconInstanceL();
       
   407                 }
       
   408             break;
       
   409             }
       
   410 
       
   411         // Client issues ESatSIconInstanceGot when the client
       
   412         // has duplicated the icon and then the bitmap can be
       
   413         // deleted.
       
   414         case ESatSIconInstanceGot:
       
   415             {
       
   416             LOG( NORMAL, "SATENGINE:   ESatSIconInstanceGot" )
       
   417             // Free the bitmap.
       
   418             delete iBitmap;
       
   419             iBitmap = NULL;
       
   420             aMessage.Complete( KErrNone );
       
   421             break;
       
   422             }
       
   423 
       
   424         // Response for SetUpIdleModeText
       
   425         case ESatSIdleModeResponse:
       
   426             {
       
   427             LOG( NORMAL, "SATENGINE:   ESatSIdleModeResponse" )
       
   428             // Send the response to Proactive SetUpIdleModeText handler
       
   429             SendSetUpIdleModeResponse( aMessage.Int0() );
       
   430             aMessage.Complete( KErrNone );
       
   431             break;
       
   432             }
       
   433 
       
   434         default:
       
   435             {
       
   436             LOG( SIMPLE, "SATENGINE:   Bad function - default" )
       
   437             iSession.PanicClient( aMessage, ESatSBadRequest );
       
   438             }
       
   439         }
       
   440 
       
   441     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::HandleCommandL exiting" )
       
   442     }
       
   443 
       
   444 // -----------------------------------------------------------------------------
       
   445 // CSatSIconSubSession::SendSetUpIdleModeResponse
       
   446 // Notification from icon observer
       
   447 // -----------------------------------------------------------------------------
       
   448 //
       
   449 void CSatSIconSubSession::SendSetUpIdleModeResponse( TInt aResponse ) const
       
   450     {
       
   451     LOG( SIMPLE,
       
   452         "SATENGINE: CSatSIconSubSession::SendSetUpIdleModeResponse calling" )
       
   453 
       
   454     // Send the response through Event handling procedure.
       
   455     switch ( aResponse )
       
   456         {
       
   457         case RSatService::ESATIdleSuccess:
       
   458             {
       
   459             LOG( NORMAL, "SATENGINE:   Success" )
       
   460             iEventMediator.Notify(
       
   461                 MSatUtils::EIdleModeResponseSuccess );
       
   462             break;
       
   463             }
       
   464 
       
   465         case RSatService::ESATIdleSuccessRequestedIconNotDisplayed:
       
   466             {
       
   467             LOG( NORMAL, "SATENGINE:   Success no icon" )
       
   468             iEventMediator.Notify(
       
   469                 MSatUtils::EIdleModeResponseSuccessNoIcon );
       
   470             break;
       
   471             }
       
   472 
       
   473         case RSatService::ESATIdleMeUnableToProcessCmd:
       
   474             {
       
   475             LOG( NORMAL, "SATENGINE:   Unable to process" )
       
   476             iEventMediator.Notify(
       
   477                 MSatUtils::EIdleModeResponseUnableToProcess );
       
   478             break;
       
   479             }
       
   480 
       
   481         case RSatService::ESATIdleCmdBeyondMeCapabilities:
       
   482             {
       
   483             LOG( NORMAL, "SATENGINE:   Beyond capabilities" )
       
   484             iEventMediator.Notify(
       
   485                 MSatUtils::EIdleModeResponseBeyondCapabilities );
       
   486             break;
       
   487             }
       
   488 
       
   489         default:
       
   490             {
       
   491             LOG( NORMAL, "SATENGINE:   Unknown response" )
       
   492             break;
       
   493             }
       
   494         }
       
   495 
       
   496     LOG( SIMPLE,
       
   497         "SATENGINE: CSatSIconSubSession::SendSetUpIdleModeResponse exiting" )
       
   498     }
       
   499 
       
   500 // -----------------------------------------------------------------------------
       
   501 // CSatSIconSubSession::Write
       
   502 // Writes descriptor to client address space and panics the client if
       
   503 // writing fails.
       
   504 // -----------------------------------------------------------------------------
       
   505 //
       
   506 void CSatSIconSubSession::Write( const RMessage2& aMessage,
       
   507                                  TInt aParam,
       
   508                                  const TDesC8& aDes ) const
       
   509     {
       
   510     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::Write calling" )
       
   511 
       
   512     TRAPD( err, aMessage.WriteL( aParam, aDes ) );
       
   513     LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::Write \
       
   514           err: %i", err )
       
   515     if ( KErrNone != err )
       
   516         {
       
   517         iSession.PanicClient( aMessage, ESatSBadDescriptor );
       
   518         }
       
   519 
       
   520     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::Write exiting" )
       
   521     }
       
   522 
       
   523 // -----------------------------------------------------------------------------
       
   524 // CSatSIconSubSession::CompleteError
       
   525 // Completion of iMessage for handler
       
   526 // -----------------------------------------------------------------------------
       
   527 //
       
   528 TInt CSatSIconSubSession::CompleteError( TInt aError ) const
       
   529     {
       
   530     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError calling" )
       
   531     TInt err( KErrCompletion );
       
   532 
       
   533     if ( NULL != iMessage.Handle() )
       
   534         {
       
   535         iMessage.Complete( aError );
       
   536         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError iMessage \
       
   537             completed" )
       
   538         err = KErrNone;
       
   539         }
       
   540 
       
   541     LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::CompleteError exiting, \
       
   542           err: %i", err )
       
   543     return err;
       
   544     }
       
   545 // -----------------------------------------------------------------------------
       
   546 // Get icon fetching mode which is in synchronous or asynchronous mode.
       
   547 // -----------------------------------------------------------------------------
       
   548 TBool CSatSIconSubSession::IconFetchingMode()
       
   549     {
       
   550     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode calling" )
       
   551 
       
   552     TInt cancelledUsingEndKey( 0 );
       
   553     TBool isSyncMode( EFalse );
       
   554     
       
   555     TInt error = RProperty::Get( KPSUidSatServerInternal,
       
   556         KSatAppClosedUsingEndKey, cancelledUsingEndKey );
       
   557     
       
   558     LOG2( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
       
   559           P&S key: %i", cancelledUsingEndKey )
       
   560         
       
   561     LOG2( NORMAL,
       
   562         "SATENGINE: CSatSIconSubSession::IconFetchingMode \
       
   563         subscribe KSatUiCancelledUsingEndKey and return: %d", error )
       
   564             
       
   565     if ( cancelledUsingEndKey )
       
   566         {
       
   567         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
       
   568              cancell UsingEndKey" )
       
   569         isSyncMode = ETrue;
       
   570         }
       
   571     else
       
   572         {
       
   573         LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode \
       
   574              don't cancell UsingEndKey" )
       
   575         isSyncMode = EFalse;
       
   576         }
       
   577         
       
   578     LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::IconFetchingMode exiting" )
       
   579 
       
   580     return isSyncMode;
       
   581     }
       
   582     
       
   583 // -----------------------------------------------------------------------------
       
   584 // Notify CSatIconHandler to fetch icons from NAA synchronously or
       
   585 // asynchrounously.
       
   586 // -----------------------------------------------------------------------------
       
   587 void CSatSIconSubSession::NotifyIconFetchingMode( TBool aMode )
       
   588     {
       
   589     LOG( SIMPLE, 
       
   590         "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode calling" )
       
   591 
       
   592     iIconAPI->SetIconFetchingMode( aMode );
       
   593 
       
   594     if ( aMode )
       
   595         {
       
   596         TInt error = RProperty::Set( KPSUidSatServerInternal,
       
   597             KSatAppClosedUsingEndKey, KSatAppTerminatedNormal );
       
   598         LOG2( SIMPLE,"CSatSIconSubSession::NotifyIconFetchingMode \
       
   599               P&S key: %i", KSatAppTerminatedNormal )
       
   600             
       
   601         LOG2( NORMAL,
       
   602             "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode \
       
   603             publish KSatUiCancelledUsingEndKey and return: %d", error )
       
   604         }
       
   605 
       
   606     LOG( SIMPLE, 
       
   607         "SATENGINE: CSatSIconSubSession::NotifyIconFetchingMode exiting" )
       
   608     }