|
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-AC5665B4-8E33-58A3-824B-6CC40E13160A"><title>Signal Strength Information Tutorial</title><shortdesc>This tutorial describes how to get the signal strength information with the telephony API for applications. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> <steps id="GUID-118619CA-9C07-578D-B36A-0CEDA713DEF6"> <step id="GUID-C52B6FA6-6291-5222-8943-C2AF63432054"><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-7AF254B4-BBDE-5F65-801E-95E39353CDDB"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::GetSignalStrength()</apiname></xref> to get the signal strength information </info> </step> <step id="GUID-A9D065A3-6247-5600-9501-F0D78367D874"><cmd/><info>you can cancel the asynchronous request with a <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>EGetSignalStrengthCancel</apiname></xref> </info> </step> <step id="GUID-46E2E940-FFC4-5C20-A809-65966C993A0E"><cmd/><info>pass the enumeration <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::ESignalStrengthChange</apiname></xref> to get the notification of any changes to the signal strength information </info> </step> <step id="GUID-99E58056-7B48-5439-B084-4E06CABC49D0"><cmd/><info>pass the enumeration <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::ESignalStrengthChangeCancel</apiname></xref> to cancel the notification request. </info> </step> </steps> <example id="GUID-7D719A16-CC6E-59F8-9B2B-ED7A8E9EC516"><title>Signal strength example</title> <codeblock id="GUID-E35C1AE7-A832-57DB-8600-E1CA73F0B308" 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::TSignalStrengthV1 iSigStrengthV1; |
|
21 CTelephony::TSignalStrengthV1Pckg iSigStrengthV1Pckg; |
|
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 iSigStrengthV1Pckg(iSigStrengthV1) |
|
40 { |
|
41 //default constructor |
|
42 } |
|
43 |
|
44 void CClientApp::SomeFunction() |
|
45 { |
|
46 iTelephony->GetSignalStrength(iStatus, iSigStrengthV1Pckg); |
|
47 SetActive(); |
|
48 } |
|
49 |
|
50 void CClientApp::RunL() |
|
51 { |
|
52 if(iStatus==KErrNone) |
|
53 { |
|
54 TInt32 sigStrength = iSigStrengthV1.iSignalStrength; |
|
55 TInt8 bar = iSigStrengthV1.iBar; |
|
56 } |
|
57 } |
|
58 |
|
59 void CClientApp::DoCancel() |
|
60 { |
|
61 iTelephony->CancelAsync(CTelephony::EGetSignalStrengthCancel); |
|
62 }</codeblock> </example> </taskbody></task> |