|
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-C48890DD-BBFD-53FA-95D6-7F39D9C3C263"><title>Current Network Information Tutorial </title><shortdesc>This tutorial describes how to get the current network information with the telephony API for applications. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> <steps id="GUID-200DAECA-5ABF-570A-8D51-66BEB8FD28C5"> <step id="GUID-EA612306-767E-52CF-9106-F37D09D9EC18"><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-E28FA43C-9DCD-503C-B338-A055F957DB45"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::GetCurrentNetworkInfo()</apiname></xref> to get the current network information </info> </step> <step id="GUID-DB2736DE-3665-5C59-B7BB-5BE160834FA3"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::EGetCurrentNetworkInfoCancel</apiname></xref> to cancel the asynchronous request </info> </step> <step id="GUID-238778A6-986B-5F82-8B6C-7B5467CFD195"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::ECurrentNetworkInfoChange</apiname></xref> to get the notification of any changes to the current network information </info> </step> <step id="GUID-2197F674-C205-5D74-A175-941CD4CDA24D"><cmd/><info>pass the enumeration <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::ECurrentNetworkInfoChangeCancel</apiname></xref> to cancel the notification request. </info> </step> </steps> <example id="GUID-294DCE91-58A5-5AFE-90FC-7F8C6E4BE1EF"><title>Current network information example</title> <codeblock id="GUID-26F49E05-4B6E-5C58-B26D-59D4ADC40AD2" 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::TNetworkInfoV1 iNetworkInfoV1; |
|
21 CTelephony::TNetworkInfoV1Pckg iNetworkInfoV1Pckg; |
|
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 iNetworkInfoV1Pckg(iNetworkInfoV1) |
|
40 { |
|
41 //default constructor |
|
42 } |
|
43 |
|
44 void CClientApp::SomeFunction() |
|
45 { |
|
46 iTelephony->GetCurrentNetworkInfo(iStatus, iNetworkInfoV1Pckg); |
|
47 SetActive(); |
|
48 } |
|
49 |
|
50 void CClientApp::RunL() |
|
51 { |
|
52 if(iStatus==KErrNone) |
|
53 { |
|
54 CTelephony::TNetworkMode mode = iNetworkInfoV1.iMode; |
|
55 if((mode == CTelephony::ENetworkModeCdma2000) || (mode == CTelephony::ENetworkModeCdma95)) |
|
56 {} // CDMA network; process CDMA-specific information |
|
57 } |
|
58 } |
|
59 |
|
60 void CClientApp::DoCancel() |
|
61 { |
|
62 iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel); |
|
63 }</codeblock> </example> </taskbody></task> |