phoneclientserver/phoneserver/Src/Standard/CPhSrvServer.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Server.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cphsrvserver.h" 
       
    21 #include "cphsrvsession.h" 
       
    22 #include "cphsrvscheduler.h" 
       
    23 #include "cphsrvussdmanager.h" 
       
    24 #include "cphsrvresourcemanager.h" 
       
    25 #include "cphsrvphonecontroller.h" 
       
    26 #include "cphsrvcallrequestmanager.h" 
       
    27 #include "cphsrvemergencyrequestmanager.h" 
       
    28 #include "cphsrvemergencynumbermanager.h" 
       
    29 
       
    30 #include "phsrvutils.h" 
       
    31 #include "kphsrvconfigure.h" // debugprints ON/OFF 
       
    32 #include "phsrvdebuginfo.h" 
       
    33 
       
    34 #include "mphsrvcomhandnegotiators.h" 
       
    35 #include "cphsrvcomhandrequestmanager.h" 
       
    36 #include "mphsrvmessengernegotiators.h" 
       
    37 #include "cphsrvmessengerrequestmanager.h" 
       
    38 #include <featmgr.h>
       
    39 
       
    40 
       
    41 
       
    42 // CONSTANTS
       
    43 const TInt KPhSrvServerPriority = 100;  // phone server priority
       
    44 
       
    45 
       
    46 // The create function enumerations.
       
    47 enum 
       
    48     {
       
    49     ECreateIdle,             // Create idle.
       
    50     ECreateEmergencyNegotiator, // Create Emergency Call negotiator
       
    51     ECreateCallNegotiator,   // Create Call Negotiator.
       
    52     ECreateUssdManager,      // Create USSD Manager.
       
    53     ECreatePhoneInterface,   // Create Phone Interface.
       
    54     ECreateEmergencyNumber,  // Create Emergency Number Manager.
       
    55     ECreateComHandManager,   // Create command handler manager.
       
    56     ECreateMessengerManager  // Create Messenger manager.
       
    57     };
       
    58 
       
    59 
       
    60 // ============================ MEMBER FUNCTIONS ===============================
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CPhSrvServer::New
       
    64 // 
       
    65 // Create and start a new server.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 CPhSrvServer* CPhSrvServer::NewL()
       
    69     {
       
    70     // Create
       
    71     CPhSrvServer* self = new ( ELeave ) CPhSrvServer( KPhSrvServerPriority );
       
    72 
       
    73     CleanupStack::PushL( self );
       
    74     self->ConstructL();
       
    75     CleanupStack::Pop();
       
    76 
       
    77     return self;
       
    78     }
       
    79 
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CPhSrvServer::CPhSrvServer
       
    83 // 
       
    84 // C++ constructor
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CPhSrvServer::CPhSrvServer( TInt  aPriority )
       
    88     : CServer2( aPriority ),
       
    89     iFBSConnections( 0 )
       
    90     {
       
    91     }
       
    92 
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CPhSrvServer::CPhSrvServer
       
    96 // 
       
    97 // C++ Destructor
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 CPhSrvServer::~CPhSrvServer()
       
   101     {
       
   102     CompleteCreateAll( KErrCancel );
       
   103 
       
   104     delete iCreateAll;
       
   105     delete iObjectConIx;
       
   106     delete iUssdManager;
       
   107     delete iEmergencyNumberManager;
       
   108     delete iResourceFileManager;
       
   109     delete iCallRequestManager;
       
   110     delete iPhoneController;
       
   111     delete iComHandRequestManager;
       
   112     delete iMessengerRequestManager;
       
   113 
       
   114     iFsSession.Close();
       
   115     DisconnectFBS( ETrue );
       
   116 
       
   117 
       
   118     // Frees the TLS! Must be done after FeatureManager is used.
       
   119     FeatureManager::UnInitializeLib();
       
   120     }
       
   121 
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CPhSrvServer::ConstructL
       
   125 // 
       
   126 // Symbian 2nd phase constructor can leave.
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 void CPhSrvServer::ConstructL()
       
   130     {
       
   131     // Sets up TLS, must be done before FeatureManager is used.
       
   132     FeatureManager::InitializeLibL();
       
   133 
       
   134 
       
   135     // Start server
       
   136     TInt ret = Start( PHONE_SERVER_NAME );
       
   137     __ASSERT_ALWAYS( ret == KErrNone || ret == KErrAlreadyExists, 
       
   138         PhoneServerUtils::Panic( EPhoneServerPanicCouldNotStartServer ) );
       
   139     User::LeaveIfError( ret );
       
   140     }
       
   141 
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CPhSrvServer::NewSessionL
       
   145 // 
       
   146 // Create a new session.
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 CSession2* CPhSrvServer::NewSessionL( 
       
   150     const TVersion& aVersion,
       
   151     const RMessage2& /*aMessage*/ ) const 
       
   152     {
       
   153     // Check the right version
       
   154     TVersion v( KPhoneServerMajorVersionNumber,
       
   155                 KPhoneServerMinorVersionNumber,
       
   156                 KPhoneServerBuildVersionNumber );
       
   157 
       
   158     if( !User::QueryVersionSupported( v, aVersion ) )
       
   159         {
       
   160         User::Leave( KErrNotSupported );
       
   161         }
       
   162 
       
   163     // Create a new session
       
   164     CSession2* session = CPhSrvSession::NewL( 
       
   165         *const_cast< CPhSrvServer* >( this ) );
       
   166 
       
   167     return session;
       
   168     }
       
   169 
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CPhSrvServer::CreateAllL
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 void CPhSrvServer::CreateAllL( CPhSrvSession& aSession )
       
   176     {
       
   177     if ( !iCreateAll )
       
   178         {
       
   179         iCreateAll = CIdle::NewL( CActive::EPriorityStandard );
       
   180         }
       
   181 
       
   182     User::LeaveIfError( iCreateAllArray.Append( &aSession ) );
       
   183 
       
   184     if ( !iCreateAll->IsActive() )
       
   185         {
       
   186         iCreateAllStep = ECreateIdle;
       
   187         iCreateAllError = KErrNone;
       
   188 
       
   189         iCreateAll->Start( TCallBack( DoCreateAllStepL, this ) );
       
   190         }
       
   191     }
       
   192 
       
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // CPhSrvServer::CancelCreateAll
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 void CPhSrvServer::CancelCreateAll( CPhSrvSession& aSession )
       
   199     {
       
   200     TInt pos = iCreateAllArray.Find( &aSession );
       
   201     if ( pos != KErrNotFound )
       
   202         {
       
   203         iCreateAllArray.Remove( pos );
       
   204         aSession.CompleteCreateAll( KErrCancel );
       
   205         }
       
   206     }
       
   207 
       
   208 
       
   209 // -----------------------------------------------------------------------------
       
   210 // CPhSrvServer::NewContainerL
       
   211 // 
       
   212 // Create a new object container for session.
       
   213 // -----------------------------------------------------------------------------
       
   214 //
       
   215 CObjectCon* CPhSrvServer::NewContainerL() const
       
   216     {
       
   217     if ( !iObjectConIx )
       
   218         {
       
   219         iObjectConIx = CObjectConIx::NewL();
       
   220         }
       
   221 
       
   222     return iObjectConIx->CreateL();
       
   223     }
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CPhSrvServer::RemoveContainer
       
   227 // 
       
   228 // Remove object container.
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 void  CPhSrvServer::RemoveContainer( CObjectCon* aCon )
       
   232     {
       
   233     iObjectConIx->Remove( aCon );
       
   234     }
       
   235     
       
   236 // -----------------------------------------------------------------------------
       
   237 // CPhSrvServer::CallNegotiatorL
       
   238 // 
       
   239 // Access the call negotiator
       
   240 // -----------------------------------------------------------------------------
       
   241 //
       
   242 MPhSrvNegotiatorCall& CPhSrvServer::CallNegotiatorL()
       
   243     {
       
   244     if ( !iCallRequestManager )
       
   245         {
       
   246         CPhSrvCallRequestManager* self = 
       
   247             new (ELeave) CPhSrvCallRequestManager();
       
   248         CleanupStack::PushL( self );
       
   249         self->ConstructL();
       
   250         CleanupStack::Pop( self );
       
   251 
       
   252         iCallRequestManager = self;
       
   253         }
       
   254     
       
   255     return *iCallRequestManager;
       
   256     }
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CPhSrvServer::CallNegotiator
       
   260 // 
       
   261 // Access the call negotiator
       
   262 // -----------------------------------------------------------------------------
       
   263 //
       
   264 MPhSrvNegotiatorCall& CPhSrvServer::CallNegotiator() const
       
   265     {
       
   266     __ASSERT_DEBUG( IsCallNegotiator(), 
       
   267         PhoneServerUtils::Panic( EPhoneServerPanicNoCallInitiatorFault ) );
       
   268     return *iCallRequestManager;
       
   269     }
       
   270 
       
   271 // -----------------------------------------------------------------------------
       
   272 // CPhSrvServer::EmergencyCallNegotiatorL
       
   273 // 
       
   274 // Access the emergency call negotiator
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 MPhSrvEmergencyNegotiatorCall& CPhSrvServer::EmergencyCallNegotiatorL()
       
   278     {
       
   279     if ( !iEmergencyRequestManager )
       
   280         {
       
   281         CPhSrvEmergencyRequestManager* self = 
       
   282             new (ELeave) CPhSrvEmergencyRequestManager();
       
   283         CleanupStack::PushL( self );
       
   284         self->ConstructL();
       
   285         CleanupStack::Pop( self );
       
   286 
       
   287         iEmergencyRequestManager = self;
       
   288         }
       
   289     
       
   290     return *iEmergencyRequestManager;
       
   291     }
       
   292 
       
   293 // -----------------------------------------------------------------------------
       
   294 // CPhSrvServer::EmergencyCallNegotiatorL
       
   295 // 
       
   296 // Access the emergency call negotiator
       
   297 // -----------------------------------------------------------------------------
       
   298 //
       
   299 MPhSrvEmergencyNegotiatorCall& CPhSrvServer::EmergencyCallNegotiator() const
       
   300     {
       
   301     __ASSERT_DEBUG( IsCallNegotiator(), 
       
   302         PhoneServerUtils::Panic( EPhoneServerPanicMissingEmerNegotiator ) );
       
   303     return *iEmergencyRequestManager;
       
   304     }
       
   305     
       
   306 // -----------------------------------------------------------------------------
       
   307 // CPhSrvServer::IsEmergencyCallNegotiator
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 TBool CPhSrvServer::IsEmergencyCallNegotiator() const
       
   311     {
       
   312     return ( iEmergencyRequestManager != NULL );
       
   313     }
       
   314   
       
   315 // -----------------------------------------------------------------------------
       
   316 // CPhSrvServer::UssdManagerL
       
   317 // -----------------------------------------------------------------------------
       
   318 //
       
   319 CPhSrvUssdManager& CPhSrvServer::UssdManagerL()
       
   320     {
       
   321     if ( !iUssdManager )
       
   322         {
       
   323         CPhSrvUssdManager* self = 
       
   324             new ( ELeave ) CPhSrvUssdManager( 
       
   325                 FsSessionL(), 
       
   326                 ResourceManagerL()
       
   327                );
       
   328 
       
   329         CleanupStack::PushL( self );
       
   330         self->ConstructL( PhoneInterfaceL() );
       
   331         CleanupStack::Pop( self );
       
   332 
       
   333         iUssdManager = self;
       
   334         }
       
   335    
       
   336     return *iUssdManager;
       
   337     }
       
   338 
       
   339 // -----------------------------------------------------------------------------
       
   340 // CPhSrvServer::PhoneInterfaceL
       
   341 // -----------------------------------------------------------------------------
       
   342 //
       
   343 MPhSrvPhoneInterface& CPhSrvServer::PhoneInterfaceL()
       
   344     {
       
   345     if ( !iPhoneController )
       
   346         {
       
   347         CPhSrvPhoneController* self = 
       
   348             new( ELeave ) CPhSrvPhoneController();
       
   349         CleanupStack::PushL( self );
       
   350         self->ConstructL();
       
   351         CleanupStack::Pop( self );
       
   352 
       
   353         iPhoneController = self;
       
   354         }
       
   355 
       
   356     return *iPhoneController;
       
   357     }
       
   358 
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // CPhSrvServer::EmergencyNumberManagerL
       
   362 // -----------------------------------------------------------------------------
       
   363 //
       
   364 MPhSrvEmergencyNumberManager& CPhSrvServer::EmergencyNumberManagerL()
       
   365     {
       
   366     if ( !iEmergencyNumberManager )
       
   367         {
       
   368         PhoneInterfaceL(); // if succeeds iPhoneController ok after this
       
   369         
       
   370         CPhSrvEmergencyNumberManager* self =
       
   371             new ( ELeave ) CPhSrvEmergencyNumberManager( *iPhoneController );
       
   372 
       
   373         TBool isDosEnPolicy = 
       
   374             FeatureManager::FeatureSupported( KFeatureIdEnPolicyDos );            
       
   375         CleanupStack::PushL( self );
       
   376         self->ConstructL( isDosEnPolicy );
       
   377         CleanupStack::Pop( self );
       
   378 
       
   379         iEmergencyNumberManager = self;    
       
   380         }
       
   381     
       
   382     return *iEmergencyNumberManager;
       
   383     }
       
   384 
       
   385 
       
   386 // -----------------------------------------------------------------------------
       
   387 // CPhSrvServer::IsCallNegotiator
       
   388 // -----------------------------------------------------------------------------
       
   389 //
       
   390 TBool CPhSrvServer::IsCallNegotiator() const
       
   391     {
       
   392     return ( iCallRequestManager != NULL );
       
   393     }
       
   394 
       
   395 
       
   396 // -----------------------------------------------------------------------------
       
   397 // CPhSrvServer::IsUssdManager
       
   398 // -----------------------------------------------------------------------------
       
   399 //
       
   400 TBool CPhSrvServer::IsUssdManager() const
       
   401     {
       
   402     return ( iUssdManager != NULL );
       
   403     }
       
   404 
       
   405 
       
   406 // -----------------------------------------------------------------------------
       
   407 // CPhSrvServer::ComHandNegotiatorL
       
   408 // 
       
   409 // Access the command handler negotiator.
       
   410 // -----------------------------------------------------------------------------
       
   411 //
       
   412 MPhSrvComHandNegotiator& CPhSrvServer::ComHandNegotiatorL()
       
   413     {
       
   414     if ( !iComHandRequestManager )
       
   415         {
       
   416         CPhSrvComHandRequestManager* self = 
       
   417             new ( ELeave ) CPhSrvComHandRequestManager( *this );
       
   418         CleanupStack::PushL( self );
       
   419         self->ConstructL();
       
   420         CleanupStack::Pop( self );
       
   421 
       
   422         iComHandRequestManager = self;
       
   423         }
       
   424     
       
   425     return *iComHandRequestManager;
       
   426     }
       
   427 
       
   428 // -----------------------------------------------------------------------------
       
   429 // CPhSrvServer::ComHandNegotiatorL
       
   430 // 
       
   431 // Access the command handler negotiator.
       
   432 // -----------------------------------------------------------------------------
       
   433 //
       
   434 MPhSrvComHandNegotiator& CPhSrvServer::ComHandNegotiator() const
       
   435     {
       
   436     __ASSERT_DEBUG( IsComHandNegotiator(), 
       
   437             PhoneServerUtils::Panic( EPhoneServerPanicMissingComInitiator ) );
       
   438     return *iComHandRequestManager;
       
   439     }
       
   440 
       
   441 
       
   442 // -----------------------------------------------------------------------------
       
   443 // CPhSrvServer::IsComHandNegotiator
       
   444 // -----------------------------------------------------------------------------
       
   445 //
       
   446 TBool CPhSrvServer::IsComHandNegotiator() const
       
   447     {
       
   448     return ( iComHandRequestManager != NULL );
       
   449     }
       
   450 
       
   451 
       
   452 // -----------------------------------------------------------------------------
       
   453 // CPhSrvServer::MessengerNegotiatorL
       
   454 // 
       
   455 // Access the Messenger negotiator.
       
   456 // -----------------------------------------------------------------------------
       
   457 //
       
   458 MPhSrvMessengerNegotiator& CPhSrvServer::MessengerNegotiatorL()
       
   459     {
       
   460     if ( !iMessengerRequestManager )
       
   461         {
       
   462         CPhSrvMessengerRequestManager* self = 
       
   463             new ( ELeave ) CPhSrvMessengerRequestManager( *this );
       
   464         CleanupStack::PushL( self );
       
   465         self->ConstructL();
       
   466         CleanupStack::Pop( self );
       
   467 
       
   468         iMessengerRequestManager = self;
       
   469         }
       
   470     
       
   471     return *iMessengerRequestManager;
       
   472     }
       
   473 
       
   474 // -----------------------------------------------------------------------------
       
   475 // CPhSrvServer::MessengerNegotiator
       
   476 // 
       
   477 // Access the Messenger negotiator.
       
   478 // -----------------------------------------------------------------------------
       
   479 //
       
   480 MPhSrvMessengerNegotiator& CPhSrvServer::MessengerNegotiator() const
       
   481     {
       
   482     __ASSERT_DEBUG( IsMessengerNegotiator(), 
       
   483         PhoneServerUtils::Panic( EPhoneServerPanicMissingMessNegotiator ) );
       
   484     return *iMessengerRequestManager;
       
   485     }
       
   486 
       
   487 
       
   488 // -----------------------------------------------------------------------------
       
   489 // CPhSrvServer::IsMessengerNegotiator
       
   490 // -----------------------------------------------------------------------------
       
   491 //
       
   492 TBool CPhSrvServer::IsMessengerNegotiator() const
       
   493     {
       
   494     return ( iMessengerRequestManager != NULL );
       
   495     }
       
   496 
       
   497 
       
   498 // -----------------------------------------------------------------------------
       
   499 // CPhSrvServer::FsSessionL
       
   500 // -----------------------------------------------------------------------------
       
   501 //
       
   502 RFs& CPhSrvServer::FsSessionL()
       
   503     {
       
   504     if ( !iFsSession.Handle() )
       
   505         {
       
   506         User::LeaveIfError( iFsSession.Connect() );
       
   507         }
       
   508 
       
   509     return iFsSession;
       
   510     }
       
   511 
       
   512 
       
   513 // -----------------------------------------------------------------------------
       
   514 // CPhSrvServer::ResourceManagerL
       
   515 // -----------------------------------------------------------------------------
       
   516 //
       
   517 CPhSrvResourceManager& CPhSrvServer::ResourceManagerL()
       
   518     {
       
   519     if ( !iResourceFileManager )
       
   520         {
       
   521         CPhSrvResourceManager* self = 
       
   522             new ( ELeave ) CPhSrvResourceManager( FsSessionL() );
       
   523         CleanupStack::PushL( self );
       
   524         self->ConstructL();
       
   525         CleanupStack::Pop( self );
       
   526 
       
   527         iResourceFileManager = self;
       
   528         }
       
   529     
       
   530     return *iResourceFileManager;
       
   531     }
       
   532 
       
   533 
       
   534 // -----------------------------------------------------------------------------
       
   535 // CPhSrvServer::CreateAllStepL
       
   536 // -----------------------------------------------------------------------------
       
   537 //
       
   538 TInt CPhSrvServer::CreateAllStepL()
       
   539     {
       
   540     TInt old = iCreateAllStep;
       
   541     TRAPD( err, PerformNextStepL() );
       
   542     if ( old == iCreateAllStep )
       
   543         {
       
   544         iCreateAllStep = ECreateIdle;
       
   545         err = KErrGeneral;
       
   546         }
       
   547 
       
   548     iCreateAllError = Min( iCreateAllError, err );
       
   549     
       
   550     if ( iCreateAllStep == ECreateIdle )
       
   551         {
       
   552         CompleteCreateAll( iCreateAllError );
       
   553         return 0; // To stop idle
       
   554         }
       
   555     
       
   556     return 1; // To continue idle processing
       
   557     }
       
   558 
       
   559 
       
   560 // -----------------------------------------------------------------------------
       
   561 // CPhSrvServer::PerformNextStepL
       
   562 // -----------------------------------------------------------------------------
       
   563 //
       
   564 void CPhSrvServer::PerformNextStepL()
       
   565     {
       
   566     switch ( iCreateAllStep )
       
   567         {
       
   568         case  ECreateEmergencyNegotiator:
       
   569             iCreateAllStep = ECreateCallNegotiator;
       
   570             EmergencyCallNegotiatorL();
       
   571             break;
       
   572             
       
   573         case ECreateCallNegotiator:
       
   574             iCreateAllStep = ECreateUssdManager;
       
   575             CallNegotiatorL();
       
   576             break;
       
   577 
       
   578         case ECreateUssdManager:
       
   579             iCreateAllStep = ECreatePhoneInterface;
       
   580             UssdManagerL();
       
   581             break;
       
   582 
       
   583         case ECreatePhoneInterface:
       
   584             iCreateAllStep = ECreateEmergencyNumber;
       
   585             PhoneInterfaceL();
       
   586             break;
       
   587 
       
   588         case ECreateEmergencyNumber:
       
   589             iCreateAllStep = ECreateComHandManager;
       
   590             EmergencyNumberManagerL();
       
   591             break;
       
   592 
       
   593         case ECreateComHandManager:
       
   594             iCreateAllStep = ECreateMessengerManager;
       
   595             ComHandNegotiatorL();
       
   596             break;
       
   597 
       
   598         case ECreateMessengerManager:
       
   599             iCreateAllStep = ECreateIdle;
       
   600             // Create messenger negotiator only if needed.
       
   601             if ( FeatureManager::FeatureSupported( 
       
   602                 KFeatureIdCsVideoTelephony ) )
       
   603                 {
       
   604                 MessengerNegotiatorL();
       
   605                 }
       
   606             break;
       
   607 
       
   608         case ECreateIdle:
       
   609         default:
       
   610             iCreateAllStep = ECreateEmergencyNegotiator;            
       
   611             break;
       
   612         }
       
   613     }
       
   614 
       
   615 
       
   616 // -----------------------------------------------------------------------------
       
   617 // CPhSrvServer::CompleteCreateAll
       
   618 // -----------------------------------------------------------------------------
       
   619 //
       
   620 void CPhSrvServer::CompleteCreateAll( TInt aError )
       
   621     {
       
   622     TInt count = iCreateAllArray.Count();
       
   623     TInt index;
       
   624 
       
   625     for ( index = 0; index < count; index++ )
       
   626         {
       
   627         iCreateAllArray[ index ]->CompleteCreateAll( aError );
       
   628         }
       
   629 
       
   630     iCreateAllArray.Close();
       
   631     
       
   632     delete iCreateAll; 
       
   633     iCreateAll = NULL;
       
   634 
       
   635     iCreateAllError = KErrNone;
       
   636     iCreateAllStep = ECreateIdle;
       
   637     }
       
   638 
       
   639 
       
   640 // -----------------------------------------------------------------------------
       
   641 // CPhSrvServer::DoCreateAllStepL
       
   642 // -----------------------------------------------------------------------------
       
   643 //
       
   644 TInt CPhSrvServer::DoCreateAllStepL( TAny* aAny )
       
   645     {
       
   646     return static_cast< CPhSrvServer* >( aAny )->CreateAllStepL();
       
   647     }
       
   648 
       
   649 // -----------------------------------------------------------------------------
       
   650 // CPhSrvServer::ConnectFBS
       
   651 // -----------------------------------------------------------------------------
       
   652 //
       
   653 TInt CPhSrvServer::ConnectFBS()
       
   654     {
       
   655     TInt err( KErrNone );
       
   656     if ( iFBSConnections == 0 )
       
   657         {
       
   658         err = RFbsSession::Connect();
       
   659         }
       
   660 
       
   661     if ( err == KErrNone )
       
   662         {
       
   663         iFBSConnections++;
       
   664         }
       
   665     return err;
       
   666     }
       
   667 
       
   668 // -----------------------------------------------------------------------------
       
   669 // CPhSrvServer::DisconnectFBS
       
   670 // -----------------------------------------------------------------------------
       
   671 //
       
   672 void CPhSrvServer::DisconnectFBS( TBool aForce )
       
   673     {
       
   674     iFBSConnections--;
       
   675     if ( iFBSConnections == 0 || aForce )
       
   676         {
       
   677         RFbsSession::Disconnect();
       
   678         }
       
   679     }
       
   680 
       
   681 // End of file