|
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-CC5A1C8D-55AA-5FAE-A446-4CBF949C9003"><title>Subscriber Identity Tutorial </title><shortdesc>This tutorial describes how an application gets the subscriber identification information. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> <steps id="GUID-A43361E3-7EAE-5596-8106-EA99038723D7"> <step id="GUID-A0597AB9-0725-584E-B9CB-6706C52F0802"><cmd/><info>create a new instance of the <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony</apiname></xref> </info> </step> <step id="GUID-E5DA9A58-763D-5571-80C1-8AA22A1FAD84"><cmd/><info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::GetSubscriberId()</apiname></xref> to get the IMSI number </info> </step> <step id="GUID-C9F1783E-DAB6-58AA-8E26-10C2ABBC822A"><cmd/><info>the function returns the IMSI in a <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::TSubscriberIdV1</apiname></xref> object </info> </step> <step id="GUID-C8C6490B-76A1-5872-B791-EEB3B14FA364"><cmd/><info>pass the enumeration <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::EGetSubscriberIdCancel</apiname></xref> to cancel the asynchronous request. </info> </step> </steps> <example id="GUID-E1CED382-30CE-57DC-8BC3-98F7F2A389DF"><title>Subscriber identity example</title> <codeblock id="GUID-63B55773-65BF-5CE8-919F-E3549CE57B71" 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::TSubscriberIdV1 iSubscriberIdV1; |
|
21 CTelephony::TSubscriberIdV1Pckg iSubscriberIdV1Pckg; |
|
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 iSubscriberIdV1Pckg(iSubscriberIdV1) |
|
40 { |
|
41 //default constructor |
|
42 } |
|
43 |
|
44 void CClientApp::SomeFunction() |
|
45 { |
|
46 iTelephony->GetSubscriberId(iStatus, iSubscriberIdV1Pckg); |
|
47 SetActive(); |
|
48 } |
|
49 |
|
50 void CClientApp::RunL() |
|
51 { |
|
52 if(iStatus==KErrNone) |
|
53 { |
|
54 TBuf<CTelephony::KIMSISize> suscriberId = iSubscriberIdV1.iSubscriberId; |
|
55 } |
|
56 } |
|
57 |
|
58 void CClientApp::DoCancel() |
|
59 { |
|
60 iTelephony->CancelAsync(CTelephony::EGetSubscriberIdCancel); |
|
61 }</codeblock> </example> </taskbody></task> |