Symbian3/PDK/Source/GUID-1907CF0B-2F4B-50F6-B676-7B7059B7FF74.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 18:02:22 +0000
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
permissions -rw-r--r--
week 10 bug fix submission (SF PDK version): Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.

<?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-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 &lt;e32base.h&gt;
#include &lt;Etel3rdParty.h&gt;

class CClientApp : public CActive
    { 

private:
    CTelephony* iTelephony;
    CTelephony::TCallId iCallId;

public:
    CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId);
    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),
      iCallId(aCallId)
    {
    //default constructor
    }

TInt CClientApp::SomeFunction()
    {
    // Check that the phone supports holding calls.
    CTelephony::TCallCapsV1 callCapsV1;
    CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1);
    iTelephony-&gt;GetCallDynamicCaps(iCallId, callCapsV1Pckg);

    if( callCapsV1.iControlCaps &amp; CTelephony::KCapsHold )
       {
       // The call represented by 'iCallId' can be put on hold
       iTelephony-&gt;Hold(iStatus, iCallId);
       SetActive();
       return KErrNone;
       }
    else
       {
       // The call cannot be put on hold; 
       // return an error indicate this.
       return KErrNotSupported;
       }
    }

void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {} // The call has been held successfully;
    }

void CClientApp::DoCancel()
    {
    iTelephony-&gt;CancelAsync(CTelephony::EHoldCancel);
    }
</codeblock> </example> </taskbody></task>