|
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 id="GUID-FDD42A61-9FFE-53F5-A0B3-D8087270C7F6" xml:lang="en"><title>Phone |
|
13 Lock Tutorial </title><shortdesc>This tutorial describes how to get the device lock information |
|
14 by the client applications. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
15 <context><p>The phone can have up to two locks specified by the user. The |
|
16 client application can retrieve the lock information to prevent unauthorised |
|
17 use of the device. The client applications must specify a lock to retrieve |
|
18 the information. </p></context> |
|
19 |
|
20 |
|
21 <steps id="GUID-A284897D-1D9A-5012-AF7F-569E3DB0FF84"> |
|
22 <step id="GUID-BF21F99C-8A31-5BF5-9D33-AC952F9CFB6C"><cmd/> |
|
23 <info>create a new instance of <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony</apiname></xref> </info> |
|
24 </step> |
|
25 <step id="GUID-CC42631B-2A9A-58DB-8018-4A7679FAED0A"><cmd/> |
|
26 <info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::GetLockInfo()</apiname></xref> to |
|
27 get the lock information </info> |
|
28 <info>Specify the lock in a <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>TIccLock</apiname></xref> object. </info> |
|
29 </step> |
|
30 <step id="GUID-A1F3A428-568F-5149-9491-00AB2D2BEE16"><cmd/> |
|
31 <info>the function returns the lock information in <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::TIccLockInfoV1</apiname></xref> </info> |
|
32 </step> |
|
33 <step id="GUID-18B971F7-056B-55DB-BE93-D6503ACC6D69"><cmd/> |
|
34 <info>use <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::EPin1LockInfoChange</apiname></xref> and <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::EPin2LockInfoChangenotification</apiname></xref> to |
|
35 get the notification of any changes in the lock1 and lock2 </info> |
|
36 </step> |
|
37 <step id="GUID-0D7A9400-6C12-5B44-BA19-BE0A55E4BF30"><cmd/> |
|
38 <info>pass the enumeration <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::EPin1LockInfoChangeCancel</apiname></xref> and <xref href="GUID-97D402C8-B4B7-385A-92B3-D3FCC0CA575A.dita"><apiname>CTelephony::EPin2LockInfoChangeCancel</apiname></xref> to cancel |
|
39 the notification requests of lock1 and lock2. </info> |
|
40 </step> |
|
41 </steps> |
|
42 <example id="GUID-FD34FB9F-02F7-518E-A591-ECBAEFCC1521"><title>Phone lock |
|
43 example</title> <codeblock id="GUID-C79BF94F-2001-511D-A3E7-827A206536DE" xml:space="preserve">#include <e32base.h> |
|
44 #include <Etel3rdParty.h> |
|
45 |
|
46 class CClientApp : public CActive |
|
47 { |
|
48 |
|
49 private: |
|
50 CTelephony* iTelephony; |
|
51 CTelephony::TIccLockInfoV1 iIccLockInfoV1; |
|
52 CTelephony::TIccLockInfoV1Pckg iIccLockInfoV1Pckg; |
|
53 public: |
|
54 CClientApp(CTelephony* aTelephony); |
|
55 void SomeFunction(); |
|
56 |
|
57 private: |
|
58 /* |
|
59 These are the pure virtual methods from CActive that |
|
60 MUST be implemented by all active objects |
|
61 */ |
|
62 void RunL(); |
|
63 void DoCancel(); |
|
64 }; |
|
65 |
|
66 CClientApp::CClientApp(CTelephony* aTelephony) |
|
67 : CActive(EPriorityStandard), |
|
68 iTelephony(aTelephony), |
|
69 iIccLockInfoV1Pckg(iIccLockInfoV1) |
|
70 { |
|
71 //default constructor |
|
72 } |
|
73 |
|
74 void CClientApp::SomeFunction() |
|
75 { |
|
76 CTelephony::TIccLock lockSelect = CTelephony::ELockPin2; |
|
77 iTelephony->GetLockInfo(iStatus, lockSelect, iIccLockInfoV1Pckg); |
|
78 SetActive(); |
|
79 } |
|
80 |
|
81 void CClientApp::RunL() |
|
82 { |
|
83 if(iStatus==KErrNone) |
|
84 { |
|
85 if( iIccLockInfoV1.iSetting == CTelephony::ELockSetEnabled |
|
86 && iIccLockInfoV1.iStatus == CTelephony::EStatusUnlocked) |
|
87 { |
|
88 // Lock 2 is available for the phone to use |
|
89 // and its current statues is open, |
|
90 // The user can access functionality governed by this lock. |
|
91 } |
|
92 } |
|
93 } |
|
94 |
|
95 void CClientApp::DoCancel() |
|
96 { |
|
97 iTelephony->CancelAsync(CTelephony::EGetLockInfoCancel); |
|
98 }</codeblock> </example> |
|
99 </taskbody></task> |