|
1 /* |
|
2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * A dynamic state class for security mode. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef CPHONESECURITYMODEOBSERVER_H |
|
20 #define CPHONESECURITYMODEOBSERVER_H |
|
21 |
|
22 #include "mphonesecuritymodeobserver.h" |
|
23 #include "mphonesecuritymessagehandler.h" |
|
24 #include "mphonesecuritymodechangeobserver.h" |
|
25 #include <e32base.h> |
|
26 #include <pevirtualengine.h> |
|
27 #include <startupdomainpskeys.h> |
|
28 #include <coreapplicationuisdomainpskeys.h> |
|
29 #include <e32cmn.h> |
|
30 |
|
31 // Forward Declarations |
|
32 class MPEEngineInfo; |
|
33 |
|
34 /** |
|
35 * Dynamic state class for security mode. |
|
36 * |
|
37 */ |
|
38 NONSHARABLE_CLASS( CPhoneSecurityModeObserver ) : public CBase, |
|
39 public MPhoneSecurityModeObserver, |
|
40 public MPhoneSecurityMessageHandler |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Default static two-phased constructor. |
|
46 * |
|
47 * @return Pointer to new instance. |
|
48 */ |
|
49 static CPhoneSecurityModeObserver* NewL(); |
|
50 |
|
51 /** |
|
52 * Default static two-phased constructor. |
|
53 * |
|
54 * @return Pointer to new instance. |
|
55 */ |
|
56 static CPhoneSecurityModeObserver* NewLC(); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 ~CPhoneSecurityModeObserver(); |
|
62 |
|
63 /** |
|
64 * Sets pointer to phone engine info interface. |
|
65 * |
|
66 * @param aEngineInfo Pointer to engine info interface. |
|
67 */ |
|
68 void SetPhoneEngineInfo( MPEEngineInfo* aEngineInfo ); |
|
69 |
|
70 // From MPhoneSecurityModeState |
|
71 |
|
72 /** |
|
73 * Register state observer. |
|
74 * |
|
75 * @param aObserver Reference to state observer instance. |
|
76 */ |
|
77 IMPORT_C void RegisterStateObserver( MPhoneSecurityModeChangeObserver& aObserver ); |
|
78 |
|
79 /** |
|
80 * Remove state observer |
|
81 * |
|
82 * @param aObserver Reference to state observer instance. |
|
83 */ |
|
84 IMPORT_C void RemoveStateObserver( MPhoneSecurityModeChangeObserver& aObserver ); |
|
85 |
|
86 /** |
|
87 * Checks if autolock is enabled. |
|
88 * |
|
89 * @return ETrue if enabled. EFalse otherwise. |
|
90 */ |
|
91 IMPORT_C TBool IsAutolockEnabled(); |
|
92 |
|
93 /** |
|
94 * Checks if security mode is enabled. |
|
95 * |
|
96 * @return ETrue if enabled. EFalse otherwise. |
|
97 */ |
|
98 IMPORT_C TBool IsSecurityMode(); |
|
99 |
|
100 /** |
|
101 * Initializes state instance. This should be called when dynamic security |
|
102 * mode observers are ready. |
|
103 */ |
|
104 IMPORT_C void Initialize(); |
|
105 |
|
106 /** |
|
107 * Handles phone engine message. Dynamic state object listens phone engine |
|
108 * message to determinate sim states. |
|
109 * |
|
110 * @param aMessage Message enumeration. |
|
111 * @param aCallId Call identifier. |
|
112 */ |
|
113 void HandlePhoneEngineMessageL( const TInt aMessage, TInt aCallId ); |
|
114 |
|
115 /** |
|
116 * Handle property change. Dynamic state object listens P&S key changes |
|
117 * to determinate autolock and sim security states. |
|
118 * |
|
119 * @param aCategory Unique identifer category reference. |
|
120 * @param aKey Key as unsigned integer. |
|
121 * @param aValue Key value as integer. |
|
122 */ |
|
123 void HandlePropertyChangedL(const TUid& aCategory, |
|
124 const TUint aKey, |
|
125 const TInt aValue ); |
|
126 |
|
127 private: |
|
128 |
|
129 /** |
|
130 * Default C++ constructor. |
|
131 */ |
|
132 CPhoneSecurityModeObserver(); |
|
133 |
|
134 /** |
|
135 * Defines iSecurityMode with corresponding logic implementation. |
|
136 */ |
|
137 void DefineSecurityModeState(); |
|
138 |
|
139 /** |
|
140 * Handles security mode state change. Basicly calls observer functions. |
|
141 */ |
|
142 void HandleStateChange(); |
|
143 |
|
144 /** |
|
145 * Checks if sim security status is enabled. |
|
146 * |
|
147 * @return ETrue if enabled. |
|
148 */ |
|
149 TBool IsSimSecurityStatus(); |
|
150 |
|
151 /** |
|
152 * Checks if sim security status is accepted, not in security mode. |
|
153 * |
|
154 * @return ETrue if not in security mode. |
|
155 */ |
|
156 TBool IsEngineSimStateAccepted(); |
|
157 |
|
158 /** |
|
159 * Checks if simless features are supported. |
|
160 * |
|
161 * @return ETrue if features are supported. |
|
162 */ |
|
163 TBool AreSimlessFeaturesSupported(); |
|
164 |
|
165 private: |
|
166 |
|
167 // Phone sim security state. Used to define dialer security mode and |
|
168 // usability restrictions dynamically. |
|
169 TPSSimSecurityStatus iSimState; |
|
170 |
|
171 // Telephony engine sim state. Used to define dialer security mode and |
|
172 // usability restrictions dynamically. |
|
173 TPESimState iEngineCurrentSimState; |
|
174 |
|
175 // Some special cases requires that we know previous sim state to |
|
176 // calculate security mode. |
|
177 TPESimState iEnginePreviousSimState; |
|
178 |
|
179 // Phone device lock state. Used to define dialer security mode and |
|
180 // usability restrictions dynamically. |
|
181 TPSAutolockStatus iDeviceLockState; |
|
182 |
|
183 // Security mode status flag. This is calculated from iSimState and |
|
184 // iDeviceLockState |
|
185 TBool iSecurityMode; |
|
186 |
|
187 /** |
|
188 * Pointer array for observers. This dynamic security mode state object |
|
189 * doesn't own the observer instances. |
|
190 */ |
|
191 RPointerArray< MPhoneSecurityModeChangeObserver > iObserverArray; |
|
192 |
|
193 /** |
|
194 * Pointer to Phone Engine info instance. This object doens't own the |
|
195 * engine info instance. |
|
196 */ |
|
197 MPEEngineInfo* iEngineInfo; |
|
198 |
|
199 /** |
|
200 * Flag to determinate if this security mode state object has been fully |
|
201 * initialized. |
|
202 */ |
|
203 TBool iInitialized; |
|
204 |
|
205 }; |
|
206 |
|
207 #endif |