telephonyutils/etel3rdpartyapi/ExampleApps/OutgoingCalls/CDialCall.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telephonyutils/etel3rdpartyapi/ExampleApps/OutgoingCalls/CDialCall.cpp	Tue Feb 02 01:41:59 2010 +0200
@@ -0,0 +1,111 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+#include "CDialCall.h"
+
+/**
+Factory constructor.
+
+@param  aController Pointer to MExecAsync object passed to constructor of 
+                    CISVAPIBase
+@return             Instance of CDialCall class
+*/
+CDialCall* CDialCall::NewL(MExecAsync* aController)
+	{
+	CDialCall* self = new(ELeave) CDialCall(aController);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+/**
+Destructor.
+Cancels outstanding requests.
+*/
+CDialCall::~CDialCall()
+	{
+	Cancel();
+	}
+
+/**
+Makes a call to aNumber.
+
+@param aNumber The number to dial
+*/
+void CDialCall::DoStartRequestL(const TDesC& aNumber)
+	{
+	CTelephony::TCallParamsV1 callParams;
+	callParams.iIdRestrict = CTelephony::ESendMyId;
+	CTelephony::TCallParamsV1Pckg callParamsPckg(callParams);
+	iConsole->Printf(_L("Dialling "));
+	
+	// Print the number to dial
+	iConsole->Printf(aNumber);
+	iConsole->Printf(KNewLine);
+	
+	// Initiates a new call.
+	iTelephony->DialNewCall(iStatus, callParamsPckg, aNumber, iCallId);
+	SetActive();
+	}
+
+/**
+Constructor.
+
+@param aController Pointer to an MExecAsync object passed to constructor of 
+                   CISVAPIBase
+*/
+CDialCall::CDialCall(MExecAsync* aController)
+	: CISVAPIAsync(aController, KDialCall)
+	{
+	// Empty method
+	}
+
+/**
+Second phase constructor.
+*/
+void CDialCall::ConstructL()
+	{
+	// Empty method
+	}
+
+/**
+Checks the status of the active object and calls ExampleComplete() to notify
+the menu object that the example has finished.
+*/
+void CDialCall::RunL()
+	{
+	if(iStatus != KErrNone)
+		{
+		iConsole->Printf(KError);
+		
+		// Print the error status code
+		iConsole->Printf(_L("%d\n"), iStatus.Int());
+		}
+	else
+		{
+		ExampleComplete();
+		}
+	}
+
+/**
+Cancels asynchronous request to CTelephony::DialNewCall()
+*/
+void CDialCall::DoCancel()
+	{
+	// Cancels an outstanding asynchronous request
+	iTelephony->CancelAsync(CTelephony::EDialNewCallCancel);
+	}