upnpsharing/applicationengine/src/upnpfilesharingengineao.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2006-2007 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:      CUPnPFileSharingEngineAO class implementation
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 // System
       
    25 #include <s32file.h>
       
    26 #include <f32file.h>
       
    27 #include <pathinfo.h>
       
    28 #include <e32property.h>
       
    29 #include <centralrepository.h>
       
    30 
       
    31 // upnp stack api
       
    32 #include <upnpstring.h>
       
    33 #include <upnpmediaserverclient.h>
       
    34 
       
    35 // upnpframework / avcontroller api
       
    36 #include "upnpavcontrollerfactory.h"
       
    37 
       
    38 // upnpframework / internal api's
       
    39 #include "upnpsecaccesscontroller.h"
       
    40 
       
    41 // homemedia internal
       
    42 #include "upnpfilesharingengineao.h"
       
    43 #include "upnpfilesharingengine.h"
       
    44 #include "upnpapplicationcrkeys.h" //KUPnPAppMediaServerIcon
       
    45 #include "upnpfileutilitytypes.h" //KJpegMime2
       
    46 #include "upnpiconconfigurator.h"
       
    47 
       
    48 _LIT( KComponentLogfile, "applicationengine.txt");
       
    49 #include "upnplog.h"
       
    50 
       
    51 
       
    52 // ============================ MEMBER FUNCTIONS ============================
       
    53 
       
    54 // --------------------------------------------------------------------------
       
    55 // CUPnPFileSharingEngineAO::CUPnPFileSharingEngineAO
       
    56 // C++ default constructor can NOT contain any code, that
       
    57 // might leave.
       
    58 // --------------------------------------------------------------------------
       
    59 //
       
    60 CUPnPFileSharingEngineAO::CUPnPFileSharingEngineAO(
       
    61     CUPnPFileSharingEngine& aEngine,
       
    62     RUpnpContentServerClient& aContentServer )
       
    63     : CActive(CActive::EPriorityStandard),
       
    64       iEngine( aEngine ),
       
    65       iContentServer( aContentServer )
       
    66     {
       
    67     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \
       
    68             CUPnPFileSharingEngineAO");
       
    69     CActiveScheduler::Add( this );
       
    70     }
       
    71 
       
    72 
       
    73 // --------------------------------------------------------------------------
       
    74 // CUPnPFileSharingEngineAO::~CUPnPFileSharingEngineAO()
       
    75 // Destructor
       
    76 // --------------------------------------------------------------------------
       
    77 //
       
    78 CUPnPFileSharingEngineAO::~CUPnPFileSharingEngineAO()
       
    79     {
       
    80     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \
       
    81             ~CUPnPFileSharingEngineAO");
       
    82 
       
    83     if ( IsActive() )
       
    84         {
       
    85         __LOG( "CUPnPFileSharingEngineAO destructor: IsActive==TRUE!" );
       
    86         iState = ENotActive;
       
    87         TRequestStatus* stat = &iStatus;
       
    88         User::RequestComplete( stat, KErrNone );
       
    89         }
       
    90 
       
    91     Cancel();
       
    92     iMediaServer.Close();
       
    93 
       
    94     delete iIconConfigurator;
       
    95     }
       
    96 
       
    97 // --------------------------------------------------------------------------
       
    98 // CUPnPFileSharingEngineAO::RunL
       
    99 // Called when asyncronous request is ready
       
   100 // --------------------------------------------------------------------------
       
   101 //
       
   102 void CUPnPFileSharingEngineAO::RunL()
       
   103     {
       
   104     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL begin");
       
   105 
       
   106     TInt err( iStatus.Int() );
       
   107     if ( err )
       
   108         {
       
   109         __LOG1( "iStatus err =%d",err );
       
   110         }
       
   111     switch ( iState )
       
   112         {
       
   113         case ENotActive :
       
   114             {
       
   115             if ( err )
       
   116                 {
       
   117                 // Inform Observer to handle the error.
       
   118                 if ( iEngine.Observer() )
       
   119                     {
       
   120                     iEngine.Observer()->
       
   121                         HandleSharingStatus( iEngine, err, EFalse );
       
   122                     }
       
   123                 }
       
   124             break;
       
   125             }
       
   126         // Show files outside
       
   127     case ECheckIcon :
       
   128         {
       
   129         if( !err )
       
   130             {
       
   131             __LOG1( "[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::ECheckIcon\
       
   132 err=%d", err );
       
   133             iState = EStartSharing;
       
   134             // callback SetIconComplete
       
   135             iIconConfigurator->ConfigureIconsL();
       
   136             }
       
   137         else
       
   138             {
       
   139             iState = ENotActive;
       
   140             if ( iEngine.Observer() )
       
   141                 {
       
   142                 iEngine.Observer()->
       
   143                     HandleSharingStatus( iEngine, err, ETrue );
       
   144                 }
       
   145             }
       
   146         }
       
   147         break;
       
   148     case EStartSharing :
       
   149         {
       
   150         iMediaServer.Close();
       
   151 
       
   152         if ( !err )
       
   153             {
       
   154             iVisibility = EOnline;
       
   155             iEngine.SetConMonStateL( ETrue, iStatus );
       
   156             SetActive();
       
   157             iState = EWaitSetConMonStateTrue;
       
   158             }
       
   159         else
       
   160             {
       
   161             iState = ENotActive;
       
   162             if ( iEngine.Observer() )
       
   163                 {
       
   164                 iEngine.Observer()->
       
   165                     HandleSharingStatus( iEngine, err, ETrue );
       
   166                 }
       
   167             }
       
   168         break;
       
   169         }
       
   170     case EWaitSetConMonStateTrue:
       
   171         {
       
   172         iState = ENotActive;
       
   173         if ( iEngine.Observer() )
       
   174             {
       
   175             iEngine.Observer()->
       
   176                 HandleSharingStatus( iEngine, err, ETrue );
       
   177             }
       
   178         break;
       
   179         }
       
   180     case EStopSharing :
       
   181         {
       
   182         if ( !err )
       
   183             {
       
   184             iEngine.SetConMonStateL( EFalse, iStatus );
       
   185             SetActive();
       
   186             iState = EWaitSetConMonStateFalse;
       
   187             }
       
   188         else
       
   189             {
       
   190             iState = ENotActive;
       
   191             if ( iEngine.Observer() )
       
   192                 {
       
   193                 iEngine.Observer()->
       
   194                     HandleSharingStatus( iEngine, err, EFalse );
       
   195                 }
       
   196             }
       
   197         }
       
   198         break;
       
   199     case EWaitSetConMonStateFalse:
       
   200         {
       
   201         iState = ENotActive;
       
   202         if ( iEngine.Observer() )
       
   203             {
       
   204             iEngine.Observer()->
       
   205                 HandleSharingStatus( iEngine, err, EFalse );
       
   206             }
       
   207         break;
       
   208         }
       
   209     default :
       
   210         {
       
   211         __PANICD( __FILE__, __LINE__ );
       
   212         break;
       
   213         }
       
   214         }
       
   215     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL end");
       
   216     }
       
   217 
       
   218 // --------------------------------------------------------------------------
       
   219 // CUPnPFileSharingEngineAO::RunError
       
   220 // Handles a leave occurring in the request completion event handler
       
   221 // --------------------------------------------------------------------------
       
   222 //
       
   223 TInt CUPnPFileSharingEngineAO::RunError( TInt aError )
       
   224     {
       
   225     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL begin");
       
   226     TState state ( iState );
       
   227     iState = ENotActive;
       
   228     if ( iEngine.Observer() )
       
   229         {
       
   230         TBool phase( EFalse );
       
   231         if( state == EStartSharing ||
       
   232             state == ECheckIcon ||
       
   233             state == EWaitSetConMonStateTrue )
       
   234             {
       
   235             phase = ETrue;
       
   236             }
       
   237 
       
   238         iEngine.Observer()->
       
   239             HandleSharingStatus( iEngine, aError, phase );
       
   240         }
       
   241     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL end");
       
   242     return KErrNone;
       
   243     }
       
   244 
       
   245 // --------------------------------------------------------------------------
       
   246 // CUPnPFileSharingEngineAO::DoCancel
       
   247 // Cancels active object
       
   248 // --------------------------------------------------------------------------
       
   249 //
       
   250 void CUPnPFileSharingEngineAO::DoCancel()
       
   251     {
       
   252     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::DoCancel begin");
       
   253     if ( iIconConfigurator )
       
   254         {
       
   255         iIconConfigurator->Cancel();
       
   256         }
       
   257 
       
   258     if ( iEngine.Observer() &&
       
   259          iState != ENotActive )
       
   260         {
       
   261         TBool phase( EFalse );
       
   262         if( iState == EStartSharing ||
       
   263             iState == ECheckIcon ||
       
   264             iState == EWaitSetConMonStateTrue )
       
   265             {
       
   266             phase = ETrue;
       
   267             }
       
   268 
       
   269         iEngine.Observer()->
       
   270             HandleSharingStatus( iEngine, KErrCancel, phase );
       
   271         }
       
   272     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::DoCancel end");
       
   273     }
       
   274 
       
   275 // --------------------------------------------------------------------------
       
   276 // CUPnPSettingsEngineAO::SetSharingState
       
   277 // Starts or stops file sharing
       
   278 // --------------------------------------------------------------------------
       
   279 //
       
   280 void CUPnPFileSharingEngineAO::SetSharingStateL( TBool aState )
       
   281     {
       
   282     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SetSharingState \
       
   283  begin");
       
   284 
       
   285     if ( IsActive() )
       
   286         {
       
   287         User::Leave ( KErrInUse );
       
   288         }
       
   289 
       
   290     // Open file sharing session from mediaserver
       
   291     TBool started = SharingStateL();
       
   292     TInt err = OpenMediaServer();
       
   293 
       
   294     if ( aState && !started )
       
   295         {
       
   296         __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   297 SetSharingState: StartSharing");
       
   298 
       
   299         // check media server availibility
       
   300         if ( !err )
       
   301             {
       
   302             EnableUpnpSecurityL();
       
   303 
       
   304             CheckMediaserverIconsL();
       
   305 
       
   306             if ( !UPnPAVControllerFactory::MSServicesInUse() )
       
   307                 {
       
   308                 if ( !HasDiskSpace() )
       
   309                     {
       
   310                     err = KErrDiskFull;
       
   311                     }
       
   312                 }
       
   313             else
       
   314                 {
       
   315                 err = KErrInUse;
       
   316                 }
       
   317             }
       
   318         if ( !err )
       
   319             {
       
   320             iMediaServer.Start( iStatus );
       
   321             SetActive();
       
   322             }
       
   323         else
       
   324             {
       
   325             SetActive();
       
   326             TRequestStatus* stat = &iStatus;
       
   327             User::RequestComplete( stat, err );
       
   328             }
       
   329         }
       
   330     else if ( !aState && started )
       
   331         {
       
   332         __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   333 SetSharingState: StopSharing");
       
   334         iState = EStopSharing;
       
   335         // Ask current state of content server
       
   336         TUpnpProgress totalProgress;
       
   337         TPckgBuf<TUpnpProgress> progressBuf( totalProgress );
       
   338         TInt pubErr = RProperty::Get( KUpnpContentServerCat,
       
   339                                       ESharingProgress, progressBuf );
       
   340         TBool sharingOngoing( EFalse );
       
   341         if ( !pubErr )
       
   342             {
       
   343             Mem::Copy( &totalProgress,
       
   344                        progressBuf.Ptr(), sizeof( TUpnpProgress ) );
       
   345             if( totalProgress.iImageVideoProgress.iProgressType !=
       
   346                 TUpnpProgressInfo::EVisualStatus ||
       
   347                 totalProgress.iMusicProgress.iProgressType !=
       
   348                 TUpnpProgressInfo::EVisualStatus )
       
   349                 {
       
   350                 sharingOngoing = ETrue;
       
   351                 }
       
   352             }
       
   353 
       
   354         if( !err )
       
   355             {
       
   356             if ( !sharingOngoing )
       
   357                 {
       
   358                 // no sharing operations ongoing, stop possible
       
   359                 err = iMediaServer.Stop();
       
   360                 }
       
   361             else
       
   362                 {
       
   363                 __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   364 ->Offline");
       
   365                 err = iMediaServer.StartOffline();
       
   366                 }
       
   367 
       
   368             if ( err != KErrNone )
       
   369                 {
       
   370                 __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \
       
   371 Error: iMediaServer");
       
   372                 err = KErrGeneral;
       
   373                 // if the MediaServer lost, setting iVisibility = EUnknown 
       
   374                 // will insure the function SharingState() to start the
       
   375                 // MediaServer session again.
       
   376                 iVisibility = EUnknown;
       
   377                 }
       
   378             else
       
   379                 {
       
   380                 iVisibility = EOffline;
       
   381                 }
       
   382 
       
   383             iMediaServer.Close();
       
   384             }
       
   385         SetActive();
       
   386         TRequestStatus* stat = &iStatus;
       
   387         User::RequestComplete( stat, err );
       
   388         }
       
   389     else
       
   390         {
       
   391         //do nothing, it's already started
       
   392         iState = EStopSharing;
       
   393         if ( aState )
       
   394             {
       
   395             iState = EStartSharing;
       
   396             }
       
   397         SetActive();
       
   398         TRequestStatus* status = &iStatus;
       
   399         User::RequestComplete( status, KErrNone );
       
   400         }
       
   401 
       
   402     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SetSharingState \
       
   403  end");
       
   404     }
       
   405 
       
   406 // --------------------------------------------------------------------------
       
   407 // CUPnPFileSharingEngineAO::SharingState
       
   408 // Gets file sharing status.
       
   409 // --------------------------------------------------------------------------
       
   410 //
       
   411 TBool CUPnPFileSharingEngineAO::SharingStateL()
       
   412     {
       
   413     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SharingState begin");
       
   414 
       
   415     TBool status( EFalse );
       
   416     if ( iVisibility == EUnknown )
       
   417         {
       
   418         // Start media server session
       
   419         TInt err( OpenMediaServer() );
       
   420         if ( err == KErrNoMemory )
       
   421             {
       
   422             User::Leave( KErrNoMemory );
       
   423             }
       
   424         
       
   425         if ( !err )
       
   426             {
       
   427             TInt s( 0 );
       
   428             err = iMediaServer.Status( s );
       
   429             if ( s == RUpnpMediaServerClient::EStartedOnline )
       
   430                 {
       
   431                 status = ETrue;
       
   432                 }
       
   433             iMediaServer.Close();
       
   434             }
       
   435         if ( status && !err )
       
   436             {
       
   437             iVisibility = EOnline;
       
   438             }
       
   439         else
       
   440             {
       
   441             iVisibility = EOffline;
       
   442             }
       
   443         }
       
   444      else if( iVisibility == EOffline ) 
       
   445         {
       
   446         TInt err( OpenMediaServer() );
       
   447         if ( err == KErrNoMemory )
       
   448             User::Leave( KErrNoMemory );  
       
   449         if ( !err )
       
   450             {
       
   451             TInt s( 0 );
       
   452             err = iMediaServer.Status( s );
       
   453             if ( s == RUpnpMediaServerClient::EStartedOnline )
       
   454                 {
       
   455                 status = ETrue;
       
   456                 }
       
   457             iMediaServer.Close();
       
   458             }
       
   459         }     
       
   460     else if ( iVisibility == EOnline )
       
   461         {
       
   462         status = ETrue;
       
   463         }
       
   464 
       
   465     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SharingState end");
       
   466     return status;
       
   467     }
       
   468 
       
   469 // --------------------------------------------------------------------------
       
   470 // CUPnPFileSharingEngineAO::ConnectionLost
       
   471 // Gets file sharing status.
       
   472 // --------------------------------------------------------------------------
       
   473 //
       
   474 void CUPnPFileSharingEngineAO::ConnectionLost()
       
   475     {
       
   476     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   477 ConnectionLost begin");
       
   478     iVisibility = EOffline;
       
   479     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   480 ConnectionLost end");
       
   481     }
       
   482 
       
   483 // --------------------------------------------------------------------------
       
   484 // CUPnPFileSharingEngineAO::HasDiskSpace
       
   485 // Check that there is enough disk space in c drive
       
   486 // --------------------------------------------------------------------------
       
   487 //
       
   488 TBool CUPnPFileSharingEngineAO::HasDiskSpace()
       
   489     {
       
   490     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   491 HasDiskSpace begin");
       
   492     const TInt KDiskSpaceThreshold( 4096 ); //4kB
       
   493     RFs fileServer;
       
   494     TInt error = fileServer.Connect();
       
   495     TBool retVal( EFalse );
       
   496     TVolumeInfo freeVol;
       
   497     if( !error )
       
   498         {
       
   499         error = fileServer.SetSessionPath( PathInfo::PhoneMemoryRootPath() );
       
   500         if( !error )
       
   501             {
       
   502             error = fileServer.Volume( freeVol );
       
   503             }
       
   504         }
       
   505     fileServer.Close();
       
   506 
       
   507     if( !error )
       
   508         {
       
   509         if( freeVol.iFree > KDiskSpaceThreshold )
       
   510             {
       
   511             __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:\
       
   512 disk space:OK!");
       
   513             retVal = ETrue;
       
   514             }
       
   515         }
       
   516 
       
   517     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   518 HasDiskSpace end");
       
   519     return retVal;
       
   520     }
       
   521 
       
   522 // --------------------------------------------------------------------------
       
   523 // CUPnPFileSharingEngineAO::SetIconComplete
       
   524 // callback from icon configurator
       
   525 // --------------------------------------------------------------------------
       
   526 //
       
   527 void CUPnPFileSharingEngineAO::SetIconComplete( TInt aError )
       
   528     {
       
   529     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   530 SetIconComplete begin");
       
   531     
       
   532     if ( aError != KErrNone )
       
   533         {
       
   534         iMediaServer.Stop();  
       
   535         }
       
   536     
       
   537     // delete iconConfigurator as not needed anymore
       
   538     delete iIconConfigurator;
       
   539     iIconConfigurator = NULL;
       
   540 
       
   541     // continue sharing
       
   542     iState = EStartSharing;
       
   543     __ASSERTD( !IsActive(), __FILE__, __LINE__ );
       
   544     SetActive();
       
   545     TRequestStatus* stat = &iStatus;
       
   546     User::RequestComplete( stat, aError );
       
   547 
       
   548     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   549 SetIconComplete end");
       
   550     }
       
   551 
       
   552 // --------------------------------------------------------------------------
       
   553 // CUPnPFileSharingEngineAO::OpenMediaServer
       
   554 // Creates connection to mediaserver
       
   555 // --------------------------------------------------------------------------
       
   556 //
       
   557 TInt CUPnPFileSharingEngineAO::OpenMediaServer()
       
   558     {
       
   559     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   560 OpenMediaServer start");
       
   561 
       
   562     TInt error = iMediaServer.Connect();
       
   563     if ( error == KErrNoMemory )
       
   564         {
       
   565         return error;
       
   566         }
       
   567     
       
   568     if ( error != KErrNone )
       
   569         {
       
   570         __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   571 OpenMediaServer: Connect FAILed");
       
   572 
       
   573         // try to reconnect
       
   574         iMediaServer.Close();
       
   575         error = iMediaServer.Connect();
       
   576         if( error )
       
   577             {
       
   578             __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   579 OpenMediaServer: ReConnect FAILed");
       
   580             }
       
   581 
       
   582         }
       
   583     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   584 OpenMediaServer end");
       
   585     return error;
       
   586     }
       
   587 
       
   588 // --------------------------------------------------------------------------
       
   589 // CUPnPFileSharingEngineAO::EnableUpnpSecurityL
       
   590 // store the cenrep value
       
   591 // --------------------------------------------------------------------------
       
   592 //
       
   593 void CUPnPFileSharingEngineAO::EnableUpnpSecurityL()
       
   594     {
       
   595     // Check if the stack's security is enabled
       
   596     __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   597 EnableUpnpSecurityL: Checking the state of stack's security manager");
       
   598     TBool upnpSecurityEnabled = EFalse;
       
   599     TRAPD( secCheckError,
       
   600            upnpSecurityEnabled =
       
   601            CUpnpSecAccessController::IsMediaServerSecurityEnabledL());
       
   602 
       
   603     // If the security is not enabled, enable it now
       
   604     if( !secCheckError &&
       
   605         !upnpSecurityEnabled )
       
   606         {
       
   607         __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   608 EnableUpnpSecurityL: Activating stack's security manager");
       
   609         TRAPD( secEnableError,
       
   610                CUpnpSecAccessController::EnableMediaServerSecurityL());
       
   611         if( secEnableError )
       
   612             {
       
   613             __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\
       
   614 EnableUpnpSecurityL: Failed to activate stack's security manager");
       
   615             }
       
   616         }
       
   617     }
       
   618 
       
   619 // --------------------------------------------------------------------------
       
   620 // CUPnPFileSharingEngineAO::CheckMediaserverIconsL
       
   621 // Checks whether icons should be configured
       
   622 // --------------------------------------------------------------------------
       
   623 //
       
   624 void CUPnPFileSharingEngineAO::CheckMediaserverIconsL()
       
   625     {
       
   626     // Create the icon configurator and see if icons must be configured.
       
   627     // If they need to, start asynchronous icon configuration process.
       
   628     delete iIconConfigurator;
       
   629     iIconConfigurator = NULL;
       
   630     iIconConfigurator = new (ELeave )
       
   631         CUPnPIconConfigurator( iMediaServer, *this );
       
   632     if ( iIconConfigurator->NeedToConfigureIcons() )
       
   633         {
       
   634         iState = ECheckIcon;
       
   635         }
       
   636     else
       
   637         {
       
   638         // icons already configured, go directly to sharing state
       
   639         delete iIconConfigurator;
       
   640         iIconConfigurator = NULL;
       
   641         iState = EStartSharing;
       
   642         }
       
   643     }
       
   644 
       
   645 // End of file