telephonyserverplugins/common_tsy/commontsy/src/mmtsy/cmmphonetsy.cpp
changeset 0 3553901f7fa8
child 14 7ef16719d8cb
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 //INCLUDES
       
    19 #include <etelmm.h>
       
    20 #include <etelmmerr.h>
       
    21 #include <exterror.h>
       
    22 
       
    23 #include "cmmphonetsy.h"
       
    24 #include "cmmvoicelinetsy.h"
       
    25 #include "cmmdatalinetsy.h"
       
    26 #include "cmmfaxlinetsy.h"
       
    27 #include "cmmcalltsy.h"
       
    28 #include "cmmconferencecalltsy.h"
       
    29 #include "cmmussdtsy.h"
       
    30 #include "cmmsecuritytsy.h"
       
    31 #include "cmmbroadcasttsy.h"
       
    32 #include "cmmsmstsy.h"
       
    33 #include "cmmonstoretsy.h"
       
    34 #include "cmmenstoretsy.h"
       
    35 #include "cmmphonebookstoretsy.h"
       
    36 #include "CMmCustomTsy.h"
       
    37 #include "cmmtsyreqhandlestore.h"
       
    38 #include "cmmcalllist.h"
       
    39 #include "cmmlinelist.h"
       
    40 #include "cmmpblist.h"
       
    41 #include "MmTsy_numberOfSlots.h"
       
    42 #include "MmTsy_conf.h"
       
    43 #include <ctsy/mmtsy_names.h>
       
    44 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    45 #include "CMmCommonStaticUtility.h"
       
    46 #include "CMmSIMTsy.h"
       
    47 #include "cmmnettsy.h"
       
    48 #include "cmmdtmftsy.h"
       
    49 #include "cmmsupplservtsy.h"
       
    50 #include "ctsyprivatecrpkeys.h"
       
    51 #include <ctsy/serviceapi/ctsydomaincrkeys.h>
       
    52 #include "et_struct.h"
       
    53 
       
    54 // Product specific headers
       
    55 #include "MmTsy_PhoneDefs.h"
       
    56 #include "Cmmpacketservicetsy.h"
       
    57 #include "cmmphonegsmwcdmaext.h"
       
    58 
       
    59 #ifdef REQHANDLE_TIMER
       
    60 #include "CResponseTimer.h"
       
    61 #include "CResponseTimerStore.h"
       
    62 #endif // REQHANDLE_TIMER
       
    63 
       
    64 #include <ctsy/serviceapi/ctsysatmessagingbase.h>
       
    65 #include "cmmphonefactorytsy.h"
       
    66 #include <ctsy/pluginapi/cmmdatapackage.h>
       
    67 #include <ctsy/serviceapi/gsmerror.h>
       
    68 
       
    69 // observers for HWRM
       
    70 #include "BatteryInfoObserver.h"
       
    71 #include "ChargingStatusObserver.h"
       
    72 
       
    73 #ifdef SYMBIAN_BAFL_SYSUTIL
       
    74 #include <bafl/sysutil.h>
       
    75 #endif
       
    76 
       
    77 // ======== Patchable-Constants ======
       
    78 #ifdef __EABI__
       
    79 // HWRM is supported
       
    80 IMPORT_C extern const TInt32 KHWRMIsSupported;
       
    81 #else
       
    82 // for emulator, use HalFunction to get the value from epoc.ini
       
    83 #include <u32hal.h>
       
    84 #endif
       
    85 
       
    86 // ======== MEMBER FUNCTIONS ========
       
    87 
       
    88 EXPORT_C CMmPhoneTsy* CMmPhoneTsy::NewL (
       
    89     CMmMessageManagerBase* aMessageManager,
       
    90     CMmPhoneFactoryTsy* aMmPhoneFactoryTsy,
       
    91     MLtsyFactoryBase* aFactory )
       
    92     {
       
    93 TFLOGSTRING2("TSY: CMmPhoneTsy::NewL - Phone model Id: %S", &KPhoneModelId);
       
    94     CMmPhoneTsy* mmPhoneTsy = new (ELeave) CMmPhoneTsy();
       
    95 
       
    96     mmPhoneTsy->iMessageManager = aMessageManager;
       
    97     mmPhoneTsy->iMmPhoneFactory = aMmPhoneFactoryTsy;
       
    98     //For pointer is stored for deleting licenseetsy instance
       
    99     mmPhoneTsy->iLtsyFactory = aFactory;
       
   100     mmPhoneTsy->iTelephonyAudioControl = NULL;
       
   101     if ( aFactory )
       
   102         {
       
   103         // Version number is used to specify LTSY interface 
       
   104         MLtsyFactoryBase::TCtsyInterfaceVersion vers =
       
   105             aFactory->Version();
       
   106         
       
   107         if( MLtsyFactoryBase::EIfVersion2 <= vers )
       
   108             {
       
   109             MLtsyFactoryV2* ptr_v2 = 
       
   110                 static_cast<MLtsyFactoryV2*>( aFactory );           
       
   111             
       
   112             // Acquire Telephony Audio Control pointer
       
   113             mmPhoneTsy->iTelephonyAudioControl = 
       
   114                 ptr_v2->GetTelephonyAudioControl( mmPhoneTsy );            
       
   115             }
       
   116         }
       
   117 
       
   118     CleanupClosePushL( *mmPhoneTsy );
       
   119     mmPhoneTsy->ConstructL();
       
   120     CleanupStack::Pop( mmPhoneTsy );
       
   121     return mmPhoneTsy;
       
   122     }
       
   123 
       
   124 CMmPhoneTsy::CMmPhoneTsy()
       
   125     {
       
   126     }
       
   127 
       
   128 void CMmPhoneTsy::ConstructL()
       
   129     {
       
   130 TFLOGSTRING("TSY: CMmPhoneTsy::ConstructL");
       
   131 	iCentRep = CRepository::NewL( KCRUidCtsyMEAlsLine );
       
   132 TFLOGSTRING("TSY: CMmPhoneTsy::ConstructL Central Repository opened successfully");
       
   133 	
       
   134 	//iPublic Central Repositories
       
   135     iMWISCentRep = CRepository::NewL( KCRUidCtsyMessageWaitingIndicator );
       
   136     iCFISPrivateCentRep = CRepository::NewL( KCRUidCtsyPrivateCallForwardingIndicator );
       
   137     iCFISCentRep = CRepository::NewL( KCRUidCtsyCallForwardingIndicator );
       
   138     
       
   139     // Set all the boot states to false
       
   140     iBootState.iSIMReady = EFalse;
       
   141     iBootState.iADNReady = EFalse;
       
   142     // Security will be set ready when all needed security codes
       
   143     // (PIN/Security code) are requested in boot
       
   144     iBootState.iSecReady = EFalse;
       
   145 
       
   146     //Initialise transaction handler, TSY req handle store, and object lists
       
   147     InitStoresAndListsL();
       
   148 
       
   149     //Initialise extension modules
       
   150     InitExtensionModulesL();
       
   151 
       
   152     //Initialise miscellaneous internal attributes
       
   153     InitInternalAttributes();
       
   154 
       
   155     //register phonetsy in the message manager
       
   156     iMessageManager->RegisterTsyObject( 
       
   157         CMmMessageManagerBase::EPhoneTsy , this );
       
   158         
       
   159     iEmergencyCallInfoProperty.Define( KPSUidCtsyEmergencyCallInfo,
       
   160           KCTSYEmergencyCallInfo, RProperty::EInt );
       
   161           
       
   162     //Parameter store
       
   163 	iServiceTableReq = new ( ELeave ) TGetServiceTableRequest();
       
   164 	
       
   165 	//Initialisation
       
   166 	iCalledOnGet = EFalse;
       
   167 	iServiceTableReq->iCaching = EFalse;
       
   168 	iSimRefreshRegisterOk = EFalse;
       
   169 	iCacheServiceTableError = KErrNone;
       
   170 	iTSYSubscriberIdReq = EFalse; 
       
   171 	iAlsQueryInBoot = EFalse; 
       
   172 	iCspFileQueryInBoot = EFalse;
       
   173 	iCspFileALS = EFalse;
       
   174 	iAlsPpSupport = EFalse;
       
   175 	iCspFileAlsSet = EFalse;
       
   176 	iViagHomeZoneParamsChecked = EFalse;
       
   177 	iIsInitializationActive = EFalse;
       
   178 
       
   179 	// initialize HWRM & its observers
       
   180 	if(IsHWRMSupported())
       
   181 		{
       
   182 		TFLOGSTRING("TSY: HWRM Battery API is in use.");
       
   183 		iPowerManager = CHWRMPower::NewL();
       
   184 		iBattery = CBatteryInfoObserver::NewL( *iPowerManager, *this ); 
       
   185 		iChargingStatus = CChargingStatusObserver::NewL( *this );
       
   186 		}
       
   187 	
       
   188 //#ifdef __WINS__  SYMBIAN commented out
       
   189 //   iMmPhoneExtInterface->NotifySimStatusReadyL();
       
   190 //#endif
       
   191     }
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // CMmPhoneTsy::InitStoresAndListsL
       
   195 // Initialises transaction handler, TSY req handle store,
       
   196 // and object lists (Call, Line and Phonebook lists) for CMmPhoneTsy
       
   197 // (other items were commented in a header).
       
   198 // ---------------------------------------------------------------------------
       
   199 //
       
   200 void CMmPhoneTsy::InitStoresAndListsL()
       
   201     {
       
   202 #ifdef REQHANDLE_TIMER
       
   203     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this,
       
   204         this, EMultimodePhoneMaxNumOfRequests, iPhoneReqHandles );
       
   205         
       
   206     iTimeStampStore = CResponseTimerStore::NewL ( this );
       
   207     iReqHandleTimer = CResponseTimer::NewL( this );
       
   208 
       
   209 #else
       
   210     //create req handle store
       
   211     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL(
       
   212         EMultimodePhoneMaxNumOfRequests,  iPhoneReqHandles );
       
   213         
       
   214 #endif //REQHANDLE_TIMER
       
   215 
       
   216     // Create call list
       
   217     iCallList = CMmCallList::NewL( this );
       
   218 
       
   219     // Create line list
       
   220     iLineList = CMmLineList::NewL( this );
       
   221 
       
   222     // Create phonebook list
       
   223     iPBList = CMmPBList::NewL( this );
       
   224 
       
   225     // Service table
       
   226     iServiceTableDataCache = NULL;
       
   227 
       
   228     // Service table (USIM)
       
   229     iServiceTableUSIMDataCache = NULL;
       
   230 
       
   231     //air time duration timer
       
   232     iAirTimeDurationTimer = CHeartbeatRunner::NewL( NULL, this );
       
   233 
       
   234     // Create and init phonebook state
       
   235     iPhoneBookState = new(ELeave) CStorageInfoData();
       
   236     }
       
   237 
       
   238 
       
   239 // ---------------------------------------------------------------------------
       
   240 // CMmPhoneTsy::SetMessageManager
       
   241 // Set message handler
       
   242 // (other items were commented in a header).
       
   243 // ---------------------------------------------------------------------------
       
   244 //
       
   245 void CMmPhoneTsy::SetMessageManager(
       
   246     CMmMessageManagerBase* aMessageManager )
       
   247 	{
       
   248 	iMessageManager = aMessageManager;
       
   249 	}
       
   250 
       
   251 // ---------------------------------------------------------------------------
       
   252 // CMmPhoneTsy::InitExtensionModulesL
       
   253 // Initialises extension modules for CMmPhoneTsy
       
   254 // (other items were commented in a header).
       
   255 // ---------------------------------------------------------------------------
       
   256 //
       
   257 void CMmPhoneTsy::InitExtensionModulesL()
       
   258     {
       
   259 //Warnings caused by configurational constants in if case. These are not
       
   260 //really errors but act as flags. This warning is purely informational as can
       
   261 //be seen from the explanation of Visual C++ help:
       
   262 //Compiler Warning (level 4) C4127
       
   263 //conditional expression is constant. The controlling expression of an
       
   264 //if statement or while loop evaluated to a constant. As a result, the
       
   265 //code in the body of the if statement or while loop either always
       
   266 //executes or never executes. This warning is informational.
       
   267 #pragma warning(disable : 4127)
       
   268 
       
   269     if ( RMobilePhone::ENetworkModeGsm == KDefaultProtocol )
       
   270         {
       
   271         //Create GSM Phone extension
       
   272         iMmPhoneExtInterface =  CMmPhoneGsmWcdmaExt::NewL( this, 
       
   273             iMessageManager );
       
   274         }
       
   275 
       
   276 //Set warning level to normal
       
   277 #pragma warning(default : 4127)
       
   278 
       
   279     // create DTMF Tsy instance
       
   280 	iMmDtmfTsy = CMmDtmfTsy::NewL( this );
       
   281 
       
   282     // create NetTsy instance
       
   283 	iMmNetTsy = CMmNetTsy::NewL( this );
       
   284 
       
   285     // create SupplServTsy instance
       
   286 	iMmSupplServTsy = CMmSupplServTsy::NewL( this );
       
   287 
       
   288     //create SecurityTsy instance
       
   289     iMmSecurityTsy = CMmSecurityTsy::NewL( this );
       
   290     }
       
   291 
       
   292 // ---------------------------------------------------------------------------
       
   293 // CMmPhoneTsy::InitInternalAttributes
       
   294 // Initialises miscellaneous internal attributes
       
   295 // (other items were commented in a header).
       
   296 // ---------------------------------------------------------------------------
       
   297 //
       
   298 void CMmPhoneTsy::InitInternalAttributes()
       
   299     {
       
   300     // Battery info
       
   301     iBatteryInfo.iStatus = RMobilePhone::EPowerStatusUnknown;
       
   302     iBatteryInfo.iChargeLevel = 0x00;
       
   303 
       
   304     // Modem info
       
   305     iPhoneStatus.iMode          = RPhone::EModeIdle;
       
   306     iPhoneStatus.iModemDetected = RPhone::EDetectedPresent;
       
   307 
       
   308     //ALS line
       
   309     iAlsLine = RMobilePhone::EAlternateLineUnknown;
       
   310 
       
   311     //amount of active calls for air time duration
       
   312     iAmountOfActiveCalls = 0;
       
   313 
       
   314     //Temporary ALS line
       
   315     iTempAlsLine = RMobilePhone::EAlternateLineUnknown;
       
   316 
       
   317     //SMS Messaging sub session
       
   318     iMmSmsTsy = NULL;
       
   319 
       
   320     //Set manufacturer
       
   321     iPhoneIdentity.iManufacturer.Copy( KPhoneManufacturerId );
       
   322 
       
   323     //Set model
       
   324     iPhoneIdentity.iModel.Copy( KPhoneModelId );
       
   325 
       
   326     //Set revision
       
   327     iPhoneIdentity.iRevision.Copy( KPhoneRevisionId );
       
   328 
       
   329 	//Set serial number to 'unknown'
       
   330 	iPhoneIdentity.iSerialNumber.Zero();
       
   331 
       
   332     // no SIM refresh ongoing at boot
       
   333     iRefreshOngoing = EFalse;
       
   334     iSimCacheQueue = 0;
       
   335     
       
   336     iPendingServiceTableReq = ENoRequest;
       
   337     iPendingServiceTableCacheReq = ENoRequest;
       
   338 
       
   339     // modem not ready
       
   340     iIsModemReady = EFalse;
       
   341     }
       
   342     
       
   343 CMmPhoneTsy::~CMmPhoneTsy()
       
   344     {
       
   345 TFLOGSTRING("TSY: CMmPhoneTsy::~CMmPhoneTsy");
       
   346 
       
   347 	if(IsHWRMSupported())
       
   348 		{
       
   349 		if ( iChargingStatus )
       
   350 			{
       
   351 			delete iChargingStatus;   
       
   352 			}
       
   353 			
       
   354 		if ( iBattery )
       
   355 			{
       
   356 			delete iBattery;    
       
   357 			}
       
   358 		
       
   359 		if ( iPowerManager )
       
   360 			{
       
   361 			delete iPowerManager;
       
   362 			}
       
   363 		}
       
   364     // deregister tsy object from message manager
       
   365     MessageManager()->DeregisterTsyObject( this );
       
   366     
       
   367     //Close handle to P&S (Close is not needed because we don't 
       
   368     //have a handle to this property)
       
   369     iEmergencyCallInfoProperty.Delete(KPSUidCtsyEmergencyCallInfo,
       
   370     	KCTSYEmergencyCallInfo);
       
   371 
       
   372     if ( iServiceTableDataCache )
       
   373         {
       
   374         delete iServiceTableDataCache;
       
   375         }
       
   376 
       
   377     if ( iServiceTableUSIMDataCache )
       
   378         {
       
   379         delete iServiceTableUSIMDataCache;
       
   380         }
       
   381 
       
   382     //delete req handle store
       
   383     if ( iTsyReqHandleStore )
       
   384         {
       
   385         delete iTsyReqHandleStore;
       
   386         }
       
   387     iTsyReqHandleStore = NULL;
       
   388     //delete phone extension
       
   389     if ( iMmPhoneExtInterface )
       
   390         {
       
   391         delete iMmPhoneExtInterface;
       
   392         }
       
   393     iMmPhoneExtInterface = NULL;
       
   394     // delete DTMF Tsy instance
       
   395     if ( iMmDtmfTsy )
       
   396         {
       
   397         delete iMmDtmfTsy;
       
   398         }
       
   399     iMmDtmfTsy = NULL;
       
   400     // delete NetTsy instance
       
   401     if ( iMmNetTsy )
       
   402         {
       
   403         delete iMmNetTsy;
       
   404         }
       
   405     iMmNetTsy = NULL;
       
   406     // delete SupplServTsy instance
       
   407     if ( iMmSupplServTsy )
       
   408         {
       
   409         delete iMmSupplServTsy;
       
   410         }
       
   411     iMmSupplServTsy = NULL;
       
   412     //delete SecurityTsy instance
       
   413     if ( iMmSecurityTsy )
       
   414         {
       
   415         delete iMmSecurityTsy;
       
   416         }
       
   417     iMmSecurityTsy = NULL;
       
   418 
       
   419     // Destroy the call list
       
   420     if ( iCallList )
       
   421         {
       
   422         delete iCallList;
       
   423         }
       
   424     iCallList = NULL;
       
   425     // Destroy the line list
       
   426     if ( iLineList )
       
   427         {
       
   428         delete iLineList;
       
   429         }
       
   430     iLineList = NULL;
       
   431     // Destroy the phonebook list
       
   432     if ( iPBList )
       
   433         {
       
   434         delete iPBList;
       
   435         }
       
   436     iPBList = NULL;
       
   437 	
       
   438 	//Release created LicenseeTsy instance
       
   439 	if( iLtsyFactory )
       
   440 		{
       
   441 		iLtsyFactory->Release();
       
   442 		}
       
   443 	iLtsyFactory = NULL;
       
   444 	
       
   445     // Destroy the message manager
       
   446     if ( iMessageManager )
       
   447         {
       
   448         delete iMessageManager;
       
   449         }
       
   450     iMessageManager = NULL;
       
   451 
       
   452 #ifdef REQHANDLE_TIMER
       
   453    //delete the time store
       
   454     if ( iReqHandleTimer )
       
   455         {
       
   456         delete iReqHandleTimer;
       
   457         }
       
   458     iReqHandleTimer = NULL;
       
   459    //delete the timer
       
   460     if ( iTimeStampStore )
       
   461         {
       
   462         delete iTimeStampStore;
       
   463         }
       
   464     iTimeStampStore = NULL;
       
   465 #endif //REQHANDLE_TIMER
       
   466 
       
   467     //delete the air time duration timer
       
   468     if ( iAirTimeDurationTimer )
       
   469         {
       
   470         delete iAirTimeDurationTimer;
       
   471         }
       
   472     iAirTimeDurationTimer = NULL;
       
   473 
       
   474     //delete phonebook state
       
   475     if ( iPhoneBookState )
       
   476         {
       
   477         delete iPhoneBookState;
       
   478         }
       
   479     iPhoneBookState = NULL;
       
   480 	
       
   481 	if( iCentRep )
       
   482 		{
       
   483 		delete iCentRep;	
       
   484 		}	
       
   485 	iCentRep = NULL;
       
   486 	
       
   487 	// public central repositories
       
   488     if( iCFISCentRep )
       
   489 		{
       
   490 		delete iCFISCentRep;	
       
   491 		}	
       
   492 	iCFISCentRep = NULL;
       
   493 
       
   494     if( iMWISCentRep )
       
   495 		{
       
   496 		delete iMWISCentRep;	
       
   497 		}	
       
   498 	iMWISCentRep = NULL;
       
   499 
       
   500 
       
   501 	if ( iCFISPrivateCentRep )
       
   502 		{
       
   503 		delete iCFISPrivateCentRep;
       
   504 		}
       
   505 	iCFISPrivateCentRep = NULL;
       
   506 	
       
   507     //delete service table req
       
   508     if( iServiceTableReq )
       
   509     	{
       
   510     	delete iServiceTableReq;
       
   511     	iServiceTableReq = NULL;
       
   512     	}
       
   513     	
       
   514     iSubscriberIdRequests.ResetAndDestroy();
       
   515     iCustomerServiceProfileRequests.ResetAndDestroy();
       
   516     iGetAlsLineRequests.ResetAndDestroy();
       
   517     iServiceProviderNameRequests.ResetAndDestroy();
       
   518  	
       
   519     //set pointters to NULL
       
   520     iMmPhoneFactory = NULL;
       
   521     iMmConferenceCall = NULL;
       
   522     iTsySatMessaging = NULL;
       
   523     iMmUssdTsy = NULL;
       
   524     iMmONStoreTsy = NULL;
       
   525     iMmENStoreTsy = NULL;
       
   526     iMmPhoneBookStoreTsy = NULL;
       
   527     iMmCustomTsy = NULL;
       
   528     iMmSmsTsy = NULL;
       
   529     iMmPacketServiceTsy = NULL;
       
   530     iRetPhoneIdentity = NULL;
       
   531     iRetCaps = NULL;
       
   532     iRetModemDetection = NULL;
       
   533     iRetNotifyFdnStatus = NULL;
       
   534     iRetNotifyALSLine = NULL;
       
   535     iICCCaps = NULL;
       
   536     iRetBatteryInfo = NULL;
       
   537     iRetPhoneStoreInfo = NULL;
       
   538     iRetTableData = NULL;
       
   539     iMmBroadcastTsy = NULL;
       
   540     iRetFdnSetting = NULL;
       
   541     iMmWaitingDataCall = NULL;
       
   542     iRetGetFdnStatus = NULL;
       
   543     iRetAPNEntries = NULL;
       
   544 	iRetAPNname = NULL;
       
   545     iRetAclStatus = NULL;
       
   546     iSetAclStatus = NULL;
       
   547     iRetNotifyAclStatus = NULL;
       
   548 TFLOGSTRING("TSY: CMmPhoneTsy::~CMmPhoneTsy DONE");
       
   549    }
       
   550 
       
   551 // ---------------------------------------------------------------------------
       
   552 // CMmPhoneTsy::Init
       
   553 // Initialisation method that is called from ETel Server
       
   554 // Creates TRAP and calls InitL method to do the actual initialisation
       
   555 // (other items were commented in a header).
       
   556 // ---------------------------------------------------------------------------
       
   557 //
       
   558 void CMmPhoneTsy::Init()
       
   559     {
       
   560     }
       
   561 
       
   562 // ---------------------------------------------------------------------------
       
   563 // CMmPhoneTsy::CompleteNotifyModemStatusReady
       
   564 // Trapped version of Init. Sends mode independent initialisation
       
   565 // requests to Phonet and then directs the request also to extension for
       
   566 // mode dependent initialisation requests
       
   567 // (other items were commented in a header).
       
   568 // ---------------------------------------------------------------------------
       
   569 //
       
   570 void CMmPhoneTsy::CompleteNotifyModemStatusReady()
       
   571     {
       
   572 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyModemStatusReady");
       
   573 
       
   574     TRAP_IGNORE(
       
   575     //update the network registration status
       
   576         iMmPhoneExtInterface->GetNetworkRegistrationStatusL( );
       
   577 
       
   578     //Start SMS routing if is not activated
       
   579     if( iMmSmsTsy )
       
   580         {
       
   581         iMmSmsTsy->ActivateSmsRoutingL();
       
   582         }
       
   583 
       
   584     // Make the SIM status request here to get SIM initializing started
       
   585         iMmPhoneExtInterface->NotifySimStatusReadyL();
       
   586     );
       
   587     // set internal boolean to true
       
   588     iIsModemReady = ETrue;
       
   589      }
       
   590 
       
   591 // ---------------------------------------------------------------------------
       
   592 // CMmPhoneTsy::CompleteNotifySimStatusReadyL
       
   593 // Initializes SIM dependent parts
       
   594 // (other items were commented in a header).
       
   595 // ---------------------------------------------------------------------------
       
   596 //
       
   597 void CMmPhoneTsy::CompleteNotifySimStatusReadyL()
       
   598     {
       
   599     if ( !iBootState.iSIMReady )
       
   600         {
       
   601 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifySimStatusReadyL - SIM is ready, start initialisations");
       
   602 
       
   603         iBootState.iSIMReady = ETrue;
       
   604         iBootState.iADNReady = ETrue;
       
   605 
       
   606         // Might leave, but we want to call also other
       
   607         // init methods here so trap possible leave.
       
   608         iMmPhoneExtInterface->InitSimL();
       
   609 
       
   610 		// Cache Service Tables
       
   611 		CacheServiceTablesL();
       
   612         // start Phonebook caching
       
   613         StartPBCachingL();
       
   614 
       
   615         // request ALS status
       
   616         iMessageManager->HandleRequestL( EMobilePhoneGetALSLine );
       
   617         // Request callforwarding number
       
   618         iMessageManager->HandleRequestL( EMmTsyGetCallForwardingNumberIPC );
       
   619         // Get call forwarding status
       
   620        	iMessageManager->HandleRequestL( 
       
   621        	    ECustomGetIccCallForwardingStatusIPC );
       
   622         // Get message waiting indicators
       
   623         iMessageManager->HandleRequestL( 
       
   624             EMobilePhoneGetIccMessageWaitingIndicators );
       
   625             
       
   626         TInt ret = iMessageManager->HandleRequestL(
       
   627             ECustomCheckAlsPpSupportIPC );
       
   628         
       
   629         if( KErrNone == ret )
       
   630             {
       
   631         	iAlsQueryInBoot = ETrue;
       
   632             }
       
   633         
       
   634         ret =  iMessageManager->HandleRequestL(
       
   635 			EMobilePhoneGetCustomerServiceProfile );
       
   636         
       
   637         if( KErrNone == ret )
       
   638             {
       
   639         	iCspFileQueryInBoot = ETrue;
       
   640             }
       
   641         
       
   642         // If Custom TSY is open, check whether we need to read
       
   643         // VIAG homezone parameters. 
       
   644         if ( iMmCustomTsy )
       
   645             {
       
   646 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifySimStatusReadyL - CustomTSY ready");
       
   647             // Get pointer to SIM Custom TSY
       
   648             CMmSIMTsy* simCustomTsy =
       
   649                 ( ( CMmSIMTsy* ) iMmCustomTsy->GetSIMTsyPtr() );
       
   650             
       
   651             if ( simCustomTsy )
       
   652                 {
       
   653 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifySimStatusReadyL - CheckViagHomeZoneParamsL()");
       
   654                 simCustomTsy->CheckViagHomezoneParamsL();
       
   655                 iViagHomeZoneParamsChecked = ETrue;
       
   656                 }
       
   657             }
       
   658         // If not able to read here it's tried again in customtsy    
       
   659         else
       
   660         	{
       
   661         	iViagHomeZoneParamsChecked = EFalse;
       
   662 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifySimStatusReadyL - CustomTSY NOT ready");        		
       
   663         	}
       
   664         } 
       
   665     }
       
   666 
       
   667 // ---------------------------------------------------------------------------
       
   668 // CMmPhoneTsy::CompleteNotifySecurityReady
       
   669 // Completes NotifySecurityReady request
       
   670 // (other items were commented in a header).
       
   671 // ---------------------------------------------------------------------------
       
   672 //
       
   673 void CMmPhoneTsy::CompleteNotifySecurityReady()
       
   674     {
       
   675     iBootState.iSecReady = ETrue;
       
   676     }
       
   677 
       
   678 // ---------------------------------------------------------------------------
       
   679 // CMmPhoneTsy::StartPBCachingL
       
   680 // Initializes Phonebook caching once the SIM is ready
       
   681 // (other items were commented in a header).
       
   682 // ---------------------------------------------------------------------------
       
   683 //
       
   684 void CMmPhoneTsy::StartPBCachingL()
       
   685     {
       
   686     // If ADN or FDN phone book storage is created, then start to fetch
       
   687     // entries from SIM into cache.
       
   688     for( TInt i = 0; i < iPBList->GetNumberOfObjects(); i++ )
       
   689         {
       
   690         //Get pbStore object
       
   691         CMmPhoneBookStoreTsy* pbStore = iPBList->GetMmPBByIndex( i );
       
   692         //Check if the current PB is the object that we are trying to find.
       
   693         //If both names are exactly the same, CompareF returns 0.
       
   694         if ( 0 == pbStore->PhoneBookName()->CompareF( KETelIccAdnPhoneBook ) )
       
   695             {
       
   696 TFLOGSTRING("TSY: CMmPhoneTsy::StartPBCachingL - Start to read ADN entries");
       
   697             //Start to cache phonebook entries.
       
   698             pbStore->CacheEntriesL();
       
   699             }
       
   700         //If current PB is FDN
       
   701         else if ( 0 == pbStore->PhoneBookName()->CompareF( 
       
   702             KETelIccFdnPhoneBook ) )
       
   703             {
       
   704 TFLOGSTRING("TSY: CMmPhoneTsy::StartPBCaching - Start to read FDN entries" );
       
   705             //Start to cache phonebook entries.
       
   706             pbStore->CacheEntriesL();
       
   707             }
       
   708         }
       
   709     }
       
   710 
       
   711 // ---------------------------------------------------------------------------
       
   712 // CMmPhoneTsy::NotifyIndicatorChange
       
   713 // Register to listen to indicator changes
       
   714 // (other items were commented in a header).
       
   715 // ---------------------------------------------------------------------------
       
   716 //
       
   717 TInt CMmPhoneTsy::NotifyIndicatorChange(
       
   718     TUint32* aIndicatorState )
       
   719     {
       
   720 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyIndicatorChange");
       
   721 
       
   722     // Update indicator state, we don't keep track of it
       
   723     // unless notify is on. So we need to update starting
       
   724     // value first..
       
   725     iIndicatorState = GetIndicatorState();
       
   726     iRetIndicatorState = aIndicatorState;
       
   727     iReqHandleType = EMultimodePhoneNotifyIndicatorChange;
       
   728     return KErrNone;
       
   729     }
       
   730 
       
   731 // ---------------------------------------------------------------------------
       
   732 // CMmPhoneTsy::CompleteNotifyIndicatorChange
       
   733 // Description: Complete NotifyIndicatorChange if indicator state has changed
       
   734 // (other items were commented in a header).
       
   735 // ---------------------------------------------------------------------------
       
   736 //
       
   737 void CMmPhoneTsy::CompleteNotifyIndicatorChange()
       
   738     {
       
   739 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyIndicatorChange");
       
   740 
       
   741     // first check if this notify is actually requested..
       
   742     if (NULL != iRetIndicatorState)
       
   743         {
       
   744 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyIndicatorChange -- notify is on");
       
   745         TUint32 newIndicatorState = GetIndicatorState();
       
   746         if (newIndicatorState != iIndicatorState)
       
   747             {
       
   748             iIndicatorState = newIndicatorState;
       
   749 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteNotifyIndicatorChange -- changed to 0x%x", iIndicatorState);
       
   750 
       
   751             //reset req handle. Returns the deleted req handle
       
   752             TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   753                                 EMultimodePhoneNotifyIndicatorChange );
       
   754 
       
   755             if( EMultimodePhoneReqHandleUnknown != reqHandle)
       
   756                 {
       
   757                 *iRetIndicatorState = iIndicatorState;
       
   758                 iRetIndicatorState = NULL;
       
   759                 // complete the client request
       
   760                 ReqCompleted( reqHandle, KErrNone );
       
   761                 }
       
   762             }
       
   763         }
       
   764     }
       
   765 
       
   766 // ---------------------------------------------------------------------------
       
   767 // CMmPhoneTsy::NotifyIndicatorChangeCancel
       
   768 // Cancels an outstanding NotifyIndicatorChange request.
       
   769 // (other items were commented in a header).
       
   770 // ---------------------------------------------------------------------------
       
   771 //
       
   772 TInt CMmPhoneTsy::NotifyIndicatorChangeCancel(
       
   773     const TTsyReqHandle aTsyReqHandle )
       
   774     {
       
   775 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyIndicatorChangeCancel");
       
   776 
       
   777     iRetIndicatorState = NULL;
       
   778     iTsyReqHandleStore->ResetTsyReqHandle( 
       
   779         EMultimodePhoneNotifyIndicatorChange );
       
   780 
       
   781     ReqCompleted( aTsyReqHandle, KErrCancel );
       
   782 
       
   783     return KErrNone;
       
   784     }
       
   785 
       
   786 // ---------------------------------------------------------------------------
       
   787 // CMmPhoneTsy::NosBootState
       
   788 // Returns current DOS boot state
       
   789 // (other items were commented in a header).
       
   790 // ---------------------------------------------------------------------------
       
   791 //
       
   792 CMmPhoneTsy::CNosBootState* CMmPhoneTsy::NosBootState()
       
   793     {
       
   794     return &iBootState;
       
   795     }
       
   796 
       
   797 // ---------------------------------------------------------------------------
       
   798 // CMmPhoneTsy::PhoneBookState
       
   799 // Returns current Phonebook state
       
   800 // (other items were commented in a header).
       
   801 // ---------------------------------------------------------------------------
       
   802 //
       
   803 CStorageInfoData* CMmPhoneTsy::PhoneBookState()
       
   804     {
       
   805     return iPhoneBookState;
       
   806     }
       
   807 
       
   808 // ---------------------------------------------------------------------------
       
   809 // CMmPhoneTsy::SetNosBootState
       
   810 // Returns current Phonebook state
       
   811 // (other items were commented in a header).
       
   812 // ---------------------------------------------------------------------------
       
   813 //
       
   814 void CMmPhoneTsy::SetNosBootState(
       
   815     CMmPhoneTsy::CNosBootState* aNewState )
       
   816     {
       
   817     iBootState.iSIMReady = aNewState->iSIMReady;
       
   818     iBootState.iADNReady = aNewState->iADNReady;
       
   819     iBootState.iSecReady = aNewState->iSecReady;
       
   820     iBootState.iCachingActive = aNewState->iCachingActive;
       
   821     }
       
   822 
       
   823 // ---------------------------------------------------------------------------
       
   824 // CMmPhoneTsy::OpenNewObjectByNameL
       
   825 // Creates new object and returns a pointer to it. The ETel
       
   826 // Server calls this method after some client has requested to open object
       
   827 // (e.g. line, sms, sat etc.) from ETel. TSY classes must not use this method.
       
   828 // (other items were commented in a header).
       
   829 // ---------------------------------------------------------------------------
       
   830 //
       
   831 CTelObject* CMmPhoneTsy::OpenNewObjectByNameL(
       
   832     const TDesC& aName )
       
   833     {
       
   834 //Warnings caused by configurational constants in if case. These are not
       
   835 //really errors but act as flags. This warning is purely informational as can
       
   836 //be seen from the explanation of Visual C++ help:
       
   837 //Compiler Warning (level 4) C4127
       
   838 //conditional expression is constant. The controlling expression of an
       
   839 //if statement or while loop evaluated to a constant. As a result, the
       
   840 //code in the body of the if statement or while loop either always
       
   841 //executes or never executes. This warning is informational.
       
   842 #pragma warning(disable : 4127)
       
   843 
       
   844     RMobilePhone::TMobileService mode( RMobilePhone::EServiceUnspecified );
       
   845     TInt addLineSucceeded( KErrNone );
       
   846     TInt addPBSucceeded( KErrNone );
       
   847     TInt trapError( 0 );
       
   848     CTelObject* mmObject = NULL;
       
   849     CMmLineTsy* mmLine = NULL;
       
   850 
       
   851     //Voice line
       
   852     if ( KVoice1LineSupported &&
       
   853             aName.CompareF( KMmTsyVoice1LineName ) == KErrNone )
       
   854         {
       
   855         mode = RMobilePhone::EVoiceService;
       
   856         TRAP( trapError, mmLine = CMmVoiceLineTsy::NewL( this, mode, aName, 
       
   857             iMessageManager, iTelephonyAudioControl ); );
       
   858         if( KErrNone == trapError)
       
   859             {
       
   860             addLineSucceeded = iLineList->AddLineObject( mmLine, 
       
   861                 mmLine->LineName() );
       
   862             mmObject = REINTERPRET_CAST( CTelObject*, mmLine );
       
   863 
       
   864             if ( 0 == addLineSucceeded )
       
   865                 {
       
   866                 if(!(iPhoneCaps.iFlags & RPhone::KCapsVoice))//complete capability change only if required
       
   867                     {
       
   868                     //set voice flag to capabilities, mask 'Unknown' caps bit away
       
   869                     iPhoneCaps.iFlags = RPhone::KCapsVoice + ( 
       
   870                             iPhoneCaps.iFlags & 0xFFFFFFFE );
       
   871                     CompleteNotifyCapsChange();
       
   872                     }
       
   873                 }
       
   874             }
       
   875         }
       
   876     //Data line
       
   877     else if ( KDataLineSupported &&
       
   878         aName.CompareF( KMmTsyDataLineName ) == KErrNone )
       
   879         {
       
   880         mode = RMobilePhone::ECircuitDataService;
       
   881         TRAP( trapError, mmLine = CMmDataLineTsy::NewL( this, mode, aName, 
       
   882             iMessageManager ); );
       
   883         if( KErrNone == trapError)
       
   884             {
       
   885             addLineSucceeded = iLineList->AddLineObject( mmLine, 
       
   886                 mmLine->LineName() );
       
   887             mmObject = REINTERPRET_CAST( CTelObject*, mmLine );
       
   888 
       
   889             if ( 0 == addLineSucceeded )
       
   890                 {
       
   891                 //set data flags to capabilities, mask 'Unknown' caps bit away
       
   892                 iPhoneCaps.iFlags = RPhone::KCapsData +
       
   893                             RPhone::KCapsEventModemDetection +
       
   894                             RPhone::KCapsStealCommPort + ( 
       
   895                                 iPhoneCaps.iFlags & 0xFFFFFFFE );
       
   896                 CompleteNotifyCapsChange();
       
   897                 }
       
   898            }
       
   899         }
       
   900     //Fax line
       
   901     else if ( KFaxLineSupported &&
       
   902         aName.CompareF( KMmTsyFaxLineName ) == KErrNone )
       
   903         {
       
   904         mode = RMobilePhone::EFaxService;
       
   905         TRAP( trapError, mmLine = CMmFaxLineTsy::NewL( this, mode, aName, 
       
   906             iMessageManager ); );
       
   907         if( KErrNone == trapError)
       
   908             {
       
   909             addLineSucceeded = iLineList->AddLineObject( mmLine, 
       
   910                 mmLine->LineName() );
       
   911             mmObject = REINTERPRET_CAST( CTelObject*, mmLine );
       
   912             }
       
   913         }
       
   914     //Voice line 2
       
   915     else if ( KVoice2LineSupported &&
       
   916         aName.CompareF( KMmTsyVoice2LineName ) == KErrNone )
       
   917         {
       
   918         mode = RMobilePhone::EAuxVoiceService;
       
   919         TRAP( trapError, mmLine = CMmVoiceLineTsy::NewL( this, mode, aName, 
       
   920             iMessageManager, iTelephonyAudioControl ); );
       
   921         if( KErrNone == trapError)
       
   922             {
       
   923             addLineSucceeded = iLineList->AddLineObject( mmLine, mmLine->
       
   924                 LineName() );
       
   925             mmObject = REINTERPRET_CAST( CTelObject*, mmLine );
       
   926 
       
   927             if ( 0 == addLineSucceeded )
       
   928                 {     
       
   929                 if(!(iPhoneCaps.iFlags & RPhone::KCapsVoice))//complete capability change only if required
       
   930                     {
       
   931                     //set voice flag to capabilities, mask 'Unknown' caps bit away
       
   932                     iPhoneCaps.iFlags = RPhone::KCapsVoice + ( 
       
   933                             iPhoneCaps.iFlags & 0xFFFFFFFE );
       
   934                     CompleteNotifyCapsChange();
       
   935                     }
       
   936                 }                               
       
   937             }
       
   938         }
       
   939     //Conference call
       
   940     else if ( KConferenceCallSupported &&
       
   941         aName.CompareF( KETelConferenceCall ) == KErrNone )
       
   942         {
       
   943         TRAP( trapError, iMmConferenceCall = 
       
   944             CMmConferenceCallTsy::NewL( this ); );
       
   945         if( KErrNone == trapError)
       
   946             {
       
   947             mmObject = REINTERPRET_CAST( CTelObject*, iMmConferenceCall );
       
   948             }
       
   949         }
       
   950     //SMS
       
   951     else if ( KSmsMessagingSupported &&
       
   952         aName.CompareF( KETelSmsMessaging ) == KErrNone )
       
   953         {
       
   954         TRAP( trapError, iMmSmsTsy = CMmSmsTsy::NewL( this ); );
       
   955         if( KErrNone == trapError)
       
   956             {
       
   957             mmObject = REINTERPRET_CAST( CTelObject*, iMmSmsTsy );
       
   958             }
       
   959         }
       
   960     //Broadcast messaging
       
   961     else if ( KBroadcastMessagingSupported &&
       
   962         aName.CompareF( KETelBroadcastMessaging ) == KErrNone )
       
   963         {
       
   964         TRAP( trapError, iMmBroadcastTsy = CMmBroadcastTsy::NewL(
       
   965             this ); );
       
   966         if( KErrNone == trapError)
       
   967             {
       
   968             mmObject = REINTERPRET_CAST( CTelObject*, iMmBroadcastTsy );
       
   969             }
       
   970         }
       
   971     //ON store
       
   972     else if ( KONStoreSupported &&
       
   973         aName.CompareF( KETelOwnNumberStore ) == KErrNone )
       
   974         {
       
   975         TRAP( trapError, iMmONStoreTsy = CMmONStoreTsy::NewL( this ); );
       
   976         if( KErrNone == trapError)
       
   977             {
       
   978             mmObject = REINTERPRET_CAST( CTelObject*, iMmONStoreTsy );
       
   979             }
       
   980         }
       
   981     //EN store
       
   982     else if ( KENStoreSupported &&
       
   983         aName.CompareF( KETelEmergencyNumberStore ) == KErrNone )
       
   984         {
       
   985         TRAP( trapError, iMmENStoreTsy = CMmENStoreTsy::NewL( this ); );
       
   986         if( KErrNone == trapError)
       
   987             {
       
   988             mmObject = REINTERPRET_CAST( CTelObject*, iMmENStoreTsy );
       
   989             }
       
   990         }
       
   991     //Phonebook
       
   992     else if ( KSimPhoneBookSupported &&
       
   993         aName.CompareF( KETelIccAdnPhoneBook ) == KErrNone ||
       
   994         aName.CompareF( KETelIccFdnPhoneBook ) == KErrNone ||
       
   995         aName.CompareF( KETelIccSdnPhoneBook ) == KErrNone ||
       
   996         aName.CompareF( KETelIccBdnPhoneBook ) == KErrNone ||
       
   997         aName.CompareF( KETelIccVoiceMailBox ) == KErrNone ||
       
   998         aName.CompareF( KETelIccMbdnPhoneBook ) == KErrNone )
       
   999         {
       
  1000         TBool isPhonebookAlreadyCreated = EFalse;
       
  1001         //Check that no already created object is tried to open multiple times
       
  1002         for( TInt i = 0; i < iPBList->GetNumberOfObjects(); i++ )
       
  1003             {
       
  1004             CMmPhoneBookStoreTsy* pbStore = iPBList->GetMmPBByIndex( i );
       
  1005 
       
  1006             if ( 0 == pbStore->PhoneBookName()->CompareF( aName ) )
       
  1007                 {
       
  1008                 isPhonebookAlreadyCreated = ETrue;
       
  1009                 mmObject = REINTERPRET_CAST( CTelObject*, pbStore );
       
  1010                 }
       
  1011             }
       
  1012 
       
  1013         // If not, a new instance can be safely created
       
  1014         if ( !isPhonebookAlreadyCreated )
       
  1015             {
       
  1016             TRAP( trapError, iMmPhoneBookStoreTsy = 
       
  1017                 CMmPhoneBookStoreTsy::NewL( this, aName ); );
       
  1018 
       
  1019             if( KErrNone == trapError)
       
  1020                 {
       
  1021                 addPBSucceeded = iPBList->AddObject( iMmPhoneBookStoreTsy );
       
  1022                 mmObject = REINTERPRET_CAST( 
       
  1023                     CTelObject*, iMmPhoneBookStoreTsy );
       
  1024                 }
       
  1025             }
       
  1026         }
       
  1027     //SAT
       
  1028     else if ( KSatToolkitSupported &&
       
  1029         !aName.CompareF( KSatToolkit ) )
       
  1030         {
       
  1031         iTsySatMessaging = iMmPhoneFactory->NewSimAtk( aName );
       
  1032         if( iTsySatMessaging )
       
  1033             {
       
  1034             //Only one application in the phone uses SAT
       
  1035             mmObject = REINTERPRET_CAST( CTelObject*, iTsySatMessaging );
       
  1036             }
       
  1037         }
       
  1038     //USSD
       
  1039     else if ( KUssdMessagingSupported &&
       
  1040         aName.CompareF( KETelUssdMessaging ) == KErrNone )
       
  1041         {
       
  1042         TRAP( trapError, iMmUssdTsy = CMmUssdTsy::NewL(
       
  1043             this ); );
       
  1044         if( KErrNone == trapError)
       
  1045             {
       
  1046             mmObject = REINTERPRET_CAST( CTelObject*, iMmUssdTsy  );
       
  1047             }
       
  1048         }
       
  1049     //Custom TSY
       
  1050     else if ( KCustomAPISupported &&
       
  1051         aName.CompareF( KCustomAPIName ) == KErrNone )
       
  1052         {
       
  1053         TRAP( trapError, iMmCustomTsy = CMmCustomTsy::NewL(
       
  1054             this ); );
       
  1055         if( KErrNone == trapError)
       
  1056             {
       
  1057             mmObject = REINTERPRET_CAST( CTelObject*, iMmCustomTsy  );
       
  1058             }
       
  1059         }
       
  1060 
       
  1061     //Packet Data Session
       
  1062     else if ( KGprsLineSupported && ( KErrNone ==
       
  1063         aName.CompareF( KPacketName ) ) )
       
  1064         {
       
  1065         TRAP( trapError, iMmPacketServiceTsy =
       
  1066             CMmPacketServiceTsy::NewL( this,
       
  1067 			REINTERPRET_CAST( CMmMessageManagerBase*, iMessageManager ),
       
  1068 			iLtsyFactory ) );
       
  1069         if( KErrNone == trapError )
       
  1070             {
       
  1071             mmObject = REINTERPRET_CAST( CTelObject*, iMmPacketServiceTsy );
       
  1072             }
       
  1073         }
       
  1074 
       
  1075 //Set warning level to normal
       
  1076 #pragma warning(default : 4127)
       
  1077 
       
  1078     if ( KErrNone != trapError || KErrNone != addLineSucceeded
       
  1079         || KErrNone != addPBSucceeded )
       
  1080         {
       
  1081 TFLOGSTRING2("TSY: CMmPhoneTsy::OpenNewObjectByNameL - Failed: %d",
       
  1082     trapError);
       
  1083 
       
  1084         if ( mmLine )
       
  1085             {
       
  1086             mmLine->Close();
       
  1087             mmLine = NULL;
       
  1088             }
       
  1089         if ( KErrNone == trapError )
       
  1090             {
       
  1091             User::Leave( KErrNoMemory );
       
  1092             }
       
  1093         else
       
  1094             {
       
  1095             User::Leave( trapError );
       
  1096             }
       
  1097         }
       
  1098     if ( NULL != mmObject )
       
  1099         {
       
  1100         //if object has been opened, return it.
       
  1101         return mmObject;
       
  1102         }
       
  1103 
       
  1104     //Otherwise we can leave...
       
  1105     User::Leave( KErrNotSupported );
       
  1106     return NULL;
       
  1107 
       
  1108     }
       
  1109 
       
  1110 // ---------------------------------------------------------------------------
       
  1111 // CMmPhoneTsy::OpenNewObjectL
       
  1112 // Creates new Line object and returns a pointer to it. All
       
  1113 // objects opened from the phone are opened by name, hence
       
  1114 // this method is not supported.
       
  1115 // (other items were commented in a header).
       
  1116 // ---------------------------------------------------------------------------
       
  1117 //
       
  1118 CTelObject* CMmPhoneTsy::OpenNewObjectL(
       
  1119         TDes& )
       
  1120     {
       
  1121     User::Leave( KErrNotSupported );
       
  1122     return NULL;
       
  1123     }
       
  1124 
       
  1125 // ---------------------------------------------------------------------------
       
  1126 // CMmPhoneTsy::ExtFunc
       
  1127 // TRAP's all CMmPhoneTsy related MM API requests in cases that
       
  1128 // they fail. This method functions only as a centralized TRAP for the
       
  1129 // DoExtFuncL method that does the actual mapping of IPC number to
       
  1130 // TSY method call.
       
  1131 // (other items were commented in a header).
       
  1132 // ---------------------------------------------------------------------------
       
  1133 //
       
  1134 TInt CMmPhoneTsy::ExtFunc(
       
  1135     const TTsyReqHandle aTsyReqHandle,
       
  1136     const TInt aIpc,
       
  1137     const TDataPackage& aPackage )
       
  1138     {
       
  1139 TFLOGSTRING3("TSY: CMmPhoneTsy::ExtFunc, IPC:%d, Handle:%d", aIpc, aTsyReqHandle);
       
  1140 
       
  1141     TInt ret = KErrNone;
       
  1142     TInt trapError = KErrNone;
       
  1143 
       
  1144     //reset last tsy request type
       
  1145     iReqHandleType = EMultimodePhoneReqHandleUnknown;
       
  1146 
       
  1147     //before processing further the request, check if offline mode status
       
  1148     //is enabled and if the given request can be perfomed in that case.
       
  1149     if ( ERfsStateInfoInactive == iStateInfo &&
       
  1150         !IsRequestPossibleInOffline( aIpc ) )
       
  1151         {
       
  1152 TFLOGSTRING2 ("TSY: Offline mode ON, request is not allowed: %d", aIpc );
       
  1153         ret = CMmCommonStaticUtility::EpocErrorCode( KErrGeneral,
       
  1154                 KErrGsmOfflineOpNotAllowed );
       
  1155 
       
  1156         //Complete the request with appropiate error
       
  1157         ReqCompleted ( aTsyReqHandle, ret );
       
  1158         }
       
  1159     else
       
  1160         {
       
  1161 
       
  1162         TRAP( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ); );
       
  1163 
       
  1164         if ( trapError != KErrNone )
       
  1165             {
       
  1166             ReqCompleted( aTsyReqHandle, trapError );
       
  1167             }
       
  1168         else if ( ret != KErrNone )
       
  1169             {
       
  1170             ReqCompleted( aTsyReqHandle, ret );
       
  1171             }
       
  1172 
       
  1173         if ( EMultimodePhoneReqHandleUnknown != iReqHandleType )
       
  1174             {
       
  1175 #ifdef REQHANDLE_TIMER
       
  1176             SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
       
  1177 #else
       
  1178             iTsyReqHandleStore->SetTsyReqHandle( 
       
  1179                 iReqHandleType, aTsyReqHandle );
       
  1180 #endif //REQHANDLE_TIMER
       
  1181             }
       
  1182 
       
  1183         //reset last tsy request type
       
  1184         iReqHandleType = EMultimodePhoneReqHandleUnknown;
       
  1185         }
       
  1186 
       
  1187     return KErrNone;
       
  1188 
       
  1189     }
       
  1190 
       
  1191 // ---------------------------------------------------------------------------
       
  1192 // CMmPhoneTsy::DoExtFuncL
       
  1193 // ExtFunc is called by the server when it has a "extended",
       
  1194 // i.e. non-core ETel request for the TSY. To process a request handle,
       
  1195 // request type and request data are passed to the TSY.
       
  1196 // (other items were commented in a header).
       
  1197 // ---------------------------------------------------------------------------
       
  1198 //
       
  1199 TInt CMmPhoneTsy::DoExtFuncL(
       
  1200     const TTsyReqHandle aTsyReqHandle,
       
  1201     const TInt aIpc,
       
  1202     const TDataPackage& aPackage )
       
  1203     {
       
  1204 TFLOGSTRING3("TSY: CMmPhoneTsy::DoExtFuncL - IPC:%d Handle:%d", aIpc, aTsyReqHandle);
       
  1205 
       
  1206     TInt ret = KErrNone;
       
  1207 
       
  1208     TAny* dataPtr = aPackage.Ptr1();
       
  1209     TAny* dataPtr2 = aPackage.Ptr2();
       
  1210 
       
  1211 
       
  1212     switch ( aIpc )
       
  1213         {
       
  1214       // Mobile Network
       
  1215         case EMobilePhoneGetNetworkCaps:
       
  1216         case EMobilePhoneGetNetworkRegistrationStatus:
       
  1217         case EMobilePhoneNotifyNetworkRegistrationStatusChange:
       
  1218         case EMobilePhoneGetCurrentMode:
       
  1219         case EMobilePhoneNotifyModeChange:
       
  1220         case EMobilePhoneGetCurrentNetwork:
       
  1221         case EMobilePhoneGetNetworkName:
       
  1222         case EMobilePhoneGetCurrentNetworkNoLocation:
       
  1223         case EMobilePhoneNotifyCurrentNetworkNoLocationChange:
       
  1224         case EMobilePhoneNotifyCurrentNetworkChange:
       
  1225         case EMobilePhoneGetHomeNetwork:
       
  1226         case EMobilePhoneGetDetectedNetworksV2Phase1:
       
  1227         case EMobilePhoneGetDetectedNetworksV2Phase2:
       
  1228         case EMobilePhoneGetNetworkSelectionSetting:
       
  1229         case EMobilePhoneSetNetworkSelectionSetting:
       
  1230         case EMobilePhoneNotifyNetworkSelectionSettingChange:
       
  1231         case EMobilePhoneSelectNetwork:
       
  1232         case EMobilePhoneGetNITZInfo:
       
  1233         case EMobilePhoneNotifyNITZInfoChange:
       
  1234         case EMobilePhoneGetSignalCaps:
       
  1235         case EMobilePhoneGetSignalStrength:
       
  1236         case EMobilePhoneNotifySignalStrengthChange:
       
  1237         case EMobilePhoneGetNetworkSecurityLevel:
       
  1238         case EMobilePhoneNotifyNetworkSecurityLevelChange:
       
  1239         case EMobilePhoneGetCipheringIndicatorStatus:
       
  1240         case EMobilePhoneAuthorizationInfoPhase1:
       
  1241         case EMobilePhoneAuthorizationInfoPhase2:
       
  1242         case EMobilePhoneGetCellInfo:
       
  1243         case EMobilePhoneNotifyCellInfoChange:
       
  1244         case EMobilePhoneGetCurrentActiveUSimApplication:                
       
  1245             //direct this request to the net specific DoExtFuncL
       
  1246             ret = iMmNetTsy->DoExtFuncL ( aTsyReqHandle, aIpc, aPackage );
       
  1247             break;
       
  1248         // Security and Phone Locks
       
  1249         case EMobilePhoneGetSecurityCaps:
       
  1250         case EMobilePhoneNotifySecurityCapsChange:
       
  1251         case EMobilePhoneGetLockInfo:
       
  1252         case EMobilePhoneNotifyLockInfoChange:
       
  1253         case EMobilePhoneSetLockSetting:
       
  1254         case EMobilePhoneChangeSecurityCode:
       
  1255         case EMobilePhoneNotifySecurityEvent:
       
  1256         case EMobilePhoneVerifySecurityCode:
       
  1257         case EMobilePhoneAbortSecurityCode:
       
  1258         case EMobilePhoneGetSecurityCodeInfo:
       
  1259         case EMobilePhoneNotifySecurityCodeInfoChange:
       
  1260             //direct this request to the security specific DoExtFuncL
       
  1261             ret = iMmSecurityTsy->DoExtFuncL ( aTsyReqHandle, aIpc, aPackage );
       
  1262             break;
       
  1263       // Service Provider name
       
  1264         case EMobilePhoneGetServiceProviderName:
       
  1265             ret = GetServiceProviderNameL( aTsyReqHandle,
       
  1266                 aPackage.Des1n() );
       
  1267             break;
       
  1268 
       
  1269       // Access to ICC (Integrated Circuit Card)
       
  1270         // Get ICC Access Capabilities
       
  1271         case EMobilePhoneGetIccAccessCaps:
       
  1272             ret = GetIccAccessCaps( aTsyReqHandle,
       
  1273                 REINTERPRET_CAST( TUint32*, dataPtr ) );
       
  1274             break;
       
  1275         // Notify Change of ICC Access Caps
       
  1276         case EMobilePhoneNotifyIccAccessCapsChange:
       
  1277             ret = NotifyIccAccessCapsChange(
       
  1278                 REINTERPRET_CAST( TUint32*, dataPtr ) );
       
  1279             break;
       
  1280 
       
  1281       // Customer service profile
       
  1282         // Get Customer Service Profile
       
  1283         case EMobilePhoneGetCustomerServiceProfile:
       
  1284             ret = GetCustomerServiceProfileL( aTsyReqHandle,
       
  1285                 aPackage.Des1n() );
       
  1286             break;
       
  1287 
       
  1288       // SIM/USIM/CDMA service table
       
  1289         // Get Service Table
       
  1290         case EMobilePhoneGetServiceTable:
       
  1291             ret = GetServiceTableCheckParametersL( aTsyReqHandle,
       
  1292                 REINTERPRET_CAST( RMobilePhone::TMobilePhoneServiceTable*,
       
  1293                 dataPtr ),
       
  1294                 aPackage.Des2n() );
       
  1295             break;
       
  1296 
       
  1297       // Power Status of Phone
       
  1298         // Get Battery Caps
       
  1299         case EMobilePhoneGetBatteryCaps:
       
  1300             ret = GetBatteryCaps( aTsyReqHandle,
       
  1301                 REINTERPRET_CAST( TUint32*, dataPtr ) );
       
  1302             break;
       
  1303         // Get Current Battery Information
       
  1304         case EMobilePhoneGetBatteryInfo:
       
  1305             ret = GetBatteryInfoL( aTsyReqHandle,
       
  1306                 REINTERPRET_CAST( RMobilePhone::TMobilePhoneBatteryInfoV1*,
       
  1307                 dataPtr ) );
       
  1308             break;
       
  1309         // Notify Change of Battery Information
       
  1310         case EMobilePhoneNotifyBatteryInfoChange:
       
  1311             ret = NotifyBatteryInfoChange(
       
  1312                 REINTERPRET_CAST( RMobilePhone::TMobilePhoneBatteryInfoV1*,
       
  1313                 dataPtr ) );
       
  1314             break;
       
  1315       //Identity of Phone and Subscriber
       
  1316         // Get Identity Caps
       
  1317         case EMobilePhoneGetIdentityCaps:
       
  1318             ret = GetIdentityCaps( aTsyReqHandle,
       
  1319                 REINTERPRET_CAST( TUint32*, dataPtr ) );
       
  1320             break;
       
  1321         // Get Phone Id
       
  1322         case EMobilePhoneGetPhoneId:
       
  1323             ret = GetPhoneIdL( aTsyReqHandle,
       
  1324                 REINTERPRET_CAST( RMobilePhone::TMobilePhoneIdentityV1*,
       
  1325                 dataPtr ) );
       
  1326             break;
       
  1327         // Get Subscriber Id
       
  1328         case EMobilePhoneGetSubscriberId:
       
  1329             ret = GetSubscriberIdL( aTsyReqHandle,
       
  1330                 REINTERPRET_CAST( RMobilePhone::TMobilePhoneSubscriberId*,
       
  1331                 dataPtr ) );
       
  1332             break;
       
  1333 		//Get the capabilities of the phone indicators
       
  1334 		case EMobilePhoneGetIndicatorCaps:
       
  1335 			ret = GetIndicatorCaps( aTsyReqHandle,
       
  1336 				REINTERPRET_CAST( TUint32*,
       
  1337 				dataPtr ),
       
  1338 				REINTERPRET_CAST( TUint32*,
       
  1339 				dataPtr2 )
       
  1340 				 );
       
  1341 			break;
       
  1342 		//Get Phone Indicators current state
       
  1343 		case EMobilePhoneGetIndicator:
       
  1344 			ret = GetIndicators( aTsyReqHandle,
       
  1345 				REINTERPRET_CAST( TUint32*,
       
  1346 				dataPtr ) );
       
  1347 			break;
       
  1348 		// All calls termination
       
  1349         case EMobilePhoneTerminateAllCalls:
       
  1350             ret = TerminateAllCallsL( aTsyReqHandle );
       
  1351             break;			
       
  1352       // DTMF
       
  1353 		// forward request to the DTMF-specific Tsy
       
  1354         case EMobilePhoneGetDTMFCaps:
       
  1355         case EMobilePhoneNotifyDTMFCapsChange:
       
  1356         case EMobilePhoneSendDTMFTones:
       
  1357         case EMobilePhoneStartDTMFTone:
       
  1358         case EMobilePhoneStopDTMFTone:
       
  1359         case EMobilePhoneNotifyStopInDTMFString:
       
  1360         case EMobilePhoneContinueDTMFStringSending:
       
  1361 		case EMobilePhoneNotifyDTMFEvent:
       
  1362 		case EMobilePhoneReadDTMFTones:
       
  1363 			ret = iMmDtmfTsy->DoExtFuncL( aTsyReqHandle, aIpc, aPackage );
       
  1364             break;
       
  1365 
       
  1366       // Alternate Line Service
       
  1367         // Get ALS Line
       
  1368         case EMobilePhoneGetALSLine:
       
  1369             ret = GetALSLineL( aTsyReqHandle,
       
  1370                 REINTERPRET_CAST( 
       
  1371                     RMobilePhone::TMobilePhoneALSLine*, dataPtr ) );
       
  1372             break;
       
  1373         // Set ALS Line
       
  1374         case EMobilePhoneSetALSLine:
       
  1375             ret = SetALSLineL( aTsyReqHandle,
       
  1376                 REINTERPRET_CAST( 
       
  1377                     RMobilePhone::TMobilePhoneALSLine*, dataPtr ) );
       
  1378             break;
       
  1379         // Notify Change of ALS Line Selection
       
  1380         case EMobilePhoneNotifyALSLineChange:
       
  1381             ret = NotifyALSLineChange(
       
  1382                 REINTERPRET_CAST( 
       
  1383                     RMobilePhone::TMobilePhoneALSLine*, dataPtr ) );
       
  1384             break;
       
  1385 
       
  1386       // Fixed Dialling Numbers
       
  1387         // Get Fixed Dialling Numbers Status
       
  1388         case EMobilePhoneGetFdnStatus:
       
  1389             ret = GetFdnStatusL( aTsyReqHandle,
       
  1390                 REINTERPRET_CAST( 
       
  1391                     RMobilePhone::TMobilePhoneFdnStatus*, dataPtr ) );
       
  1392             break;
       
  1393         // Set Fixed Dialling Numbers Setting
       
  1394         case EMobilePhoneSetFdnSetting:
       
  1395             ret = SetFdnSettingL( aTsyReqHandle, aPackage );
       
  1396             break;
       
  1397         // Notify Fixed Dialling Numbers Status Change
       
  1398         case EMobilePhoneNotifyFdnStatusChange:
       
  1399             ret = NotifyFdnStatusChange(
       
  1400                 REINTERPRET_CAST( 
       
  1401                     RMobilePhone::TMobilePhoneFdnStatus*, dataPtr ) );
       
  1402             break;
       
  1403         case EMobilePhoneGetMailboxNumbers:
       
  1404             ret = GetMailboxNumbersL( aPackage.Des1n() );
       
  1405         	break;
       
  1406         		
       
  1407     // Supplementary services:
       
  1408     // forward request to the Supplementary Services-specific Tsy
       
  1409         // Call Service Capabilities
       
  1410         case EMobilePhoneGetCallServiceCaps:
       
  1411         case EMobilePhoneNotifyCallServiceCapsChange:
       
  1412         // Call Forwarding
       
  1413         case EMobilePhoneGetCallForwardingStatusPhase1:
       
  1414         case EMobilePhoneGetCallForwardingStatusPhase2:
       
  1415         case EMobilePhoneSetCallForwardingStatus:
       
  1416         case EMobilePhoneNotifyCallForwardingStatusChange:
       
  1417         case EMobilePhoneNotifyCallForwardingActive:
       
  1418         // Call Barring
       
  1419         case EMobilePhoneGetBarringStatusPhase1:
       
  1420         case EMobilePhoneGetBarringStatusPhase2:
       
  1421         case EMobilePhoneSetCallBarringStatus:
       
  1422         case EMobilePhoneNotifyCallBarringStatusChange:
       
  1423         // Supplementary Services password change
       
  1424         case EMobilePhoneSetSSPassword:
       
  1425         // Call Waiting
       
  1426         case EMobilePhoneGetWaitingStatusPhase1:
       
  1427         case EMobilePhoneGetWaitingStatusPhase2:
       
  1428         case EMobilePhoneSetCallWaitingStatus:
       
  1429         case EMobilePhoneNotifyCallWaitingStatusChange:
       
  1430         // Identity Services
       
  1431         case EMobilePhoneGetIdentityServiceStatus:
       
  1432         // User's Access to Network Services
       
  1433         case EMobilePhoneSendNetworkServiceRequest:
       
  1434         case EMobilePhoneSendNetworkServiceRequestNoFdnCheck:
       
  1435         // Message waiting Indicators
       
  1436         case EMobilePhoneGetIccMessageWaitingIndicators:
       
  1437         case EMobilePhoneSetIccMessageWaitingIndicators:
       
  1438         case EMobilePhoneNotifyIccMessageWaitingIndicatorsChange:
       
  1439         // Notification for send networks service requests
       
  1440         case EMobilePhoneNotifySendNetworkServiceRequest:
       
  1441         case EMobilePhoneNotifyAllSendNetworkServiceRequest:
       
  1442             ret = iMmSupplServTsy->DoExtFuncL( 
       
  1443                 aTsyReqHandle, aIpc, aPackage );
       
  1444             break;
       
  1445         
       
  1446         // Mode Capabilities of TSY
       
  1447         // Get Multimode Capabilities
       
  1448         case EMobilePhoneGetMultimodeCaps:
       
  1449             ret = GetMultimodeCaps( aTsyReqHandle,
       
  1450                 REINTERPRET_CAST( TUint32*, dataPtr ) );
       
  1451             break;
       
  1452         // Get Phone Store Information and Capabilities
       
  1453         case EMobilePhoneGetPhoneStoreInfo:
       
  1454             switch( aPackage.Type() )
       
  1455                 {
       
  1456             	// Switch between alternative implementations of 
       
  1457             	// GetPhoneStoreInfo
       
  1458                 case TDataPackage::EPackage1n2u:
       
  1459                     ret = GetPhoneStoreInfoL( aPackage.Des1n(),
       
  1460                         REINTERPRET_CAST( 
       
  1461                         RMobilePhone::TMobileName* /*TName**/, 
       
  1462                         aPackage.Des2u() ) );
       
  1463                     break;
       
  1464                 case TDataPackage::EPackage1n2n:
       
  1465                     ret = KErrNotSupported;
       
  1466                     break;
       
  1467                 default:
       
  1468                     ret = KErrNotSupported;
       
  1469                     break;
       
  1470                 }
       
  1471             break;
       
  1472         case EMobilePhoneNotifyIndicatorChange:
       
  1473             ret = NotifyIndicatorChange(
       
  1474                 REINTERPRET_CAST( TUint32*, dataPtr ) );
       
  1475             break;
       
  1476         case EMobilePhoneIMSAuthenticate:
       
  1477 		    ret = ImsAuthenticationL( aPackage.Des1n() );
       
  1478         	break;
       
  1479 
       
  1480         // Access point control list
       
  1481         case EMobilePhoneEnumerateAPNEntries:
       
  1482             ret = EnumerateAPNEntriesL( aTsyReqHandle, REINTERPRET_CAST( 
       
  1483                 TUint32*, dataPtr ) );
       
  1484             break;
       
  1485         case EMobilePhoneGetAPNname:
       
  1486             ret = GetAPNnameL( aTsyReqHandle, REINTERPRET_CAST( 
       
  1487                 TUint32*, dataPtr ), aPackage.Des2n() );
       
  1488             break;
       
  1489         case EMobilePhoneAppendAPNName:
       
  1490         	ret = AppendAPNNameL( REINTERPRET_CAST(     
       
  1491                 RMobilePhone::TAPNEntryV3*, aPackage.Ptr1() ) );
       
  1492         	break;
       
  1493         case EMobilePhoneDeleteAPNName:
       
  1494             ret = DeleteAPNNameL( aTsyReqHandle, REINTERPRET_CAST(     
       
  1495                 TUint32*,  aPackage.Ptr1() ) );
       
  1496             break;
       
  1497         case EMobilePhoneSetAPNControlListServiceStatus:
       
  1498             ret = SetAPNControlListServiceStatusL( aTsyReqHandle, 
       
  1499                 REINTERPRET_CAST( RMobilePhone::TAPNControlListServiceStatus*, 
       
  1500                 aPackage.Ptr1() ) );
       
  1501             break;
       
  1502         case EMobilePhoneGetAPNControlListServiceStatus:
       
  1503             ret = GetAPNControlListServiceStatusL( aTsyReqHandle, 
       
  1504                 REINTERPRET_CAST( RMobilePhone::TAPNControlListServiceStatus*, 
       
  1505                 aPackage.Ptr1() ) );
       
  1506             break;
       
  1507         case EMobilePhoneNotifyAPNListChanged:
       
  1508             ret = NotifyAPNListChanged();
       
  1509             break;
       
  1510         case EMobilePhoneNotifyAPNControlListServiceStatusChange:
       
  1511             ret = NotifyAPNControlListServiceStatusChange( REINTERPRET_CAST( 
       
  1512                 RMobilePhone::TAPNControlListServiceStatus*, 
       
  1513                 aPackage.Ptr1() ) );
       
  1514             break;
       
  1515     //NOT SUPPORTED FEATURES
       
  1516         case EMobilePhoneGetAlternatingCallCaps:
       
  1517         case EMobilePhoneNotifyAlternatingCallCapsChange:
       
  1518         case EMobilePhoneGetAlternatingCallMode:
       
  1519         case EMobilePhoneSetAlternatingCallMode:
       
  1520         case EMobilePhoneNotifyAlternatingCallModeChange:
       
  1521         case EMobilePhoneGetIncomingCallType:
       
  1522         case EMobilePhoneSetIncomingCallType:
       
  1523         case EMobilePhoneNotifyIncomingCallTypeChange:
       
  1524         case EMobilePhoneGetMulticallParams:
       
  1525         case EMobilePhoneSetMulticallParams:
       
  1526         case EMobilePhoneNotifyMulticallParamsChange:
       
  1527         case EMobilePhoneGetUUSSetting:
       
  1528         case EMobilePhoneSetUUSSetting:
       
  1529         case EMobilePhoneNotifyUUSSettingChange:
       
  1530         case EMobilePhoneSetDefaultPrivacy:
       
  1531         case EMobilePhoneGetDefaultPrivacy:
       
  1532         case EMobilePhoneNotifyDefaultPrivacyChange:
       
  1533         case EMobilePhoneGetCCBSStatus:
       
  1534         case EMobilePhoneNotifyCCBSStatusChange:
       
  1535         case EMobilePhoneNotifyMessageWaiting:
       
  1536         case EMobilePhoneDeactivateCCBS:
       
  1537         case EMobilePhoneNotifyCCBSRecall:
       
  1538         case EMobilePhoneAcceptCCBSRecall:
       
  1539         case EMobilePhoneRefuseCCBSRecall:
       
  1540         default:
       
  1541             ret = KErrNotSupported;
       
  1542             break;
       
  1543         }
       
  1544 
       
  1545     return ret;
       
  1546     }
       
  1547 
       
  1548 // ---------------------------------------------------------------------------
       
  1549 // CMmPhoneTsy::ReqModeL
       
  1550 // Returns request mode for given IPC. If the IPC number
       
  1551 // belongs to some of the core functions, CPhoneBase's ReqModeL function
       
  1552 // is called.
       
  1553 // (other items were commented in a header).
       
  1554 // ---------------------------------------------------------------------------
       
  1555 //
       
  1556 CTelObject::TReqMode CMmPhoneTsy::ReqModeL(
       
  1557     const TInt aIpc )
       
  1558     {
       
  1559     CTelObject::TReqMode ret = 0;
       
  1560 
       
  1561     switch ( aIpc )
       
  1562         {
       
  1563         // All disabled
       
  1564         // TSYs wishing to implement their own buffering algorithm will place
       
  1565         // all requests in this category.
       
  1566         // This category will also be used by the RecoverDataPort request that
       
  1567         // must be passed to the TSY to indicate that it may use the
       
  1568         // communications port after a loan.
       
  1569 
       
  1570         //Get methods that do not use DOS and return immediately. Flow control
       
  1571         //not required.
       
  1572         case EEtelPhoneGetInfo:
       
  1573         case EEtelPhoneGetCaps:
       
  1574         case EEtelPhoneGetStatus:
       
  1575         case EEtelPhoneGetLineInfo:
       
  1576         case EMobilePhoneGetDTMFCaps:
       
  1577         case EMobilePhoneGetNetworkCaps:
       
  1578         case EMobilePhoneGetNetworkRegistrationStatus:
       
  1579         case EMobilePhoneGetCurrentMode:
       
  1580         case EMobilePhoneGetCurrentNetwork:
       
  1581         case EMobilePhoneGetNetworkName:
       
  1582         case EMobilePhoneGetCurrentNetworkNoLocation:
       
  1583         case EMobilePhoneGetHomeNetwork:
       
  1584         case EMobilePhoneGetNetworkSelectionSetting:
       
  1585         case EMobilePhoneGetNITZInfo:
       
  1586         case EMobilePhoneGetMultimodeCaps:
       
  1587         case EMobilePhoneGetBatteryCaps:
       
  1588         case EMobilePhoneGetBatteryInfo:
       
  1589         case EMobilePhoneGetSignalCaps:
       
  1590         case EMobilePhoneGetSignalStrength:
       
  1591         case EMobilePhoneGetIdentityCaps:
       
  1592         case EMobilePhoneGetPhoneId:
       
  1593         case EMobilePhoneGetSubscriberId:
       
  1594         case EMobilePhoneGetAlternatingCallCaps:
       
  1595         case EMobilePhoneGetAlternatingCallMode:
       
  1596         case EMobilePhoneGetSecurityCaps:
       
  1597         case EMobilePhoneGetIccAccessCaps:
       
  1598         case EMobilePhoneGetDefaultPrivacy:
       
  1599         case EMobilePhoneGetCallServiceCaps:
       
  1600         case EMobilePhoneGetMulticallParams:
       
  1601         case EMobilePhoneGetIncomingCallType:
       
  1602         case EMobilePhoneGetUUSSetting:
       
  1603         case EMobilePhoneGetNetworkSecurityLevel:
       
  1604         case EMobilePhoneGetCellInfo:
       
  1605         case EMobilePhoneGetCurrentActiveUSimApplication:                        	
       
  1606         //Other methods that do not use DOS and return immediately. 
       
  1607         //Flow control not required.
       
  1608         case EEtelPhoneInitialise:
       
  1609         case EEtelPhoneEnumerateLines:
       
  1610         case EMobilePhoneGetDetectedNetworksV2Phase2:
       
  1611         case EMobilePhoneGetCallForwardingStatusPhase2:
       
  1612         case EMobilePhoneGetBarringStatusPhase2:
       
  1613         case EMobilePhoneGetWaitingStatusPhase2:
       
  1614         case EMobilePhoneGetCompletionRequestsPhase2:
       
  1615         case EMobilePhoneContinueDTMFStringSending:
       
  1616 
       
  1617         //Methods that can propably take a long time and cannot therefore be 
       
  1618         //flow controlled. Solution: All these methods must check req handle 
       
  1619         //tablebefore handling the request. In case that the request table 
       
  1620         //indicates that same method has been called and has not been 
       
  1621         //completed, the method should return KErrServerBusy.
       
  1622         case EMobilePhoneTerminateAllCalls:
       
  1623         case EMobilePhoneGetFdnStatus:
       
  1624         case EMobilePhoneGetCustomerServiceProfile:
       
  1625         case EMobilePhoneGetDetectedNetworksV2Phase1:
       
  1626         case EMobilePhoneSetLockSetting:
       
  1627         case EMobilePhoneVerifySecurityCode:
       
  1628         case EMobilePhoneAbortSecurityCode:
       
  1629         case EMobilePhoneStartDTMFTone:
       
  1630         case EMobilePhoneStopDTMFTone:
       
  1631         case EMobilePhoneGetServiceProviderName:
       
  1632         case EMobilePhoneGetServiceTable:
       
  1633         case EMobilePhoneSetALSLine:
       
  1634         case EMobilePhoneGetALSLine:
       
  1635         case EMobilePhoneSendDTMFTones:
       
  1636         case EMobilePhoneAuthorizationInfoPhase1:
       
  1637         case EMobilePhoneAuthorizationInfoPhase2:
       
  1638         case EMobilePhoneEnumerateAPNEntries:
       
  1639         case EMobilePhoneGetAPNname:
       
  1640         case EMobilePhoneGetAPNControlListServiceStatus:
       
  1641         case EMobilePhoneSetAPNControlListServiceStatus:
       
  1642         case EMobilePhoneDeleteAPNName:
       
  1643         case EMobilePhoneAppendAPNName:
       
  1644         case EMobilePhoneGetSecurityCodeInfo:
       
  1645 
       
  1646         //SS related methods.
       
  1647         case EMobilePhoneGetCallForwardingStatusPhase1:
       
  1648         case EMobilePhoneGetBarringStatusPhase1:
       
  1649         case EMobilePhoneGetWaitingStatusPhase1:
       
  1650         case EMobilePhoneSetCallBarringStatus:
       
  1651         case EMobilePhoneSetCallWaitingStatus:
       
  1652         case EMobilePhoneSetCallForwardingStatus:
       
  1653         case EMobilePhoneSetSSPassword:
       
  1654         case EMobilePhoneGetIdentityServiceStatus:
       
  1655         case EMobilePhoneSendNetworkServiceRequest:
       
  1656         case EMobilePhoneSendNetworkServiceRequestNoFdnCheck:
       
  1657         case EMobilePhoneGetMailboxNumbers:
       
  1658         case EMobilePhoneGetIccMessageWaitingIndicators:
       
  1659         case EMobilePhoneSetIccMessageWaitingIndicators:
       
  1660         case EMobilePhoneNotifyDTMFEvent:
       
  1661             ret = 0;
       
  1662             break;
       
  1663 
       
  1664         // KReqModeFlowControlObeyed
       
  1665         // Commands that change the state of the phone, e.g. clearing the AoC
       
  1666         // counter, are commands that the TSY should only deal with one at
       
  1667         // a time.
       
  1668 
       
  1669         //Voice call related methods. Handle one at a time.
       
  1670 
       
  1671 
       
  1672         //NET related methods. Handle one at a time.
       
  1673         case EMobilePhoneSelectNetwork:
       
  1674         case EMobilePhoneSetNetworkSelectionSetting:
       
  1675 
       
  1676         //SS related methods. Handle one at a time.
       
  1677         case EMobilePhoneGetCompletionRequestsPhase1:
       
  1678         case EMobilePhoneSetAlternatingCallMode:
       
  1679         case EMobilePhoneSetFdnSetting:
       
  1680         case EMobilePhoneSetDefaultPrivacy:
       
  1681 
       
  1682         //Security related methods. Handle one at a time.
       
  1683         case EMobilePhoneChangeSecurityCode:
       
  1684         case EMobilePhoneGetLockInfo:
       
  1685 
       
  1686         //Other cases
       
  1687         case EMobilePhoneSetMulticallParams:
       
  1688         case EMobilePhoneSetUUSSetting:
       
  1689 
       
  1690         case EMobilePhoneGetIndicatorCaps:
       
  1691         case EMobilePhoneGetIndicator:
       
  1692         case EMobilePhoneGetPhoneStoreInfo:
       
  1693         case EMobilePhoneGetCipheringIndicatorStatus:
       
  1694         case EMobilePhoneIMSAuthenticate:	
       
  1695             ret=KReqModeFlowControlObeyed;
       
  1696             break;
       
  1697 
       
  1698         //Do not use this! Request handle table has only one place for
       
  1699         //each request handle
       
  1700         //ReqModePostImmediately
       
  1701         //Requests that notify a client about a change of state, where the 
       
  1702         //TSY needs to distinguish between different clients.
       
  1703             //ret=KReqModeRePostImmediately;
       
  1704 
       
  1705 
       
  1706         //KReqModeMultipleCompletionEnabled
       
  1707         //(a) commands that may take some time, but which the TSY can handle
       
  1708         //more than one of concurrently, or
       
  1709         //(b) notifications that the TSY does not wish to be re-posted
       
  1710         //immediately, so the server does no buffering.
       
  1711             //ret=KReqModeMultipleCompletionEnabled;
       
  1712 
       
  1713 
       
  1714         //KReqModeMultipleCompletionEnabled | KReqModeFlowControlObeyed
       
  1715         //A command that may take some time and which the TSY can only deal
       
  1716         //with one at a time.
       
  1717         //NOTE!!! (TAN) 2.11.2000. All GetXXX methods that do lead to message
       
  1718         //sending to DOS can be moved under "all disabled" case(the first one)
       
  1719         //The methods will also function correctly if they are here but it is
       
  1720         //possible that this reqMode requires more from the ETel Server.
       
  1721         //ret=KReqModeMultipleCompletionEnabled | KReqModeFlowControlObeyed;
       
  1722         //break;
       
  1723 
       
  1724         //KReqModeMultipleCompletionEnabled | ReqModePostImmediately
       
  1725         //Requests that notify a client about a change of state.
       
  1726         //Since these requests do not require the issuing of any modem
       
  1727         //commands, they do not have to obey flow control.
       
  1728         //The TSY never gets more than one of these outstanding per CTelObject
       
  1729         case EEtelPhoneNotifyModemDetected:
       
  1730         case EETelPhoneCapsChangeNotification:
       
  1731         case EMobilePhoneNotifyDTMFCapsChange:
       
  1732         case EMobilePhoneNotifyStopInDTMFString:
       
  1733         case EMobilePhoneNotifyNetworkRegistrationStatusChange:
       
  1734         case EMobilePhoneNotifyModeChange:
       
  1735         case EMobilePhoneNotifyCurrentNetworkChange:
       
  1736         case EMobilePhoneNotifyCurrentNetworkNoLocationChange:
       
  1737         case EMobilePhoneNotifyNetworkSelectionSettingChange:
       
  1738         case EMobilePhoneNotifyBatteryInfoChange:
       
  1739         case EMobilePhoneNotifySignalStrengthChange:
       
  1740         case EMobilePhoneNotifyCallForwardingStatusChange:
       
  1741         case EMobilePhoneNotifyCallBarringStatusChange:
       
  1742         case EMobilePhoneNotifyCallWaitingStatusChange:
       
  1743         case EMobilePhoneNotifyAlternatingCallCapsChange:
       
  1744         case EMobilePhoneNotifyAlternatingCallModeChange:
       
  1745         case EMobilePhoneNotifyALSLineChange:
       
  1746         case EMobilePhoneNotifySecurityCapsChange:
       
  1747         case EMobilePhoneNotifyLockInfoChange:
       
  1748         case EMobilePhoneNotifySecurityEvent:
       
  1749         case EMobilePhoneNotifyMessageWaiting:
       
  1750         case EMobilePhoneNotifyFdnStatusChange:
       
  1751         case EMobilePhoneNotifyIccAccessCapsChange:
       
  1752         case EMobilePhoneNotifyNITZInfoChange:
       
  1753         case EMobilePhoneNotifyDefaultPrivacyChange:
       
  1754         case EMobilePhoneNotifyCallServiceCapsChange:
       
  1755         case EMobilePhoneNotifyCallForwardingActive:
       
  1756         case EMobilePhoneNotifyMulticallParamsChange:
       
  1757         case EMobilePhoneNotifyIncomingCallTypeChange:
       
  1758         case EMobilePhoneNotifyUUSSettingChange:
       
  1759         case EMobilePhoneNotifyIccMessageWaitingIndicatorsChange:
       
  1760         case EMobilePhoneNotifyIndicatorChange:
       
  1761         case EMobilePhoneNotifyNetworkSecurityLevelChange:
       
  1762         case EMobilePhoneNotifySecurityCodeInfoChange:
       
  1763         case EMobilePhoneNotifyAPNListChanged:
       
  1764         case EMobilePhoneNotifyAPNControlListServiceStatusChange:
       
  1765         case EMobilePhoneNotifySendNetworkServiceRequest:
       
  1766         case EMobilePhoneNotifyAllSendNetworkServiceRequest: 
       
  1767         case EMobilePhoneNotifyCellInfoChange:
       
  1768             ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
       
  1769             break;
       
  1770         // Cancel Requests
       
  1771         //It is not necessary to include the Cancel methods in ReqModeL at all
       
  1772         //The ETel server never calls ReqModeL with a Cancel IPC.
       
  1773 
       
  1774         //Other variations of return values are unusable
       
  1775 
       
  1776         // Default: Call CPhoneBase's ReqModeL.
       
  1777         default:
       
  1778             ret=CPhoneBase::ReqModeL(aIpc);
       
  1779             break;
       
  1780 
       
  1781         }
       
  1782 	TFLOGSTRING3("TSY: CMmPhoneTsy::ReqModeL - IPC:%d, Mode:%d", aIpc, ret);
       
  1783 
       
  1784     return ret;
       
  1785     }
       
  1786 
       
  1787 // ---------------------------------------------------------------------------
       
  1788 // CMmPhoneTsy::NumberOfSlotsL
       
  1789 // Returns number of slots to be used for given IPC
       
  1790 // (other items were commented in a header).
       
  1791 // ---------------------------------------------------------------------------
       
  1792 //
       
  1793 TInt CMmPhoneTsy::NumberOfSlotsL(
       
  1794     const TInt aIpc )
       
  1795     {
       
  1796     // All Phone related notifications must be added here!
       
  1797     TInt numberOfSlots = 1;
       
  1798 
       
  1799     switch ( aIpc )
       
  1800         {
       
  1801         case EEtelPhoneNotifyModemDetected:
       
  1802             numberOfSlots = KMmPhoneModemDetectedSlots;
       
  1803             break;
       
  1804         case EETelPhoneCapsChangeNotification:
       
  1805             numberOfSlots = KMmPhoneCapsChangeNotificationSlots;
       
  1806             break;
       
  1807         case EMobilePhoneNotifyDTMFCapsChange:
       
  1808             numberOfSlots = KMmPhoneDTMFCapsChangeSlots;
       
  1809             break;
       
  1810         case EMobilePhoneNotifyStopInDTMFString:
       
  1811             numberOfSlots = KMmPhoneStopInDTMFStringSlots;
       
  1812             break;
       
  1813         case EMobilePhoneNotifyNetworkRegistrationStatusChange:
       
  1814             numberOfSlots = KMmPhoneNetworkRegistrationStatusChangeSlots;
       
  1815             break;
       
  1816         case EMobilePhoneNotifyModeChange:
       
  1817             numberOfSlots = KMmPhoneModeChangeSlots;
       
  1818             break;
       
  1819         case EMobilePhoneNotifyCurrentNetworkChange:
       
  1820             numberOfSlots = KMmPhoneCurrentNetworkChangeSlots;
       
  1821             break;
       
  1822         case EMobilePhoneNotifyCurrentNetworkNoLocationChange:
       
  1823             numberOfSlots = KMmPhoneCurrentNetworkChangeSlots;
       
  1824             break;
       
  1825         case EMobilePhoneNotifyNetworkSelectionSettingChange:
       
  1826             numberOfSlots = KMmPhoneNetworkSelectionSettingChangeSlots;
       
  1827             break;
       
  1828         case EMobilePhoneNotifyBatteryInfoChange:
       
  1829             numberOfSlots = KMmPhoneBatteryInfoChangeSlots;
       
  1830             break;
       
  1831         case EMobilePhoneNotifySignalStrengthChange:
       
  1832             numberOfSlots = KMmPhoneSignalStrengthChangeSlots;
       
  1833             break;
       
  1834         case EMobilePhoneNotifyCallForwardingStatusChange:
       
  1835             numberOfSlots = KMmPhoneCallForwardingStatusChangeSlots;
       
  1836             break;
       
  1837         case EMobilePhoneNotifyCallBarringStatusChange:
       
  1838             numberOfSlots = KMmPhoneCallBarringStatusChangeSlots;
       
  1839             break;
       
  1840         case EMobilePhoneNotifyCallWaitingStatusChange:
       
  1841             numberOfSlots = KMmPhoneCallWaitingStatusChangeSlots;
       
  1842             break;
       
  1843         case EMobilePhoneNotifyAlternatingCallCapsChange:
       
  1844             numberOfSlots = KMmPhoneAlternatingCallCapsChangeSlots;
       
  1845             break;
       
  1846         case EMobilePhoneNotifyAlternatingCallModeChange:
       
  1847             numberOfSlots = KMmPhoneAlternatingCallModeChangeSlots;
       
  1848             break;
       
  1849         case EMobilePhoneNotifyALSLineChange:
       
  1850             numberOfSlots = KMmPhoneALSLineChangeSlots;
       
  1851             break;
       
  1852         case EMobilePhoneNotifySecurityCapsChange:
       
  1853             numberOfSlots = KMmPhoneSecurityCapsChangeSlots;
       
  1854             break;
       
  1855         case EMobilePhoneNotifyLockInfoChange:
       
  1856             numberOfSlots = KMmPhoneLockInfoChangeSlots;
       
  1857             break;
       
  1858         case EMobilePhoneNotifySecurityEvent:
       
  1859             numberOfSlots = KMmPhoneSecurityEventSlots;
       
  1860             break;
       
  1861         case EMobilePhoneNotifyMessageWaiting:
       
  1862             numberOfSlots = KMmPhoneMessageWaitingSlots;
       
  1863             break;
       
  1864         case EMobilePhoneNotifyFdnStatusChange:
       
  1865             numberOfSlots = KMmPhoneFdnStatusChangeSlots;
       
  1866             break;
       
  1867         case EMobilePhoneNotifyIccAccessCapsChange:
       
  1868             numberOfSlots = KMmPhoneIccAccessCapsChangeSlots;
       
  1869             break;
       
  1870         case EMobilePhoneNotifyNITZInfoChange:
       
  1871             numberOfSlots = KMmPhoneNITZInfoChangeSlots;
       
  1872             break;
       
  1873         case EMobilePhoneNotifyDefaultPrivacyChange:
       
  1874             numberOfSlots = KMmPhoneDefaultPrivacyChangeSlots;
       
  1875             break;
       
  1876         case EMobilePhoneNotifyCallServiceCapsChange:
       
  1877             numberOfSlots = KMmPhoneCallServiceCapsChangeSlots;
       
  1878             break;
       
  1879         case EMobilePhoneNotifyCallForwardingActive:
       
  1880             numberOfSlots = KMmPhoneCallForwardingActiveSlots;
       
  1881             break;
       
  1882         case EMobilePhoneNotifyMulticallParamsChange:
       
  1883             numberOfSlots = KMmPhoneMulticallParamsChangeSlots;
       
  1884             break;
       
  1885         case EMobilePhoneNotifyIncomingCallTypeChange:
       
  1886             numberOfSlots = KMmPhoneIncomingCallTypeChangeSlots;
       
  1887             break;
       
  1888         case EMobilePhoneNotifyUUSSettingChange:
       
  1889             numberOfSlots = KMmPhoneUUSSettingChangeSlots;
       
  1890             break;
       
  1891         case EMobilePhoneNotifyIccMessageWaitingIndicatorsChange:
       
  1892             numberOfSlots = KMmPhoneIccMessageWaitingIndicatorsChangeSlots;
       
  1893             break;
       
  1894         case EMobilePhoneNotifySendNetworkServiceRequest:
       
  1895         	numberOfSlots = KMmPhoneNotifySendNetworkServiceRequestSlots;
       
  1896         	break;            
       
  1897         case EMobilePhoneNotifyAllSendNetworkServiceRequest:
       
  1898             numberOfSlots = KMmPhoneNotifyAllSendNetworkServiceRequestSlots;
       
  1899             break;
       
  1900         case EMobilePhoneNotifyIndicatorChange:
       
  1901             numberOfSlots = KMmPhoneIndicatorChangeSlots;
       
  1902             break;
       
  1903         case EMobilePhoneNotifyNetworkSecurityLevelChange:
       
  1904             numberOfSlots = KMmPhoneNetworkSecurityLevelChangeSlots;
       
  1905             break;
       
  1906         case EMobilePhoneNotifySecurityCodeInfoChange: 
       
  1907             numberOfSlots = KMmPhoneSecurityCodeInfoChangeSlots;
       
  1908             break;
       
  1909         case EMobilePhoneNotifyAPNListChanged: 
       
  1910             numberOfSlots = KMmPhoneAPNListChangedSlots;
       
  1911             break;
       
  1912         case EMobilePhoneNotifyAPNControlListServiceStatusChange: 
       
  1913             numberOfSlots = KMmPhoneAPNControlListServiceStatusChangeSlots;
       
  1914             break;
       
  1915         case EMobilePhoneNotifyCellInfoChange:
       
  1916         	numberOfSlots = KMmPhoneCellInfoChangeSlots;
       
  1917         	break;
       
  1918         default:
       
  1919             // Unknown or invalid Phone IPC
       
  1920             User::Leave( KErrNotSupported );
       
  1921             break;
       
  1922         }
       
  1923 
       
  1924     return numberOfSlots;
       
  1925     }
       
  1926 
       
  1927 // ---------------------------------------------------------------------------
       
  1928 // CMmPhoneTsy::CancelService
       
  1929 // Cancels specified service
       
  1930 // (other items were commented in a header).
       
  1931 // ---------------------------------------------------------------------------
       
  1932 //
       
  1933 TInt CMmPhoneTsy::CancelService(
       
  1934     const TInt aIpc,
       
  1935     const TTsyReqHandle aTsyReqHandle )
       
  1936     {
       
  1937 TFLOGSTRING3("TSY: CMmPhoneTsy::CancelService - IPC:%d, Handle:%d", aIpc, aTsyReqHandle);
       
  1938 
       
  1939     TInt ret ( KErrNotSupported );
       
  1940 
       
  1941     // When the clients close their sub-sessions (eg. by calling RLine::Close)
       
  1942     // they may not have cancelled all their outstanding asynchronous requests
       
  1943     // before closing.  It is up to the ETel server to clean up in this
       
  1944     // situation, so the server will find the list of outstanding requests
       
  1945     // related to that sub-session object and pass these outstanding IPC
       
  1946     // request numbers, one at a time, to the CancelService method in the TSY.
       
  1947 
       
  1948     switch ( aIpc )
       
  1949         {        	
       
  1950 		// forward DTMF cancellations
       
  1951         case EMobilePhoneSendDTMFTones:
       
  1952         case EMobilePhoneNotifyDTMFCapsChange:
       
  1953         case EMobilePhoneNotifyStopInDTMFString:
       
  1954         case EMobilePhoneNotifyDTMFEvent:
       
  1955             ret =  iMmDtmfTsy->CancelService( aIpc, aTsyReqHandle );
       
  1956             break;
       
  1957         // forward NET cancellations
       
  1958         case EMobilePhoneGetCipheringIndicatorStatus:
       
  1959         case EMobilePhoneNotifySignalStrengthChange:
       
  1960         case EMobilePhoneNotifyNetworkRegistrationStatusChange:
       
  1961         case EMobilePhoneNotifyModeChange:
       
  1962         case EMobilePhoneNotifyCurrentNetworkChange:
       
  1963         case EMobilePhoneNotifyCurrentNetworkNoLocationChange:
       
  1964         case EMobilePhoneNotifyNetworkSelectionSettingChange:
       
  1965         case EMobilePhoneGetNetworkRegistrationStatus:
       
  1966         case EMobilePhoneNotifyNITZInfoChange:
       
  1967         case EMobilePhoneGetDetectedNetworksV2Phase1:
       
  1968         case EMobilePhoneGetDetectedNetworksV2Phase2:
       
  1969         case EMobilePhoneSelectNetwork:
       
  1970         case EMobilePhoneAuthorizationInfoPhase1:
       
  1971         case EMobilePhoneAuthorizationInfoPhase2:
       
  1972         case EMobilePhoneNotifyNetworkSecurityLevelChange:
       
  1973         case EMobilePhoneGetCellInfo:
       
  1974         case EMobilePhoneNotifyCellInfoChange:
       
  1975         case EMobilePhoneGetCurrentActiveUSimApplication:        
       
  1976         	ret = iMmNetTsy->CancelService( aIpc, aTsyReqHandle );
       
  1977             break;
       
  1978 		// forward SS cancellations
       
  1979         case EMobilePhoneNotifyCallForwardingStatusChange:
       
  1980         case EMobilePhoneNotifyCallForwardingActive:
       
  1981         case EMobilePhoneGetCallForwardingStatusPhase1:
       
  1982         case EMobilePhoneGetCallForwardingStatusPhase2:
       
  1983         case EMobilePhoneSetCallForwardingStatus:
       
  1984         case EMobilePhoneNotifyCallBarringStatusChange:
       
  1985         case EMobilePhoneGetBarringStatusPhase1:
       
  1986         case EMobilePhoneGetBarringStatusPhase2:
       
  1987         case EMobilePhoneSetCallBarringStatus:
       
  1988         case EMobilePhoneSetSSPassword:
       
  1989         case EMobilePhoneNotifyCallWaitingStatusChange:
       
  1990         case EMobilePhoneGetWaitingStatusPhase1:
       
  1991         case EMobilePhoneGetWaitingStatusPhase2:
       
  1992         case EMobilePhoneSetCallWaitingStatus:
       
  1993         case EMobilePhoneGetIdentityServiceStatus:
       
  1994         case EMobilePhoneNotifyCallServiceCapsChange:
       
  1995         case EMobilePhoneSendNetworkServiceRequest:
       
  1996         case EMobilePhoneSendNetworkServiceRequestNoFdnCheck:
       
  1997         case EMobilePhoneGetIccMessageWaitingIndicators:        
       
  1998         case EMobilePhoneSetIccMessageWaitingIndicators:        
       
  1999         case EMobilePhoneNotifyIccMessageWaitingIndicatorsChange:  
       
  2000         case EMobilePhoneNotifySendNetworkServiceRequest:         
       
  2001         case EMobilePhoneNotifyAllSendNetworkServiceRequest:
       
  2002             ret =  iMmSupplServTsy->CancelService( aIpc, aTsyReqHandle );
       
  2003             break;
       
  2004         //forward SECURITY cancellations
       
  2005         case EMobilePhoneNotifySecurityCapsChange:
       
  2006         case EMobilePhoneGetLockInfo:
       
  2007         case EMobilePhoneSetLockSetting:
       
  2008         case EMobilePhoneNotifyLockInfoChange:
       
  2009         case EMobilePhoneNotifySecurityEvent:
       
  2010         case EMobilePhoneGetSecurityCodeInfo:
       
  2011         case EMobilePhoneNotifySecurityCodeInfoChange:
       
  2012            ret = iMmSecurityTsy->CancelService ( aIpc, aTsyReqHandle );
       
  2013             break;
       
  2014 
       
  2015         //TSY has started a request and it is not possible to then
       
  2016         //cancel this request. The best thing for the TSY to do in this case 
       
  2017         //is to proceed as though the Cancel never happened. The server's call 
       
  2018         //to the TSY cancel function will return synchronously. The TSY then 
       
  2019         //continues to wait for the original acknowledgement and when it 
       
  2020         //receives it, the TSY will complete the original request.
       
  2021         case EMobilePhoneChangeSecurityCode:
       
  2022         case EMobilePhoneVerifySecurityCode:
       
  2023         case EMobilePhoneSetALSLine:
       
  2024         case EMobilePhoneSetFdnSetting:
       
  2025         case EMobilePhoneNotifyDefaultPrivacyChange:
       
  2026         case EMobilePhoneSetDefaultPrivacy:
       
  2027         case EMobilePhoneTerminateAllCalls:
       
  2028         case EMobilePhoneSetNetworkSelectionSetting:        
       
  2029             ret = KErrNone;
       
  2030             break;
       
  2031 
       
  2032         //Cancel methods that are not supported.
       
  2033         case EMobilePhoneGetBatteryInfo:
       
  2034         case EMobilePhoneGetSignalStrength:
       
  2035         case EMobilePhoneGetCurrentNetwork:
       
  2036         case EMobilePhoneGetNetworkName:
       
  2037         case EMobilePhoneGetCurrentNetworkNoLocation:
       
  2038         case EMobilePhoneGetHomeNetwork:
       
  2039         case EMobilePhoneSetAlternatingCallMode:
       
  2040         case EMobilePhoneNotifyAlternatingCallCapsChange:
       
  2041         case EMobilePhoneNotifyAlternatingCallModeChange:
       
  2042         //WCDMA features, hence not supported.
       
  2043         case EMobilePhoneGetUUSSetting:
       
  2044         case EMobilePhoneSetUUSSetting:
       
  2045         case EMobilePhoneGetIncomingCallType:
       
  2046         case EMobilePhoneSetIncomingCallType:
       
  2047         case EMobilePhoneNotifyIncomingCallTypeChange:
       
  2048         case EMobilePhoneGetMulticallParams:
       
  2049         case EMobilePhoneSetMulticallParams:
       
  2050         case EMobilePhoneNotifyMulticallParamsChange:
       
  2051         case EMobilePhoneNotifyUUSSettingChange:
       
  2052         //Unsupported CDMA features
       
  2053         case EMobilePhoneNotifyMessageWaiting:
       
  2054             break;
       
  2055 
       
  2056         //Notification Cancels, no special requirements...
       
  2057 
       
  2058         case EMobilePhoneGetPhoneId:
       
  2059             ret = MobilePhoneGetPhoneIdCancel( aTsyReqHandle );
       
  2060             break;
       
  2061 
       
  2062         case EMobilePhoneNotifyIndicatorChange:
       
  2063             ret = NotifyIndicatorChangeCancel( aTsyReqHandle );
       
  2064             break;
       
  2065 
       
  2066         case EMobilePhoneNotifyIccAccessCapsChange:
       
  2067             ret = NotifyIccAccessCapsChangeCancel( aTsyReqHandle );
       
  2068             break;
       
  2069         case EMobilePhoneNotifyBatteryInfoChange:
       
  2070             ret = NotifyBatteryInfoChangeCancel( aTsyReqHandle );
       
  2071             break;
       
  2072         case EMobilePhoneNotifyALSLineChange:
       
  2073             ret = NotifyALSLineChangeCancel( aTsyReqHandle );
       
  2074             break;
       
  2075         case EMobilePhoneNotifyFdnStatusChange:
       
  2076             ret = NotifyFdnStatusChangeCancel( aTsyReqHandle );
       
  2077             break;
       
  2078         case EMobilePhoneGetMailboxNumbers:
       
  2079         	ret = GetMailboxNumbersCancel();
       
  2080         	break; 
       
  2081         //Everything is taken care in the method implementation.
       
  2082         //Just direct the request to the method.
       
  2083         case EMobilePhoneGetPhoneStoreInfo:
       
  2084             ret = GetPhoneStoreInfoCancel( aTsyReqHandle );
       
  2085             break;
       
  2086         case EMobilePhoneGetALSLine:
       
  2087             ret = GetAlsLineCancel( aTsyReqHandle );
       
  2088             break;
       
  2089         case EMobilePhoneGetSubscriberId:
       
  2090             ret = GetSubscriberIdCancel( aTsyReqHandle );
       
  2091             break;
       
  2092         case EMobilePhoneIMSAuthenticate:
       
  2093             ret = ImsAuthenticationCancel();
       
  2094             break;
       
  2095         case EMobilePhoneEnumerateAPNEntries:
       
  2096             ret = EnumerateAPNEntriesCancel();
       
  2097             break;
       
  2098         case EMobilePhoneGetAPNname:
       
  2099             ret = GetAPNnameCancel();
       
  2100             break;
       
  2101         case EMobilePhoneAppendAPNName:
       
  2102             ret = AppendAPNNameCancel();
       
  2103             break;
       
  2104         case EMobilePhoneDeleteAPNName:
       
  2105             ret = DeleteAPNNameCancel();
       
  2106             break;
       
  2107         case EMobilePhoneSetAPNControlListServiceStatus:
       
  2108             ret = SetAPNControlListServiceStatusCancel();
       
  2109             break;
       
  2110         case EMobilePhoneGetAPNControlListServiceStatus:
       
  2111             ret = GetAPNControlListServiceStatusCancel();
       
  2112             break;
       
  2113         case EMobilePhoneNotifyAPNListChanged:
       
  2114             ret = NotifyAPNListChangedCancel();
       
  2115             break;
       
  2116         case EMobilePhoneNotifyAPNControlListServiceStatusChange:
       
  2117             ret = NotifyAPNControlListServiceStatusChangeCancel();
       
  2118             break;
       
  2119         case EMobilePhoneGetCustomerServiceProfile:
       
  2120             ret = GetCustomerServiceProfileCancel( aTsyReqHandle );
       
  2121             break;
       
  2122         case EMobilePhoneGetServiceProviderName:
       
  2123             ret = GetServiceProviderNameCancel( aTsyReqHandle );
       
  2124             break;
       
  2125         case EMobilePhoneGetFdnStatus:
       
  2126             ret = GetFdnStatusCancel( aTsyReqHandle );
       
  2127             break;
       
  2128 
       
  2129         //When WINS flag is defined cancelling EMobilePhoneGetServiceTable
       
  2130         //request is made possible because the request is handled much slower
       
  2131         //Otherwise KErrNone is returned.
       
  2132 #ifdef __WINS__
       
  2133         case EMobilePhoneGetServiceTable:
       
  2134         	ret = GetServiceTableCancel( aTsyReqHandle );
       
  2135         	break;
       
  2136 #else
       
  2137         case EMobilePhoneGetServiceTable:
       
  2138         	ret = KErrNone;
       
  2139         	break;
       
  2140 #endif //__WINS__
       
  2141 
       
  2142         //Default case
       
  2143         default:
       
  2144             ret = CPhoneBase::CancelService( aIpc, aTsyReqHandle );
       
  2145             break;
       
  2146         }
       
  2147 
       
  2148     return ret;
       
  2149     }
       
  2150 
       
  2151 // ---------------------------------------------------------------------------
       
  2152 // CMmPhoneTsy::GetInfo
       
  2153 // This CORE API method this function returns core phone
       
  2154 // information in the given parameter
       
  2155 // (other items were commented in a header).
       
  2156 // ---------------------------------------------------------------------------
       
  2157 //
       
  2158 TInt CMmPhoneTsy::GetInfo(
       
  2159     const TTsyReqHandle aTsyReqHandle,
       
  2160     RPhone::TPhoneInfo* aPhoneInfo )
       
  2161     {
       
  2162     aPhoneInfo->iDetection = iPhoneStatus.iModemDetected;
       
  2163     ReqCompleted( aTsyReqHandle, KErrNone );
       
  2164     
       
  2165     return KErrNone;
       
  2166     }
       
  2167 
       
  2168 // ---------------------------------------------------------------------------
       
  2169 // CMmPhoneTsy::NotifyCapsChange
       
  2170 // This CORE API method is used to request caps change
       
  2171 // notifications from the TSY. The request handle and the pointer are stored
       
  2172 // to wait for caps change event.
       
  2173 // (other items were commented in a header).
       
  2174 // ---------------------------------------------------------------------------
       
  2175 //
       
  2176 TInt CMmPhoneTsy::NotifyCapsChange(
       
  2177     const TTsyReqHandle aTsyReqHandle,
       
  2178     RPhone::TCaps* aCaps )
       
  2179     {
       
  2180     // Save request handle and ptr to aCaps. 
       
  2181     iRetCaps = aCaps;
       
  2182     iTsyReqHandleStore->SetTsyReqHandle( 
       
  2183         EMultimodePhoneCapsChangeNotification, aTsyReqHandle );
       
  2184 
       
  2185     return KErrNone;
       
  2186     }
       
  2187 
       
  2188 // ---------------------------------------------------------------------------
       
  2189 // CMmPhoneTsy::NotifyCapsChangeCancel
       
  2190 // This CORE API method cancels caps change notifications
       
  2191 // (other items were commented in a header).
       
  2192 // ---------------------------------------------------------------------------
       
  2193 //
       
  2194 TInt CMmPhoneTsy::NotifyCapsChangeCancel(
       
  2195     const TTsyReqHandle aTsyReqHandle )
       
  2196     {
       
  2197     iRetCaps = NULL;
       
  2198 
       
  2199     // Reset request handle and pointer
       
  2200     iTsyReqHandleStore->ResetTsyReqHandle( 
       
  2201         EMultimodePhoneCapsChangeNotification );
       
  2202     // Complete the request and return KErrNone
       
  2203     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  2204     
       
  2205     return KErrNone;
       
  2206     }
       
  2207 
       
  2208 // ---------------------------------------------------------------------------
       
  2209 // CMmPhoneTsy::CompleteNotifyCapsChange
       
  2210 // Completes caps change notification. The new capabilities
       
  2211 // are written to the stored pointer and the client is notified
       
  2212 // (other items were commented in a header).
       
  2213 // ---------------------------------------------------------------------------
       
  2214 //
       
  2215 void CMmPhoneTsy::CompleteNotifyCapsChange()
       
  2216     {
       
  2217     //reset req handle. Returns the deleted req handle
       
  2218     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  2219         EMultimodePhoneCapsChangeNotification );
       
  2220 
       
  2221     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  2222         {
       
  2223         // Fill the pointer with phone capabilities
       
  2224         iRetCaps->iFlags = iPhoneCaps.iFlags;
       
  2225         // Complete the client request
       
  2226         ReqCompleted( reqHandle, KErrNone );
       
  2227         }
       
  2228     }
       
  2229 
       
  2230 // ---------------------------------------------------------------------------
       
  2231 // CMmPhoneTsy::ControlledInitialisation
       
  2232 // This CORE API method defines TSY special start. Not supported
       
  2233 // by MMTSY. Set to return KErrNone only because SMS stack is expecting it
       
  2234 // (other items were commented in a header).
       
  2235 // ---------------------------------------------------------------------------
       
  2236 //
       
  2237 TInt CMmPhoneTsy::ControlledInitialisation(
       
  2238     const TTsyReqHandle aTsyReqHandle )
       
  2239     {
       
  2240     // Complete the request with KErrNone    
       
  2241     ReqCompleted( aTsyReqHandle, KErrNone );
       
  2242     
       
  2243     return KErrNone;
       
  2244     }
       
  2245 
       
  2246 // ---------------------------------------------------------------------------
       
  2247 // CMmPhoneTsy::ControlledInitialisationCancel
       
  2248 // Cancels controlled initialisation. Not supported by CommonTSY
       
  2249 // (other items were commented in a header).
       
  2250 // ---------------------------------------------------------------------------
       
  2251 //
       
  2252 TInt CMmPhoneTsy::ControlledInitialisationCancel(
       
  2253     const TTsyReqHandle aTsyReqHandle )
       
  2254     {
       
  2255     ReqCompleted( aTsyReqHandle, KErrNotSupported );
       
  2256     
       
  2257     return KErrNone;
       
  2258     }
       
  2259 
       
  2260 // ---------------------------------------------------------------------------
       
  2261 // CMmPhoneTsy::NotifyModemDetected
       
  2262 // This CORE API method requests notification when modem has been
       
  2263 // detected.
       
  2264 // (other items were commented in a header).
       
  2265 // ---------------------------------------------------------------------------
       
  2266 //
       
  2267 TInt CMmPhoneTsy::NotifyModemDetected(
       
  2268     const TTsyReqHandle aTsyReqHandle,
       
  2269     RPhone::TModemDetection* aModemDetection )
       
  2270     {
       
  2271     iRetModemDetection = aModemDetection;
       
  2272     iTsyReqHandleStore->SetTsyReqHandle( EMultimodePhoneNotifyModemDetected, 
       
  2273         aTsyReqHandle );
       
  2274     
       
  2275     return KErrNone;
       
  2276     }
       
  2277 
       
  2278 // ---------------------------------------------------------------------------
       
  2279 // CMmPhoneTsy::NotifyModemDetectedCancel
       
  2280 // This CORE API method cancels modem detected notifications.
       
  2281 // (other items were commented in a header).
       
  2282 // ---------------------------------------------------------------------------
       
  2283 //
       
  2284 TInt CMmPhoneTsy::NotifyModemDetectedCancel(
       
  2285     const TTsyReqHandle aTsyReqHandle )
       
  2286     {
       
  2287     iRetModemDetection = NULL;
       
  2288     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePhoneNotifyModemDetected );
       
  2289     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  2290     
       
  2291     return KErrNone;
       
  2292     }
       
  2293 
       
  2294 // ---------------------------------------------------------------------------
       
  2295 // CMmPhoneTsy::CompleteNotifyModemDetected
       
  2296 // Complete the client request when modem has been detected
       
  2297 // (other items were commented in a header).
       
  2298 // ---------------------------------------------------------------------------
       
  2299 //
       
  2300 void CMmPhoneTsy::CompleteNotifyModemDetected(
       
  2301     RPhone::TStatus aModemStatus )
       
  2302     {
       
  2303     iPhoneStatus = aModemStatus;
       
  2304 
       
  2305     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  2306         EMultimodePhoneNotifyModemDetected );
       
  2307 
       
  2308     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  2309         {
       
  2310         *iRetModemDetection = iPhoneStatus.iModemDetected;
       
  2311         iRetModemDetection = NULL;
       
  2312         ReqCompleted( reqHandle, KErrNone );
       
  2313         }
       
  2314     }
       
  2315 
       
  2316 // ---------------------------------------------------------------------------
       
  2317 // CMmPhoneTsy::GetCaps
       
  2318 // This CORE API method returns the phone capabilities in the
       
  2319 // aCaps parameter
       
  2320 // (other items were commented in a header).
       
  2321 // ---------------------------------------------------------------------------
       
  2322 //
       
  2323 TInt CMmPhoneTsy::GetCaps(
       
  2324     const TTsyReqHandle aTsyReqHandle,
       
  2325     RPhone::TCaps* aCaps )
       
  2326     {
       
  2327     aCaps->iFlags = KPhoneCoreCaps;
       
  2328 
       
  2329     // Complete the request
       
  2330     ReqCompleted( aTsyReqHandle, KErrNone );
       
  2331     
       
  2332     return KErrNone;
       
  2333     }
       
  2334 
       
  2335 // ---------------------------------------------------------------------------
       
  2336 // CMmPhoneTsy::GetStatus
       
  2337 // This CORE API method returns the phone status in the aStatus
       
  2338 // parameter
       
  2339 // (other items were commented in a header).
       
  2340 // ---------------------------------------------------------------------------
       
  2341 //
       
  2342 TInt CMmPhoneTsy::GetStatus(
       
  2343     const TTsyReqHandle aTsyReqHandle,
       
  2344     RPhone::TStatus* aStatus )
       
  2345     {
       
  2346     // Fill status structure.
       
  2347     aStatus->iMode = iPhoneStatus.iMode;
       
  2348     aStatus->iModemDetected = iPhoneStatus.iModemDetected;
       
  2349 
       
  2350     // Complete the request
       
  2351     ReqCompleted( aTsyReqHandle, KErrNone );
       
  2352     
       
  2353     return KErrNone;
       
  2354     }
       
  2355 
       
  2356 // ---------------------------------------------------------------------------
       
  2357 // CMmPhoneTsy::EnumerateLines
       
  2358 // This CORE API method enumerates the max. number of lines
       
  2359 // that the TSY supports
       
  2360 // (other items were commented in a header).
       
  2361 // ---------------------------------------------------------------------------
       
  2362 //
       
  2363 TInt CMmPhoneTsy::EnumerateLines(
       
  2364     const TTsyReqHandle aTsyReqHandle,
       
  2365     TInt* aCount )
       
  2366     {
       
  2367     // Write maximum number of lines to server pointer
       
  2368     *aCount = KMmTsyNumOfSupportedLines;
       
  2369 
       
  2370     // Complete the request
       
  2371     ReqCompleted( aTsyReqHandle, KErrNone );
       
  2372     
       
  2373     return KErrNone;
       
  2374     }
       
  2375 
       
  2376 // ---------------------------------------------------------------------------
       
  2377 // CMmPhoneTsy::GetLineInfo
       
  2378 // This CORE API method returns line information in the given
       
  2379 // parameter
       
  2380 // (other items were commented in a header).
       
  2381 // ---------------------------------------------------------------------------
       
  2382 //
       
  2383 TInt CMmPhoneTsy::GetLineInfo(
       
  2384     const TTsyReqHandle aTsyReqHandle,
       
  2385     TLineInfoIndex* aLineInfoIndex )
       
  2386     {
       
  2387     //set return value to KErrNotFound
       
  2388     TInt ret ( KErrNotFound );
       
  2389 
       
  2390     //check that line is supported
       
  2391     if ( ( aLineInfoIndex->iIndex >= 0 ) &&
       
  2392          ( aLineInfoIndex->iIndex < KMmTsyNumOfSupportedLines ) )
       
  2393         {
       
  2394         //set return value to KErrNone
       
  2395         ret = KErrNone;
       
  2396 
       
  2397         // Look line by given index
       
  2398         CMmLineTsy* mmLine = REINTERPRET_CAST( CMmLineTsy*,
       
  2399             iLineList->GetObjectByIndex( aLineInfoIndex->iIndex ) );
       
  2400 
       
  2401         // Check if line was found and fill aInfo
       
  2402         if( mmLine )
       
  2403             {
       
  2404             aLineInfoIndex->iInfo = mmLine->LineInfo();
       
  2405             }
       
  2406         else
       
  2407         //no line found
       
  2408             {
       
  2409             switch ( aLineInfoIndex->iIndex )
       
  2410                 {
       
  2411                 case CMmLineList::ELine0Voice1:
       
  2412                     aLineInfoIndex->iInfo.iName = KMmTsyVoice1LineName;
       
  2413                     aLineInfoIndex->iInfo.iLineCapsFlags = 0x00010004;
       
  2414                     break;
       
  2415                 case CMmLineList::ELine1Voice2:
       
  2416                     aLineInfoIndex->iInfo.iName = KMmTsyVoice2LineName;
       
  2417                     aLineInfoIndex->iInfo.iLineCapsFlags = 0x00010008;
       
  2418                     break;
       
  2419                 case CMmLineList::ELine2Data:
       
  2420                     aLineInfoIndex->iInfo.iName = KMmTsyDataLineName;
       
  2421                     aLineInfoIndex->iInfo.iLineCapsFlags = 0x10001;
       
  2422                     break;
       
  2423                 case CMmLineList::ELine3Fax:
       
  2424                     aLineInfoIndex->iInfo.iName = KMmTsyFaxLineName;
       
  2425                     aLineInfoIndex->iInfo.iLineCapsFlags = 0x10002;
       
  2426                     break;
       
  2427                 default :
       
  2428                     break;
       
  2429                 }
       
  2430 
       
  2431             //Status is set to "Unknown"
       
  2432             aLineInfoIndex->iInfo.iStatus = RCall::EStatusUnknown;
       
  2433             }
       
  2434         }
       
  2435 
       
  2436     ReqCompleted( aTsyReqHandle, ret );
       
  2437     
       
  2438     return KErrNone;
       
  2439     }
       
  2440 
       
  2441 // ---------------------------------------------------------------------------
       
  2442 // CMmPhoneTsy::TerminateAllCallsL
       
  2443 // Terminates all calls simultaneously.
       
  2444 // ---------------------------------------------------------------------------
       
  2445 //
       
  2446 TInt CMmPhoneTsy::TerminateAllCallsL(const TTsyReqHandle aTsyReqHandle)
       
  2447 	{
       
  2448 TFLOGSTRING("TSY: CMmPhoneTsy::TerminateAllCalls");
       
  2449 
       
  2450 	// Check if some other client has already requested this
       
  2451 	TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(EMultimodePhoneTerminateAllCalls);
       
  2452 	
       
  2453 	if (EMultimodePhoneReqHandleUnknown >= reqHandle )
       
  2454 		{ 
       
  2455 		// The request is not already in processing because of a previous request
       
  2456 		
       
  2457         CMmCallTsy* activeCall 		= iCallList->GetMmCallByStatus(RMobileCall::EStatusConnected);
       
  2458         CMmCallTsy* heldCall 		= iCallList->GetMmCallByStatus(RMobileCall::EStatusHold);
       
  2459         CMmCallTsy* connectingCall 	= iCallList->GetMmCallByStatus(RMobileCall::EStatusDialling);
       
  2460         if ( connectingCall == NULL )
       
  2461             {
       
  2462             connectingCall 			= iCallList->GetMmCallByStatus(RMobileCall::EStatusConnecting);
       
  2463             }
       
  2464 
       
  2465         if ( activeCall || heldCall || connectingCall )
       
  2466             {
       
  2467             TInt callId(0);
       
  2468             if (connectingCall != NULL)
       
  2469             	{
       
  2470             	callId = connectingCall->CallId();
       
  2471             	}
       
  2472             CMmDataPackage dataPackage;
       
  2473             dataPackage.PackData(&callId);
       
  2474             TInt err = iMessageManager->HandleRequestL(ECtsyPhoneTerminateAllCallsReq, &dataPackage);
       
  2475             
       
  2476             if ( err == KErrNone )
       
  2477                 {
       
  2478 #ifdef REQHANDLE_TIMER
       
  2479                 SetTypeOfResponse( EMultimodePhoneTerminateAllCalls, aTsyReqHandle );
       
  2480 #else
       
  2481                 iTsyReqHandleStore->SetTsyReqHandle( 
       
  2482                 		iReqHandleType, aTsyReqHandle );
       
  2483 #endif //REQHANDLE_TIMER
       
  2484                 }
       
  2485             else
       
  2486             	{
       
  2487                 // request failed, complete with error value
       
  2488                 ReqCompleted( aTsyReqHandle, err );
       
  2489                 }
       
  2490             }
       
  2491         else
       
  2492             {
       
  2493             ReqCompleted( aTsyReqHandle, KErrNone );
       
  2494             }   
       
  2495 		}
       
  2496 	else
       
  2497 		{
       
  2498 TFLOGSTRING("TSY: CMmPhoneTsy::TerminateAllCalls - Already requested");
       
  2499 		ReqCompleted( aTsyReqHandle, KErrServerBusy );
       
  2500 		}
       
  2501 	return KErrNone;
       
  2502 	}
       
  2503 
       
  2504 void CMmPhoneTsy::CompleteTerminateAllCallsReq(TInt aErrorCode)
       
  2505 	{
       
  2506 	// Reset req handle. Returns the deleted req handle
       
  2507 	 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  2508 	     EMultimodePhoneTerminateAllCalls );
       
  2509 	
       
  2510 	 if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  2511 	     {
       
  2512          ReqCompleted( reqHandle, aErrorCode );
       
  2513 	     }	 
       
  2514 	}
       
  2515 
       
  2516 // ---------------------------------------------------------------------------
       
  2517 // CMmPhoneTsy::RegisterNotification
       
  2518 // This function is used by ETel Server to subscribe
       
  2519 // notifications from DOS. Currently does not really do anything but returns
       
  2520 // KErrNone to ETel server in case of known notification request type
       
  2521 // (other items were commented in a header).
       
  2522 // ---------------------------------------------------------------------------
       
  2523 //
       
  2524 TInt CMmPhoneTsy::RegisterNotification (
       
  2525     const TInt aIpc )
       
  2526     {
       
  2527     TInt ret = KErrNone;
       
  2528 
       
  2529     switch (aIpc)
       
  2530         {
       
  2531         case EEtelPhoneNotifyModemDetected:
       
  2532         case EETelPhoneCapsChangeNotification:
       
  2533         case EMobilePhoneNotifyDTMFCapsChange:
       
  2534         case EMobilePhoneNotifyStopInDTMFString:
       
  2535         case EMobilePhoneNotifyDTMFEvent:
       
  2536         case EMobilePhoneNotifyNetworkRegistrationStatusChange:
       
  2537         case EMobilePhoneNotifyModeChange:
       
  2538         case EMobilePhoneNotifyCurrentNetworkChange:
       
  2539         case EMobilePhoneNotifyCurrentNetworkNoLocationChange:
       
  2540         case EMobilePhoneNotifyNetworkSelectionSettingChange:
       
  2541         case EMobilePhoneNotifyBatteryInfoChange:
       
  2542         case EMobilePhoneNotifySignalStrengthChange:
       
  2543         case EMobilePhoneNotifyCallForwardingStatusChange:
       
  2544         case EMobilePhoneNotifyCallBarringStatusChange:
       
  2545         case EMobilePhoneNotifyCallWaitingStatusChange:
       
  2546         case EMobilePhoneNotifyAlternatingCallCapsChange:
       
  2547         case EMobilePhoneNotifyAlternatingCallModeChange:
       
  2548         case EMobilePhoneNotifyALSLineChange:
       
  2549         case EMobilePhoneNotifySecurityCapsChange:
       
  2550         case EMobilePhoneNotifyLockInfoChange:
       
  2551         case EMobilePhoneNotifySecurityEvent:
       
  2552         case EMobilePhoneNotifyMessageWaiting:
       
  2553         case EMobilePhoneNotifyFdnStatusChange:
       
  2554         case EMobilePhoneNotifyIccAccessCapsChange:
       
  2555         case EMobilePhoneNotifyNITZInfoChange:
       
  2556         case EMobilePhoneNotifyDefaultPrivacyChange:
       
  2557         case EMobilePhoneNotifyCallServiceCapsChange:
       
  2558         case EMobilePhoneNotifyCallForwardingActive:
       
  2559         case EMobilePhoneNotifyMulticallParamsChange:
       
  2560         case EMobilePhoneNotifyIncomingCallTypeChange:
       
  2561         case EMobilePhoneNotifyUUSSettingChange:
       
  2562         case EMobilePhoneNotifyIccMessageWaitingIndicatorsChange:
       
  2563         case EMobilePhoneNotifyIndicatorChange:
       
  2564         case EMobilePhoneNotifyNetworkSecurityLevelChange:
       
  2565         case EMobilePhoneNotifySecurityCodeInfoChange:
       
  2566         case EMobilePhoneNotifyAPNListChanged:
       
  2567         case EMobilePhoneNotifyAPNControlListServiceStatusChange:
       
  2568         case EMobilePhoneNotifySendNetworkServiceRequest:
       
  2569         case EMobilePhoneNotifyAllSendNetworkServiceRequest:
       
  2570         case EMobilePhoneNotifyCellInfoChange:
       
  2571             ret = KErrNone;
       
  2572             break;
       
  2573         default:
       
  2574             // Not supported
       
  2575             ret = KErrNotSupported;
       
  2576         }
       
  2577 
       
  2578     return ret;
       
  2579     }
       
  2580 
       
  2581 // ---------------------------------------------------------------------------
       
  2582 // CMmPhoneTsy::DeregisterNotification
       
  2583 // This function is used to unsubscribe given notification
       
  2584 // from DOS. Currently does not really do anything but returns
       
  2585 // KErrNone to ETel server in case of known notification request type
       
  2586 // (other items were commented in a header).
       
  2587 // ---------------------------------------------------------------------------
       
  2588 //
       
  2589 TInt CMmPhoneTsy::DeregisterNotification(
       
  2590     const TInt aIpc )
       
  2591     {
       
  2592     TInt ret = KErrNone;
       
  2593 
       
  2594     switch (aIpc)
       
  2595         {
       
  2596         case EEtelPhoneNotifyModemDetected:
       
  2597         case EETelPhoneCapsChangeNotification:
       
  2598         case EMobilePhoneNotifyDTMFCapsChange:
       
  2599         case EMobilePhoneNotifyStopInDTMFString:
       
  2600         case EMobilePhoneNotifyDTMFEvent:		
       
  2601         case EMobilePhoneNotifyNetworkRegistrationStatusChange:
       
  2602         case EMobilePhoneNotifyModeChange:
       
  2603         case EMobilePhoneNotifyCurrentNetworkChange:
       
  2604         case EMobilePhoneNotifyCurrentNetworkNoLocationChange:
       
  2605         case EMobilePhoneNotifyNetworkSelectionSettingChange:
       
  2606         case EMobilePhoneNotifyBatteryInfoChange:
       
  2607         case EMobilePhoneNotifySignalStrengthChange:
       
  2608         case EMobilePhoneNotifyCallForwardingStatusChange:
       
  2609         case EMobilePhoneNotifyCallBarringStatusChange:
       
  2610         case EMobilePhoneNotifyCallWaitingStatusChange:
       
  2611         case EMobilePhoneNotifyAlternatingCallCapsChange:
       
  2612         case EMobilePhoneNotifyAlternatingCallModeChange:
       
  2613         case EMobilePhoneNotifyALSLineChange:
       
  2614         case EMobilePhoneNotifySecurityCapsChange:
       
  2615         case EMobilePhoneNotifyLockInfoChange:
       
  2616         case EMobilePhoneNotifySecurityEvent:
       
  2617         case EMobilePhoneNotifyMessageWaiting:
       
  2618         case EMobilePhoneNotifyFdnStatusChange:
       
  2619         case EMobilePhoneNotifyIccAccessCapsChange:
       
  2620         case EMobilePhoneNotifyNITZInfoChange:
       
  2621         case EMobilePhoneNotifyDefaultPrivacyChange:
       
  2622         case EMobilePhoneNotifyCallServiceCapsChange:
       
  2623         case EMobilePhoneNotifyCallForwardingActive:
       
  2624         case EMobilePhoneNotifyMulticallParamsChange:
       
  2625         case EMobilePhoneNotifyIncomingCallTypeChange:
       
  2626         case EMobilePhoneNotifyUUSSettingChange:
       
  2627         case EMobilePhoneNotifyIccMessageWaitingIndicatorsChange:
       
  2628         case EMobilePhoneNotifyIndicatorChange:
       
  2629         case EMobilePhoneNotifyNetworkSecurityLevelChange:
       
  2630         case EMobilePhoneNotifySecurityCodeInfoChange:
       
  2631         case EMobilePhoneNotifyAPNListChanged:
       
  2632         case EMobilePhoneNotifyAPNControlListServiceStatusChange:
       
  2633         case EMobilePhoneNotifySendNetworkServiceRequest:
       
  2634         case EMobilePhoneNotifyAllSendNetworkServiceRequest:
       
  2635         case EMobilePhoneNotifyCellInfoChange:
       
  2636             ret = KErrNone;
       
  2637             break;
       
  2638         default:
       
  2639             // Not supported
       
  2640             ret = KErrNotSupported;
       
  2641         }
       
  2642 
       
  2643     return ret;
       
  2644     }
       
  2645 
       
  2646 // ---------------------------------------------------------------------------
       
  2647 // CMmPhoneTsy::GetActivePhoneExtension
       
  2648 // Returns a pointer to the active phone extension. The phone
       
  2649 // extension implements phone functionality that is specific
       
  2650 // for selected mode. There should always be some extension active
       
  2651 // (other items were commented in a header).
       
  2652 // ---------------------------------------------------------------------------
       
  2653 //
       
  2654 CMmPhoneExtInterface* CMmPhoneTsy::GetActivePhoneExtension()
       
  2655     {
       
  2656     return iMmPhoneExtInterface;
       
  2657     }
       
  2658 
       
  2659 // ---------------------------------------------------------------------------
       
  2660 // CMmPhoneTsy::CallList
       
  2661 // Returns a pointer to the call list. Call groups are used
       
  2662 // only inside the TSY module, not from the client or from ETel Server.
       
  2663 // When a new CMmCallTsy object is created in the TSY and added to the ETel
       
  2664 // Server's Phone Manager database, it should also be added to the call list.
       
  2665 // The call list has some same functionality as call groups had. Call groups
       
  2666 // were removed from new Mobile API
       
  2667 // (other items were commented in a header).
       
  2668 // ---------------------------------------------------------------------------
       
  2669 //
       
  2670 CMmCallList* CMmPhoneTsy::CallList()
       
  2671     {
       
  2672     return iCallList;
       
  2673     }
       
  2674 
       
  2675 // ---------------------------------------------------------------------------
       
  2676 // CMmPhoneTsy::GetActivePhoneExtension
       
  2677 // Returns a pointer to the line list.
       
  2678 // When a new CMmLineTsy object is created in the TSY and added to the ETel
       
  2679 // Server's Phone Manager database, it should also be added to the line list
       
  2680 // (other items were commented in a header).
       
  2681 // ---------------------------------------------------------------------------
       
  2682 //
       
  2683 CMmLineList* CMmPhoneTsy::LineList()
       
  2684     {
       
  2685     return iLineList;
       
  2686     }
       
  2687 
       
  2688 // ---------------------------------------------------------------------------
       
  2689 // CMmPhoneTsy::PBList
       
  2690 // Returns a pointer to the phonebook list.
       
  2691 // When a new CMmPhoneBookStoreTsy object is created in the TSY, it should
       
  2692 // be also added to the phone book list
       
  2693 // (other items were commented in a header).
       
  2694 // ---------------------------------------------------------------------------
       
  2695 //
       
  2696 CMmPBList* CMmPhoneTsy::PBList()
       
  2697     {
       
  2698     return iPBList;
       
  2699     }
       
  2700 
       
  2701 // ---------------------------------------------------------------------------
       
  2702 // CMmPhoneTsy::GetMultimodeCaps
       
  2703 // This method returns the multimode support capabilities of he phone
       
  2704 // (other items were commented in a header).
       
  2705 // ---------------------------------------------------------------------------
       
  2706 //
       
  2707 TInt CMmPhoneTsy::GetMultimodeCaps(
       
  2708     const TTsyReqHandle aTsyReqHandle,
       
  2709     TUint32* aCaps )
       
  2710     {
       
  2711     *aCaps = KMultimodeCaps;
       
  2712     ReqCompleted( aTsyReqHandle, KErrNone );
       
  2713 
       
  2714     return KErrNone;
       
  2715     }
       
  2716 
       
  2717 // ---------------------------------------------------------------------------
       
  2718 // CMmPhoneTsy::GetPhoneStoreInfoL
       
  2719 // Request information about the phone store specified by aStoreName
       
  2720 // (other items were commented in a header).
       
  2721 // ---------------------------------------------------------------------------
       
  2722 //
       
  2723 TInt CMmPhoneTsy::GetPhoneStoreInfoL(
       
  2724     TDes8* aInfo,
       
  2725     const RMobilePhone::TMobileName* aStoreName )
       
  2726     {
       
  2727     TInt ret( KErrArgument );
       
  2728 TFLOGSTRING("TSY: CMmPhoneTsy::GetPhoneStoreInfoL" );
       
  2729     
       
  2730     if(sizeof(RMobilePhoneStore::TMobilePhoneStoreInfoV1) <= aInfo->MaxLength())
       
  2731       	{
       
  2732         ret = KErrNone;
       
  2733         
       
  2734         RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg* info = 
       
  2735             reinterpret_cast<RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg*>( aInfo );
       
  2736           
       
  2737         RMobilePhoneStore::TMobilePhoneStoreInfoV1& storeInfo = ( *info )();
       
  2738              
       
  2739         if ( KETelExtMultimodeV1 != storeInfo.ExtensionId() )
       
  2740     		{
       
  2741 			TFLOGSTRING("TSY: Phonebook not supported. Only KETelExtMultimodeV1 types supported for RMobilePhone::GetPhoneStoreInfo" );
       
  2742     		ret = KErrNotSupported;
       
  2743     		}
       
  2744     	else
       
  2745     	    {
       
  2746     		// Not supported features
       
  2747     	    if ( 0x0 == aStoreName->Compare( KETelMeAdnPhoneBook )       || 
       
  2748     	         0x0 == aStoreName->Compare( KETelMeDialledPhoneBook )   || 
       
  2749     	         0x0 == aStoreName->Compare( KETelMeMissedPhoneBook )    || 
       
  2750     	         0x0 == aStoreName->Compare( KETelMeReceivedPhoneBook )  || 
       
  2751     	         0x0 == aStoreName->Compare( KETelCombinedAdnPhoneBook ) || 
       
  2752     	         0x0 == aStoreName->Compare( KETelCombinedSmsStore )     || 
       
  2753     	         0x0 == aStoreName->Compare( KETelMeSmsStore )              
       
  2754     	       )
       
  2755     	        {
       
  2756 				TFLOGSTRING("TSY: Phonebook name is not supported. " );
       
  2757     	        ret = KErrNotSupported;
       
  2758     	        }
       
  2759     	    else
       
  2760     	        {
       
  2761     		    // packed parameter for DOS call: RMobilePhone::TMobileName
       
  2762     			CMmDataPackage dataPackage;
       
  2763 
       
  2764     			RMobilePhone::TMobileName* nonConstStoreName =
       
  2765     				const_cast<RMobilePhone::TMobileName*>( aStoreName );
       
  2766     			dataPackage.PackData( nonConstStoreName );
       
  2767     	        ret = iMessageManager->HandleRequestL( 
       
  2768     	              EMobilePhoneGetPhoneStoreInfo, &dataPackage );
       
  2769     	        }
       
  2770 
       
  2771     	    // Check the request sending status
       
  2772     	    if ( KErrNone == ret )
       
  2773     	        {
       
  2774     	        // Save last req handle type
       
  2775     	        iReqHandleType = EMultimodePhoneGetPhoneStoreInfo;
       
  2776     			iRetPhoneStoreInfo = &storeInfo;
       
  2777     	        }
       
  2778     		}
       
  2779       	}
       
  2780     return ret;    
       
  2781     }
       
  2782 
       
  2783     
       
  2784 // ---------------------------------------------------------------------------
       
  2785 // CMmPhoneTsy::CompleteGetPhoneStoreInfo
       
  2786 // Returns the phone store info that is stored on the SIM to the client
       
  2787 // (other items were commented in a header).
       
  2788 // ---------------------------------------------------------------------------
       
  2789 //
       
  2790 void CMmPhoneTsy::CompleteGetPhoneStoreInfo(
       
  2791     RMobilePhoneStore::TMobilePhoneStoreInfoV1 aPhoneStoreInfo,
       
  2792     TInt aErrorCode )
       
  2793     {
       
  2794     // Reset req handle. Returns the deleted req handle
       
  2795     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  2796         EMultimodePhoneGetPhoneStoreInfo );
       
  2797 
       
  2798     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  2799         {
       
  2800 		if ( iRetPhoneStoreInfo )
       
  2801 			{
       
  2802 			// copy result to client
       
  2803 			*iRetPhoneStoreInfo = aPhoneStoreInfo;
       
  2804 			// reset pointer to client
       
  2805 			iRetPhoneStoreInfo = NULL;
       
  2806 			}
       
  2807         // Complete the client request
       
  2808         ReqCompleted( reqHandle, aErrorCode );
       
  2809 		}
       
  2810     }
       
  2811 
       
  2812 // ---------------------------------------------------------------------------
       
  2813 // CMmPhoneTsy::GetPhoneStoreInfoCancel
       
  2814 // Cancels a previously placed GetPhoneStoreInfo request
       
  2815 // (other items were commented in a header).
       
  2816 // ---------------------------------------------------------------------------
       
  2817 //
       
  2818 TInt CMmPhoneTsy::GetPhoneStoreInfoCancel(
       
  2819     const TTsyReqHandle )
       
  2820     {
       
  2821     TTsyReqHandle reqHandle =
       
  2822      	iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePhoneGetPhoneStoreInfo );
       
  2823    
       
  2824     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  2825         {
       
  2826         // reset pointer to client
       
  2827         iRetPhoneStoreInfo = NULL;
       
  2828         //complete with cancel
       
  2829         ReqCompleted( reqHandle, KErrCancel );
       
  2830         }
       
  2831 
       
  2832     return KErrNone;
       
  2833     }
       
  2834 
       
  2835 // ---------------------------------------------------------------------------
       
  2836 // CMmPhoneTsy::GetCustomerServiceProfileL
       
  2837 // Request the whole Customer Service Profile file that is stored on the SIM.
       
  2838 // (other items were commented in a header).
       
  2839 // ---------------------------------------------------------------------------
       
  2840 //
       
  2841 TInt CMmPhoneTsy::GetCustomerServiceProfileL(
       
  2842     const TTsyReqHandle aTsyReqHandle,
       
  2843     TDes8* aCspFile )
       
  2844     {
       
  2845 TFLOGSTRING("TSY: CMmPhoneTsy::GetCustomerServiceProfileL" );
       
  2846     
       
  2847     TInt ret = KErrArgument;
       
  2848     
       
  2849     if ( sizeof( RMobilePhone::TMobilePhoneCspFileV1 ) == 
       
  2850          aCspFile->MaxLength() )
       
  2851         {
       
  2852         RMobilePhone::TMobilePhoneCspFileV1Pckg* infoPckg =
       
  2853         reinterpret_cast< RMobilePhone::TMobilePhoneCspFileV1Pckg* >
       
  2854             ( aCspFile );
       
  2855         RMobilePhone::TMobilePhoneCspFileV1* cspFile = &( ( *infoPckg )() );    
       
  2856             
       
  2857         TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
       
  2858             EMultimodePhoneGetCustomerServiceProfile );
       
  2859 
       
  2860         if ( 0 < reqHandle )
       
  2861             {
       
  2862  TFLOGSTRING("TSY: CMmPhoneTsy::GetCustomerServiceProfileL one req already ongoing" );  
       
  2863             ret = KErrNone;
       
  2864             //The request is already in processing because of previous request
       
  2865             //Complete request with status value informing the client about
       
  2866     		TCustomerServiceProfileIdRequest* req = 
       
  2867                 new (ELeave) TCustomerServiceProfileIdRequest();
       
  2868     		req->iReqHandle = aTsyReqHandle;
       
  2869     		req->iRetCspFile = cspFile;
       
  2870     		iCustomerServiceProfileRequests.AppendL( req );
       
  2871             }
       
  2872         else
       
  2873             {
       
  2874     		// no packed parameters for DOS call
       
  2875     		ret =  iMessageManager->HandleRequestL(
       
  2876     			EMobilePhoneGetCustomerServiceProfile );
       
  2877 
       
  2878     		// Check the request sending status
       
  2879             if ( KErrNone == ret )
       
  2880                 {
       
  2881                	// DOS call successful, save request handle and return pointer
       
  2882     			// for completion
       
  2883                 iReqHandleType = EMultimodePhoneGetCustomerServiceProfile;
       
  2884     			// save request in queue for completion
       
  2885     			TCustomerServiceProfileIdRequest* req = 
       
  2886                     new (ELeave) TCustomerServiceProfileIdRequest();
       
  2887     			req->iReqHandle = aTsyReqHandle;
       
  2888     			req->iRetCspFile = cspFile;
       
  2889     			iCustomerServiceProfileRequests.AppendL( req );
       
  2890                 }
       
  2891             }
       
  2892         }
       
  2893 
       
  2894     return ret;
       
  2895     }
       
  2896 
       
  2897 // ---------------------------------------------------------------------------
       
  2898 // CMmPhoneTsy::CompleteGetCustomerServiceProfile
       
  2899 // Completes a GetCustomerServiceProfile request.
       
  2900 // (other items were commented in a header).
       
  2901 // ---------------------------------------------------------------------------
       
  2902 //
       
  2903 void CMmPhoneTsy::CompleteGetCustomerServiceProfile(
       
  2904     RMobilePhone::TMobilePhoneCspFileV1 aCspFile,
       
  2905     TInt aErrorCode )
       
  2906     {
       
  2907 
       
  2908 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetCustomerServiceProfile" );
       
  2909     
       
  2910     // Check if the get was called internally during boot
       
  2911     if( iCspFileQueryInBoot )
       
  2912         {
       
  2913         // Examine Csp file's ALS state
       
  2914     	if ( RMobilePhone::KCspALS & aCspFile.iCphsTeleservices )
       
  2915     	    {
       
  2916     	    iCspFileAlsSet = ETrue;
       
  2917     		SetAlsState( ETrue );
       
  2918     		iCspFileAlsSet = EFalse;
       
  2919     	    }
       
  2920     	iCspFileQueryInBoot = EFalse;
       
  2921         }
       
  2922         
       
  2923     // Reset req handle. Returns the deleted req handle
       
  2924     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  2925         EMultimodePhoneGetCustomerServiceProfile );
       
  2926 
       
  2927     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  2928         {
       
  2929 			
       
  2930 		TInt customerServiceProfileRequestsCount = 
       
  2931             iCustomerServiceProfileRequests.Count();
       
  2932 
       
  2933 		for ( TInt i=0; i < customerServiceProfileRequestsCount ; i++ )
       
  2934 			{
       
  2935             TCustomerServiceProfileIdRequest* req = 
       
  2936                 iCustomerServiceProfileRequests[ i ];
       
  2937             
       
  2938             //set value in client side
       
  2939             *(req->iRetCspFile) = aCspFile;
       
  2940 			//reset the return pointer
       
  2941 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetCustomerServiceProfile queue handling" ); 
       
  2942             ReqCompleted( req->iReqHandle, aErrorCode );
       
  2943 			}
       
  2944         // Complete the client request
       
  2945 		//Destroy Array 
       
  2946  		iCustomerServiceProfileRequests.ResetAndDestroy();
       
  2947         }
       
  2948     }
       
  2949 
       
  2950 //
       
  2951 // ---------------------------------------------------------------------------
       
  2952 // CMmPhoneTsy::GetCustomerServiceProfileCancel
       
  2953 // Cancels an outstanding GetCustomerServiceProfile request.
       
  2954 // (other items were commented in a header).
       
  2955 // ---------------------------------------------------------------------------
       
  2956 //
       
  2957 TInt CMmPhoneTsy::GetCustomerServiceProfileCancel( const TTsyReqHandle aTsyReqHandle )
       
  2958     {
       
  2959 TFLOGSTRING2("TSY: CMmPhoneTsy::GetCustomerServiceProfileCancel aTsyReqHandle: %d", aTsyReqHandle);   
       
  2960 
       
  2961     TInt customerServiceProfileRequestsCount = iCustomerServiceProfileRequests.Count();
       
  2962 
       
  2963     //reset the req handle if only one req remains
       
  2964     if( 1 == customerServiceProfileRequestsCount )
       
  2965         {
       
  2966         TFLOGSTRING("TSY: CMmPhoneTsy::GetCustomerServiceProfileCancel - one req");       
       
  2967         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  2968                 EMultimodePhoneGetCustomerServiceProfile );       
       
  2969         }
       
  2970 
       
  2971     // go through array if one or more requests remain and find the correct request handle to cancel
       
  2972     for ( TInt i=0; i < customerServiceProfileRequestsCount ; i++ )
       
  2973         {
       
  2974 TFLOGSTRING("TSY: CMmPhoneTsy::GetCustomerServiceProfileCancel - queued requests");
       
  2975 
       
  2976         TCustomerServiceProfileIdRequest* req =
       
  2977         iCustomerServiceProfileRequests[ i ];
       
  2978 
       
  2979         // find correct handle for cancelling
       
  2980         if( aTsyReqHandle == req->iReqHandle  )
       
  2981             {
       
  2982             ReqCompleted( req->iReqHandle, KErrCancel );
       
  2983             // remove correct handle from queue
       
  2984             delete iCustomerServiceProfileRequests[ i ];
       
  2985             iCustomerServiceProfileRequests.Remove(i);
       
  2986             break; 
       
  2987             }
       
  2988         }
       
  2989 
       
  2990     return KErrNone;
       
  2991     }
       
  2992 
       
  2993 // ---------------------------------------------------------------------------
       
  2994 // CMmPhoneTsy::GetBatteryCaps
       
  2995 // Returns the battery information capabilities of the phone
       
  2996 // (other items were commented in a header).
       
  2997 // ---------------------------------------------------------------------------
       
  2998 //
       
  2999 TInt CMmPhoneTsy::GetBatteryCaps(
       
  3000     const TTsyReqHandle aTsyReqHandle,
       
  3001     TUint32* aCaps )
       
  3002     {
       
  3003     //Get battery capability information
       
  3004     *aCaps = KBatteryCaps;
       
  3005     ReqCompleted( aTsyReqHandle, KErrNone );
       
  3006     
       
  3007     return KErrNone;
       
  3008     }
       
  3009 
       
  3010 // ---------------------------------------------------------------------------
       
  3011 // CMmPhoneTsy::GetBatteryInfo
       
  3012 // Returns current battery information of the phone. If the current power
       
  3013 // status is unknown, it is requested from DOS.
       
  3014 // (other items were commented in a header).
       
  3015 // ---------------------------------------------------------------------------
       
  3016 //
       
  3017 TInt CMmPhoneTsy::GetBatteryInfoL(
       
  3018     const TTsyReqHandle aTsyReqHandle,
       
  3019     RMobilePhone::TMobilePhoneBatteryInfoV1* aInfo )
       
  3020     {
       
  3021 TFLOGSTRING("TSY: CMmPhoneTsy::GetBatteryInfoL");
       
  3022 
       
  3023     // Battery info is requested when phone is booted up and updated when
       
  3024     // EM server sends indications.
       
  3025     *aInfo = iBatteryInfo;
       
  3026 
       
  3027     ReqCompleted( aTsyReqHandle, KErrNone );
       
  3028     
       
  3029     return KErrNone;
       
  3030     }
       
  3031 
       
  3032 // ---------------------------------------------------------------------------
       
  3033 // CMmPhoneTsy::NotifyBatteryInfoChange
       
  3034 // Notifies the client when the battery info changes.
       
  3035 // (other items were commented in a header).
       
  3036 // ---------------------------------------------------------------------------
       
  3037 //
       
  3038 TInt CMmPhoneTsy::NotifyBatteryInfoChange(
       
  3039     RMobilePhone::TMobilePhoneBatteryInfoV1* aInfo )
       
  3040     {
       
  3041 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyBatteryInfoChange");
       
  3042 
       
  3043     iRetBatteryInfo = aInfo;
       
  3044     iReqHandleType = EMultimodePhoneNotifyBatteryInfoChange;
       
  3045     return KErrNone;
       
  3046     }
       
  3047 
       
  3048 // ---------------------------------------------------------------------------
       
  3049 // CMmPhoneTsy::CompleteNotifyBatteryInfoChange
       
  3050 // This method completes an outstanding asynchronous NotifyALSLineChange
       
  3051 // request.
       
  3052 // (other items were commented in a header).
       
  3053 // ---------------------------------------------------------------------------
       
  3054 //
       
  3055 void CMmPhoneTsy::CompleteNotifyBatteryInfoChange(
       
  3056     CMmDataPackage* aDataPackage,
       
  3057     TInt aErrorCode )
       
  3058     {
       
  3059 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyBatteryInfoChange");
       
  3060 
       
  3061     if ( KErrNone == aErrorCode )
       
  3062         {
       
  3063         // unpack data...
       
  3064         RMobilePhone::TMobilePhoneBatteryInfoV1* batteryInfo = NULL;
       
  3065         aDataPackage->UnPackData(&batteryInfo);
       
  3066         iBatteryInfo = *batteryInfo;
       
  3067         }
       
  3068 
       
  3069 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteNotifyBatteryInfoChange, battery status: %d", (TInt)iBatteryInfo.iStatus);
       
  3070 
       
  3071     //reset req handle. Returns the deleted req handle
       
  3072     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3073         EMultimodePhoneNotifyBatteryInfoChange );
       
  3074 
       
  3075     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  3076         {
       
  3077         if ( KErrNone == aErrorCode )
       
  3078             {
       
  3079             *iRetBatteryInfo = iBatteryInfo;
       
  3080             }
       
  3081         iRetBatteryInfo = NULL;
       
  3082         // complete the client request
       
  3083         ReqCompleted( reqHandle, aErrorCode );
       
  3084         }
       
  3085     }
       
  3086 
       
  3087 // ---------------------------------------------------------------------------
       
  3088 // CMmPhoneTsy::NotifyBatteryInfoChange
       
  3089 // Cancels an outstanding NotifyBatteryInfoChange request.
       
  3090 // (other items were commented in a header).
       
  3091 // ---------------------------------------------------------------------------
       
  3092 //
       
  3093 TInt CMmPhoneTsy::NotifyBatteryInfoChangeCancel(
       
  3094     const TTsyReqHandle aTsyReqHandle )
       
  3095     {
       
  3096 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyBatteryInfoChangeCancel");
       
  3097 
       
  3098     iRetBatteryInfo = NULL;
       
  3099     iTsyReqHandleStore->ResetTsyReqHandle( 
       
  3100         EMultimodePhoneNotifyBatteryInfoChange );
       
  3101 
       
  3102     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  3103 
       
  3104     return KErrNone;
       
  3105     }
       
  3106 
       
  3107 // ---------------------------------------------------------------------------
       
  3108 // CMmPhoneTsy::NotifyBatteryInfo
       
  3109 // This method allows a client to be notified if battery info is changed
       
  3110 // (other items were commented in a header).
       
  3111 // ---------------------------------------------------------------------------
       
  3112 //
       
  3113 void CMmPhoneTsy::NotifyBatteryInfo( TInt aErrorCode,
       
  3114     CHWRMPower::TBatteryConsumptionData aBatteryData )
       
  3115     {
       
  3116     if ( iBatteryInfo.iChargeLevel != aBatteryData.iRemainingPercentageCapacity )
       
  3117         {
       
  3118         iBatteryInfo.iChargeLevel = aBatteryData.iRemainingPercentageCapacity;
       
  3119         
       
  3120         // reset req handle. Returns the deleted req handle
       
  3121         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3122             EMultimodePhoneNotifyBatteryInfoChange );
       
  3123 
       
  3124         if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  3125             {
       
  3126             if ( KErrNone == aErrorCode )
       
  3127                 {
       
  3128                 *iRetBatteryInfo = iBatteryInfo;
       
  3129                 }
       
  3130             iRetBatteryInfo = NULL;
       
  3131             // complete the client request
       
  3132             ReqCompleted( reqHandle, aErrorCode );
       
  3133             }
       
  3134         }
       
  3135     }
       
  3136         
       
  3137 // ---------------------------------------------------------------------------
       
  3138 // CMmPhoneTsy::NotifyChargingStatus
       
  3139 // This method allows a client to be notified if battery charging status is
       
  3140 // changed
       
  3141 // (other items were commented in a header).
       
  3142 // ---------------------------------------------------------------------------
       
  3143 //
       
  3144 void CMmPhoneTsy::NotifyChargingStatus( TInt aErrorCode,
       
  3145     RMobilePhone::TMobilePhoneBatteryInfoV1 aBatteryInfo )
       
  3146     {
       
  3147     if ( iBatteryInfo.iStatus != aBatteryInfo.iStatus )
       
  3148         {
       
  3149         iBatteryInfo.iStatus = aBatteryInfo.iStatus;
       
  3150         // reset req handle. Returns the deleted req handle
       
  3151         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3152             EMultimodePhoneNotifyBatteryInfoChange );
       
  3153 
       
  3154         if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  3155             {
       
  3156             if ( KErrNone == aErrorCode )
       
  3157                 {
       
  3158                 *iRetBatteryInfo = iBatteryInfo;
       
  3159                 }
       
  3160             iRetBatteryInfo = NULL;
       
  3161             // complete the client request
       
  3162             ReqCompleted( reqHandle, aErrorCode );
       
  3163             }
       
  3164         }
       
  3165     }
       
  3166 
       
  3167 // ---------------------------------------------------------------------------
       
  3168 // CMmPhoneTsy::GetServiceProviderNameL
       
  3169 // Get service provider name
       
  3170 // (other items were commented in a header).
       
  3171 // ---------------------------------------------------------------------------
       
  3172 //
       
  3173 TInt CMmPhoneTsy::GetServiceProviderNameL(
       
  3174     const TTsyReqHandle aTsyReqHandle,
       
  3175     TDes8* aName )
       
  3176     {
       
  3177     TInt ret = KErrNone;
       
  3178     
       
  3179     if ( iBootState.iSIMReady )
       
  3180         {
       
  3181 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceProviderNameL -Sim ready");
       
  3182 
       
  3183         if ( sizeof( RMobilePhone::TMobilePhoneServiceProviderNameV2 ) >
       
  3184              aName->MaxLength() )
       
  3185             {
       
  3186 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceProviderNameL -Invalid parameter!");        
       
  3187             ret = KErrArgument;
       
  3188             }
       
  3189 		else
       
  3190 		    {
       
  3191     	    //Send a request to LTSY if request handle does not exist.
       
  3192         	TTsyReqHandle reqhandle = iTsyReqHandleStore->GetTsyReqHandle( 
       
  3193     			EMultimodePhoneGetServiceProviderName );
       
  3194     		
       
  3195     		if( EMultimodePhoneReqHandleUnknown == reqhandle )
       
  3196     			{
       
  3197     			ret = iMmPhoneExtInterface->GetServiceProviderNameL();  			
       
  3198     			}
       
  3199     	    }
       
  3200 
       
  3201         if ( KErrNone == ret )
       
  3202             {
       
  3203             // save reqhandle to queue
       
  3204 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceProviderNameL - Client to queue");
       
  3205             RMobilePhone::TMobilePhoneServiceProviderNameV2Pckg* nameV2Pckg =
       
  3206                 REINTERPRET_CAST( 
       
  3207                     RMobilePhone::TMobilePhoneServiceProviderNameV2Pckg*, 
       
  3208                         aName );
       
  3209                     
       
  3210             RMobilePhone::TMobilePhoneServiceProviderNameV2* 
       
  3211                 serviceProviderName = &( ( *nameV2Pckg ) () );
       
  3212             
       
  3213             //Save request handle in queue
       
  3214 			TServiceProviderNameRequest* req = 
       
  3215 				new (ELeave) TServiceProviderNameRequest();
       
  3216 			req->iReqHandle = aTsyReqHandle;
       
  3217 			req->iServiceProviderName = serviceProviderName;
       
  3218 			iServiceProviderNameRequests.AppendL( req );
       
  3219             //Save tsy req handle type
       
  3220             iReqHandleType = EMultimodePhoneGetServiceProviderName;
       
  3221             }
       
  3222          }
       
  3223      else
       
  3224         {
       
  3225 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceProviderNameL - Sim not ready");
       
  3226         ret = KErrNotReady;
       
  3227         }
       
  3228 
       
  3229     return ret;
       
  3230     }
       
  3231 
       
  3232 // ---------------------------------------------------------------------------
       
  3233 // CMmPhoneTsy::CompleteGetServiceProviderName
       
  3234 // This method completes an outstanding asynchronous
       
  3235 // GetServiceProviderName request
       
  3236 // (other items were commented in a header).
       
  3237 // ---------------------------------------------------------------------------
       
  3238 //
       
  3239 void CMmPhoneTsy::CompleteGetServiceProviderName(
       
  3240     CMmDataPackage* aDataPackage,
       
  3241     TInt aErrorCode )
       
  3242     {
       
  3243 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetServiceProviderName Error %d", aErrorCode );
       
  3244    
       
  3245     // reset req handle. Returns the deleted req handle
       
  3246     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3247         EMultimodePhoneGetServiceProviderName );
       
  3248 
       
  3249     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  3250         {     
       
  3251         RMobilePhone::TMobilePhoneServiceProviderNameV2* name = NULL;
       
  3252         TInt requestCount = iServiceProviderNameRequests.Count();
       
  3253         
       
  3254         if ( KErrNone == aErrorCode )
       
  3255             {
       
  3256             aDataPackage->UnPackData( &name );
       
  3257 
       
  3258 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetServiceProviderName name: %S", &name->iSPName );
       
  3259 		    for ( TInt i=0; i < requestCount ; i++ )
       
  3260 		        {
       
  3261 		        TServiceProviderNameRequest* req = 
       
  3262 		            iServiceProviderNameRequests[ i ];
       
  3263 		        *(req->iServiceProviderName) = *name;
       
  3264 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetServiceProviderName client %d", i );
       
  3265 		        ReqCompleted( req->iReqHandle, aErrorCode );
       
  3266 		        }
       
  3267             }
       
  3268         else
       
  3269         	{
       
  3270 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetServiceProviderName Error %d", aErrorCode );
       
  3271         	for ( TInt i=0; i < requestCount ; i++ )
       
  3272 		        {
       
  3273 		        TServiceProviderNameRequest* req = 
       
  3274 		            iServiceProviderNameRequests[ i ];
       
  3275 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetServiceProviderName Error queue: %d", i );
       
  3276 		        ReqCompleted( req->iReqHandle, aErrorCode );
       
  3277 		        }	
       
  3278         	}
       
  3279         //Delete array and it's content	
       
  3280         iServiceProviderNameRequests.ResetAndDestroy();
       
  3281         
       
  3282         }
       
  3283     }
       
  3284 
       
  3285 //
       
  3286 // ---------------------------------------------------------------------------
       
  3287 // CMmPhoneTsy::GetServiceProviderNameCancel
       
  3288 // Cancels an outstanding GetServiceProviderName request.
       
  3289 // (other items were commented in a header).
       
  3290 // ---------------------------------------------------------------------------
       
  3291 //
       
  3292 TInt CMmPhoneTsy::GetServiceProviderNameCancel( const TTsyReqHandle aTsyReqHandle )
       
  3293     {
       
  3294     TFLOGSTRING2("TSY: CMmPhoneTsy::GetServiceProviderNameCancel aTsyReqHandle: %d", aTsyReqHandle);   
       
  3295 
       
  3296     TInt requestCount = iServiceProviderNameRequests.Count();
       
  3297     
       
  3298     //reset the req handle if only one req remains
       
  3299     if( 1 == requestCount )
       
  3300         {
       
  3301         TFLOGSTRING("TSY: CMmPhoneTsy::GetCustomerServiceProfileCancel - one req");       
       
  3302         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3303                 EMultimodePhoneGetServiceProviderName );       
       
  3304         }
       
  3305 
       
  3306     // qo throw array if several requests and find correct reqhandle to cancel
       
  3307     for ( TInt i = 0; i < requestCount; i++ )
       
  3308         {
       
  3309         TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceProviderNameCancel - queued requests");
       
  3310 
       
  3311         TServiceProviderNameRequest* req =
       
  3312         iServiceProviderNameRequests[i];
       
  3313 
       
  3314         // find correct handle for cancelling
       
  3315         if( aTsyReqHandle == req->iReqHandle  )
       
  3316             {
       
  3317             ReqCompleted( req->iReqHandle, KErrCancel );
       
  3318             // remove correct handle from queue
       
  3319             delete iServiceProviderNameRequests[ i ];
       
  3320             iServiceProviderNameRequests.Remove(i);
       
  3321             break; 
       
  3322             }
       
  3323         }
       
  3324     return KErrNone;
       
  3325     }
       
  3326 
       
  3327 // ---------------------------------------------------------------------------
       
  3328 // CMmPhoneTsy::GetIdentityCaps
       
  3329 // Gets the identity information capabilities of the phone.
       
  3330 // (other items were commented in a header).
       
  3331 // ---------------------------------------------------------------------------
       
  3332 //
       
  3333 TInt CMmPhoneTsy::GetIdentityCaps(
       
  3334     const TTsyReqHandle aTsyReqHandle,
       
  3335     TUint32* aCaps )
       
  3336     {
       
  3337     *aCaps = KIdentityCaps;
       
  3338 
       
  3339     ReqCompleted( aTsyReqHandle, KErrNone );
       
  3340     
       
  3341     return KErrNone;
       
  3342     }
       
  3343 
       
  3344 // ---------------------------------------------------------------------------
       
  3345 // CMmPhoneTsy::GetPhoneIdL
       
  3346 // Gets the phone's manufacturer, model, revision and serialNumber. The serial
       
  3347 // number is requested from DOS if currently unknown.
       
  3348 // (other items were commented in a header).
       
  3349 // ---------------------------------------------------------------------------
       
  3350 //
       
  3351 TInt CMmPhoneTsy::GetPhoneIdL(
       
  3352     const TTsyReqHandle aTsyReqHandle,
       
  3353     RMobilePhone::TMobilePhoneIdentityV1* aId )
       
  3354     {    
       
  3355    
       
  3356     // This is a get request. First check if another request is going through
       
  3357     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(EMultimodePhoneGetPhoneId);
       
  3358      
       
  3359     // if this is not the first request for Phone id information then add it to the
       
  3360     // list of waiting
       
  3361     if(reqHandle > 0)
       
  3362     	{
       
  3363         TGetPhoneIdRequest* req = new (ELeave) TGetPhoneIdRequest();
       
  3364     	req->iReqHandle = aTsyReqHandle;
       
  3365     	req->iRetPhoneId = aId;
       
  3366     	CleanupStack::PushL(req);
       
  3367     	iGetPhoneIdRequests.AppendL( req );
       
  3368     	CleanupStack::Pop(req);
       
  3369     	}
       
  3370     else
       
  3371     	{
       
  3372     	DoGetPhoneIdL(aTsyReqHandle, aId);    	
       
  3373     	}
       
  3374    
       
  3375     return KErrNone;
       
  3376     }
       
  3377 
       
  3378 // ---------------------------------------------------------------------------
       
  3379 // CMmPhoneTsy::DoGetPhoneId
       
  3380 // Gets the iPhoneIdentitys iSerialNumber and completes GetPhoneId.
       
  3381 // (other items were commented in a header).
       
  3382 // ---------------------------------------------------------------------------
       
  3383 //
       
  3384 void CMmPhoneTsy::DoGetPhoneIdL(const TTsyReqHandle aTsyReqHandle,
       
  3385 		                        RMobilePhone::TMobilePhoneIdentityV1* aId)
       
  3386 	{
       
  3387 #ifndef USING_CTSY_DISPATCHER
       
  3388 //ifdefed out as when using the dispatcher all the information is retrieved from the LTSY
       
  3389 #ifdef SYMBIAN_BAFL_SYSUTIL
       
  3390 	
       
  3391 	CDeviceTypeInformation* deviceAtts = SysUtil::GetDeviceTypeInfoL();
       
  3392 	CleanupStack::PushL(deviceAtts);
       
  3393 	
       
  3394 	// For manufacturerName, modelName and revisionId we check if there is data 
       
  3395 	// available in the result given from SysUtil::GetDeviceTypeInfoL. Where data
       
  3396 	// is present the default value from initalization is overwritten.
       
  3397 	// The retrieved buffers can be 64 characters long but we 
       
  3398 	// have only got space in iPhoneIdentity for 50 due to the design of 
       
  3399 	// TMobilePhoneIdentityV1. Therfore we truncate if the buffer is to big to fit.	
       
  3400 			  		   
       
  3401 	TPtrC16 manufacturerName;
       
  3402  	if(User::LeaveIfError(deviceAtts->GetManufacturerName(manufacturerName)) == KErrNone)
       
  3403  		{
       
  3404  		if(manufacturerName.Length() != 0)
       
  3405  			{
       
  3406 			iPhoneIdentity.iManufacturer.Copy(manufacturerName.Left(RMobilePhone::KPhoneManufacturerIdSize));
       
  3407  			}
       
  3408  		}
       
  3409     
       
  3410  	TPtrC16 modelName;
       
  3411     if(User::LeaveIfError(deviceAtts->GetModelName(modelName)) == KErrNone)
       
  3412     	{
       
  3413 		if(modelName.Length() != 0)
       
  3414 			{
       
  3415 			iPhoneIdentity.iModel.Copy(modelName.Left(RMobilePhone::KPhoneModelIdSize));
       
  3416 			}
       
  3417     	}
       
  3418     
       
  3419 	TPtrC16 revisionId;
       
  3420 	if(User::LeaveIfError(deviceAtts->GetRevisionID(revisionId)) == KErrNone)
       
  3421 		{   
       
  3422 		if(revisionId.Length() != 0)
       
  3423 			{
       
  3424 			iPhoneIdentity.iRevision.Copy(revisionId.Left(RMobilePhone::KPhoneRevisionIdSize));
       
  3425 			}
       
  3426 		}
       
  3427 				
       
  3428 	// delete deviceAtts as its no longer required
       
  3429 	CleanupStack::PopAndDestroy();
       
  3430 #endif
       
  3431 #endif //USING_CTSY_DISPATCHER
       
  3432 	
       
  3433    if (0 == iPhoneIdentity.iSerialNumber.Length())
       
  3434       {		
       
  3435 	  TInt ret = iMessageManager->HandleRequestL(EMobilePhoneGetPhoneId);
       
  3436 
       
  3437 	  if(KErrNone == ret)
       
  3438 	     {
       
  3439 	     // DOS call successful, save request handle and return pointer
       
  3440 	     // for completion
       
  3441 	     iRetPhoneIdentity = aId;
       
  3442          iReqHandleType = EMultimodePhoneGetPhoneId;
       
  3443             
       
  3444          // save request handle in queue
       
  3445          TGetPhoneIdRequest* req = new (ELeave) TGetPhoneIdRequest();
       
  3446          req->iReqHandle = aTsyReqHandle;
       
  3447          req->iRetPhoneId = aId;
       
  3448          iGetPhoneIdRequests.AppendL( req );            
       
  3449 	     }
       
  3450 	  else
       
  3451 	     {
       
  3452 	     // DOS call failed, immediately complete with error
       
  3453 	     ReqCompleted( aTsyReqHandle, ret );
       
  3454 	     }
       
  3455       }
       
  3456    else
       
  3457       {
       
  3458       TFLOGSTRING3("TSY: CMmPhoneTsy::GetPhoneIdL - iManufacturer: %S, iModel: %S", &iPhoneIdentity.iManufacturer, 
       
  3459              		                                                                      &iPhoneIdentity.iModel );             
       
  3460       TFLOGSTRING3("TSY: CMmPhoneTsy::GetPhoneIdL - iRevision: %S, iSerialNumber: %S", &iPhoneIdentity.iRevision, 
       
  3461              		                                                                         &iPhoneIdentity.iSerialNumber);
       
  3462      	  
       
  3463 	  *aId = iPhoneIdentity;
       
  3464 	  ReqCompleted( aTsyReqHandle, KErrNone );	   
       
  3465       }	
       
  3466    }
       
  3467 
       
  3468 // ---------------------------------------------------------------------------
       
  3469 // CMmPhoneTsy::CompleteGetPhoneId
       
  3470 // Sets iPhoneIdentitys iSerialNumber and completes GetPhoneId.
       
  3471 // (other items were commented in a header).
       
  3472 // ---------------------------------------------------------------------------
       
  3473 //
       
  3474 void CMmPhoneTsy::CompleteGetPhoneId(
       
  3475     TBuf8<KSerialNumberLength> aSerialData, 
       
  3476     TInt aError )
       
  3477     {
       
  3478 	if ( ( KErrNone == aError ) && ( 0 < aSerialData.Length() ) )
       
  3479 		{
       
  3480         // Copy serial number
       
  3481         iPhoneIdentity.iSerialNumber.Copy(aSerialData.Left( aSerialData.Length() ) );
       
  3482         
       
  3483         TFLOGSTRING2("TSY: CMmPhoneTsy::CompletePhoneSerialNumber - iSerialNumber: %S", &iPhoneIdentity.iSerialNumber );
       
  3484         }
       
  3485 
       
  3486     //reset req handle. Returns the deleted req handle
       
  3487     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(EMultimodePhoneGetPhoneId );
       
  3488    
       
  3489     TInt getPhoneIdRequestsCount = iGetPhoneIdRequests.Count();
       
  3490 
       
  3491     for ( TInt i=0; i < getPhoneIdRequestsCount ; i++ )
       
  3492         {
       
  3493         TGetPhoneIdRequest* req = iGetPhoneIdRequests[i];
       
  3494     
       
  3495         *(req->iRetPhoneId) = iPhoneIdentity;
       
  3496         ReqCompleted(req->iReqHandle, aError);   
       
  3497         }
       
  3498     iGetPhoneIdRequests.ResetAndDestroy();
       
  3499     }
       
  3500 
       
  3501 // ---------------------------------------------------------------------------
       
  3502 // CMmPhoneTsy::MobilePhoneGetPhoneIdCancel
       
  3503 // Cancels get phone id request
       
  3504 // (other items were commented in a header).
       
  3505 // ---------------------------------------------------------------------------
       
  3506 //
       
  3507 TInt CMmPhoneTsy::MobilePhoneGetPhoneIdCancel(const TTsyReqHandle aTsyReqHandle )
       
  3508     {
       
  3509     TFLOGSTRING("TSY: CMmPhoneTsy::MobilePhoneGetPhoneIdCancel");    
       
  3510     
       
  3511     TInt reqCount = iGetPhoneIdRequests.Count();
       
  3512     
       
  3513     // 1 means that last ongoing request is going to be cancelled.
       
  3514     if ( reqCount == 1 )
       
  3515         {
       
  3516         //Request handle storage is used in this case like a semaphore. When the
       
  3517         //request handle is stored in iTsyReqHandleStore then CTSY knows that 
       
  3518         //there is at least one ongoing GetPhoneId request. Code must remove 
       
  3519         //GetPhoneId request handle from storage when the last ongoing request 
       
  3520         //is cancelled.
       
  3521         iTsyReqHandleStore->ResetTsyReqHandle(EMultimodePhoneGetPhoneId);
       
  3522         }            
       
  3523     
       
  3524     for ( TInt i = 0; i < reqCount; i++ )
       
  3525        {
       
  3526        if (aTsyReqHandle == iGetPhoneIdRequests[i]->iReqHandle)
       
  3527           {
       
  3528           // remove the request from the queue and destroy it.
       
  3529           TGetPhoneIdRequest* req = iGetPhoneIdRequests[i];
       
  3530           iGetPhoneIdRequests.Remove( i );
       
  3531           delete req;
       
  3532                     
       
  3533           // cancel the request
       
  3534           ReqCompleted(aTsyReqHandle, KErrCancel);
       
  3535      
       
  3536           // end the FOR-loop, there can be only one identical reqhandle
       
  3537           // so there is no reason why the array-loop should continue
       
  3538           break;
       
  3539           }
       
  3540         }     
       
  3541     return KErrNone;
       
  3542     }    
       
  3543 
       
  3544 
       
  3545 // ---------------------------------------------------------------------------
       
  3546 // CMmPhoneTsy::GetSubscriberIdL
       
  3547 // Gets the subscriber's identity as described by its IMSI.
       
  3548 // (other items were commented in a header).
       
  3549 // ---------------------------------------------------------------------------
       
  3550 //
       
  3551 TInt CMmPhoneTsy::GetSubscriberIdL(
       
  3552     const TTsyReqHandle aTsyReqHandle,
       
  3553     RMobilePhone::TMobilePhoneSubscriberId* aId )
       
  3554     {
       
  3555 	if ( 0 == iSubscriberId.Length() )
       
  3556 		{
       
  3557 		TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(EMultimodePhoneGetSubscriberId );
       
  3558 		if ( reqHandle == EMultimodePhoneReqHandleUnknown )
       
  3559 			{
       
  3560 			// IMSI has to be asynchronously requested from DOS.
       
  3561 			// (no packed parameters)
       
  3562 			TInt ret = iMessageManager->HandleRequestL( EMobilePhoneGetSubscriberId );
       
  3563 	
       
  3564 			if ( KErrNone == ret )
       
  3565 				{
       
  3566 				// DOS call successful, save request handle and return pointer
       
  3567 				// for completion
       
  3568 	            iReqHandleType = EMultimodePhoneGetSubscriberId;
       
  3569 				// save request handle in queue
       
  3570 				TSubscriberIdRequest* req = new (ELeave) TSubscriberIdRequest();
       
  3571 				req->iReqHandle = aTsyReqHandle;
       
  3572 				req->iRetSubscrId = aId;
       
  3573 				iSubscriberIdRequests.AppendL( req );
       
  3574 				}
       
  3575 			else
       
  3576 				{
       
  3577 				// DOS call failed, immediately complete with error
       
  3578 				ReqCompleted( aTsyReqHandle, ret );
       
  3579 				}
       
  3580 			}
       
  3581 		else
       
  3582 			{
       
  3583 			TFLOGSTRING("TSY: CMmPhoneTsy::GetSubscriberIdL - queued requests add req to queue");
       
  3584 			TSubscriberIdRequest* req = new (ELeave) TSubscriberIdRequest();
       
  3585 			req->iReqHandle = aTsyReqHandle;
       
  3586 			req->iRetSubscrId = aId;
       
  3587 			iSubscriberIdRequests.AppendL( req );
       
  3588 			}
       
  3589 		}
       
  3590 	else
       
  3591 		{
       
  3592 		// Complete with current IMSI
       
  3593 	    *aId = iSubscriberId;
       
  3594 		ReqCompleted( aTsyReqHandle, KErrNone );
       
  3595 		}
       
  3596 
       
  3597     return KErrNone;
       
  3598     }
       
  3599 
       
  3600 // ---------------------------------------------------------------------------
       
  3601 // CMmPhoneTsy::GetIndicatorCaps
       
  3602 // Returns the supported indicator capabilities
       
  3603 // (other items were commented in a header).
       
  3604 // ---------------------------------------------------------------------------
       
  3605 //
       
  3606 TInt CMmPhoneTsy::GetIndicatorCaps(
       
  3607     const TTsyReqHandle aTsyReqHandle,
       
  3608     TUint32* aActCaps,
       
  3609     TUint32* aIndCaps )
       
  3610     {
       
  3611     TInt ret( KErrGeneral );
       
  3612 
       
  3613 TFLOGSTRING("TSY: CMmPhoneTsy::GetIndicatorCaps" );
       
  3614     if(	 NULL != aActCaps && NULL != aIndCaps )
       
  3615     	{
       
  3616     	*aActCaps = RMobilePhone::KCapsGetIndicator | 
       
  3617             RMobilePhone::KCapsNotifyIndicatorChange; 
       
  3618     	*aIndCaps = RMobilePhone::KIndChargerConnected | 
       
  3619             RMobilePhone::KIndNetworkAvailable | 
       
  3620             RMobilePhone::KIndCallInProgress; 
       
  3621     	ret = KErrNone;
       
  3622     	}
       
  3623 
       
  3624     ReqCompleted( aTsyReqHandle, ret );
       
  3625 
       
  3626     return ret;
       
  3627     }
       
  3628 
       
  3629 // ---------------------------------------------------------------------------
       
  3630 // CMmPhoneTsy::GetIndicators
       
  3631 // Returns the phone indicators information to the client
       
  3632 // (other items were commented in a header).
       
  3633 // ---------------------------------------------------------------------------
       
  3634 //
       
  3635 TInt CMmPhoneTsy::GetIndicators(
       
  3636     const TTsyReqHandle aTsyReqHandle,
       
  3637     TUint32* aIndicators )
       
  3638     {
       
  3639 TFLOGSTRING( "TSY: CMmPhoneTsy::GetIndicators" );
       
  3640     TInt ret( KErrGeneral );
       
  3641 
       
  3642     if( aIndicators )
       
  3643     	{
       
  3644     	*aIndicators = GetIndicatorState();
       
  3645 		ret = KErrNone;
       
  3646     	}
       
  3647 
       
  3648     ReqCompleted( aTsyReqHandle, ret );
       
  3649 
       
  3650     return ret;
       
  3651     }
       
  3652 
       
  3653 // ---------------------------------------------------------------------------
       
  3654 // CMmPhoneTsy::GetIndicators
       
  3655 // Gets the current indicators state from different components
       
  3656 // (other items were commented in a header).
       
  3657 // ---------------------------------------------------------------------------
       
  3658 //
       
  3659 TUint32 CMmPhoneTsy::GetIndicatorState()
       
  3660 	{
       
  3661 	TUint32 indicators( 0 );
       
  3662 
       
  3663 	//Charger connected?
       
  3664 TFLOGSTRING2( "TSY: CMmPhoneTsy::GetIndicatorState charger: %d", (TInt)iBatteryInfo.iStatus );
       
  3665 	if( RMobilePhone::EBatteryConnectedButExternallyPowered == 
       
  3666         iBatteryInfo.iStatus )
       
  3667 		{
       
  3668 		indicators |= RMobilePhone::KIndChargerConnected;
       
  3669 		}
       
  3670 
       
  3671 	//Network available?
       
  3672 	if( iMmNetTsy )
       
  3673 		{
       
  3674 		RMobilePhone::TMobilePhoneRegistrationStatus networkRegStatus = 
       
  3675         iMmNetTsy->GetNetworkRegistrationStatus();
       
  3676 		if( RMobilePhone::ERegisteredOnHomeNetwork == networkRegStatus || 
       
  3677             RMobilePhone::ERegisteredRoaming == networkRegStatus )
       
  3678 			{
       
  3679 			indicators |= RMobilePhone::KIndNetworkAvailable;
       
  3680 			}
       
  3681 TFLOGSTRING2( "TSY: CMmPhoneTsy::GetIndicatorState network: %d", (TInt)networkRegStatus );
       
  3682 		}
       
  3683 
       
  3684 	//Call in progress?
       
  3685 	//-Browses through the call list to find any calls that are currently 
       
  3686     //connected
       
  3687 	TInt numberOfCallObjects = CallList()->GetNumberOfObjects();
       
  3688 	for ( TInt i=0; i<numberOfCallObjects; i++ )
       
  3689     	{
       
  3690 		CMmCallTsy* mmCall = CallList()->GetMmCallByIndex( i );
       
  3691 		if ( RMobileCall::EStatusConnected == mmCall->MobileCallStatus() )
       
  3692 			{
       
  3693 TFLOGSTRING3( "TSY: CMmPhoneTsy::GetIndicatorState call id: %d, status: %d", mmCall->CallId(), (TInt)mmCall->MobileCallStatus() );
       
  3694 			indicators |= RMobilePhone::KIndCallInProgress;
       
  3695 			break;
       
  3696 			}
       
  3697 		}
       
  3698 TFLOGSTRING2( "TSY: CMmPhoneTsy::GetIndicatorState - ok, Indicators: %d", indicators );
       
  3699 
       
  3700     return indicators;
       
  3701 	}
       
  3702 
       
  3703 // ---------------------------------------------------------------------------
       
  3704 // CMmPhoneTsy::CompleteGetSubscriberIdL
       
  3705 // Completes GetSubscriberId and delivers IMSI to client.
       
  3706 // (other items were commented in a header).
       
  3707 // ---------------------------------------------------------------------------
       
  3708 //
       
  3709 void CMmPhoneTsy::CompleteGetSubscriberIdL(
       
  3710     TBuf8<RMobilePhone::KIMSISize> aImsiData,
       
  3711     TInt aError )
       
  3712     {
       
  3713 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetSubscriberIdL, aError=%d", aError );
       
  3714 
       
  3715     // Set the flag to EFalse
       
  3716     iTSYSubscriberIdReq = EFalse;
       
  3717     
       
  3718     RMobilePhone::TMobilePhoneSubscriberId subscriberIdTmp;
       
  3719     subscriberIdTmp.Zero();  
       
  3720   
       
  3721     // Retrieve previous IMSI value from the Central Repository
       
  3722 	iCFISPrivateCentRep->Get( KCtsyIMSI, subscriberIdTmp );
       
  3723 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetSubscriberIdL - Get old IMSI from CenRep: %S", &subscriberIdTmp );
       
  3724 	
       
  3725     if ( ( KErrNone == aError ) && ( 0 < aImsiData.Length() ) )
       
  3726         {
       
  3727         // Copy new IMSI value to the member variable
       
  3728         iSubscriberId.Copy( aImsiData.Left( aImsiData.Length() ) );
       
  3729 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetSubscriberIdL - Copy new IMSI: %S", &iSubscriberId );
       
  3730         }
       
  3731     
       
  3732     // check the boot state security, is the security ready (PIN query)
       
  3733     if ( iBootState.iSecReady )
       
  3734         {
       
  3735 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetSubscriberIdL - Security ready");
       
  3736   
       
  3737         // Check has the IMSI changed and is there previous info: or an error
       
  3738         if ( KErrNotFound == subscriberIdTmp.Match( iSubscriberId ) && 
       
  3739         	subscriberIdTmp.Length() != 0 ||
       
  3740         	KErrNone != aError )     
       
  3741             {
       
  3742             // Reset ME ALS info
       
  3743             ResetMEAlsInfo();
       
  3744             //Reset CFIS data from public CR
       
  3745             iCFISCentRep->Reset();
       
  3746             //Reset MWIS data from public CR
       
  3747             iMWISCentRep->Reset();
       
  3748             //Reset private side CR
       
  3749             iCFISPrivateCentRep->Reset();
       
  3750             // Reset MWIS support
       
  3751             iMmSupplServTsy->SetIccSupportForMWIS( ETrue );   
       
  3752 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetSubscriberIdL - Central Repositories have been reseted!");     
       
  3753             
       
  3754             // intialize the previous SIM related data
       
  3755             if ( iMmCustomTsy )
       
  3756                 { 
       
  3757                 iMmCustomTsy->SetIccCfBootUpFlag( ETrue );
       
  3758                 }
       
  3759             iMmSupplServTsy->SetIccMwisBootUpFlag( ETrue );
       
  3760             
       
  3761             // get new infromation from lower levels, if sim is ready
       
  3762             if ( iBootState.iSIMReady )
       
  3763                 {                       
       
  3764 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetSubscriberIdL - SIM ready, retrive intial ICC SIM data."); 
       
  3765 
       
  3766                 // update ALS line information 
       
  3767                 iMessageManager->HandleRequestL( EMobilePhoneGetALSLine );
       
  3768                 // update call forward information
       
  3769                 iMessageManager->HandleRequestL( 
       
  3770                     EMmTsyGetCallForwardingNumberIPC );
       
  3771                 // Get Icc call forwarding status
       
  3772                 iMessageManager->HandleRequestL( 
       
  3773                     ECustomGetIccCallForwardingStatusIPC );
       
  3774                 // Get message waiting indicators
       
  3775                 iMessageManager->HandleRequestL( 
       
  3776                     EMobilePhoneGetIccMessageWaitingIndicators );
       
  3777                 }   
       
  3778             }
       
  3779         }
       
  3780         
       
  3781     if ( ( KErrNone == aError ) && 
       
  3782         ( 0 < aImsiData.Length() ) && 
       
  3783         KErrNotFound == subscriberIdTmp.Match( iSubscriberId ) )
       
  3784         {    
       
  3785     	// Write new IMSI value to the central repository
       
  3786     	iCFISPrivateCentRep->Set( KCtsyIMSI, iSubscriberId );
       
  3787 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetSubscriberIdL - Write new IMSI to the CenRep: %S", &iSubscriberId );
       
  3788         }
       
  3789         
       
  3790     //reset req handle. Returns the deleted req handle
       
  3791     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3792         EMultimodePhoneGetSubscriberId );
       
  3793 
       
  3794     for ( TInt i=0; i < iSubscriberIdRequests.Count(); i++ )
       
  3795         {
       
  3796         TSubscriberIdRequest* req = iSubscriberIdRequests[ i ];
       
  3797         *(req->iRetSubscrId) = iSubscriberId;
       
  3798         ReqCompleted( req->iReqHandle, aError );
       
  3799         }
       
  3800         
       
  3801     iSubscriberIdRequests.ResetAndDestroy();
       
  3802     }
       
  3803 
       
  3804 // ---------------------------------------------------------------------------
       
  3805 // CMmPhoneTsy::GetSubscriberIdCancel
       
  3806 // Cancels an outstanding GetSubscriberId request.
       
  3807 // (other items were commented in a header).
       
  3808 // ---------------------------------------------------------------------------
       
  3809 //
       
  3810 TInt CMmPhoneTsy::GetSubscriberIdCancel(
       
  3811     const TTsyReqHandle aTsyReqHandle )
       
  3812     {
       
  3813     // If there is only one request, reset the req handle
       
  3814     if( 1 == iSubscriberIdRequests.Count() )
       
  3815     	{
       
  3816 		TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3817         	EMultimodePhoneGetSubscriberId );    	
       
  3818     	}
       
  3819 
       
  3820     // Delete and remove cancelled request from the array
       
  3821 	for ( TInt i = 0; i < iSubscriberIdRequests.Count(); i++ )
       
  3822 		{
       
  3823 	  	TSubscriberIdRequest* req = iSubscriberIdRequests[ i ];
       
  3824 	  	
       
  3825 	  	if( aTsyReqHandle == req->iReqHandle  )
       
  3826 	  		{
       
  3827 	  	    delete iSubscriberIdRequests[ i ];
       
  3828 	  		iSubscriberIdRequests.Remove(i);
       
  3829 	  		ReqCompleted( aTsyReqHandle, KErrCancel );
       
  3830 	  		break;	
       
  3831 	  		}
       
  3832 		}
       
  3833 
       
  3834     return KErrNone;
       
  3835     }
       
  3836 
       
  3837 // ---------------------------------------------------------------------------
       
  3838 // CMmPhoneTsy::GetALSLineL
       
  3839 // This method allows a client to find out which voice line is currently
       
  3840 // selected as the active ALS line for outgoing voice calls.
       
  3841 // (other items were commented in a header).
       
  3842 // ---------------------------------------------------------------------------
       
  3843 //
       
  3844 TInt CMmPhoneTsy::GetALSLineL(
       
  3845     const TTsyReqHandle aTsyReqHandle,
       
  3846     RMobilePhone::TMobilePhoneALSLine* aALSLine )
       
  3847     {
       
  3848 TFLOGSTRING("TSY: CMmPhoneTsy::GetALSLineL");
       
  3849 	
       
  3850     TInt ret ( KErrNone );
       
  3851 	TBool alsSupportedBySim;
       
  3852 	
       
  3853 	//Get als  support info
       
  3854 	iCentRep->Get( KCtsyMEAlsSupported, alsSupportedBySim );
       
  3855     
       
  3856 	//Get TSY req. handle
       
  3857     TTsyReqHandle phoneGetAlsLineHandle = iTsyReqHandleStore->GetTsyReqHandle( 
       
  3858 		EMultimodePhoneGetAlsLine );
       
  3859     
       
  3860     //The request is already in processing because of previous request
       
  3861     //Complete request with status value informing the client about
       
  3862 	if( EMultimodePhoneReqHandleUnknown != phoneGetAlsLineHandle )
       
  3863 		{
       
  3864 		TGetAlsLineRequest* req = new (ELeave) TGetAlsLineRequest();
       
  3865 		req->iReqHandle = aTsyReqHandle;
       
  3866 		req->iALSLine = aALSLine;
       
  3867 		iGetAlsLineRequests.AppendL( req );
       
  3868 		}
       
  3869 	else
       
  3870 		{
       
  3871 		if ( RMobilePhone::EAlternateLineUnknown == iAlsLine && 
       
  3872 			alsSupportedBySim ) 
       
  3873 			{ 
       
  3874 			// no packed parameters for DOS call 
       
  3875 			ret = iMessageManager->HandleRequestL( EMobilePhoneGetALSLine ); 
       
  3876 			//check success
       
  3877 			if ( KErrNone == ret )
       
  3878 				{
       
  3879 				//save tsy req handle type 
       
  3880 				iReqHandleType = EMultimodePhoneGetAlsLine; 
       
  3881 				
       
  3882 				// save request in queue for completion
       
  3883 				TGetAlsLineRequest* req = new (ELeave) TGetAlsLineRequest();
       
  3884 				req->iReqHandle = aTsyReqHandle;
       
  3885 				req->iALSLine = aALSLine;
       
  3886 				iGetAlsLineRequests.AppendL( req );
       
  3887 				}
       
  3888 			}
       
  3889 		 
       
  3890 		else if( RMobilePhone::EAlternateLineUnknown != iAlsLine && 
       
  3891 			alsSupportedBySim ) 
       
  3892 			{ 
       
  3893 			// set value in client side 
       
  3894 			*aALSLine = iAlsLine; 
       
  3895 			// complete immediately 
       
  3896 			ReqCompleted ( aTsyReqHandle, KErrNone ); 
       
  3897 			}
       
  3898 			
       
  3899 		else if ( !alsSupportedBySim )
       
  3900 		    {	    
       
  3901 		    TInt tempLine(0);
       
  3902 		    
       
  3903 		    //Get Default als info from Central Repository
       
  3904 		    ret = iCentRep->Get( KCtysMEAlsLineInfo, tempLine );		    
       
  3905 		   	
       
  3906 		   	RMobilePhone::TMobilePhoneALSLine alsline = MapMEALSLine( tempLine );
       
  3907 		   	
       
  3908 		   	if( KErrNone == ret )
       
  3909 		   		{
       
  3910 		   		// set default value in client side 
       
  3911 				*aALSLine = alsline; 
       
  3912 		   		}
       
  3913 			// complete immediately 
       
  3914 			ReqCompleted ( aTsyReqHandle, ret );
       
  3915 		    } 
       
  3916 		}
       
  3917 
       
  3918     return ret;
       
  3919     }
       
  3920 
       
  3921 // ---------------------------------------------------------------------------
       
  3922 // CMmPhoneTsy::GetAlsLineCancel
       
  3923 // Cancels an outstanding GetAlsLine request.
       
  3924 // (other items were commented in a header).
       
  3925 // ---------------------------------------------------------------------------
       
  3926 //
       
  3927 TInt CMmPhoneTsy::GetAlsLineCancel(
       
  3928 	const TTsyReqHandle aTsyReqHandle )
       
  3929     {
       
  3930 
       
  3931     //reset the req handle
       
  3932     if( 1 == iGetAlsLineRequests.Count() )
       
  3933     	{
       
  3934 		TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3935         	EMultimodePhoneGetAlsLine );    	
       
  3936     	}
       
  3937 	
       
  3938 	for ( TInt i = 0; i < iGetAlsLineRequests.Count(); i++ )
       
  3939 		{
       
  3940 	  	TGetAlsLineRequest* req = iGetAlsLineRequests[ i ];
       
  3941 	  	
       
  3942 	  	if( aTsyReqHandle == req->iReqHandle  )
       
  3943 	  		{
       
  3944 	  		ReqCompleted( req->iReqHandle, KErrCancel );
       
  3945 	  		delete iGetAlsLineRequests[ i ];
       
  3946 	  		iGetAlsLineRequests.Remove(i);
       
  3947 	  		break;	
       
  3948 	  		}
       
  3949 		}
       
  3950 		
       
  3951     return KErrNone;
       
  3952     }
       
  3953 
       
  3954 // ---------------------------------------------------------------------------
       
  3955 // CMmPhoneTsy::CompleteGetAlsLine
       
  3956 // Completes a GetAlsLine request
       
  3957 // (other items were commented in a header).
       
  3958 // ---------------------------------------------------------------------------
       
  3959 //
       
  3960 void CMmPhoneTsy::CompleteGetAlsLine(
       
  3961     RMobilePhone::TMobilePhoneALSLine aAlsStatus,
       
  3962     TInt aErrorCode )
       
  3963     {
       
  3964 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetAlsLine - ALS line" );
       
  3965 
       
  3966     //check if value has been updated
       
  3967     if ( aAlsStatus != iAlsLine )
       
  3968         {
       
  3969         //save value in tsy
       
  3970         iAlsLine = aAlsStatus;
       
  3971         iCentRep->Set( KCtysMEAlsLineInfo, aAlsStatus );
       
  3972         }
       
  3973 
       
  3974 	//reset req handle. Returns the deleted req handle
       
  3975     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  3976 		EMultimodePhoneGetAlsLine );
       
  3977 
       
  3978     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  3979         {
       
  3980 		for ( TInt i = 0; i < iGetAlsLineRequests.Count(); i++ )
       
  3981 			{
       
  3982 		  	TGetAlsLineRequest* req = iGetAlsLineRequests[ i ];
       
  3983 			//set value in client side
       
  3984 		  	*(req->iALSLine) = aAlsStatus;
       
  3985             // Complete the client request
       
  3986             ReqCompleted( req->iReqHandle, aErrorCode );
       
  3987 			}
       
  3988 		//Destroy Array 
       
  3989 		iGetAlsLineRequests.ResetAndDestroy();
       
  3990         }
       
  3991     }
       
  3992 
       
  3993 // ---------------------------------------------------------------------------
       
  3994 // CMmPhoneTsy::SetALSLineL
       
  3995 // This method allows a client to set which voice line is currently
       
  3996 // selected as the active ALS line for outgoing voice calls.
       
  3997 // (other items were commented in a header).
       
  3998 // ---------------------------------------------------------------------------
       
  3999 //
       
  4000 TInt CMmPhoneTsy::SetALSLineL(
       
  4001     const TTsyReqHandle aTsyReqHandle,
       
  4002     RMobilePhone::TMobilePhoneALSLine* aALSLine )
       
  4003     {
       
  4004 TFLOGSTRING("TSY: CMmPhoneTsy::SetALSLineL");
       
  4005     TInt ret ( KErrNone );
       
  4006 	TBool alsSupportedBySim ( EFalse );
       
  4007 	
       
  4008 	//Get als support info
       
  4009 	iCentRep->Get( KCtsyMEAlsSupported, alsSupportedBySim );
       
  4010 	
       
  4011 	//check if handle is not used for Get and Set
       
  4012 	if ( ( EMultimodePhoneReqHandleUnknown == iTsyReqHandleStore->
       
  4013            GetTsyReqHandle( EMultimodePhoneGetAlsLine ) ) &&
       
  4014 	     ( EMultimodePhoneReqHandleUnknown == iTsyReqHandleStore->
       
  4015 		   GetTsyReqHandle( EMultimodePhoneSetAlsLine ) ) 
       
  4016 		   && alsSupportedBySim )
       
  4017         {
       
  4018         //save the new ALS value temporarily, will be used in the completion
       
  4019         iTempAlsLine = *aALSLine;
       
  4020 
       
  4021         CMmDataPackage data;
       
  4022 		data.PackData ( aALSLine );
       
  4023 
       
  4024 		// parameter for DOS call: RMobilePhone::TMobilePhoneALSLine
       
  4025 		ret = iMessageManager->HandleRequestL( EMobilePhoneSetALSLine, &data );
       
  4026 
       
  4027         //check success
       
  4028         if ( KErrNone == ret )
       
  4029         	{
       
  4030         	//save tsy req handle type
       
  4031             iReqHandleType = EMultimodePhoneSetAlsLine;
       
  4032         	}
       
  4033         }
       
  4034     else if ( ( EMultimodePhoneReqHandleUnknown == iTsyReqHandleStore->
       
  4035            GetTsyReqHandle( EMultimodePhoneGetAlsLine ) ) &&
       
  4036 	     ( EMultimodePhoneReqHandleUnknown == iTsyReqHandleStore->
       
  4037 		   GetTsyReqHandle( EMultimodePhoneSetAlsLine ) ) && 
       
  4038 		   !alsSupportedBySim )
       
  4039         {        
       
  4040         //Reset previous Info
       
  4041         iCentRep->Reset();
       
  4042         
       
  4043         //ME based ALS is used
       
  4044        	ret = iCentRep->Set( KCtysMEAlsLineInfo, *aALSLine );	
       
  4045         
       
  4046         //Set default ALS Value
       
  4047         if( KErrNone == ret )
       
  4048 	        {
       
  4049 	        iAlsLine = *aALSLine;
       
  4050 	        //NotifyClient about als line change
       
  4051 	        CompleteNotifyALSLineChange();
       
  4052 	        ReqCompleted( aTsyReqHandle, ret );	
       
  4053 	        }
       
  4054 		else	
       
  4055 			{
       
  4056 			ret = KErrWrite;
       
  4057 			} 
       
  4058         }
       
  4059 	else
       
  4060 		{
       
  4061 		ret = KErrServerBusy;	
       
  4062 		}       
       
  4063 
       
  4064     return ret;
       
  4065     }
       
  4066 
       
  4067 // ---------------------------------------------------------------------------
       
  4068 // CMmPhoneTsy::CompleteSetAlsLine
       
  4069 // Completes SetAlsLine request. If notification of ALS line change has been 
       
  4070 // requested by the client, the notification is completed as well.
       
  4071 // (other items were commented in a header).
       
  4072 // ---------------------------------------------------------------------------
       
  4073 //
       
  4074 void CMmPhoneTsy::CompleteSetAlsLine(
       
  4075     TInt aErrorCode )
       
  4076     {
       
  4077 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteSetAlsLine - ALS line: %d", iTempAlsLine );
       
  4078 
       
  4079     //reset req handle. Returns the deleted req handle
       
  4080     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  4081     	EMultimodePhoneSetAlsLine );
       
  4082 
       
  4083     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  4084         {
       
  4085         //if operation has been successful
       
  4086         if ( KErrNone == aErrorCode )
       
  4087             {
       
  4088             //save the temporary value in iAlsLine
       
  4089             iAlsLine = iTempAlsLine;
       
  4090 
       
  4091             CompleteNotifyALSLineChange();
       
  4092             }
       
  4093         ReqCompleted( reqHandle, aErrorCode );
       
  4094         }
       
  4095     }
       
  4096 
       
  4097 // ---------------------------------------------------------------------------
       
  4098 // CMmPhoneTsy::NotifyALSLineChange
       
  4099 // This method allows a client to be notified if the currently selected
       
  4100 // ALS line changes.
       
  4101 // (other items were commented in a header).
       
  4102 // ---------------------------------------------------------------------------
       
  4103 //
       
  4104 TInt CMmPhoneTsy::NotifyALSLineChange(
       
  4105     RMobilePhone::TMobilePhoneALSLine* aALSLine )
       
  4106     {
       
  4107     iRetNotifyALSLine = aALSLine;
       
  4108     //save tsy req handle type
       
  4109     iReqHandleType = EMultimodePhoneNotifyAlsLineChange;
       
  4110 
       
  4111     return KErrNone;
       
  4112     }
       
  4113 
       
  4114 // ---------------------------------------------------------------------------
       
  4115 // CMmPhoneTsy::NotifyALSLineChangeCancel
       
  4116 // This method cancels an outstanding asynchronous NotifyALSLineChange request
       
  4117 // (other items were commented in a header).
       
  4118 // ---------------------------------------------------------------------------
       
  4119 //
       
  4120 TInt CMmPhoneTsy::NotifyALSLineChangeCancel(
       
  4121     const TTsyReqHandle aTsyReqHandle )
       
  4122     {
       
  4123     iRetNotifyALSLine = NULL;
       
  4124     iTsyReqHandleStore->ResetTsyReqHandle( 
       
  4125         EMultimodePhoneNotifyAlsLineChange );
       
  4126     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  4127 
       
  4128     return KErrNone;
       
  4129     }
       
  4130 
       
  4131 // ---------------------------------------------------------------------------
       
  4132 // CMmPhoneTsy::CompleteNotifyALSLineChange
       
  4133 // This method completes an outstanding asynchronous NotifyALSLineChange
       
  4134 // request.
       
  4135 // (other items were commented in a header).
       
  4136 // ---------------------------------------------------------------------------
       
  4137 //
       
  4138 void CMmPhoneTsy::CompleteNotifyALSLineChange()
       
  4139     {
       
  4140     //reset req handle. Returns the deleted req handle
       
  4141     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  4142   		EMultimodePhoneNotifyAlsLineChange );
       
  4143 
       
  4144     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  4145         {
       
  4146         //copy data in client space
       
  4147         *iRetNotifyALSLine = iAlsLine;
       
  4148         //reset pointer to client space
       
  4149         iRetNotifyALSLine = NULL;
       
  4150 
       
  4151         // Complete the client request
       
  4152         ReqCompleted( reqHandle, KErrNone );
       
  4153         }
       
  4154     }
       
  4155 
       
  4156 // ---------------------------------------------------------------------------
       
  4157 // CMmPhoneTsy::GetFdnStatusL
       
  4158 // Retrieves the current status of the Fixed Dialling Numbers service.
       
  4159 // (other items were commented in a header).
       
  4160 // ---------------------------------------------------------------------------
       
  4161 //
       
  4162 TInt CMmPhoneTsy::GetFdnStatusL(
       
  4163     const TTsyReqHandle aTsyReqHandle,
       
  4164     RMobilePhone::TMobilePhoneFdnStatus* aFdnStatus )
       
  4165     {
       
  4166 TFLOGSTRING( "TSY: CMmPhoneTsy::GetFdnStatusL" );
       
  4167 
       
  4168     TInt ret ( KErrServerBusy );
       
  4169 
       
  4170     //check if handle is not in use already
       
  4171     TTsyReqHandle phoneSetLockSettingHandle =
       
  4172             iTsyReqHandleStore->GetTsyReqHandle( EMultimodePhoneGetFdnStatus );
       
  4173 
       
  4174 	if ( EMultimodePhoneReqHandleUnknown == phoneSetLockSettingHandle )
       
  4175         {
       
  4176         //save the setting information for later use
       
  4177         iRetGetFdnStatus = aFdnStatus;
       
  4178 
       
  4179         //call the extension to handle this request
       
  4180         ret = iMmPhoneExtInterface->GetFdnStatusL( );
       
  4181 
       
  4182         if ( KErrNone == ret )
       
  4183             {
       
  4184             //Set tsy req handle. Must be done already here so that
       
  4185             //CompleteNotifySecurityEvent can complete request if it
       
  4186             //unable to notify client about the situation.
       
  4187 #ifdef REQHANDLE_TIMER
       
  4188             SetTypeOfResponse( EMultimodePhoneGetFdnStatus, aTsyReqHandle );      
       
  4189 #else
       
  4190             // Never comes here. See SetTypeOfResponse.
       
  4191             iTsyReqHandleStore->SetTsyReqHandle(
       
  4192                     EMultimodePhoneGetFdnStatus, aTsyReqHandle );
       
  4193 #endif // REQHANDLE_TIMER
       
  4194             }
       
  4195         }
       
  4196 
       
  4197     return ret;
       
  4198     }
       
  4199 
       
  4200 // ---------------------------------------------------------------------------
       
  4201 // CMmPhoneTsy::CompleteGetFdnStatus
       
  4202 // Completes an outstanding asynchronous GetFdnStatus request.
       
  4203 // (other items were commented in a header).
       
  4204 // ---------------------------------------------------------------------------
       
  4205 //
       
  4206 void CMmPhoneTsy::CompleteGetFdnStatus(
       
  4207         CMmDataPackage* aDataPackage,
       
  4208         TInt aErrorCode )
       
  4209     {
       
  4210 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetFdnStatus - Error: %d", aErrorCode );
       
  4211 
       
  4212 
       
  4213     //reset req handle. Returns the deleted req handle
       
  4214     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  4215                                 EMultimodePhoneGetFdnStatus );
       
  4216 
       
  4217     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  4218         {
       
  4219         if( KErrNone == aErrorCode )
       
  4220             {
       
  4221             //unpack the data
       
  4222             RMobilePhone::TMobilePhoneFdnStatus* fdnStatus = NULL;
       
  4223             aDataPackage->UnPackData (&fdnStatus );
       
  4224             *iRetGetFdnStatus = *fdnStatus;
       
  4225             }
       
  4226         
       
  4227         //null the pointer to client side
       
  4228         iRetGetFdnStatus = NULL;
       
  4229         // Complete the client request
       
  4230         ReqCompleted( reqHandle, aErrorCode );
       
  4231         }
       
  4232     }
       
  4233 
       
  4234 // ---------------------------------------------------------------------------
       
  4235 // CMmPhoneTsy::GetFdnStatusCancel
       
  4236 // This method cancels an outstanding asynchronous GetFdnStatus request
       
  4237 // (other items were commented in a header).
       
  4238 // ---------------------------------------------------------------------------
       
  4239 //
       
  4240 TInt CMmPhoneTsy::GetFdnStatusCancel(
       
  4241     const TTsyReqHandle aTsyReqHandle )
       
  4242     {
       
  4243 TFLOGSTRING( "TSY: CMmPhoneTsy::GetFdnStatusCancel" );
       
  4244     iRetGetFdnStatus = NULL;
       
  4245     
       
  4246     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePhoneGetFdnStatus );
       
  4247     
       
  4248     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  4249 
       
  4250     return KErrNone;
       
  4251     }
       
  4252 
       
  4253 // ---------------------------------------------------------------------------
       
  4254 // CMmPhoneTsy::SetFdnSettingL
       
  4255 // This method activates (ON) or deactivates (OFF) the Fixed
       
  4256 // Dialling Numbers (FDN) service
       
  4257 // (other items were commented in a header).
       
  4258 // ---------------------------------------------------------------------------
       
  4259 //
       
  4260 TInt CMmPhoneTsy::SetFdnSettingL(
       
  4261     const TTsyReqHandle aTsyReqHandle,
       
  4262     const TDataPackage& aPackage )
       
  4263     {
       
  4264     //PIN2 must be verified prior setting the fdn setting, launch
       
  4265     //a security event to inform the client. Wait until
       
  4266     //VerifySecurityCode is completed
       
  4267     iMmSecurityTsy->CompleteNotifySecurityEventL( RMobilePhone::EPin2Required,
       
  4268                                          KErrNone );
       
  4269 
       
  4270     //save the setting information for later use
       
  4271     iRetFdnSetting = reinterpret_cast<RMobilePhone::TMobilePhoneFdnSetting*>
       
  4272         ( aPackage.Ptr1() );
       
  4273 
       
  4274     //the SetFdnSetting is already ongoing, save the request type.
       
  4275     //don't wait for DoExtFuncL to store it ( the normal procedure )
       
  4276     //as CompleteNotifySecurityEvent
       
  4277     //will trigger a notification repost and this repost
       
  4278     //will overwrite the internal attribute iReqHandleType
       
  4279     iTsyReqHandleStore->SetTsyReqHandle( EMultimodePhoneSetFdnSetting,
       
  4280                                              aTsyReqHandle );
       
  4281     return KErrNone;
       
  4282     }
       
  4283 
       
  4284 // ---------------------------------------------------------------------------
       
  4285 // CMmPhoneTsy::CompleteSetFdnSettingL
       
  4286 // This method completes an outstanding asynchronous SetFdnSetting request
       
  4287 // (other items were commented in a header).
       
  4288 // ---------------------------------------------------------------------------
       
  4289 //
       
  4290 void CMmPhoneTsy::CompleteSetFdnSettingL(
       
  4291     TInt aErrorCode )
       
  4292     {
       
  4293 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteSetFdnSettingL - Error: %d",
       
  4294     aErrorCode);
       
  4295 
       
  4296     //reset req handle. Returns the deleted req handle
       
  4297     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  4298                                 EMultimodePhoneSetFdnSetting );
       
  4299 
       
  4300     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  4301         {
       
  4302         RMobilePhone::TMobilePhoneFdnSetting retFdnSetting = *iRetFdnSetting;
       
  4303 
       
  4304         if ( KErrNone == aErrorCode )
       
  4305             {            
       
  4306             //trigger the FDN notification completion
       
  4307             CompleteNotifyFdnStatusChange();
       
  4308 
       
  4309             //reset pointer to the client space.
       
  4310             iRetFdnSetting = NULL;
       
  4311 
       
  4312             //Complete the request before checking if the ADN
       
  4313             //Should be cached, the UI gets freezed for a couple of seconds
       
  4314             //if the ADN is being cached before completeing the Fdn setting
       
  4315             ReqCompleted( reqHandle, KErrNone );
       
  4316 
       
  4317             //check if the Fdn has been set off, the ADN cache is not
       
  4318             //done if the phone boots with FDN on, thefore we have to
       
  4319             //cache it at this point
       
  4320             if ( RMobilePhone::EFdnSetOff == retFdnSetting )
       
  4321                 {
       
  4322                 for( TInt i = 0; i < iPBList->GetNumberOfObjects(); i++ )
       
  4323                     {
       
  4324                     //Get pbStore object
       
  4325                     CMmPhoneBookStoreTsy* pbStore = iPBList->
       
  4326                         GetMmPBByIndex( i );
       
  4327                     //check if the current phonebook is ADN
       
  4328                     if ( 0 == pbStore->PhoneBookName()->CompareF(
       
  4329                                                     KETelIccAdnPhoneBook ) )
       
  4330                         {
       
  4331                         //Start to cache phonebook entries.
       
  4332                         pbStore->CacheEntriesL();
       
  4333                         }
       
  4334                     }
       
  4335                 }
       
  4336             }
       
  4337         else
       
  4338             {
       
  4339             //reset pointer to the client space.
       
  4340             iRetFdnSetting = NULL;
       
  4341 
       
  4342             ReqCompleted( reqHandle, aErrorCode );
       
  4343             }
       
  4344 
       
  4345         }
       
  4346     }
       
  4347 
       
  4348 // ---------------------------------------------------------------------------
       
  4349 // CMmPhoneTsy::NotifyFdnStatusChange
       
  4350 // This request allows a client to be notified when the status
       
  4351 // of the FDN service has changed
       
  4352 // (other items were commented in a header).
       
  4353 // ---------------------------------------------------------------------------
       
  4354 //
       
  4355 TInt CMmPhoneTsy::NotifyFdnStatusChange(
       
  4356     RMobilePhone::TMobilePhoneFdnStatus* aStatus )
       
  4357     {
       
  4358     iRetNotifyFdnStatus = aStatus;
       
  4359     //save tsy req handle type
       
  4360     iReqHandleType = EMultimodePhoneNotifyFdnStatusChange;
       
  4361 
       
  4362     return KErrNone;
       
  4363     }
       
  4364 
       
  4365 // ---------------------------------------------------------------------------
       
  4366 // CMmPhoneTsy::NotifyFdnStatusChangeCancel
       
  4367 // This method cancels an outstanding asynchronous NotifyFdnStatusChange req.
       
  4368 // (other items were commented in a header).
       
  4369 // ---------------------------------------------------------------------------
       
  4370 //
       
  4371 TInt CMmPhoneTsy::NotifyFdnStatusChangeCancel(
       
  4372     const TTsyReqHandle aTsyReqHandle )
       
  4373     {
       
  4374 
       
  4375     iRetNotifyFdnStatus = NULL;
       
  4376     iTsyReqHandleStore->ResetTsyReqHandle
       
  4377         ( EMultimodePhoneNotifyFdnStatusChange );
       
  4378     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  4379 
       
  4380 
       
  4381     return KErrNone;
       
  4382     }
       
  4383 
       
  4384 // ---------------------------------------------------------------------------
       
  4385 // CMmPhoneTsy::CompleteNotifyFdnStatusChange
       
  4386 // This method cancels an outstanding asynchronous NotifyFdnStatusChange req.
       
  4387 // (other items were commented in a header).
       
  4388 // ---------------------------------------------------------------------------
       
  4389 //
       
  4390 void CMmPhoneTsy::CompleteNotifyFdnStatusChange()
       
  4391     {
       
  4392     //reset req handle. Returns the deleted req handle
       
  4393     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  4394                                 EMultimodePhoneNotifyFdnStatusChange );
       
  4395 
       
  4396     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  4397         {
       
  4398         //map the value of the used in the setting
       
  4399         //we asume first that the status is on
       
  4400         *iRetNotifyFdnStatus = RMobilePhone::EFdnActive;
       
  4401         //if the status is off change the value
       
  4402         if (  RMobilePhone::EFdnSetOff == *iRetFdnSetting )
       
  4403             {
       
  4404             *iRetNotifyFdnStatus = RMobilePhone::EFdnNotActive;
       
  4405             }
       
  4406         // Complete the client request
       
  4407         ReqCompleted( reqHandle, KErrNone );
       
  4408         }
       
  4409     }
       
  4410 
       
  4411 // ---------------------------------------------------------------------------
       
  4412 // CMmPhoneTsy::PhoneExtInterface
       
  4413 // This method returns pointer to active phone extension object
       
  4414 // (other items were commented in a header).
       
  4415 // ---------------------------------------------------------------------------
       
  4416 //
       
  4417 CMmPhoneExtInterface* CMmPhoneTsy::PhoneExtInterface()
       
  4418     {
       
  4419     return iMmPhoneExtInterface;
       
  4420     }
       
  4421 
       
  4422 // ---------------------------------------------------------------------------
       
  4423 // CMmPhoneTsy::SetConferenceCall
       
  4424 // This method returns a pointer to
       
  4425 // CMmConferenceCallMessHandlerGsmWcdmaExt object
       
  4426 // (other items were commented in a header).
       
  4427 // ---------------------------------------------------------------------------
       
  4428 //
       
  4429 void CMmPhoneTsy::SetConferenceCall(
       
  4430     CMmConferenceCallTsy* aMmConferenceCallTsy )
       
  4431     {
       
  4432     iMmConferenceCall = aMmConferenceCallTsy;
       
  4433     }
       
  4434 
       
  4435 // ---------------------------------------------------------------------------
       
  4436 // CMmPhoneTsy::ConferenceCall
       
  4437 // This method returns a pointer to
       
  4438 // CMmConferenceCallMessHandlerGsmWcdmaExt object
       
  4439 // (other items were commented in a header).
       
  4440 // ---------------------------------------------------------------------------
       
  4441 //
       
  4442 CMmConferenceCallTsy* CMmPhoneTsy::ConferenceCall()
       
  4443     {
       
  4444 
       
  4445     return iMmConferenceCall;
       
  4446 
       
  4447     }
       
  4448 
       
  4449 // ---------------------------------------------------------------------------
       
  4450 // CMmPhoneTsy::SmsSession
       
  4451 // Gives pointer to SMS messaging session
       
  4452 // (other items were commented in a header).
       
  4453 // ---------------------------------------------------------------------------
       
  4454 //
       
  4455 CMmSmsTsy* CMmPhoneTsy::SmsSession()
       
  4456     {
       
  4457     return iMmSmsTsy;
       
  4458     }
       
  4459 
       
  4460 // ---------------------------------------------------------------------------
       
  4461 // CMmPhoneTsy::SmsService
       
  4462 // Gives pointer to SMS messaging session as a MCtsySatService
       
  4463 // (other items were commented in a header).
       
  4464 // ---------------------------------------------------------------------------
       
  4465 //
       
  4466 MCtsySatService& CMmPhoneTsy::SmsService()
       
  4467     {
       
  4468     return *iMmSmsTsy;
       
  4469     }
       
  4470 
       
  4471 // ---------------------------------------------------------------------------
       
  4472 // CMmPhoneTsy::SetSmsSession
       
  4473 // Set SMS messaging session
       
  4474 // (other items were commented in a header).
       
  4475 // ---------------------------------------------------------------------------
       
  4476 //
       
  4477 void CMmPhoneTsy::SetSmsSession(
       
  4478     CMmSmsTsy* aMmSmsTsy )
       
  4479     {
       
  4480     iMmSmsTsy = aMmSmsTsy;
       
  4481     }
       
  4482 
       
  4483 // ---------------------------------------------------------------------------
       
  4484 // CMmPhoneTsy::PacketDataSession
       
  4485 // Gives pointer to Packet Data session
       
  4486 // (other items were commented in a header).
       
  4487 // ---------------------------------------------------------------------------
       
  4488 //
       
  4489 CMmPacketServiceTsy* CMmPhoneTsy::PacketDataSession()
       
  4490     {
       
  4491     return iMmPacketServiceTsy;
       
  4492     }
       
  4493 
       
  4494 // ---------------------------------------------------------------------------
       
  4495 // CMmPhoneTsy::GetCustomTsy
       
  4496 // Gives pointer to CustomTsy extension
       
  4497 // (other items were commented in a header).
       
  4498 // ---------------------------------------------------------------------------
       
  4499 //
       
  4500 CMmCustomTsy* CMmPhoneTsy::GetCustomTsy()
       
  4501     {
       
  4502     return iMmCustomTsy;
       
  4503     }
       
  4504 
       
  4505 // ---------------------------------------------------------------------------
       
  4506 // CMmPhoneTsy::SetCustomTsy
       
  4507 // CustomTsy can set iMmCustomTsy pointer to NULL when it is closed
       
  4508 // (other items were commented in a header).
       
  4509 // ---------------------------------------------------------------------------
       
  4510 //
       
  4511 void CMmPhoneTsy::SetCustomTsy(
       
  4512     CMmCustomTsy* aMmCustomTsy )
       
  4513     {
       
  4514     iMmCustomTsy = aMmCustomTsy;
       
  4515     }
       
  4516 
       
  4517 // ---------------------------------------------------------------------------
       
  4518 // CMmPhoneTsy::GetSmsTsy
       
  4519 // Gives pointer to SmsTsy
       
  4520 // (other items were commented in a header).
       
  4521 // ---------------------------------------------------------------------------
       
  4522 //
       
  4523 CMmSmsTsy* CMmPhoneTsy::GetSmsTsy()
       
  4524     {
       
  4525     return iMmSmsTsy;
       
  4526     }
       
  4527 
       
  4528 // ---------------------------------------------------------------------------
       
  4529 // CMmPhoneTsy::GetIccAccessCaps
       
  4530 // Get ICC Access Capabilities. ICC capabilities are
       
  4531 // network mode dependent
       
  4532 // (other items were commented in a header).
       
  4533 // ---------------------------------------------------------------------------
       
  4534 //
       
  4535 TInt CMmPhoneTsy::GetIccAccessCaps(
       
  4536     const TTsyReqHandle aTsyReqHandle,
       
  4537     TUint32*            aCaps )
       
  4538     {
       
  4539     TInt ret( KErrNone );
       
  4540 
       
  4541     //set the default value for the capabilites
       
  4542     *aCaps = 0x0;
       
  4543 
       
  4544     // Check mode ICC type
       
  4545     TInt currentIccType( iMmPhoneExtInterface->CurrentICCType() );
       
  4546 
       
  4547     // 2G SIM
       
  4548     if ( CMmPhoneGsmWcdmaExt::EICCTypeSim2GGsm ==  currentIccType)
       
  4549         {
       
  4550         *aCaps = RMobilePhone::KCapsSimAccessSupported;
       
  4551 TFLOGSTRING("TSY: CMmPhoneTsy::GetIccAccessCaps: aCaps = KCapsSimAccessSupported.");
       
  4552         }
       
  4553     // 3G USIM
       
  4554     else if ( CMmPhoneGsmWcdmaExt::EICCTypeSim3G == currentIccType )
       
  4555         {
       
  4556         *aCaps = RMobilePhone::KCapsUSimAccessSupported +
       
  4557             RMobilePhone::KCapsSimAccessSupported;
       
  4558 TFLOGSTRING("TSY: CMmPhoneTsy::GetIccAccessCaps: aCaps = KCapsUSimAccessSupported + KCapsSimAccessSupported.");
       
  4559         }
       
  4560     ReqCompleted( aTsyReqHandle, ret );
       
  4561 
       
  4562     return KErrNone;
       
  4563     }
       
  4564 
       
  4565 // ---------------------------------------------------------------------------
       
  4566 // CMmPhoneTsy::NotifyIccAccessCapsChange
       
  4567 // Notify Change of ICC Access Caps. ICC capabilities are 
       
  4568 // network mode dependent
       
  4569 // (other items were commented in a header).
       
  4570 // ---------------------------------------------------------------------------
       
  4571 //
       
  4572 TInt CMmPhoneTsy::NotifyIccAccessCapsChange(
       
  4573     TUint32* aCaps )
       
  4574     {
       
  4575     iReqHandleType = EMultimodePhoneNotifyIccAccessCapsChange;
       
  4576     iICCCaps = aCaps;
       
  4577 
       
  4578     return KErrNone;
       
  4579     }
       
  4580 
       
  4581 // ---------------------------------------------------------------------------
       
  4582 // CMmPhoneTsy::NotifyIccAccessCapsChangeCancel
       
  4583 // Cancels an outstanding NotifyIccAccessCapsChange method
       
  4584 // (other items were commented in a header).
       
  4585 // ---------------------------------------------------------------------------
       
  4586 //
       
  4587 TInt CMmPhoneTsy::NotifyIccAccessCapsChangeCancel (
       
  4588     const TTsyReqHandle aTsyReqHandle )
       
  4589     {
       
  4590     // As cancel is called, the client memory address pointed to is no longer
       
  4591     // valid -> NULL it
       
  4592     iICCCaps = NULL;
       
  4593     iTsyReqHandleStore->ResetTsyReqHandle( 
       
  4594         EMultimodePhoneNotifyIccAccessCapsChange );
       
  4595     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  4596 
       
  4597     return KErrNone;
       
  4598     }
       
  4599 
       
  4600 // ---------------------------------------------------------------------------
       
  4601 // CMmPhoneTsy::CompleteNotifyIccAccessCapsChange
       
  4602 // Complete Notify Change of ICC Access Caps. ICC capabilities
       
  4603 // are network mode dependent
       
  4604 // (other items were commented in a header).
       
  4605 // ---------------------------------------------------------------------------
       
  4606 //
       
  4607 void CMmPhoneTsy::CompleteNotifyIccAccessCapsChange()
       
  4608     {
       
  4609     TInt ret ( KErrNone );
       
  4610 
       
  4611     // Reset req handle. Returns the deleted req handle
       
  4612     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  4613                                 EMultimodePhoneNotifyIccAccessCapsChange );
       
  4614 
       
  4615     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  4616         {
       
  4617 
       
  4618         switch ( iMmPhoneExtInterface->CurrentICCType() )
       
  4619             {
       
  4620             case CMmPhoneGsmWcdmaExt::EICCTypeSim2GGsm:     // 2G SIM
       
  4621                 *iICCCaps = RMobilePhone::KCapsSimAccessSupported;
       
  4622 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyIccAccessCapsChange: KCapsSimAccessSupported.");
       
  4623                 break;
       
  4624             case CMmPhoneGsmWcdmaExt::EICCTypeSim3G:   // 3G USIM
       
  4625                 *iICCCaps = RMobilePhone::KCapsUSimAccessSupported;
       
  4626 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyIccAccessCapsChange: KCapsUSimAccessSupported.");
       
  4627                 break;
       
  4628 
       
  4629             default:
       
  4630                 *iICCCaps = 0x0;
       
  4631 
       
  4632                 // If the TSY/ME does not support any ICC access
       
  4633                 // then the request should be completed with KErrNotSupported.
       
  4634                 ret = KErrNotSupported;
       
  4635             }
       
  4636 
       
  4637         // Complete the client request
       
  4638         ReqCompleted( reqHandle, ret );
       
  4639         }
       
  4640     }
       
  4641     
       
  4642 // ---------------------------------------------------------------------------
       
  4643 // CMmPhoneTsy::GetServiceTableCheckParametersL
       
  4644 // Check validity of client parameters and pass request to GetServiceTableL().
       
  4645 // (other items were commented in a header).
       
  4646 // ---------------------------------------------------------------------------
       
  4647 //
       
  4648 TInt CMmPhoneTsy::GetServiceTableCheckParametersL(
       
  4649     const TTsyReqHandle             aTsyReqHandle,
       
  4650     RMobilePhone::TMobilePhoneServiceTable* aTable,
       
  4651     TDes8* aTableData )
       
  4652     {   
       
  4653     TInt ret = KErrArgument;
       
  4654 
       
  4655     //Incorrectly packaged parameter or wrong parameter may cause crash in TSY
       
  4656     //when the service table data is copied to aTableData. Check validity of 
       
  4657     //parameter delivered by ETel API client.
       
  4658     if ( sizeof( RMobilePhone::TMobilePhoneServiceTableV1 ) <= 
       
  4659          aTableData->MaxLength() )
       
  4660         {
       
  4661         RMobilePhone::TMobilePhoneServiceTableV1Pckg* serviceTableV1Pckg =
       
  4662             REINTERPRET_CAST( RMobilePhone::TMobilePhoneServiceTableV1Pckg*, 
       
  4663                 aTableData );
       
  4664                 
       
  4665         RMobilePhone::TMobilePhoneServiceTableV1* 
       
  4666             serviceTableV1 = &( ( *serviceTableV1Pckg ) () );
       
  4667     
       
  4668         ret = GetServiceTableL( aTsyReqHandle, aTable, serviceTableV1 );
       
  4669         }
       
  4670 
       
  4671 TFLOGSTRING2("TSY: CMmPhoneTsy::GetServiceTableCheckParametersL - ret:%d",ret);
       
  4672     return ret;
       
  4673     }        
       
  4674 
       
  4675 // ---------------------------------------------------------------------------
       
  4676 // CMmPhoneTsy::GetServiceTableL
       
  4677 // Request Service Table (SST/UST)
       
  4678 // (other items were commented in a header).
       
  4679 // ---------------------------------------------------------------------------
       
  4680 //
       
  4681 TInt CMmPhoneTsy::GetServiceTableL(
       
  4682     const TTsyReqHandle             aTsyReqHandle,
       
  4683     RMobilePhone::TMobilePhoneServiceTable* aTable,
       
  4684     RMobilePhone::TMobilePhoneServiceTableV1* aTableData )
       
  4685     {
       
  4686 TFLOGSTRING2("TSY: CMmPhoneTsy::GetServiceTableL - Handle:%d", aTsyReqHandle);
       
  4687     TInt ret( KErrServerBusy );
       
  4688 
       
  4689     TTsyReqHandle serviceTableHandle =
       
  4690         iTsyReqHandleStore->GetTsyReqHandle( EMultimodePhoneGetServiceTable );
       
  4691 
       
  4692     if ( 0 < serviceTableHandle || KErrNone != iCacheServiceTableError  )
       
  4693         {
       
  4694         //The request is already in processing because of previous request
       
  4695         //Complete request with KErrServerBusy informing the client about
       
  4696         //the situation. Or if cache is failed when called from GetServiceTable
       
  4697         // complete with that error
       
  4698         
       
  4699         //Cache failed update return code
       
  4700         if( !iSimRefreshRegisterOk && ( iServiceTableReq->iCaching ) )
       
  4701         	{
       
  4702         	ret = iCacheServiceTableError;
       
  4703         	}
       
  4704         ReqCompleted( aTsyReqHandle, ret );
       
  4705         }
       
  4706     else
       
  4707         {
       
  4708 
       
  4709         // check if the request is supported for this service table 
       
  4710         // and current mode
       
  4711         switch ( *aTable )
       
  4712             {
       
  4713             case RMobilePhone::ESIMServiceTable:
       
  4714                 // SST is always supported
       
  4715                 ret = KErrNone;
       
  4716                 break;
       
  4717             case RMobilePhone::EUSIMServiceTable:
       
  4718             // KJT
       
  4719                 // UST is only supported if the used ICC is USIM.
       
  4720                 if ( CMmPhoneGsmWcdmaExt::EICCTypeSim3G  ==
       
  4721                      iMmPhoneExtInterface->CurrentICCType() )
       
  4722                     {
       
  4723                     ret = KErrNone;
       
  4724                     }
       
  4725                 else
       
  4726                     {
       
  4727                     ret = KErrMMEtelWrongMode;
       
  4728                     }
       
  4729                 break;
       
  4730             case RMobilePhone::ECDMAServiceTable:
       
  4731             case RMobilePhone::EUSIMEnabledServiceTable:
       
  4732             default:   // CDMA and "USIM enabled" service table are not supported
       
  4733                 ret = KErrNotFound;
       
  4734             }
       
  4735 
       
  4736         if ( KErrNone == ret )
       
  4737             {
       
  4738             // if SIM is not ready, store request and complete it when SIM is ready
       
  4739             if ( !iBootState.iSIMReady )
       
  4740 		        {
       
  4741 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceTableL - request when SIM not ready - store req" );
       
  4742 		    	TServiceTableRequests* req = new (ELeave) TServiceTableRequests();
       
  4743 		    	req->iReqHandle = aTsyReqHandle;
       
  4744 		    	req->iTable = aTable;
       
  4745 		    	req->iTableData = aTableData;
       
  4746 		    	iServiceTableRequests.Append( req );
       
  4747 		        }
       
  4748 		    else
       
  4749             {
       
  4750             if( RMobilePhone::ESIMServiceTable == 
       
  4751                     *aTable && iServiceTableDataCache )
       
  4752             	{
       
  4753 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceTableL ESIMServiceTable returned from cache");
       
  4754             	*aTableData = *iServiceTableDataCache;
       
  4755             	ReqCompleted( aTsyReqHandle, ret );
       
  4756             	return KErrNone;
       
  4757             	}
       
  4758            	else if ( RMobilePhone::EUSIMServiceTable== 
       
  4759                           *aTable && iServiceTableUSIMDataCache )
       
  4760            		{
       
  4761 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceTableL EUSIMServiceTable returned from cache");
       
  4762            		*aTableData = *iServiceTableUSIMDataCache;
       
  4763             	ReqCompleted( aTsyReqHandle, ret );
       
  4764             	return KErrNone;
       
  4765            		}
       
  4766             else
       
  4767             	{
       
  4768             	if( !iSimRefreshRegisterOk && !( iServiceTableReq->iCaching ) )
       
  4769             		{
       
  4770 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceTableL sim refresh registration failed - possible old data - cache and complete ");
       
  4771             		//Store reguest parameters for completion
       
  4772             		iServiceTableReq->iReqHandle = aTsyReqHandle;
       
  4773             		iServiceTableReq->iTable = aTable;
       
  4774 					iServiceTableReq->iTableData = aTableData;
       
  4775 					iServiceTableReq->iCaching = ETrue;
       
  4776 									
       
  4777 					//Do necessary internal intialisation
       
  4778 					iCacheServiceTableError = KErrNone;
       
  4779 					ret = KErrNone;
       
  4780 					iCalledOnGet = ETrue;	
       
  4781 					iSimCacheQueue = KCacheServiceTable;
       
  4782 					iRefreshOngoing = ETrue;
       
  4783 					iPendingServiceTableReq = ESIMRequest;
       
  4784 				
       
  4785 					//Request new caching	
       
  4786             		CacheServiceTablesL();
       
  4787             		}
       
  4788             	else
       
  4789             		{            	
       
  4790 	            	if( RMobilePhone::ESIMServiceTable == *aTable )
       
  4791 	            		{	
       
  4792 		            	iPendingServiceTableReq = ESIMRequest;
       
  4793 	            		}
       
  4794 	            	else
       
  4795 		            	{
       
  4796 		            	iPendingServiceTableReq = EUSIMRequest;
       
  4797 		            	}
       
  4798 	            	
       
  4799 	            	// If caching is ongoing do not request service table
       
  4800 	            	if( ENoRequest == iPendingServiceTableCacheReq )
       
  4801 		            	{	
       
  4802 			            // Forward the request to DOS
       
  4803 			            // packed parameter: RMobilePhone::TMobilePhoneServiceTable
       
  4804 			            CMmDataPackage dataPackage;
       
  4805 			            dataPackage.PackData( aTable );
       
  4806 			            ret = iMessageManager->HandleRequestL( 
       
  4807 	                          EMobilePhoneGetServiceTable, &dataPackage );
       
  4808 		            	}
       
  4809 		            //Ready to process new request 
       
  4810 		            iServiceTableReq->iCaching = EFalse;
       
  4811 	            	}
       
  4812             	
       
  4813             }
       
  4814             }
       
  4815 
       
  4816         // Check the request sending status
       
  4817         if ( KErrNone == ret )
       
  4818             {
       
  4819             // Save last req handle type and return pointer
       
  4820             iReqHandleType = EMultimodePhoneGetServiceTable;
       
  4821             iRetTableData = aTableData;
       
  4822             }
       
  4823         else
       
  4824             {
       
  4825             // Complete request if error occured
       
  4826             ReqCompleted( aTsyReqHandle, ret );
       
  4827             }
       
  4828         }
       
  4829         else
       
  4830         	{
       
  4831             ReqCompleted( aTsyReqHandle, ret );
       
  4832         	}
       
  4833     	}
       
  4834     return KErrNone;
       
  4835     }
       
  4836 
       
  4837 // ---------------------------------------------------------------------------
       
  4838 // CMmPhoneTsy::CacheServiceTables
       
  4839 // Starts the service table caching process
       
  4840 // (other items were commented in a header).
       
  4841 // ---------------------------------------------------------------------------
       
  4842 //
       
  4843 void CMmPhoneTsy::CacheServiceTablesL()
       
  4844 	{
       
  4845 TFLOGSTRING("TSY: CMmPhoneTsy::CacheServiceTables.");
       
  4846 
       
  4847 	// Start caching if it is not already ongoing
       
  4848 	if ( (((iSimCacheQueue && ( KCacheServiceTable & iSimCacheQueue )) )
       
  4849 		&& IsRefreshOngoing()) || !IsRefreshOngoing() )
       
  4850 		{
       
  4851 		RMobilePhone::TMobilePhoneServiceTable serviceTable = 
       
  4852             RMobilePhone::ESIMServiceTable;
       
  4853 				
       
  4854 		iPendingServiceTableCacheReq = ESIMRequest;
       
  4855 
       
  4856 		// Forward the request to DOS
       
  4857 	    // packed parameter: RMobilePhone::TMobilePhoneServiceTable
       
  4858 	    CMmDataPackage dataPackage;
       
  4859 	    dataPackage.PackData( &serviceTable );
       
  4860 
       
  4861 	    TInt ret = iMessageManager->HandleRequestL( EMobilePhoneGetServiceTable,
       
  4862 	        &dataPackage );
       
  4863 		}
       
  4864 	}
       
  4865 
       
  4866 // ---------------------------------------------------------------------------
       
  4867 // CMmPhoneTsy::CompleteCacheServiceTables
       
  4868 // Completes the service table caching process
       
  4869 // (other items were commented in a header).
       
  4870 // ---------------------------------------------------------------------------
       
  4871 //
       
  4872 void CMmPhoneTsy::CompleteCacheServiceTablesL( const TInt aError )
       
  4873 	{
       
  4874 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL Error = %d", aError);
       
  4875 	if ( ( iSimCacheQueue && ( KCacheServiceTable & iSimCacheQueue ) ) 
       
  4876             && IsRefreshOngoing() )
       
  4877 		{
       
  4878 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL");
       
  4879 		CompleteCacheSimL( KCacheServiceTable, aError );
       
  4880 		}
       
  4881 		
       
  4882 	TInt ret = KErrNone;
       
  4883 		
       
  4884 	// check pending requests and proceed if any
       
  4885     TInt serviceTableRequestsCount = iServiceTableRequests.Count();
       
  4886 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - serviceTableRequestsCount: %d", serviceTableRequestsCount );
       
  4887 
       
  4888 	 if ( serviceTableRequestsCount )
       
  4889 	 	{
       
  4890 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - Completing pending ServiceTableRequests");
       
  4891 		// check request type for every pending request and complete
       
  4892 		for ( TInt i = 0; i < serviceTableRequestsCount; i++ )
       
  4893 			{
       
  4894 			TServiceTableRequests* req = iServiceTableRequests[ i ];
       
  4895 			if ( RMobilePhone::ESIMServiceTable == *req->iTable )
       
  4896 				{
       
  4897 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - pending ESIMServiceTableRequest");
       
  4898 				*(req->iTableData) = *iServiceTableDataCache;
       
  4899 				}
       
  4900 			else if ( RMobilePhone::EUSIMServiceTable == *req->iTable )
       
  4901 				{
       
  4902 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - pending ESIMServiceTableRequest");
       
  4903 				*(req->iTableData) = *iServiceTableUSIMDataCache;
       
  4904 				}
       
  4905 			else 
       
  4906 				{
       
  4907 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - pending BadRequest - KErrGeneral");
       
  4908 				ret = KErrGeneral;	
       
  4909 				}
       
  4910 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - ReqCompleted for pending req withHandle:%d", req->iReqHandle);
       
  4911 			ReqCompleted(req->iReqHandle, ret);
       
  4912 			}
       
  4913 		// Reset req handle
       
  4914 		iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePhoneGetServiceTable );
       
  4915 		iServiceTableRequests.ResetAndDestroy();
       
  4916 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - Reset and ResetAndDestroy!");	
       
  4917 		}
       
  4918 		
       
  4919 	if ( ENoRequest != iPendingServiceTableReq )
       
  4920 		{
       
  4921 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL completing client request");
       
  4922 		// Complete client request if pending
       
  4923 		
       
  4924 		// Reset req handle. Returns the deleted req handle
       
  4925 	    TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  4926             EMultimodePhoneGetServiceTable );
       
  4927 
       
  4928 	    if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  4929 	        {
       
  4930 	        ret = KErrNone;
       
  4931 	        
       
  4932 	    	if( ESIMRequest == iPendingServiceTableReq )
       
  4933 	    		{
       
  4934 	    		if( iServiceTableDataCache )
       
  4935 	    			{
       
  4936 	        		*iRetTableData = *iServiceTableDataCache;
       
  4937 	    			}
       
  4938 	    		else
       
  4939 	    			{
       
  4940 	    			ret = KErrGeneral;
       
  4941 	    			}
       
  4942 	    		}
       
  4943 	    	else
       
  4944 	        	{
       
  4945 	        	if( iServiceTableUSIMDataCache )
       
  4946 	        		{	
       
  4947 	        		*iRetTableData = *iServiceTableUSIMDataCache;
       
  4948 	        		}
       
  4949 	        	else
       
  4950 	    			{
       
  4951 	    			ret = KErrGeneral;
       
  4952 	    			}
       
  4953 	        	}
       
  4954 	     	
       
  4955 	     	if ( iCalledOnGet && ( iServiceTableReq->iCaching ) )
       
  4956 				{
       
  4957 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - Called when reading service tables - ");
       
  4958 				iCalledOnGet = EFalse;
       
  4959 				iSimCacheQueue = 0;
       
  4960 				iRefreshOngoing = EFalse;
       
  4961 				GetServiceTableL( iServiceTableReq->iReqHandle,iServiceTableReq->iTable, 
       
  4962 					iServiceTableReq->iTableData );
       
  4963 				iPendingServiceTableReq = ENoRequest;
       
  4964 				
       
  4965 				if( KErrNone != aError )
       
  4966 					{
       
  4967 					iCacheServiceTableError = KErrNotFound;
       
  4968 					}
       
  4969 				
       
  4970 				}
       
  4971 			else
       
  4972 				{	   	
       
  4973 	        	iPendingServiceTableReq = ENoRequest;
       
  4974 	        	
       
  4975 	        	// Complete request if error occured
       
  4976 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteCacheServiceTablesL - Completing req if error occurred");
       
  4977 	        	ReqCompleted( reqHandle, ret );
       
  4978 				}
       
  4979 	        }	
       
  4980 		}
       
  4981 	}
       
  4982 
       
  4983 // ---------------------------------------------------------------------------
       
  4984 // CMmPhoneTsy::CompleteGetServiceTableL
       
  4985 // Returns the Service Table file that is
       
  4986 // stored on the SIM to the client
       
  4987 // (other items were commented in a header).
       
  4988 // ---------------------------------------------------------------------------
       
  4989 //
       
  4990 void CMmPhoneTsy::CompleteGetServiceTableL(
       
  4991     RMobilePhone::TMobilePhoneServiceTableV1 aTableData,
       
  4992     TInt aErrorCode )
       
  4993     {
       
  4994 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetServiceTableL Error = %d", aErrorCode);
       
  4995     // Check if timeout has happend, complete to all pending ServiceTable
       
  4996     // requests and clear queue
       
  4997 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL");
       
  4998 	if ( KErrTimedOut == aErrorCode )
       
  4999 		{
       
  5000 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL - Timeout happened");
       
  5001 		// Reset req handle. Returns the deleted req handle
       
  5002 	    TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  5003             EMultimodePhoneGetServiceTable );
       
  5004 
       
  5005 	    if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  5006 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL - in EMultimodePhoneReqHandleUnknown != reqHandle" );
       
  5007 	    	{
       
  5008 			// count pending requests and proceed if any
       
  5009 			TInt serviceTableRequestsCount = iServiceTableRequests.Count();
       
  5010 
       
  5011 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetServiceTableL - serviceTableRequestsCount: %d", serviceTableRequestsCount );
       
  5012 	 		if ( serviceTableRequestsCount )
       
  5013 	 			{
       
  5014 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL - Completing pending ServiceTableRequests");
       
  5015 				// complete pending requests
       
  5016 				for ( TInt i = 0; i < serviceTableRequestsCount; i++ )
       
  5017 					{
       
  5018 					TServiceTableRequests* req = iServiceTableRequests[ i ];
       
  5019 
       
  5020 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetServiceTableL - ReqCompleted for pending req withHandle:%d", req->iReqHandle);
       
  5021 					ReqCompleted(req->iReqHandle, aErrorCode);
       
  5022 					}
       
  5023 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL - in iServiceTableRequests.ResetAndDestroy()" );
       
  5024 				iServiceTableRequests.ResetAndDestroy();	
       
  5025 				}
       
  5026 	        }
       
  5027 		}
       
  5028 
       
  5029     if ( ESIMRequest == iPendingServiceTableCacheReq )
       
  5030 		{
       
  5031 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL got Service Table");
       
  5032 		
       
  5033 		delete iServiceTableDataCache;
       
  5034 		iServiceTableDataCache = NULL;
       
  5035 		
       
  5036 		if ( KErrNone == aErrorCode )
       
  5037 			{	
       
  5038 			iServiceTableDataCache =
       
  5039 				new (ELeave) RMobilePhone::TMobilePhoneServiceTableV1();
       
  5040 
       
  5041 			*iServiceTableDataCache = aTableData;
       
  5042 			}
       
  5043 			
       
  5044 		// Request USIM Service Table
       
  5045 		if ( ( CMmPhoneGsmWcdmaExt::EICCTypeSim3G  ==
       
  5046             iMmPhoneExtInterface->CurrentICCType() ) &&
       
  5047             ENoRequest != iPendingServiceTableCacheReq )
       
  5048 			{
       
  5049 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL requesting USIM Service Table");
       
  5050 
       
  5051 			RMobilePhone::TMobilePhoneServiceTable serviceTable = 
       
  5052 				RMobilePhone::EUSIMServiceTable;
       
  5053 				
       
  5054 			iPendingServiceTableCacheReq = EUSIMRequest;
       
  5055 
       
  5056 			// Forward the request to DOS
       
  5057 			// packed parameter: RMobilePhone::TMobilePhoneServiceTable
       
  5058 			CMmDataPackage dataPackage;
       
  5059 			dataPackage.PackData( &serviceTable );
       
  5060 			TInt ret = iMessageManager->HandleRequestL( 
       
  5061 				EMobilePhoneGetServiceTable, &dataPackage );
       
  5062 
       
  5063 			}
       
  5064 		// Complete caching if it is ongoing
       
  5065 		else
       
  5066 			{
       
  5067 			iPendingServiceTableCacheReq = ENoRequest;
       
  5068 			CompleteCacheServiceTablesL( aErrorCode );
       
  5069 			}
       
  5070 
       
  5071 		}
       
  5072 	else if ( EUSIMRequest == iPendingServiceTableCacheReq )
       
  5073 		{
       
  5074 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL got USIM Service Table");
       
  5075 
       
  5076 		delete iServiceTableUSIMDataCache;
       
  5077 		iServiceTableUSIMDataCache = NULL;
       
  5078 		
       
  5079 		if ( KErrNone == aErrorCode )
       
  5080 			{
       
  5081 			iServiceTableUSIMDataCache =
       
  5082 				new (ELeave) RMobilePhone::TMobilePhoneServiceTableV1();
       
  5083 
       
  5084 			*iServiceTableUSIMDataCache = aTableData;
       
  5085 			}
       
  5086 			
       
  5087 		iPendingServiceTableCacheReq = ENoRequest;
       
  5088 
       
  5089 		// Complete caching if it is ongoing
       
  5090 		CompleteCacheServiceTablesL( aErrorCode );
       
  5091 		}
       
  5092 	
       
  5093 	// Update data only if caching is not ongoing and client request
       
  5094 	// is pending	
       
  5095 	if ( ENoRequest != iPendingServiceTableReq &&
       
  5096         ENoRequest == iPendingServiceTableCacheReq )
       
  5097 		{
       
  5098 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL completing client request");
       
  5099 		// Complete client request if pending
       
  5100 		
       
  5101 		// Reset req handle. Returns the deleted req handle
       
  5102 	    TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  5103             EMultimodePhoneGetServiceTable );
       
  5104 
       
  5105 	    if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  5106 	        {
       
  5107 	    	if( ESIMRequest == iPendingServiceTableReq )
       
  5108 	    		{
       
  5109 	    		delete iServiceTableDataCache;
       
  5110 				iServiceTableDataCache = NULL;
       
  5111 		
       
  5112 	    		if( KErrNone == aErrorCode )
       
  5113 	    			{
       
  5114 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL copy SIM ST data to client");
       
  5115 	    			iServiceTableDataCache = new (ELeave) 
       
  5116 					    RMobilePhone::TMobilePhoneServiceTableV1();
       
  5117 	    			*iServiceTableDataCache	= aTableData;
       
  5118 	        		*iRetTableData = aTableData;
       
  5119 	    			}
       
  5120 	    		}
       
  5121 	    	else // EUSIMRequest
       
  5122 	        	{
       
  5123 	        	delete iServiceTableUSIMDataCache;
       
  5124 				iServiceTableUSIMDataCache = NULL;
       
  5125 				
       
  5126 	        	if( KErrNone == aErrorCode )
       
  5127 	        		{
       
  5128 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetServiceTableL copy USIM ST data to client");
       
  5129 	        		iServiceTableUSIMDataCache = new (ELeave) 
       
  5130 					    RMobilePhone::TMobilePhoneServiceTableV1();
       
  5131 	        		*iServiceTableUSIMDataCache = aTableData;	
       
  5132 	        		*iRetTableData = aTableData;
       
  5133 	        		}
       
  5134 	        	}
       
  5135 	        
       
  5136 	        iPendingServiceTableReq = ENoRequest;
       
  5137 	        	
       
  5138 	        // Complete request if error occured
       
  5139 	        ReqCompleted( reqHandle, aErrorCode );
       
  5140 	        }	
       
  5141 		}
       
  5142     }
       
  5143 
       
  5144 // ---------------------------------------------------------------------------
       
  5145 // CMmPhoneTsy::GetServiceTableCancel
       
  5146 // Cancels GetServiceTable request
       
  5147 // (other items were commented in a header).
       
  5148 // ---------------------------------------------------------------------------
       
  5149 //
       
  5150 TInt CMmPhoneTsy::GetServiceTableCancel (
       
  5151 	const TTsyReqHandle aTsyReqHandle )
       
  5152     {
       
  5153 TFLOGSTRING("TSY: CMmPhoneTsy::GetServiceTableCancel");
       
  5154     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePhoneGetServiceTable );
       
  5155     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  5156 
       
  5157     return KErrNone;
       
  5158     }
       
  5159 
       
  5160 // ---------------------------------------------------------------------------
       
  5161 // CMmPhoneTsy::SimRefreshRegisterL
       
  5162 // This method registers TSY for receiving the SIM refresh indications.
       
  5163 // Returns KErrNotSupported (?) if the HW does not support this request.
       
  5164 // (other items were commented in a header).
       
  5165 // ---------------------------------------------------------------------------
       
  5166 //
       
  5167 TInt CMmPhoneTsy::SimRefreshRegisterL()
       
  5168     {
       
  5169 TFLOGSTRING( "TSY: CMmPhoneTsy::SimRefreshRegisterL" );
       
  5170 
       
  5171     TInt ret( KErrNone );
       
  5172 
       
  5173     // Add all supported file types to be registered for refresh
       
  5174     TUint16 filesToRegister = KCacheAdn | KCacheFdn | KCacheServiceTable
       
  5175         | KCacheALSline;
       
  5176 
       
  5177     // parameter: files to register
       
  5178     CMmDataPackage dataPackage;
       
  5179     dataPackage.PackData( &filesToRegister );
       
  5180 
       
  5181     // send request to DOS (no packed parameters).
       
  5182     ret = iMessageManager->HandleRequestL(
       
  5183         EMmTsySimRefreshRegisterIPC, &dataPackage );
       
  5184 
       
  5185     if ( KErrNone != ret )
       
  5186         {
       
  5187         // the sending has failed
       
  5188 TFLOGSTRING( "TSY: CMmPhoneTsy::SimRefreshRegisterL, Registration for Refresh failed" );
       
  5189         }
       
  5190 
       
  5191     return ret;
       
  5192     }
       
  5193 
       
  5194 // ---------------------------------------------------------------------------
       
  5195 // CMmPhoneTsy::CompleteSimRefreshRegisterL
       
  5196 // This method is called when SIM refresh register is completed
       
  5197 // (other items were commented in a header).
       
  5198 // ---------------------------------------------------------------------------
       
  5199 //
       
  5200 void CMmPhoneTsy::CompleteSimRefreshRegister(
       
  5201      TInt aErrorCode )
       
  5202     {
       
  5203 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteSimRefreshRegisterL Error = %d", aErrorCode );
       
  5204 
       
  5205 	if( KErrNone == aErrorCode )
       
  5206 		{
       
  5207 		iSimRefreshRegisterOk = ETrue;		
       
  5208 		}		
       
  5209     }
       
  5210 
       
  5211 //---------------------------------------------------------------------------
       
  5212 // CMmPhoneTsy::GetSimRefreshRegister
       
  5213 // This method returns Sim refresh registration status
       
  5214 // (other items were commented in a header).
       
  5215 // ---------------------------------------------------------------------------
       
  5216 //
       
  5217 TBool CMmPhoneTsy::GetSimRefreshRegister()
       
  5218     {
       
  5219 TFLOGSTRING2( "TSY: CMmPhoneTsy::GetSimRefreshRegister iSimRefreshRegisterOk = %d", iSimRefreshRegisterOk );
       
  5220 
       
  5221 	return iSimRefreshRegisterOk;		
       
  5222     }
       
  5223     
       
  5224 // ---------------------------------------------------------------------------
       
  5225 // CMmPhoneTsy::CompleteUpdateLifeTimer
       
  5226 // This method is called on completion update life time request
       
  5227 // ---------------------------------------------------------------------------
       
  5228 //    
       
  5229 void CMmPhoneTsy::CompleteUpdateLifeTimer(
       
  5230      TInt aErrorCode )
       
  5231     {
       
  5232 	if( KErrNone != aErrorCode)
       
  5233 		{
       
  5234 		TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteUpdateLifeTimer Error = %d", aErrorCode );
       
  5235 		}
       
  5236     }    
       
  5237 
       
  5238 //---------------------------------------------------------------------------
       
  5239 // CMmPhoneTsy::GetSimRefreshRegister
       
  5240 // This method starts new cache for for specific phonebook
       
  5241 // (other items were commented in a header).
       
  5242 // ---------------------------------------------------------------------------
       
  5243 //
       
  5244 TInt CMmPhoneTsy::StartNewCacheL( 
       
  5245 	TUint8 aPhoneBookType )
       
  5246     {
       
  5247 
       
  5248 	TInt ret( KErrNone );	
       
  5249 	
       
  5250 	//Check cache by phonebook type
       
  5251 	if( KADNPhoneBook == aPhoneBookType )
       
  5252 		{
       
  5253 		iSimCacheQueue = KCacheAdn;
       
  5254 		}
       
  5255 	else if( KFDNPhoneBook == aPhoneBookType )
       
  5256 		{
       
  5257 		iSimCacheQueue = KCacheFdn;	
       
  5258 		}
       
  5259 	else
       
  5260 		ret = KErrArgument;
       
  5261 	
       
  5262 	//If Ok Start cache
       
  5263 	if( KErrNone == ret )
       
  5264 		{
       
  5265 		CacheNextL();
       
  5266 		}
       
  5267 		
       
  5268 	return ret; 
       
  5269     }
       
  5270 
       
  5271 // ---------------------------------------------------------------------------
       
  5272 // CMmPhoneTsy::IsRefreshOngoing
       
  5273 // This method is called when it is needed to know whether caching has been
       
  5274 // initialized by SIM (refresh)
       
  5275 // (other items were commented in a header).
       
  5276 // ---------------------------------------------------------------------------
       
  5277 //
       
  5278 TBool CMmPhoneTsy::IsRefreshOngoing()
       
  5279     {
       
  5280     return iRefreshOngoing;
       
  5281     }
       
  5282 
       
  5283 // ---------------------------------------------------------------------------
       
  5284 // CMmPhoneTsy::CompleteSimRefreshNowL
       
  5285 // This method is called when "refresh now" indication has been received from
       
  5286 // by SIM and re-caching is needed
       
  5287 // (other items were commented in a header).
       
  5288 // ---------------------------------------------------------------------------
       
  5289 //
       
  5290 void CMmPhoneTsy::CompleteSimRefreshNowL(
       
  5291     TUint16 aFilesToRefresh )
       
  5292     {
       
  5293 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteSimRefreshNowL filemask: %d", aFilesToRefresh);
       
  5294 
       
  5295     // Set flag to indicate that refresh has started
       
  5296     iRefreshOngoing = ETrue;
       
  5297 
       
  5298     // Fill cache queue
       
  5299     iSimCacheQueue = aFilesToRefresh;
       
  5300 
       
  5301     // Check if the IMSI has changed and reset ME ALS info
       
  5302     GetSubscriberIdForTSYL();
       
  5303 
       
  5304 	// Cache service tables first
       
  5305 	if( iSimCacheQueue && ( KCacheServiceTable & iSimCacheQueue ) )
       
  5306         {
       
  5307         CacheServiceTablesL();
       
  5308         }
       
  5309 
       
  5310 	// Start caching..
       
  5311 	if( iSimCacheQueue && ( KCacheServiceTable != iSimCacheQueue ) )
       
  5312   		{
       
  5313   		CacheNextL(); 
       
  5314   		}
       
  5315     }
       
  5316 
       
  5317 
       
  5318 // ---------------------------------------------------------------------------
       
  5319 // CMmPhoneTsy::CacheNextL
       
  5320 // This method is called when SIM caching is needed ( boot or refresh, for now
       
  5321 // this is only implemented for refresh case ) for some SIM file.
       
  5322 //
       
  5323 // The following restriction applies to caching:
       
  5324 //   ADN can not be cached if FDN is activated
       
  5325 // (other items were commented in a header).
       
  5326 // ---------------------------------------------------------------------------
       
  5327 //
       
  5328 TBool CMmPhoneTsy::CacheNextL()
       
  5329     {
       
  5330     TBool result(ETrue);
       
  5331 
       
  5332     //Some files required for caching?
       
  5333     if( iSimCacheQueue )
       
  5334         {
       
  5335         // REFRESH ADN or FDN
       
  5336         TBuf<0x80>  pbRequested;
       
  5337         TUint16     resetFlag(0);
       
  5338         TBool       cacheStarted = EFalse;
       
  5339 
       
  5340         //FDN requested? (FDN has the first priority)
       
  5341         if( KCacheFdn & iSimCacheQueue )
       
  5342             {
       
  5343 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL - FDN" );
       
  5344             pbRequested = KETelIccFdnPhoneBook;
       
  5345             resetFlag = KCacheFdn;
       
  5346             }
       
  5347         else if( KCacheALSline & iSimCacheQueue )
       
  5348             {
       
  5349 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL - ALS" );
       
  5350 			ResetMEAlsInfo();
       
  5351 			pbRequested = KNullDesC;
       
  5352 			cacheStarted = ETrue;
       
  5353             }
       
  5354         //ADN requested?
       
  5355         else if( KCacheAdn & iSimCacheQueue )
       
  5356             {
       
  5357 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL - ADN" );
       
  5358             //NOTE: Here should be added the checking of FDN active state
       
  5359             pbRequested = KETelIccAdnPhoneBook;
       
  5360             resetFlag = KCacheAdn;
       
  5361             }
       
  5362         //UNKNOWN request (erroneous requests, all valid cases have been 
       
  5363         //checked and the queue can be reset)
       
  5364         else
       
  5365             {
       
  5366 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL - Unknown" );
       
  5367             pbRequested = KNullDesC;
       
  5368             resetFlag = iSimCacheQueue;
       
  5369             }
       
  5370 
       
  5371         //PHONE BOOK Request: Is there a phonebook available?
       
  5372         if( (pbRequested!=KNullDesC) && (iPBList) )
       
  5373             {
       
  5374             TInt numberOfPBooks = iPBList->GetNumberOfObjects();
       
  5375 TFLOGSTRING2( "TSY: CMmPhoneTsy::CacheNextL - Num Of PBs: %d", numberOfPBooks );
       
  5376 
       
  5377             //Browse through the phonebook names for the one required
       
  5378             for( TInt i=0; i < numberOfPBooks; i++ )
       
  5379                 {
       
  5380                 CMmPhoneBookStoreTsy* pbStore = iPBList->GetMmPBByIndex( i );
       
  5381 
       
  5382                 //If the correct phonebook is found, cache it's entries
       
  5383                 if ( !pbStore->PhoneBookName()->CompareF( pbRequested ) )
       
  5384                     {
       
  5385                     // Cancel cache first
       
  5386                     if ( ( pbRequested == KETelIccFdnPhoneBook ) ||  
       
  5387                             ( pbRequested == KETelIccAdnPhoneBook ) )
       
  5388                     	{
       
  5389                     	// Create package
       
  5390                     	CPhoneBookDataPackage package;
       
  5391                     	// Set package data
       
  5392                     	package.SetPhoneBookName( pbRequested );
       
  5393                     	TRAP_IGNORE( MessageManager()->HandleRequestL( 
       
  5394                             EMmTsyPhoneBookStoreCacheCancelIPC, &package ); );
       
  5395 
       
  5396 #if ( TF_LOGGING_METHOD > 0 )
       
  5397                     	if ( pbRequested == KETelIccFdnPhoneBook ) 
       
  5398                     	    {
       
  5399 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL - CancelCache for : KETelIccFdnPhoneBook" ); 
       
  5400                             }
       
  5401                     	else 
       
  5402                     	    {
       
  5403 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL - CancelCache for : KETelIccAdnPhoneBook" ); 
       
  5404                             }
       
  5405 #endif // TF_LOGGING_METHOD
       
  5406                     	}                   
       
  5407                     // perform the various stages of phonebook 
       
  5408                     // cache re-initialisation
       
  5409 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL - Resetting cache.");
       
  5410                     pbStore->ResetCacheReady();
       
  5411                     pbStore->ResetInitialisationStatus();
       
  5412                     pbStore->ResetCache();
       
  5413 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL -> Cache entries" );
       
  5414                     pbStore->CacheEntriesL();
       
  5415 
       
  5416                     cacheStarted = ETrue;
       
  5417                     break;
       
  5418                     }
       
  5419                 }
       
  5420             }
       
  5421 
       
  5422         //CACHING not started
       
  5423         //phonebook does not exist, or unknown request,
       
  5424         //so the file is removed from the cache queue
       
  5425         if( !cacheStarted )
       
  5426             {
       
  5427 TFLOGSTRING( "TSY: CMmPhoneTsy::CacheNextL - No PB Could be found, or Unknown request" );
       
  5428             CompleteCacheSimL( resetFlag, ETrue ); //complete with error
       
  5429             }
       
  5430         }
       
  5431     //more files in the queue?
       
  5432     result = ( iSimCacheQueue )? ETrue : EFalse;
       
  5433 
       
  5434 TFLOGSTRING2( "TSY: CMmPhoneTsy::CacheNextL: (Success/Fail = 1/0) %d",(TInt)result );
       
  5435     return result;
       
  5436     }
       
  5437 
       
  5438 
       
  5439 // ---------------------------------------------------------------------------
       
  5440 // CMmPhoneTsy::CompleteCacheSimL
       
  5441 // This method is called when caching for any of SIM files is finished. The 
       
  5442 // list of files left to be cached is updated here.
       
  5443 // (other items were commented in a header).
       
  5444 // ---------------------------------------------------------------------------
       
  5445 //
       
  5446 void CMmPhoneTsy::CompleteCacheSimL(
       
  5447     TUint8	aFileType,
       
  5448     TBool	aReadError)
       
  5449     {
       
  5450 TFLOGSTRING2( "TSY: CMmPhoneTsy::CompleteCacheSimL, FileType: 0x%x", aFileType );
       
  5451 
       
  5452     TBool filesInCacheQueue(EFalse); //By default: "no more files in cache"
       
  5453 
       
  5454     // Remove file from caching queue
       
  5455     iSimCacheQueue &= ~aFileType;
       
  5456 
       
  5457     // Start caching the next on queue, if queue is not empty
       
  5458     // If Service Table cahing is completed and ather caching is ongoing
       
  5459     // do not cache next
       
  5460 #ifdef USING_CTSY_DISPATCHER
       
  5461     //believed to be a defect, comparing to aFileType will cause a call to CacheNextL on a queue 
       
  5462     //containing only KCacheServiceTable and result in a Refresh Done IPC, with ETrue as an error
       
  5463     if ( iSimCacheQueue == KCacheServiceTable )
       
  5464 #else
       
  5465     if ( aFileType == KCacheServiceTable )
       
  5466 #endif //USING_CTSY_DISPATCHER
       
  5467     	{
       
  5468 		filesInCacheQueue = iSimCacheQueue;
       
  5469 		}
       
  5470 	else
       
  5471 		{
       
  5472     	filesInCacheQueue = (!iSimCacheQueue)?EFalse:CacheNextL();
       
  5473 		}
       
  5474 
       
  5475     // Here it must be checked whether caching was finished.
       
  5476     // Server must still be notified for completion. Complete
       
  5477     // also if error occured, this means that caching is
       
  5478     // interrupted
       
  5479     if( ( !filesInCacheQueue || aReadError ) && !(iBootState.iCachingActive) )
       
  5480         {
       
  5481         // Complete the refresh
       
  5482         NotifySimRefreshCompletionL( aReadError );
       
  5483         }
       
  5484      else
       
  5485      	{
       
  5486 TFLOGSTRING( "TSY: CMmPhoneTsy::CompleteCacheSimL, caching still in progress." );
       
  5487      	}
       
  5488     }
       
  5489 
       
  5490 // ---------------------------------------------------------------------------
       
  5491 // CMmPhoneTsy::NotifySimRefreshCompletionL
       
  5492 // Notifying server that refresh has been completed
       
  5493 // (other items were commented in a header).
       
  5494 // ---------------------------------------------------------------------------
       
  5495 //
       
  5496 void CMmPhoneTsy::NotifySimRefreshCompletionL(
       
  5497     TBool aReadError )
       
  5498     {
       
  5499 TFLOGSTRING2( "TSY: CMmPhoneTsy::NotifySimRefreshCompletionL error = %d",aReadError );
       
  5500 
       
  5501     // Refresh is finished, update flag
       
  5502     iRefreshOngoing = EFalse;
       
  5503 
       
  5504     // Make sure that the list gets empty
       
  5505     iSimCacheQueue = 0;
       
  5506 
       
  5507     // Parameter: error indicator
       
  5508     CMmDataPackage dataPackage;
       
  5509     dataPackage.PackData( &aReadError );
       
  5510 
       
  5511     // Notify server for completion of refresh
       
  5512     iMessageManager->HandleRequestL(
       
  5513 		EMmTsySimRefreshDoneIPC, &dataPackage );
       
  5514     }
       
  5515 
       
  5516 // ---------------------------------------------------------------------------
       
  5517 // CMmPhoneTsy::IMSAuthenticationL
       
  5518 // Requests authentication data generatation from input parameters
       
  5519 // (other items were commented in a header).
       
  5520 // ---------------------------------------------------------------------------
       
  5521 //
       
  5522 TInt CMmPhoneTsy::ImsAuthenticationL( 
       
  5523     TDes8* aAuthenticationData )
       
  5524     {
       
  5525 TFLOGSTRING("TSY: CMmPhoneTsy::ImsAuthenticationL");
       
  5526 
       
  5527 	TInt ret = KErrServerBusy;
       
  5528     
       
  5529     // Check if request handle already exists
       
  5530     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
       
  5531         EMultimodePhoneIMSAuthenticate );
       
  5532 
       
  5533     if ( EMultimodePhoneReqHandleUnknown == reqHandle )
       
  5534         {
       
  5535         ret = KErrArgument;
       
  5536         if ( sizeof( RMobilePhone::TImsAuthenticateDataV5Pckg ) <=
       
  5537              aAuthenticationData->MaxLength() )
       
  5538             {                     
       
  5539     	   	// Unpack entry parameter
       
  5540         	RMobilePhone::TImsAuthenticateDataV5Pckg* entryPckg =
       
  5541             REINTERPRET_CAST
       
  5542             ( RMobilePhone::TImsAuthenticateDataV5Pckg*, aAuthenticationData );
       
  5543        		RMobilePhone::TImsAuthenticateDataV5& authData = ( *entryPckg )();
       
  5544        		
       
  5545        		if ( KEtelExtMultimodeV5 == authData.ExtensionId() )
       
  5546        		    {
       
  5547         	    // Save pointer to client space
       
  5548         	    iIMSAuthenticationData = aAuthenticationData;
       
  5549         		
       
  5550         	    CMmDataPackage authenticationDataPackage;
       
  5551         	    authenticationDataPackage.PackData( &authData );
       
  5552 
       
  5553         	    ret = ( MessageManager()->HandleRequestL(
       
  5554         	        EMobilePhoneIMSAuthenticate, &authenticationDataPackage ) );
       
  5555 
       
  5556         	    // Store request handle if KErrNone returned.
       
  5557         	    if ( KErrNone == ret )
       
  5558         	        {
       
  5559         	        iReqHandleType = EMultimodePhoneIMSAuthenticate;	
       
  5560         	        }
       
  5561         	    }
       
  5562             }
       
  5563 	    }
       
  5564 	    
       
  5565     return ret;
       
  5566     }
       
  5567 
       
  5568 // ---------------------------------------------------------------------------
       
  5569 // CMmPhoneTsy::CompleteImsAuthentication
       
  5570 // Requests authentication data generatation from input parameters
       
  5571 // (other items were commented in a header).
       
  5572 // ---------------------------------------------------------------------------
       
  5573 //
       
  5574 void CMmPhoneTsy::CompleteImsAuthentication( 
       
  5575     CMmDataPackage* aDataPackage, 
       
  5576     TInt aResult )
       
  5577     {
       
  5578 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteImsAuthentication");
       
  5579 
       
  5580     // reset req handle. Returns the deleted req handle
       
  5581     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  5582         EMultimodePhoneIMSAuthenticate );
       
  5583     if ( KErrNone == aResult )
       
  5584         {
       
  5585         if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  5586             { 
       
  5587             RMobilePhone::TImsAuthenticateDataV5* authenticationData;
       
  5588             
       
  5589             aDataPackage->UnPackData( &authenticationData );
       
  5590 			
       
  5591 			RMobilePhone::TImsAuthenticateDataV5Pckg* entryPckg =
       
  5592         	REINTERPRET_CAST
       
  5593         	( RMobilePhone::TImsAuthenticateDataV5Pckg*, 
       
  5594                 iIMSAuthenticationData );
       
  5595    			RMobilePhone::TImsAuthenticateDataV5& authData = ( *entryPckg )();
       
  5596 
       
  5597             // Copy data to client
       
  5598             authData.iRES.Copy( authenticationData->iRES );
       
  5599             authData.iCK.Copy( authenticationData->iCK );
       
  5600             authData.iIK.Copy( authenticationData->iIK );
       
  5601             
       
  5602             iIMSAuthenticationData = NULL;
       
  5603 
       
  5604             ReqCompleted( reqHandle, aResult );
       
  5605             }
       
  5606         }
       
  5607     else if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  5608         {
       
  5609         if ( KErrTimedOut == aResult )
       
  5610             {
       
  5611             iIMSAuthenticationData = NULL;
       
  5612             }
       
  5613         else
       
  5614             {
       
  5615             RMobilePhone::TImsAuthenticateDataV5* authenticationData;
       
  5616             aDataPackage->UnPackData( &authenticationData );
       
  5617 			
       
  5618 			RMobilePhone::TImsAuthenticateDataV5Pckg* entryPckg =
       
  5619         	REINTERPRET_CAST
       
  5620         	( RMobilePhone::TImsAuthenticateDataV5Pckg*, 
       
  5621                 iIMSAuthenticationData );
       
  5622    			RMobilePhone::TImsAuthenticateDataV5& authData = ( *entryPckg )();
       
  5623    		
       
  5624             // It is possible that request is completed whithout any data
       
  5625             // inside datapackage
       
  5626             if ( NULL != authenticationData )
       
  5627                 {
       
  5628                 authData.iAUTS.Copy( authenticationData->iAUTS );
       
  5629 
       
  5630                 iIMSAuthenticationData = NULL;
       
  5631                 }
       
  5632             }
       
  5633         ReqCompleted( reqHandle, aResult );
       
  5634         }
       
  5635     }
       
  5636 
       
  5637 // ---------------------------------------------------------------------------
       
  5638 // CMmPhoneTsy::ImsAuthenticationCancel
       
  5639 // Cancels sim authentication request
       
  5640 // (other items were commented in a header).
       
  5641 // ---------------------------------------------------------------------------
       
  5642 //
       
  5643 TInt CMmPhoneTsy::ImsAuthenticationCancel()
       
  5644     {
       
  5645 TFLOGSTRING("TSY: CMmPhoneTsy::ImsAuthenticationCancel");
       
  5646     // reset the reqhandle
       
  5647     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  5648         EMultimodePhoneIMSAuthenticate );
       
  5649 
       
  5650     // reset pointer to client data
       
  5651     iIMSAuthenticationData = NULL;
       
  5652 
       
  5653     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  5654     	{
       
  5655     	// complete
       
  5656     	ReqCompleted( reqHandle, KErrCancel );
       
  5657     	}
       
  5658 
       
  5659     return KErrNone;
       
  5660     }
       
  5661 
       
  5662 // ---------------------------------------------------------------------------
       
  5663 // CMmPhoneTsy::GetMailboxNumbers
       
  5664 // Requests mailbox numbers identifier information   
       
  5665 // (other items were commented in a header).
       
  5666 // ---------------------------------------------------------------------------
       
  5667 //
       
  5668 TInt CMmPhoneTsy::GetMailboxNumbersL(
       
  5669     TDes8* aMailBox )
       
  5670     {
       
  5671 TFLOGSTRING("TSY: CMmPhoneTsy::GetMailboxNumbersL");
       
  5672     TInt ret = KErrServerBusy;
       
  5673     
       
  5674     // Check if request handle already exists
       
  5675     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
       
  5676         EMultimodePhoneGetMailboxNumbers );   
       
  5677 
       
  5678     if ( EMultimodePhoneReqHandleUnknown == reqHandle )
       
  5679         {
       
  5680         ret = KErrArgument;        
       
  5681         if ( sizeof( RMobilePhone::TMobilePhoneVoicemailIdsV3 ) <=
       
  5682              aMailBox->MaxLength() )
       
  5683             {
       
  5684             // Unpack entry parameter
       
  5685             RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg* entryPckg =
       
  5686             REINTERPRET_CAST
       
  5687             ( RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg*, aMailBox );
       
  5688             
       
  5689             RMobilePhone::TMobilePhoneVoicemailIdsV3& mailboxData = 
       
  5690               ( *entryPckg )();
       
  5691 
       
  5692             if ( KETelExtMultimodeV3 == mailboxData.ExtensionId() )
       
  5693                 {
       
  5694                 // Save pointer to client space
       
  5695                 iMailBoxData = aMailBox;
       
  5696 
       
  5697                 CMmDataPackage mailBoxDataPackage;
       
  5698                 mailBoxDataPackage.PackData( &mailboxData );
       
  5699 
       
  5700                 ret = ( MessageManager()->HandleRequestL(
       
  5701                     EMobilePhoneGetMailboxNumbers, &mailBoxDataPackage ) );
       
  5702 
       
  5703                 // Store request handle if KErrNone
       
  5704                 if ( KErrNone == ret )
       
  5705                     {
       
  5706                     iReqHandleType = EMultimodePhoneGetMailboxNumbers;
       
  5707                     }
       
  5708                 }
       
  5709             }
       
  5710         }
       
  5711     return ret;
       
  5712     }
       
  5713 
       
  5714 // ---------------------------------------------------------------------------
       
  5715 // CMmPhoneTsy::CompleteGetMailboxNumbers
       
  5716 // Completes GetMailboxNumbers request
       
  5717 // (other items were commented in a header).
       
  5718 // ---------------------------------------------------------------------------
       
  5719 //
       
  5720 void CMmPhoneTsy::CompleteGetMailboxNumbers( 
       
  5721     CMmDataPackage* aDataPackage, 
       
  5722     TInt aResult )
       
  5723     {
       
  5724 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteGetMailboxNumbers");
       
  5725 
       
  5726     // reset req handle. Returns the deleted req handle
       
  5727     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  5728         EMultimodePhoneGetMailboxNumbers );
       
  5729         
       
  5730     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  5731         { 
       
  5732         if ( KErrNone == aResult )
       
  5733         	{	
       
  5734 	        RMobilePhone::TMobilePhoneVoicemailIdsV3* mailboxData;
       
  5735 	        
       
  5736 	        aDataPackage->UnPackData( mailboxData );
       
  5737 			
       
  5738 			RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg* entryPckg =
       
  5739 	    	REINTERPRET_CAST
       
  5740 	    	( RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg*, iMailBoxData );
       
  5741 	    	
       
  5742 			RMobilePhone::TMobilePhoneVoicemailIdsV3& clientData = ( *entryPckg )();
       
  5743 
       
  5744 	        // Copy data to client
       
  5745 	        clientData = *mailboxData;
       
  5746 		
       
  5747 	        iMailBoxData = NULL;
       
  5748         	}
       
  5749         ReqCompleted( reqHandle, aResult );
       
  5750         }
       
  5751     }
       
  5752     
       
  5753 // ---------------------------------------------------------------------------
       
  5754 // CMmPhoneTsy::GetMailboxNumbersCancel
       
  5755 // Cancels GetMailboxNumbers request
       
  5756 // (other items were commented in a header).
       
  5757 // ---------------------------------------------------------------------------
       
  5758 //
       
  5759 TInt CMmPhoneTsy::GetMailboxNumbersCancel()
       
  5760     {
       
  5761 TFLOGSTRING("TSY: CMmPhoneTsy::GetMailboxNumbersCancel");
       
  5762     // reset the reqhandle
       
  5763     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  5764         EMultimodePhoneGetMailboxNumbers );
       
  5765 
       
  5766     // reset pointer to client data
       
  5767     iMailBoxData = NULL;
       
  5768 
       
  5769     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  5770     	{
       
  5771     	// complete
       
  5772     	ReqCompleted( reqHandle, KErrCancel );
       
  5773     	}
       
  5774 
       
  5775     return KErrNone;
       
  5776     }
       
  5777      
       
  5778 // ---------------------------------------------------------------------------
       
  5779 // CMmPhoneTsy::GetStaticExtensionMode
       
  5780 // This method can be used to find out what protocol mode is
       
  5781 // currently active
       
  5782 // (other items were commented in a header).
       
  5783 // ---------------------------------------------------------------------------
       
  5784 //
       
  5785 void CMmPhoneTsy::GetStaticExtensionMode(
       
  5786     RMobilePhone::TMobilePhoneNetworkMode* aMode )
       
  5787     {
       
  5788     iMmPhoneExtInterface->GetStaticExtensionMode( aMode );
       
  5789     }
       
  5790 
       
  5791 // ---------------------------------------------------------------------------
       
  5792 // CMmPhoneTsy::RemoveLine
       
  5793 // Marks a line as removed in LineList and recalculates
       
  5794 // phone capablities
       
  5795 // (other items were commented in a header).
       
  5796 // ---------------------------------------------------------------------------
       
  5797 //
       
  5798 void CMmPhoneTsy::RemoveLine(
       
  5799     const TName& aLineName )
       
  5800     {
       
  5801     TUint newCaps ( 0 );
       
  5802     CMmLineTsy* mmLine = NULL;
       
  5803 	RMobilePhone::TMobileService lineMode ( RMobilePhone::EServiceUnspecified );
       
  5804 
       
  5805     // remove line
       
  5806     iLineList->RemoveLine(aLineName);
       
  5807 
       
  5808     // recalculate phone caps
       
  5809     for( TInt i = 0; i < iLineList->GetNumberOfObjects(); i++ )
       
  5810         {
       
  5811         mmLine = REINTERPRET_CAST( CMmLineTsy*,
       
  5812                  iLineList->GetObjectByIndex(i) );
       
  5813         if ( mmLine )
       
  5814             {
       
  5815             lineMode = mmLine->LineMode();
       
  5816             if ( RMobilePhone::EVoiceService == lineMode )
       
  5817                 {
       
  5818                 newCaps += RPhone::KCapsVoice;
       
  5819                 }
       
  5820             else if ( RMobilePhone::EAuxVoiceService == lineMode )
       
  5821                 {
       
  5822                 newCaps += RPhone::KCapsVoice;
       
  5823                 }
       
  5824             else if ( RMobilePhone::ECircuitDataService == lineMode )
       
  5825                 {
       
  5826                 newCaps += RPhone::KCapsData +
       
  5827                        RPhone::KCapsEventModemDetection +
       
  5828                        RPhone::KCapsStealCommPort;
       
  5829                 }
       
  5830             }
       
  5831     }
       
  5832 
       
  5833     //Notify caps change if they have changed.
       
  5834     if ( newCaps != iPhoneCaps.iFlags )
       
  5835         {
       
  5836         iPhoneCaps.iFlags = newCaps;
       
  5837         CompleteNotifyCapsChange();
       
  5838         }
       
  5839     }
       
  5840 
       
  5841 // ---------------------------------------------------------------------------
       
  5842 // CMmPhoneTsy::MessageManager
       
  5843 // Returns a pointer to iMessageManager object
       
  5844 // (other items were commented in a header).
       
  5845 // ---------------------------------------------------------------------------
       
  5846 //
       
  5847 CMmMessageManagerBase* CMmPhoneTsy::MessageManager()
       
  5848     {
       
  5849     return iMessageManager;
       
  5850     }
       
  5851 
       
  5852 #ifdef REQHANDLE_TIMER
       
  5853 
       
  5854 // ---------------------------------------------------------------------------
       
  5855 // CMmPhoneTsy::GetTimeStampStore
       
  5856 // Returns pointer to the response timer store
       
  5857 // (other items were commented in a header).
       
  5858 // ---------------------------------------------------------------------------
       
  5859 //
       
  5860 CResponseTimerStore* CMmPhoneTsy::GetTimeStampStore()
       
  5861     {
       
  5862     return iTimeStampStore;
       
  5863     }
       
  5864 
       
  5865 // ---------------------------------------------------------------------------
       
  5866 // CMmPhoneTsy::GetTimer
       
  5867 // Returns pointer to the response timer
       
  5868 // (other items were commented in a header).
       
  5869 // ---------------------------------------------------------------------------
       
  5870 //
       
  5871 CResponseTimer* CMmPhoneTsy::GetTimer()
       
  5872     {
       
  5873     return iReqHandleTimer;
       
  5874     }
       
  5875 
       
  5876 // ---------------------------------------------------------------------------
       
  5877 // CMmPhoneTsy::TimerExpired
       
  5878 // Completes the request due timer expiration
       
  5879 // (other items were commented in a header).
       
  5880 // ---------------------------------------------------------------------------
       
  5881 //
       
  5882 void CMmPhoneTsy::TimerExpired(
       
  5883     CTelObject *aObject,
       
  5884     TInt aReqHandleType,
       
  5885     TInt aIPC )
       
  5886     {
       
  5887     //Because the timer has expired, send this default error value to
       
  5888     //the compting object.
       
  5889     TInt error( KErrTimedOut );
       
  5890 
       
  5891    //Find the correct tsy object and call its' Complete function
       
  5892 
       
  5893     //Check if the object is the Phone object
       
  5894     if( this == aObject )
       
  5895         {
       
  5896 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - this == aObject");
       
  5897         //call phone object to complete this request
       
  5898         this->Complete( aReqHandleType, error );
       
  5899         }
       
  5900 
       
  5901     //Line does not require timer
       
  5902     TInt i( 0 );
       
  5903 
       
  5904     //Check if the object is a Call object
       
  5905     for ( i = 0; i < iCallList->GetNumberOfObjects(); i++ )
       
  5906         {
       
  5907 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iCallList->GetNumberOfObjects()");
       
  5908         //Get call object
       
  5909         CMmCallTsy* call = iCallList->GetMmCallByIndex( i );
       
  5910         //check if the current call is the object that we are
       
  5911         //trying to find
       
  5912         if( call == aObject )
       
  5913             {
       
  5914 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - call == aObject");
       
  5915             //call the complete method
       
  5916             call->Complete( aReqHandleType, error );
       
  5917             //object found, break
       
  5918             break;
       
  5919             }
       
  5920         }
       
  5921 
       
  5922     // Check if the object is a ConferenceCall object
       
  5923     if ( iMmConferenceCall == aObject )
       
  5924         {
       
  5925 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iMmConferenceCall");
       
  5926         iMmConferenceCall->Complete( aReqHandleType, error );
       
  5927         }
       
  5928     //OTHER MODULES
       
  5929 
       
  5930     //Check if the object is a PBStore object
       
  5931     for ( i = 0; i < iPBList->GetNumberOfObjects(); i++ )
       
  5932         {
       
  5933 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iPBList->GetNumberOfObjects()");
       
  5934         //Get PBStore object
       
  5935         CMmPhoneBookStoreTsy* pbStore = iPBList->GetMmPBByIndex( i );
       
  5936         //check if the current PB is the object that we are
       
  5937         //trying to find
       
  5938         if ( pbStore == aObject )
       
  5939             {
       
  5940 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - aPBStore == aObject");
       
  5941             //call the complete method
       
  5942 			pbStore->Complete( aReqHandleType, error );
       
  5943             //object found, break
       
  5944             break;
       
  5945             }
       
  5946         }
       
  5947 
       
  5948     // Check if the object is the SMS object
       
  5949     if ( iMmSmsTsy == aObject )
       
  5950         {
       
  5951 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iMmSmsTsy == aObject");
       
  5952         //call the complete method
       
  5953         iMmSmsTsy->Complete( aReqHandleType, error );
       
  5954         }
       
  5955     // Check if the object is the Broadcast object
       
  5956     else if ( iMmBroadcastTsy == aObject )
       
  5957         {
       
  5958 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iMmBroadcastTsy == aObject");
       
  5959         //call the complete method
       
  5960         iMmBroadcastTsy->Complete( aReqHandleType, error );
       
  5961         }
       
  5962     // Check if the object is the USSD object
       
  5963     else if ( iMmUssdTsy == aObject )
       
  5964         {
       
  5965 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iMmUssdTsy == aObject");
       
  5966         //call the complete method
       
  5967         iMmUssdTsy->Complete( aReqHandleType, error );
       
  5968         }
       
  5969     // Check if the object is the ONstore object
       
  5970     else if ( iMmONStoreTsy == aObject )
       
  5971         {
       
  5972 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iMmONStoreTsy == aObject");
       
  5973         //call the complete method
       
  5974         iMmONStoreTsy->Complete( aReqHandleType, error );
       
  5975         }
       
  5976     // Check if the object is the ENstore object
       
  5977     else if ( iMmENStoreTsy == aObject )
       
  5978         {
       
  5979 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iMmENStoreTsy == aObject");
       
  5980         //call the complete method
       
  5981         iMmENStoreTsy->Complete( aReqHandleType, error );
       
  5982         }
       
  5983     else if ( iMmCustomTsy == aObject )
       
  5984         {
       
  5985 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - iMmCustomTsy == aObject");
       
  5986         iMmCustomTsy->Complete( aReqHandleType, error , aIPC );
       
  5987         }
       
  5988 
       
  5989     //THESE DO NOT USE REQ HANDLE STORE -> CANNOT USE TIMER
       
  5990     // SAT
       
  5991 
       
  5992     // If Packet Data is included, complete method from Packet Service TSY
       
  5993     // must be called to handler completes if aObject is part of Packet
       
  5994     // Data session
       
  5995     else if ( NULL != iMmPacketServiceTsy )
       
  5996         {
       
  5997 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - NULL != iMmPacketServiceTsy");
       
  5998         //call the complete method
       
  5999         iMmPacketServiceTsy->Complete( aObject, aReqHandleType, error );
       
  6000         }
       
  6001     else
       
  6002     	{
       
  6003 TFLOGSTRING("TSY: CMmPhoneTsy::TimerExpired - else");		
       
  6004         }
       
  6005     }
       
  6006 
       
  6007 // ---------------------------------------------------------------------------
       
  6008 // CMmPhoneTsy::SetTypeOfResponse
       
  6009 // Sets the type of response for a given Handle. Automatic
       
  6010 // mode includes an automatic response in case of non response
       
  6011 // from the LTSY layer in a specified time
       
  6012 // (other items were commented in a header).
       
  6013 // ---------------------------------------------------------------------------
       
  6014 //
       
  6015 void CMmPhoneTsy::SetTypeOfResponse(
       
  6016     const TInt aReqHandleType,
       
  6017     const TTsyReqHandle aTsyReqHandle )
       
  6018     {
       
  6019     TInt timeOut = 0;
       
  6020 
       
  6021     //All possible TSY req handle types are listed in the
       
  6022     //switch case below.
       
  6023     switch ( aReqHandleType )
       
  6024         {
       
  6025       //DTMF
       
  6026         case EMultimodePhoneSendDTMFTones:
       
  6027             timeOut = KMmPhoneSendDTMFTonesTimeOut;
       
  6028             break;
       
  6029         case EMultimodePhoneStartDTMFTone:
       
  6030             timeOut = KMmPhoneStartDTMFToneTimeOut;
       
  6031             break;
       
  6032         case EMultimodePhoneStopDTMFTone:
       
  6033             timeOut = KMmPhoneStopDTMFToneTimeOut;
       
  6034             break;
       
  6035       // All Calls Termination
       
  6036         case EMultimodePhoneTerminateAllCalls:
       
  6037             timeOut = KMmPhoneTerminateAllCallsTimeOut;
       
  6038             break;
       
  6039       //NET
       
  6040         case EMultimodePhoneSelectNetwork:
       
  6041             timeOut = KMmPhoneSelectNetworkTimeOut;
       
  6042             break;
       
  6043         case EMultimodePhoneSendNetworkServiceRequest:
       
  6044             timeOut = KMmPhoneSendNetworkServiceRequestTimeOut;
       
  6045             break;
       
  6046         case EMultimodePhoneSendNetworkServiceRequestNoFdnCheck:
       
  6047             timeOut = KMmPhoneSendNetworkServiceRequestNoFdnCheckTimeOut;
       
  6048             break;                        
       
  6049         case EMultimodePhoneGetDetectedNetworksPhase1:
       
  6050             timeOut = KMmPhoneGetDetectedNetworksPhase1TimeOut;
       
  6051             break;
       
  6052         case EMultimodePhoneSetNWSelectionSetting:
       
  6053             timeOut = KMmPhoneSetNWSelectionSettingTimeOut;
       
  6054             break;
       
  6055         case EMultimodePhoneGetCurrentActiveUSimApplication:        
       
  6056         	timeOut = KMmPhoneGetCurrentActiveUSimApplicationTimeOut;        	
       
  6057             break;                        
       
  6058         case EMultimodePhoneGetAuthorizationInfoPhase1:
       
  6059             timeOut = KMmPhoneGetAuthorizationInfoPhase1TimeOut;
       
  6060             break;
       
  6061 
       
  6062       //SECURITY
       
  6063         case EMultimodePhoneGetLockInfo:
       
  6064             timeOut = KMmPhoneGetLockInfoTimeOut;
       
  6065             break;
       
  6066         case EMultimodePhoneAbortSecurityCode:
       
  6067             timeOut = KMmPhoneAbortSecurityCodeTimeOut;
       
  6068             break;
       
  6069         case EMultimodePhoneVerifySecurityCode:
       
  6070             timeOut = KMmPhoneVerifySecurityCodeTimeOut;
       
  6071             break;
       
  6072         case EMultimodePhoneChangeSecurityCode:
       
  6073             timeOut = KMmPhoneChangeSecurityCodeTimeOut;
       
  6074             break;
       
  6075         case EMultimodePhoneGetSecurityCodeInfoPin1:
       
  6076         case EMultimodePhoneGetSecurityCodeInfoPin2:
       
  6077         case EMultimodePhoneGetSecurityCodeInfoPuk1:
       
  6078         case EMultimodePhoneGetSecurityCodeInfoPuk2:
       
  6079         case EMultimodePhoneGetSecurityCodeInfoPhonePassword:
       
  6080         case EMultimodePhoneGetSecurityCodeInfoSPC:
       
  6081         case EMultimodePhoneGetSecurityCodeInfoPhonebookHiddenKey:
       
  6082         case EMultimodePhoneGetSecurityCodeInfoUSIMAppPin:
       
  6083         case EMultimodePhoneGetSecurityCodeInfoSecondUSIMAppPin:
       
  6084         case EMultimodePhoneGetSecurityCodeInfoUniversalPin:
       
  6085         case EMultimodePhoneGetSecurityCodeInfoUniversalPuk:
       
  6086             timeOut = KMmPhoneGetSecurityCodeInfoTimeOut;
       
  6087             break;
       
  6088 
       
  6089       //SS
       
  6090         case EMultimodePhoneSetCallForwardingStatus:
       
  6091             timeOut = KMmPhoneSetCallForwardingStatusTimeOut;
       
  6092             break;
       
  6093         case EMultimodePhoneSetCallBarringStatus:
       
  6094             timeOut = KMmPhoneSetCallBarringStatusTimeOut;
       
  6095             break;
       
  6096         case EMultimodePhoneGetCallForwardingStatusPhase1:
       
  6097             timeOut = KMmPhoneGetCallForwardingStatusPhase1TimeOut;
       
  6098             break;
       
  6099         case EMultimodePhoneGetCallBarringStatusPhase1:
       
  6100             timeOut = KMmPhoneGetCallBarringStatusPhase1TimeOut;
       
  6101             break;
       
  6102         case EMultimodePhoneGetCallWaitingStatusPhase1:
       
  6103             timeOut = KMmPhoneGetCallWaitingStatusPhase1TimeOut;
       
  6104             break;
       
  6105         case EMultimodePhoneSetSSPassword:
       
  6106             timeOut = KMmPhoneSetSSPasswordTimeOut;
       
  6107             break;
       
  6108         case EMultimodePhoneSetCallWaitingStatus:
       
  6109             timeOut = KMmPhoneSetCallWaitingStatusTimeOut;
       
  6110             break;
       
  6111         case EMultimodePhoneGetIdentityServiceStatus:
       
  6112            timeOut = KMmPhoneGetIdentityServiceStatusTimeOut;
       
  6113             break;
       
  6114         case EMultimodePhoneGetAlsLine:
       
  6115             timeOut = KMmPhoneGetAlsLineTimeOut;
       
  6116             break;
       
  6117         case EMultimodePhoneSetAlsLine:
       
  6118             timeOut = KMmPhoneSetAlsLineTimeOut;
       
  6119             break;
       
  6120         // SIM access and capabilities
       
  6121         case EMultimodePhoneGetServiceTable:
       
  6122             timeOut = KMmPhoneGetServiceTableTimeOut;
       
  6123             break;
       
  6124         case EMultimodePhoneGetCustomerServiceProfile:
       
  6125             timeOut = KMmPhoneGetCustomerServiceProfileTimeOut;
       
  6126             break;
       
  6127         case EMultimodePhoneGetPhoneStoreInfo:
       
  6128             timeOut = KMmPhoneGetPhoneStoreInfoTimeOut;
       
  6129             break;
       
  6130         case EMultimodePhoneGetServiceProviderName:
       
  6131             timeOut = KMmPhoneGetServiceProvicedNameTimeOut;
       
  6132             break;
       
  6133         case EMultimodePhoneIMSAuthenticate:
       
  6134             timeOut = KMmPhoneIMSAuthenticateTimeOut;
       
  6135             break;
       
  6136        	case EMultimodePhoneGetMailboxNumbers:
       
  6137        		timeOut = KMmPhoneGetMailboxNumbersTimeOut;
       
  6138        		break;
       
  6139         case EMultimodePhoneEnumerateAPNEntries:
       
  6140             timeOut = KMmPhoneEnumerateAPNEntriesTimeOut;
       
  6141             break;
       
  6142         case EMultimodePhoneGetAPNname:
       
  6143             timeOut = KMmPhoneGetAPNnameTimeOut;
       
  6144             break;
       
  6145         case EMultimodePhoneGetIccMessageWaitingIndicators:
       
  6146             timeOut = KMmPhoneGetIccMessageWaitingIndicators;
       
  6147             break;
       
  6148         case EMultimodePhoneSetIccMessageWaitingIndicators:
       
  6149             timeOut = KMmPhoneSetIccMessageWaitingIndicators;
       
  6150             break;
       
  6151         case EMultimodePhoneAppendAPNName:
       
  6152             timeOut = KMmPhoneAppendAPNNameTimeOut;
       
  6153             break;
       
  6154         case EMultimodePhoneDeleteAPNName:
       
  6155             timeOut = KMmPhoneDeleteAPNNameTimeOut;
       
  6156             break;
       
  6157         case EMultimodePhoneSetAPNControlListServiceStatus:
       
  6158             timeOut = KMmPhoneSetAPNControlListServiceStatusTimeOut;
       
  6159             break;
       
  6160         case EMultimodePhoneGetAPNControlListServiceStatus:
       
  6161             timeOut = KMmPhoneGetAPNControlListServiceStatusTimeOut;
       
  6162             break;
       
  6163         case EMultimodePhoneGetFdnStatus:
       
  6164             timeOut = KMmPhoneGetFdnStatusTimeOut;
       
  6165             break;
       
  6166 
       
  6167       //Do not use timer in these cases
       
  6168       // - all notification requests
       
  6169         //case EMultimodePhoneNotifyModemDetected:
       
  6170         //case EMultimodePhoneCapsChangeNotification:
       
  6171         //case EMultimodePhoneNotifyDTMFCaps:
       
  6172         //case EMultimodePhoneNotifyNetworkRegistrationStatusChange:
       
  6173         //case EMultimodePhoneNotifyModeChange:
       
  6174         //case EMultimodePhoneNotifyCurrentNetworkChange:
       
  6175         //case EMultimodePhoneNotifySignalStrengthChange:
       
  6176         //case EMultimodePhoneNotifyNITZInfoChange:
       
  6177         //case EMultimodePhoneNotifyNWSelectionSettingChange:
       
  6178         //case EMultimodePhoneNotifyNWTimeInfoChange:
       
  6179         //case EMultimodePhoneNotifyCallForwardingStatusChange:
       
  6180         //case EMultimodePhoneNotifyCallBarringStatusChange:
       
  6181         //case EMultimodePhoneNotifyCallWaitingStatusChange:
       
  6182         //case EMultimodePhoneNotifyAlsLineChange:
       
  6183         //case EMultimodePhoneNotifyFdnStatusChange:
       
  6184         //case EMultimodePhoneNotifySecurityCapsChange:
       
  6185         //case EMultimodePhoneNotifyLockInfoChange:
       
  6186         //case EMultimodePhoneNotifySecurityEvent:
       
  6187         //case EMultimodePhoneNotifyBatteryInfoChange:
       
  6188         //case EMultimodePhoneNotifyStopInDTMFString:
       
  6189         //case EMultimodePhoneNotifyCallServiceCapsChange:
       
  6190         //case EMultimodePhoneNotifyCallForwardingActive:
       
  6191         //case EMultimodePhoneNotifyIccAccessCapsChange:
       
  6192         //case EMultimodePhoneNotifyIccMessageWaitingIndicatorsChange:
       
  6193         //case EMultimodePhoneNotifySecurityCodeInfoChange:
       
  6194         //case EMultimodePhoneNotifySendNetworkRequest:
       
  6195 
       
  6196       //SS features that require PIN verification. Therefore the
       
  6197       //request is 2-phased which means that possibility for dead-lock
       
  6198       //is so high that timer is not used.
       
  6199         //case EMultimodePhoneSetFdnSetting:
       
  6200         //case EMultimodePhoneSetLockSetting:
       
  6201 
       
  6202         default:
       
  6203               iTsyReqHandleStore->SetTsyReqHandle(
       
  6204                     aReqHandleType,
       
  6205                     aTsyReqHandle );
       
  6206               break;
       
  6207         }
       
  6208 
       
  6209     //if timeout is requested
       
  6210     if ( timeOut > 0 )
       
  6211         {
       
  6212         //set time out
       
  6213         iTsyReqHandleStore->SetTsyReqHandle(
       
  6214                 aReqHandleType,
       
  6215                 aTsyReqHandle,
       
  6216                 timeOut );
       
  6217         }
       
  6218     }
       
  6219 
       
  6220 // ---------------------------------------------------------------------------
       
  6221 // CMmPhoneTsy::Complete
       
  6222 // Completes the request due timer expiration
       
  6223 // (other items were commented in a header).
       
  6224 // ---------------------------------------------------------------------------
       
  6225 //
       
  6226 void CMmPhoneTsy::Complete(
       
  6227     TInt aReqHandleType,
       
  6228     TInt aError )
       
  6229     {
       
  6230 	CMmDataPackage dataPackage;
       
  6231 	RMobilePhone:: TMobilePhoneLockStatus lock;
       
  6232 	RMobilePhone::TMobilePhoneLockSetting setting;
       
  6233 	RMobilePhone::TMobilePhoneCspFileV1 emptyCspFile;
       
  6234 	RMobilePhone::TMobilePhoneServiceTableV1 emptyServiceTable;
       
  6235 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 emptyPhoneStoreInfo;
       
  6236 	TInt trapError = KErrNone;
       
  6237 TFLOGSTRING2("TSY: CMmPhoneTsy::Complete - ReqHandleType: %d", aReqHandleType);	
       
  6238     switch( aReqHandleType )
       
  6239         {
       
  6240         case EMultimodePhoneTerminateAllCalls:
       
  6241         	CompleteTerminateAllCallsReq(aError);
       
  6242         	break;
       
  6243       //DTMF
       
  6244         case EMultimodePhoneSendDTMFTones:
       
  6245         case EMultimodePhoneStartDTMFTone:
       
  6246         case EMultimodePhoneStopDTMFTone:
       
  6247 			// forward to DTMF Tsy
       
  6248 			iMmDtmfTsy->Complete( aReqHandleType, aError );
       
  6249             break;
       
  6250 
       
  6251 	  //SS
       
  6252         case EMultimodePhoneSetCallForwardingStatus:
       
  6253         case EMultimodePhoneGetCallForwardingStatusPhase1:
       
  6254         case EMultimodePhoneGetCallBarringStatusPhase1:
       
  6255         case EMultimodePhoneSetCallBarringStatus:
       
  6256         case EMultimodePhoneSetSSPassword:
       
  6257         case EMultimodePhoneGetCallWaitingStatusPhase1:
       
  6258         case EMultimodePhoneSetCallWaitingStatus:
       
  6259         case EMultimodePhoneGetIdentityServiceStatus:
       
  6260         case EMultimodePhoneSendNetworkServiceRequest:
       
  6261         case EMultimodePhoneSendNetworkServiceRequestNoFdnCheck:
       
  6262         case EMultimodePhoneGetIccMessageWaitingIndicators:
       
  6263         case EMultimodePhoneSetIccMessageWaitingIndicators:
       
  6264             iMmSupplServTsy->Complete( aReqHandleType, aError );
       
  6265             break;
       
  6266 
       
  6267 		//NET
       
  6268         case EMultimodePhoneSelectNetwork:
       
  6269             iMmNetTsy->CompleteSelectNetwork( aError );
       
  6270             break;
       
  6271         case EMultimodePhoneGetDetectedNetworksPhase1:
       
  6272             // Catch possible leave. If this call leaves, there is nothing
       
  6273             // we can do.
       
  6274             TRAP_IGNORE( iMmNetTsy->ProcessGetDetectedNetworksPhase1L( NULL, 
       
  6275             	aError ) );
       
  6276             break;
       
  6277         case EMultimodePhoneSetNWSelectionSetting:
       
  6278             iMmNetTsy->CompleteSetNetworkSelectionSetting( aError );
       
  6279             break;
       
  6280         case EMultimodePhoneGetAuthorizationInfoPhase1:
       
  6281         	TRAP_IGNORE( iMmNetTsy->ProcessGetAuthorizationInfoPhase1L( NULL,
       
  6282         			aError ));
       
  6283             break;
       
  6284         case EMobilePhoneGetCurrentActiveUSimApplication:
       
  6285             break;            
       
  6286 
       
  6287       //SECURITY
       
  6288         case EMultimodePhoneGetLockInfo:
       
  6289             lock = RMobilePhone::EStatusLockUnknown;
       
  6290             setting = RMobilePhone::ELockSetUnknown;
       
  6291 
       
  6292             dataPackage.PackData(&lock, &setting );
       
  6293             iMmSecurityTsy->CompleteGetLockInfo( &dataPackage,
       
  6294                 aError );
       
  6295             break;
       
  6296         case EMultimodePhoneAbortSecurityCode:
       
  6297             iMmSecurityTsy->CompleteAbortSecurityCode( aError );
       
  6298             break;
       
  6299         case EMultimodePhoneVerifySecurityCode:
       
  6300             TRAP( trapError,
       
  6301             	  iMmSecurityTsy->CompleteVerifySecurityCodeL( aError ); );
       
  6302             break;
       
  6303         case EMultimodePhoneChangeSecurityCode:
       
  6304             iMmSecurityTsy->CompleteChangeSecurityCode( aError );
       
  6305             break;
       
  6306         case EMultimodePhoneGetSecurityCodeInfoPin1:
       
  6307         case EMultimodePhoneGetSecurityCodeInfoPin2:
       
  6308         case EMultimodePhoneGetSecurityCodeInfoPuk1:
       
  6309         case EMultimodePhoneGetSecurityCodeInfoPuk2:
       
  6310         case EMultimodePhoneGetSecurityCodeInfoPhonePassword:
       
  6311         case EMultimodePhoneGetSecurityCodeInfoSPC:
       
  6312         case EMultimodePhoneGetSecurityCodeInfoPhonebookHiddenKey:
       
  6313         case EMultimodePhoneGetSecurityCodeInfoUSIMAppPin:
       
  6314         case EMultimodePhoneGetSecurityCodeInfoSecondUSIMAppPin:
       
  6315         case EMultimodePhoneGetSecurityCodeInfoUniversalPin:
       
  6316         case EMultimodePhoneGetSecurityCodeInfoUniversalPuk:
       
  6317         	TimeoutGetSecurityCodeInfo(aReqHandleType, aError);
       
  6318             break;
       
  6319 
       
  6320       //SS
       
  6321         case EMultimodePhoneGetAlsLine:
       
  6322             CompleteGetAlsLine( RMobilePhone::EAlternateLineNotAvailable,
       
  6323                                 aError );
       
  6324             break;
       
  6325         case EMultimodePhoneSetAlsLine:
       
  6326             CompleteSetAlsLine( aError );
       
  6327             break;
       
  6328         //SIM access and capabilities
       
  6329         case EMultimodePhoneGetServiceTable:
       
  6330             TRAP_IGNORE( CompleteGetServiceTableL( 
       
  6331             		emptyServiceTable, aError ); );
       
  6332             break;
       
  6333         case EMultimodePhoneGetCustomerServiceProfile:
       
  6334             CompleteGetCustomerServiceProfile( emptyCspFile, aError );
       
  6335             break;
       
  6336         case EMultimodePhoneGetPhoneStoreInfo:
       
  6337             CompleteGetPhoneStoreInfo( emptyPhoneStoreInfo, aError );
       
  6338             break;
       
  6339         case EMultimodePhoneIMSAuthenticate:
       
  6340                 CompleteImsAuthentication( NULL, aError );
       
  6341              break;
       
  6342         case EMultimodePhoneEnumerateAPNEntries:
       
  6343             CompleteEnumerateAPNEntries( NULL, aError );
       
  6344             break;
       
  6345         case EMultimodePhoneGetAPNname:
       
  6346             CompleteGetAPNname( NULL, aError );
       
  6347             break;
       
  6348         case EMultimodePhoneAppendAPNName:
       
  6349             CompleteAppendAPNName( aError );
       
  6350             break;
       
  6351         case EMultimodePhoneDeleteAPNName:
       
  6352             CompleteDeleteAPNName( aError );
       
  6353             break;
       
  6354         case EMultimodePhoneSetAPNControlListServiceStatus:
       
  6355             CompleteSetAPNControlListServiceStatus( aError );
       
  6356             break;
       
  6357         case EMultimodePhoneGetAPNControlListServiceStatus:
       
  6358             CompleteGetAPNControlListServiceStatus( NULL, aError );
       
  6359             break;
       
  6360         case EMultimodePhoneGetServiceProviderName:
       
  6361             CompleteGetServiceProviderName( NULL, aError );            
       
  6362             break;     
       
  6363         case EMultimodePhoneGetFdnStatus:
       
  6364             CompleteGetFdnStatus( NULL, aError );
       
  6365             break;         
       
  6366         default:
       
  6367 TFLOGSTRING("TSY: CMmPhoneTsy::Complete default handle type" );        
       
  6368             if ( iTsyReqHandleStore->GetTsyReqHandle(
       
  6369                     aReqHandleType ))
       
  6370             	{
       
  6371             	ReqCompleted( iTsyReqHandleStore->ResetTsyReqHandle(
       
  6372                     aReqHandleType ), aError );
       
  6373             	}
       
  6374             break;
       
  6375         }
       
  6376 
       
  6377     }
       
  6378 
       
  6379 // ---------------------------------------------------------------------------
       
  6380 // CMmPhoneTsy::TimeoutGetSecurityCodeInfo
       
  6381 // Sets the security code when the request completes due to timer expiration
       
  6382 // and then it calls the completion function to handle the timeout event.
       
  6383 // (other items were commented in a header).
       
  6384 // ---------------------------------------------------------------------------
       
  6385 //
       
  6386 void CMmPhoneTsy::TimeoutGetSecurityCodeInfo(
       
  6387 		const TInt aReqHandleType, 
       
  6388 		const TInt aError)
       
  6389 	{
       
  6390 	CMmDataPackage dataPackage;
       
  6391   	RMobilePhone::TMobilePhoneSecurityCode secCode;
       
  6392    	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  6393 
       
  6394 	switch (aReqHandleType)
       
  6395 		{
       
  6396 		case EMultimodePhoneGetSecurityCodeInfoPin1:
       
  6397 			secCode = RMobilePhone::ESecurityCodePin1;
       
  6398 			break;
       
  6399         case EMultimodePhoneGetSecurityCodeInfoPin2:
       
  6400         	secCode = RMobilePhone::ESecurityCodePin2;
       
  6401         	break;
       
  6402         case EMultimodePhoneGetSecurityCodeInfoPuk1:
       
  6403         	secCode = RMobilePhone::ESecurityCodePuk1;
       
  6404         	break;
       
  6405         case EMultimodePhoneGetSecurityCodeInfoPuk2:
       
  6406         	secCode = RMobilePhone::ESecurityCodePuk2;
       
  6407         	break;
       
  6408         case EMultimodePhoneGetSecurityCodeInfoPhonePassword:
       
  6409         	secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  6410         	break;
       
  6411         case EMultimodePhoneGetSecurityCodeInfoSPC:
       
  6412         	secCode = RMobilePhone::ESecurityCodeSPC;
       
  6413         	break;
       
  6414         case EMultimodePhoneGetSecurityCodeInfoPhonebookHiddenKey:
       
  6415         	secCode = RMobilePhone::ESecurityHiddenKey;
       
  6416         	break;
       
  6417         case EMultimodePhoneGetSecurityCodeInfoUSIMAppPin:
       
  6418         	secCode = RMobilePhone::ESecurityUSIMAppPin;
       
  6419         	break;
       
  6420         case EMultimodePhoneGetSecurityCodeInfoSecondUSIMAppPin:
       
  6421         	secCode = RMobilePhone::ESecuritySecondUSIMAppPin;
       
  6422         	break;
       
  6423         case EMultimodePhoneGetSecurityCodeInfoUniversalPin:
       
  6424         	secCode = RMobilePhone::ESecurityUniversalPin;
       
  6425         	break;
       
  6426         case EMultimodePhoneGetSecurityCodeInfoUniversalPuk:
       
  6427         	secCode = RMobilePhone::ESecurityUniversalPuk;
       
  6428         	break;
       
  6429 		}
       
  6430 	dataPackage.PackData(&secCode, &codeV5 );
       
  6431 
       
  6432     iMmSecurityTsy->CompleteGetSecurityCodeInfo( 
       
  6433         &dataPackage, aError );
       
  6434 	}
       
  6435 
       
  6436 #endif
       
  6437 
       
  6438 
       
  6439 #ifdef TF_LOGGING_ENABLED
       
  6440 // ---------------------------------------------------------------------------
       
  6441 // CMmPhoneTsy::ReqCompleted
       
  6442 // Overloads CTelObject::ReqCompleted for logging purposes. It
       
  6443 // prints the aTsyReqHandle and aError variable in the log file and then
       
  6444 // calls CTelObject::ReqCompleted
       
  6445 // (other items were commented in a header).
       
  6446 // ---------------------------------------------------------------------------
       
  6447 //
       
  6448 void CMmPhoneTsy::ReqCompleted(
       
  6449     const TTsyReqHandle aTsyReqHandle,
       
  6450     const TInt aError  )
       
  6451     {
       
  6452 TFLOGSTRING3("TSY: CMmPhoneTsy::Request Completed - Handle:%d Error:%d", aTsyReqHandle, aError);
       
  6453 
       
  6454     CTelObject::ReqCompleted( aTsyReqHandle, aError );
       
  6455 
       
  6456     }
       
  6457 #endif
       
  6458 
       
  6459 // ---------------------------------------------------------------------------
       
  6460 // CMmPhoneTsy::SetWaitingCallForData
       
  6461 // Set iMmWaitingDataCall pointer to call object waiting to
       
  6462 // answer incoming call
       
  6463 // (other items were commented in a header).
       
  6464 // ---------------------------------------------------------------------------
       
  6465 //
       
  6466 void CMmPhoneTsy::SetWaitingCallForData(
       
  6467     CMmCallTsy* aMmCall )
       
  6468     {
       
  6469     iMmWaitingDataCall = aMmCall;
       
  6470     }
       
  6471 
       
  6472 // ---------------------------------------------------------------------------
       
  6473 // CMmPhoneTsy::WaitingCallForData
       
  6474 // Return WaitingCallForData pointer of call object wishing to
       
  6475 // answer incoming call
       
  6476 // (other items were commented in a header).
       
  6477 // ---------------------------------------------------------------------------
       
  6478 //
       
  6479 CMmCallTsy* CMmPhoneTsy::WaitingCallForData()
       
  6480     {
       
  6481     return iMmWaitingDataCall;
       
  6482     }
       
  6483 
       
  6484 // ---------------------------------------------------------------------------
       
  6485 // CMmPhoneTsy::ResetPacketDataSession
       
  6486 // Sets Packet Data pointer to NULL
       
  6487 // (other items were commented in a header).
       
  6488 // ---------------------------------------------------------------------------
       
  6489 //
       
  6490 void CMmPhoneTsy::ResetPacketDataSession()
       
  6491     {
       
  6492     iMmPacketServiceTsy = NULL;
       
  6493     }
       
  6494 
       
  6495 // ---------------------------------------------------------------------------
       
  6496 // CMmPhoneTsy::AirTimeTimerCheckStart
       
  6497 // Starts the air time duration timer when the first call is
       
  6498 // in active state. Increases the amount of active calls
       
  6499 // stored in the internal variable iAmountOfActiveCalls
       
  6500 // (other items were commented in a header).
       
  6501 // ---------------------------------------------------------------------------
       
  6502 //
       
  6503 void CMmPhoneTsy::AirTimeTimerCheckStart()
       
  6504     {
       
  6505     //check if any call is active already
       
  6506     if ( 0 == iAmountOfActiveCalls )
       
  6507         {
       
  6508         //this is first call in active state, start the timer
       
  6509         iAirTimeDurationTimer->StartAirTimeDuration();
       
  6510         }
       
  6511     //increase the count of active calls
       
  6512     iAmountOfActiveCalls++;
       
  6513     }
       
  6514 
       
  6515 // ---------------------------------------------------------------------------
       
  6516 // CMmPhoneTsy::AirTimeTimerCheckStop
       
  6517 // Stops the air time duration timer when all calls are in idle
       
  6518 // state. Decreases the amount of active calls
       
  6519 // stored in the internal variable iAmountOfActiveCalls
       
  6520 // (other items were commented in a header).
       
  6521 // ---------------------------------------------------------------------------
       
  6522 //
       
  6523 void CMmPhoneTsy::AirTimeTimerCheckStop()
       
  6524     {
       
  6525     //check if any call is active
       
  6526     if( iAmountOfActiveCalls > 0 )
       
  6527         {
       
  6528         //decrease the amount of active calls
       
  6529         iAmountOfActiveCalls--;
       
  6530         }
       
  6531 
       
  6532     //check that there are no calls active
       
  6533     if ( 0 == iAmountOfActiveCalls )
       
  6534         {
       
  6535         iAirTimeDurationTimer->Stop();
       
  6536         }
       
  6537     }
       
  6538 
       
  6539 // ---------------------------------------------------------------------------
       
  6540 // CMmPhoneTsy::GetAirTimeDuration
       
  6541 // Gets the value of the air time duration timer
       
  6542 // set the number of beats of iAirTimeDurationTimer in aTime
       
  6543 // (other items were commented in a header).
       
  6544 // ---------------------------------------------------------------------------
       
  6545 //
       
  6546 void CMmPhoneTsy::GetAirTimeDuration( TTimeIntervalSeconds &aTime )
       
  6547     {
       
  6548     //number of beats can hold two possible values:
       
  6549     //if at least one call is active it will return the current seconds of the
       
  6550     //ongoing air time. If no call is active, it will return the amount of
       
  6551     //seconds of the last air duration time
       
  6552 
       
  6553     aTime = iAirTimeDurationTimer->NumberOfBeats();
       
  6554     }
       
  6555 
       
  6556 // ---------------------------------------------------------------------------
       
  6557 // CMmPhoneTsy::GetSatMessaging
       
  6558 // Returns pointer to the SAT service interface.
       
  6559 // (other items were commented in a header).
       
  6560 // ---------------------------------------------------------------------------
       
  6561 //
       
  6562 MStkTsySatService* CMmPhoneTsy::GetSatMessaging()
       
  6563     {
       
  6564     return iTsySatMessaging;
       
  6565     }
       
  6566 
       
  6567 // ---------------------------------------------------------------------------
       
  6568 // CMmPhoneTsy::GetRfStateInfo
       
  6569 // Returns StateInfo
       
  6570 // (other items were commented in a header).
       
  6571 // ---------------------------------------------------------------------------
       
  6572 //
       
  6573 TRfStateInfo CMmPhoneTsy::GetRfStateInfo()
       
  6574     {
       
  6575     return iStateInfo;
       
  6576     }
       
  6577 
       
  6578 // ---------------------------------------------------------------------------
       
  6579 // CMmPhoneTsy::SetRfStateInfo
       
  6580 // Sets StateInfo
       
  6581 // (other items were commented in a header).
       
  6582 // ---------------------------------------------------------------------------
       
  6583 //
       
  6584 void CMmPhoneTsy::SetRfStateInfo( TRfStateInfo aStateInfo )
       
  6585     {
       
  6586     iStateInfo = aStateInfo;
       
  6587     }
       
  6588 
       
  6589 // ---------------------------------------------------------------------------
       
  6590 // CMmPhoneTsy::SetRfStatus
       
  6591 // Sets RfStatus
       
  6592 // (other items were commented in a header).
       
  6593 // ---------------------------------------------------------------------------
       
  6594 //
       
  6595 void CMmPhoneTsy::SetRfStatus(
       
  6596     TRfStatus aRfStatus )
       
  6597     {
       
  6598     iRfStatusFlag = aRfStatus;
       
  6599     }
       
  6600 
       
  6601 // ---------------------------------------------------------------------------
       
  6602 // CMmPhoneTsy::GetRfStatus
       
  6603 // Returns RfStatus
       
  6604 // (other items were commented in a header).
       
  6605 // ---------------------------------------------------------------------------
       
  6606 //
       
  6607 TRfStatus CMmPhoneTsy::GetRfStatus()
       
  6608     {
       
  6609     return iRfStatusFlag;
       
  6610     }
       
  6611 
       
  6612 // ---------------------------------------------------------------------------
       
  6613 // CMmPhoneTsy::GetNetTsy
       
  6614 // Returns NetTsy instance
       
  6615 // (other items were commented in a header).
       
  6616 // ---------------------------------------------------------------------------
       
  6617 //
       
  6618 CMmNetTsy* CMmPhoneTsy::GetNetTsy()
       
  6619     {
       
  6620     return iMmNetTsy;
       
  6621     }
       
  6622 
       
  6623 // ---------------------------------------------------------------------------
       
  6624 // CMmPhoneTsy::GetONStoreTsy
       
  6625 // Returns pointer to CMmONStoreTsy
       
  6626 // (other items were commented in a header).
       
  6627 // ---------------------------------------------------------------------------
       
  6628 //
       
  6629 CMmONStoreTsy* CMmPhoneTsy::GetONStoreTsy()
       
  6630     {
       
  6631     return iMmONStoreTsy;
       
  6632     }
       
  6633 
       
  6634 // ---------------------------------------------------------------------------
       
  6635 // CMmPhoneTsy::GetDtmfTsy
       
  6636 // Get pointer to DTMF Tsy.
       
  6637 // (other items were commented in a header).
       
  6638 // ---------------------------------------------------------------------------
       
  6639 //
       
  6640 CMmDtmfTsy* CMmPhoneTsy::GetDtmfTsy()
       
  6641     {
       
  6642     return iMmDtmfTsy;
       
  6643     }
       
  6644 
       
  6645 // ---------------------------------------------------------------------------
       
  6646 // CMmPhoneTsy::GetSupplServTsy
       
  6647 // Get pointer to Supplementary Services Tsy.
       
  6648 // (other items were commented in a header).
       
  6649 // ---------------------------------------------------------------------------
       
  6650 //
       
  6651 CMmSupplServTsy* CMmPhoneTsy::GetSupplServTsy()
       
  6652     {
       
  6653     return iMmSupplServTsy;
       
  6654     }
       
  6655 
       
  6656 // ---------------------------------------------------------------------------
       
  6657 // CMmPhoneTsy::HandleType
       
  6658 // Returns req handle type
       
  6659 // (other items were commented in a header).
       
  6660 // ---------------------------------------------------------------------------
       
  6661 //
       
  6662 CMmPhoneTsy::TPhoneRequestTypes CMmPhoneTsy::HandleType()
       
  6663     {
       
  6664     return iReqHandleType;
       
  6665     }
       
  6666 
       
  6667 // ---------------------------------------------------------------------------
       
  6668 // CMmPhoneTsy::GetSecurityTsy
       
  6669 //  Returns SecurityTsy instance
       
  6670 // (other items were commented in a header).
       
  6671 // ---------------------------------------------------------------------------
       
  6672 //
       
  6673 CMmSecurityTsy* CMmPhoneTsy::GetSecurityTsy()
       
  6674     {
       
  6675     return iMmSecurityTsy;
       
  6676     }
       
  6677 
       
  6678 
       
  6679 // ---------------------------------------------------------------------------
       
  6680 // CMmPhoneTsy::IsRequestPossibleInOffLine
       
  6681 // Checks wether a ETel request can be performed or not while offline mode is
       
  6682 // enabled'
       
  6683 // (other items were commented in a header).
       
  6684 // ---------------------------------------------------------------------------
       
  6685 //
       
  6686 TBool CMmPhoneTsy::IsRequestPossibleInOffline(
       
  6687     TInt aIpc )
       
  6688     {
       
  6689     // we assume here that most of the requests are possible, thefore
       
  6690     // we switch for the not possible ones, optimizing a bit the checking.
       
  6691     TBool isRequestPossible ( ETrue );
       
  6692     
       
  6693     switch ( aIpc )
       
  6694         {
       
  6695         //SS
       
  6696         //case EMobilePhoneGetCallServiceCaps: //OK
       
  6697         //case EMobilePhoneNotifyCallServiceCapsChange://OK
       
  6698         case EMobilePhoneGetCallForwardingStatusPhase1://NO
       
  6699         case EMobilePhoneGetCallForwardingStatusPhase2://NO
       
  6700         case EMobilePhoneSetCallForwardingStatus://NO
       
  6701         //case EMobilePhoneNotifyCallForwardingStatusChange: //OK
       
  6702         //case EMobilePhoneNotifyCallForwardingActive://OK
       
  6703         case EMobilePhoneGetBarringStatusPhase1://NO
       
  6704         case EMobilePhoneGetBarringStatusPhase2://NO
       
  6705         case EMobilePhoneSetCallBarringStatus://NO
       
  6706         //case EMobilePhoneNotifyCallBarringStatusChange: //OK
       
  6707         case EMobilePhoneSetSSPassword://NO
       
  6708         case EMobilePhoneGetWaitingStatusPhase1://NO
       
  6709         case EMobilePhoneGetWaitingStatusPhase2://NO
       
  6710         case EMobilePhoneSetCallWaitingStatus://NO
       
  6711         //case EMobilePhoneNotifyCallWaitingStatusChange://OK
       
  6712         case EMobilePhoneGetIdentityServiceStatus://NO
       
  6713         //case EMobilePhoneSendNetworkServiceRequest://OK
       
  6714         case EMobilePhoneSendNetworkServiceRequestNoFdnCheck: //NO
       
  6715         //case EMobilePhoneNotifyAllSendNetworkServiceRequest: //OK         
       
  6716         //case EMobilePhoneGetIccMessageWaitingIndicators://OK          
       
  6717         //case EMobilePhoneSetIccMessageWaitingIndicators://OK 
       
  6718         //case EMobilePhoneNotifyIccMessageWaitingIndicatorsChange://OK
       
  6719 
       
  6720         //NET
       
  6721         //case EMobilePhoneGetNetworkCaps: //ok
       
  6722         //case EMobilePhoneGetNetworkRegistrationStatus: //ok
       
  6723         //case EMobilePhoneNotifyNetworkRegistrationStatusChange: //ok
       
  6724         //case EMobilePhoneGetCurrentMode: //ok
       
  6725         //case EMobilePhoneNotifyModeChange: //ok
       
  6726         //case EMobilePhoneGetCurrentNetwork://ok
       
  6727         //case EMobilePhoneGetCurrentNetworkNoLocation://ok
       
  6728         //case EMobilePhoneNotifyCurrentNetworkChange://ok
       
  6729         // case EMobilePhoneNotifyCurrentNetworkNoLocationChange: ok
       
  6730         //case EMobilePhoneGetHomeNetwork://ok
       
  6731         case EMobilePhoneGetDetectedNetworksV2Phase1: //NO
       
  6732         case EMobilePhoneGetDetectedNetworksV2Phase2: //NO
       
  6733         //case EMobilePhoneGetNetworkSelectionSetting: //ok
       
  6734         //case EMobilePhoneSetNetworkSelectionSetting: //ok
       
  6735         //case EMobilePhoneNotifyNetworkSelectionSettingChange: //ok
       
  6736         case EMobilePhoneSelectNetwork: //NO
       
  6737         //case EMobilePhoneGetNITZInfo: //ok
       
  6738         //case EMobilePhoneNotifyNITZInfoChange: //ok
       
  6739         //case EMobilePhoneGetSignalCaps: //ok
       
  6740         //case EMobilePhoneGetSignalStrength: //ok
       
  6741         //case EMobilePhoneNotifySignalStrengthChange: //ok
       
  6742         //case EMobilePhoneGetNetworkSecurityLevel://ok
       
  6743         //case EMobilePhoneNotifyNetworkSecurityLevelChange: //ok
       
  6744         //case EMobilePhoneGetCipheringIndicatorStatus://ok
       
  6745 
       
  6746         //SECURITY
       
  6747         //case EMobilePhoneGetSecurityCaps: //ok
       
  6748         //case EMobilePhoneNotifySecurityCapsChange: //ok
       
  6749         //case EMobilePhoneGetLockInfo: //ok
       
  6750         //case EMobilePhoneNotifyLockInfoChange://ok
       
  6751         //case EMobilePhoneSetLockSetting://ok
       
  6752         //case EMobilePhoneChangeSecurityCode://ok
       
  6753         //case EMobilePhoneNotifySecurityEvent://ok
       
  6754         //case EMobilePhoneVerifySecurityCode://ok
       
  6755         //case EMobilePhoneAbortSecurityCode://ok
       
  6756         //case EMobilePhoneGetSecurityCodeInfo://ok
       
  6757         //case EMobilePhoneNotifySecurityCodeInfoChange://ok
       
  6758 
       
  6759         //MISC
       
  6760         //case EMobilePhoneGetServiceProviderName: //ok
       
  6761         //case EMobilePhoneGetIccAccessCaps: //ok
       
  6762         //case EMobilePhoneNotifyIccAccessCapsChange: //ok
       
  6763         //case EMobilePhoneGetCustomerServiceProfile: //ok
       
  6764         //case EMobilePhoneGetServiceTable: //ok
       
  6765         //case EMobilePhoneGetBatteryCaps://ok
       
  6766         //case EMobilePhoneGetBatteryInfo: //ok
       
  6767         //case EMobilePhoneNotifyBatteryInfoChange: //ok
       
  6768         //case EMobilePhoneGetIdentityCaps://ok
       
  6769         //case EMobilePhoneGetPhoneId://ok
       
  6770         //case EMobilePhoneGetSubscriberId://ok
       
  6771         //case EMobilePhoneGetALSLine://ok
       
  6772         //case EMobilePhoneSetALSLine://ok
       
  6773         //case EMobilePhoneNotifyALSLineChange: //ok
       
  6774         //case EMobilePhoneGetFdnStatus: //ok
       
  6775         //case EMobilePhoneSetFdnSetting: //ok
       
  6776         //case EMobilePhoneNotifyFdnStatusChange: //ok
       
  6777         //case EMobilePhoneGetMultimodeCaps: //ok
       
  6778         //case EMobilePhoneGetPhoneStoreInfo: //ok
       
  6779         //case EMobilePhoneNotifyIndicatorChange: //ok
       
  6780         //case EMobilePhoneEnumerateAPNEntries: //ok
       
  6781         //case EMobilePhoneGetAPNname: //ok
       
  6782         //case EMobilePhoneAppendAPNName: //ok
       
  6783         //case EMobilePhoneDeleteAPNName: //ok
       
  6784         //case EMobilePhoneSetAPNControlListServiceStatus: //ok
       
  6785         //case EMobilePhoneGetAPNControlListServiceStatus: //ok
       
  6786         //case EMobilePhoneNotifyAPNListChanged: //ok
       
  6787         //case EMobilePhoneNotifyAPNControlListServiceStatusChange: //ok
       
  6788 
       
  6789         // DTMF
       
  6790         //case EMobilePhoneGetDTMFCaps: //ok
       
  6791         //case EMobilePhoneNotifyDTMFCapsChange: //ok
       
  6792         case EMobilePhoneSendDTMFTones: //NO
       
  6793         case EMobilePhoneStartDTMFTone: //NO
       
  6794         case EMobilePhoneStopDTMFTone: //NO
       
  6795         case EMobilePhoneNotifyStopInDTMFString: //NO
       
  6796         case EMobilePhoneContinueDTMFStringSending: //NO
       
  6797         case EMobilePhoneNotifyDTMFEvent: //NO
       
  6798         case EMobilePhoneReadDTMFTones: //NO
       
  6799             {
       
  6800             isRequestPossible = EFalse;
       
  6801             break;
       
  6802             }
       
  6803             
       
  6804         default:
       
  6805             break;
       
  6806         }
       
  6807 
       
  6808 TFLOGSTRING3("TSY: CMmPhoneTsy::IsRequestPossibleInOffline - IPC:%d, ret:%d", aIpc, isRequestPossible);
       
  6809     return isRequestPossible;
       
  6810     }
       
  6811 
       
  6812 // ----------------------------------------------------------------------------
       
  6813 // CMmPhoneTsy::CompleteGetCallForwardingNumber
       
  6814 // Completes when call forwarding number is ready to be written to P&S
       
  6815 // ----------------------------------------------------------------------------
       
  6816 //
       
  6817 void CMmPhoneTsy::CompleteGetCallForwardingNumber( 
       
  6818     TInt /*aError*/, 
       
  6819     const CMmDataPackage* aDataPackage )
       
  6820     {
       
  6821     //Copy data from package
       
  6822     iCallForwardingNumber.Zero();
       
  6823     aDataPackage->UnPackData( iCallForwardingNumber );
       
  6824 
       
  6825 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetCallForwardingNumber number = %S ", &iCallForwardingNumber);
       
  6826 
       
  6827     }
       
  6828 
       
  6829 // ---------------------------------------------------------------------------
       
  6830 // CMmPhoneTsy::EnumerateAPNEntriesL
       
  6831 // Gets the total number of APN in access point control list (ACL)
       
  6832 // (other items were commented in a header).
       
  6833 // ---------------------------------------------------------------------------
       
  6834 //
       
  6835 TInt CMmPhoneTsy::EnumerateAPNEntriesL( 
       
  6836     const TTsyReqHandle aTsyReqHandle, 
       
  6837     TUint32* aIndex )
       
  6838     {
       
  6839 TFLOGSTRING("TSY: CMmPhoneTsy::EnumerateAPNEntries");
       
  6840 
       
  6841     // Check if request handle already exists
       
  6842     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( 
       
  6843         EMultimodePhoneEnumerateAPNEntries );
       
  6844     
       
  6845     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  6846         {
       
  6847         // The request is already in processing because of previous request.
       
  6848         // Complete request with status value informing the client about 
       
  6849         // the situation.
       
  6850         ReqCompleted( aTsyReqHandle, KErrServerBusy );
       
  6851         }
       
  6852     else
       
  6853         {
       
  6854         iRetAPNEntries = aIndex;
       
  6855 
       
  6856         // allow for EMultimodePhoneEnumerateAPNEntries immediate completion
       
  6857 #ifdef REQHANDLE_TIMER
       
  6858         SetTypeOfResponse( EMultimodePhoneEnumerateAPNEntries, 
       
  6859             aTsyReqHandle );
       
  6860 #else
       
  6861         // Never comes here. See SetTypeOfResponse.
       
  6862         iTsyReqHandleStore->SetTsyReqHandle( 
       
  6863             EMultimodePhoneEnumerateAPNEntries, aTsyReqHandle );
       
  6864 #endif // REQHANDLE_TIMER
       
  6865 
       
  6866         //Send request to the Domestic OS layer.
       
  6867         TInt ret = MessageManager()->HandleRequestL( 
       
  6868             EMobilePhoneEnumerateAPNEntries );
       
  6869         
       
  6870         // DOS layer returned with error without completing request
       
  6871         if ( KErrNone != ret )
       
  6872             {
       
  6873             //reset req handle
       
  6874             iTsyReqHandleStore->ResetTsyReqHandle( 
       
  6875                 EMultimodePhoneEnumerateAPNEntries );
       
  6876             ReqCompleted( aTsyReqHandle, ret );
       
  6877             }
       
  6878         }
       
  6879         
       
  6880     return KErrNone;
       
  6881     }
       
  6882 
       
  6883 // ---------------------------------------------------------------------------
       
  6884 // CMmPhoneTsy::EnumerateAPNEntriesCancel
       
  6885 // Cancels an outstanding EnumerateAPNEntries request.
       
  6886 // (other items were commented in a header).
       
  6887 // ---------------------------------------------------------------------------
       
  6888 //
       
  6889 TInt CMmPhoneTsy::EnumerateAPNEntriesCancel()
       
  6890     {
       
  6891 TFLOGSTRING("CMmPhoneTsy::EnumerateAPNEntriesCancel");
       
  6892     iRetAPNEntries = NULL;
       
  6893     
       
  6894     //reset the req handle
       
  6895     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  6896         EMultimodePhoneEnumerateAPNEntries );
       
  6897 
       
  6898     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  6899     	{
       
  6900     	//complete with cancel
       
  6901     	ReqCompleted( reqHandle, KErrCancel );
       
  6902     	}
       
  6903     
       
  6904     return KErrNone;
       
  6905     }
       
  6906     
       
  6907 // ---------------------------------------------------------------------------
       
  6908 // CMmPhoneTsy::CompleteEnumerateAPNEntries
       
  6909 // Completes an outstanding asynchronous EnumerateAPNEntries request
       
  6910 // (other items were commented in a header).
       
  6911 // ---------------------------------------------------------------------------
       
  6912 //
       
  6913 void CMmPhoneTsy::CompleteEnumerateAPNEntries( 
       
  6914     CMmDataPackage* aDataPackage, 
       
  6915     TInt aErrorCode )
       
  6916     {
       
  6917 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteEnumerateAPNEntries Error: %d", aErrorCode);
       
  6918 
       
  6919     //reset req handle. Returns the deleted req handle
       
  6920     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  6921         EMultimodePhoneEnumerateAPNEntries );
       
  6922 
       
  6923     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  6924         {
       
  6925         if ( KErrNone == aErrorCode )
       
  6926             {
       
  6927             TUint32* apnEntries( NULL );
       
  6928             aDataPackage->UnPackData( &apnEntries );
       
  6929             *iRetAPNEntries = *apnEntries;
       
  6930             
       
  6931             //Complete request to success
       
  6932             ReqCompleted( reqHandle, KErrNone );
       
  6933             }
       
  6934         else
       
  6935             {
       
  6936             // Complete with error
       
  6937             ReqCompleted( reqHandle, aErrorCode );
       
  6938             }
       
  6939         }
       
  6940     }
       
  6941 
       
  6942 // ---------------------------------------------------------------------------
       
  6943 // CMmPhoneTsy::GetAPNnameL
       
  6944 // Get the name of APN in access point control list according to index
       
  6945 // (other items were commented in a header).
       
  6946 // ---------------------------------------------------------------------------
       
  6947 //
       
  6948 TInt CMmPhoneTsy::GetAPNnameL( 
       
  6949     const TTsyReqHandle aTsyReqHandle, 
       
  6950     TUint32* aIndex, 
       
  6951     TDes8* aAPN )
       
  6952     {
       
  6953 TFLOGSTRING("TSY: CMmPhoneTsy::GetAPNnameL");    
       
  6954 
       
  6955     TInt ret = KErrServerBusy;
       
  6956     
       
  6957     // Check if request handle already exists
       
  6958     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( 
       
  6959         EMultimodePhoneGetAPNname );
       
  6960     
       
  6961     if ( EMultimodePhoneReqHandleUnknown == reqHandle )
       
  6962         {
       
  6963         if ( sizeof( RMobilePhone::TAPNEntryV3 ) > aAPN->MaxLength() )
       
  6964             {
       
  6965             ret = KErrArgument;
       
  6966             }
       
  6967         else
       
  6968             {
       
  6969             iRetAPNname = aAPN;
       
  6970         
       
  6971          // allow for EMobilePhoneGetAPNname immediate completion
       
  6972 #ifdef REQHANDLE_TIMER
       
  6973             SetTypeOfResponse( EMultimodePhoneGetAPNname, aTsyReqHandle );
       
  6974 #else
       
  6975             // Never comes here. See SetTypeOfResponse.
       
  6976             iTsyReqHandleStore->SetTsyReqHandle( 
       
  6977                 EMultimodePhoneGetAPNname, aTsyReqHandle );
       
  6978 #endif // REQHANDLE_TIMER
       
  6979         
       
  6980             CMmDataPackage dataPackage;
       
  6981     	    dataPackage.PackData( aIndex );
       
  6982     	
       
  6983             // Send request to the Domestic OS layer.
       
  6984             ret = MessageManager()->HandleRequestL( 
       
  6985                 EMobilePhoneGetAPNname, &dataPackage );
       
  6986             
       
  6987             // In error case reset ReqHandle
       
  6988             if ( KErrNone != ret )
       
  6989                 {
       
  6990                 //Reset req handle
       
  6991                 iTsyReqHandleStore->ResetTsyReqHandle( 
       
  6992                     EMultimodePhoneGetAPNname );
       
  6993                 }
       
  6994             }
       
  6995         }
       
  6996     return ret;
       
  6997     }
       
  6998 
       
  6999 // ---------------------------------------------------------------------------
       
  7000 // CMmPhoneTsy::GetAPNnameCancel
       
  7001 // Cancels an outstanding GetAPNname request.
       
  7002 // (other items were commented in a header).
       
  7003 // ---------------------------------------------------------------------------
       
  7004 //
       
  7005 TInt CMmPhoneTsy::GetAPNnameCancel()
       
  7006     {
       
  7007 TFLOGSTRING("CMmPhoneTsy::GetAPNnameCancel");
       
  7008     iRetAPNname = NULL;
       
  7009     
       
  7010     //reset the req handle
       
  7011     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7012         EMultimodePhoneGetAPNname );
       
  7013 
       
  7014     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7015     	{
       
  7016     	//complete with cancel
       
  7017     	ReqCompleted( reqHandle, KErrCancel );
       
  7018     	}
       
  7019     
       
  7020     return KErrNone;
       
  7021     }
       
  7022 
       
  7023 // ---------------------------------------------------------------------------
       
  7024 // CMmPhoneTsy::CompleteGetAPNname
       
  7025 // Completes an outstanding asynchronous GetAPNname request
       
  7026 // (other items were commented in a header).
       
  7027 // ---------------------------------------------------------------------------
       
  7028 //
       
  7029 void CMmPhoneTsy::CompleteGetAPNname( 
       
  7030     CMmDataPackage* aDataPackage, 
       
  7031     TInt aErrorCode )
       
  7032     {
       
  7033 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetAPNname Error: %d", aErrorCode);
       
  7034     
       
  7035     //reset req handle. Returns the deleted req handle
       
  7036     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7037         EMultimodePhoneGetAPNname );
       
  7038 
       
  7039     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7040         {
       
  7041         if ( KErrNone == aErrorCode )
       
  7042             {
       
  7043 
       
  7044             // APN Entry
       
  7045             RMobilePhone::TAPNEntryV3* apnEntryName;
       
  7046             // Unpack data
       
  7047             aDataPackage->UnPackData( &apnEntryName );
       
  7048             
       
  7049             RMobilePhone::TAPNEntryV3Pckg* apnEntryPckg = REINTERPRET_CAST( 
       
  7050                 RMobilePhone::TAPNEntryV3Pckg*, iRetAPNname );
       
  7051             RMobilePhone::TAPNEntryV3& apnEntry = ( *apnEntryPckg )();
       
  7052             
       
  7053             apnEntry.iApn.Copy( apnEntryName->iApn );
       
  7054  
       
  7055             //Complete request to success
       
  7056             ReqCompleted( reqHandle, KErrNone );
       
  7057             }
       
  7058         else
       
  7059             {
       
  7060             // Complete with error
       
  7061             ReqCompleted( reqHandle, aErrorCode );
       
  7062             }
       
  7063         }
       
  7064     }
       
  7065     
       
  7066 // ---------------------------------------------------------------------------
       
  7067 // CMmPhoneTsy::SetAlsState
       
  7068 // Sets ALS support state
       
  7069 // (other items were commented in a header).
       
  7070 // ---------------------------------------------------------------------------
       
  7071 //
       
  7072 void CMmPhoneTsy::SetAlsState( 
       
  7073 	TBool aState )
       
  7074 	{
       
  7075 TFLOGSTRING2("TSY: CMmPhoneTsy::SetAlsState Error: %d", aState);
       
  7076 	
       
  7077 	// Check where set was called
       
  7078 	if( iCspFileAlsSet )
       
  7079 	    {
       
  7080 	    // Set Csp file's ALS state
       
  7081 		iCspFileALS = aState;
       
  7082 	    }
       
  7083 	else
       
  7084 	    {
       
  7085 	    // Set ALS state
       
  7086 	    iAlsPpSupport = aState;
       
  7087 	    }
       
  7088 	
       
  7089 	// Check if ALS is supported
       
  7090 	if( iCspFileALS || iAlsPpSupport )
       
  7091 	    {
       
  7092 		//Set ALS status to ETrue in Central Repository
       
  7093 	    iCentRep->Set( KCtsyMEAlsSupported, ETrue );
       
  7094 	    }
       
  7095 	else
       
  7096 	    {
       
  7097 	    //Set ALS status to EFalse Central Repository
       
  7098 	    iCentRep->Set( KCtsyMEAlsSupported, EFalse );
       
  7099 	    }
       
  7100 	
       
  7101 	}
       
  7102 
       
  7103 // ---------------------------------------------------------------------------
       
  7104 // CMmPhoneTsy::MapMEALSLine
       
  7105 // Maps ALS information
       
  7106 // (other items were commented in a header).
       
  7107 // ---------------------------------------------------------------------------
       
  7108 //
       
  7109 RMobilePhone::TMobilePhoneALSLine CMmPhoneTsy::MapMEALSLine( 
       
  7110 	TInt aAlsLineInfo )
       
  7111 	{
       
  7112 TFLOGSTRING("TSY: CMmPhoneTsy::MapMEALSLine");
       
  7113 
       
  7114 	RMobilePhone::TMobilePhoneALSLine lineInfo;
       
  7115 	
       
  7116 	switch ( aAlsLineInfo )
       
  7117 		{
       
  7118 		case 0://TInt from CentRep
       
  7119 			lineInfo = RMobilePhone::EAlternateLinePrimary;
       
  7120 TFLOGSTRING("TSY: CMmPhoneTsy::MapMEALSInfo Line line = EAlternateLinePrimary");
       
  7121 			break;
       
  7122 		case 1://TInt from CentRep
       
  7123 			lineInfo = RMobilePhone::EAlternateLineAuxiliary;
       
  7124 TFLOGSTRING("TSY: CMmPhoneTsy::MapMEALSLine line = EAlternateLineAuxiliary");
       
  7125 			break;
       
  7126 		case 2://TInt from CentRep
       
  7127 			lineInfo = RMobilePhone::EAlternateLineUnknown;
       
  7128 TFLOGSTRING("TSY: CMmPhoneTsy::MapMEALSLine line = EAlternateLineUnknown");
       
  7129 			break;
       
  7130 		case 3://TInt from CentRep
       
  7131 			lineInfo = RMobilePhone::EAlternateLineNotAvailable;
       
  7132 TFLOGSTRING("TSY: CMmPhoneTsy::MapMEALSLine line = EAlternateLineNotAvailable");
       
  7133 			break;
       
  7134 		default:
       
  7135 			lineInfo = RMobilePhone::EAlternateLineUnknown;
       
  7136 TFLOGSTRING("TSY: CMmPhoneTsy::MapMEALSLine line = EAlternateLineUnknown");
       
  7137 			break;
       
  7138 		}
       
  7139 		
       
  7140 	return lineInfo;
       
  7141 	}
       
  7142 	
       
  7143 // ---------------------------------------------------------------------------
       
  7144 // CMmPhoneTsy::ResetMEAlsInfo
       
  7145 // Resets ALS information in CentRep.
       
  7146 // (other items were commented in a header).
       
  7147 // ---------------------------------------------------------------------------
       
  7148 //
       
  7149 void CMmPhoneTsy::ResetMEAlsInfo()
       
  7150 	{
       
  7151 	
       
  7152 TFLOGSTRING("TSY: CMmPhoneTsy::ResetMEAlsInfo");
       
  7153 	
       
  7154 	iCentRep->Reset();
       
  7155 	
       
  7156 	if( iSimCacheQueue && ( KCacheALSline & iSimCacheQueue ) )
       
  7157 	    { 
       
  7158 TFLOGSTRING("TSY: CMmPhoneTsy::ResetMEAlsInfo -> CompleteCacheSimL");
       
  7159         // function can leave, so there for it must be trapped, the error 
       
  7160         // value is ingnored, because the functionality doesn't depend on it
       
  7161 	    TRAP_IGNORE( CompleteCacheSimL( KCacheALSline, EFalse ) );	
       
  7162 	    }
       
  7163 	
       
  7164 	}
       
  7165 
       
  7166 // ---------------------------------------------------------------------------
       
  7167 // CMmPhoneTsy::GetCfisCenRep
       
  7168 // Returns pointer to CFIS central repository 
       
  7169 // (other items were commented in a header).
       
  7170 // ---------------------------------------------------------------------------
       
  7171 //
       
  7172 CRepository* CMmPhoneTsy::GetCfisCenRep()
       
  7173 	{
       
  7174 TFLOGSTRING("TSY: CMmPhoneTsy::GetCfisCenRep");
       
  7175 
       
  7176 	if( iCFISCentRep )
       
  7177 		{
       
  7178 		return iCFISCentRep;
       
  7179 		}
       
  7180 	else 
       
  7181 		return NULL;
       
  7182 	}
       
  7183 
       
  7184 // ---------------------------------------------------------------------------
       
  7185 // CMmPhoneTsy::GetMwisCenRep
       
  7186 // Returns pointer to MWIS central repository
       
  7187 // (other items were commented in a header).
       
  7188 // ---------------------------------------------------------------------------
       
  7189 //
       
  7190 CRepository* CMmPhoneTsy::GetMwisCenRep()
       
  7191 	{
       
  7192 TFLOGSTRING("TSY: CMmPhoneTsy::GetMwisCenRep");
       
  7193 
       
  7194 	if( iMWISCentRep )
       
  7195 		{
       
  7196 		return iMWISCentRep;
       
  7197 		}
       
  7198 	else 
       
  7199 		return NULL;
       
  7200 	}
       
  7201 
       
  7202 // ---------------------------------------------------------------------------
       
  7203 // CMmPhoneTsy::GetMwisCenRep
       
  7204 // Returns pointer to MWIS central repository
       
  7205 // (other items were commented in a header).
       
  7206 // ---------------------------------------------------------------------------
       
  7207 //
       
  7208 CRepository* CMmPhoneTsy::GetCfisPRCenRep()
       
  7209 	{
       
  7210 TFLOGSTRING("TSY: CMmPhoneTsy::GetCfisPRCenRep");
       
  7211 
       
  7212 	if( iCFISPrivateCentRep )
       
  7213 		{
       
  7214 		return iCFISPrivateCentRep;
       
  7215 		}
       
  7216 	else 
       
  7217 		return NULL;
       
  7218 	}
       
  7219 			
       
  7220 // ---------------------------------------------------------------------------
       
  7221 // CMmPhoneTsy::GetSubscriberIdForTSYL
       
  7222 // Get IMSI for TSY internal use.
       
  7223 // (other items were commented in a header).
       
  7224 // ---------------------------------------------------------------------------
       
  7225 //
       
  7226 void CMmPhoneTsy::GetSubscriberIdForTSYL()
       
  7227     {
       
  7228 TFLOGSTRING("TSY: CMmPhoneTsy::GetSubscriberIdForTSYL");
       
  7229     
       
  7230     // Check if some client has already requested this
       
  7231     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( 
       
  7232         EMultimodePhoneGetSubscriberId );
       
  7233     
       
  7234     if ( EMultimodePhoneReqHandleUnknown == reqHandle 
       
  7235         && !iTSYSubscriberIdReq )
       
  7236         {
       
  7237         iTSYSubscriberIdReq = ETrue;
       
  7238         iMessageManager->HandleRequestL( EMobilePhoneGetSubscriberId );
       
  7239         }
       
  7240     else
       
  7241         {
       
  7242 TFLOGSTRING("TSY: CMmPhoneTsy::GetSubscriberIdForTSYL - Already requested");
       
  7243         }
       
  7244     }
       
  7245 	
       
  7246 // ---------------------------------------------------------------------------
       
  7247 // CMmPhoneTsy::AppendAPNNameL
       
  7248 // Append an entry to the access point name (APN) control list
       
  7249 // (other items were commented in a header).
       
  7250 // ---------------------------------------------------------------------------
       
  7251 //
       
  7252 TInt CMmPhoneTsy::AppendAPNNameL( 
       
  7253     RMobilePhone::TAPNEntryV3* aAPNEntry )
       
  7254     {
       
  7255 TFLOGSTRING("TSY: CMmPhoneTsy::AppendAPNNameL");
       
  7256 
       
  7257     TInt ret ( KErrServerBusy );
       
  7258 
       
  7259     //check if handle is not in use already
       
  7260     TTsyReqHandle phoneAppendAPNNameHandle =
       
  7261                 iTsyReqHandleStore->GetTsyReqHandle( 
       
  7262                 EMultimodePhoneAppendAPNName );       
       
  7263 
       
  7264     if ( EMultimodePhoneReqHandleUnknown == phoneAppendAPNNameHandle )
       
  7265         {
       
  7266         RMobilePhone::TAPNEntryV3* apnEntry = aAPNEntry;
       
  7267         CMmDataPackage dataPackage;
       
  7268         dataPackage.PackData( apnEntry );
       
  7269         ret = MessageManager()->HandleRequestL( 
       
  7270                                 EMobilePhoneAppendAPNName, &dataPackage );
       
  7271         if ( KErrNone == ret )
       
  7272             {
       
  7273             // Save the req handle type
       
  7274             iReqHandleType = EMultimodePhoneAppendAPNName;
       
  7275             }
       
  7276         }
       
  7277     return ret;
       
  7278     }
       
  7279 
       
  7280 // ---------------------------------------------------------------------------
       
  7281 // CMmPhoneTsy::AppendAPNNameCancel
       
  7282 // Cancel AppendAPNNameL
       
  7283 // (other items were commented in a header).
       
  7284 // ---------------------------------------------------------------------------
       
  7285 //
       
  7286 TInt CMmPhoneTsy::AppendAPNNameCancel()
       
  7287     {
       
  7288 TFLOGSTRING("TSY: CMmPhoneTsy::AppendAPNNameCancel");
       
  7289     // reset the reqhandle
       
  7290     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7291         EMultimodePhoneAppendAPNName );
       
  7292     
       
  7293     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7294         {
       
  7295         // complete
       
  7296         ReqCompleted( reqHandle, KErrCancel );
       
  7297         }
       
  7298 
       
  7299     return KErrNone;
       
  7300     }
       
  7301 
       
  7302 // ---------------------------------------------------------------------------
       
  7303 // CMmPhoneTsy::CompleteAppendAPNName
       
  7304 // Complete Append APN name request
       
  7305 // (other items were commented in a header).
       
  7306 // ---------------------------------------------------------------------------
       
  7307 //
       
  7308 void CMmPhoneTsy::CompleteAppendAPNName( 
       
  7309     TInt aErrorCode )
       
  7310     {
       
  7311 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteAppendAPNName. Error: %d", aErrorCode);
       
  7312     
       
  7313     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7314         EMultimodePhoneAppendAPNName );
       
  7315     
       
  7316     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7317         {
       
  7318         ReqCompleted( reqHandle, aErrorCode );
       
  7319         }
       
  7320     }
       
  7321 
       
  7322 // ---------------------------------------------------------------------------
       
  7323 // CMmPhoneTsy::DeleteAPNNameL
       
  7324 // Delete an entry from the access point name (APN) control list
       
  7325 // (other items were commented in a header).
       
  7326 // ---------------------------------------------------------------------------
       
  7327 //
       
  7328 TInt CMmPhoneTsy::DeleteAPNNameL( 
       
  7329     const TTsyReqHandle aTsyReqHandle, 
       
  7330     TUint32* aIndex )
       
  7331     {
       
  7332 TFLOGSTRING2("TSY: CMmPhoneTsy::DeleteAPNNameL, index = %d", aIndex);
       
  7333 
       
  7334     // get the handle
       
  7335     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( 
       
  7336         EMultimodePhoneDeleteAPNName );
       
  7337 
       
  7338     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7339         {
       
  7340         ReqCompleted( aTsyReqHandle, KErrServerBusy );
       
  7341         }
       
  7342     else
       
  7343         {
       
  7344         CMmDataPackage dataPackage;
       
  7345         dataPackage.PackData( aIndex );
       
  7346 
       
  7347         TInt ret = MessageManager()->HandleRequestL( 
       
  7348             EMobilePhoneDeleteAPNName, &dataPackage );
       
  7349 
       
  7350         if ( KErrNone != ret )
       
  7351             {
       
  7352             ReqCompleted( aTsyReqHandle, ret );
       
  7353             }
       
  7354         else
       
  7355             {
       
  7356             // Save the req handle type
       
  7357             iReqHandleType = EMultimodePhoneDeleteAPNName;
       
  7358             }
       
  7359         }
       
  7360 
       
  7361     return KErrNone;
       
  7362     }
       
  7363 
       
  7364 // ---------------------------------------------------------------------------
       
  7365 // CMmPhoneTsy::DeleteAPNNameCancel
       
  7366 // Cancel DeleteAPNEntry
       
  7367 // (other items were commented in a header).
       
  7368 // ---------------------------------------------------------------------------
       
  7369 //
       
  7370 TInt CMmPhoneTsy::DeleteAPNNameCancel()
       
  7371     {
       
  7372 TFLOGSTRING("TSY: CMmPhoneTsy::DeleteAPNNameCancel");
       
  7373     // reset the reqhandle
       
  7374     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7375         EMultimodePhoneDeleteAPNName );
       
  7376 
       
  7377     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7378         {
       
  7379         ReqCompleted( reqHandle, KErrCancel );
       
  7380         }
       
  7381 
       
  7382     return KErrNone;
       
  7383     }
       
  7384 
       
  7385 // ---------------------------------------------------------------------------
       
  7386 // CMmPhoneTsy::CompleteDeleteAPNName
       
  7387 // Complete delete APN entry
       
  7388 // (other items were commented in a header).
       
  7389 // ---------------------------------------------------------------------------
       
  7390 //
       
  7391 void CMmPhoneTsy::CompleteDeleteAPNName( 
       
  7392     TInt aErrorCode )
       
  7393     {
       
  7394 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteDeleteAPNName. Error: %d", aErrorCode);
       
  7395 
       
  7396     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7397         EMultimodePhoneDeleteAPNName );
       
  7398     
       
  7399     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7400         {
       
  7401         ReqCompleted( reqHandle, aErrorCode );
       
  7402         }
       
  7403     }
       
  7404 
       
  7405 // ---------------------------------------------------------------------------
       
  7406 // CMmPhoneTsy::NotifyAPNListChanged
       
  7407 // This function is used to request to receive notification of when the APN 
       
  7408 // control list changes.
       
  7409 // (other items were commented in a header).
       
  7410 // ---------------------------------------------------------------------------
       
  7411 //
       
  7412 TInt CMmPhoneTsy::NotifyAPNListChanged()
       
  7413     {
       
  7414 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyAPNListChanged");
       
  7415 
       
  7416     iReqHandleType = EMultimodePhoneNotifyAPNListChange;
       
  7417     
       
  7418     return KErrNone;
       
  7419     }
       
  7420 
       
  7421 // ---------------------------------------------------------------------------
       
  7422 // CMmPhoneTsy::NotifyAPNListChangedCancel
       
  7423 // This function cancels an outstanding access point name (APN) control list 
       
  7424 // change notification request.
       
  7425 // (other items were commented in a header).
       
  7426 // ---------------------------------------------------------------------------
       
  7427 //
       
  7428 TInt CMmPhoneTsy::NotifyAPNListChangedCancel()
       
  7429     {
       
  7430 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyAPNListChangedCancel");
       
  7431     
       
  7432     TTsyReqHandle reqHandle = iTsyReqHandleStore->
       
  7433         ResetTsyReqHandle( EMultimodePhoneNotifyAPNListChange );
       
  7434 
       
  7435      if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7436         {
       
  7437         ReqCompleted( reqHandle, KErrCancel );
       
  7438         }
       
  7439 
       
  7440     return KErrNone;
       
  7441     }
       
  7442 
       
  7443 // ---------------------------------------------------------------------------
       
  7444 // CMmPhoneTsy::CompleteNotifyAPNListChanged
       
  7445 // Complete notification request
       
  7446 // (other items were commented in a header).
       
  7447 // ---------------------------------------------------------------------------
       
  7448 //
       
  7449 void CMmPhoneTsy::CompleteNotifyAPNListChanged( 
       
  7450     TInt aErrorCode )
       
  7451     {
       
  7452 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyAPNListChanged");
       
  7453 
       
  7454     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7455         EMultimodePhoneNotifyAPNListChange );
       
  7456 
       
  7457     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7458         {
       
  7459         // complete the client request
       
  7460         ReqCompleted( reqHandle, aErrorCode );
       
  7461         }
       
  7462     }
       
  7463 
       
  7464 // ---------------------------------------------------------------------------
       
  7465 // CMmPhoneTsy::SetAPNControlListServiceStatusL
       
  7466 // Enabling and disabling the access point name (APN) control list service
       
  7467 // (other items were commented in a header).
       
  7468 // ---------------------------------------------------------------------------
       
  7469 //
       
  7470 TInt CMmPhoneTsy::SetAPNControlListServiceStatusL( 
       
  7471     const TTsyReqHandle aTsyReqHandle, 
       
  7472     RMobilePhone::TAPNControlListServiceStatus* aAPNControlListServiceStatus )
       
  7473     {
       
  7474 TFLOGSTRING("TSY: CMmPhoneTsy::SetAPNControlListServiceStatusL.");
       
  7475 
       
  7476     iSetAclStatus = aAPNControlListServiceStatus;
       
  7477     
       
  7478     // get the handle
       
  7479     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( 
       
  7480         EMultimodePhoneSetAPNControlListServiceStatus );
       
  7481 
       
  7482     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7483         {
       
  7484         ReqCompleted( aTsyReqHandle, KErrServerBusy );
       
  7485         }
       
  7486     else
       
  7487         {
       
  7488         CMmDataPackage dataPackage;
       
  7489         dataPackage.PackData( iSetAclStatus );
       
  7490 
       
  7491         TInt ret = MessageManager()->HandleRequestL( 
       
  7492             EMobilePhoneSetAPNControlListServiceStatus, &dataPackage );
       
  7493 
       
  7494         if ( KErrNone != ret )
       
  7495             {
       
  7496             ReqCompleted( aTsyReqHandle, ret );
       
  7497             }
       
  7498         else
       
  7499             {
       
  7500             // Save the req handle type
       
  7501             iReqHandleType = EMultimodePhoneSetAPNControlListServiceStatus;
       
  7502             }
       
  7503         }
       
  7504     
       
  7505     return KErrNone;
       
  7506     }
       
  7507 
       
  7508 // ---------------------------------------------------------------------------
       
  7509 // CMmPhoneTsy::SetAPNControlListServiceStatusCancel
       
  7510 // Set ACL Status
       
  7511 // (other items were commented in a header).
       
  7512 // ---------------------------------------------------------------------------
       
  7513 //
       
  7514 TInt CMmPhoneTsy::SetAPNControlListServiceStatusCancel()
       
  7515     {
       
  7516 TFLOGSTRING("TSY: CMmPhoneTsy::SetAPNControlListServiceStatusCancel");
       
  7517     
       
  7518     // erase pointer to client data
       
  7519     iSetAclStatus = NULL;
       
  7520 
       
  7521     // reset the reqhandle
       
  7522     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7523         EMultimodePhoneSetAPNControlListServiceStatus );
       
  7524 
       
  7525     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7526         {
       
  7527         ReqCompleted( reqHandle, KErrCancel );
       
  7528         }
       
  7529 
       
  7530     return KErrNone;
       
  7531     }
       
  7532 
       
  7533 // ---------------------------------------------------------------------------
       
  7534 // CMmPhoneTsy::CompleteSetAPNControlListServiceStatus
       
  7535 // Complete Set APN service status
       
  7536 // (other items were commented in a header).
       
  7537 // ---------------------------------------------------------------------------
       
  7538 //
       
  7539 void CMmPhoneTsy::CompleteSetAPNControlListServiceStatus( 
       
  7540     TInt aErrorCode )
       
  7541     {
       
  7542 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteSetAPNControlListServiceStatus. Error: %d", aErrorCode);
       
  7543 
       
  7544     //reset req handle. Returns the deleted req handle
       
  7545     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7546         EMultimodePhoneSetAPNControlListServiceStatus );
       
  7547 
       
  7548     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7549         {
       
  7550         ReqCompleted( reqHandle, aErrorCode );
       
  7551         }
       
  7552     iSetAclStatus = NULL;
       
  7553     }
       
  7554 
       
  7555 // ---------------------------------------------------------------------------
       
  7556 // CMmPhoneTsy::GetAPNControlListServiceStatusL
       
  7557 // Get the status of the access point name (APN) control list service
       
  7558 // (other items were commented in a header).
       
  7559 // ---------------------------------------------------------------------------
       
  7560 //
       
  7561 TInt CMmPhoneTsy::GetAPNControlListServiceStatusL( 
       
  7562     const TTsyReqHandle aTsyReqHandle, 
       
  7563     RMobilePhone::TAPNControlListServiceStatus* aAPNControlListServiceStatus )
       
  7564     {
       
  7565 TFLOGSTRING("TSY: CMmPhoneTsy::GetAPNControlListServiceStatusL");
       
  7566 
       
  7567     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( 
       
  7568         EMultimodePhoneGetAPNControlListServiceStatus );
       
  7569 
       
  7570     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7571         {
       
  7572         ReqCompleted( aTsyReqHandle, KErrServerBusy );
       
  7573         }
       
  7574     else
       
  7575         {
       
  7576         // save pointer to client data
       
  7577         iRetAclStatus = aAPNControlListServiceStatus;
       
  7578 
       
  7579         // call DOS (no packed parameters)
       
  7580         TInt ret = MessageManager()->HandleRequestL( 
       
  7581             EMobilePhoneGetAPNControlListServiceStatus );
       
  7582 
       
  7583         // check the result of the call
       
  7584         if ( KErrNone != ret )
       
  7585             {
       
  7586             ReqCompleted ( aTsyReqHandle, ret );
       
  7587             }
       
  7588         else
       
  7589             {
       
  7590             // Store the request handle
       
  7591             iReqHandleType = EMultimodePhoneGetAPNControlListServiceStatus;
       
  7592             }
       
  7593         }
       
  7594 
       
  7595     return KErrNone;
       
  7596     }
       
  7597 
       
  7598 // ---------------------------------------------------------------------------
       
  7599 // CMmPhoneTsy::GetAPNControlListServiceStatusCancel
       
  7600 // Cancel the request to get ACL status
       
  7601 // (other items were commented in a header).
       
  7602 // ---------------------------------------------------------------------------
       
  7603 //
       
  7604 TInt CMmPhoneTsy::GetAPNControlListServiceStatusCancel()
       
  7605     {
       
  7606 TFLOGSTRING("TSY: CMmPhoneTsy::GetAPNControlListServiceStatusCancel");
       
  7607     // reset the reqhandle
       
  7608     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7609         EMultimodePhoneGetAPNControlListServiceStatus );
       
  7610 
       
  7611     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7612         {
       
  7613         ReqCompleted( reqHandle, KErrCancel );
       
  7614         }
       
  7615 
       
  7616     return KErrNone;
       
  7617     }
       
  7618 
       
  7619 // ---------------------------------------------------------------------------
       
  7620 // CMmPhoneTsy::CompleteGetAPNControlListServiceStatus
       
  7621 // Complete Get APN service status
       
  7622 // (other items were commented in a header).
       
  7623 // ---------------------------------------------------------------------------
       
  7624 //
       
  7625 void CMmPhoneTsy::CompleteGetAPNControlListServiceStatus( 
       
  7626     CMmDataPackage* aDataPackage, 
       
  7627     TInt aErrorCode )
       
  7628     {
       
  7629 TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteGetAPNControlListServiceStatus. Error %d", aErrorCode);
       
  7630     
       
  7631     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7632         EMultimodePhoneGetAPNControlListServiceStatus );
       
  7633     
       
  7634     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7635         {
       
  7636         if ( KErrNone == aErrorCode )
       
  7637             {
       
  7638             RMobilePhone::TAPNControlListServiceStatus aclStatus;
       
  7639             aDataPackage->UnPackData( aclStatus );
       
  7640             
       
  7641             // set the information for the client
       
  7642             *iRetAclStatus = aclStatus;
       
  7643             
       
  7644             //Complete request to success
       
  7645             ReqCompleted( reqHandle, KErrNone );
       
  7646             }
       
  7647         else
       
  7648             {
       
  7649             // Complete with error
       
  7650             ReqCompleted( reqHandle, aErrorCode );
       
  7651             }
       
  7652 
       
  7653         // reset the internal variable
       
  7654         iRetAclStatus = NULL;
       
  7655         }
       
  7656     }
       
  7657 
       
  7658 // ---------------------------------------------------------------------------
       
  7659 // CMmPhoneTsy::NotifyAPNControlListServiceStatusChange
       
  7660 // This function is used to request to receive notification of when the 
       
  7661 // status of the APN control list service changes.
       
  7662 // (other items were commented in a header).
       
  7663 // ---------------------------------------------------------------------------
       
  7664 //
       
  7665 TInt CMmPhoneTsy::NotifyAPNControlListServiceStatusChange( 
       
  7666     RMobilePhone::TAPNControlListServiceStatus* aAPNControlListServiceStatus )
       
  7667     {
       
  7668 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyAPNControlListServiceStatusChange");
       
  7669     
       
  7670     iRetNotifyAclStatus = aAPNControlListServiceStatus;
       
  7671     iReqHandleType = EMultimodePhoneNotifyAPNControlListServiceStatusChange;
       
  7672     
       
  7673     return KErrNone;
       
  7674     }
       
  7675 
       
  7676 // ---------------------------------------------------------------------------
       
  7677 // CMmPhoneTsy::NotifyAPNControlListServiceStatusChangeCancel
       
  7678 // This function cancels an outstanding access point name (APN) control list 
       
  7679 // service status change notification request.
       
  7680 // (other items were commented in a header).
       
  7681 // ---------------------------------------------------------------------------
       
  7682 //
       
  7683 TInt CMmPhoneTsy::NotifyAPNControlListServiceStatusChangeCancel()
       
  7684     {
       
  7685 TFLOGSTRING("TSY: CMmPhoneTsy::NotifyAPNControlListServiceStatusChangeCancel");
       
  7686 
       
  7687     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7688         EMultimodePhoneNotifyAPNControlListServiceStatusChange );
       
  7689     
       
  7690     
       
  7691     if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7692         {
       
  7693         ReqCompleted( reqHandle, KErrCancel );
       
  7694         iRetNotifyAclStatus = NULL;
       
  7695         }
       
  7696 
       
  7697     return KErrNone;
       
  7698     }
       
  7699 
       
  7700 // ---------------------------------------------------------------------------
       
  7701 // CMmPhoneTsy::CompleteNotifyAPNControlListServiceStatusChange
       
  7702 // Complete service status notification
       
  7703 // (other items were commented in a header).
       
  7704 // ---------------------------------------------------------------------------
       
  7705 //
       
  7706 void CMmPhoneTsy::CompleteNotifyAPNControlListServiceStatusChange( 
       
  7707     CMmDataPackage* aDataPackage, 
       
  7708     TInt aErrorCode )
       
  7709     {
       
  7710 TFLOGSTRING("TSY: CMmPhoneTsy::CompleteNotifyAPNControlListServiceStatusChange");
       
  7711 
       
  7712     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  7713         EMultimodePhoneNotifyAPNControlListServiceStatusChange );
       
  7714 
       
  7715     if( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  7716         {
       
  7717         if ( KErrNone == aErrorCode )
       
  7718             {
       
  7719             RMobilePhone::TAPNControlListServiceStatus aclStatus;
       
  7720             aDataPackage->UnPackData( aclStatus );
       
  7721             
       
  7722             // set the information for the client
       
  7723             *iRetNotifyAclStatus = aclStatus;
       
  7724             
       
  7725             //Complete request to success
       
  7726             ReqCompleted( reqHandle, KErrNone );
       
  7727             }
       
  7728         else
       
  7729             {
       
  7730             // Complete with error
       
  7731             ReqCompleted( reqHandle, aErrorCode );
       
  7732             }
       
  7733 
       
  7734         // reset the internal variable
       
  7735         iRetNotifyAclStatus = NULL;
       
  7736         }
       
  7737     }
       
  7738 
       
  7739 // ---------------------------------------------------------------------------
       
  7740 // CMmPhoneTsy::SetAlsQueryInBoot
       
  7741 // Sets internal boolean, which indicates is als query done during boot.
       
  7742 // (other items were commented in a header).
       
  7743 // ---------------------------------------------------------------------------
       
  7744 //
       
  7745 void CMmPhoneTsy::SetAlsQueryInBoot( TBool aInBoot )
       
  7746     {
       
  7747 	iAlsQueryInBoot = aInBoot;
       
  7748     }
       
  7749     
       
  7750 // ---------------------------------------------------------------------------
       
  7751 // CMmPhoneTsy::GetAlsQueryInBoot
       
  7752 // Sets internal boolean, which indicates is als query done during boot.
       
  7753 // (other items were commented in a header).
       
  7754 // ---------------------------------------------------------------------------
       
  7755 //
       
  7756 TBool CMmPhoneTsy::GetAlsQueryInBoot()
       
  7757     {
       
  7758 	return iAlsQueryInBoot;
       
  7759     }
       
  7760 
       
  7761 // ---------------------------------------------------------------------------
       
  7762 // CMmPhoneTsy::GetHomeZoneParamsChecked
       
  7763 // Returns value of iViagHomeZoneParamsChecked.
       
  7764 // (other items were commented in a header).
       
  7765 // ---------------------------------------------------------------------------
       
  7766 //
       
  7767 TBool CMmPhoneTsy::GetHomeZoneParamsChecked()
       
  7768 	{
       
  7769 	return iViagHomeZoneParamsChecked;
       
  7770 	}
       
  7771 
       
  7772 // ---------------------------------------------------------------------------
       
  7773 // CMmPhoneTsy::SetHomeZoneParamsChecked
       
  7774 // Sets internal boolean, which indicates is HomeZoneParams 
       
  7775 // query done in SimStatusReady
       
  7776 // (other items were commented in a header).
       
  7777 // ---------------------------------------------------------------------------
       
  7778 //
       
  7779 void CMmPhoneTsy::SetHomeZoneParamsChecked( TBool aHomeZoneChecked )
       
  7780 	{
       
  7781 	iViagHomeZoneParamsChecked = aHomeZoneChecked;
       
  7782 	}
       
  7783 	
       
  7784 // ---------------------------------------------------------------------------
       
  7785 // CMmPhoneTsy::CompleteNotifyCallDurationChange
       
  7786 // Complete notification when duration changes (every 10sec). Timer causes calling of
       
  7787 // this completion every 10 second. 
       
  7788 // ---------------------------------------------------------------------------
       
  7789 //
       
  7790 void CMmPhoneTsy::CompleteNotifyCallDurationChange()
       
  7791     {
       
  7792 	TUint32 duration = KLifeTimeUpdateInterval;		
       
  7793     CMmDataPackage dataPackage;
       
  7794     dataPackage.PackData( &duration );
       
  7795 
       
  7796     TFLOGSTRING2("TSY: CMmPhoneTsy::CompleteNotifyCallDurationChange - \
       
  7797          duration: %d", duration);
       
  7798 
       
  7799 #ifdef USING_CTSY_DISPATCHER	
       
  7800     TRAP_IGNORE(iMessageManager->HandleRequestL( 
       
  7801     				ECtsyUpdateLifeTimeReq, &dataPackage );
       
  7802         ); 
       
  7803 #else	
       
  7804     TRAP_IGNORE(iMessageManager->HandleRequestL( 
       
  7805     				EMmTsyUpdateLifeTimeIPC, &dataPackage );
       
  7806         ); 
       
  7807 #endif //USING_CTSY_DISPATCHER 
       
  7808     }
       
  7809     
       
  7810 // ---------------------------------------------------------------------------
       
  7811 // CMmPhoneTsy::NotifyTelephonyAudioControlError
       
  7812 // Receives error notifications from Telephony audio control
       
  7813 // ---------------------------------------------------------------------------
       
  7814 //
       
  7815 #if TF_LOGGING_METHOD == 1
       
  7816 void CMmPhoneTsy::NotifyTelephonyAudioControlError( const TName& aCallName, 
       
  7817                                                     const TInt& aError )
       
  7818     {       
       
  7819     TFLOGSTRING3("TSY: CMmPhoneTsy::NotifyAudioControlError. Call name:%S, Error code %d", &aCallName, aError );
       
  7820 #else
       
  7821 void CMmPhoneTsy::NotifyTelephonyAudioControlError( const TName& /*aCallName*/, 
       
  7822                                                     const TInt& /*aError*/ )
       
  7823     {
       
  7824 #endif // TF_LOGGING_METHOD
       
  7825     
       
  7826     TInt callCount( iCallList->GetNumberOfObjects() );
       
  7827     // find all the audio calls and hang up them all
       
  7828     for ( TInt i = callCount; 0 < i; i-- )
       
  7829         {
       
  7830         CMmCallTsy* call = iCallList->GetMmCallById( i );
       
  7831         if ( NULL != call )
       
  7832             {
       
  7833             if ( RMobilePhone::EVoiceService == call->CallMode() ||
       
  7834                  RMobilePhone::EAuxVoiceService == call->CallMode() )
       
  7835                 {
       
  7836                 call->HangUp( CMmCallTsy::EMultimodeCallReqHandleUnknown );
       
  7837                 }
       
  7838             }
       
  7839         }
       
  7840 
       
  7841     }
       
  7842 	
       
  7843 // ---------------------------------------------------------------------------
       
  7844 // CMmPhoneTsy::SetPBInitActiveStatus
       
  7845 // Is PB intitialization active.
       
  7846 // (other items were commented in a header).
       
  7847 // ---------------------------------------------------------------------------
       
  7848 //    
       
  7849 void CMmPhoneTsy::SetPBInitActiveStatus( TBool aIsInitializationActive )
       
  7850     {
       
  7851 TFLOGSTRING2("TSY: CMmPhoneTsy::SetPBInitActiveStatus: - prev.status %i", iIsInitializationActive);    
       
  7852 TFLOGSTRING2("TSY: CMmPhoneTsy::SetPBInitActiveStatus: %i", aIsInitializationActive);
       
  7853     
       
  7854     iIsInitializationActive = aIsInitializationActive;
       
  7855     }
       
  7856 
       
  7857 // ---------------------------------------------------------------------------
       
  7858 // CMmPhoneTsy::IsPBInitActive
       
  7859 // Is PB intitialization active.
       
  7860 // (other items were commented in a header).
       
  7861 // ---------------------------------------------------------------------------
       
  7862 //    
       
  7863 TBool CMmPhoneTsy::IsPBInitActive()
       
  7864     {   
       
  7865 TFLOGSTRING2("TSY: CMmPhoneTsy::IsPBInitActive: %i", iIsInitializationActive);
       
  7866     
       
  7867     return iIsInitializationActive;
       
  7868     }
       
  7869 
       
  7870 // ---------------------------------------------------------------------------
       
  7871 // CMmPhoneTsy::IsHWRMSupported
       
  7872 // availability of Hareware Resource Manager in the current ROM
       
  7873 // Returns TTrue indicate HWRM is available. TFalse indicate it is unavailable
       
  7874 // ---------------------------------------------------------------------------
       
  7875 //
       
  7876 TBool CMmPhoneTsy::IsHWRMSupported()
       
  7877 	{
       
  7878 #ifdef __EABI__
       
  7879 	return KHWRMIsSupported != 0;
       
  7880 #else	// WINSCW
       
  7881 	    // for the emulator the SecureId of Master phone application is patched via the epoc32\data\epoc.ini file
       
  7882 		// for example, define
       
  7883 		// ctsy_KHWRMIsSupported 1
       
  7884 	TInt HWRMSupported = 0;
       
  7885     UserSvr::HalFunction(EHalGroupEmulator,EEmulatorHalIntProperty,(TAny*)"ctsy_KHWRMIsSupported", &HWRMSupported);
       
  7886     return HWRMSupported != 0;
       
  7887 #endif
       
  7888 	}
       
  7889 
       
  7890 // ---------------------------------------------------------------------------
       
  7891 // CMmPhoneTsy::IsSIMReady
       
  7892 // Is SIM ready for query.
       
  7893 // (other items were commented in a header).
       
  7894 // ---------------------------------------------------------------------------
       
  7895 //
       
  7896 TBool CMmPhoneTsy::IsSIMReady()
       
  7897 	{
       
  7898 	TFLOGSTRING2("TSY: CMmPhoneTsy::IsSIMReady: %i", iBootState.iSIMReady);
       
  7899 	return iBootState.iSIMReady;
       
  7900 	}
       
  7901 
       
  7902 // ---------------------------------------------------------------------------
       
  7903 // CMmPhoneTsy::SaveFdnInfoDetails
       
  7904 // FDN details saved in case of FDN Pb not created but info received
       
  7905 // (other items were commented in a header).
       
  7906 // ---------------------------------------------------------------------------
       
  7907 //   
       
  7908 void CMmPhoneTsy::SaveFdnInfoDetails( TInt aResult, CMmDataPackage* aDataPackage )
       
  7909     {
       
  7910 TFLOGSTRING2("TSY: CMmPhoneTsy::SaveFdnInfoDetails aResult:  %d", aResult );
       
  7911 
       
  7912    // Store FDN info only in successfull case
       
  7913     if ( KErrNone == aResult )
       
  7914        {
       
  7915        TPBFdnInfo pbFdnInfo;
       
  7916        aDataPackage->UnPackData( pbFdnInfo );
       
  7917        iPhoneBookState->iFDNNumOfEntries = pbFdnInfo.iFDNNumOfEntries;
       
  7918        iPhoneBookState->iFDNNumberLengthMax = pbFdnInfo.iFDNNumberLengthMax;
       
  7919        iPhoneBookState->iFDNTextLengthMax = pbFdnInfo.iFDNTextLengthMax;
       
  7920 
       
  7921 TFLOGSTRING2("TSY: CMmPhoneTsy::SaveFdnInfoDetails - iFDNNumOfEntries: %i",iPhoneBookState->iFDNNumOfEntries );
       
  7922 TFLOGSTRING2("TSY: CMmPhoneTsy::SaveFdnInfoDetails - iFDNNumberLengthMax: %i",iPhoneBookState->iFDNNumberLengthMax );
       
  7923 TFLOGSTRING2("TSY: CMmPhoneTsy::SaveFdnInfoDetails - iFDNTextLengthMax: %i",iPhoneBookState->iFDNTextLengthMax );
       
  7924        }
       
  7925     }
       
  7926 
       
  7927 // ---------------------------------------------------------------------------
       
  7928 // CMmPhoneTsy::IsModemStatusReady
       
  7929 // Is modem status ready
       
  7930 // (other items were commented in a header).
       
  7931 // ---------------------------------------------------------------------------
       
  7932 //    
       
  7933 TBool CMmPhoneTsy::IsModemStatusReady() const
       
  7934     {   
       
  7935 TFLOGSTRING2("TSY: CMmPhoneTsy::IsModemStatusReady: %i", iIsModemReady );
       
  7936     
       
  7937     return iIsModemReady;
       
  7938     }
       
  7939 //  End of File
       
  7940