📄 tmexampledmadapter.h
字号:
/* Copyright (c) 2005, Forum Nokia. All rights reserved */
#ifndef __TM_EXAMPLE_DM_ADAPTER_H__
#define __TM_EXAMPLE_DM_ADAPTER_H__
// INCLUDE FILES
#include <e32base.h>
#include <nsmldmadapter.h>
#include "tmserversession.h"
// CLASS DECLARATION
/**
*
*/
class CTmExampleDmAdapter : public CNSmlDmAdapter
{
// Public functions
public:
/**
* The construction for CNSmlDmAdapter class.
* @param aDmCallback An address of the callback interface class.
*/
static CTmExampleDmAdapter* NewL( MNSmlDmCallback* aDmCallback=0);
/**
* C++ default destructor.
*/
~CTmExampleDmAdapter();
/**
* Pure virtual methods.
*/
/**
* The function returns current version of the DDF.
* By asking current DDF versions from adapters DM Module can control
* possible changes in the data structure and send the changed DDF
* description to a management server.
* @param aVersion DDF version of the adapter. (filled by the adapter)
*/
void DDFVersionL( CBufBase& aVersion );
/**
* The function for filling the DDF structure of the adapter
* @param aDDFObject Reference to root object. A DM adapter starts filling
* the data structure by calling AddChildObjectL to the root object and
* so describes the DDF of the adapter.
*/
void DDFStructureL( MNSmlDmDDFObject& aDDF );
/**
* The function adds a leaf object. The information about the success of the
* command should be returned by calling SetStatusL function of MNSmlDmCallback
* callback interface. This makes it possible to buffer the commands.
* However, all the status codes for buffered commands must be returned at the
* latest when the EndMessageL() of adapter is called.
* @param aURI URI of the object
* @param aParentLUID LUID of the parent object (if the adapter
* have earlier returned LUID to the DM Module).
* @param aObject Data of the object.
* @param aType MIME type of the object
* @param aStatusRef Reference to correct command, i.e. this reference must
* be used when calling the SetStatusL of this command.
*/
void AddLeafObjectL( const TDesC& aURI,const TDesC& aParentLUID, const TDesC8& aObject, const TDesC& aType,const TInt aStatusRef );
/**
* The function replaces data of a leaf object. The SetStatusL should be used as
* described in AddLeafObjectL()
* @param aURI URI of the object
* @param aLUID LUID of the object (if the adapter have earlier returned
* LUID to the DM Module).
* @param aObject Data of the object.
* @param aType MIME type of the object
* @param aStatusRef Reference to correct command, i.e. this reference
* must be used when calling the SetStatusL of this command.
*/
void UpdateLeafObjectL( const TDesC& aURI, const TDesC& aLUID, const TDesC8& aObject, const TDesC& aType, const TInt aStatusRef );
/**
* The function deletes an object and its child objects. The SetStatusL should be used
* as described in AddLeafObjectL()
* @param aURI URI of the object
* @param aLUID LUID of the object (if the adapter have earlier returned
LUID to the DM Module).
* @param aStatusRef Reference to correct command, i.e. this reference must
* be used when calling the SetStatusL of this command.
*/
void DeleteObjectL( const TDesC& aURI, const TDesC& aLUID, const TInt aStatusRef );
/**
* The function fetches data of a leaf object. The SetStatusL should be used as described
* in AddLeafObjectL(). The data is returned by using the SetResultsL function of
* MNSmlCallback callback interface.
* @param aURI URI of the object
* @param aLUID LUID of the object (if the adapter have earlier returned LUID
* to the DM Module).
* @param aType MIME type of the object
* @param aResultsRef Reference to correct results, i.e. this reference must be used
* when returning the result by calling the SetResultsL.
* @param aStatusRef Reference to correct command, i.e. this reference must be used
* when calling the SetStatusL of this command.
*/
void FetchLeafObjectL( const TDesC& aURI, const TDesC& aLUID, const TDesC& aType, const TInt aResultsRef, const TInt aStatusRef );
/**
* The function fetches URI list. An adapter returns the list of URI segments under the given URI
* be separated by slash ("/"). The URI segment names for new objects must be given by the adapter.
* The list is returned by calling the SetResultsL function of MNSmlCallback callback interface.
* @param aParentURI URI of the parent object
* @param aParentLUID LUID of the parent object (if the adapter have earlier
* returned LUID to the DM Module).
* @param aPreviousURISegmentLIist URI list with mapping LUID information, which is known by
* DM engine. An adapter can use this information when verifying
* if old objects still exists. An adapter also knows what
* objects are new to DM engine and can provide LUID mapping
* for them. aPreviousURISegmentList parameter (see above) helps
* to recognise new objects.
* @param aResultsRef Reference to correct results, i.e. this reference must be used
* when returning the result by calling the SetResultsL.
* @param aStatusRef Reference to correct command, i.e. this reference must be used
* when calling the SetStatusL of this command.
*/
void ChildURIListL( const TDesC& aURI, const TDesC& aLUID, const CArrayFix<TNSmlDmMappingInfo>& aPreviousURISegmentList, const TInt aResultsRef, const TInt aStatusRef );
/**
* The function adds node object. In some cases an implementation of the function may be empty
* function, if the node object does not need concrete database update. Still this function may
* be helpful to an adapter, i.e. in passing mapping LUID of the node to DM Module. The SetStatusL
* should be used as described in AddLeafObjectL()
* @param aURI URI of the object
* @param aParentLUID LUID of the parent object (if the adapter have earlier
* returned LUID to the DM Module).
* @param aStatusRef Reference to correct command, i.e. this reference must
* be used when calling the SetStatusL of this command.
*/
void AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID, const TInt aStatusRef );
/**
* Virtual methods.
*/
/**
* The function is called only if an adapter has returned ETrue in AdapterCanChangeACL() function.
* An adapter MUST always return ACL to the DM engine which stores it. ACL must be returned
* although an adapter has not changed it. ACL is returned by using SetACLL() function of
* MNSmlCallback interface. The SetStatusL should be used as described in AddLeafObjectL().
* The function has default (empty) implementation, and the new implementation is not needed
* if the adapter does not want to update ACLs. This function is called only if the
* AdapterCanChangeACL function returns ETrue.
* @param aURI URI of the object. Note: "?prop=ACL" has already been
* dropped by DM engine.
* @param aLUID LUID of the object (if the adapter have earlier returned LUID
* to the DM engine).
* @param aACL ACL of the object.
* @param aStatusRef Reference to correct command, i.e. this reference must be
* used when calling the SetStatusL of this command.
*/
void UpdateACLPropertyL( const TDesC& /*aURI*/, const TDesC& /*aLUID*/, const TDesC8& /*aACL*/, const TInt /*aStatusRef*/ ){};
/**
* The function tells if a DM adapter is able to change ACL properties which are sent
* from DM servers. This function has default implemention in the base class,
* which returns EFalse. If the function returns ETrue, the UpdateACLPropertyL is called
* when the server sends the replace to any of ACLs whic belongs to this adapter.
* @return TBool ETrue if the adapter wants to edit ACL properties.
*/
TBool AdapterCanChangeACL(){return EFalse;}
/**
* The function tells if a DM adapter cares mapping LUIDs to URIs itself. This function
* has default implemention in the base class, which returns EFalse.
* @return TBool ETrue if an adapter wants to store and stores and care of mapping itself
* without DM engines services. In default implementation the function return EFalse, when
* DM engine stores the mappings.
*/
TBool LuidMappingInAdapter(){return EFalse;}
/**
* The function tells to adapter that all the commands of the message have been handled
* and the status codes and results to buffered commands must be returned at latests when
* this function is called.
*/
void EndMessageL(){}
private:
CNSmlDmAdapter::TError SetValue(const TDesC& aURI, const TDesC8& aObject);
private:
MNSmlDmCallback* iCallback;
RTmServerSession iTmSession;
};
#endif // __TM_EXAMPLE_DM_ADAPTER_H__
// End of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -