Symbian3/SDK/Source/GUID-E2D4973C-FE93-5DE7-B04E-19B7701621C3.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-E2D4973C-FE93-5DE7-B04E-19B7701621C3.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation 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". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE task
+  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
+<task xml:lang="en" id="GUID-E2D4973C-FE93-5DE7-B04E-19B7701621C3"><title>Call Swap Tutorial </title><shortdesc>This tutorial describes how to swap calls with the telephony API for applications. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> <steps id="GUID-B8135064-5C8F-5EE1-9F58-9A8A9CCED402"> <step id="GUID-87A34CB4-69CB-59EB-BE40-E4CFD64334BB"><cmd/><info>create a new instance of <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony</apiname></xref>  </info> </step> <step id="GUID-A3EB36C9-9856-5AA4-8E64-6BE8282CEAB1"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::GetCallDynamicCaps()</apiname></xref> to check if the device supports swap function </info> </step> <step id="GUID-135949F6-5864-5BD4-A8B1-253CE994AB44"><cmd/><info>call <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::Swap()</apiname></xref> when you have an active call and a call on hold </info> <info>The function makes the held call active and the puts the active call on hold. Pass the function the IDs of the two calls. The IDs are <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::TCallId</apiname></xref> objects returned when you dialled or answered the calls. </info> </step> <step id="GUID-2B849097-C643-59E7-95FA-708061ED71E3"><cmd/><info>pass the enumeration <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::ESwapCancel</apiname></xref> to cancel the asynchronous request </info> </step> </steps> <example id="GUID-24851381-E70A-53F5-AFDB-41B5D8DEB172"><title>Call swap example</title> <codeblock id="GUID-D28043B3-811B-5A73-B42B-E79A5BCCC481" xml:space="preserve">#include &lt;e32base.h&gt;
+#include &lt;Etel3rdParty.h&gt;
+
+class CClientApp : public CActive
+    { 
+
+private:
+    CTelephony* iTelephony;
+    CTelephony::TCallId iCallIdA;
+    CTelephony::TCallId iCallIdB;
+
+public:
+    CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallIdA, CTelephony::TCallId aCallIdB);
+    TInt SomeFunction();
+
+private:
+    /*
+       These are the pure virtual methods from CActive that  
+       MUST be implemented by all active objects
+       */
+    void RunL();
+    void DoCancel();
+   };
+
+CClientApp::CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId)
+    : CActive(EPriorityStandard),
+      iTelephony(aTelephony),
+      iCallIdA(aCallIdA)
+      iCallIdB(aCallIdB)
+    {
+    //default constructor
+    }
+
+TInt CClientApp::SomeFunction()
+    {
+    // Check that the phone supports Resuming calls.
+    CTelephony::TCallCapsV1 callCapsV1;
+    CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1);
+    iTelephony-&gt;GetCallDynamicCaps(iCallId, callCapsV1Pckg);
+
+    if( callCapsV1.iControlCaps &amp; CTelephony::KCapsSwap )
+       {
+       // The call represented by 'iCallId' can be swapped
+       iTelephony-&gt;Swap(iStatus, iCallIdA, iCallIdB);
+       SetActive();
+       return KErrNone;
+       }
+    else
+       {
+       // The call cannot be swapped; 
+       // return an error indicate this.
+       return KErrNotSupported;
+       }
+    }
+
+void CClientApp::RunL()
+    {
+    if(iStatus==KErrNone)
+       {} // The call has been swapped successfully;
+    }
+
+void CClientApp::DoCancel()
+    {
+    iTelephony-&gt;CancelAsync(CTelephony::ESwapCancel);
+    }
+</codeblock> </example> </taskbody></task>
\ No newline at end of file