telephonyserverplugins/common_tsy/commontsy/src/mmtsy/cmmfaxcalltsy.cpp
changeset 44 8b72faa1200f
parent 0 3553901f7fa8
child 53 12b52b1a573e
equal deleted inserted replaced
39:2473f5e227f9 44:8b72faa1200f
     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 ) ||
  1729 //
  1726 //
  1730 TInt CMmFaxCallTsy::LoanDataPort(
  1727 TInt CMmFaxCallTsy::LoanDataPort(
  1731     const TTsyReqHandle aTsyReqHandle,
  1728     const TTsyReqHandle aTsyReqHandle,
  1732     RCall::TCommPort* aCommPort )
  1729     RCall::TCommPort* aCommPort )
  1733     {
  1730     {
  1734 TFLOGSTRING2("TSY: CMmFaxCallTsy::LoanDataPort - Client taking control: %S",
  1731 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_LOANDATAPORT_1, "TSY: CMmFaxCallTsy::LoanDataPort - Client taking control: %S",iCallName );
  1735     &iCallName );
       
  1736 
  1732 
  1737     TInt ret( KErrNone );
  1733     TInt ret( KErrNone );
  1738 
  1734 
  1739     // Check if the port is loaned!
  1735     // Check if the port is loaned!
  1740     if ( iLoanedCommPort.iPort.Compare( KNullDesC) == 0 )
  1736     if ( iLoanedCommPort.iPort.Compare( KNullDesC) == 0 )
  1836 // ---------------------------------------------------------------------------
  1832 // ---------------------------------------------------------------------------
  1837 //
  1833 //
  1838 TInt CMmFaxCallTsy::RecoverDataPort(
  1834 TInt CMmFaxCallTsy::RecoverDataPort(
  1839     const TTsyReqHandle aTsyReqHandle )
  1835     const TTsyReqHandle aTsyReqHandle )
  1840     {
  1836     {
  1841 TFLOGSTRING2("TSY: CMmFaxCallTsy::RecoverDataPort - Client returning control: %S",
  1837 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_RECOVERDATAPORT_1, "TSY: CMmFaxCallTsy::RecoverDataPort - Client returning control: %S",iCallName );
  1842     &iCallName );
       
  1843 
  1838 
  1844     TInt ret( KErrNone );
  1839     TInt ret( KErrNone );
  1845 
  1840 
  1846     // Check if the port is loaned!
  1841     // Check if the port is loaned!
  1847     if ( iLoanedCommPort.iPort.Compare( KNullDesC) != 0 )
  1842     if ( iLoanedCommPort.iPort.Compare( KNullDesC) != 0 )
  1892 // (other items were commented in a header).
  1887 // (other items were commented in a header).
  1893 // ---------------------------------------------------------------------------
  1888 // ---------------------------------------------------------------------------
  1894 //
  1889 //
  1895 TInt CMmFaxCallTsy::RecoverDataPortAndRelinquishOwnership()
  1890 TInt CMmFaxCallTsy::RecoverDataPortAndRelinquishOwnership()
  1896     {
  1891     {
  1897 TFLOGSTRING2("TSY: CMmFaxCallTsy::RecoverDataPortAndRelinquishOwnership - \
  1892 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMFAXCALLTSY_RECOVERDATAPORTANDRELINQUISHOWNERSHIP_1, "TSY: CMmFaxCallTsy::RecoverDataPortAndRelinquishOwnership - \Client returning control: %S", iCallName );
  1898     Client returning control: %S", &iCallName );
       
  1899 
  1893 
  1900     TInt ret( KErrNone );
  1894     TInt ret( KErrNone );
  1901 
  1895 
  1902     // Check if the port is loaned!
  1896     // Check if the port is loaned!
  1903     if ( iLoanedCommPort.iPort.Compare( KNullDesC) != 0 )
  1897     if ( iLoanedCommPort.iPort.Compare( KNullDesC) != 0 )