telephonyserverplugins/common_tsy/commontsy/src/mmtsy/cmmfaxcalltsy.cpp
branchRCL_3
changeset 19 630d2f34d719
parent 18 17af172ffa5f
child 20 07a122eea281
equal deleted inserted replaced
18:17af172ffa5f 19:630d2f34d719
     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 "cmmfaxcalltsyTraces.h"
       
    23 #endif
       
    24 
    19 #include "cmmfaxcalltsy.h"
    25 #include "cmmfaxcalltsy.h"
    20 #include "cmmfaxlinetsy.h"
    26 #include "cmmfaxlinetsy.h"
    21 #include "cmmphonetsy.h"
    27 #include "cmmphonetsy.h"
    22 #include "cmmtsyreqhandlestore.h"
    28 #include "cmmtsyreqhandlestore.h"
    23 #include "cmmcalllist.h"
    29 #include "cmmcalllist.h"
    40     CMmPhoneTsy* aMmPhone, CMmFaxLineTsy* aMmLine,
    46     CMmPhoneTsy* aMmPhone, CMmFaxLineTsy* aMmLine,
    41     RMobilePhone::TMobileService aMode, 
    47     RMobilePhone::TMobileService aMode, 
    42     TDes& aName, 
    48     TDes& aName, 
    43     CMmMessageManagerBase* aMessageManager )
    49     CMmMessageManagerBase* aMessageManager )
    44     {
    50     {
    45 	TFLOGSTRING2("TSY: CMmFaxCallTsy::NewL. Call name: %S", &aName);
    51 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_NEWL_1, "TSY: CMmFaxCallTsy::NewL. Call name: %S", aName);
    46 
    52 
    47     CMmFaxCallTsy* mmCall = NULL;
    53     CMmFaxCallTsy* mmCall = NULL;
    48 
    54 
    49     //check input parameters
    55     //check input parameters
    50     if ( aMmPhone != NULL && aMmLine != NULL &&
    56     if ( aMmPhone != NULL && aMmLine != NULL &&
    64     return mmCall;
    70     return mmCall;
    65     }
    71     }
    66 
    72 
    67 CMmFaxCallTsy::~CMmFaxCallTsy()
    73 CMmFaxCallTsy::~CMmFaxCallTsy()
    68     {
    74     {
    69     TFLOGSTRING3("TSY: CMmFaxCallTsy::~CMmFaxCallTsy. Call deleted \
    75     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_DTOR_1, "TSY: CMmFaxCallTsy::~CMmFaxCallTsy. Call deleted \iCallId:%d iCallName:%S", iCallId, iCallName);
    70         iCallId:%d iCallName:%S", iCallId, &iCallName);
       
    71 
    76 
    72     // If Dial fails, Symbian CSD agent will close the call immediately.
    77     // If Dial fails, Symbian CSD agent will close the call immediately.
    73     // This means that TSY has not yet received call status indications, 
    78     // This means that TSY has not yet received call status indications, 
    74     // where call status changes to idle. Thus responses from modem are 
    79     // where call status changes to idle. Thus responses from modem are 
    75     // passed to call object. 
    80     // passed to call object. 
   199 TInt CMmFaxCallTsy::DoExtFuncL(
   204 TInt CMmFaxCallTsy::DoExtFuncL(
   200     const TTsyReqHandle aTsyReqHandle,
   205     const TTsyReqHandle aTsyReqHandle,
   201     const TInt aIpc,
   206     const TInt aIpc,
   202     const TDataPackage& aPackage )
   207     const TDataPackage& aPackage )
   203     {
   208     {
   204     TFLOGSTRING3("TSY: CMmFaxCallTsy::DoExtFuncL. IPC:%d Handle:%d", aIpc, 
   209     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_DOEXTFUNCL_1, "TSY: CMmFaxCallTsy::DoExtFuncL. IPC:%d Handle:%d", aIpc, aTsyReqHandle);
   205         aTsyReqHandle);
       
   206 
   210 
   207     TInt ret( KErrNone );
   211     TInt ret( KErrNone );
   208 
   212 
   209     TAny* dataPtr = aPackage.Ptr1();
   213     TAny* dataPtr = aPackage.Ptr1();
   210 
   214 
   304 // ---------------------------------------------------------------------------
   308 // ---------------------------------------------------------------------------
   305 //
   309 //
   306 CTelObject::TReqMode CMmFaxCallTsy::ReqModeL(
   310 CTelObject::TReqMode CMmFaxCallTsy::ReqModeL(
   307     const TInt aIpc )
   311     const TInt aIpc )
   308     {
   312     {
   309     TFLOGSTRING2("TSY: CMmFaxCallTsy::ReqModeL. IPC:%d",aIpc); 
   313     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_REQMODEL_1, "TSY: CMmFaxCallTsy::ReqModeL. IPC:%d",aIpc);
   310 
   314 
   311     CTelObject::TReqMode ret( 0 ); // default return value
   315     CTelObject::TReqMode ret( 0 ); // default return value
   312     
   316     
   313     switch ( aIpc )
   317     switch ( aIpc )
   314         {
   318         {
   547 //
   551 //
   548 TInt CMmFaxCallTsy::CancelService(
   552 TInt CMmFaxCallTsy::CancelService(
   549     const TInt aIpc,
   553     const TInt aIpc,
   550     const TTsyReqHandle aTsyReqHandle )
   554     const TTsyReqHandle aTsyReqHandle )
   551     {
   555     {
   552     TFLOGSTRING3("TSY: CMmFaxCallTsy::CancelService. IPC: %d, Req handle: %d",
   556     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_CANCELSERVICE_1, "TSY: CMmFaxCallTsy::CancelService. IPC: %d, Req handle: %d",aIpc, aTsyReqHandle);
   553         aIpc, aTsyReqHandle); 
       
   554 
   557 
   555     TInt ret( KErrNone );
   558     TInt ret( KErrNone );
   556 
   559 
   557     //When the clients close their sub-sessions (eg. by calling RPhone::Close)
   560     //When the clients close their sub-sessions (eg. by calling RPhone::Close)
   558     //they may not have cancelled all their outstanding asynchronous requests
   561     //they may not have cancelled all their outstanding asynchronous requests
   652         CCallDataPackage* callDataPackage = 
   655         CCallDataPackage* callDataPackage = 
   653             reinterpret_cast<CCallDataPackage*>(aDataPackage);
   656             reinterpret_cast<CCallDataPackage*>(aDataPackage);
   654 
   657 
   655         callDataPackage->UnPackData( callStatus );
   658         callDataPackage->UnPackData( callStatus );
   656 
   659 
   657         TFLOGSTRING2("TSY: CMmFaxCallTsy::CompleteNotifyStatusChange. aResult:%d",
   660         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_COMPLETENOTIFYSTATUSCHANGE_1, "TSY: CMmFaxCallTsy::CompleteNotifyStatusChange. aResult:%d",aResult );
   658             aResult ); 
   661         OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_COMPLETENOTIFYSTATUSCHANGE_2, "TSY: CMmFaxCallTsy::CompleteNotifyStatusChange. \Call status:%d Call name:%S", callStatus, iCallName);
   659         TFLOGSTRING3("TSY: CMmFaxCallTsy::CompleteNotifyStatusChange. \
       
   660             Call status:%d Call name:%S", callStatus, &iCallName); 
       
   661 
   662 
   662         switch( callStatus )
   663         switch( callStatus )
   663             {
   664             {
   664             case RMobileCall::EStatusIdle:
   665             case RMobileCall::EStatusIdle:
   665                 //reset caps. 
   666                 //reset caps. 
   971 TInt CMmFaxCallTsy::Dial(
   972 TInt CMmFaxCallTsy::Dial(
   972     const TTsyReqHandle aTsyReqHandle,
   973     const TTsyReqHandle aTsyReqHandle,
   973     const TDesC8* aCallParams,
   974     const TDesC8* aCallParams,
   974     TDesC* aTelNumber )
   975     TDesC* aTelNumber )
   975     {
   976     {
   976     TFLOGSTRING3("TSY: CMmFaxCallTsy::Dial. Req handle: %d, Call name: %S", 
   977     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_DIAL_1, "TSY: CMmFaxCallTsy::Dial. Req handle: %u, Call name: %S", aTsyReqHandle, iCallName);
   977         aTsyReqHandle, &iCallName);
       
   978 
   978 
   979 	CMmCallList* callList = iMmPhone->CallList();
   979 	CMmCallList* callList = iMmPhone->CallList();
   980 	TBool dialFlag( EFalse );
   980 	TBool dialFlag( EFalse );
   981 	
   981 	
   982 	for(TInt i=0; i< callList->GetNumberOfObjects();i++)
   982 	for(TInt i=0; i< callList->GetNumberOfObjects();i++)
  1001     //reset finished data call flag
  1001     //reset finished data call flag
  1002     iIsFinishedDataCall = EFalse;
  1002     iIsFinishedDataCall = EFalse;
  1003 
  1003 
  1004     if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() )
  1004     if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() )
  1005         {
  1005         {
  1006         TFLOGSTRING("TSY: Offline mode ON, Dial request is not allowed" );
  1006         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_DIAL_2, "TSY: Offline mode ON, Dial request is not allowed" );
  1007         TInt ret = CMmCommonStaticUtility::EpocErrorCode(
  1007         TInt ret = CMmCommonStaticUtility::EpocErrorCode(
  1008             KErrGeneral, KErrGsmOfflineOpNotAllowed );
  1008             KErrGeneral, KErrGsmOfflineOpNotAllowed );
  1009 
  1009 
  1010         //Complete the request with appropiate error
  1010         //Complete the request with appropiate error
  1011         ReqCompleted ( aTsyReqHandle, ret ); 
  1011         ReqCompleted ( aTsyReqHandle, ret ); 
  1016         {
  1016         {
  1017         //The request cannot be forwarded since this call object
  1017         //The request cannot be forwarded since this call object
  1018         //is still in use.
  1018         //is still in use.
  1019         //Complete request with status value informing the client
  1019         //Complete request with status value informing the client
  1020         //about the situation.
  1020         //about the situation.
  1021         TFLOGSTRING("TSY: CMmFaxCallTsy::Dial - KErrNotReady");
  1021         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_DIAL_3, "TSY: CMmFaxCallTsy::Dial - KErrNotReady");
  1022         ReqCompleted( aTsyReqHandle, KErrNotReady );
  1022         ReqCompleted( aTsyReqHandle, KErrNotReady );
  1023         }
  1023         }
  1024     else if ( 0 < dialHandle )
  1024     else if ( 0 < dialHandle )
  1025         {
  1025         {
  1026         //The request is already in processing because of previous request
  1026         //The request is already in processing because of previous request
  1027         //Complete request with status value informing the client about 
  1027         //Complete request with status value informing the client about 
  1028         //the situation.
  1028         //the situation.
  1029         TFLOGSTRING("TSY: CMmFaxCallTsy::Dial - KErrServerBusy");
  1029         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_DIAL_4, "TSY: CMmFaxCallTsy::Dial - KErrServerBusy");
  1030         ReqCompleted( aTsyReqHandle, KErrServerBusy );
  1030         ReqCompleted( aTsyReqHandle, KErrServerBusy );
  1031         }
  1031         }
  1032     else
  1032     else
  1033         {
  1033         {
  1034         TInt ret( KErrNone );
  1034         TInt ret( KErrNone );
  1115 // ---------------------------------------------------------------------------
  1115 // ---------------------------------------------------------------------------
  1116 //
  1116 //
  1117 TInt CMmFaxCallTsy::DialCancel(
  1117 TInt CMmFaxCallTsy::DialCancel(
  1118     const TTsyReqHandle aTsyReqHandle )
  1118     const TTsyReqHandle aTsyReqHandle )
  1119     {
  1119     {
  1120     TFLOGSTRING3("TSY: CMmFaxCallTsy::DialCancel. Req handle: %d, Call name: %S", 
  1120     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_DIALCANCEL_1, "TSY: CMmFaxCallTsy::DialCancel. Req handle: %u, Call name: %S", aTsyReqHandle, iCallName);
  1121         aTsyReqHandle, &iCallName);
       
  1122 
  1121 
  1123     TInt ret( KErrGeneral );
  1122     TInt ret( KErrGeneral );
  1124 
  1123 
  1125     if (iMmFaxExt)
  1124     if (iMmFaxExt)
  1126         {
  1125         {
  1142 //
  1141 //
  1143 TInt CMmFaxCallTsy::AnswerIncomingCall(
  1142 TInt CMmFaxCallTsy::AnswerIncomingCall(
  1144     const TTsyReqHandle aTsyReqHandle,
  1143     const TTsyReqHandle aTsyReqHandle,
  1145     const TDesC8* /*aCallParams*/ )
  1144     const TDesC8* /*aCallParams*/ )
  1146     {
  1145     {
  1147     TFLOGSTRING2("TSY: CMmFaxCallTsy::AnswerIncomingCall. \n\t\t\t Handle:%d",
  1146     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_ANSWERINCOMINGCALL_1, "TSY: CMmFaxCallTsy::AnswerIncomingCall. \n\t\t\t Handle:%d",aTsyReqHandle);
  1148         aTsyReqHandle); 
       
  1149 
  1147 
  1150     TTsyReqHandle iAnswerCallHandle = iTsyReqHandleStore->
  1148     TTsyReqHandle iAnswerCallHandle = iTsyReqHandleStore->
  1151         GetTsyReqHandle( EMultimodeCallAnswer );
  1149         GetTsyReqHandle( EMultimodeCallAnswer );
  1152 
  1150 
  1153     if ( 0 < iAnswerCallHandle )
  1151     if ( 0 < iAnswerCallHandle )
  1225 // ---------------------------------------------------------------------------
  1223 // ---------------------------------------------------------------------------
  1226 //
  1224 //
  1227 TInt CMmFaxCallTsy::HangUp(
  1225 TInt CMmFaxCallTsy::HangUp(
  1228     const TTsyReqHandle aTsyReqHandle )
  1226     const TTsyReqHandle aTsyReqHandle )
  1229     {
  1227     {
  1230     TFLOGSTRING3("TSY: CMmFaxCallTsy::HangUp. Req handle: %d, Call name: %S", 
  1228     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_HANGUP_1, "TSY: CMmFaxCallTsy::HangUp. Req handle: %u, Call name: %S", aTsyReqHandle, iCallName);
  1231         aTsyReqHandle, &iCallName);
       
  1232 
  1229 
  1233     TInt hangUpCause( KErrNone );
  1230     TInt hangUpCause( KErrNone );
  1234     TInt ret( KErrNone );
  1231     TInt ret( KErrNone );
  1235     TInt trapError ( KErrNone );
  1232     TInt trapError ( KErrNone );
  1236 
  1233 
  1282         //If the call is ringing e.g. MT call, we do not have ownership
  1279         //If the call is ringing e.g. MT call, we do not have ownership
  1283         //yet. So let the client reject the call without checking 
  1280         //yet. So let the client reject the call without checking 
  1284         //ownership.
  1281         //ownership.
  1285         if ( RCall::EStatusRinging == iCallStatus )
  1282         if ( RCall::EStatusRinging == iCallStatus )
  1286             {
  1283             {
  1287             TFLOGSTRING("TSY: CMmFaxCallTsy::HangUp - Reject incoming call");
  1284             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_HANGUP_2, "TSY: CMmFaxCallTsy::HangUp - Reject incoming call");
  1288             }
  1285             }
  1289         //Phone Application is the first client that is started, it 
  1286         //Phone Application is the first client that is started, it 
  1290         //will always be the priority client and thus able to hangup calls
  1287         //will always be the priority client and thus able to hangup calls
  1291         //Owner of the call is also able to hangup the call.
  1288         //Owner of the call is also able to hangup the call.
  1292         else if ( CCallBase::CheckPriorityClient( aTsyReqHandle ) ||
  1289         else if ( CCallBase::CheckPriorityClient( aTsyReqHandle ) ||
  1730 //
  1727 //
  1731 TInt CMmFaxCallTsy::LoanDataPort(
  1728 TInt CMmFaxCallTsy::LoanDataPort(
  1732     const TTsyReqHandle aTsyReqHandle,
  1729     const TTsyReqHandle aTsyReqHandle,
  1733     RCall::TCommPort* aCommPort )
  1730     RCall::TCommPort* aCommPort )
  1734     {
  1731     {
  1735 TFLOGSTRING2("TSY: CMmFaxCallTsy::LoanDataPort - Client taking control: %S",
  1732 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_LOANDATAPORT_1, "TSY: CMmFaxCallTsy::LoanDataPort - Client taking control: %S",iCallName );
  1736     &iCallName );
       
  1737 
  1733 
  1738     TInt ret( KErrNone );
  1734     TInt ret( KErrNone );
  1739 
  1735 
  1740     // Check if the port is loaned!
  1736     // Check if the port is loaned!
  1741     if ( iLoanedCommPort.iPort.Compare( KNullDesC) == 0 )
  1737     if ( iLoanedCommPort.iPort.Compare( KNullDesC) == 0 )
  1837 // ---------------------------------------------------------------------------
  1833 // ---------------------------------------------------------------------------
  1838 //
  1834 //
  1839 TInt CMmFaxCallTsy::RecoverDataPort(
  1835 TInt CMmFaxCallTsy::RecoverDataPort(
  1840     const TTsyReqHandle aTsyReqHandle )
  1836     const TTsyReqHandle aTsyReqHandle )
  1841     {
  1837     {
  1842 TFLOGSTRING2("TSY: CMmFaxCallTsy::RecoverDataPort - Client returning control: %S",
  1838 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_RECOVERDATAPORT_1, "TSY: CMmFaxCallTsy::RecoverDataPort - Client returning control: %S",iCallName );
  1843     &iCallName );
       
  1844 
  1839 
  1845     TInt ret( KErrNone );
  1840     TInt ret( KErrNone );
  1846 
  1841 
  1847     // Check if the port is loaned!
  1842     // Check if the port is loaned!
  1848     if ( iLoanedCommPort.iPort.Compare( KNullDesC) != 0 )
  1843     if ( iLoanedCommPort.iPort.Compare( KNullDesC) != 0 )
  1893 // (other items were commented in a header).
  1888 // (other items were commented in a header).
  1894 // ---------------------------------------------------------------------------
  1889 // ---------------------------------------------------------------------------
  1895 //
  1890 //
  1896 TInt CMmFaxCallTsy::RecoverDataPortAndRelinquishOwnership()
  1891 TInt CMmFaxCallTsy::RecoverDataPortAndRelinquishOwnership()
  1897     {
  1892     {
  1898 TFLOGSTRING2("TSY: CMmFaxCallTsy::RecoverDataPortAndRelinquishOwnership - \
  1893 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_RECOVERDATAPORTANDRELINQUISHOWNERSHIP_1, "TSY: CMmFaxCallTsy::RecoverDataPortAndRelinquishOwnership - \Client returning control: %S", iCallName );
  1899     Client returning control: %S", &iCallName );
       
  1900 
  1894 
  1901     TInt ret( KErrNone );
  1895     TInt ret( KErrNone );
  1902 
  1896 
  1903     // Check if the port is loaned!
  1897     // Check if the port is loaned!
  1904     if ( iLoanedCommPort.iPort.Compare( KNullDesC) != 0 )
  1898     if ( iLoanedCommPort.iPort.Compare( KNullDesC) != 0 )