|
1 /* |
|
2 * Copyright (c) 2005 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 * Contains the implementation for RSCPClient, the client side interface |
|
16 * for SCP Server. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef SCPCLIENT_H |
|
22 #define SCPCLIENT_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <bldvariant.hrh> |
|
27 #include <SCPServerInterface.h> |
|
28 #include <etelmm.h> |
|
29 |
|
30 #include <SCPParamObject.h> |
|
31 |
|
32 // Code change types. Forced change is used when password expires. |
|
33 const TInt KSCPNormalChange = 1; |
|
34 const TInt KSCPForcedChange = 2; |
|
35 |
|
36 /** |
|
37 * Implements the public interface towards the SCP Server |
|
38 * Contains methods for controlling the server operation |
|
39 */ |
|
40 class RSCPClient : public RSessionBase |
|
41 { |
|
42 public: // Methods |
|
43 |
|
44 // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * C++ default constructor. |
|
48 */ |
|
49 IMPORT_C RSCPClient(); |
|
50 |
|
51 // New methods |
|
52 |
|
53 /** |
|
54 * The standard connection method, starts the server process, if necessary |
|
55 * @return A system error code indicating the result of the operation |
|
56 * <BR><B>Name of return value:</B> Result |
|
57 * <BR><B>Type of return value:</B> Integer |
|
58 * <BR><B>Range of return value:</B> System wide error code |
|
59 * <BR><B>Contents of return value:</B> KErrNone on success, |
|
60 * <BR> otherwise an error indication |
|
61 */ |
|
62 IMPORT_C TInt Connect(); |
|
63 |
|
64 /** |
|
65 * Version query |
|
66 * @return The version number of the client DLL |
|
67 * <BR><B>Name of return value:</B> Version |
|
68 * <BR><B>Type of return value:</B> TVersion |
|
69 * <BR><B>Range of return value:</B> Three integer values |
|
70 * <BR><B>Contents of return value:</B> A TVersion-object, |
|
71 * <BR>which contains the Major, Minor and Build version numbers |
|
72 */ |
|
73 IMPORT_C TVersion Version() const; |
|
74 |
|
75 /** |
|
76 * A method for querying the stored ISA code |
|
77 * @param aCode A buffer for storing the code |
|
78 * @return The result of the operation |
|
79 * <BR><B>Name of return value:</B> Result |
|
80 * <BR><B>Type of return value:</B> Integer |
|
81 * <BR><B>Range of return value:</B> System wide error code |
|
82 * <BR><B>Contents of return value:</B> KErrNone on success, |
|
83 * <BR>otherwise an error indication |
|
84 */ |
|
85 IMPORT_C TInt GetCode( TSCPSecCode& aCode ); |
|
86 |
|
87 /** |
|
88 * Used to store the new code, the user has set, in SCP |
|
89 * @param aCode A descriptor containing the new code |
|
90 * @return The result of the operation |
|
91 * <BR><B>Name of return value:</B> Result |
|
92 * <BR><B>Type of return value:</B> Integer |
|
93 * <BR><B>Range of return value:</B> System wide error code |
|
94 * <BR><B>Contents of return value:</B> KErrNone on success, |
|
95 * <BR>otherwise an error indication |
|
96 */ |
|
97 IMPORT_C TInt StoreCode( TSCPSecCode& aCode ); |
|
98 |
|
99 /** |
|
100 * Used to change the system security code, uses the stored code |
|
101 * as the current one. |
|
102 * @param aNewCode A descriptor containing the new code |
|
103 * @return The result of the operation |
|
104 * <BR><B>Name of return value:</B> Result |
|
105 * <BR><B>Type of return value:</B> Integer |
|
106 * <BR><B>Range of return value:</B> System wide error code |
|
107 * <BR><B>Contents of return value:</B> KErrNone on success, |
|
108 * <BR>otherwise an error indication |
|
109 */ |
|
110 IMPORT_C TInt ChangeCode( TDes& aNewCode ); |
|
111 |
|
112 /** |
|
113 * Used to lock the phone, uses the stored code for verifying the request |
|
114 * @param aLocked ETrue to lock the phone, EFalse to unlock. |
|
115 * @return The result of the operation |
|
116 * <BR><B>Name of return value:</B> Result |
|
117 * <BR><B>Type of return value:</B> Integer |
|
118 * <BR><B>Range of return value:</B> System wide error code |
|
119 * <BR><B>Contents of return value:</B> KErrNone on success, |
|
120 * <BR> otherwise an error indication |
|
121 */ |
|
122 IMPORT_C TInt SetPhoneLock( TBool aLocked ); |
|
123 |
|
124 /** |
|
125 * Query the current state of the system lock. |
|
126 * @param aState Will contain the state after a successful call. |
|
127 * @return The result of the operation |
|
128 * <BR><B>Name of return value:</B> Result |
|
129 * <BR><B>Type of return value:</B> Integer |
|
130 * <BR><B>Range of return value:</B> System wide error code |
|
131 * <BR><B>Contents of return value:</B> KErrNone on success, |
|
132 * <BR> otherwise an error indication |
|
133 */ |
|
134 IMPORT_C TInt GetLockState( TBool& aState ); |
|
135 |
|
136 /** |
|
137 * A method for retrieving the operational status of the server in relation |
|
138 * to the given command. |
|
139 * @param aCommand The command, whose status will be queried |
|
140 * @return The status, see below |
|
141 * <BR><B>Name of return value:</B> Operation status |
|
142 * <BR><B>Type of return value:</B> TBool |
|
143 * <BR><B>Range of return value:</B> ETrue/EFalse |
|
144 * <BR><B>Contents of return value:</B> The query will return ETrue |
|
145 * in case the operation is actually in progress, or if it was already |
|
146 * completed but not acknowledged via this call. This history information is |
|
147 * kept to ensure, that interested parties receive the information regardless |
|
148 * of the execution schedule. |
|
149 * Otherwise EFalse will be returned. |
|
150 */ |
|
151 IMPORT_C TBool QueryAdminCmd( TSCPAdminCommand aCommand ); |
|
152 |
|
153 /** |
|
154 * Get the value of an identified parameter stored on the server. |
|
155 * @param aParamID The ID of the requested parameter. |
|
156 * @param aTimeout The value to be set. |
|
157 * @return The status, see below |
|
158 * <BR><B>Name of return value:</B> Operation status |
|
159 * <BR><B>Type of return value:</B> TInt |
|
160 * <BR><B>Range of return value:</B> A system wide error code |
|
161 * <BR><B>Contents of return value:</B> The status code of the operation. |
|
162 * |
|
163 * NOTE: FUNCTION IS DEPRECATED. Use SetParamValue( TInt aParamID, TDes& aValue, const TUint32 aCallerID ) instead. |
|
164 */ |
|
165 IMPORT_C TInt SetParamValue( TInt aParamID, TDes& aValue ); |
|
166 |
|
167 /** |
|
168 * Get the value of an identified parameter stored on the server. |
|
169 * @param aParamID The ID of the requested parameter. |
|
170 * @param aValue Will contain the requested value after a successful call. |
|
171 * @return The status, see below |
|
172 * <BR><B>Name of return value:</B> Operation status |
|
173 * <BR><B>Type of return value:</B> TInt |
|
174 * <BR><B>Range of return value:</B> A system wide error code |
|
175 * <BR><B>Contents of return value:</B> The status code of the operation. |
|
176 */ |
|
177 IMPORT_C TInt GetParamValue( TInt aParamID, TDes& aValue ); |
|
178 |
|
179 enum TSCPButtonConfig |
|
180 { |
|
181 SCP_OK, |
|
182 SCP_OK_CANCEL, |
|
183 SCP_OK_ETEL, |
|
184 SCP_OK_CANCEL_ETEL |
|
185 }; |
|
186 |
|
187 /** |
|
188 * Request the security code from the user. |
|
189 * |
|
190 */ |
|
191 IMPORT_C TInt SecCodeQuery( RMobilePhone::TMobilePassword& aPassword, |
|
192 TSCPButtonConfig aButtonsShown, |
|
193 TBool aECSSupport, |
|
194 TInt aFlags ); |
|
195 |
|
196 /** |
|
197 * Prompt the user to change the security code. |
|
198 */ |
|
199 IMPORT_C TInt ChangeCodeRequest(); |
|
200 |
|
201 /** |
|
202 * Checks the server configuration and reports the status. |
|
203 * @param aMode The check mode, initial or complete. The initial mode only checks if the |
|
204 * configuration has already been validated. |
|
205 */ |
|
206 IMPORT_C TInt CheckConfiguration( TInt aMode ); |
|
207 |
|
208 /** |
|
209 * This function can be used to cleanup the parameter values stored by any |
|
210 * application, initialize the parameters to default values. The call notifies |
|
211 * the stakeholders (Other applications that may be using the same parameters) about the |
|
212 * change (value being revoked to default) |
|
213 * |
|
214 * @param: |
|
215 * aEvent - One of the external events that lead to cleanup (Currently application |
|
216 * Uninstallation is the only event that is supported) |
|
217 * aAppIDs - The UID's of the application(s) that were uninstalled/removed |
|
218 */ |
|
219 IMPORT_C TInt PerformCleanupL(RArray<TUid>& aAppIDs); |
|
220 |
|
221 /** |
|
222 * Get the value of an identified parameter stored on the server. |
|
223 * @param aParamID The ID of the requested parameter. |
|
224 * @param aValue The value to be set. |
|
225 * @param aCallerID The SID of the calling application. |
|
226 * |
|
227 * NOTE: Currently TCServer is the only component that is capable of calling this function |
|
228 * TCServer is assured to send the correct caller id always. |
|
229 * |
|
230 * @return The status, see below |
|
231 * <BR><B>Name of return value:</B> Operation status |
|
232 * <BR><B>Type of return value:</B> TInt |
|
233 * <BR><B>Range of return value:</B> A system wide error code |
|
234 * <BR><B>Contents of return value:</B> The status code of the operation. |
|
235 * |
|
236 * NOTE: FUNCTION IS DEPRECATED. Use SetParamValue( TInt aParamID, TDes& aValue, const TUint32 aCallerID ) instead. |
|
237 */ |
|
238 IMPORT_C TInt SetParamValue( TInt aParamID, TDes& aValue, TUint32 aCallerID ); |
|
239 |
|
240 |
|
241 IMPORT_C TInt SetAutoLockPeriod( TInt aValue ); |
|
242 private: // Methods |
|
243 |
|
244 /** |
|
245 * Request the security code from the user (encapsulates functionalities of SecCodeQuery()). |
|
246 * |
|
247 */ |
|
248 TInt SetSecurityCodeL(RMobilePhone::TMobilePassword& aPassword, TSCPButtonConfig aButtonsShown, |
|
249 TBool aECSSupport, TInt aFlags, TInt& aResFileSCP, TInt& aResFileSecUi); |
|
250 |
|
251 /** |
|
252 * Request the new code from the user and try to change the code |
|
253 */ |
|
254 TInt GetNewCodeAndChange( TDes& aOldCode, TInt aMode, TSCPSecCode* aNewDOSCode = NULL, HBufC** aNewCodePptr = NULL ); |
|
255 |
|
256 /** |
|
257 * Process the server's response-commands |
|
258 */ |
|
259 void ProcessServerCommandsL( TDes8& aInParams, |
|
260 CSCPParamObject** aOutParams = NULL, |
|
261 TBool isNotifierEvent = EFalse ); |
|
262 |
|
263 /** |
|
264 * Show UI controls based on server commands |
|
265 */ |
|
266 void ShowUIL( CSCPParamObject& aContext ); |
|
267 |
|
268 /** |
|
269 * Fetch the limit-values for code length |
|
270 */ |
|
271 void FetchLimits( TInt& aMin, TInt& aMax ); |
|
272 TBool isFlagEnabled; |
|
273 }; |
|
274 |
|
275 #endif //SCPCLIENT_H |
|
276 |
|
277 // End of File |
|
278 |