telephonyserverplugins/multimodetsy/hayes/ATNOCARR.CPP
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 #include "ATNOCARR.H"
       
    17 #include "mSLOGGER.H"
       
    18 #include "CALL.H"
       
    19 #include "ATIO.H"
       
    20 
       
    21 CATWaitForNoCarrier* CATWaitForNoCarrier::NewL(CATIO* aIo,CTelObject* aTelObject,CPhoneGlobals* aPhoneGlobals)
       
    22 	{
       
    23 	return new(ELeave) CATWaitForNoCarrier(aIo,aTelObject,aPhoneGlobals);
       
    24 	}
       
    25 
       
    26 CATWaitForNoCarrier::CATWaitForNoCarrier(CATIO* aIo,CTelObject* aTelObject,CPhoneGlobals* aPhoneGlobals) 
       
    27 								: CATBase(aIo,aTelObject,aPhoneGlobals),iNoCarrierExpectString(NULL),iCallMonitoringEventString(NULL)
       
    28 	{}
       
    29 
       
    30 CATWaitForNoCarrier::~CATWaitForNoCarrier()
       
    31 	{
       
    32 	iIo->RemoveExpectStrings(this);
       
    33 	iIo->WriteAndTimerCancel(this);	
       
    34 	}
       
    35 
       
    36 void CATWaitForNoCarrier::StartWait()
       
    37 	{
       
    38 	LOGTEXT(_L8("WaitForNoCarrier:\tStarting wait for no carrier"));
       
    39 	if (!iNoCarrierExpectString)
       
    40 		iNoCarrierExpectString=iIo->AddExpectString(this,KNoCarrierString);
       
    41 
       
    42 //  Commented out as the same function is executed by Fax/Data calls also (except Voice)
       
    43 //	This was causing serious problems in timeout situations
       
    44 
       
    45 //	if (!iCallMonitoringEventString)
       
    46 //		iCallMonitoringEventString=iIo->AddExpectString(this,KCallMonitoringEventString);
       
    47 	}
       
    48 
       
    49 void CATWaitForNoCarrier::StopWait()
       
    50 	{
       
    51 	iIo->RemoveExpectStrings(this);
       
    52 	iNoCarrierExpectString = NULL;
       
    53 	}
       
    54 
       
    55 void CATWaitForNoCarrier::CompleteWithIOError(TEventSource /*aSource*/,TInt /*aStatus*/)
       
    56 	{
       
    57 	iIo->WriteAndTimerCancel(this);
       
    58 	iNoCarrierExpectString = NULL;
       
    59 	}
       
    60 
       
    61 void CATWaitForNoCarrier::EventSignal(TEventSource aSource)
       
    62 	{
       
    63 	__ASSERT_ALWAYS(aSource==EReadCompletion,Panic(EATCommand_IllegalCompletionReadNotExpected));
       
    64 	__ASSERT_ALWAYS (((iIo->FoundChatString()==iNoCarrierExpectString) || \
       
    65 					  (iIo->FoundChatString()==iCallMonitoringEventString)), \
       
    66 					 Panic (EATCommand_IllegalResponse) );
       
    67 
       
    68 	if (iIo->FoundChatString()==iCallMonitoringEventString) 
       
    69 		LOGTEXT(_L8("WaitForNoCarrier:\t*ECAV Call Monitoring Event (similar to NO CARRIER) detected"));
       
    70 	else
       
    71 		LOGTEXT(_L8("WaitForNoCarrier:\tNO CARRIER detected"));
       
    72 
       
    73 	// Reconfigure the Serial port to remove the DCD Obey flag (Defect fix no: MIR-4QHMBV)
       
    74 	TCommConfig aConfigPckg;
       
    75 	TInt ret=iPhoneGlobals->iConfiguration->PortConfig(aConfigPckg,EConfigTypeInit);
       
    76 	if (ret==KErrNone)
       
    77 		__ASSERT_ALWAYS(iIo->ConfigurePort(aConfigPckg) == KErrNone,Panic(EGeneral));
       
    78 	
       
    79 	REINTERPRET_CAST(CCallHayes*,iTelObject)->SetToIdle();
       
    80 	}