bluetoothengine/headsetsimulator/profiles/hspprofile/src/features/hspcalltermination.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/headsetsimulator/profiles/hspprofile/src/features/hspcalltermination.cpp Wed Sep 15 15:59:44 2010 +0200
@@ -0,0 +1,112 @@
+/*
+ *
+ * Copyright (c) <2010> Comarch S.A. and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Original Contributors:
+ * Comarch S.A. - original contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#include "hspcalltermination.h"
+#include "hspcommand.h"
+#include "hspsettings.h"
+#include "debug.h"
+
+CHsHSPCallTerminationProc* CHsHSPCallTerminationProc::NewL(
+ MHsHSPFeatureProviderObserver* aObserver )
+ {
+ CHsHSPCallTerminationProc *self = CHsHSPCallTerminationProc::NewLC(
+ aObserver );
+ CleanupStack::Pop( self );
+
+ return self;
+ }
+
+CHsHSPCallTerminationProc* CHsHSPCallTerminationProc::NewLC(
+ MHsHSPFeatureProviderObserver* aObserver )
+ {
+ CHsHSPCallTerminationProc *self = new ( ELeave ) CHsHSPCallTerminationProc(
+ aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+CHsHSPCallTerminationProc::~CHsHSPCallTerminationProc()
+ {
+ }
+
+TInt CHsHSPCallTerminationProc::ProcessCommand( const CHsHSPCommand* aInputCmd,
+ CHsHSPCommand &aOutputCmd )
+ {
+ TRACE_FUNC_ENTRY
+
+ TInt res = KErrNone;
+ if ( aInputCmd->FromAG() )
+ {
+ if ( iWaitingForOK && aInputCmd->Type() == EHSPCmdOK )
+ {
+ iWaitingForOK = EFalse;
+ iObserver->HandleProcedureCompleted( KErrNone, EHSPCallTerminate );
+ }
+ else
+ {
+ res = KErrArgument;
+ }
+ }
+ else
+ {
+ if ( IsCKPD200( aInputCmd ) )
+ {
+ iWaitingForOK = ETrue;
+ TRAP(res,CHsHSPCommand::CopyL( aInputCmd, aOutputCmd ));
+ }
+ else
+ {
+ res = KErrArgument;
+ }
+ }
+
+ TRACE_FUNC_EXIT
+ return res;
+ }
+
+CHsHSPCallTerminationProc::CHsHSPCallTerminationProc(
+ MHsHSPFeatureProviderObserver* aObserver ) :
+ iObserver( aObserver )
+ {
+
+ }
+
+void CHsHSPCallTerminationProc::ConstructL()
+ {
+ }
+
+TBool CHsHSPCallTerminationProc::IsCKPD200( const CHsHSPCommand* aCommand )
+ {
+ TBool res = EFalse;
+
+ if ( ( EHSPCmdCKPD == aCommand->Type() )
+ && ( aCommand->Params().Count() == 1 )
+ && ( ( aCommand->Params()[0].Des().Compare( _L8("200") ) ) == 0 ) )
+ {
+ res = ETrue;
+ }
+
+ return res;
+ }
+
+void CHsHSPCallTerminationProc::InformObserver( TInt aErr )
+ {
+ __ASSERT_ALWAYS(iObserver, User::Panic(_L("Observer missing"),KErrGeneral));
+ iObserver->HandleProcedureCompleted( aErr, iHSPProc );
+ }