telephonyserverplugins/common_tsy/commontsy/src/mmtsy/cmmdtmftsy.cpp
changeset 42 3adadc800673
parent 0 3553901f7fa8
child 73 70d75957b98f
equal deleted inserted replaced
31:8ab6687fb94c 42:3adadc800673
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    14 //
    14 //
    15 
    15 
    16 
    16 
    17 
    17 
    18 //INCLUDE FILES
    18 //INCLUDE FILES
       
    19 
       
    20 #include "OstTraceDefinitions.h"
       
    21 #ifdef OST_TRACE_COMPILER_IN_USE
       
    22 #include "cmmdtmftsyTraces.h"
       
    23 #endif
       
    24 
    19 #include "cmmdtmftsy.h"
    25 #include "cmmdtmftsy.h"
    20 #include <etelmmcs.h> 
    26 #include <etelmmcs.h> 
    21 #include <ctsy/tflogger.h> 
       
    22 
    27 
    23 // include internal Tsy classes
    28 // include internal Tsy classes
    24 #include "cmmphonetsy.h"
    29 #include "cmmphonetsy.h"
    25 #include "cmmtsyreqhandlestore.h"
    30 #include "cmmtsyreqhandlestore.h"
    26 #include "cmmcalltsy.h"
    31 #include "cmmcalltsy.h"
    57     return self;
    62     return self;
    58     }
    63     }
    59     
    64     
    60 CMmDtmfTsy::~CMmDtmfTsy()
    65 CMmDtmfTsy::~CMmDtmfTsy()
    61     {
    66     {
    62     TFLOGSTRING("TSY: CMmDtmfTsy::~CMmDtmfTsy");
    67     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_DTOR_1, "TSY: CMmDtmfTsy::~CMmDtmfTsy");
    63     if (iMmPhone )
    68     if (iMmPhone )
    64         {
    69         {
    65         // deregister tsy object from message manager
    70         // deregister tsy object from message manager
    66         iMmPhone->MessageManager()->DeregisterTsyObject(this);        
    71         iMmPhone->MessageManager()->DeregisterTsyObject(this);        
    67         }
    72         }
   143 // CMmDtmfTsy::NotifyDtmfEvent
   148 // CMmDtmfTsy::NotifyDtmfEvent
   144 // Request for Notification of DTMF event received from client. 
   149 // Request for Notification of DTMF event received from client. 
   145 // ---------------------------------------------------------------------------
   150 // ---------------------------------------------------------------------------
   146 TInt CMmDtmfTsy::NotifyDTMFEvent( TInt* aInfo )
   151 TInt CMmDtmfTsy::NotifyDTMFEvent( TInt* aInfo )
   147 	{
   152 	{
   148 TFLOGSTRING("TSY: CMmDtmfTsy::NotifyDTMFEvent");
   153 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_NOTIFYDTMFEVENT_1, "TSY: CMmDtmfTsy::NotifyDTMFEvent");
   149 
   154 
   150 	iDtmfInfo = aInfo; // save pointer to client data
   155 	iDtmfInfo = aInfo; // save pointer to client data
   151 
   156 
   152 	// save handle type
   157 	// save handle type
   153 	iMmPhone->iReqHandleType = CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent;
   158 	iMmPhone->iReqHandleType = CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent;
   160 // Notifies client that a DTMF event has occurred. 
   165 // Notifies client that a DTMF event has occurred. 
   161 // ---------------------------------------------------------------------------
   166 // ---------------------------------------------------------------------------
   162 //
   167 //
   163 void CMmDtmfTsy::CompleteNotifyDTMFEvent( TInt aInfo )
   168 void CMmDtmfTsy::CompleteNotifyDTMFEvent( TInt aInfo )
   164      {
   169      {
   165 TFLOGSTRING("TSY: CMmCustomTsy::CompleteNotifyDtmfEvent");
   170 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_COMPLETENOTIFYDTMFEVENT_1, "TSY: CMmCustomTsy::CompleteNotifyDtmfEvent");
   166     // reset request handle. Returns the deleted req handle.
   171     // reset request handle. Returns the deleted req handle.
   167 	TTsyReqHandle reqHandle =	
   172 	TTsyReqHandle reqHandle =	
   168 		iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle( 
   173 		iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle( 
   169     					CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent );
   174     					CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent );
   170 
   175 
   181 // CMmDtmfTsy::NotifyDTMFEventCancel
   186 // CMmDtmfTsy::NotifyDTMFEventCancel
   182 // Cancels a notification request. 
   187 // Cancels a notification request. 
   183 // ---------------------------------------------------------------------------
   188 // ---------------------------------------------------------------------------
   184 TInt CMmDtmfTsy::NotifyDTMFEventCancel( const TTsyReqHandle aTsyReqHandle )
   189 TInt CMmDtmfTsy::NotifyDTMFEventCancel( const TTsyReqHandle aTsyReqHandle )
   185     {
   190     {
   186 TFLOGSTRING("TSY: CMmDtmfTsy::NotifyDtmfEventCancel");
   191 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_NOTIFYDTMFEVENTCANCEL_1, "TSY: CMmDtmfTsy::NotifyDtmfEventCancel");
   187 
   192 
   188 	iDtmfInfo = NULL;
   193 	iDtmfInfo = NULL;
   189 	TTsyReqHandle reqHandle =	
   194 	TTsyReqHandle reqHandle =	
   190 	iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle( 
   195 	iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle( 
   191 					CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent );
   196 					CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent );
   450 // (other items were commented in a header).
   455 // (other items were commented in a header).
   451 // ---------------------------------------------------------------------------
   456 // ---------------------------------------------------------------------------
   452 //
   457 //
   453 TInt CMmDtmfTsy::SendDTMFTonesCancelL()
   458 TInt CMmDtmfTsy::SendDTMFTonesCancelL()
   454     {
   459     {
   455 TFLOGSTRING("TSY: CMmDtmfTsy::SendDTMFTonesCancel");
   460 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_SENDDTMFTONESCANCELL_1, "TSY: CMmDtmfTsy::SendDTMFTonesCancel");
   456 
   461 
   457     TTsyReqHandle sendDTMFTonesHandle =
   462     TTsyReqHandle sendDTMFTonesHandle =
   458         iMmPhone->iTsyReqHandleStore->GetTsyReqHandle( 
   463         iMmPhone->iTsyReqHandleStore->GetTsyReqHandle( 
   459             CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
   464             CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
   460     
   465     
   484 // ---------------------------------------------------------------------------
   489 // ---------------------------------------------------------------------------
   485 //
   490 //
   486 void CMmDtmfTsy::CompleteSendDTMFTonesCancel( 
   491 void CMmDtmfTsy::CompleteSendDTMFTonesCancel( 
   487     TInt aResult ) 
   492     TInt aResult ) 
   488     {
   493     {
   489 TFLOGSTRING("TSY: CMmDtmfTsy::CompleteSendDTMFTonesCancel");
   494 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_COMPLETESENDDTMFTONESCANCEL_1, "TSY: CMmDtmfTsy::CompleteSendDTMFTonesCancel");
   490 
   495 
   491     // Get req handle. 
   496     // Get req handle. 
   492     TTsyReqHandle reqHandle = iMmPhone->iTsyReqHandleStore->GetTsyReqHandle( 
   497     TTsyReqHandle reqHandle = iMmPhone->iTsyReqHandleStore->GetTsyReqHandle( 
   493         CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
   498         CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
   494 
   499 
   606 // (other items were commented in a header).
   611 // (other items were commented in a header).
   607 // ---------------------------------------------------------------------------
   612 // ---------------------------------------------------------------------------
   608 //
   613 //
   609 TInt CMmDtmfTsy::NotifyStopInDTMFString()
   614 TInt CMmDtmfTsy::NotifyStopInDTMFString()
   610     {
   615     {
   611 TFLOGSTRING("TSY: CMmDtmfTsy::NotifyStopInDTMFString");
   616 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_NOTIFYSTOPINDTMFSTRING_1, "TSY: CMmDtmfTsy::NotifyStopInDTMFString");
   612     //Set TSY request handle type
   617     //Set TSY request handle type
   613     iMmPhone->iReqHandleType = 
   618     iMmPhone->iReqHandleType = 
   614         CMmPhoneTsy::EMultimodePhoneNotifyStopInDTMFString;
   619         CMmPhoneTsy::EMultimodePhoneNotifyStopInDTMFString;
   615 
   620 
   616     return KErrNone;
   621     return KErrNone;
   641 // ---------------------------------------------------------------------------
   646 // ---------------------------------------------------------------------------
   642 //
   647 //
   643 void CMmDtmfTsy::CompleteNotifyStopInDTMFString( 
   648 void CMmDtmfTsy::CompleteNotifyStopInDTMFString( 
   644 	CMmDataPackage* aDataPackage )
   649 	CMmDataPackage* aDataPackage )
   645     {
   650     {
   646 TFLOGSTRING("TSY: CMmDtmfTsy::CompleteNotifyStopInDTMFString");
   651 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_COMPLETENOTIFYSTOPINDTMFSTRING_1, "TSY: CMmDtmfTsy::CompleteNotifyStopInDTMFString");
   647     // Reset req handle. Returns the deleted req handle
   652     // Reset req handle. Returns the deleted req handle
   648     TTsyReqHandle reqHandle = iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
   653     TTsyReqHandle reqHandle = iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
   649         CMmPhoneTsy::EMultimodePhoneNotifyStopInDTMFString );
   654         CMmPhoneTsy::EMultimodePhoneNotifyStopInDTMFString );
   650 
   655 
   651     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
   656     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
   668 TInt CMmDtmfTsy::ContinueDTMFStringSendingL(
   673 TInt CMmDtmfTsy::ContinueDTMFStringSendingL(
   669      const TTsyReqHandle aTsyReqHandle, 
   674      const TTsyReqHandle aTsyReqHandle, 
   670      TBool aContinue )                  
   675      TBool aContinue )                  
   671                                            
   676                                            
   672     {
   677     {
   673 TFLOGSTRING2("TSY: CMmDtmfTsy::ContinueDTMFStringSendingL aContinue:%d",aContinue);
   678 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMDTMFTSY_CONTINUEDTMFSTRINGSENDINGL_1, "TSY: CMmDtmfTsy::ContinueDTMFStringSendingL aContinue:%d",aContinue);
   674     TInt ret( KErrNone );
   679     TInt ret( KErrNone );
   675 
   680 
   676     TTsyReqHandle sendDTMFTonesHandle = 
   681     TTsyReqHandle sendDTMFTonesHandle = 
   677         iMmPhone->iTsyReqHandleStore->GetTsyReqHandle( 
   682         iMmPhone->iTsyReqHandleStore->GetTsyReqHandle( 
   678             CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
   683             CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
   762         CMmCallTsy* mmCall = list->GetMmCallByIndex( i );
   767         CMmCallTsy* mmCall = list->GetMmCallByIndex( i );
   763         if ( mmCall )
   768         if ( mmCall )
   764             {
   769             {
   765             // get call status
   770             // get call status
   766             RCall::TStatus  callStatus = mmCall->Status();
   771             RCall::TStatus  callStatus = mmCall->Status();
   767             if ( RCall::EStatusConnected == callStatus)
   772             // Check if the call state is one that suggests that someone will listen to a DTMF. 
       
   773             if (( RCall::EStatusConnected == callStatus ) || ( RCall::EStatusDialling == callStatus )|| ( RCall::EStatusConnecting == callStatus ))
   768                 {
   774                 {
   769                 // get service type of call
   775                 // get service type of call
   770                 RMobileCall::TMobileCallInfoV1 info;
   776                 RMobileCall::TMobileCallInfoV1 info;
   771                 RMobileCall::TMobileCallInfoV1Pckg infoPckg(info);
   777                 RMobileCall::TMobileCallInfoV1Pckg infoPckg(info);
   772                 mmCall->FillMobileCallInfo(&infoPckg);
   778                 mmCall->FillMobileCallInfo(&infoPckg);