atext/server/src/atextcommonsession.cpp
branchRCL_3
changeset 16 9f17f914e828
parent 0 29b1cd4cb562
equal deleted inserted replaced
14:f8503e232b0c 16:9f17f914e828
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: 
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <badesca.h>
    19 #include <badesca.h>
   130 // ---------------------------------------------------------------------------
   130 // ---------------------------------------------------------------------------
   131 //
   131 //
   132 CATExtCommonSession::CATExtCommonSession( CATExtSrvCommon& aServer,
   132 CATExtCommonSession::CATExtCommonSession( CATExtSrvCommon& aServer,
   133                                           const TVersion& aVersion ) :
   133                                           const TVersion& aVersion ) :
   134     iServer( aServer ),
   134     iServer( aServer ),
       
   135     iEComSession( NULL ),
   135     iVersion( aVersion )
   136     iVersion( aVersion )
   136     {
   137     {
   137     }
   138     }
   138 
   139 
   139 // ---------------------------------------------------------------------------
   140 // ---------------------------------------------------------------------------
   156     if ( retTemp != KErrNone )
   157     if ( retTemp != KErrNone )
   157         {
   158         {
   158         TRACE_FUNC_EXIT
   159         TRACE_FUNC_EXIT
   159         User::Leave( retTemp );
   160         User::Leave( retTemp );
   160         }
   161         }
   161     REComSession& ecomSession = REComSession::OpenL();
   162     iEComSession = &REComSession::OpenL();
   162     CleanupClosePushL( ecomSession );
       
   163     RImplInfoPtrArray implementations;
   163     RImplInfoPtrArray implementations;
   164     CleanupResetDestroyClosePushL( implementations );
   164     CleanupResetDestroyClosePushL( implementations );
   165     TUid ifUid = TUid::Uid( ATEXT_INTERFACE_COM_UID );
   165     TUid ifUid = TUid::Uid( ATEXT_INTERFACE_COM_UID );
   166     iEComSession.ListImplementationsL( ifUid,
   166     iEComSession->ListImplementationsL( ifUid,
   167                                        implementations );
   167                                         implementations );
   168     if ( implementations.Count() != 1 )
   168     if ( implementations.Count() != 1 )
   169         {
   169         {
   170         TRACE_FUNC_EXIT
   170         TRACE_FUNC_EXIT
   171         User::Leave( KErrGeneral );
   171         User::Leave( KErrGeneral );
   172         }
   172         }
   173     TUid pluginUid = implementations[0]->ImplementationUid();
   173     TUid pluginUid = implementations[0]->ImplementationUid();
   174     iCommonBase = CATExtCommonBase::NewL( pluginUid, *this, connectionName );
   174     iCommonBase = CATExtCommonBase::NewL( pluginUid, *this, connectionName );
   175     CleanupStack::PopAndDestroy( &implementations );
   175     CleanupStack::PopAndDestroy( &implementations );
   176     CleanupStack::Pop( &ecomSession );
       
   177     CleanupStack::PopAndDestroy( &connectionName );
   176     CleanupStack::PopAndDestroy( &connectionName );
   178     iEComSession = ecomSession;
       
   179     TRACE_FUNC_EXIT
   177     TRACE_FUNC_EXIT
   180     }
   178     }
   181 
   179 
   182 // ---------------------------------------------------------------------------
   180 // ---------------------------------------------------------------------------
   183 // Synchronously closes the session
   181 // Synchronously closes the session
   486         {
   484         {
   487         iNvramStatusMessage.Complete( KErrServerTerminated );
   485         iNvramStatusMessage.Complete( KErrServerTerminated );
   488         }
   486         }
   489     delete iCommonBase;
   487     delete iCommonBase;
   490     iCommonBase = NULL;
   488     iCommonBase = NULL;
   491     iEComSession.Close();
   489     if ( iEComSession )
       
   490         {
       
   491         iEComSession->Close();
       
   492         }
   492     if ( !aSyncClose )
   493     if ( !aSyncClose )
   493         {
   494         {
   494         REComSession::FinalClose();
   495         REComSession::FinalClose();
   495         iServer.ClientClosed( *this );
   496         iServer.ClientClosed( *this );
   496         }
   497         }