|
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-1907CF0B-2F4B-50F6-B676-7B7059B7FF74"><title>Call Hold Tutorial </title><shortdesc>This tutorial describes how to place a call on hold with the telephony API for applications. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> <steps id="GUID-579AD00E-9CCB-5C1E-85D7-D223535A4C7A"> <step id="GUID-BA54B3E5-B284-55C8-9709-082ADB8E1C5D"><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-B48E2268-6BFE-57A4-A46A-3913B65234BE"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::GetCallDynamicCaps()</apiname></xref> to check if the device supports hold function </info> </step> <step id="GUID-15ADB36E-8D94-57EF-BBAA-6A7958A854CD"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::Hold()</apiname></xref> to place a call on hold </info> <info>Pass it the ID of the call to hold. The ID is the <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::TCallId</apiname></xref> returned when you dialled or answered the call. </info> </step> <step id="GUID-82771AAC-9CBA-5029-98DA-9D95552E90F4"><cmd/><info>pass the enumeration <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::EHoldCancel</apiname></xref> to cancel the asynchronous request </info> </step> </steps> <example id="GUID-6068EFDB-D572-5D49-880E-FAF76EC44408"><title>Call hold example</title> <codeblock id="GUID-32D588C0-A809-5BC1-8DF4-1B9F494C19DE" 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 iCallId; |
|
21 |
|
22 public: |
|
23 CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId); |
|
24 TInt SomeFunction(); |
|
25 |
|
26 private: |
|
27 /* |
|
28 These are the pure virtual methods from CActive that |
|
29 MUST be implemented by all active objects |
|
30 */ |
|
31 void RunL(); |
|
32 void DoCancel(); |
|
33 }; |
|
34 |
|
35 CClientApp::CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId) |
|
36 : CActive(EPriorityStandard), |
|
37 iTelephony(aTelephony), |
|
38 iCallId(aCallId) |
|
39 { |
|
40 //default constructor |
|
41 } |
|
42 |
|
43 TInt CClientApp::SomeFunction() |
|
44 { |
|
45 // Check that the phone supports holding calls. |
|
46 CTelephony::TCallCapsV1 callCapsV1; |
|
47 CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1); |
|
48 iTelephony->GetCallDynamicCaps(iCallId, callCapsV1Pckg); |
|
49 |
|
50 if( callCapsV1.iControlCaps & CTelephony::KCapsHold ) |
|
51 { |
|
52 // The call represented by 'iCallId' can be put on hold |
|
53 iTelephony->Hold(iStatus, iCallId); |
|
54 SetActive(); |
|
55 return KErrNone; |
|
56 } |
|
57 else |
|
58 { |
|
59 // The call cannot be put on hold; |
|
60 // return an error indicate this. |
|
61 return KErrNotSupported; |
|
62 } |
|
63 } |
|
64 |
|
65 void CClientApp::RunL() |
|
66 { |
|
67 if(iStatus==KErrNone) |
|
68 {} // The call has been held successfully; |
|
69 } |
|
70 |
|
71 void CClientApp::DoCancel() |
|
72 { |
|
73 iTelephony->CancelAsync(CTelephony::EHoldCancel); |
|
74 } |
|
75 </codeblock> </example> </taskbody></task> |