telephonyserverplugins/common_tsy/commontsy/src/mmtsy/cmmphonetsy.cpp
changeset 20 244d7c5f118e
parent 19 1f776524b15c
child 23 6b1d113cdff3
equal deleted inserted replaced
19:1f776524b15c 20:244d7c5f118e
   121     mmPhoneTsy->ConstructL();
   121     mmPhoneTsy->ConstructL();
   122     CleanupStack::Pop( mmPhoneTsy );
   122     CleanupStack::Pop( mmPhoneTsy );
   123     return mmPhoneTsy;
   123     return mmPhoneTsy;
   124     }
   124     }
   125 
   125 
   126 CMmPhoneTsy::CMmPhoneTsy()
   126 CMmPhoneTsy::CMmPhoneTsy():
       
   127     iReqHandleType(EMultimodePhoneReqHandleUnknown)
   127     {
   128     {
   128     }
   129     }
   129 
   130 
   130 void CMmPhoneTsy::ConstructL()
   131 void CMmPhoneTsy::ConstructL()
   131     {
   132     {
  1138 TFLOGSTRING3("TSY: CMmPhoneTsy::ExtFunc, IPC:%d, Handle:%d", aIpc, aTsyReqHandle);
  1139 TFLOGSTRING3("TSY: CMmPhoneTsy::ExtFunc, IPC:%d, Handle:%d", aIpc, aTsyReqHandle);
  1139 
  1140 
  1140     TInt ret = KErrNone;
  1141     TInt ret = KErrNone;
  1141     TInt trapError = KErrNone;
  1142     TInt trapError = KErrNone;
  1142 
  1143 
  1143     //reset last tsy request type
  1144     // Ensure the ReqHandleType is unset.
  1144     iReqHandleType = EMultimodePhoneReqHandleUnknown;
  1145     // This will detect cases where this method indirectly calls itself
       
  1146     // (e.g. servicing a client call that causes a self-reposting notification to complete and thus repost).
       
  1147     // Such cases are not supported because iReqHandleType is in the context of this class instance,
       
  1148     // not this request, and we don't want the values set by the inner request and the outer request
       
  1149     // interfering with each other.
       
  1150     __ASSERT_DEBUG(iReqHandleType==EMultimodePhoneReqHandleUnknown, User::Invariant());
  1145 
  1151 
  1146     //before processing further the request, check if offline mode status
  1152     //before processing further the request, check if offline mode status
  1147     //is enabled and if the given request can be perfomed in that case.
  1153     //is enabled and if the given request can be perfomed in that case.
  1148     if ( ERfsStateInfoInactive == iStateInfo &&
  1154     if ( ERfsStateInfoInactive == iStateInfo &&
  1149         !IsRequestPossibleInOffline( aIpc ) )
  1155         !IsRequestPossibleInOffline( aIpc ) )
  1175             SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
  1181             SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
  1176 #else
  1182 #else
  1177             iTsyReqHandleStore->SetTsyReqHandle( 
  1183             iTsyReqHandleStore->SetTsyReqHandle( 
  1178                 iReqHandleType, aTsyReqHandle );
  1184                 iReqHandleType, aTsyReqHandle );
  1179 #endif //REQHANDLE_TIMER
  1185 #endif //REQHANDLE_TIMER
  1180             }
  1186             // We've finished with this value now. Clear it so it doesn't leak
  1181 
  1187             //  up to any other instances of this method down the call stack
  1182         //reset last tsy request type
  1188             iReqHandleType = EMultimodePhoneReqHandleUnknown;
  1183         iReqHandleType = EMultimodePhoneReqHandleUnknown;
  1189             }
  1184         }
  1190         }
  1185 
  1191 
  1186     return KErrNone;
  1192     return KErrNone;
  1187 
  1193 
  1188     }
  1194     }
  1346 			break;
  1352 			break;
  1347 		// All calls termination
  1353 		// All calls termination
  1348         case EMobilePhoneTerminateAllCalls:
  1354         case EMobilePhoneTerminateAllCalls:
  1349             ret = TerminateAllCallsL( aTsyReqHandle );
  1355             ret = TerminateAllCallsL( aTsyReqHandle );
  1350             break;			
  1356             break;			
       
  1357         // Active calls termination
       
  1358         case EMobilePhoneTerminateActiveCalls:
       
  1359             ret = TerminateActiveCallsL( aTsyReqHandle );
       
  1360             break;          
  1351       // DTMF
  1361       // DTMF
  1352 		// forward request to the DTMF-specific Tsy
  1362 		// forward request to the DTMF-specific Tsy
  1353         case EMobilePhoneGetDTMFCaps:
  1363         case EMobilePhoneGetDTMFCaps:
  1354         case EMobilePhoneNotifyDTMFCapsChange:
  1364         case EMobilePhoneNotifyDTMFCapsChange:
  1355         case EMobilePhoneSendDTMFTones:
  1365         case EMobilePhoneSendDTMFTones:
  1617         //flow controlled. Solution: All these methods must check req handle 
  1627         //flow controlled. Solution: All these methods must check req handle 
  1618         //tablebefore handling the request. In case that the request table 
  1628         //tablebefore handling the request. In case that the request table 
  1619         //indicates that same method has been called and has not been 
  1629         //indicates that same method has been called and has not been 
  1620         //completed, the method should return KErrServerBusy.
  1630         //completed, the method should return KErrServerBusy.
  1621         case EMobilePhoneTerminateAllCalls:
  1631         case EMobilePhoneTerminateAllCalls:
       
  1632         case EMobilePhoneTerminateActiveCalls:
  1622         case EMobilePhoneGetFdnStatus:
  1633         case EMobilePhoneGetFdnStatus:
  1623         case EMobilePhoneGetCustomerServiceProfile:
  1634         case EMobilePhoneGetCustomerServiceProfile:
  1624         case EMobilePhoneGetDetectedNetworksV2Phase1:
  1635         case EMobilePhoneGetDetectedNetworksV2Phase1:
  1625         case EMobilePhoneSetLockSetting:
  1636         case EMobilePhoneSetLockSetting:
  1626         case EMobilePhoneVerifySecurityCode:
  1637         case EMobilePhoneVerifySecurityCode:
  2022         case EMobilePhoneSetALSLine:
  2033         case EMobilePhoneSetALSLine:
  2023         case EMobilePhoneSetFdnSetting:
  2034         case EMobilePhoneSetFdnSetting:
  2024         case EMobilePhoneNotifyDefaultPrivacyChange:
  2035         case EMobilePhoneNotifyDefaultPrivacyChange:
  2025         case EMobilePhoneSetDefaultPrivacy:
  2036         case EMobilePhoneSetDefaultPrivacy:
  2026         case EMobilePhoneTerminateAllCalls:
  2037         case EMobilePhoneTerminateAllCalls:
       
  2038         case EMobilePhoneTerminateActiveCalls:
  2027         case EMobilePhoneSetNetworkSelectionSetting:        
  2039         case EMobilePhoneSetNetworkSelectionSetting:        
  2028             ret = KErrNone;
  2040             ret = KErrNone;
  2029             break;
  2041             break;
  2030 
  2042 
  2031         //Cancel methods that are not supported.
  2043         //Cancel methods that are not supported.
  2476                 {
  2488                 {
  2477 #ifdef REQHANDLE_TIMER
  2489 #ifdef REQHANDLE_TIMER
  2478                 SetTypeOfResponse( EMultimodePhoneTerminateAllCalls, aTsyReqHandle );
  2490                 SetTypeOfResponse( EMultimodePhoneTerminateAllCalls, aTsyReqHandle );
  2479 #else
  2491 #else
  2480                 iTsyReqHandleStore->SetTsyReqHandle( 
  2492                 iTsyReqHandleStore->SetTsyReqHandle( 
  2481                 		iReqHandleType, aTsyReqHandle );
  2493                         EMultimodePhoneTerminateAllCalls, aTsyReqHandle );
  2482 #endif //REQHANDLE_TIMER
  2494 #endif //REQHANDLE_TIMER
  2483                 }
  2495                 }
  2484             else
  2496             else
  2485             	{
  2497             	{
  2486                 // request failed, complete with error value
  2498                 // request failed, complete with error value
  2509 	 if ( EMultimodePhoneReqHandleUnknown != reqHandle )
  2521 	 if ( EMultimodePhoneReqHandleUnknown != reqHandle )
  2510 	     {
  2522 	     {
  2511          ReqCompleted( reqHandle, aErrorCode );
  2523          ReqCompleted( reqHandle, aErrorCode );
  2512 	     }	 
  2524 	     }	 
  2513 	}
  2525 	}
       
  2526 
       
  2527 
       
  2528 // ---------------------------------------------------------------------------
       
  2529 // CMmPhoneTsy::TerminateActiveCallsL
       
  2530 // Terminates all active calls simultaneously.
       
  2531 // ---------------------------------------------------------------------------
       
  2532 //
       
  2533 TInt CMmPhoneTsy::TerminateActiveCallsL(const TTsyReqHandle aTsyReqHandle)
       
  2534     {
       
  2535 TFLOGSTRING("TSY: CMmPhoneTsy::TerminateActiveCalls");
       
  2536 
       
  2537     // Check if some other client has already requested this
       
  2538     TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(EMultimodePhoneTerminateActiveCalls);
       
  2539     
       
  2540     if (EMultimodePhoneReqHandleUnknown >= reqHandle )
       
  2541         {
       
  2542         // The request is not already in processing because of a previous request
       
  2543 
       
  2544         TInt err = iMessageManager->HandleRequestL(ECtsyPhoneTerminateActiveCallsReq);
       
  2545         if ( err == KErrNone )
       
  2546             {
       
  2547 #ifdef REQHANDLE_TIMER
       
  2548             SetTypeOfResponse( EMultimodePhoneTerminateActiveCalls, aTsyReqHandle );
       
  2549 #else
       
  2550             iTsyReqHandleStore->SetTsyReqHandle( 
       
  2551                     iReqHandleType, aTsyReqHandle );
       
  2552 #endif //REQHANDLE_TIMER
       
  2553             }
       
  2554         else
       
  2555             {
       
  2556             // request failed, complete with error value
       
  2557             ReqCompleted( aTsyReqHandle, err );
       
  2558             } 
       
  2559         }
       
  2560     else
       
  2561         {
       
  2562 TFLOGSTRING("TSY: CMmPhoneTsy::TerminatActiveCalls - Already requested");
       
  2563         ReqCompleted( aTsyReqHandle, KErrServerBusy );
       
  2564         }
       
  2565     return KErrNone;
       
  2566     }
       
  2567 // ---------------------------------------------------------------------------
       
  2568 // CMmPhoneTsy::CompleteTerminateActiveCallsReq
       
  2569 // Description: Complete TerminateActiveCallsRequest
       
  2570 // ---------------------------------------------------------------------------
       
  2571 //
       
  2572 void CMmPhoneTsy::CompleteTerminateActiveCallsReq(TInt aErrorCode)
       
  2573     {
       
  2574     // Reset req handle. Returns the deleted req handle
       
  2575      TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  2576          EMultimodePhoneTerminateActiveCalls );
       
  2577     
       
  2578      if ( EMultimodePhoneReqHandleUnknown != reqHandle )
       
  2579          {
       
  2580          ReqCompleted( reqHandle, aErrorCode );
       
  2581          }   
       
  2582     }
  2514 
  2583 
  2515 // ---------------------------------------------------------------------------
  2584 // ---------------------------------------------------------------------------
  2516 // CMmPhoneTsy::RegisterNotification
  2585 // CMmPhoneTsy::RegisterNotification
  2517 // This function is used by ETel Server to subscribe
  2586 // This function is used by ETel Server to subscribe
  2518 // notifications from DOS. Currently does not really do anything but returns
  2587 // notifications from DOS. Currently does not really do anything but returns
  6065             break;
  6134             break;
  6066       // All Calls Termination
  6135       // All Calls Termination
  6067         case EMultimodePhoneTerminateAllCalls:
  6136         case EMultimodePhoneTerminateAllCalls:
  6068             timeOut = KMmPhoneTerminateAllCallsTimeOut;
  6137             timeOut = KMmPhoneTerminateAllCallsTimeOut;
  6069             break;
  6138             break;
       
  6139       // Active Calls Termination
       
  6140         case EMultimodePhoneTerminateActiveCalls:
       
  6141             timeOut = KMmPhoneTerminateActiveCallsTimeOut;
       
  6142             break;
  6070       //NET
  6143       //NET
  6071         case EMultimodePhoneSelectNetwork:
  6144         case EMultimodePhoneSelectNetwork:
  6072             timeOut = KMmPhoneSelectNetworkTimeOut;
  6145             timeOut = KMmPhoneSelectNetworkTimeOut;
  6073             break;
  6146             break;
  6074         case EMultimodePhoneSendNetworkServiceRequest:
  6147         case EMultimodePhoneSendNetworkServiceRequest:
  6269     switch( aReqHandleType )
  6342     switch( aReqHandleType )
  6270         {
  6343         {
  6271         case EMultimodePhoneTerminateAllCalls:
  6344         case EMultimodePhoneTerminateAllCalls:
  6272         	CompleteTerminateAllCallsReq(aError);
  6345         	CompleteTerminateAllCallsReq(aError);
  6273         	break;
  6346         	break;
       
  6347         case EMultimodePhoneTerminateActiveCalls:
       
  6348             CompleteTerminateActiveCallsReq(aError);
       
  6349             break;
  6274       //DTMF
  6350       //DTMF
  6275         case EMultimodePhoneSendDTMFTones:
  6351         case EMultimodePhoneSendDTMFTones:
  6276         case EMultimodePhoneStartDTMFTone:
  6352         case EMultimodePhoneStartDTMFTone:
  6277         case EMultimodePhoneStopDTMFTone:
  6353         case EMultimodePhoneStopDTMFTone:
  6278 			// forward to DTMF Tsy
  6354 			// forward to DTMF Tsy