1 /* |
|
2 * Copyright (c) 2002-2004 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: Device Management IMPS Adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // TaH 3.6.2005 Added constants for parameter lenghts (KNSmlDMMaxNameLen, KNSmlDMMaxAddrLen). |
|
21 // TaH 13.6.2005 Added comments for functions. |
|
22 // TaH 27.9.2005 Constansts for dynamic node names changed. |
|
23 |
|
24 #ifndef __NSMLDMIMPSADAPTER_H__ |
|
25 #define __NSMLDMIMPSADAPTER_H__ |
|
26 |
|
27 // ------------------------------------------------------------------------------------------------ |
|
28 // Includes |
|
29 // ------------------------------------------------------------------------------------------------ |
|
30 #include <e32base.h> |
|
31 #include <smldmadapter.h> |
|
32 #include <msvapi.h> |
|
33 |
|
34 // CONSTANTS |
|
35 // Defined in nsmldmimpluids.h file |
|
36 const TUint KNSmlDMImpsAdapterImplUid = 0x101F9A2B; |
|
37 const TInt KNSmlDMSAPSettings = 200; |
|
38 const TInt KNSmlDMMaxNameLen = 50; |
|
39 const TInt KNSmlDMMaxAddrLen = 255; |
|
40 const TInt KNSmlDMReservingData = 16; |
|
41 const TInt KNSmlDMReservingMaxData = 100; |
|
42 |
|
43 // MACROS |
|
44 |
|
45 // DATA TYPES |
|
46 |
|
47 // FUNCTION PROTOTYPES |
|
48 |
|
49 // FORWARD DECLARATIONS |
|
50 |
|
51 // CLASS DECLARATION |
|
52 |
|
53 // the DDF version must be changed if any changes in DDF structure ( built in DDFStructureL() function ) |
|
54 _LIT8( KNSmlDMImpsDDFVersion, "1.0" ); |
|
55 |
|
56 _LIT8( KNSmlDMImpsTextPlain, "text/plain" ); |
|
57 _LIT8( KNSmlDMImpsDynamicNode, "" ); |
|
58 _LIT8( KNSmlDMImpsNodeName, "IMPS" ); |
|
59 _LIT8( KNSmlDMImpsAppId, "AppID" ); |
|
60 _LIT8( KNSmlDMImpsName, "Name" ); |
|
61 _LIT8( KNSmlDMImpsPrefConRef, "PrefConRef" ); |
|
62 _LIT8( KNSmlDMImpsPrefAddr, "PrefAddr" ); |
|
63 _LIT8( KNSmlDMImpsAppAuth, "AppAuth" ); |
|
64 _LIT8( KNSmlDMImpsAAuthLevel, "AAuthLevel" ); |
|
65 _LIT8( KNSmlDMImpsAAuthName, "AAuthName" ); |
|
66 _LIT8( KNSmlDMImpsAAuthSecret, "AAuthSecret" ); |
|
67 _LIT8( KNSmlDMImpsServices, "Services" ); |
|
68 _LIT8( KNSmlDMImpsExtNode, "Ext" ); |
|
69 _LIT8( KNSmlDMImpsPepCompliant, "PEPCompliant" ); |
|
70 _LIT( KNSmlDMImpsPepCompliant16, "PEPCompliant" ); |
|
71 |
|
72 _LIT8( KNSmlDMImpsDescr, "The interior object holds all IMPS objects" ); |
|
73 _LIT8( KNSmlDMDynamicNodeDescr, "Placeholder for one or more objects" ); |
|
74 _LIT8( KNSmlDMImpsAppIDDescr, "Identifier for the application service available at the described SAP" ); |
|
75 _LIT8( KNSmlDMImpsNameDescr, "Logical and user readable identity of the SAP" ); |
|
76 _LIT8( KNSmlDMImpsPrefConRefDescr, "Indicator for preferred linkage to connectivity parameters" ); |
|
77 _LIT8( KNSmlDMImpsPrefAddrDescr, "Addres of the application server" ); |
|
78 _LIT8( KNSmlDMImpsAppAuthDescr, "Container of authentication information to be used with the SAP" ); |
|
79 _LIT8( KNSmlDMImpsAAuthLevelDescr, "Tells how the provided authentication credentials are to be applied" ); |
|
80 _LIT8( KNSmlDMImpsAAuthNameDescr, "Indicator of the ID" ); |
|
81 _LIT8( KNSmlDMImpsAAuthSecretDescr, "Indicator of the authentication secret" ); |
|
82 _LIT8( KNSmlDMImpsServicesDescr, "List of supported high-level services" ); |
|
83 _LIT8( KNSmlDMImpsExtNodeDescr, "Container of vendor specific information" ); |
|
84 _LIT8( KNSmlDMImpsPepCompliantDescr, "Indicator of the PEP Compliantly" ); |
|
85 |
|
86 _LIT8( KNSmlDMImpsDefaultAppID, "wA" ); |
|
87 _LIT8( KNSmlDMImpsDefaultAAuthLevel, "APPSRV" ); |
|
88 _LIT8( KNSmlDMImpsDefaultPEC, "TRUE" ); |
|
89 _LIT8( KNSmlDMImpsDefaultIM, "FALSE" ); |
|
90 _LIT8( KNSmlDMImpsDefPEC, "T" ); |
|
91 _LIT8( KNSmlDMImpsDefIM, "F" ); |
|
92 _LIT( KNSmlDMImpsNotDefined, "" ); |
|
93 _LIT8( KNSmlDMImpsNotDefined8, "" ); |
|
94 _LIT8( KNSmlDMImpsIAPUri, "AP" ); |
|
95 _LIT8( KNSmlDMImpsServiceIM, "IM" ); |
|
96 _LIT8( KNSmlDMImpsServicePS, "PS" ); |
|
97 _LIT8( KNSmlDMImpsServiceGR, "GR" ); |
|
98 _LIT8( KNSmlDMImpsConnMOIAPUri, "NAP" ); |
|
99 |
|
100 _LIT8( KNSmlDMImpsRtNode, "AppID/Name/PrefConRef/PrefAddr/Services/AppAuth/Ext"); |
|
101 _LIT8( KNSmlDMAppAuthRtNode, "AAuthLevel/AAuthName/AAuthSecret"); |
|
102 _LIT8( KNSmlDMRtNode8, "AAId1"); |
|
103 _LIT( KNSmlDMRtNode, "AAId1"); |
|
104 |
|
105 _LIT8( KNSmlDMImpsSeparator8, "/" ); |
|
106 _LIT( KNSmlDMImpsSeparator, "/" ); |
|
107 _LIT8( KNSmlImpsUriDotSlash, "./"); |
|
108 _LIT8( KNSmlDMImpsSemiColon, ";"); |
|
109 _LIT( KNSmlDMImpsDefaultName, "default" ); |
|
110 |
|
111 _LIT8( KNSmlDMImpsRootAndDyn, "IMPS/*" ); |
|
112 _LIT8( KNSmlDMImpsWholeAppAuthUri, "IMPS/*/AppAuth" ); |
|
113 _LIT8( KNSmlDMImpsWholeAppAuthDynUri, "IMPS/*/AppAuth/*" ); |
|
114 _LIT8( KNSmlDMImpsWholeExtUri, "IMPS/*/Ext" ); |
|
115 |
|
116 _LIT8( KNSMLDMImpsDynNodeName, "ImpsId" ); |
|
117 _LIT8( KNSmlImpsLine, "-"); |
|
118 |
|
119 // ------------------------------------------------------------------------------------------------ |
|
120 // CNSmlDmImpsAdapter |
|
121 // ------------------------------------------------------------------------------------------------ |
|
122 class CNSmlDmImpsAdapter : public CSmlDmAdapter, public MMsvSessionObserver |
|
123 { |
|
124 public: // Constructors and destructor |
|
125 |
|
126 /** |
|
127 * Two-phased constructors. |
|
128 */ |
|
129 static CNSmlDmImpsAdapter* NewL( MSmlDmCallback* aDmCallback ); |
|
130 static CNSmlDmImpsAdapter* NewLC( MSmlDmCallback* aDmCallback ); |
|
131 |
|
132 /** |
|
133 * Destructor. |
|
134 */ |
|
135 virtual ~CNSmlDmImpsAdapter(); |
|
136 |
|
137 /** |
|
138 * Requests DDF Version |
|
139 * @param aVersion, Reference for version |
|
140 */ |
|
141 void DDFVersionL( CBufBase& aVersion ); |
|
142 |
|
143 /** |
|
144 * Requests DDF Structure |
|
145 * @param aDDF, Reference to root node |
|
146 */ |
|
147 void DDFStructureL( MSmlDmDDFObject& aDDF ); |
|
148 |
|
149 /** |
|
150 * Updates leaf object value |
|
151 * @param aURI, The uri of parameter |
|
152 * @param aLUID, The Luid of Uri |
|
153 * @param aObject, The value for parameter |
|
154 * @param aType, Not used at the moment |
|
155 * @param aStatusRef, Status reference of command |
|
156 */ |
|
157 void UpdateLeafObjectL( const TDesC8& aURI, |
|
158 const TDesC8& aLUID, |
|
159 const TDesC8& aObject, |
|
160 const TDesC8& aType, |
|
161 TInt aStatusRef ); |
|
162 |
|
163 /** |
|
164 * Updates leaf object value |
|
165 * Not used at the moment |
|
166 */ |
|
167 void UpdateLeafObjectL( const TDesC8& aURI, |
|
168 const TDesC8& aLUID, |
|
169 RWriteStream*& aStream, |
|
170 const TDesC8& aType, |
|
171 TInt aStatusRef ); |
|
172 |
|
173 /** |
|
174 * Fetches the leaf object size |
|
175 * @param aURI, The uri of parameter |
|
176 * @param aLUID, The Luid of Uri |
|
177 * @param aType, Not used at the moment |
|
178 * @param aResultsRef, Result reference of command |
|
179 * @param aStatusRef, Status reference of command |
|
180 */ |
|
181 void FetchLeafObjectSizeL( const TDesC8& aURI, |
|
182 const TDesC8& aLUID, |
|
183 const TDesC8& aType, |
|
184 const TInt aResultsRef, |
|
185 const TInt aStatusRef ); |
|
186 |
|
187 /** |
|
188 * Fetches the leaf object value |
|
189 * @param aURI, The uri of parameter |
|
190 * @param aLUID, The Luid of Uri |
|
191 * @param aType, Not used at the moment |
|
192 * @param aResultsRef, Result reference of command |
|
193 * @param aStatusRef, Status reference of command |
|
194 */ |
|
195 void FetchLeafObjectL( const TDesC8& aURI, |
|
196 const TDesC8& aLUID, |
|
197 const TDesC8& aType, |
|
198 TInt aResultsRef, |
|
199 TInt aStatusRef ); |
|
200 |
|
201 /** |
|
202 * Deletes the node or leaf |
|
203 * @param aURI, The uri of parameter |
|
204 * @param aLUID, The Luid of Uri |
|
205 * @param aType, Not used at the moment |
|
206 * @param aResultsRef, Result reference of command |
|
207 * @param aStatusRef, Status reference of command |
|
208 */ |
|
209 void DeleteObjectL( const TDesC8& aURI, |
|
210 const TDesC8& aLUID, |
|
211 TInt aStatusRef ); |
|
212 |
|
213 |
|
214 /** |
|
215 * Requests the child uri list |
|
216 * @param aURI, The uri of parameter |
|
217 * @param aLUID, The Luid of Uri |
|
218 * @param aPreviousURISegmentList, list of previous Uri Segments |
|
219 * @param aResultsRef, Result reference of command |
|
220 * @param aStatusRef, Status reference of command |
|
221 */ |
|
222 void ChildURIListL( const TDesC8& aURI, |
|
223 const TDesC8& aLUID, |
|
224 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
225 TInt aResultsRef, |
|
226 TInt aStatusRef ); |
|
227 |
|
228 /** |
|
229 * Adds new node |
|
230 * @param aURI, The uri of parameter |
|
231 * @param aParentLUID, The Luid of ParentUri |
|
232 * @param aStatusRef, Status reference of command |
|
233 */ |
|
234 void AddNodeObjectL( const TDesC8& aURI, |
|
235 const TDesC8& aParentLUID, |
|
236 TInt aStatusRef ); |
|
237 |
|
238 /** |
|
239 * Following methods are not used at the moment |
|
240 */ |
|
241 void CompleteOutstandingCmdsL(); |
|
242 void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, const TDesC8& aType, const TInt aStatusRef ); |
|
243 void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, RWriteStream*& aStream, const TDesC8& aType, const TInt aStatusRef ); |
|
244 void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, const TDesC8& aSourceURI, const TDesC8& aSourceLUID, const TDesC8& aType, TInt aStatusRef ); |
|
245 void StartAtomicL(); |
|
246 void CommitAtomicL(); |
|
247 void RollbackAtomicL(); |
|
248 TBool StreamingSupport( TInt& aItemSize ); |
|
249 void StreamCommittedL(); |
|
250 |
|
251 protected: |
|
252 |
|
253 /** |
|
254 * From MMsvSessionObserver |
|
255 */ |
|
256 void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3 ); |
|
257 |
|
258 private: |
|
259 |
|
260 /** |
|
261 * Constructors. |
|
262 */ |
|
263 CNSmlDmImpsAdapter(); |
|
264 CNSmlDmImpsAdapter( TAny* aEcomArguments );//new |
|
265 |
|
266 /** |
|
267 * Symbian 2nd phase constructor. |
|
268 */ |
|
269 void ConstructL( MSmlDmCallback* aDmCallback ); |
|
270 |
|
271 /** |
|
272 * Change Descriptor to Int |
|
273 * @param aLuid, Descriptor |
|
274 * @return Integer value |
|
275 */ |
|
276 TInt DesToInt( const TDesC& aLuid ); |
|
277 TInt DesToInt( const TDesC8& aLuid ); |
|
278 |
|
279 /** |
|
280 * Change Int to descriptor |
|
281 * @param aLuid, Integer value |
|
282 * @return Descriptor |
|
283 */ |
|
284 HBufC* IntToDesLC( const TInt aLuid ); |
|
285 HBufC8* IntToDes8LC( const TInt aLuid ); |
|
286 |
|
287 /** |
|
288 * Converts 8 bit descriptor to 16 bit descriptor |
|
289 * @param aSource, source descriptor |
|
290 * @return Destination descriptor |
|
291 */ |
|
292 TDesC8& ConvertTo8LC( const TDesC& aSource ); |
|
293 |
|
294 /** |
|
295 * Converts 16 bit descriptor to 8 bit descriptor |
|
296 * @param aSource, source descriptor |
|
297 * @return Destination descriptor |
|
298 */ |
|
299 TDesC16& ConvertTo16LC( const TDesC8& aSource ); |
|
300 |
|
301 /** |
|
302 * Fill node info |
|
303 * @param aNode, node name |
|
304 * @param aAccTypes, access types |
|
305 * @param aOccurence, occurrence |
|
306 * @param aScope, Dynamic or permanent |
|
307 * @param aFormat, type of leaf |
|
308 * @param aDescription, description of node/leaf |
|
309 */ |
|
310 void FillNodeInfoL( MSmlDmDDFObject& aNode, |
|
311 const TSmlDmAccessTypes aAccTypes, |
|
312 MSmlDmDDFObject::TOccurence aOccurrence, |
|
313 MSmlDmDDFObject::TScope aScope, |
|
314 MSmlDmDDFObject::TDFFormat aFormat, |
|
315 const TDesC8& aDescription ); |
|
316 |
|
317 /** |
|
318 * Find correct SAP from DB and read the data |
|
319 * @param aLUID, SAP uid |
|
320 * @param aSap, place for reading SAP data |
|
321 * @param aStore, variable for rading SAP data |
|
322 * @return error status |
|
323 */ |
|
324 TInt GetCorrectSapL( const TDesC8& aLUID, |
|
325 CIMPSSAPSettings* aSap, |
|
326 CIMPSSAPSettingsStore* aStore ); |
|
327 |
|
328 /** |
|
329 * Reset Sap with empty data |
|
330 * @param aSap, includes the SAP data |
|
331 */ |
|
332 void ResetSapL( CIMPSSAPSettings* aSap ); |
|
333 |
|
334 /** |
|
335 * Update value to SAP data |
|
336 * @param aUri, parameter |
|
337 * @param aObject, parameter value |
|
338 * @param aSap, variable for SAP data |
|
339 * @return error status |
|
340 */ |
|
341 CSmlDmAdapter::TError UpdateValueL( const TDesC8& aUri, |
|
342 const TDesC8& aObject, |
|
343 CIMPSSAPSettings* aSap ); |
|
344 |
|
345 /** |
|
346 * Update PEP value to SAP data |
|
347 * @param aUri, parameter |
|
348 * @param aObject, parameter value |
|
349 * @param aLUID, SAP uid |
|
350 * @param aSap, variable for reading SAP data |
|
351 * @param aStore, used for rading SAP data |
|
352 * @return error status |
|
353 */ |
|
354 CSmlDmAdapter::TError UpdatePEPValueL( const TDesC8& aURI, |
|
355 const TDesC8& aObject, |
|
356 const TDesC8& aLUID, |
|
357 CIMPSSAPSettings* aSap, |
|
358 CIMPSSAPSettingsStore* aStore ); |
|
359 |
|
360 /** |
|
361 * Delete value from SAP data |
|
362 * @param aUri, parameter |
|
363 * @param aSap, variable for reading SAP data |
|
364 * @return error status |
|
365 */ |
|
366 CSmlDmAdapter::TError DeleteValueL( const TDesC8& aUri, |
|
367 CIMPSSAPSettings* aSap ); |
|
368 |
|
369 /** |
|
370 * Fetch object data |
|
371 * @param aUri, parameter |
|
372 * @param aLUID, SAP uid |
|
373 * @param aObject, variable for returning parameter data |
|
374 * @return error status |
|
375 */ |
|
376 CSmlDmAdapter::TError FetchObjectL( const TDesC8& aUri, |
|
377 const TDesC8& aLUID, |
|
378 CBufBase& aObject ); |
|
379 |
|
380 /** |
|
381 * Get Connection Reference |
|
382 * @return accesspoint reference |
|
383 */ |
|
384 const TDesC8& GetConRef() ; |
|
385 |
|
386 |
|
387 private: // Data |
|
388 MSmlDmCallback* iCallBack; |
|
389 /** |
|
390 * Boolean to check FeatMgr Initialization |
|
391 */ |
|
392 TBool iFeatMgrInitialized; |
|
393 }; |
|
394 |
|
395 #endif // __NSMLDMIMPSADAPTER_H__ |
|