|
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-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 <e32base.h> |
|
13 #include <Etel3rdParty.h> |
|
14 |
|
15 class CClientApp : public CActive |
|
16 { |
|
17 |
|
18 private: |
|
19 CTelephony* iTelephony; |
|
20 CTelephony::TIndicatorV1 iIndicatorV1; |
|
21 CTelephony::TIndicatorV1Pckg iIndicatorV1Pckg; |
|
22 |
|
23 public: |
|
24 CClientApp(CTelephony* aTelephony); |
|
25 void 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) |
|
37 : CActive(EPriorityStandard), |
|
38 iTelephony(aTelephony), |
|
39 iIndicatorV1Pckg(iIndicatorV1) |
|
40 { |
|
41 //default constructor |
|
42 } |
|
43 |
|
44 void CClientApp::SomeFunction() |
|
45 { |
|
46 iTelephony->GetIndicator(iStatus, iIndicatorV1Pckg); |
|
47 SetActive(); |
|
48 } |
|
49 |
|
50 void CClientApp::RunL() |
|
51 { |
|
52 if(iStatus==KErrNone) |
|
53 { |
|
54 if(iIndicatorV1.iCapabilities & CTelephony::KIndNetworkAvailable) |
|
55 { |
|
56 // We can detect when a network is present |
|
57 if(iIndicatorV1.iIndicator & CTelephony::KIndNetworkAvailable) |
|
58 {} // Network is present |
|
59 else |
|
60 {} // Network is no present |
|
61 } |
|
62 else |
|
63 {} // We do not know whether a network is present |
|
64 } |
|
65 } |
|
66 |
|
67 void CClientApp::DoCancel() |
|
68 { |
|
69 iTelephony->CancelAsync(CTelephony::EGetIndicatorCancel); |
|
70 }</codeblock> </example> </taskbody></task> |