2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Definition of dm constants/exported methods
15 * This is part of remotemgmt_plat.
19 #ifndef __SMLDMADAPTER_H__
20 #define __SMLDMADAPTER_H__
23 #include <ecom/ecom.h>
25 class MSmlDmDDFObject;
29 /** ECOM interface uid for DM plugin adapters */
30 #define KSmlDMInterfaceUid 0x102018B4
32 /** Maximum length of a URI segment supported by the DM framework */
33 #define KSmlMaxURISegLen 32
35 struct TSmlDmMappingInfo
37 The struct combines an URI segment to a LUID in a device.
42 /** The URI segment. When using this structure, a path of the URI segment must be known */
43 TBufC8<KSmlMaxURISegLen> iURISeg;
45 /** Local UID in the device */
51 Abstract Device Management adapter. Implementations of this interface are able to map settings
52 in device stores to portions of the Device Management Tree.
59 /** An enumeration of the error codes which may be returned by DM adapters.
65 /** The command was successful */
67 /** The command failed because no setting exists in the store which corresponds to the
68 URI or LUID passed to the adapter */
70 /** The command failed because the setting can't take the value being passed to the adapter */
72 /** The command failed because the setting already exists in the store */
74 /** The command failed because the setting value is too large to be accommodated in the store */
76 /** The command failed because the disk on which the device store resides is full */
78 /** The command failed for an unspecified reason */
80 /** The command could not be rolled back successfully */
82 /** The command failed because the setting is being used by another client */
84 /** The command failed because no memory could be allocated */
86 /** The command succesfully committed */
88 /** The command rolled back succesfully */
90 /** The commit of command failed */
93 EAcceptedForProcessing,
99 EExecAltDwnldAuthFail,
103 EExecPkgValidationFail,
106 EExecDeactivateFailed,
109 EExecOperationReject,
110 EExecAltDwnldSrvError,
111 EExecAltDwnldSrvUnavailable
117 The function returns current version of the DDF.
118 By asking current DDF versions from adapters DM Module can control
119 possible changes in the data structure and send the changed DDF
120 description to a management server.
121 This function is always called after DDFStructureL.
122 @param aVersion DDF version of the adapter. (filled by the adapter)
126 virtual void DDFVersionL( CBufBase& aVersion ) = 0;
129 The function for filling the DDF structure of the adapter
130 This function is only called once, immediately after the adapter is created.
131 @param aDDFObject Reference to root object. A DM adapter starts filling
132 the data structure by calling AddChildObjectL to the root object and
133 so describes the DDF of the adapter.
137 virtual void DDFStructureL( MSmlDmDDFObject& aDDF ) = 0;
140 The function creates new leaf objects, or replaces data in existing leaf
141 objects. The information about the success of the command should be
142 returned by calling SetStatusL function of MSmlDmCallback callback
143 interface. This makes it possible to buffer the commands. However, all
144 the status codes for buffered commands must be returned at the latest when
145 the adapter's CompleteOutstandingCmdsL() is called.
146 @param aURI URI of the object
147 @param aLUID LUID of the object (if the adapter has earlier returned a
148 LUID to the DM Module). For new objects, this is the LUID
149 inherited through the parent node.
150 @param aObject Data of the object.
151 @param aType MIME type of the object
152 @param aStatusRef Reference to correct command, i.e. this reference
153 must be used when calling the SetStatusL of this command
157 virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
158 const TDesC8& aObject, const TDesC8& aType,
159 TInt aStatusRef ) = 0;
162 The function creates new leaf objects, or replaces data in existing leaf
163 objects, in the case where data is large enough to be streamed. The
164 information about the success of the command should be returned by calling
165 SetStatusL function of MSmlDmCallback callback interface. This makes it
166 possible to buffer the commands. However, all the status codes for buffered
167 commands must be returned at the latest when the CompleteOutstandingCmdsL()
168 of adapter is called.
169 @param aURI URI of the object
170 @param aLUID LUID of the object (if the adapter has earlier returned a
171 LUID to the DM Module). For new objects, this is the LUID
172 inherited through the parent node.
173 @param aStream Data of the object. Adapter should create write stream
174 and return, when data is written to stream by DM agent,
175 StreamCommittedL() is called by DM engine
176 @param aType MIME type of the object
177 @param aStatusRef Reference to correct command, i.e. this reference
178 must be used when calling the SetStatusL of this
183 virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
184 RWriteStream*& aStream, const TDesC8& aType,
185 TInt aStatusRef ) = 0;
188 The function deletes an object and its child objects. The SetStatusL
189 should be used as described in UpdateLeafObjectL()
190 @param aURI URI of the object
191 @param aLUID LUID of the object (if the adapter have earlier returned
192 LUID to the DM Module).
193 @param aStatusRef Reference to correct command, i.e. this reference must
194 be used when calling the SetStatusL of this command.
198 virtual void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID,
199 TInt aStatusRef ) = 0;
202 The function fetches data of a leaf object. The SetStatusL should be used
203 as described in UpdateLeafObjectL(). The data is returned by using the
204 SetResultsL function of MSmlCallback callback interface, and may be streamed.
205 @param aURI URI of the object
206 @param aLUID LUID of the object (if the adapter have earlier
207 returned LUID to the DM Module).
208 @param aType MIME type of the object
209 @param aResultsRef Reference to correct results, i.e. this reference
210 must be used when returning the result by calling
212 @param aStatusRef Reference to correct command, i.e. this reference
213 must be used when calling the SetStatusL of this
218 virtual void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
219 const TDesC8& aType, TInt aResultsRef,
220 TInt aStatusRef ) = 0;
223 The function fetches the size of the data of a leaf object. The size is
224 in bytes, and must reflect the number of bytes that will be transferred
225 when the framework calls FetchLeafObjectL. The SetStatusL should be used
226 as described in FetchLeafObjectL(). The size value is returned by using
227 the SetResultsL function of MSmlCallback callback interface, and must be
228 a decimal integer expressed as a string, eg. "1234".
229 Results from this call MUST NOT be streamed.
230 @param aURI URI of the object
231 @param aLUID LUID of the object (if the adapter have earlier
232 returned LUID to the DM Module).
233 @param aType MIME type of the object
234 @param aResultsRef Reference to correct results, i.e. this reference
235 must be used when returning the result by calling
237 @param aStatusRef Reference to correct command, i.e. this reference
238 must be used when calling the SetStatusL of this
243 virtual void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID,
244 const TDesC8& aType, TInt aResultsRef,
245 TInt aStatusRef ) = 0;
247 The function fetches URI list. An adapter returns the list of URI segments
248 under the given URI be separated by slash ("/"). The URI segment names for
249 new objects must be given by the adapter.
250 The list is returned by calling the SetResultsL function of MSmlCallback
251 callback interface. Results from this call MUST NOT be streamed.
252 @param aParentURI URI of the parent object
253 @param aParentLUID LUID of the parent object (if the
254 adapter have earlier returned LUID to
256 @param aPreviousURISegmentList URI list with mapping LUID information,
257 which is known by DM engine. An adapter
258 can use this information when verifying
259 if old objects still exists. An adapter
260 also knows what objects are new to DM
261 engine and can provide LUID mapping for
262 them. aPreviousURISegmentList parameter
263 (see above) helps to recognise new
265 @param aResultsRef Reference to correct results, i.e. this
266 reference must be used when returning
267 the result by calling the SetResultsL.
268 @param aStatusRef Reference to correct command, i.e. this
269 reference must be used when calling the
270 SetStatusL of this command.
274 virtual void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID,
275 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
276 TInt aResultsRef, TInt aStatusRef ) = 0;
279 The function adds node object. In some cases an implementation of the
280 function may be empty function, if the node object does not need concrete
281 database update. Still this function may be helpful to an adapter, i.e. in
282 passing mapping LUID of the node to DM Module. The SetStatusL should be
283 used as described in UpdateLeafObjectL()
284 @param aURI URI of the object
285 @param aParentLUID LUID of the parent object (if the adapter have
286 earlier returned LUID to the DM Module).
287 @param aStatusRef Reference to correct command, i.e. this reference
288 must be used when calling the SetStatusL of this
293 virtual void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID,
297 The function implements execute command. The information about the success
298 of the command should be returned by calling SetStatusL function of
299 MSmlDmCallback callback interface. This makes it possible to buffer the
301 However, all the status codes for buffered commands must be returned at
302 the latest when the CompleteOutstandingCmdsL() of adapter is called.
303 @param aURI URI of the command
304 @param aLUID LUID of the object (if the adapter have earlier
305 returned LUID to the DM Module).
306 @param aArgument Argument for the command
307 @param aType MIME type of the object
308 @param aStatusRef Reference to correct command, i.e. this reference
309 must be used when calling the SetStatusL of this
314 virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
315 const TDesC8& aArgument, const TDesC8& aType,
316 TInt aStatusRef ) = 0;
319 The function implements execute command. The information about the
320 success of the command should be returned by calling SetStatusL function
321 of MSmlDmCallback callback interface. This makes it possible to buffer the
323 However, all the status codes for buffered commands must be returned at
324 the latest when the CompleteOutstandingCmdsL() of adapter is called.
325 @param aURI URI of the command
326 @param aLUID LUID of the object (if the adapter have earlier
327 returned LUID to the DM Module).
328 @param aStream Argument for the command. Adapter should create
329 write stream and return, when data is written to
330 stream by DM agent, StreamCommittedL() is called by
332 @param aType MIME type of the object
333 @param aStatusRef Reference to correct command, i.e. this reference
334 must be used when calling the SetStatusL of this
339 virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
340 RWriteStream*& aStream, const TDesC8& aType,
341 TInt aStatusRef ) = 0;
344 The function implements copy command. The information about the success of
345 the command should be returned by calling SetStatusL function of
346 MSmlDmCallback callback interface. This makes it possible to buffer the
348 However, all the status codes for buffered commands must be returned at
349 the latest when the CompleteOutstandingCmdsL() of adapter is called.
350 @param aTargetURI Target URI for the command
351 @param aSourceLUID LUID of the target object (if one exists, and if the adapter
352 has earlier returned a LUID to the DM Module).
353 @param aSourceURI Source URI for the command
354 @param aSourceLUID LUID of the source object (if the adapter has
355 earlier returned a LUID to the DM Module).
356 @param aType MIME type of the objects
357 @param aStatusRef Reference to correct command, i.e. this reference
358 must be used when calling the SetStatusL of this
363 virtual void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID,
364 const TDesC8& aSourceURI, const TDesC8& aSourceLUID,
365 const TDesC8& aType, TInt aStatusRef ) = 0;
368 The function indicates start of Atomic command.
372 virtual void StartAtomicL() = 0;
375 The function indicates successful end of Atomic command. The adapter
376 should commit all changes issued between StartAtomicL() and
381 virtual void CommitAtomicL() = 0;
384 The function indicates unsuccessful end of Atomic command. The adapter
385 should rollback all changes issued between StartAtomicL() and
386 RollbackAtomicL(). If rollback fails for a command, adapter should use
387 SetStatusL() to indicate it.
391 virtual void RollbackAtomicL() = 0;
394 Returns ETrue if adapter supports streaming otherwise EFalse.
395 @param aItemSize size limit for stream usage
396 @return TBool ETrue for streaming support
400 virtual TBool StreamingSupport( TInt& aItemSize ) = 0;
403 Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has
404 been written to and committed. Not called when fetching item.
408 virtual void StreamCommittedL() = 0;
411 The function tells the adapter that all the commands of the message that
412 can be passed to the adapter have now been passed. This indciates that
413 the adapter must supply status codes and results to any buffered commands.
414 This must be done at latest by the time this function returns.
415 This function is used at the end of SyncML messages, and during processing
416 of Atomic. In the case of Atomic processing, the function will be
417 followed by a call to CommitAtomicL or RollbackAtomicL.
421 virtual void CompleteOutstandingCmdsL() = 0;
425 class TSmlDmAccessTypes
427 This class sets the access types which are allowed for a DM object.
435 This enumeration describes the possible access types for a DM object
440 /** The DM Command Add is permitted on this DM object */
441 EAccessType_Add = 0x01,
442 /** The DM Command Copy is permitted on this DM object */
443 EAccessType_Copy = 0x02,
444 /** The DM Command Delete is permitted on this DM object */
445 EAccessType_Delete = 0x04,
446 /** The DM Command Exec is permitted on this DM object */
447 EAccessType_Exec = 0x08,
448 /** The DM Command Get is permitted on this DM object */
449 EAccessType_Get = 0x10,
450 /** The DM Command Replace is permitted on this DM object */
451 EAccessType_Replace = 0x20
454 inline TSmlDmAccessTypes();
455 inline void SetAdd();
456 inline void SetCopy();
457 inline void SetDelete();
458 inline void SetExec();
459 inline void SetGet();
460 inline void SetReplace();
461 inline TUint8 GetACL();
470 class CSmlDmAdapter : public CBase, public MSmlDmAdapter
472 The class CSmlDmAdapter is an ECOM interface for Device Management adapter plugins.
473 This interface which must be implemented by every DM plugin adapter
480 inline static CSmlDmAdapter* NewL( const TUid& aImplementationUid,
481 MSmlDmCallback& aDmCallback );
482 inline virtual ~CSmlDmAdapter();
485 inline CSmlDmAdapter(TAny* aEcomArguments);
486 inline MSmlDmCallback& Callback();
489 /** ECOM framework requires this ID in object destructor
495 /** The DM Framework's callback for returning command results and data
499 MSmlDmCallback& iCallback;
504 This class is callback interface which is implemented in DM Module. An
505 instance is passed by reference as an argument to the CSmlDmAdapter::NewL()
506 function. This interface is mostly used for returning results and status
507 codes for completed commands to the DM framework. The interface also has
508 functionality for mapping LUIDs and fetching from other parts of the DM Tree.
509 The adapter does not necessarily need to use any other functions but the
510 SetStatusL and SetResultsL, if it handles the LUID mapping itself.
517 The function is used to return the data in case of FetchLeafObjectL(),
518 FetchLeafObjectSizeL() and ChildURIListL() functions. It should not be
519 called where the DM command has failed, i.e. the error code returned in
520 SetStatusL is something other than EOk.
521 @param aResultsRef Reference to correct command
522 @param aObject The data which should be returned
523 @param aType MIME type of the object
527 virtual void SetResultsL( TInt aResultsRef, CBufBase& aObject,
528 const TDesC8& aType ) = 0;
531 The function is used to return the data in case of FetchLeafObjectL() and
532 ChildURIListL() functions, where the size of the data being returned is
533 large enough for the Adapter to stream it. This function should not be
534 called when command was failed, i.e. the error code returned in SetStatusL
535 is something other than EOk.
536 @param aResultsRef Reference to correct command
537 @param aStream Large data which should be returned, DM engine
538 closes stream when it has read all the data
539 @param aType MIME type of the object
543 virtual void SetResultsL( TInt aResultsRef, RReadStream*& aStream,
544 const TDesC8& aType ) = 0;
547 The function returns information about the Add,Update,Delete and Fetch
548 commands success to DM engine. The reference to correct command must be
549 used when calling the SetStatusL function, the reference is got from the
550 argument of the command functions. The SetStatusL function must be called
551 separately for every single command.
552 @param aStatusRef Reference to correct command
553 @param aErrorCode Information about the command success
557 virtual void SetStatusL( TInt aStatusRef,
558 MSmlDmAdapter::TError aErrorCode ) = 0;
561 The function passes map information to DM Module. This function is called
562 for a new management object, both for node objects and for leaf objects.
563 In addition if ChildURIListL() function has returned new objects a mapping
564 information of the new objects must be passed. A mapping is treated as
565 inheritable. If the mapping is not set with this function, the mapping
566 LUID of the parent object is passed in following commands to the object.
567 @param aURI URI of the object.
568 @param aLUID LUID of the object. LUID must contain the all information,
569 which is needed for retrieve the invidual object from the
570 database. Typically it is ID for the database table. In
571 more complicated structures it can be combination of IDs,
572 which represent path to the object.
576 virtual void SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ) = 0;
579 The function is used to make a fetch to other adapters. The most common
580 use is to make a fetch to the AP adapter, because when managing the access
581 points, the data comes as URI. For example, there are ToNAPId field in
582 some adapters, and data to it can be something like AP/IAPidx, and then
583 the link to AP adapter is needed.
584 Using FetchLinkL causes the DM Framework to make a Get request to the
585 appropriate DM adapter. The receiving adapter MUST complete the Get
586 request synchronously.
587 @param aURI URI of the object.
588 @param aData Reference to data, i.e. data is returned here
589 @param aStatus The status of fetch command is returned here
593 virtual void FetchLinkL( const TDesC8& aURI, CBufBase& aData,
594 MSmlDmAdapter::TError& aStatus ) = 0;
597 The function returns the LUID which is mapped to aURI. If LUID is not
598 found, the function allocates a null length string, i.e. the function
599 allocates memory in every case.
600 @param aURI URI of the object.
604 virtual HBufC8* GetLuidAllocL( const TDesC8& aURI ) = 0;
607 The function is used to remove a mapped URI. Returns the error code about mapping removal.
608 @param aAdapterId Settings Adapter id
609 @param aURI Mapped Uri
610 @param aChildAlso Indicates the child nodes removal
614 virtual TInt RemoveMappingL( TUint32 aAdapterId, const TDesC8& aURI, TBool aChildAlso ) = 0;
618 class MSmlDmDDFObject
620 This class structure includes DDF description. When used as an argument in DM
621 Adapters Interface each adapter fills its own branch of DDF Tree to the data
631 The possible formats of a node.
636 /** Base64 encoded */
640 /** Character data */
644 /** A DM Tree interior node */
648 /** XML character data*/
662 The possible occurrences of a node.
667 /** The node appears exactly once */
669 /** The node is optional and may appear zero or once */
671 /** The node is optional and may appear zero or more times */
673 /** The node is mandatory and may appear once or more times */
675 /** The node is optional and may appear between once and 'N' times */
677 /** The node is mandatory and may appear between once and 'N' times */
683 The possible scopes of a node.
688 /** The node is permanent in the DM Tree */
690 /** The node is created at run-time in the DM Tree */
695 The function sets permitted access types property to the object. Access
696 types property is a mandatory element. If this function is not called all
698 @param aAccessTypes Access types property.
702 virtual void SetAccessTypesL( TSmlDmAccessTypes aAccessTypes )=0;
705 The function sets a default value property to the object. Default value
706 is not a mandatory element. If this function is not called, it means that
707 the default value property is not set at all.
708 @param aDefaultValue Default value property.
712 virtual void SetDefaultValueL( const TDesC8& aDefaultValue )=0;
715 The function sets a description property to the object. Description is
716 not a mandatory element. If this function is not called, it means that the
717 description property value is not set at all.
718 @param aDescription Description property.
722 virtual void SetDescriptionL( const TDesC8& aDescription )=0;
725 The function sets a format property to the object. Format is a mandatory
726 element. If this function is not called for node element, Format is set as
727 'node'. For leaf elements this function must be called.
728 @param aFormat Format property.
732 virtual void SetDFFormatL( TDFFormat aFormat )= 0;
735 The function sets an occurence property to the object. If this function
736 is not called, an occurence is set as TOccurence::EOne.
737 @param aOccurence Occurence property.
741 virtual void SetOccurenceL( TOccurence aOccurence ) =0;
744 The function sets a scope property to the object. If this function is not
745 called, the scope is set as TScope::EDynamic.
746 @param aScope Scope property.
750 virtual void SetScopeL( TScope aScope ) = 0;
753 The function sets a title property to the object. Title is not a mandatory
754 element. If this function is not called, it means that a Title property
755 value is not set at all.
756 @param aTitle DFTitle property.
760 virtual void SetDFTitleL( const TDesC8& aTitle ) = 0;
763 The function sets a MIME type property to the object. MIME Type is a
764 mandatory element for leaf objects. If this function is not called (for
765 node elements), it means that the MIME type property value is not set at
767 @param aMimeType MIME type property.
771 virtual void AddDFTypeMimeTypeL( const TDesC8& aMimeType ) = 0;
774 The function sets an object as an object group. If this function is not
775 called, it means that the object is not an object group. Object group is a
776 term used with for the node in the management tree that is used as a
777 container for other object groups, container for management objects or a
778 container for both object groups and management objects. The term 'object
779 group' is not used when talked about the nodes which are part of
780 the management object itself.
782 @withdrawn - This is not supported. MSmlDmDDFObject::AddChildObjectGroupL
783 * must be used instead of AddChildObjectL,SetAsObjectGroup.
785 virtual void SetAsObjectGroup() = 0;
788 The function adds a child object and sets name of the URI segment, which
789 is used by the DM server. The highest object must be directly under root.
790 An adapter is not able to set properties of the root object. The aNodeName
791 argument should be an empty string, when the name is not fixed in DDF,
792 i.e. in case of dynamic nodes.
793 @param aNodeName The name of the node
797 virtual MSmlDmDDFObject& AddChildObjectL(const TDesC8& aNodeName) = 0;
800 The function adds a child object, to be used as an object group. As an
801 object group, there is no node name (these nodes are 'unnamed' in the DDF).
802 Object group is a term used with for nodes in the management tree that are
803 used as a container for other object groups, container for management
804 objects or a container for both object groups and management objects. The
805 term 'object group' is not used when referring to nodes which are part
806 of the management object itself.
810 virtual MSmlDmDDFObject& AddChildObjectGroupL() = 0;
813 #include "smldmadapter.inl"
815 #endif // __SMLDMADAPTER_H__