telephonyserverplugins/common_tsy/commontsy/src/mmtsy/cmmlinetsy.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
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 // INCLUDE FILES
       
    19 #include "cmmlinetsy.h"
       
    20 #include "cmmphonetsy.h"
       
    21 #include "cmmcalltsy.h"
       
    22 #include "cmmlinelist.h"
       
    23 #include "cmmcalllist.h"
       
    24 #include "cmmtsyreqhandlestore.h"
       
    25 #include "MmTsy_numberOfSlots.h"
       
    26 #include <ctsy/tflogger.h>
       
    27 #include <ctsy/pluginapi/cmmdatapackage.h>
       
    28 #include <et_struct.h>
       
    29 
       
    30 
       
    31 // ======== MEMBER FUNCTIONS ========
       
    32 
       
    33 CMmLineTsy::CMmLineTsy()
       
    34     {
       
    35     }
       
    36 
       
    37 void CMmLineTsy::ConstructL()
       
    38     {
       
    39     TFLOGSTRING("TSY: CMmLineTsy::ConstructL");
       
    40     //Initialise miscellaneous internal attributes
       
    41     InitInternalAttributesL();
       
    42 
       
    43     // Create and store a Call Object for incoming calls.
       
    44     TInt ret = CreateCallObjectForIncomingCall();
       
    45     
       
    46     if ( KErrNone != ret )
       
    47         {
       
    48         //if this fails, incoming calls cannot be called -> leave
       
    49         User::Leave( KErrNoMemory );
       
    50         }
       
    51 
       
    52     //create req handle store
       
    53     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( 
       
    54         EMultimodeLineMaxNumOfRequests, iLineReqHandles );
       
    55     }
       
    56 
       
    57 CMmLineTsy::~CMmLineTsy()
       
    58     {
       
    59     TFLOGSTRING2("TSY: CMmLineTsy::~CMmLineTsy. Line name: %S", &iLineName);
       
    60 
       
    61     //delete req handle store
       
    62     delete iTsyReqHandleStore;
       
    63 
       
    64     //delete incoming call object
       
    65     if ( iCallForIncomingCall )
       
    66         {
       
    67         iCallForIncomingCall->Close();
       
    68         }
       
    69 
       
    70     // Remove all calls still open from this line
       
    71     iMmPhone->CallList()->RemoveCallsByLine( &iLineName );
       
    72 
       
    73     //Inform phone that this line has been removed.
       
    74     iMmPhone->RemoveLine( iLineName );
       
    75 
       
    76     iMmPhone = NULL;
       
    77     iCallForIncomingCall = NULL;
       
    78     iRetLineStatus = NULL;
       
    79     iRetCaps = NULL;
       
    80     iRetIncomingCallName = NULL;
       
    81     iRetCallAdded = NULL;
       
    82     iRetMobileLineStatus = NULL;
       
    83     iTsyReqHandleStore = NULL;
       
    84     iMessageManager = NULL;
       
    85     }
       
    86 
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CMmLineTsy::OpenNewObjectByNameL
       
    90 // Returns a pointer to an existing call. The TSY classes must not use this 
       
    91 // method. This method is called when the client uses RCall::OpenExistingCall 
       
    92 // method.
       
    93 // (other items were commented in a header).
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 CTelObject* CMmLineTsy::OpenNewObjectByNameL(
       
    97     const TDesC& aName )
       
    98     {
       
    99     TFLOGSTRING2("TSY: CMmLineTsy::OpenNewObjectByNameL %S", &aName);
       
   100 
       
   101     TName mmCallName( aName );
       
   102     CMmCallTsy* mmCall = iMmPhone->CallList()->GetMmCallByName( &mmCallName );
       
   103 
       
   104     //if not found, Leave...
       
   105     if ( NULL == mmCall )
       
   106         {
       
   107         User::Leave( KErrNotFound );
       
   108         }
       
   109     else
       
   110         {
       
   111         //Update iUnownedCallObject flag
       
   112         mmCall->SetUnownedCallObjectFlag( EFalse );
       
   113         }
       
   114 
       
   115     return mmCall;
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // CMmLineTsy::InitInternalAttributesL
       
   120 // Initialises miscellaneous internal attributes.
       
   121 // (other items were commented in a header).
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 void CMmLineTsy::InitInternalAttributesL()
       
   125     {
       
   126     // Set object attributes
       
   127     iLineStatus = RCall::EStatusIdle;    
       
   128     iMobileLineStatus = RMobileCall::EStatusIdle;
       
   129 
       
   130     //reset the name for answering call
       
   131     iNameOfCallForAnswering.Zero();
       
   132 
       
   133     iNumCalls = 0;    // Number of calls created from line;
       
   134     iCallSequenceNumber = 0;    // The sequence number for the calls
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // CMmLineTsy::CallObjectForIncomingCall
       
   139 // This method returns a Call object that is used for a new incoming call. 
       
   140 // If there are no incoming calls this method creates a new call object.
       
   141 // (other items were commented in a header).
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 CMmCallTsy* CMmLineTsy::CallObjectForIncomingCall()
       
   145     {
       
   146     CMmCallTsy* callForIncomingCall = NULL;
       
   147 
       
   148     if ( iCallForIncomingCall == NULL )
       
   149         {
       
   150         CreateCallObjectForIncomingCall();
       
   151         }
       
   152 
       
   153     callForIncomingCall = iCallForIncomingCall;
       
   154 
       
   155     return callForIncomingCall;
       
   156     }
       
   157 
       
   158 // ---------------------------------------------------------------------------
       
   159 // CMmLineTsy::ReqModeL
       
   160 // ReqModeL is called from the server's CTelObject::ReqAnalyserL in order to 
       
   161 // check the type of request it has
       
   162 // (other items were commented in a header).
       
   163 // ---------------------------------------------------------------------------
       
   164 //
       
   165 CTelObject::TReqMode CMmLineTsy::ReqModeL(
       
   166     const TInt aIpc )
       
   167     {
       
   168     TFLOGSTRING2("TSY: CMmLineTsy::ReqModeL IPC:%d",aIpc);
       
   169     
       
   170     CTelObject::TReqMode ret( 0 );    // default return value
       
   171     
       
   172     switch( aIpc )
       
   173         {
       
   174         // Non-flow control requests
       
   175         // All disabled
       
   176         // TSYs wishing to implement their own buffering algorithm will place
       
   177         // all requests in this category. This category will also be used by
       
   178         // the RecoverDataPort request that must be passed to the TSY to
       
   179         // indicate that it may use the communications port after a loan.
       
   180                 
       
   181         //Get methods that do not use DOS and return immediately.
       
   182         //Flow control not required.
       
   183         case EEtelLineGetStatus:
       
   184         case EEtelLineGetCaps:
       
   185         case EEtelLineGetCallInfo:
       
   186         case EEtelLineGetInfo:
       
   187         case EEtelLineGetHookStatus:
       
   188         case EMobileLineGetMobileLineStatus:
       
   189 
       
   190         //Other methods that do not use DOS and return immediately.
       
   191         //Flow control not required.
       
   192         case EEtelLineEnumerateCall:
       
   193 
       
   194         //Methods that can propably take a long time and cannot therefore be
       
   195         //flow controlled. Solution: All these methods must check req handle
       
   196         //table before handling the request. In case that the request table
       
   197         //indicates that same method has been called and has not been
       
   198         //completed, the method should return KErrServerBusy.
       
   199             break;
       
   200         // Flow Controlled Services
       
   201         // KReqModeFlowControlObeyed
       
   202         // Commands that change the state of the phone, e.g. clearing the AoC
       
   203         // counter; are commands that the TSY should only deal with one at
       
   204         // a time.
       
   205         
       
   206         //    ret = KReqModeFlowControlObeyed;
       
   207         //    break;
       
   208 
       
   209         // ReqModePostImmediately
       
   210         // Requests that notify a client about a change of state, where the
       
   211         // TSY needs to distinguish between different clients.
       
   212             //ret=KReqModeRePostImmediately;
       
   213             //break;
       
   214 
       
   215         // KReqModeMultipleCompletionEnabled
       
   216         // (a) commands that may take some time, but which the TSY can handle
       
   217         // more than one of concurrently, or 
       
   218         // (b) notifications that the TSY does not wish to be re-posted
       
   219         // immediately, so the server does no buffering.
       
   220             //ret=KReqModeMultipleCompletionEnabled;
       
   221             //break;
       
   222 
       
   223         // KReqModeMultipleCompletionEnabled | KReqModeFlowControlObeyed
       
   224         // A command that may take some time and which the TSY can only deal 
       
   225         // with one at a time.
       
   226             //ret = KReqModeMultipleCompletionEnabled |
       
   227             //    KReqModeFlowControlObeyed;
       
   228             //break;
       
   229 
       
   230         // Notification Requests
       
   231         // KReqModeMultipleCompletionEnabled | ReqModePostImmediately
       
   232         // Requests that notify a client about a change of state.
       
   233         // Since these requests do not require the issuing of any modem
       
   234         // commands, they do not have to obey flow control. The TSY never
       
   235         // gets more than one of these outstanding per CTelObject.
       
   236         case EEtelLineNotifyStatusChange:
       
   237         case EEtelLineNotifyCallAdded:
       
   238         case EETelLineCapsChangeNotification:
       
   239         case EEtelLineNotifyHookChange:
       
   240         case EEtelLineNotifyIncomingCall:
       
   241         case EMobileLineNotifyMobileLineStatusChange:
       
   242             ret = KReqModeMultipleCompletionEnabled |
       
   243                 KReqModeRePostImmediately;
       
   244             break;
       
   245         // Cancel Requests
       
   246         //It is not necessary to include the Cancel methods in ReqModeL at all
       
   247         //The ETel server never calls ReqModeL with a Cancel IPC.
       
   248 
       
   249         //Other variations of return values are unusable
       
   250 
       
   251         // Default: Call CLineBase's ReqModeL.
       
   252         default:
       
   253             ret = CLineBase::ReqModeL( aIpc );
       
   254             break;
       
   255         }
       
   256 
       
   257     return ret;
       
   258     }
       
   259 
       
   260 // ---------------------------------------------------------------------------
       
   261 // CMmLineTsy::ExtFunc
       
   262 // TRAP's all CMmLineTsy related MM API requests in cases that they fail. This 
       
   263 // method functions only as a centralized TRAP for the DoExtFuncL method that 
       
   264 // does the actual mapping of IPC number to TSY method call.
       
   265 // (other items were commented in a header).
       
   266 // ---------------------------------------------------------------------------
       
   267 //
       
   268 TInt CMmLineTsy::ExtFunc(
       
   269     const TTsyReqHandle aTsyReqHandle,
       
   270     const TInt aIpc,
       
   271     const TDataPackage& aPackage )
       
   272     {
       
   273     TInt ret( KErrNone );
       
   274     TInt trapError( KErrNone );
       
   275 
       
   276     //reset last tsy request type
       
   277     iReqHandleType = EMultimodeLineReqHandleUnknown;
       
   278 
       
   279     //Original code continues here.
       
   280     TRAP( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ); );
       
   281 
       
   282     if ( trapError != KErrNone )
       
   283         {
       
   284         // Object cannot be created.
       
   285         ReqCompleted( aTsyReqHandle, trapError );
       
   286         }
       
   287     else if ( ret != KErrNone )
       
   288         {
       
   289         ReqCompleted( aTsyReqHandle, ret );
       
   290         }
       
   291     
       
   292     //save request handle
       
   293     if ( EMultimodeLineReqHandleUnknown != iReqHandleType )
       
   294         {
       
   295         iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, aTsyReqHandle );
       
   296         }
       
   297 
       
   298     return KErrNone;
       
   299     }
       
   300 
       
   301 // ---------------------------------------------------------------------------
       
   302 // CMmLineTsy::DoExtFuncL
       
   303 // ExtFunc is called by the server when it has a "extended", i.e. non-core  
       
   304 // ETel request for the TSY. To process a request handle, request type and 
       
   305 // request  data are passed to the TSY. 
       
   306 // (other items were commented in a header).
       
   307 // ---------------------------------------------------------------------------
       
   308 //
       
   309 TInt CMmLineTsy::DoExtFuncL(
       
   310     const TTsyReqHandle aTsyReqHandle,
       
   311     const TInt aIpc,
       
   312     const TDataPackage& aPackage )
       
   313     {
       
   314     TFLOGSTRING3("TSY: CMmLineTsy::DoExtFuncL IPC:%d Handle:%d", aIpc, \
       
   315         aTsyReqHandle);
       
   316 
       
   317     TInt ret ( KErrNone );
       
   318 
       
   319     TAny* dataPtr = aPackage.Ptr1();
       
   320 
       
   321     // The request data has to extracted from TDataPackage and the TAny* 
       
   322     // pointers have to be "cast" to the expected request data type
       
   323     switch ( aIpc )
       
   324         {
       
   325       // Mobile Line Status
       
   326         // Get Mobile Line Status
       
   327         case EMobileLineGetMobileLineStatus:
       
   328             ret = GetMobileLineStatus( aTsyReqHandle,
       
   329             REINTERPRET_CAST( RMobileCall::TMobileCallStatus*, dataPtr ) );
       
   330             break;
       
   331         //Notify Change of Mobile Line Status
       
   332         case EMobileLineNotifyMobileLineStatusChange:
       
   333             ret = NotifyMobileLineStatusChange(
       
   334             REINTERPRET_CAST( RMobileCall::TMobileCallStatus*, dataPtr ) );
       
   335             break;
       
   336         default:
       
   337             ret = KErrNotSupported;
       
   338             break;
       
   339         }
       
   340 
       
   341     return ret;
       
   342     }
       
   343 
       
   344 // ---------------------------------------------------------------------------
       
   345 // CMmLineTsy::CreateNewCallName
       
   346 // Creates a new name for the call, which is the name of the line followed by 
       
   347 // a call sequence number.
       
   348 // (other items were commented in a header).
       
   349 // ---------------------------------------------------------------------------
       
   350 //
       
   351 TInt CMmLineTsy::CreateNewCallName(
       
   352     TDes& aNewName )
       
   353     {
       
   354     // buffer for the name
       
   355     TBuf<KMaxName> buf;
       
   356     // append line name first
       
   357     buf.Append( iLineName );
       
   358     // append call sequence number next
       
   359     buf.AppendNum( IncrementCallSequenceNumber() );
       
   360     // copy the created name
       
   361     aNewName.Copy( buf );
       
   362 
       
   363     return KErrNone;
       
   364     }
       
   365 
       
   366 // ---------------------------------------------------------------------------
       
   367 // CMmLineTsy::IncrementCallSequenceNumber
       
   368 // Returns the sequence number of the call created from this line. This 
       
   369 // sequence number will be resetted when this line object is deleted. TInt 
       
   370 // allows the value to increment to the value 2^32. 
       
   371 // (other items were commented in a header).
       
   372 // ---------------------------------------------------------------------------
       
   373 //
       
   374 TUint CMmLineTsy::IncrementCallSequenceNumber()
       
   375     {
       
   376     // increment call sequence number
       
   377     iCallSequenceNumber++;
       
   378     return iCallSequenceNumber;
       
   379     }
       
   380 
       
   381 // ---------------------------------------------------------------------------
       
   382 // CMmLineTsy::EnumerateCall
       
   383 // This CORE API method returns the number of calls opened from a line. The 
       
   384 // number of calls will be stored in the aCount pointer.
       
   385 // (other items were commented in a header).
       
   386 // ---------------------------------------------------------------------------
       
   387 //
       
   388 TInt CMmLineTsy::EnumerateCall(
       
   389     const TTsyReqHandle aTsyReqHandle,
       
   390     TInt* aCount )
       
   391     {
       
   392     *aCount = iNumCalls;
       
   393     ReqCompleted( aTsyReqHandle, KErrNone );
       
   394     return KErrNone;
       
   395     }
       
   396 
       
   397 // ---------------------------------------------------------------------------
       
   398 // CMmLineTsy::DecrementNumberOfCalls
       
   399 // Decrements number of calls opened from a line by one.
       
   400 // (other items were commented in a header).
       
   401 // ---------------------------------------------------------------------------
       
   402 //
       
   403 void CMmLineTsy::DecrementNumberOfCalls()
       
   404     {
       
   405     if ( iNumCalls > 0 )
       
   406         {
       
   407         iNumCalls--;
       
   408         }
       
   409     }
       
   410 
       
   411 // ---------------------------------------------------------------------------
       
   412 // CMmLineTsy::NotifyStatusChange
       
   413 // This CORE API method provides notification about a change in the line 
       
   414 // status
       
   415 // (other items were commented in a header).
       
   416 // ---------------------------------------------------------------------------
       
   417 //
       
   418 TInt CMmLineTsy::NotifyStatusChange(
       
   419     const TTsyReqHandle aTsyReqHandle,
       
   420     RCall::TStatus* aLineStatus )
       
   421     {
       
   422     iRetLineStatus = aLineStatus;
       
   423     iTsyReqHandleStore->SetTsyReqHandle( EMultimodeLineNotifyStatusChange,
       
   424         aTsyReqHandle );
       
   425     return KErrNone;
       
   426     }
       
   427 
       
   428 // ---------------------------------------------------------------------------
       
   429 // CMmLineTsy::NotifyStatusChangeCancel
       
   430 // This CORE API method cancels an outstanding line status change notification 
       
   431 // request, placed using the NotifyStatusChange() method.
       
   432 // (other items were commented in a header).
       
   433 // ---------------------------------------------------------------------------
       
   434 //
       
   435 TInt CMmLineTsy::NotifyStatusChangeCancel(
       
   436     const TTsyReqHandle aTsyReqHandle )
       
   437     {
       
   438     iRetLineStatus = NULL;
       
   439     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeLineNotifyStatusChange );
       
   440     ReqCompleted( aTsyReqHandle, KErrCancel );
       
   441     return KErrNone;
       
   442     }
       
   443 
       
   444 // ---------------------------------------------------------------------------
       
   445 // CMmLineTsy::CompleteNotifyStatusChange
       
   446 // This method is used to notify to the client about the line status change. 
       
   447 // This method should only be called by the CMmCallTsy's 
       
   448 // CompleteNotifyStatusChange method to guaratee that this is functioning 
       
   449 // right. 
       
   450 // (other items were commented in a header).
       
   451 // ---------------------------------------------------------------------------
       
   452 //
       
   453 void CMmLineTsy::CompleteNotifyStatusChange()
       
   454     {
       
   455     TInt ret( KErrNone );
       
   456     TBool coreStatusChanged( EFalse );
       
   457     TBool mobileStatusChanged( EFalse );
       
   458     RCall::TStatus tempCoreStatus( RCall::EStatusIdle );
       
   459     RMobileCall::TMobileCallStatus tempMobileStatus( 
       
   460         RMobileCall::EStatusIdle );
       
   461     TInt numberOfObjectsInCallList = iMmPhone->CallList()->
       
   462         GetNumberOfObjects();
       
   463 
       
   464     for ( TInt i = 0; i < numberOfObjectsInCallList; i++ )
       
   465         {
       
   466         CMmCallTsy* mmCall = iMmPhone->CallList()->GetMmCallByIndex(i);
       
   467         
       
   468         //check that the call object has been opened from this line
       
   469         if ( mmCall->Line() == this )
       
   470             {
       
   471             RMobileCall::TMobileCallStatus mobileStatus 
       
   472                 = mmCall->MobileCallStatus();
       
   473             switch( mobileStatus )
       
   474                 {
       
   475                 case RMobileCall::EStatusUnknown:
       
   476                     tempCoreStatus = RCall::EStatusUnknown;
       
   477                     tempMobileStatus = RMobileCall::EStatusUnknown;
       
   478                     //get out of loop, resulting status is unknown...
       
   479                     i = numberOfObjectsInCallList;
       
   480                     break;
       
   481                 case RMobileCall::EStatusConnected:
       
   482                     tempCoreStatus = RCall::EStatusConnected;
       
   483                     tempMobileStatus = RMobileCall::EStatusConnected;
       
   484                     //get out of loop, resulting status is unknown...
       
   485                     i = numberOfObjectsInCallList;
       
   486                     break;
       
   487                 case RMobileCall::EStatusRinging:
       
   488                     //update core status
       
   489                     if ( tempCoreStatus == RCall::EStatusIdle )
       
   490                         {
       
   491                         tempCoreStatus = RCall::EStatusRinging;
       
   492                         }
       
   493                     //update mobile status
       
   494                     if ( tempMobileStatus == RMobileCall::EStatusIdle || 
       
   495                          tempMobileStatus == RMobileCall::EStatusHold)
       
   496                         {
       
   497                         tempMobileStatus = mobileStatus;
       
   498                         }
       
   499                     break;
       
   500                 case RMobileCall::EStatusDialling:
       
   501                     if ( tempCoreStatus == RCall::EStatusIdle )
       
   502                         {
       
   503                         tempCoreStatus = RCall::EStatusDialling;
       
   504                         }
       
   505                     //update mobile status
       
   506                     if ( tempMobileStatus == RMobileCall::EStatusIdle || 
       
   507                          tempMobileStatus == RMobileCall::EStatusHold)
       
   508                         {
       
   509                         tempMobileStatus = mobileStatus;
       
   510                         }
       
   511                     break;
       
   512                 case RMobileCall::EStatusAnswering:
       
   513                     if ( tempCoreStatus == RCall::EStatusIdle ||
       
   514                          tempCoreStatus == RCall::EStatusRinging )
       
   515                         {
       
   516                         tempCoreStatus = RCall::EStatusAnswering;
       
   517                         }
       
   518                     //update mobile status
       
   519                     if ( tempMobileStatus == RMobileCall::EStatusIdle || 
       
   520                          tempMobileStatus == RMobileCall::EStatusRinging ||
       
   521                          tempMobileStatus == RMobileCall::EStatusHold )
       
   522                         {
       
   523                         tempMobileStatus = mobileStatus;
       
   524                         }
       
   525                     break;
       
   526                 case RMobileCall::EStatusConnecting:
       
   527                     if ( tempCoreStatus == RCall::EStatusIdle || 
       
   528                             tempCoreStatus == RCall::EStatusDialling )
       
   529                         {
       
   530                         tempCoreStatus = RCall::EStatusConnecting;
       
   531                         }
       
   532                     //update mobile status
       
   533                     if ( tempMobileStatus == RMobileCall::EStatusIdle ||
       
   534                          tempMobileStatus == RMobileCall::EStatusDialling ||
       
   535                          tempMobileStatus == RMobileCall::EStatusHold )
       
   536                         {
       
   537                         tempMobileStatus = mobileStatus;
       
   538                         }
       
   539                     break;
       
   540                 case RMobileCall::EStatusDisconnecting:
       
   541                     //update core status
       
   542                     if ( tempCoreStatus == RCall::EStatusIdle )
       
   543                         {
       
   544                         tempCoreStatus = RCall::EStatusHangingUp;
       
   545                         }
       
   546                     if ( tempMobileStatus == RMobileCall::EStatusIdle )
       
   547                         {
       
   548                         tempMobileStatus = mobileStatus;
       
   549                         }
       
   550                     break;
       
   551                 case RMobileCall::EStatusWaitingAlternatingCallSwitch:
       
   552                     if ( tempMobileStatus == RMobileCall::EStatusIdle )
       
   553                         {
       
   554                         tempMobileStatus = mobileStatus;
       
   555                         }
       
   556                     break;
       
   557                 case RMobileCall::EStatusHold:
       
   558                     if ( tempMobileStatus == RMobileCall::EStatusIdle || 
       
   559                          tempMobileStatus == 
       
   560                             RMobileCall::EStatusDisconnecting )
       
   561                         {
       
   562                         tempCoreStatus = iLineStatus;
       
   563                         tempMobileStatus = mobileStatus;
       
   564                         }
       
   565                     break;
       
   566                 case RMobileCall::EStatusIdle:
       
   567                 case RMobileCall::EStatusReconnectPending:
       
   568                 case RMobileCall::EStatusDisconnectingWithInband:
       
   569                 case RMobileCall::EStatusTransferring:
       
   570                 case RMobileCall::EStatusTransferAlerting:
       
   571                 default:
       
   572                     break;
       
   573                 }
       
   574             }
       
   575         }
       
   576 
       
   577     //check if core status has changed
       
   578     if ( tempCoreStatus != iLineStatus )
       
   579         {
       
   580         coreStatusChanged = ETrue;
       
   581         iLineStatus = tempCoreStatus;
       
   582         }
       
   583 
       
   584     //check if mobile status has changed
       
   585     if ( tempMobileStatus != iMobileLineStatus )
       
   586         {
       
   587         mobileStatusChanged = ETrue;
       
   588         iMobileLineStatus = tempMobileStatus;
       
   589         }
       
   590 
       
   591     //get core status change notification req handle
       
   592     TTsyReqHandle iNotifyStatusChangeHandle = iTsyReqHandleStore->
       
   593                 GetTsyReqHandle( EMultimodeLineNotifyStatusChange );
       
   594 
       
   595     //if req handle available and status changed
       
   596     if ( ( iNotifyStatusChangeHandle > 0 ) && coreStatusChanged )
       
   597         {
       
   598         *iRetLineStatus = iLineStatus; 
       
   599         iTsyReqHandleStore->ResetTsyReqHandle(
       
   600             EMultimodeLineNotifyStatusChange );
       
   601         ReqCompleted( iNotifyStatusChangeHandle, ret );
       
   602         }
       
   603 
       
   604     //get mobile status change notification req handle
       
   605     TTsyReqHandle iNotifyMobileLineStatusChangeHandle = iTsyReqHandleStore->
       
   606         GetTsyReqHandle( EMultimodeLineMobileLineStatusChange );
       
   607 
       
   608     //if req handle available and status changed
       
   609     if ( iNotifyMobileLineStatusChangeHandle > 0 
       
   610         && ( coreStatusChanged || mobileStatusChanged ) )
       
   611         {
       
   612         *iRetMobileLineStatus = iMobileLineStatus; 
       
   613         iTsyReqHandleStore->ResetTsyReqHandle(
       
   614             EMultimodeLineMobileLineStatusChange );
       
   615         ReqCompleted( iNotifyMobileLineStatusChangeHandle, ret );
       
   616         }
       
   617     }
       
   618 
       
   619 // ---------------------------------------------------------------------------
       
   620 // CMmLineTsy::GetHookStatus
       
   621 // This CORE API method retrieves the current hook status. Method is not 
       
   622 // currently supported,
       
   623 // (other items were commented in a header).
       
   624 // ---------------------------------------------------------------------------
       
   625 //
       
   626 TInt CMmLineTsy::GetHookStatus(
       
   627     const TTsyReqHandle aTsyReqHandle,
       
   628     RCall::THookStatus* )
       
   629     {
       
   630     ReqCompleted( aTsyReqHandle, KErrNotSupported );
       
   631     return KErrNone;
       
   632     }
       
   633 
       
   634 // ---------------------------------------------------------------------------
       
   635 // CMmLineTsy::GetInfo
       
   636 // This CORE API method retrieves the current line information.
       
   637 // (other items were commented in a header).
       
   638 // ---------------------------------------------------------------------------
       
   639 //
       
   640 TInt CMmLineTsy::GetInfo(
       
   641     const TTsyReqHandle aTsyReqHandle,
       
   642     RLine::TLineInfo* aLineInfo )
       
   643     {
       
   644     // The current hook status.
       
   645     aLineInfo->iHookStatus = RCall::EHookStatusUnknown; 
       
   646     // The current line status.
       
   647     aLineInfo->iStatus = iLineStatus;
       
   648     // The name of the last call created on the line.
       
   649     aLineInfo->iNameOfLastCallAdded = iNameOfLastCallAdded;
       
   650     // The name of the call to which a new incoming call will be directed.
       
   651     aLineInfo->iNameOfCallForAnswering = iNameOfCallForAnswering;
       
   652  
       
   653     ReqCompleted( aTsyReqHandle, KErrNone );
       
   654     return KErrNone;
       
   655     }
       
   656 
       
   657 // ---------------------------------------------------------------------------
       
   658 // CMmLineTsy::LineInfo
       
   659 // This method retrieves the current line information. The method is used by 
       
   660 // MmPhone object.
       
   661 // (other items were commented in a header).
       
   662 // ---------------------------------------------------------------------------
       
   663 //
       
   664 RPhone::TLineInfo CMmLineTsy::LineInfo() const
       
   665     {        
       
   666     // Line info
       
   667     RPhone::TLineInfo lineInfo;
       
   668     // The current line status.
       
   669     lineInfo.iStatus = iLineStatus;
       
   670     // line capabilities
       
   671     lineInfo.iLineCapsFlags = iLineCaps.iFlags;
       
   672     // line name
       
   673     lineInfo.iName = iLineName;
       
   674 
       
   675     return lineInfo;
       
   676     }
       
   677 
       
   678 // ---------------------------------------------------------------------------
       
   679 // CMmLineTsy::NotifyCapsChange
       
   680 // This CORE API method provides notification of a change in the line 
       
   681 // capabilities.
       
   682 // (other items were commented in a header).
       
   683 // ---------------------------------------------------------------------------
       
   684 //
       
   685 TInt CMmLineTsy::NotifyCapsChange(
       
   686     const TTsyReqHandle aTsyReqHandle,
       
   687     RLine::TCaps* aCaps )
       
   688     {
       
   689     // On return, contains the new line capabilities
       
   690     iRetCaps = aCaps;
       
   691     iTsyReqHandleStore->SetTsyReqHandle( EMultimodeLineCapsChangeNotification,
       
   692         aTsyReqHandle );
       
   693     
       
   694     return KErrNone;
       
   695     }
       
   696 
       
   697 // ---------------------------------------------------------------------------
       
   698 // CMmLineTsy::NotifyCapsChangeCancel
       
   699 // This CORE API method cancels an "line capabilities change" notification 
       
   700 // request, placed using the NotifyCapsChange() method.
       
   701 // (other items were commented in a header).
       
   702 // ---------------------------------------------------------------------------
       
   703 //
       
   704 TInt CMmLineTsy::NotifyCapsChangeCancel(
       
   705     const TTsyReqHandle aTsyReqHandle )
       
   706     {
       
   707     iRetCaps = NULL;
       
   708     iTsyReqHandleStore->ResetTsyReqHandle(
       
   709         EMultimodeLineCapsChangeNotification );
       
   710     ReqCompleted( aTsyReqHandle, KErrCancel );
       
   711 
       
   712     return KErrNone;
       
   713     }
       
   714 
       
   715 // ---------------------------------------------------------------------------
       
   716 // CMmLineTsy::CompleteNotifyCapsChange
       
   717 // This method is used to notify to the client about the capabilities change.
       
   718 // (other items were commented in a header).
       
   719 // ---------------------------------------------------------------------------
       
   720 //
       
   721 void CMmLineTsy::CompleteNotifyCapsChange()
       
   722     {
       
   723     //reset req handle. Returns the deleted req handle
       
   724     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
   725         EMultimodeLineCapsChangeNotification );
       
   726 
       
   727     if ( EMultimodeLineReqHandleUnknown != reqHandle )
       
   728         {
       
   729         *iRetCaps = iLineCaps; 
       
   730         ReqCompleted( reqHandle, KErrNone );
       
   731         }
       
   732     }
       
   733 
       
   734 // ---------------------------------------------------------------------------
       
   735 // CMmLineTsy::NotifyIncomingCall
       
   736 // This CORE API method is used to notify a client when an incoming call is 
       
   737 // detected.
       
   738 // (other items were commented in a header).
       
   739 // ---------------------------------------------------------------------------
       
   740 //
       
   741 TInt CMmLineTsy::NotifyIncomingCall(
       
   742     const TTsyReqHandle aTsyReqHandle,
       
   743     TName* aName )
       
   744     {
       
   745     // On notification, contains the name of the incoming call.
       
   746     iRetIncomingCallName = aName;    
       
   747     iTsyReqHandleStore->SetTsyReqHandle( EMultimodeLineNotifyIncomingCall,
       
   748          aTsyReqHandle );
       
   749     return KErrNone;
       
   750     }
       
   751 
       
   752 // ---------------------------------------------------------------------------
       
   753 // CMmLineTsy::NotifyIncomingCallCancel
       
   754 // This CORE API method cancels an outstanding incoming call notification, 
       
   755 // placed with the NotifyIncomingCall() method.
       
   756 // (other items were commented in a header).
       
   757 // ---------------------------------------------------------------------------
       
   758 //
       
   759 TInt CMmLineTsy::NotifyIncomingCallCancel(
       
   760     const TTsyReqHandle aTsyReqHandle )
       
   761     {
       
   762     iRetIncomingCallName = NULL;
       
   763     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeLineNotifyIncomingCall );
       
   764     ReqCompleted( aTsyReqHandle, KErrCancel );
       
   765     return KErrNone;    
       
   766     }
       
   767 
       
   768 // ---------------------------------------------------------------------------
       
   769 // CMmLineTsy::NotifyCallAdded
       
   770 // This CORE API method provides notification that a new call has been added 
       
   771 // to the line.
       
   772 // (other items were commented in a header).
       
   773 // ---------------------------------------------------------------------------
       
   774 //
       
   775 TInt CMmLineTsy::NotifyCallAdded(
       
   776     const TTsyReqHandle aTsyReqHandle,
       
   777     TName* aName )
       
   778     {
       
   779     TFLOGSTRING2("TSY: CMmLineTsy::NotifyCallAdded requested by client, \
       
   780         lineMode:%d", iLineMode);
       
   781     // On return, contains the name of the new call.
       
   782     iRetCallAdded = aName;    
       
   783     iTsyReqHandleStore->SetTsyReqHandle( EMultimodeLineNotifyCallAdded,
       
   784         aTsyReqHandle );
       
   785     return KErrNone;
       
   786     }
       
   787 
       
   788 // ---------------------------------------------------------------------------
       
   789 // CMmLineTsy::NotifyCallAddedCancel
       
   790 // This CORE API method cancels an outstanding "new call added" notification 
       
   791 // request, placed using the NotifyCallAdded() method.(other items were 
       
   792 // commented in a header).
       
   793 // (other items were commented in a header).
       
   794 // ---------------------------------------------------------------------------
       
   795 //
       
   796 TInt CMmLineTsy::NotifyCallAddedCancel(
       
   797     const TTsyReqHandle aTsyReqHandle )
       
   798     {
       
   799     TFLOGSTRING("TSY: CMmLineTsy::NotifyCallAddedCancel requested by client");
       
   800     iRetCallAdded = NULL;
       
   801     iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeLineNotifyCallAdded );
       
   802     ReqCompleted( aTsyReqHandle, KErrCancel );
       
   803     return KErrNone;    
       
   804     }
       
   805 
       
   806 // ---------------------------------------------------------------------------
       
   807 // CMmLineTsy::CompleteNotifyCallAdded
       
   808 // This CORE API method is used to notify to the client that a call has been 
       
   809 // added to the line. NOTE: Type is not defined because this method may be 
       
   810 // called when incoming call occurs or when a call object has been created. 
       
   811 // (other items were commented in a header).
       
   812 // ---------------------------------------------------------------------------
       
   813 //
       
   814 void CMmLineTsy::CompleteNotifyCallAdded(const TDesC& aName )    
       
   815     {
       
   816     TFLOGSTRING3("TSY: CMmLineTsy::CompleteNotifyCallAdded entered, \
       
   817     CALL ADDED, Call name: %S, Call mode: %d", &aName, iLineMode );
       
   818 
       
   819     //reset req handle. Returns the deleted req handle
       
   820     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
   821                                 EMultimodeLineNotifyCallAdded );
       
   822 
       
   823     iNumCalls++;
       
   824 
       
   825     if ( EMultimodeLineReqHandleUnknown != reqHandle )
       
   826         {
       
   827         TFLOGSTRING("TSY: CMmLineTsy::CompleteNotifyCallAdded, Completed!");
       
   828         *iRetCallAdded = aName;
       
   829         ReqCompleted( reqHandle, KErrNone );
       
   830         }
       
   831     }
       
   832 
       
   833 // ---------------------------------------------------------------------------
       
   834 // CMmLineTsy::GetCaps
       
   835 // This CORE API method retrieves the line capabilities.
       
   836 // (other items were commented in a header).
       
   837 // ---------------------------------------------------------------------------
       
   838 //
       
   839 TInt CMmLineTsy::GetCaps(
       
   840     const TTsyReqHandle aTsyReqHandle,
       
   841     RLine::TCaps* aCaps )
       
   842     {
       
   843     *aCaps = iLineCaps;
       
   844     ReqCompleted( aTsyReqHandle, KErrNone );
       
   845     return KErrNone;
       
   846     }
       
   847 
       
   848 // ---------------------------------------------------------------------------
       
   849 // CMmLineTsy::GetStatus
       
   850 // This CORE API method returns core line status information.
       
   851 // (other items were commented in a header).
       
   852 // ---------------------------------------------------------------------------
       
   853 //
       
   854 TInt CMmLineTsy::GetStatus(
       
   855     const TTsyReqHandle aTsyReqHandle,
       
   856     RCall::TStatus* aStatus )
       
   857     {    
       
   858     *aStatus = iLineStatus;
       
   859     ReqCompleted( aTsyReqHandle, KErrNone );
       
   860     return KErrNone;
       
   861     }
       
   862 
       
   863 // ---------------------------------------------------------------------------
       
   864 // CMmLineTsy::NotifyHookChange
       
   865 // This CORE API method provides notification when the hook status changes. 
       
   866 // Feature is not supported.
       
   867 // (other items were commented in a header).
       
   868 // ---------------------------------------------------------------------------
       
   869 //
       
   870 TInt CMmLineTsy::NotifyHookChange(
       
   871     const TTsyReqHandle aTsyReqHandle,
       
   872     RCall::THookStatus* )
       
   873     {    
       
   874     ReqCompleted( aTsyReqHandle, KErrNotSupported );
       
   875     return KErrNone;
       
   876     }
       
   877 
       
   878 // ---------------------------------------------------------------------------
       
   879 // CMmLineTsy::NotifyHookChangeCancel
       
   880 // This CORE API method cancels an outstanding hook change notification req
       
   881 // placed using the NotifyHookChange() method. Feature is not supported.
       
   882 // (other items were commented in a header).
       
   883 // ---------------------------------------------------------------------------
       
   884 //
       
   885 TInt CMmLineTsy::NotifyHookChangeCancel(
       
   886     const TTsyReqHandle aTsyReqHandle )
       
   887     {    
       
   888     ReqCompleted( aTsyReqHandle, KErrNotSupported );
       
   889     return KErrNone;
       
   890     }
       
   891 
       
   892 // ---------------------------------------------------------------------------
       
   893 // CMmLineTsy::GetCallInfo
       
   894 // This CORE API method returns information about a call. 
       
   895 // (other items were commented in a header).
       
   896 // ---------------------------------------------------------------------------
       
   897 //
       
   898 TInt CMmLineTsy::GetCallInfo(
       
   899     const TTsyReqHandle aTsyReqHandle,
       
   900     TCallInfoIndex* aCallInfoIndex )
       
   901     {
       
   902     TFLOGSTRING3("TSY: CMmLineTsy::GetCallInfo - Line name: %S, Index: %d",
       
   903         &iLineName, aCallInfoIndex->iIndex );
       
   904 
       
   905     TInt ret( KErrNotFound );
       
   906 
       
   907     // Check if the call object can be found from call list by index
       
   908     CMmCallTsy* mmCall = REINTERPRET_CAST( CMmCallTsy*, 
       
   909             iMmPhone->CallList()->GetMmCallByIndexAndLine( 
       
   910                 aCallInfoIndex->iIndex, &iLineName ) );
       
   911 
       
   912     // If call object was found, fill the client pointer with call information
       
   913     if ( mmCall )
       
   914         {
       
   915         aCallInfoIndex->iInfo.iCallName      = mmCall->CallName();
       
   916         aCallInfoIndex->iInfo.iStatus        = mmCall->Status();
       
   917         aCallInfoIndex->iInfo.iCallCapsFlags = mmCall->CallCaps();
       
   918 
       
   919         TFLOGSTRING3("TSY: CMmLineTsy::GetCallInfo - Call name: %S, Status: %d",
       
   920             &aCallInfoIndex->iInfo.iCallName, aCallInfoIndex->iInfo.iStatus );
       
   921 
       
   922         ret = KErrNone;
       
   923         }
       
   924 
       
   925     ReqCompleted( aTsyReqHandle, ret );
       
   926     return KErrNone;
       
   927     }
       
   928 
       
   929 // ---------------------------------------------------------------------------
       
   930 // CMmLineTsy::CancelService
       
   931 // CancelService is called by the server when it is "cleaning-up" any still 
       
   932 // outstanding asynchronous requests before closing a client's sub-session. 
       
   933 // This will happen if a client closes its R-class handle without cancelling 
       
   934 // outstanding asynchronous requests. Core API requests are directed to the 
       
   935 // LineBase. 
       
   936 // (other items were commented in a header).
       
   937 // ---------------------------------------------------------------------------
       
   938 //
       
   939 TInt CMmLineTsy::CancelService(
       
   940     const TInt aIpc, 
       
   941     const TTsyReqHandle aTsyReqHandle )
       
   942     {
       
   943     TInt ret( KErrNone );
       
   944     
       
   945     // When the clients close their sub-sessions (eg. by calling RLine::Close)
       
   946     // they may not have cancelled all their outstanding asynchronous requests 
       
   947     // before closing.  It is up to the ETel server to clean up in this 
       
   948     // situation, so the server will find the list of outstanding requests 
       
   949     // related to that sub-session object and pass these outstanding IPC 
       
   950     // request numbers, one at a time, to the CancelService method in the TSY.
       
   951 
       
   952     switch ( aIpc )
       
   953         {
       
   954         //TSY has started a request and it is not possible to then cancel
       
   955         //this request. The best thing for the TSY to do in this case is to
       
   956         //proceed as though the Cancel never happened. The server's call to
       
   957         //the TSY cancel function will return synchronously. The TSY then
       
   958         //continues to wait for the original acknowledgement and when it
       
   959         //receives it, the TSY will complete the original request.
       
   960         //case XXX
       
   961         //    break;
       
   962 
       
   963         //Cancel methods that are not supported
       
   964         //case XXX:
       
   965         //    ret = KErrNotSupported;
       
   966         //    break;
       
   967 
       
   968         //Notification Cancels, no special requirements.
       
   969         case EMobileLineNotifyMobileLineStatusChange:
       
   970             ret =  NotifyMobileLineStatusChangeCancel( aTsyReqHandle );
       
   971             break;
       
   972         //Everything is taken care in the method implementation.
       
   973         //Just direct the request to the method.
       
   974         //case XXX:
       
   975         //    ret = XXXCancel( aTsyReqHandle );
       
   976         //    break;
       
   977 
       
   978         default:
       
   979             return CLineBase::CancelService( aIpc, aTsyReqHandle );
       
   980         }
       
   981 
       
   982     return ret;
       
   983     }
       
   984 
       
   985 // ---------------------------------------------------------------------------
       
   986 // CMmLineTsy::RegisterNotification
       
   987 // RegisterNotification is called when the server recognises that this 
       
   988 // notification is being posted for the first time on this sub-session object. 
       
   989 // It enables the TSY to "turn on" any regular notification messages that it 
       
   990 // may receive from DOS. Currently does not really do anything but returns  
       
   991 // KErrNone to ETel server in case of known notification request type. 
       
   992 // (other items were commented in a header).
       
   993 // ---------------------------------------------------------------------------
       
   994 //
       
   995 TInt CMmLineTsy::RegisterNotification(
       
   996     const TInt aIpc )
       
   997     {    
       
   998     TInt ret( KErrNone );
       
   999 
       
  1000     switch ( aIpc )
       
  1001         {
       
  1002         case EEtelLineNotifyStatusChange:
       
  1003         case EEtelLineNotifyCallAdded:
       
  1004         case EETelLineCapsChangeNotification:
       
  1005         case EEtelLineNotifyHookChange:
       
  1006         case EEtelLineNotifyIncomingCall:
       
  1007         case EMobileLineNotifyMobileLineStatusChange:
       
  1008             ret = KErrNone;
       
  1009             break;
       
  1010         default:
       
  1011             // Unknown or invalid IPC
       
  1012             ret = KErrNotSupported;
       
  1013         }
       
  1014     return ret;
       
  1015     }
       
  1016 
       
  1017 // ---------------------------------------------------------------------------
       
  1018 // CMmLineTsy::DeregisterNotification
       
  1019 // DeregisterNotification is called when the server recognises that this 
       
  1020 // notification will not be posted again because the last client to have a 
       
  1021 // handle on this sub-session object has just closed the handle. It enables 
       
  1022 // TSY to "turn off" any regular notification messages that it may receive 
       
  1023 // from DOS. Currently does not really do anything but returns KErrNone to  
       
  1024 // ETel server in case of known notification request type. 
       
  1025 // (other items were commented in a header).
       
  1026 // ---------------------------------------------------------------------------
       
  1027 //
       
  1028 TInt CMmLineTsy::DeregisterNotification(
       
  1029     const TInt aIpc )
       
  1030     {
       
  1031     TInt ret( KErrNone );
       
  1032 
       
  1033     switch ( aIpc )
       
  1034         {
       
  1035         case EEtelLineNotifyStatusChange:
       
  1036         case EEtelLineNotifyCallAdded:
       
  1037         case EETelLineCapsChangeNotification:
       
  1038         case EEtelLineNotifyHookChange:
       
  1039         case EEtelLineNotifyIncomingCall:
       
  1040         case EMobileLineNotifyMobileLineStatusChange:
       
  1041             ret = KErrNone;
       
  1042             break;
       
  1043         default:
       
  1044             // Unknown or invalid IPC
       
  1045             ret = KErrNotSupported;
       
  1046         }
       
  1047     return ret;
       
  1048     }
       
  1049 
       
  1050 // ---------------------------------------------------------------------------
       
  1051 // CMmLineTsy::NumberOfSlotsL
       
  1052 // NumberOfSlotsL is called by the server when it is registering a new 
       
  1053 // NOTIFICATION. It enables the TSY to tell the server how many buffer slots 
       
  1054 // to allocate for "repost immediately" notifications that may trigger before 
       
  1055 // clients collect them.
       
  1056 // (other items were commented in a header).
       
  1057 // ---------------------------------------------------------------------------
       
  1058 //
       
  1059 TInt CMmLineTsy::NumberOfSlotsL(
       
  1060     const TInt aIpc )
       
  1061     {    
       
  1062     //There is a buffer in the ETel server for each type of NOTIFICATION and
       
  1063     //the size of the buffer is determined by the TSY. When the ETel server
       
  1064     //discovers that a request is "repost immediately" it will ask the TSY how
       
  1065     //big a buffer it wants by calling CTelObject::NumberOfSlotsL( ).
       
  1066     //
       
  1067     //It is up to the TSY developer's judgement how many buffer slots this
       
  1068     //method returns for each notification. If there is a danger that a
       
  1069     //particular notification could trigger frequently and in rapid succession
       
  1070     //(e.g. call group change notification) then at least 10 or 20 slots may
       
  1071     //be required. For a notification that triggers rarely, perhaps 1 or 2
       
  1072     //slots is enough.
       
  1073     //
       
  1074     //So if the ETel server has stored a few occurrences of a particular
       
  1075     //notification, when a client subsequently calls that notification request
       
  1076     //the ETel server will complete the client's request with the saved data.
       
  1077     
       
  1078     TInt numberOfSlots( 1 );
       
  1079 
       
  1080     switch ( aIpc )
       
  1081         {
       
  1082         case EEtelLineNotifyStatusChange:
       
  1083             numberOfSlots = KMmLineStatusChangeSlots;
       
  1084             break;
       
  1085         case EEtelLineNotifyCallAdded:
       
  1086             numberOfSlots = KMmLineCallAddedSlots;
       
  1087             break;
       
  1088         case EETelLineCapsChangeNotification:
       
  1089             numberOfSlots = KMmLineCapsChangeSlots;
       
  1090             break;
       
  1091         case EEtelLineNotifyHookChange:
       
  1092             numberOfSlots = KMmLineHookChangeSlots;
       
  1093             break;
       
  1094         case EEtelLineNotifyIncomingCall:
       
  1095             numberOfSlots = KMmLineIncomingCallSlots;
       
  1096             break;
       
  1097         case EMobileLineNotifyMobileLineStatusChange:
       
  1098             numberOfSlots = KMmLineMobileLineStatusChangeSlots;
       
  1099             break;
       
  1100         default:  
       
  1101             // Unknown or invalid Line IPC
       
  1102             User::Leave( KErrNotSupported );
       
  1103             break;
       
  1104         }
       
  1105     return numberOfSlots;
       
  1106     }
       
  1107 
       
  1108 // ---------------------------------------------------------------------------
       
  1109 // CMmLineTsy::LineMode
       
  1110 // Returns line mode.
       
  1111 // (other items were commented in a header).
       
  1112 // ---------------------------------------------------------------------------
       
  1113 //
       
  1114 RMobilePhone::TMobileService CMmLineTsy::LineMode() const
       
  1115     {
       
  1116     return iLineMode;
       
  1117     }
       
  1118 
       
  1119 // ---------------------------------------------------------------------------
       
  1120 // CMmLineTsy::LineName
       
  1121 // Returns line name.
       
  1122 // (other items were commented in a header).
       
  1123 // ---------------------------------------------------------------------------
       
  1124 //
       
  1125 TName CMmLineTsy::LineName() const
       
  1126     {
       
  1127     return iLineName;
       
  1128     }
       
  1129 
       
  1130 // ---------------------------------------------------------------------------
       
  1131 // CMmLineTsy::GetMobileLineStatus
       
  1132 // Returns the current status of the line through the aStatus argument. The 
       
  1133 // possible line states map to the call states (see MM API spec) so that a 
       
  1134 // line that has one or more calls opened from it will have a status defined 
       
  1135 // by this table.
       
  1136 // (other items were commented in a header).
       
  1137 // ---------------------------------------------------------------------------
       
  1138 //
       
  1139 TInt CMmLineTsy::GetMobileLineStatus(
       
  1140     const TTsyReqHandle aTsyReqHandle,
       
  1141     RMobileCall::TMobileCallStatus* aStatus )
       
  1142     {
       
  1143     *aStatus = iMobileLineStatus;
       
  1144     ReqCompleted( aTsyReqHandle, KErrNone );
       
  1145     return KErrNone;
       
  1146     }
       
  1147 
       
  1148 // ---------------------------------------------------------------------------
       
  1149 // CMmLineTsy::NotifyMobileLineStatusChange
       
  1150 // Allows a client to be notified when the mobile line changes state. The 
       
  1151 // request completes when the line changes state, the new state being copied 
       
  1152 // to the aStatus parameter.
       
  1153 // (other items were commented in a header).
       
  1154 // ---------------------------------------------------------------------------
       
  1155 //
       
  1156 TInt CMmLineTsy::NotifyMobileLineStatusChange(
       
  1157     RMobileCall::TMobileCallStatus* aStatus )
       
  1158     {
       
  1159     iRetMobileLineStatus = aStatus;
       
  1160     iReqHandleType = EMultimodeLineMobileLineStatusChange;
       
  1161     return KErrNone;
       
  1162     }
       
  1163 
       
  1164 // ---------------------------------------------------------------------------
       
  1165 // CMmLineTsy::NotifyMobileLineStatusChangeCancel
       
  1166 // Cancels an outstanding asynchronous NotifyMobileLineStatusChange request.
       
  1167 // (other items were commented in a header).
       
  1168 // ---------------------------------------------------------------------------
       
  1169 //
       
  1170 TInt CMmLineTsy::NotifyMobileLineStatusChangeCancel(
       
  1171     const TTsyReqHandle aTsyReqHandle )
       
  1172     {
       
  1173     iRetMobileLineStatus = NULL;
       
  1174     iTsyReqHandleStore->ResetTsyReqHandle(
       
  1175         EMultimodeLineMobileLineStatusChange );
       
  1176     ReqCompleted( aTsyReqHandle, KErrCancel );
       
  1177     return KErrNone;
       
  1178     }
       
  1179 
       
  1180 // ---------------------------------------------------------------------------
       
  1181 // CMmLineTsy::CompleteNotifyAddBypassingCall
       
  1182 // Handles ghost call object creation and initialisation. Also notifies 
       
  1183 // clients about the ghost call (using NotifyCallAdded method)
       
  1184 // (other items were commented in a header).
       
  1185 // ---------------------------------------------------------------------------
       
  1186 //
       
  1187 void CMmLineTsy::CompleteNotifyAddBypassingCall(
       
  1188     CMmDataPackage* aDataPackage )
       
  1189     {
       
  1190     TInt callId( -1 );
       
  1191     RMobilePhone::TMobileService callMode( RMobilePhone::EVoiceService );
       
  1192     RMobileCall::TMobileCallInfoV1* mobileCallInfo;
       
  1193 
       
  1194     const CCallDataPackage* callData = 
       
  1195         reinterpret_cast<const CCallDataPackage*>(aDataPackage);
       
  1196 
       
  1197     callData->GetCallIdAndMode( callId, callMode );
       
  1198     callData->UnPackData ( &mobileCallInfo );
       
  1199 
       
  1200     if ( mobileCallInfo->iStatus == RMobileCall::EStatusDialling ||
       
  1201          mobileCallInfo->iStatus == RMobileCall::EStatusConnecting ||
       
  1202          mobileCallInfo->iStatus == RMobileCall::EStatusConnected )
       
  1203         {
       
  1204         TFLOGSTRING2("TSY: CMmLineTsy::CompleteNotifyAddBypassingCall, \
       
  1205             CALL INITIATED - NOT REQUESTED BY ETEL's CLIENT, Call ID: %d",
       
  1206             callId );
       
  1207 
       
  1208         //create new call object
       
  1209         CMmCallTsy* mmGhostCall = CreateGhostCallObject(
       
  1210             callId, callMode, mobileCallInfo->iStatus );
       
  1211 
       
  1212         if ( mmGhostCall )
       
  1213             {
       
  1214             // Add the new call to the list of calls
       
  1215             TInt ret( iMmPhone->CallList()->AddObject( mmGhostCall ) );
       
  1216 
       
  1217             if ( KErrNone == ret )
       
  1218                 {
       
  1219                 mmGhostCall->CompleteNotifyMobileCallInfoChange( 
       
  1220                     aDataPackage );
       
  1221                 CompleteNotifyStatusChange();
       
  1222                 //inform ETel client that someone is creating a MO call
       
  1223                 CompleteNotifyCallAdded( mmGhostCall->CallName() );
       
  1224                 mmGhostCall->SetGhostCall( ETrue );
       
  1225                 }
       
  1226             else
       
  1227                 {
       
  1228                 delete mmGhostCall;
       
  1229                 }
       
  1230             }
       
  1231         }
       
  1232     else
       
  1233         {
       
  1234         TFLOGSTRING3("TSY: CMmLineTsy::CompleteNotifyAddBypassingCall, \
       
  1235             CALL NOT INITIATED - Call ID:%d, Call status:%d", 
       
  1236             callId, mobileCallInfo->iStatus);
       
  1237         }
       
  1238     }
       
  1239 
       
  1240 #ifdef TF_LOGGING_ENABLED
       
  1241 // ---------------------------------------------------------------------------
       
  1242 // CMmLineTsy::ReqCompleted
       
  1243 // Overloads CTelObject::ReqCompleted for logging purposes. It prints the 
       
  1244 // aTsyReqHandle and aError variable in the log file and then calls 
       
  1245 // CTelObject::ReqCompleted.
       
  1246 // (other items were commented in a header).
       
  1247 // ---------------------------------------------------------------------------
       
  1248 //
       
  1249 void CMmLineTsy::ReqCompleted(
       
  1250     const TTsyReqHandle aTsyReqHandle,
       
  1251     const TInt aError )
       
  1252     {
       
  1253     TFLOGSTRING3("TSY: CMmLineTsy::ReqCompleted Handle:%d Error:%d", 
       
  1254         aTsyReqHandle, aError);
       
  1255 
       
  1256     CTelObject::ReqCompleted(aTsyReqHandle,aError);        
       
  1257     }
       
  1258 
       
  1259 #endif
       
  1260 
       
  1261 
       
  1262 //  End of File