24
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
#ifndef __SIMPHONESECURITY_H_
|
|
17 |
#define __SIMPHONESECURITY_H_
|
|
18 |
|
|
19 |
/**
|
|
20 |
* @file
|
|
21 |
*
|
|
22 |
* Contains the class definitions required for the Phone Security.
|
|
23 |
* @internalAll
|
|
24 |
*/
|
|
25 |
|
|
26 |
#include <etelmm.h>
|
|
27 |
#include <et_phone.h>
|
|
28 |
#include <mpbutil.h>
|
|
29 |
#include "csimtimer.h"
|
|
30 |
#include "CSimPhone.h"
|
|
31 |
|
|
32 |
// CDMA Mode - Timer Values
|
|
33 |
//const TInt KNamTimeout=1;
|
|
34 |
|
|
35 |
/**
|
|
36 |
* The main Phone Security class which simulates security features.
|
|
37 |
*/
|
|
38 |
class CSimPhone;
|
|
39 |
class CTestConfigSection;
|
|
40 |
class CTestConfigItem;
|
|
41 |
class CSimPhoneSecurity : public CSubSessionExtBase, public MTimerCallBack
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
static CSimPhoneSecurity* NewL(CSimPhone* aPhone);
|
|
45 |
CSimPhoneSecurity(CSimPhone* aPhone);
|
|
46 |
~CSimPhoneSecurity();
|
|
47 |
|
|
48 |
virtual CTelObject::TReqMode ReqModeL(const TInt aIpc);
|
|
49 |
// MTelObjectTSY pure virtual
|
|
50 |
virtual TInt RegisterNotification(const TInt aIpc);
|
|
51 |
virtual TInt DeregisterNotification(const TInt aIpc);
|
|
52 |
virtual void Init();
|
|
53 |
virtual CTelObject* OpenNewObjectByNameL(const TDesC& aName);
|
|
54 |
virtual CTelObject* OpenNewObjectL(TDes& aNewName);
|
|
55 |
virtual TInt NumberOfSlotsL(const TInt aIpc);
|
|
56 |
virtual TInt CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle);
|
|
57 |
|
|
58 |
// MSubSessionExtBaseTSY pure virtual
|
|
59 |
virtual TInt ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage);
|
|
60 |
virtual void TimerCallBack(TInt aId);
|
|
61 |
const CTestConfigSection* CfgFile();
|
|
62 |
//Called by other classes
|
|
63 |
TBool IsICCLocked();
|
|
64 |
TBool IsPIN2Locked();
|
|
65 |
void LockICC();
|
|
66 |
void UnLockICC();
|
|
67 |
void LockPIN2();
|
|
68 |
void UnLockPIN2();
|
|
69 |
TBool IsHiddenEnabled();
|
|
70 |
void HideEntries();
|
|
71 |
void ShowHidden();
|
|
72 |
|
|
73 |
void LockSpc();
|
|
74 |
void UnLockSpc();
|
|
75 |
|
|
76 |
protected:
|
|
77 |
void ConstructL();
|
|
78 |
public:
|
|
79 |
|
|
80 |
enum TSecurityEvent
|
|
81 |
{
|
|
82 |
EEventPin1Required,
|
|
83 |
EEventPin1Verified,
|
|
84 |
EEventPin2Required,
|
|
85 |
EEventPin2Verified,
|
|
86 |
EEventPuk1Required,
|
|
87 |
EEventPuk1Verified,
|
|
88 |
EEventPuk2Required,
|
|
89 |
EEventPuk2Verified,
|
|
90 |
EEventHiddenKeyRequired,
|
|
91 |
EEventHiddenKeyVerified,
|
|
92 |
EEventUSim1Required,
|
|
93 |
EEventUSim1Verified,
|
|
94 |
EEventUSim2Required,
|
|
95 |
EEventUSim2Verified,
|
|
96 |
EEventUniversalRequired,
|
|
97 |
EEventUniversalVerified,
|
|
98 |
};
|
|
99 |
|
|
100 |
class TSecurityCodes
|
|
101 |
{
|
|
102 |
public:
|
|
103 |
TName iPin1;
|
|
104 |
TName iPin2;
|
|
105 |
TName iPuk1;
|
|
106 |
TName iPuk2;
|
|
107 |
TName iPhonePassword;
|
|
108 |
TName iSPC;
|
|
109 |
TName iPhBkHiddenKey;
|
|
110 |
TName iUSimAppPin;
|
|
111 |
TName iSecondUSimAppPin;
|
|
112 |
TName iUniversalPin;
|
|
113 |
};
|
|
114 |
|
|
115 |
class TSecurityCodeRemainigAttempts
|
|
116 |
{
|
|
117 |
public:
|
|
118 |
TInt iPin1;
|
|
119 |
TInt iPin2;
|
|
120 |
TInt iPuk1;
|
|
121 |
TInt iPuk2;
|
|
122 |
};
|
|
123 |
|
|
124 |
class TSecurityStatus
|
|
125 |
{
|
|
126 |
public:
|
|
127 |
RMobilePhone::TMobilePhoneLockStatus iPin1;
|
|
128 |
RMobilePhone::TMobilePhoneLockStatus iPin2;
|
|
129 |
RMobilePhone::TMobilePhoneLockStatus iPuk1;
|
|
130 |
RMobilePhone::TMobilePhoneLockStatus iPuk2;
|
|
131 |
RMobilePhone::TMobilePhoneLockStatus iPhonePassword;
|
|
132 |
RMobilePhone::TMobilePhoneLockStatus iSPC;
|
|
133 |
RMobilePhone::TMobilePhoneLockStatus iPhBkHiddenKey;
|
|
134 |
RMobilePhone::TMobilePhoneLockStatus iUSimAppPin;
|
|
135 |
RMobilePhone::TMobilePhoneLockStatus iSecondUSimAppPin;
|
|
136 |
RMobilePhone::TMobilePhoneLockStatus iUniversalPin;
|
|
137 |
};
|
|
138 |
|
|
139 |
class TSecuritySetting
|
|
140 |
{
|
|
141 |
public:
|
|
142 |
RMobilePhone::TMobilePhoneLockSetting iPin1;
|
|
143 |
RMobilePhone::TMobilePhoneLockSetting iPin2;
|
|
144 |
RMobilePhone::TMobilePhoneLockSetting iPuk1;
|
|
145 |
RMobilePhone::TMobilePhoneLockSetting iPuk2;
|
|
146 |
RMobilePhone::TMobilePhoneLockSetting iPhonePassword;
|
|
147 |
RMobilePhone::TMobilePhoneLockSetting iSPC;
|
|
148 |
RMobilePhone::TMobilePhoneLockSetting iPhBkHiddenKey;
|
|
149 |
RMobilePhone::TMobilePhoneLockSetting iUSimAppPin;
|
|
150 |
RMobilePhone::TMobilePhoneLockSetting iSecondUSimAppPin;
|
|
151 |
RMobilePhone::TMobilePhoneLockSetting iUniversalPin;
|
|
152 |
};
|
|
153 |
|
|
154 |
class TICCStatusEntry
|
|
155 |
{
|
|
156 |
public:
|
|
157 |
TInt iDuration; // < Duration of ICC state
|
|
158 |
RMobilePhone::TMobilePhoneSecurityEvent iICCStatus; // < State of ICC
|
|
159 |
};
|
|
160 |
|
|
161 |
class TSecNotifyData
|
|
162 |
{
|
|
163 |
public:
|
|
164 |
TBool iNotifyPending; //indicates if a notification is pending
|
|
165 |
TTsyReqHandle iNotifyHandle; //the TSY notification handle
|
|
166 |
TAny* iNotifyData; //Holds the data for the notification pending
|
|
167 |
TAny* iNotifyDataXtra; //Holds the data for the notification pending
|
|
168 |
};
|
|
169 |
|
|
170 |
class TICCSettingEntry
|
|
171 |
{
|
|
172 |
public:
|
|
173 |
TInt iDuration; // < Duration of ICC setting
|
|
174 |
RMobilePhone::TMobilePhoneLock iLock; //lock change applies to.
|
|
175 |
RMobilePhone::TMobilePhoneLockInfoV1 iLockInfo;
|
|
176 |
};
|
|
177 |
|
|
178 |
|
|
179 |
public:
|
|
180 |
|
|
181 |
TInt GetSecurityCaps(const TTsyReqHandle aTsyReqHandle, TUint32* aCaps);
|
|
182 |
|
|
183 |
TInt NotifySecurityCapsChange(const TTsyReqHandle aTsyReqHandle, TUint32* aCaps);
|
|
184 |
TInt NotifySecurityCapsChangeCancel(const TTsyReqHandle aTsyReqHandle);
|
|
185 |
|
|
186 |
TInt GetLockInfo(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneLock* aLock, TDes8* aLockInfo);
|
|
187 |
TInt GetLockInfoCancel(const TTsyReqHandle aTsyReqHandle);
|
|
188 |
|
|
189 |
TInt NotifyLockInfoChange(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneLock* aLock, TDes8* aLockInfo);
|
|
190 |
TInt NotifyLockInfoChangeCancel(const TTsyReqHandle aTsyReqHandle);
|
|
191 |
|
|
192 |
TInt SetLockSetting(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneLock* aLock, RMobilePhone::TMobilePhoneLockSetting* aSetting);
|
|
193 |
TInt SetLockSettingCancel(const TTsyReqHandle aTsyReqHandle);
|
|
194 |
|
|
195 |
TInt GetSecurityCodeInfo(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode,TDes8* aSecurityCodeInfo);
|
|
196 |
TInt GetSecurityCodeInfoCancel(const TTsyReqHandle aReqHandle);
|
|
197 |
|
|
198 |
TInt NotifySecurityCodeInfoChange(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode,TDes8* aSecurityCodeInfo);
|
|
199 |
TInt NotifySecurityCodeInfoChangeCancel(const TTsyReqHandle aReqHandle);
|
|
200 |
|
|
201 |
TInt ChangeSecurityCode(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneSecurityCode* aType,const TDes8* aChange);
|
|
202 |
TInt ChangeSecurityCodeCancel(const TTsyReqHandle aTsyReqHandle);
|
|
203 |
|
|
204 |
TInt NotifySecurityEvent(const TTsyReqHandle aTsyReqHandle, TDes8* aEvent);
|
|
205 |
TInt NotifySecurityEventCancel(const TTsyReqHandle aTsyReqHandle);
|
|
206 |
|
|
207 |
TInt VerifySecurityCode(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneSecurityCode* aType, const RMobilePhone::TCodeAndUnblockCode* aCode);
|
|
208 |
TInt VerifySecurityCodeCancel(const TTsyReqHandle aTsyReqHandle);
|
|
209 |
|
|
210 |
TInt AbortSecurityCode(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneSecurityCode* aType);
|
|
211 |
|
|
212 |
TInt UnlockNam(const TTsyReqHandle aReqHandle, const RMobilePhone::TMobilePassword* aSpc);
|
|
213 |
TInt UnlockNamCancel(const TTsyReqHandle aTsyReqHandle);
|
|
214 |
void TimerCallBackUnlockNam();
|
|
215 |
|
|
216 |
TInt LockNamCancel(const TTsyReqHandle aTsyReqHandle);
|
|
217 |
void TimerCallBackLockNam();
|
|
218 |
|
|
219 |
void SecurityEvent(RMobilePhone::TMobilePhoneSecurityEvent aEvent);
|
|
220 |
|
|
221 |
class CIccTimer : public CBase
|
|
222 |
{
|
|
223 |
public:
|
|
224 |
CIccTimer();
|
|
225 |
~CIccTimer();
|
|
226 |
static CIccTimer* NewL();
|
|
227 |
public:
|
|
228 |
TBool iTimerStarted;
|
|
229 |
TInt iIndex;
|
|
230 |
CSimTimer* iTimer;
|
|
231 |
};
|
|
232 |
|
|
233 |
private:
|
|
234 |
TInt UpdateLockInfo(RMobilePhone::TMobilePhoneLock aLock, const RMobilePhone::TMobilePhoneLockInfoV1& aLockInfo);
|
|
235 |
|
|
236 |
void Pin1Failure();
|
|
237 |
void Pin1Success();
|
|
238 |
void Pin2Failure();
|
|
239 |
void Pin2Success();
|
|
240 |
void Puk1Failure();
|
|
241 |
void Puk1Success();
|
|
242 |
void Puk2Failure();
|
|
243 |
void Puk2Success();
|
|
244 |
|
|
245 |
void CompleteNotifyLockInfoChange(RMobilePhone::TMobilePhoneLock aLock, const RMobilePhone::TMobilePhoneLockInfoV1& aLockInfo);
|
|
246 |
void CompleteNotifySecurityCodeInfoChange(RMobilePhone::TMobilePhoneSecurityCode aSecurityCode, const RMobilePhone::TMobilePhoneSecurityCodeInfoV5& aSecurityCodeInfo);
|
|
247 |
|
|
248 |
CSimPhone* iPhone;
|
|
249 |
|
|
250 |
TSecurityCodes iSecCodes;
|
|
251 |
TSecurityCodeRemainigAttempts iSecurityCodeRemainigAttempts;
|
|
252 |
TSecurityCodeRemainigAttempts iSecurityCodeDefaultRemainigAttempts;
|
|
253 |
CArrayFixFlat<TICCStatusEntry>* iICCStatusProfile; // <Array containing the indicators changes for this test
|
|
254 |
TSecNotifyData iNotifyLock;
|
|
255 |
TSecNotifyData iNotifySecurityCodeInfo;
|
|
256 |
TNotifyData iNotifyEvent;
|
|
257 |
TSecurityStatus iSecStatus;
|
|
258 |
TSecuritySetting iSecSetting;
|
|
259 |
CArrayFixFlat<TICCSettingEntry>* iICCSettingProfile;
|
|
260 |
|
|
261 |
CIccTimer* iNotifySettingsTimer;
|
|
262 |
CIccTimer* iNotifySecurityEventsTimer;
|
|
263 |
|
|
264 |
CSimTimer* iUnlockNamTimer;
|
|
265 |
TTsyReqHandle iUnlockNamHandle;
|
|
266 |
CSimTimer* iLockNamTimer;
|
|
267 |
TTsyReqHandle iLockNamHandle;
|
|
268 |
};
|
|
269 |
|
|
270 |
#endif
|