46
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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 adapter handling bearer management related settings
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef NSMLDMBMADAPTER_H
|
|
22 |
#define NSMLDMBMADAPTER_H
|
|
23 |
|
|
24 |
#include <smldmadapter.h>
|
|
25 |
|
|
26 |
#include "nsmldmbmsettingstore.h"
|
|
27 |
|
|
28 |
class CSmlDmBmCommandElement;
|
|
29 |
class CSmlDmBmSettingsElement;
|
|
30 |
class CNSmlDmBmSettingStore;
|
|
31 |
|
|
32 |
/** The DDF version must be changed if any changes in DDF structure
|
|
33 |
( built in DDFStructureL() function ) */
|
|
34 |
_LIT8( KNSmlDmBMAdapterDDFVersion, "1.1" );
|
|
35 |
_LIT8( KNSmlDmBMAdapterTextPlain, "text/plain" );
|
|
36 |
|
|
37 |
/** Names of the nodes */
|
|
38 |
/** When updating KNSmlDmBMAdapterBMURI also update
|
|
39 |
KNSmlDmBmAdapterURIMaxLength! */
|
|
40 |
_LIT8(KNSmlDmBMAdapterBMURI, "./BearerManagementSNAP");
|
|
41 |
_LIT8(KNSmlDmBMAdapterBM, "BearerManagementSNAP");
|
|
42 |
_LIT8(KNSmlDmBMAdapterName, "Name");
|
|
43 |
_LIT8(KNSmlDmBMAdapterIAPPriorityList, "IAPPriorityList");
|
|
44 |
_LIT8(KNSmlDmBMAdapterEmbeddedSNAP, "EmbeddedSNAP");
|
|
45 |
_LIT8(KNSmlDmBMAdapterMetadata, "Metadata");
|
|
46 |
_LIT8(KNSmlDmBMAdapterProtected, "Protected");
|
|
47 |
_LIT8(KNSmlDmBMAdapterHidden, "Hidden");
|
|
48 |
|
|
49 |
/** Descriptions of the nodes */
|
|
50 |
_LIT8( KNSmlDmBMAdapterBMDescription,
|
|
51 |
"BearerManagement provides management of Access Point groups (SNAPs)");
|
|
52 |
_LIT8( KNSmlDmBMAdapterDynamicDescription,
|
|
53 |
"Node presents a group of Access Points (SNAP)");
|
|
54 |
_LIT8( KNSmlDmBMAdapterNameDescription,
|
|
55 |
"Name of the Access Point group");
|
|
56 |
_LIT8( KNSmlDmBMAdapterIAPPriorityListDescription,
|
|
57 |
"Comma separated list of Access Point URIs in priority order.");
|
|
58 |
_LIT8( KNSmlDmBMAdapterEmbeddedSNAPDescription,
|
|
59 |
"URI of embedded Access Point group. All Access points of the Embedded \
|
|
60 |
SNAP are seen as also belonging to this SNAP");
|
|
61 |
_LIT8( KNSmlDmBMAdapterMetadataDescription,
|
|
62 |
"32 bit integer representing SNAP metadata. Following bitmasks indicate \
|
|
63 |
meaning of the individual bits: \n 0x00000001 \t Internet: The SNAP is \
|
|
64 |
the Internet SNAP. This may only be set to one SNAP object.\n \
|
|
65 |
0x00000002\tHighlight: SNAP is highlighted in certain UI dialog.\n \
|
|
66 |
0x00000004\tHidden: SNAP is hidden in certain UI dialog.");
|
|
67 |
_LIT8( KNSmlDmBMAdapterProtectedDescription,
|
|
68 |
"SNAP is protected with one of the following protection levels. \
|
|
69 |
Protected object can not be modified without NetworkControl capability \n \
|
|
70 |
0 \t No protection \n 1 \t SNAP and related objects \n \
|
|
71 |
2 \t SNAP name is protected.");
|
|
72 |
_LIT8( KNSmlDmBMAdapterHiddenDescription,
|
|
73 |
"SNAP is set as hidden in the setting store");
|
|
74 |
|
|
75 |
/** Leaf nodes of snap node */
|
|
76 |
_LIT8( KNSmlDmBMAllLeafNodes,
|
|
77 |
"Name/IAPPriorityList/Metadata/Protected/Hidden/EmbeddedSNAP");
|
|
78 |
_LIT8( KNSmlDmBMAllLeafNodesNoEmbedded,
|
|
79 |
"Name/IAPPriorityList/Metadata/Protected/Hidden");
|
|
80 |
|
|
81 |
/** URI of for fetching IAP nodes */
|
|
82 |
/** When updating KNSmlDmBMAdapterIAPURI also update
|
|
83 |
KNSmlDmBmAdapterAPURIMaxLength! */
|
|
84 |
_LIT8( KNSmlDmBMAdapterIAPURI, "./AP" );
|
|
85 |
/** Node name of AP adapter root */
|
|
86 |
_LIT8( KNSmlDmBMAdapterIAPNode, "AP" );
|
|
87 |
/** URI segment separator */
|
|
88 |
/** When updating this literal also update
|
|
89 |
KNSmlDmBmAdapterAPURIMaxLength and KNSmlDmBmAdapterURIMaxLength! */
|
|
90 |
_LIT8( KNSmlDmBmSeparator, "/" );
|
|
91 |
/** URI segment separator */
|
|
92 |
/** When updating KNSmlDmBMAdapterBMURI also update
|
|
93 |
KNSmlDmBmAdapterAPURIMaxLength and KNSmlDmBmAdapterURIMaxLength! */
|
|
94 |
_LIT8( KNSmlDmBmUriListSeparator, "," );
|
|
95 |
/** Prefix in URIs (removed for LUID mapping) */
|
|
96 |
_LIT8( KNSmlDmBmAdapterURIPrefix, "./" );
|
|
97 |
|
|
98 |
/** Name prefix for unnamed snap nodes */
|
|
99 |
_LIT8( KNSmlDmBMSNAPNamePrefix, "SNAP" );
|
|
100 |
_LIT8( KNSmlDmBMBooleanTrue, "True" );
|
|
101 |
_LIT8( KNSmlDmBMBooleanFalse, "False" );
|
|
102 |
|
|
103 |
|
|
104 |
const TInt KNSmlDmBMGranularity = 4;
|
|
105 |
const TInt KNsmlDmBmSNAPNodeDepth = 2;
|
|
106 |
const TInt KNSmlDmBmInvalidRef = -1;
|
|
107 |
|
|
108 |
/** Maximum length of snap URI including a separator character in URI List.
|
|
109 |
Node is not calculated here. KNSmlDmBMAdapterBMURI + KNSmlDmBmSeparator +
|
|
110 |
KNSmlDmBmUriListSeparator
|
|
111 |
*/
|
|
112 |
const TInt KNSmlDmBmAdapterURIMaxLength = 24;
|
|
113 |
|
|
114 |
/** Maximum length of AP URI including a separator character in URI List.
|
|
115 |
Node is not calculated here. KNSmlDmBMAdapterIAPURI + KNSmlDmBmSeparator +
|
|
116 |
KNSmlDmBmUriListSeparator
|
|
117 |
*/
|
|
118 |
const TInt KNSmlDmBmAdapterAPURIMaxLength = 6;
|
|
119 |
|
|
120 |
/** Maximum length of 32bit integer */
|
|
121 |
const TInt KMaxLengthOf32bitInteger = 10;
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Bearer Management device management adapter
|
|
125 |
*
|
|
126 |
* Bearer Management device management adapter manages settings
|
|
127 |
* related to Service Network Access Points (SNAPs) which are
|
|
128 |
* used for groupin IAPs
|
|
129 |
*
|
|
130 |
* @lib nsmldmbmadapter
|
|
131 |
* @since S60 v3.2
|
|
132 |
*/
|
|
133 |
class CNSmlDmBmAdapter : public CSmlDmAdapter
|
|
134 |
{
|
|
135 |
|
|
136 |
public:
|
|
137 |
|
|
138 |
/** Possible command types */
|
|
139 |
enum TCommandType
|
|
140 |
{
|
|
141 |
EAddCmd,
|
|
142 |
EGetCmd,
|
|
143 |
EGetSizeCmd,
|
|
144 |
EDeleteCmd
|
|
145 |
};
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Two-phased constructor.
|
|
149 |
*/
|
|
150 |
static CNSmlDmBmAdapter* NewL( MSmlDmCallback* aDmCallback );
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Destructor.
|
|
154 |
*/
|
|
155 |
virtual ~CNSmlDmBmAdapter();
|
|
156 |
|
|
157 |
|
|
158 |
// from base class CSmlDmAdapter
|
|
159 |
|
|
160 |
/**
|
|
161 |
* The function returns current version of the DDF.
|
|
162 |
*
|
|
163 |
* @since S60 v3.2
|
|
164 |
* @param aDDFVersion DDF version of the
|
|
165 |
* adapter. (filled by the adapter)
|
|
166 |
*/
|
|
167 |
void DDFVersionL( CBufBase& aDDFVersion );
|
|
168 |
|
|
169 |
/**
|
|
170 |
* The function for filling the DDF structure of the adapter
|
|
171 |
*
|
|
172 |
* @since S60 v3.2
|
|
173 |
* @param aDDF Reference to root object.
|
|
174 |
*/
|
|
175 |
void DDFStructureL( MSmlDmDDFObject& aDDF );
|
|
176 |
|
|
177 |
/**
|
|
178 |
* The function creates new leaf objects, or replaces data in existing
|
|
179 |
* leaf objects. The information about the success of the command is
|
|
180 |
* returned by calling SetStatusL function of MSmlDmCallback callback
|
|
181 |
* interface.
|
|
182 |
*
|
|
183 |
* @since S60 v3.2
|
|
184 |
* @param aURI URI of the object
|
|
185 |
* @param aLUID LUID of the object
|
|
186 |
* @param aObject Data of the object.
|
|
187 |
* @param aType MIME type of the object
|
|
188 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
189 |
* must be used when calling the SetStatusL of this
|
|
190 |
* command
|
|
191 |
*/
|
|
192 |
void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
193 |
const TDesC8& aObject, const TDesC8& aType,
|
|
194 |
TInt aStatusRef );
|
|
195 |
/**
|
|
196 |
* The function deletes an object and its child objects.
|
|
197 |
*
|
|
198 |
* @since S60 v3.2
|
|
199 |
* @param aURI URI of the object
|
|
200 |
* @param aLUID LUID of the object (if the adapter have earlier
|
|
201 |
* returned LUID to the DM Module).
|
|
202 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
203 |
* must be used when calling the SetStatusL of this
|
|
204 |
* command.
|
|
205 |
*/
|
|
206 |
void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
207 |
TInt aStatusRef );
|
|
208 |
|
|
209 |
/**
|
|
210 |
* The function fetches data of a leaf object. The SetStatusL is used
|
|
211 |
* as described in UpdateLeafObjectL(). The data is returned by using the
|
|
212 |
* SetResultsL function of MSmlCallback callback interface.
|
|
213 |
*
|
|
214 |
* @since S60 v3.2
|
|
215 |
* @param aURI URI of the object
|
|
216 |
* @param aLUID LUID of the object (if the adapter have
|
|
217 |
* earlier returned LUID to the DM Module).
|
|
218 |
* @param aType MIME type of the object
|
|
219 |
* @param aResultsRef Reference to correct results, i.e. this
|
|
220 |
* reference must be used when returning the
|
|
221 |
* result by calling the SetResultsL.
|
|
222 |
* @param aStatusRef Reference to correct command, i.e. this
|
|
223 |
* reference must be used when calling the
|
|
224 |
* SetStatusL of this command.
|
|
225 |
*/
|
|
226 |
void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
227 |
const TDesC8& aType, TInt aResultsRef,
|
|
228 |
TInt aStatusRef );
|
|
229 |
|
|
230 |
/**
|
|
231 |
* The function fetches the size of the data of a leaf object. The size
|
|
232 |
* is in bytes, and must reflect the number of bytes that will be
|
|
233 |
* transferred when the framework calls FetchLeafObjectL.
|
|
234 |
*
|
|
235 |
* @since S60 v3.2
|
|
236 |
* @param aURI URI of the object
|
|
237 |
* @param aLUID LUID of the object (if the adapter have
|
|
238 |
* earlier returned LUID to the DM Module).
|
|
239 |
* @param aType MIME type of the object
|
|
240 |
* @param aResultsRef Reference to correct results, i.e. this
|
|
241 |
* reference must be used when returning the
|
|
242 |
* result by calling the SetResultsL.
|
|
243 |
* @param aStatusRef Reference to correct command, i.e. this
|
|
244 |
* reference must be used when calling the
|
|
245 |
* SetStatusL of this command.
|
|
246 |
*/
|
|
247 |
void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
248 |
const TDesC8& aType, TInt aResultsRef,
|
|
249 |
TInt aStatusRef );
|
|
250 |
|
|
251 |
/**
|
|
252 |
* The function fetches URI list. An adapter returns the list of URI
|
|
253 |
* segments under the given URI be separated by slash ("/"). The URI
|
|
254 |
* segment names for new objects must be given by the adapter.
|
|
255 |
* The list is returned by calling the SetResultsL function of
|
|
256 |
* MSmlCallback callback interface.
|
|
257 |
*
|
|
258 |
* @since S60 v3.2
|
|
259 |
* @param aURI URI of the parent object
|
|
260 |
* @param aLUID LUID of the parent object (if the
|
|
261 |
* adapter have earlier returned LUID to
|
|
262 |
* the DM Module).
|
|
263 |
* @param aPreviousURISegmentList URI list with mapping LUID
|
|
264 |
* information, which is known by DM
|
|
265 |
* engine.
|
|
266 |
* @param aResultsRef Reference to correct results, i.e.
|
|
267 |
* this reference must be used when
|
|
268 |
* returning the result by calling the
|
|
269 |
* SetResultsL.
|
|
270 |
* @param aStatusRef Reference to correct command, i.e.
|
|
271 |
* this reference must be used when
|
|
272 |
* calling the SetStatusL of this
|
|
273 |
* command.
|
|
274 |
*/
|
|
275 |
void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
276 |
const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
|
|
277 |
TInt aResultsRef, TInt aStatusRef );
|
|
278 |
|
|
279 |
/**
|
|
280 |
* The function adds node object.
|
|
281 |
*
|
|
282 |
* @since S60 v3.2
|
|
283 |
* @param aURI URI of the object
|
|
284 |
* @param aParentLUID LUID of the parent object (if the adapter have
|
|
285 |
* earlier returned LUID to the DM Module).
|
|
286 |
* @param aStatusRef Reference to correct command, i.e. this
|
|
287 |
* reference must be used when calling the
|
|
288 |
* SetStatusL of this command.
|
|
289 |
*/
|
|
290 |
void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID,
|
|
291 |
TInt aStatusRef );
|
|
292 |
/**
|
|
293 |
* The adapter does not support streaming and no implementation is
|
|
294 |
* provided for this function.
|
|
295 |
*
|
|
296 |
* @since S60 v3.2
|
|
297 |
* @param aURI URI of the object
|
|
298 |
* @param aLUID LUID of the object
|
|
299 |
* @param aStream Data of the object.
|
|
300 |
* @param aType MIME type of the object
|
|
301 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
302 |
* must be used when calling the SetStatusL of this
|
|
303 |
* command.
|
|
304 |
*/
|
|
305 |
void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
306 |
RWriteStream*& aStream, const TDesC8& aType,
|
|
307 |
TInt aStatusRef );
|
|
308 |
/**
|
|
309 |
* The adapter does not support execute command and does not
|
|
310 |
* provide implementation for this function.
|
|
311 |
*
|
|
312 |
* @since S60 v3.2
|
|
313 |
* @param aURI URI of the command
|
|
314 |
* @param aLUID LUID of the object
|
|
315 |
* @param aArgument Argument for the command
|
|
316 |
* @param aType MIME type of the object
|
|
317 |
* @param aStatusRef Reference to correct command, i.e. this
|
|
318 |
* reference must be used when calling the
|
|
319 |
* SetStatusL of this command.
|
|
320 |
*/
|
|
321 |
void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
322 |
const TDesC8& aArgument, const TDesC8& aType,
|
|
323 |
TInt aStatusRef );
|
|
324 |
/**
|
|
325 |
* The adapter does not support execute command and does not
|
|
326 |
* provide implementation for this function.
|
|
327 |
*
|
|
328 |
* @since S60 v3.2
|
|
329 |
* @param aURI URI of the command
|
|
330 |
* @param aLUID LUID of the object
|
|
331 |
* @param aStream Argument for the command.
|
|
332 |
* @param aType MIME type of the object
|
|
333 |
* @param aStatusRef Reference to correct command, i.e. this
|
|
334 |
* reference must be used when calling the
|
|
335 |
* SetStatusL of this command.
|
|
336 |
*/
|
|
337 |
void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
338 |
RWriteStream*& aStream, const TDesC8& aType,
|
|
339 |
TInt aStatusRef );
|
|
340 |
/**
|
|
341 |
* The adapter does not support copy command and does not
|
|
342 |
* provide implementation for this function.
|
|
343 |
*
|
|
344 |
* @since S60 v3.2
|
|
345 |
* @param aTargetURI Target URI for the command
|
|
346 |
* @param aTargetLUID LUID of the target object
|
|
347 |
* @param aSourceURI Source URI for the command
|
|
348 |
* @param aSourceLUID LUID of the source object
|
|
349 |
* @param aType MIME type of the objects
|
|
350 |
* @param aStatusRef Reference to correct command, i.e. this
|
|
351 |
* reference must be used when calling the
|
|
352 |
* SetStatusL of this command.
|
|
353 |
*/
|
|
354 |
void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID,
|
|
355 |
const TDesC8& aSourceURI, const TDesC8& aSourceLUID,
|
|
356 |
const TDesC8& aType, TInt aStatusRef );
|
|
357 |
/**
|
|
358 |
* Not supported
|
|
359 |
* @since S60 v3.2
|
|
360 |
*/
|
|
361 |
void StartAtomicL();
|
|
362 |
/**
|
|
363 |
* Not Supported
|
|
364 |
* @since S60 v3.2
|
|
365 |
*
|
|
366 |
*/
|
|
367 |
void CommitAtomicL();
|
|
368 |
/**
|
|
369 |
* Not supported.
|
|
370 |
* @since S60 v3.2
|
|
371 |
*/
|
|
372 |
void RollbackAtomicL();
|
|
373 |
/**
|
|
374 |
* Returns EFalse as the adapter does not support streaming
|
|
375 |
*
|
|
376 |
* @since S60 v3.2
|
|
377 |
* @param aItemSize size limit for stream usage
|
|
378 |
* @return TBool EFalse as streaming is not supported
|
|
379 |
*/
|
|
380 |
TBool StreamingSupport( TInt& aItemSize );
|
|
381 |
/**
|
|
382 |
* Not supported
|
|
383 |
*
|
|
384 |
* @since S60 v3.2
|
|
385 |
*/
|
|
386 |
void StreamCommittedL();
|
|
387 |
/**
|
|
388 |
* The function tells the adapter that all the commands of the message
|
|
389 |
* that can be passed to the adapter have now been passed. This
|
|
390 |
* indciates that the adapter must supply status codes and results to
|
|
391 |
* any buffered commands. This must be done at latest by the time this
|
|
392 |
* function returns. This function is used at the end of SyncML messages,
|
|
393 |
* and during processing of Atomic.
|
|
394 |
*
|
|
395 |
* @since S60 v3.2
|
|
396 |
*/
|
|
397 |
void CompleteOutstandingCmdsL();
|
|
398 |
|
|
399 |
/**
|
|
400 |
* Function checks if a SNAP with the argument URI is buffered for
|
|
401 |
* later handling. If so, the function calls iSettingStore object
|
|
402 |
* to store the SNAP. This function is called by the iSettingStore
|
|
403 |
* object to check whether EmbeddedSNAP node referenced by a command is
|
|
404 |
* still in the buffer and needs to be stored first.
|
|
405 |
*
|
|
406 |
* @since S60 v3.2
|
|
407 |
* @param aURI Descriptor containing the SNAP URI
|
|
408 |
*/
|
|
409 |
void StoreSnapIfBufferedL( const TDesC8& aURI );
|
|
410 |
|
|
411 |
|
|
412 |
/**
|
|
413 |
* Function returns a pointer to a HBufC object containing a SNAP URI
|
|
414 |
* which correcponds to the argument LUID.
|
|
415 |
*
|
|
416 |
* @since S60 v3.2
|
|
417 |
* @param aSnapId LUID of SNAP object
|
|
418 |
* @return Descriptor containing the SNAP URI.
|
|
419 |
*/
|
|
420 |
HBufC8* GetSnapUriFromLuidL( const TUint aSnapId );
|
|
421 |
|
|
422 |
|
|
423 |
/**
|
|
424 |
* Function returns a pointer to HBufC object containing a
|
|
425 |
* comma separated list of IAP URIs according to the IAP LUIDs
|
|
426 |
* contained in the argument array.
|
|
427 |
*
|
|
428 |
* @since S60 v3.2
|
|
429 |
* @param aIdArray Array of IAP LUIDs for which the URI list is formed.
|
|
430 |
* @return HBufC object containing a comma separated list of IAP URIs
|
|
431 |
*/
|
|
432 |
HBufC8* GetIapListL( const RArray<TUint>& aIdArray );
|
|
433 |
|
|
434 |
|
|
435 |
/**
|
|
436 |
* Function returns an array containing the LUIDs of IAP URIs listed in
|
|
437 |
* argument descriptor.
|
|
438 |
*
|
|
439 |
* @since S60 v3.2
|
|
440 |
* @param aIAPList TDesC object containing a comma separated list of IAP
|
|
441 |
* URIs
|
|
442 |
* @return Array of IAP LUIDs that correspond to the argument URI list.
|
|
443 |
*/
|
|
444 |
RArray<TUint> GetIdArrayL( const TDesC8& aIAPList);
|
|
445 |
|
|
446 |
|
|
447 |
/**
|
|
448 |
* Converts integer to 8bit descriptor
|
|
449 |
*
|
|
450 |
* @since S60 v3.2
|
|
451 |
* @param aLuid The integer to be converted
|
|
452 |
* @return The Integer as a descriptor
|
|
453 |
*/
|
|
454 |
HBufC8* IntToDes8L( TInt aLuid) const;
|
|
455 |
|
|
456 |
/**
|
|
457 |
* Converts 8bit descriptor to integer
|
|
458 |
*
|
|
459 |
* @since S60 v3.2
|
|
460 |
* @param aLuid The descriptor to be converted
|
|
461 |
* @return Integer value of the descriptor
|
|
462 |
*/
|
|
463 |
TUint DesToIntL(const TDesC8& aLuid) const;
|
|
464 |
|
|
465 |
/**
|
|
466 |
* Converts 8bit descriptor to a boolean value
|
|
467 |
* @since S60 v3.2
|
|
468 |
* @param aBoolDes The descriptor to be converted
|
|
469 |
* @param aBool A pointer to a boolean where result is stored
|
|
470 |
* @return ETrue if conversion was succesful, otherwise EFalse
|
|
471 |
*/
|
|
472 |
TBool DesToBool(const TDesC8& aBoolDes, TBool& aBool ) const;
|
|
473 |
|
|
474 |
/**
|
|
475 |
* Converts boolean value to 8bit descriptor
|
|
476 |
* @since S60 v3.2
|
|
477 |
* @param aBool The boolean value to be converted
|
|
478 |
* @return The boolean value as a descriptor
|
|
479 |
*/
|
|
480 |
HBufC8* BoolToDes8LC( TBool aBool) const;
|
|
481 |
|
|
482 |
|
|
483 |
/**
|
|
484 |
* The function calls the GetLuidAllocL function of the MSmlDmCallback to
|
|
485 |
* get the LUID which is mapped to aURI. This function LUID is not found,
|
|
486 |
* the function allocates a null length string, i.e. the function
|
|
487 |
* allocates memory in every case.
|
|
488 |
* @since S60 v3.2
|
|
489 |
* @param aURI URI of the object.
|
|
490 |
*/
|
|
491 |
HBufC8* GetLuidAllocL( const TDesC8& aURI );
|
|
492 |
|
|
493 |
private:
|
|
494 |
|
|
495 |
/**
|
|
496 |
* Constructor
|
|
497 |
*/
|
|
498 |
CNSmlDmBmAdapter();
|
|
499 |
|
|
500 |
/**
|
|
501 |
* Constructor
|
|
502 |
* @param aDmCallback Callback object to the framework
|
|
503 |
*/
|
|
504 |
CNSmlDmBmAdapter( MSmlDmCallback* aDmCallback );
|
|
505 |
|
|
506 |
/**
|
|
507 |
* Second phase constructor
|
|
508 |
*/
|
|
509 |
void ConstructL();
|
|
510 |
|
|
511 |
|
|
512 |
/**
|
|
513 |
* Searches the buffer for a SNAP with the parameter mapping name
|
|
514 |
* @param aMappingName Mapping Name of this SNAP
|
|
515 |
* @return Pointer to the CSmlDmBmSettingsElement object in buffer.
|
|
516 |
* The object is owned by the CNSmlDmBmAdapter.
|
|
517 |
*/
|
|
518 |
CSmlDmBmSettingsElement* GetSnapIfBuffered( const TDesC8& aMappingName);
|
|
519 |
|
|
520 |
/**
|
|
521 |
* Returns the first URI from a list of URIs
|
|
522 |
* @param aURIList Comma separated list of URIs
|
|
523 |
* @return The first URI
|
|
524 |
*/
|
|
525 |
TPtrC8 FirstURI(const TDesC8& aURIList) const;
|
|
526 |
|
|
527 |
/**
|
|
528 |
* Returns the number of URIs in a list of URIs
|
|
529 |
* @param aURIList Comma-separated list of URIs
|
|
530 |
* @return Number of URIs in the list.
|
|
531 |
*/
|
|
532 |
TInt NumOfURIs(const TDesC8& aURIList) const;
|
|
533 |
|
|
534 |
|
|
535 |
/**
|
|
536 |
* Removes the first URI from a list of URIs
|
|
537 |
* @param aURIList Comma separated list of URIs
|
|
538 |
* @return The first URI
|
|
539 |
*/
|
|
540 |
TPtrC8 RemoveFirstURI(const TDesC8& aURI) const;
|
|
541 |
|
|
542 |
/**
|
|
543 |
* Parses the last URI segment from URI
|
|
544 |
* @param aURI The whole URI
|
|
545 |
* @return The last URI segment
|
|
546 |
*/
|
|
547 |
TPtrC8 LastURISeg(const TDesC8& aURI) const;
|
|
548 |
|
|
549 |
/**
|
|
550 |
* Removes the last URI segment from URI
|
|
551 |
* @param aURI The whole URI
|
|
552 |
* @return The aURI without the last URI segment
|
|
553 |
*/
|
|
554 |
TPtrC8 RemoveLastURISeg(const TDesC8& aURI) const;
|
|
555 |
|
|
556 |
/**
|
|
557 |
* Calculates the number of URI segments
|
|
558 |
* @param aURI The whole URI
|
|
559 |
* @return The number of URI segments
|
|
560 |
*/
|
|
561 |
TInt NumOfURISegs(const TDesC8& aURI) const;
|
|
562 |
|
|
563 |
/**
|
|
564 |
* Checks if the URI refers to predefined SNAP (of format SNAPx) in which
|
|
565 |
* case operations should be successful even if passed LUID is empty.
|
|
566 |
* Maps the URI to found id.
|
|
567 |
* @param aURI The whole URI
|
|
568 |
* @param aLUID LUID
|
|
569 |
* @return The SNAP ID if found
|
|
570 |
*/
|
|
571 |
TInt MapPredefinedSnapsL( const TDesC8& aURI, const TDesC8& aLUID );
|
|
572 |
|
|
573 |
/**
|
|
574 |
* Tries to find predefined URI string (SNAPx) fronm input
|
|
575 |
* returns the ID.
|
|
576 |
* @param aURI The whole URI
|
|
577 |
* @return The SNAP ID if found
|
|
578 |
*/
|
|
579 |
TInt GetPredefinedSnapIdFromUri( const TDesC8& aURI ) const;
|
|
580 |
|
|
581 |
private: //data
|
|
582 |
|
|
583 |
/**
|
|
584 |
* Buffered commands. Contains a CSmlDmBmSettingsElement object
|
|
585 |
* for each SNAP. THese in turn contain commands for the SNAP.
|
|
586 |
*/
|
|
587 |
RPointerArray<CSmlDmBmSettingsElement> iBuffer;
|
|
588 |
|
|
589 |
/**
|
|
590 |
* Setting store object, which is called for managing settings
|
|
591 |
* in CommsDat. Own.
|
|
592 |
*/
|
|
593 |
CNSmlDmBmSettingStore * iSettingStore;
|
|
594 |
|
|
595 |
/**
|
|
596 |
* CmManager object for SNAP existence checking for
|
|
597 |
* direct accesses to pre-defined SNAPs
|
|
598 |
*/
|
|
599 |
RCmManagerExt iCmManagerExt;
|
|
600 |
|
|
601 |
};
|
|
602 |
|
|
603 |
|
|
604 |
/**
|
|
605 |
* CSmlDmBmCommandElement
|
|
606 |
*
|
|
607 |
* Helper class, which stores a single buffered command for a SNAP.
|
|
608 |
* @lib nsmldmbmadapter
|
|
609 |
* @since S60 v3.2
|
|
610 |
*/
|
|
611 |
|
|
612 |
class CSmlDmBmCommandElement : public CBase
|
|
613 |
{
|
|
614 |
|
|
615 |
public:
|
|
616 |
|
|
617 |
/**
|
|
618 |
* Two-phased constructor.
|
|
619 |
*/
|
|
620 |
static CSmlDmBmCommandElement* NewLC( TBool aLeaf,
|
|
621 |
TInt aStatusRef,
|
|
622 |
TInt aResultRef,
|
|
623 |
CNSmlDmBmAdapter::TCommandType aCmdType,
|
|
624 |
const TDesC8& aLastUriSeg,
|
|
625 |
const TDesC8& aData );
|
|
626 |
|
|
627 |
/**
|
|
628 |
* Destructor.
|
|
629 |
*/
|
|
630 |
~CSmlDmBmCommandElement();
|
|
631 |
|
|
632 |
/**
|
|
633 |
* Returns the iExecuted member value of the object
|
|
634 |
*
|
|
635 |
* @since S60 v3.2
|
|
636 |
* @return The iExecuted member value of the object
|
|
637 |
*/
|
|
638 |
inline TBool Executed();
|
|
639 |
|
|
640 |
/**
|
|
641 |
* Sets the iExecuted member value of the object
|
|
642 |
*
|
|
643 |
* @since S60 v3.2
|
|
644 |
* @param aExecuted Executed value for the object.
|
|
645 |
*/
|
|
646 |
inline void SetExecuted( TBool aExecuted );
|
|
647 |
|
|
648 |
/**
|
|
649 |
* Returns the iStatus member value of the object
|
|
650 |
*
|
|
651 |
* @since S60 v3.2
|
|
652 |
* @return The iStatus value of the object
|
|
653 |
*/
|
|
654 |
inline CSmlDmAdapter::TError Status();
|
|
655 |
|
|
656 |
/**
|
|
657 |
* Sets the iStatus member value of the object
|
|
658 |
*
|
|
659 |
* @since S60 v3.2
|
|
660 |
* @param aStatus Status value for the object.
|
|
661 |
*/
|
|
662 |
inline void SetStatus( CSmlDmAdapter::TError aStatus );
|
|
663 |
|
|
664 |
/**
|
|
665 |
* Returns the iLeaf member value of the object
|
|
666 |
*
|
|
667 |
* @since S60 v3.2
|
|
668 |
* @return The iLeaf member value of the object
|
|
669 |
*/
|
|
670 |
inline TBool Leaf();
|
|
671 |
|
|
672 |
/**
|
|
673 |
* Returns the iStatusRef member value of the object
|
|
674 |
*
|
|
675 |
* @since S60 v3.2
|
|
676 |
* @return The iStatusRef member value of the object
|
|
677 |
*/
|
|
678 |
inline TInt StatusRef();
|
|
679 |
|
|
680 |
/**
|
|
681 |
* Returns the iResultRef member value of the object
|
|
682 |
*
|
|
683 |
* @since S60 v3.2
|
|
684 |
* @return The iResultRef member value of the object
|
|
685 |
*/
|
|
686 |
inline TInt ResultRef();
|
|
687 |
|
|
688 |
/**
|
|
689 |
* Returns the iCmdType member value of the object
|
|
690 |
*
|
|
691 |
* @since S60 v3.2
|
|
692 |
* @return The iCmdType member value of the object
|
|
693 |
*/
|
|
694 |
inline CNSmlDmBmAdapter::TCommandType CmdType();
|
|
695 |
|
|
696 |
/**
|
|
697 |
* Returns the iData member value of the object
|
|
698 |
*
|
|
699 |
* @since S60 v3.2
|
|
700 |
* @return The iData member value of the object
|
|
701 |
*/
|
|
702 |
inline const HBufC8* Data();
|
|
703 |
|
|
704 |
/**
|
|
705 |
* Returns the iLastUriSeg member value of the object
|
|
706 |
*
|
|
707 |
* @since S60 v3.2
|
|
708 |
* @return The iLastUriSeg member value of the object
|
|
709 |
*/
|
|
710 |
inline const HBufC8* LastUriSeg();
|
|
711 |
|
|
712 |
/**
|
|
713 |
* Sets the iData member value of the object
|
|
714 |
*
|
|
715 |
* @since S60 v3.2
|
|
716 |
* @param aData Data set to the object. The data will be owned by
|
|
717 |
* the command object.
|
|
718 |
*/
|
|
719 |
inline void SetDataL( const TDesC8& aData );
|
|
720 |
|
|
721 |
private:
|
|
722 |
|
|
723 |
CSmlDmBmCommandElement( TBool aLeaf,
|
|
724 |
TInt aStatusRef,
|
|
725 |
TInt aResultRef,
|
|
726 |
CNSmlDmBmAdapter::TCommandType aCmdType );
|
|
727 |
|
|
728 |
void ConstructL( const TDesC8& aLastUriSeg, const TDesC8& aData );
|
|
729 |
|
|
730 |
|
|
731 |
private: //data
|
|
732 |
|
|
733 |
/**
|
|
734 |
* Has command been executed.
|
|
735 |
* Set to ETrue when command is executed.
|
|
736 |
*/
|
|
737 |
TBool iExecuted;
|
|
738 |
|
|
739 |
/**
|
|
740 |
* The execution status of an exeuted command.
|
|
741 |
* Filled in when command is executed.
|
|
742 |
*/
|
|
743 |
CSmlDmAdapter::TError iStatus;
|
|
744 |
|
|
745 |
|
|
746 |
/**
|
|
747 |
* True if commend is for a leaf node, False if it is for a Snap node.
|
|
748 |
*/
|
|
749 |
const TBool iLeaf;
|
|
750 |
|
|
751 |
/**
|
|
752 |
* Reference for returning the status to DM framework.
|
|
753 |
*/
|
|
754 |
const TInt iStatusRef;
|
|
755 |
|
|
756 |
/**
|
|
757 |
* Reference for returning result of Get command to the DM framework.
|
|
758 |
*/
|
|
759 |
const TInt iResultRef;
|
|
760 |
|
|
761 |
/**
|
|
762 |
* Type of command.
|
|
763 |
*/
|
|
764 |
const CNSmlDmBmAdapter::TCommandType iCmdType;
|
|
765 |
|
|
766 |
|
|
767 |
/**
|
|
768 |
* Data which is either ment to be stored to setting store
|
|
769 |
* or which has been fetched from there.
|
|
770 |
*/
|
|
771 |
HBufC8* iData;
|
|
772 |
|
|
773 |
/**
|
|
774 |
* Last segment in the command URI, which indicates the leaf node
|
|
775 |
* in question. For non leaf command empty string.
|
|
776 |
*/
|
|
777 |
HBufC8* iLastUriSeg;
|
|
778 |
|
|
779 |
};
|
|
780 |
|
|
781 |
|
|
782 |
/**
|
|
783 |
* CSmlDmBmSettingsElement
|
|
784 |
*
|
|
785 |
* Helper class which stores information of a single SNAP object
|
|
786 |
* into buffer. Contains the buffered commands for the
|
|
787 |
* SNAP as a list of CSmlBmCommandElement objects.
|
|
788 |
*
|
|
789 |
* @lib nsmldmbmadapter
|
|
790 |
* @since S60 v3.2
|
|
791 |
*/
|
|
792 |
|
|
793 |
class CSmlDmBmSettingsElement : public CBase
|
|
794 |
{
|
|
795 |
|
|
796 |
public:
|
|
797 |
|
|
798 |
/**
|
|
799 |
* Two-phased constructor.
|
|
800 |
*/
|
|
801 |
static CSmlDmBmSettingsElement* NewLC( const TDesC8& aMappingName );
|
|
802 |
|
|
803 |
/**
|
|
804 |
* Destructor.
|
|
805 |
*/
|
|
806 |
~CSmlDmBmSettingsElement();
|
|
807 |
|
|
808 |
/**
|
|
809 |
* Returns a reference to iNodeBuf member.
|
|
810 |
* @since S60 v3.2
|
|
811 |
* @return Reference to iNodeBuf member of the object
|
|
812 |
*/
|
|
813 |
inline RPointerArray<CSmlDmBmCommandElement>& NodeBuf();
|
|
814 |
|
|
815 |
/**
|
|
816 |
* Returns the iMappingName member value.
|
|
817 |
* @since S60 v3.2
|
|
818 |
* @return The iMappingName member value of the object
|
|
819 |
*/
|
|
820 |
inline const HBufC8* MappingName();
|
|
821 |
|
|
822 |
/**
|
|
823 |
* Returns the iExecuted member value.
|
|
824 |
* @since S60 v3.2
|
|
825 |
* @return The iExecuted member value of the object
|
|
826 |
*/
|
|
827 |
inline TBool Executed();
|
|
828 |
|
|
829 |
/**
|
|
830 |
* Sets the iExecuted member value.
|
|
831 |
* @since S60 v3.2
|
|
832 |
* @param aExecuted Value for the iExecuted member of the object
|
|
833 |
*/
|
|
834 |
inline void SetExecuted( TBool aExecuted );
|
|
835 |
|
|
836 |
/**
|
|
837 |
* Returns the iLuid member value.
|
|
838 |
* @since S60 v3.2
|
|
839 |
* @return The iLuid member value of the object
|
|
840 |
*/
|
|
841 |
inline TInt Luid();
|
|
842 |
|
|
843 |
/**
|
|
844 |
* Sets the iLuid member value.
|
|
845 |
* @since S60 v3.2
|
|
846 |
* @param aLuid Value for the iLuid member of the object
|
|
847 |
*/
|
|
848 |
inline void SetLuid( TInt aLuid );
|
|
849 |
|
|
850 |
|
|
851 |
private:
|
|
852 |
|
|
853 |
CSmlDmBmSettingsElement();
|
|
854 |
|
|
855 |
void ConstructL( const TDesC8& aMappingName );
|
|
856 |
|
|
857 |
private: //data
|
|
858 |
|
|
859 |
/**
|
|
860 |
* Buffer of commands for this SNAP object. Commands
|
|
861 |
* are added as they come in from the framework and
|
|
862 |
* executed by the setting store.
|
|
863 |
*/
|
|
864 |
RPointerArray<CSmlDmBmCommandElement> iNodeBuf;
|
|
865 |
|
|
866 |
/**
|
|
867 |
* Indicates whether commands for this SNAP have been executed.
|
|
868 |
* Set to Erue by CNsmlDmBmSettingStore when object is handled.
|
|
869 |
*/
|
|
870 |
TBool iExecuted;
|
|
871 |
|
|
872 |
/**
|
|
873 |
* LUID (Local UID) is the CommsDat id of the SNAP node. This is
|
|
874 |
* filled in when SNAP object is created in CommsDat.
|
|
875 |
*/
|
|
876 |
TInt iLuid;
|
|
877 |
|
|
878 |
/**
|
|
879 |
* Mapping name of this SNAP node. This is mapped to the
|
|
880 |
* iLuid when the Snap is created and has id.
|
|
881 |
*/
|
|
882 |
HBufC8* iMappingName;
|
|
883 |
};
|
|
884 |
|
|
885 |
#include "nsmldmbmadapter.inl"
|
|
886 |
|
|
887 |
#endif // NSMLDMBMADAPTER_H
|