Symbian3/SDK/Source/GUID-9EE405E2-2D58-525B-8C33-B1EAC0C5A71A.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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-9EE405E2-2D58-525B-8C33-B1EAC0C5A71A"><title>Network Signal Status Tutorial </title><shortdesc>This tutorial describes how to get the network signal status with the telephony API for applications. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> <steps id="GUID-457C44A1-1947-51F5-9BBB-7DC61AE2BE3D"> <step id="GUID-DC0EA5D5-2F74-5AEA-B96E-727809E45043"><cmd/><info>create new instance of <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony</apiname></xref>  </info> </step> <step id="GUID-8BB0592B-C650-5FC1-B32A-3D41778D99A2"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::GetIndicator()</apiname></xref> to get the network signal status information </info> </step> <step id="GUID-0DE72B37-076D-5C92-9439-DC28F91EDB23"><cmd/><info>you can cancel the asynchronous request with a <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>EGetIndicatorCancel</apiname></xref> object </info> </step> <step id="GUID-7841BBB1-8081-5A91-B8D5-5210971EFDB3"><cmd/><info>use the enumeration<xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>EIndicatorChange</apiname></xref> to get the notification of any changes to the network signal status </info> </step> <step id="GUID-6E4772BB-C48B-5613-A1C7-5A5A549F4596"><cmd/><info>cancel the notification request with <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>EIndicatorChangeCancel</apiname></xref> enumeration. </info> </step> </steps> <example id="GUID-B8922F87-D2CA-5103-B629-628D875CFBBD"><title>Network signal status example</title> <codeblock id="GUID-2EC900DF-10B9-5E63-8F0E-84D396520FDE" xml:space="preserve">#include &lt;e32base.h&gt;
#include &lt;Etel3rdParty.h&gt;

class CClientApp : public CActive
    { 

private:
    CTelephony* iTelephony;
    CTelephony::TIndicatorV1 iIndicatorV1;
    CTelephony::TIndicatorV1Pckg iIndicatorV1Pckg;

public:
    CClientApp(CTelephony* aTelephony);
    void 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)
    : CActive(EPriorityStandard),
      iTelephony(aTelephony),
      iIndicatorV1Pckg(iIndicatorV1)
    {
    //default constructor
    }

void CClientApp::SomeFunction()
    {
    iTelephony-&gt;GetIndicator(iStatus, iIndicatorV1Pckg);
    SetActive();
    }

void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {
       if(iIndicatorV1.iCapabilities &amp; CTelephony::KIndNetworkAvailable)
          {
          // We can detect when a network is present
          if(iIndicatorV1.iIndicator &amp; CTelephony::KIndNetworkAvailable)
             {} // Network is present
          else
             {} // Network is no present
          }
       else
          {} // We do not know whether a network is present
       }
    }

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