satengine/SatServer/Engine/src/csatmultimodeapi.cpp
changeset 0 ff3b6d0fd310
child 18 594d59766373
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Encapsule the access to etelmm API in sat
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include    <mmtsy_names.h>
       
    20 #include    "csatmultimodeapi.h"
       
    21 #include    "csatsactivewrapper.h"
       
    22 #include    "SatLog.h"
       
    23 
       
    24 #ifdef SAT_USE_DUMMY_TSY
       
    25     _LIT( KSatSDummyTsyModuleName, "DSAT" );
       
    26     _LIT( KSatSDummyTsyPhoneName, "DMobile" );
       
    27 #endif
       
    28 
       
    29 const TInt KLoopMaxTryouts = 5;
       
    30 const TInt KLoopTimeout = 3000000;
       
    31 
       
    32 // ================= MEMBER FUNCTIONS ==========================================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // Class constructor.
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CSatMultiModeApi::CSatMultiModeApi()
       
    39     {
       
    40     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CSatMultiModeApi calling-exiting" )
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // Destructor
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 CSatMultiModeApi::~CSatMultiModeApi()
       
    48     {
       
    49     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::~CSatMultiModeApi calling" )
       
    50 
       
    51     if ( iCallOpened )
       
    52         {
       
    53         iCall.Close();
       
    54         }
       
    55     
       
    56     if ( iLineOpened )
       
    57         {
       
    58         iLine.Close();
       
    59         }
       
    60     
       
    61     if ( iUssdOpened )
       
    62         {
       
    63         iUssd.Close();
       
    64         }
       
    65         
       
    66     iCustomPhone.Close();
       
    67     
       
    68     iPhone.Close();
       
    69 
       
    70 #ifdef SAT_USE_DUMMY_TSY
       
    71     iDummyPhone.Close();
       
    72 #endif
       
    73     iTelServer.Close();
       
    74             
       
    75     delete iWrapper;
       
    76     iWrapper = NULL;
       
    77 
       
    78     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::~CSatMultiModeApi calling" )
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CSatMultiModeApi::NewL
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CSatMultiModeApi* CSatMultiModeApi::NewL()
       
    86     {
       
    87     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NewL calling" )
       
    88 
       
    89     CSatMultiModeApi* self = new( ELeave )CSatMultiModeApi();
       
    90     CleanupStack::PushL( self );
       
    91     self->ConstructL();
       
    92     CleanupStack::Pop( self );
       
    93     
       
    94     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::NewL calling" )
       
    95     return self;
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CSatMultiModeApi::Phone
       
   100 // (other items were commented in a header).
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 RMobilePhone* CSatMultiModeApi::Phone()
       
   104     {
       
   105     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::Phone calling-exiting" )
       
   106     return &iPhone;
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CSatMultiModeApi::Phone
       
   111 // (other items were commented in a header).
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 RMobilePhone* CSatMultiModeApi::DummyPhone()
       
   115     {
       
   116     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::Phone calling-exiting" )
       
   117 #ifdef SAT_USE_DUMMY_TSY
       
   118     return &iDummyPhone;
       
   119 #else
       
   120     return NULL;
       
   121 #endif
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CSatMultiModeApi::CustomApi
       
   126 // (other items were commented in a header).
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 RMmCustomAPI* CSatMultiModeApi::CustomApi()
       
   130     {
       
   131     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CustomApi calling-exiting" )
       
   132     return &iCustomPhone;
       
   133     }
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CSatMultiModeApi::LowerErrorGranularity
       
   137 // (other items were commented in a header).
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 void CSatMultiModeApi::LowerErrorGranularity()
       
   141     {
       
   142     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LowerErrorGranularity \
       
   143         calling-exiting" )
       
   144     iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorBasic );
       
   145     }
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // CSatMultiModeApi::RaiseErrorGranularity
       
   149 // (other items were commented in a header).
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 void CSatMultiModeApi::RaiseErrorGranularity()
       
   153     {
       
   154     LOG( NORMAL, "SATENGINE: CSatMultiModeApi::RaiseErrorGranularity \
       
   155         calling-exiting" )
       
   156     iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended );
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CSatMultiModeApi::GetNetworkRegistrationStatus
       
   161 // (other items were commented in a header).
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 void CSatMultiModeApi::GetNetworkRegistrationStatus( 
       
   165         TRequestStatus& aReqStatus, 
       
   166         RMobilePhone::TMobilePhoneRegistrationStatus& aStatus)
       
   167     {
       
   168     LOG( SIMPLE, 
       
   169     "SATENGINE: CSatMultiModeApi::GetNetworkRegistrationStatus calling" )
       
   170 
       
   171     iPhone.GetNetworkRegistrationStatus( aReqStatus, aStatus );
       
   172 
       
   173     LOG( SIMPLE,
       
   174      "SATENGINE: CSatMultiModeApi::GetNetworkRegistrationStatus exiting" )
       
   175     }
       
   176 // -----------------------------------------------------------------------------
       
   177 // CSatMultiModeApi::NotifyNetworkRegistrationStatusChange
       
   178 // (other items were commented in a header).
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 void CSatMultiModeApi::NotifyNetworkRegistrationStatusChange(
       
   182         TRequestStatus& aReqStatus, 
       
   183         RMobilePhone::TMobilePhoneRegistrationStatus& aStatus)
       
   184     {    
       
   185     LOG( SIMPLE, "SATENGINE: \
       
   186     CSatMultiModeApi::NotifyNetworkRegistrationStatusChange calling" )
       
   187     
       
   188     iPhone.NotifyNetworkRegistrationStatusChange( aReqStatus, aStatus );
       
   189     
       
   190     LOG( SIMPLE, "SATENGINE: \
       
   191     CSatMultiModeApi::NotifyNetworkRegistrationStatusChange exiting" )
       
   192     }
       
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // CSatMultiModeApi::GetSubscriberId
       
   196 // (other items were commented in a header).
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 void CSatMultiModeApi::GetSubscriberId(TRequestStatus& aReqStatus, 
       
   200         RMobilePhone::TMobilePhoneSubscriberId& aId)
       
   201     {
       
   202     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::GetSubscriberId calling" )
       
   203     iPhone.GetSubscriberId( aReqStatus, aId );
       
   204     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::GetSubscriberId exiting" )
       
   205     }
       
   206 
       
   207 // -----------------------------------------------------------------------------
       
   208 // CSatMultiModeApi::SendDTMFTones
       
   209 // (other items were commented in a header).
       
   210 // -----------------------------------------------------------------------------
       
   211 //
       
   212 void CSatMultiModeApi::SendDTMFTones( TRequestStatus& aReqStatus, 
       
   213         const TDesC& aTones)
       
   214     {
       
   215     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::SendDTMFTones calling" )
       
   216     iPhone.SendDTMFTones( aReqStatus, aTones );
       
   217     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::SendDTMFTones exiting" )
       
   218     }
       
   219 
       
   220 // -----------------------------------------------------------------------------
       
   221 // CSatMultiModeApi::DialNoFdnCheck
       
   222 // (other items were commented in a header).
       
   223 // -----------------------------------------------------------------------------
       
   224 //
       
   225 void CSatMultiModeApi::DialNoFdnCheck( TRequestStatus& aStatus,
       
   226         const TDesC8& aCallParams, const TDesC& aTelNumber)
       
   227     {
       
   228     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialNoFdnCheck calling" )
       
   229     iCall.DialNoFdnCheck( aStatus, aCallParams, aTelNumber );
       
   230     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialNoFdnCheck exiting" )
       
   231     }
       
   232                         
       
   233 // -----------------------------------------------------------------------------
       
   234 // CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck
       
   235 // (other items were commented in a header).
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 void CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck( 
       
   239         TRequestStatus& aReqStatus, const TDesC& aServiceString)
       
   240                        
       
   241     {
       
   242     LOG( SIMPLE, "SATENGINE: \
       
   243             CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck calling" )
       
   244     
       
   245     iPhone.SendNetworkServiceRequestNoFdnCheck( aReqStatus, aServiceString );
       
   246     
       
   247     LOG( SIMPLE, "SATENGINE: \
       
   248             CSatMultiModeApi::SendNetworkServiceRequestNoFdnCheck exiting" )
       
   249     }
       
   250                                 
       
   251 // -----------------------------------------------------------------------------
       
   252 // CSatMultiModeApi::SendMessageNoFdnCheck
       
   253 // (other items were commented in a header).
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 void CSatMultiModeApi::SendMessageNoFdnCheck( TRequestStatus& aReqStatus,
       
   257             const TDesC8& aMsgData, const TDesC8& aMsgAttributes )
       
   258     {
       
   259     LOG( SIMPLE,
       
   260         "SATENGINE: CSatMultiModeApi::SendMessageNoFdnCheck calling" )
       
   261     
       
   262     iUssd.SendMessageNoFdnCheck( aReqStatus, aMsgData, aMsgAttributes );
       
   263     
       
   264     LOG( SIMPLE, 
       
   265         "SATENGINE: CSatMultiModeApi::SendMessageNoFdnCheck exiting" )
       
   266     }
       
   267 
       
   268 // -----------------------------------------------------------------------------
       
   269 // CSatMultiModeApi::CancelAsyncRequest
       
   270 // (other items were commented in a header).
       
   271 // -----------------------------------------------------------------------------
       
   272 //
       
   273 void CSatMultiModeApi::CancelAsyncRequest(TInt aReqToCancel)
       
   274     {
       
   275     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CancelAsyncRequest calling" )
       
   276     iPhone.CancelAsyncRequest( aReqToCancel );
       
   277     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::CancelAsyncRequest exiting" )
       
   278     }
       
   279 
       
   280 // -----------------------------------------------------------------------------
       
   281 // CSatMultiModeApi::DialCancel
       
   282 // (other items were commented in a header).
       
   283 // -----------------------------------------------------------------------------
       
   284 //
       
   285 void CSatMultiModeApi::DialCancel()
       
   286     {
       
   287     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel calling" )
       
   288     iCall.DialCancel();
       
   289     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::DialCancel exiting" )
       
   290     }
       
   291 
       
   292 // -----------------------------------------------------------------------------
       
   293 // CSatMultiModeApi::GetCurrentActiveUSimApplication
       
   294 // (other items were commented in a header).
       
   295 // -----------------------------------------------------------------------------
       
   296 //
       
   297 void CSatMultiModeApi::GetCurrentActiveUSimApplication(
       
   298                          TRequestStatus& aReqStatus, RMobilePhone::TAID& aAID )
       
   299     {
       
   300     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::\
       
   301             GetCurrentActiveUSimApplication calling" )
       
   302     iPhone.GetCurrentActiveUSimApplication( aReqStatus,aAID );
       
   303     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::\
       
   304             GetCurrentActiveUSimApplication exiting" )
       
   305     }
       
   306 
       
   307 // -----------------------------------------------------------------------------
       
   308 // CSatMultiModeApi::IsCallIncoming
       
   309 // (other items were commented in a header).
       
   310 // -----------------------------------------------------------------------------
       
   311 //
       
   312 TBool CSatMultiModeApi::IsCallIncoming( )
       
   313     {
       
   314     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::IsCallIncoming entering" )
       
   315     TInt lines( 0 );
       
   316     TBool callIncoming( EFalse );
       
   317 
       
   318     // Enumerate all lines in the phone
       
   319     TInt err( iPhone.EnumerateLines( lines ) );
       
   320 
       
   321     if ( KErrNone == err )
       
   322         {
       
   323         RPhone::TLineInfo lineInfo;
       
   324         // Check the lines' status one by one
       
   325         for( TInt i = 0; ( i < lines ) && !callIncoming; ++i )
       
   326             {
       
   327             err = iPhone.GetLineInfo( i, lineInfo ); 
       
   328             if ( KErrNone == err )
       
   329                 {
       
   330                 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \
       
   331                     line status is %d", lineInfo.iStatus )
       
   332                 if ( ( RCall::EStatusDialling == lineInfo.iStatus ) ||
       
   333                      ( RCall::EStatusRinging == lineInfo.iStatus ) )
       
   334                     {
       
   335                     // There is an incoming call
       
   336                     callIncoming = ETrue;
       
   337                     }
       
   338                 }
       
   339             else
       
   340                 {
       
   341                 // Error happened when getting line info
       
   342                 // We currently do nothing but skip the error line and log it
       
   343                 LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \
       
   344                     getting line status error %d", err )
       
   345                 }
       
   346             }
       
   347         }
       
   348     else
       
   349         {
       
   350         // Enumerate lines error
       
   351         LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::IsCallIncoming \
       
   352             enumerate lines error %d", err )
       
   353         }
       
   354 
       
   355     LOG2( SIMPLE, "SATENGINE: CSatMultiModeApi::IsCallIncoming exiting %d", 
       
   356           callIncoming )
       
   357     return callIncoming;
       
   358     }
       
   359 // -----------------------------------------------------------------------------
       
   360 // CSatMultiModeApi::SetActiveAndWait
       
   361 // -----------------------------------------------------------------------------
       
   362 //
       
   363 void CSatMultiModeApi::ConstructL()
       
   364     {
       
   365     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConstructL calling" )
       
   366 
       
   367     // Connect to ETel Server    
       
   368     ConnectETelServerL();
       
   369 #if !defined ( __WINSCW__ )
       
   370     //On the emulator the load will leave. We can not use the functionaly
       
   371     //on enmulator
       
   372     LoadMobileCallL();
       
   373     LoadUssdMessagingL();
       
   374 #endif
       
   375 
       
   376     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConstructL exiting" )
       
   377     }
       
   378 
       
   379 // -----------------------------------------------------------------------------
       
   380 // CSatMultiModeApi::ConnectETelServerL
       
   381 // (other items were commented in a header).
       
   382 // -----------------------------------------------------------------------------
       
   383 //
       
   384 void CSatMultiModeApi::ConnectETelServerL()
       
   385     {
       
   386     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConnectETelServerL calling" )
       
   387 
       
   388     TInt numberOfTries( 1 );        // Indicates loop tryouts
       
   389     TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
       
   390     TInt error = KErrNone;          // Error that is Leave'd
       
   391 
       
   392     if ( !iWrapper )
       
   393         {
       
   394         LOG( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \
       
   395         iWrapper false" )
       
   396         iWrapper = new ( ELeave ) CSatSActiveWrapper();
       
   397         }
       
   398 
       
   399     // First loop is for connecting to RTelServer. Loop is done until
       
   400     // connection returns KErrNone or when max loop try outs has been 
       
   401     // reached
       
   402     while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
       
   403         {
       
   404         error = iTelServer.Connect();
       
   405         if ( KErrNone == error )
       
   406             {
       
   407             LOG( NORMAL, "SATENGINE: \
       
   408             CSatMultiModeApi::ConnectETelServerL KErrNone == error" )
       
   409             loopSuccess = ETrue;
       
   410             }
       
   411         else
       
   412             {
       
   413             numberOfTries++;
       
   414             iWrapper->After( KLoopTimeout );
       
   415             }
       
   416         }
       
   417 
       
   418     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \
       
   419           numberOfTries: %i", numberOfTries )
       
   420 
       
   421     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::ConnectETelServerL \
       
   422           error: %i", error )
       
   423 
       
   424     // Check the error status
       
   425     User::LeaveIfError( error );
       
   426 
       
   427     // Now load phone module
       
   428     LoadPhoneModuleL( iPhone, KMmTsyModuleName, KMmTsyPhoneName );
       
   429 
       
   430 #ifdef SAT_USE_DUMMY_TSY
       
   431     // Also load dummy tsy
       
   432     LoadPhoneModuleL( iDummyPhone, KSatSDummyTsyModuleName, KSatSDummyTsyPhoneName );
       
   433 #endif // SAT_USE_DUMMY_TSY
       
   434 
       
   435     User::LeaveIfError( iCustomPhone.Open( iPhone ) );
       
   436 
       
   437     // No need for wrapper anymore
       
   438     delete iWrapper;
       
   439     iWrapper = NULL;
       
   440 
       
   441     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::ConnectETelServerL exiting" )
       
   442     }
       
   443 
       
   444 // -----------------------------------------------------------------------------
       
   445 // CSatMultiModeApi::LoadPhoneModuleL
       
   446 // (other items were commented in a header).
       
   447 // -----------------------------------------------------------------------------
       
   448 //
       
   449 void CSatMultiModeApi::LoadPhoneModuleL( RMobilePhone& aPhone,
       
   450         const TDesC& aModuleName, const TDesC& aPhoneName )
       
   451     {
       
   452     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL calling" )
       
   453 
       
   454     TInt numberOfTries( 1 );        // Indicates loop tryouts
       
   455     TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
       
   456     TInt error = KErrNone;          // Error that is Leave'd
       
   457 
       
   458     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
       
   459           ModuleName: %S", &aModuleName )
       
   460 
       
   461     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
       
   462           PhoneName: %S", &aPhoneName )
       
   463 
       
   464     // We wait here until the phone module gets loaded.
       
   465     // Load the correct phone module depending on the TSY being used.
       
   466     while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
       
   467         {
       
   468         error = iTelServer.LoadPhoneModule( aModuleName );
       
   469         if ( KErrNone == error )
       
   470             {
       
   471             loopSuccess = ETrue;
       
   472             }
       
   473         else
       
   474             {
       
   475             numberOfTries++;
       
   476             iWrapper->After( KLoopTimeout );
       
   477             }
       
   478         }
       
   479 
       
   480     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
       
   481           numberOfTries: %i", numberOfTries )
       
   482 
       
   483     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
       
   484           error: %i", error )
       
   485 
       
   486     // Check the error status
       
   487     User::LeaveIfError( error );
       
   488 
       
   489     // This function retrieves the total number of phones supported by all
       
   490     // the currently loaded ETel (TSY) modules.
       
   491     TInt phoneCount( 0 );
       
   492     User::LeaveIfError( iTelServer.EnumeratePhones( phoneCount ) );
       
   493 
       
   494     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
       
   495           phoneCount: %i", phoneCount )
       
   496 
       
   497     // This function retrieves information associated with the specified phone
       
   498     RTelServer::TPhoneInfo phoneInfo;
       
   499     while ( phoneCount-- )
       
   500         {
       
   501         User::LeaveIfError( iTelServer.GetPhoneInfo( phoneCount,
       
   502             phoneInfo ) );
       
   503 
       
   504         // Check that do we have the right phone
       
   505         if ( phoneInfo.iName == aPhoneName )
       
   506             {
       
   507             LOG( NORMAL, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL \
       
   508             phoneInfo.iName == aPhoneName" )
       
   509             phoneCount = 0;
       
   510             }
       
   511         }
       
   512 
       
   513     if ( phoneInfo.iName != aPhoneName )
       
   514         {
       
   515         // Did not found correct phone info -> Leave
       
   516         LOG( SIMPLE, 
       
   517             "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL Not found" )
       
   518         User::Leave( KErrNotFound );
       
   519         }
       
   520 
       
   521     // Reset the counter and loop status for the next loop.
       
   522     numberOfTries = 1;
       
   523     loopSuccess = EFalse;
       
   524 
       
   525     // We wait here until the phone gets opened.
       
   526     // Open the correct phone depending on the TSY being used.
       
   527     while ( !loopSuccess && ( numberOfTries <= KLoopMaxTryouts ) )
       
   528         {
       
   529         error = aPhone.Open( iTelServer, aPhoneName );
       
   530 
       
   531         if ( KErrNone == error )
       
   532             {
       
   533             LOG( NORMAL, "SATENGINE: \
       
   534             CSatMultiModeApi::LoadPhoneModuleL KErrNone == error" )
       
   535             loopSuccess = ETrue;
       
   536             }
       
   537         else
       
   538             {
       
   539             numberOfTries++;
       
   540             iWrapper->After( KLoopTimeout );
       
   541             }
       
   542         }
       
   543     if ( !loopSuccess )
       
   544         {
       
   545         LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL\
       
   546                       phone open failed" );
       
   547         }
       
   548     
       
   549     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadPhoneModuleL exiting" )
       
   550     }
       
   551 
       
   552 // -----------------------------------------------------------------------------
       
   553 // CSatMultiModeApi::LoadMobileCallL
       
   554 // (other items were commented in a header).
       
   555 // -----------------------------------------------------------------------------
       
   556 //
       
   557 void CSatMultiModeApi::LoadMobileCallL()
       
   558     {
       
   559     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadMobileCallL calling" )
       
   560 
       
   561     TInt numberOfTries( 1 );        // Indicates loop tryouts
       
   562     TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
       
   563     TInt error = KErrNone;          // Error that is Leave'd
       
   564 
       
   565     while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
       
   566         {
       
   567         error = iLine.Open( iPhone, KMmTsyVoice1LineName );
       
   568         if ( KErrNone == error )
       
   569             {
       
   570             loopSuccess = ETrue;
       
   571             iLineOpened = ETrue;
       
   572             }
       
   573         else
       
   574             {
       
   575             numberOfTries++;
       
   576             iWrapper->After( KLoopTimeout );
       
   577             }
       
   578         }
       
   579 
       
   580     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \
       
   581           iLine numberOfTries: %i", numberOfTries )
       
   582 
       
   583     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \
       
   584           iLine error: %i", error )
       
   585     User::LeaveIfError( error );
       
   586     
       
   587     numberOfTries = 1;
       
   588     loopSuccess =  EFalse;
       
   589     error = KErrNone;
       
   590 
       
   591     while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
       
   592         {
       
   593         error = iCall.OpenNewCall( iLine );
       
   594         if ( KErrNone == error )
       
   595             {
       
   596             loopSuccess = ETrue;
       
   597             iCallOpened = ETrue;
       
   598             }
       
   599         else
       
   600             {
       
   601             numberOfTries++;
       
   602             iWrapper->After( KLoopTimeout );
       
   603             }
       
   604         }
       
   605 
       
   606     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \
       
   607           iCall numberOfTries: %i", numberOfTries )
       
   608 
       
   609     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadMobileCallL \
       
   610           iCall error: %i", error )
       
   611 
       
   612     User::LeaveIfError( error );
       
   613 
       
   614     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadMobileCallL exiting" )   
       
   615     }
       
   616     
       
   617 // -----------------------------------------------------------------------------
       
   618 // CSatMultiModeApi::LoadMobileCallL
       
   619 // (other items were commented in a header).
       
   620 // -----------------------------------------------------------------------------
       
   621 //    
       
   622 void CSatMultiModeApi::LoadUssdMessagingL()
       
   623     
       
   624     {
       
   625     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL calling" )
       
   626 
       
   627     TInt numberOfTries( 1 );        // Indicates loop tryouts
       
   628     TBool loopSuccess( EFalse );    // Loop stopper, if this is ETrue
       
   629     TInt error = KErrNone;          // Error that is Leave'd
       
   630 
       
   631     while ( !loopSuccess && numberOfTries <= KLoopMaxTryouts )
       
   632         {
       
   633         error = iUssd.Open( iPhone );
       
   634         if ( KErrNone == error )
       
   635             {
       
   636             loopSuccess = ETrue;
       
   637             iUssdOpened = ETrue;
       
   638             }
       
   639         else
       
   640             {
       
   641             numberOfTries++;
       
   642             iWrapper->After( KLoopTimeout );
       
   643             }
       
   644         }
       
   645 
       
   646     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL \
       
   647           iUssd numberOfTries: %i", numberOfTries )
       
   648 
       
   649     LOG2( NORMAL, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL \
       
   650           iUssd error: %i", error )
       
   651           
       
   652     User::LeaveIfError( error );
       
   653 
       
   654     LOG( SIMPLE, "SATENGINE: CSatMultiModeApi::LoadUssdMessagingL exiting" )   
       
   655     }
       
   656 
       
   657 
       
   658 //End of file