|
1 /* |
|
2 * Copyright (c) 2008 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: Used in Auto-Restart to read/write profile to cenrep, read from |
|
15 * settings database etc. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef NSML_PROFILE_UTIL_H |
|
21 #define NSML_PROFILE_UTIL_H |
|
22 |
|
23 // SYSTEM INCLUDES |
|
24 #include <e32cons.h> |
|
25 #include <s32mem.h> |
|
26 #include <e32uid.h> |
|
27 #include <centralrepository.h> |
|
28 |
|
29 // USER INCLUDES |
|
30 #include "nsmldssettings.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CNsmlContentData; |
|
34 |
|
35 /** |
|
36 * Utility class. Provides features to read a profile form settings database, |
|
37 * cache the profile to cenrep in a binary key, read the cached profile from |
|
38 * cenrep. |
|
39 */ |
|
40 class CNsmlProfileUtil : public CBase |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Two phase construction |
|
46 */ |
|
47 IMPORT_C static CNsmlProfileUtil* NewLC(); |
|
48 |
|
49 /** |
|
50 * Two phase construction |
|
51 */ |
|
52 IMPORT_C static CNsmlProfileUtil* NewL(); |
|
53 |
|
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 virtual ~CNsmlProfileUtil(); |
|
58 |
|
59 /** |
|
60 * Initialize this object by reading profile details from settings database |
|
61 */ |
|
62 IMPORT_C void InternalizeFromSettingsDBL(TInt aProfileId); |
|
63 |
|
64 /** |
|
65 * Initialize this object by reading profile details from central repository |
|
66 */ |
|
67 IMPORT_C void InternalizeFromCenrepL(); |
|
68 |
|
69 /** |
|
70 * Write this object details to central repository |
|
71 */ |
|
72 IMPORT_C void ExternalizeToCenrepL(); |
|
73 |
|
74 /** |
|
75 * Returns the profile id |
|
76 */ |
|
77 IMPORT_C TSmlProfileId ProfileId(); |
|
78 |
|
79 /** |
|
80 * Compare this profile against a new profile. Return ETrue if same |
|
81 */ |
|
82 IMPORT_C TBool IsSame(CNsmlProfileUtil& aNewProfile); |
|
83 /** |
|
84 * Check Whether a Valid Interrupt has occurred or not |
|
85 */ |
|
86 IMPORT_C void IsValidResumeL(TBool& aValue); |
|
87 |
|
88 /** |
|
89 * Write the value of Interrupt Flag |
|
90 */ |
|
91 IMPORT_C void WriteInterruptFlagL(TInt aFlag); |
|
92 |
|
93 /** |
|
94 * Write the value of IAPID |
|
95 */ |
|
96 IMPORT_C void WriteAccessPointIdL(TInt aIAPID); |
|
97 |
|
98 /** |
|
99 * Read the value of IAPID |
|
100 */ |
|
101 IMPORT_C void AccessPointIdL(TInt& aIAPID); |
|
102 |
|
103 /** |
|
104 * Write the TaskIds' in to the Cenrep |
|
105 */ |
|
106 IMPORT_C void ExternalizeTaskIdL(RArray<TSmlTaskId> aTaskIdArray); |
|
107 |
|
108 /** |
|
109 * Read the TaskIds' in to the Cenrep |
|
110 */ |
|
111 IMPORT_C void InternalizeTaskIdL(RArray<TSmlTaskId>& aTaskIdArray); |
|
112 |
|
113 private: |
|
114 |
|
115 /** |
|
116 * Second Phase constructor |
|
117 */ |
|
118 void ConstructL(); |
|
119 |
|
120 /** |
|
121 * Utility to write a size of string and its contents to a stream |
|
122 */ |
|
123 void WriteToStreamL(RDesWriteStream& aStream, const TDesC& aString); |
|
124 |
|
125 |
|
126 /** |
|
127 * Compares the Int values of the Profile details |
|
128 */ |
|
129 TBool CompareIntValues(TInt aCenrepValue,TInt aCurrentValue); |
|
130 |
|
131 /** |
|
132 * Compares the String values of the Profile details |
|
133 */ |
|
134 |
|
135 TBool CompareStringValues(TPtr16 aNewValue, TPtr16 aCurrentValue); |
|
136 |
|
137 private: |
|
138 |
|
139 /** |
|
140 * Internal profile id |
|
141 */ |
|
142 TSmlProfileId iProfileId; |
|
143 |
|
144 /** |
|
145 * Profile name |
|
146 */ |
|
147 HBufC* iDisplayName; |
|
148 |
|
149 /** |
|
150 * Protocol version selected for this profile |
|
151 */ |
|
152 TSmlProtocolVersion iProtocolVer; |
|
153 |
|
154 |
|
155 /** |
|
156 * Bearer Type selected for this profile |
|
157 */ |
|
158 TSmlTransportId iTransportId; |
|
159 |
|
160 |
|
161 /** |
|
162 * Access Point selected for this profile |
|
163 * |
|
164 */ |
|
165 TInt iIapId; |
|
166 |
|
167 /** |
|
168 * Server id set for this profile |
|
169 */ |
|
170 HBufC* iServerId; |
|
171 |
|
172 /** |
|
173 * Server URL defined for this profile |
|
174 */ |
|
175 HBufC* iServerURI; |
|
176 |
|
177 /** |
|
178 * Server port set for this profile |
|
179 */ |
|
180 TInt iServerPort; |
|
181 |
|
182 /** |
|
183 * Username defined for this profile |
|
184 */ |
|
185 HBufC* iSyncMLUserName; |
|
186 |
|
187 /** |
|
188 * Password defined for this profile |
|
189 */ |
|
190 HBufC* iSyncMLPassword; |
|
191 |
|
192 /** |
|
193 * SAN request settings for this profile |
|
194 */ |
|
195 TSmlServerAlertedAction iSanRequest; |
|
196 |
|
197 /** |
|
198 * HTTP username defined for this profile |
|
199 */ |
|
200 HBufC* iSyncHTTPAuthUserName; |
|
201 |
|
202 /** |
|
203 * HTTP passwd defined for this profile |
|
204 */ |
|
205 HBufC* iSyncHTTPAuthPassword; |
|
206 |
|
207 /** |
|
208 * Sync Type set for this profile |
|
209 */ |
|
210 TSmlSyncType iSyncType; |
|
211 |
|
212 |
|
213 /** |
|
214 * Content details defined for this profile |
|
215 */ |
|
216 RPointerArray<CNsmlContentData> iContents; |
|
217 |
|
218 }; |
|
219 |
|
220 |
|
221 /** |
|
222 * Support utility for CNsmlProfileUtil. This class holds the content details |
|
223 * selected for a profile |
|
224 */ |
|
225 class CNsmlContentData : public CBase |
|
226 { |
|
227 public: |
|
228 |
|
229 /** |
|
230 * Two phase construction |
|
231 */ |
|
232 IMPORT_C static CNsmlContentData* NewLC(); |
|
233 |
|
234 /** |
|
235 * Two phase construction |
|
236 */ |
|
237 IMPORT_C static CNsmlContentData* NewL(); |
|
238 |
|
239 /** |
|
240 * Virtual destructor |
|
241 */ |
|
242 virtual ~CNsmlContentData(); |
|
243 |
|
244 /** |
|
245 * Returns the server data source for this profile |
|
246 */ |
|
247 IMPORT_C HBufC* ServerDataSource(); |
|
248 |
|
249 /** |
|
250 * Set the server data source defined for this profile |
|
251 */ |
|
252 IMPORT_C void SetServerDataSourceL(const TDesC& aServerDataSource); |
|
253 |
|
254 /** |
|
255 * Returns the implementation id for this profile |
|
256 */ |
|
257 IMPORT_C TInt ImplementationId(); |
|
258 |
|
259 /** |
|
260 * Set the implementation id for this profile |
|
261 */ |
|
262 IMPORT_C void SetImplementationId(const TInt aImplementationId) ; |
|
263 |
|
264 /** |
|
265 * Returns the content enabled status |
|
266 */ |
|
267 IMPORT_C TInt ContentEnabled(); |
|
268 |
|
269 /** |
|
270 * Set the content enabled status |
|
271 */ |
|
272 IMPORT_C void SetContentEnabled(const TInt aContentEnabled); |
|
273 |
|
274 private: |
|
275 |
|
276 /** |
|
277 * Second Phase constructor |
|
278 */ |
|
279 void ConstructL(); |
|
280 |
|
281 private: |
|
282 |
|
283 /** |
|
284 * Content is enabled or not |
|
285 */ |
|
286 TInt iEnabled; |
|
287 |
|
288 |
|
289 /** |
|
290 * Implementation id for this content type |
|
291 */ |
|
292 TInt iImplementationId; |
|
293 |
|
294 /** |
|
295 * Server data source defined for this content type |
|
296 */ |
|
297 HBufC* iServerDataSource; |
|
298 }; |
|
299 |
|
300 #endif // NSML_PROFILE_UTIL_H |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |