|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <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 <e32base.h> |
|
13 #include <Etel3rdParty.h> |
|
14 |
|
15 class CClientApp : public CActive |
|
16 { |
|
17 |
|
18 private: |
|
19 CTelephony* iTelephony; |
|
20 CTelephony::TCallId iCallIdA; |
|
21 CTelephony::TCallId iCallIdB; |
|
22 |
|
23 public: |
|
24 CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallIdA, CTelephony::TCallId aCallIdB); |
|
25 TInt SomeFunction(); |
|
26 |
|
27 private: |
|
28 /* |
|
29 These are the pure virtual methods from CActive that |
|
30 MUST be implemented by all active objects |
|
31 */ |
|
32 void RunL(); |
|
33 void DoCancel(); |
|
34 }; |
|
35 |
|
36 CClientApp::CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId) |
|
37 : CActive(EPriorityStandard), |
|
38 iTelephony(aTelephony), |
|
39 iCallIdA(aCallIdA) |
|
40 iCallIdB(aCallIdB) |
|
41 { |
|
42 //default constructor |
|
43 } |
|
44 |
|
45 TInt CClientApp::SomeFunction() |
|
46 { |
|
47 // Check that the phone supports Resuming calls. |
|
48 CTelephony::TCallCapsV1 callCapsV1; |
|
49 CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1); |
|
50 iTelephony->GetCallDynamicCaps(iCallId, callCapsV1Pckg); |
|
51 |
|
52 if( callCapsV1.iControlCaps & CTelephony::KCapsSwap ) |
|
53 { |
|
54 // The call represented by 'iCallId' can be swapped |
|
55 iTelephony->Swap(iStatus, iCallIdA, iCallIdB); |
|
56 SetActive(); |
|
57 return KErrNone; |
|
58 } |
|
59 else |
|
60 { |
|
61 // The call cannot be swapped; |
|
62 // return an error indicate this. |
|
63 return KErrNotSupported; |
|
64 } |
|
65 } |
|
66 |
|
67 void CClientApp::RunL() |
|
68 { |
|
69 if(iStatus==KErrNone) |
|
70 {} // The call has been swapped successfully; |
|
71 } |
|
72 |
|
73 void CClientApp::DoCancel() |
|
74 { |
|
75 iTelephony->CancelAsync(CTelephony::ESwapCancel); |
|
76 } |
|
77 </codeblock> </example> </taskbody></task> |