omadm/omadmextensions/adapters/devdetail/inc/nsmldmdevdetailadapter.h
changeset 18 7d11f9a6646f
parent 4 75a71fdb4c92
child 21 c707676bf59f
equal deleted inserted replaced
4:75a71fdb4c92 18:7d11f9a6646f
     1 /*
       
     2 * Copyright (c) 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:    DM DevDetail Adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __NSMLDMDEVDETAILADAPTER_H__
       
    22 #define __NSMLDMDEVDETAILADAPTER_H__
       
    23 
       
    24 // INCLUDES
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <smldmadapter.h>
       
    28 #include "nsmldmconstants.h"
       
    29 
       
    30 // the DDF version must be changed if any changes in DDF structure 
       
    31 // ( built in DDFStructureL() function )
       
    32 _LIT8( KNSmlDMDevDetailDDFVersion, "1.0" ); 
       
    33 
       
    34 _LIT8( KNSmlDMDevDetailTextPlain, "text/plain" );
       
    35 _LIT8( KNSmlDMDevDetailNodeName, "DevDetail" );
       
    36 _LIT8( KNSmlDMDevDetailDescription, "The interior object holds all DevDetail objects" );
       
    37 
       
    38 _LIT8( KNSmlDMDevDetailDevTypNodeName, "DevTyp" );
       
    39 _LIT8( KNSmlDMDevDetailDevTypDescription, "The type of the device" );
       
    40 _LIT8( KNSmlDMDevDetailDevTypValue, "smartphone" );
       
    41 
       
    42 _LIT8( KNSmlDMDevDetailOEMNodeName, "OEM" );
       
    43 _LIT8( KNSmlDMDevDetailOEMDescription, "Original Equipment Manufacturer" );
       
    44 
       
    45 _LIT8( KNSmlDMDevDetailFwVNodeName, "FwV" );
       
    46 _LIT8( KNSmlDMDevDetailFwVDescription, "The firmware revision of the device" );
       
    47 
       
    48 _LIT8( KNSmlDMDevDetailSwVNodeName, "SwV" );
       
    49 _LIT8( KNSmlDMDevDetailSwVDescription, "The software revision of the device" );
       
    50 
       
    51 _LIT8( KNSmlDMDevDetailHwVNodeName, "HwV" );
       
    52 _LIT8( KNSmlDMDevDetailHwVDescription, "The hardware revision of the device" );
       
    53 
       
    54 _LIT8( KNSmlDMDevDetailLrgObjNodeName, "LrgObj" );
       
    55 _LIT8( KNSmlDMDevDetailLrgObjDescription, "Large object handling supported if value is true" );
       
    56 _LIT8( KNSmlDMDevDetailLrgObjValue, "true" );
       
    57 
       
    58 _LIT8( KNSmlDMDevDetailURINodeName, "URI" );
       
    59 _LIT8( KNSmlDMDevDetailURIDescription, "The tree limitations branch" );
       
    60 
       
    61 _LIT8( KNSmlDMDevDetailMaxDepthNodeName, "MaxDepth" );
       
    62 _LIT8( KNSmlDMDevDetailMaxDepthDescription, "Maximum tree depth" );
       
    63 _LIT8( KNSmlDMDevDetailMaxDepthValue, "0" );
       
    64 
       
    65 _LIT8( KNSmlDMDevDetailMaxTotLenNodeName, "MaxTotLen" );
       
    66 _LIT8( KNSmlDMDevDetailMaxTotLenDescription, "Maximum URI length" );
       
    67 _LIT8( KNSmlDMDevDetailMaxTotLenValue, "0" );
       
    68 
       
    69 _LIT8( KNSmlDMDevDetailMaxSegLenNodeName, "MaxSegLen" );
       
    70 _LIT8( KNSmlDMDevDetailMaxSegLenDescription, "Maximum URI segment length" );
       
    71 _LIT8( KNSmlDMDevDetailMaxSegLenValue, "9" );
       
    72 
       
    73 _LIT8( KNSmlDMDevDetailSeparator, "/" );
       
    74 
       
    75 const TInt KNSmlMaxRequestBufferLength = 128;
       
    76 const TInt KNSmlMaxSizeBufferLength = 4;
       
    77 
       
    78 _LIT( KNSmlDevDetailPanic,      "DevDetail" );
       
    79 
       
    80 // CLASS DECLARATION
       
    81 class CNSmlDmDevDetailAdapter : public CSmlDmAdapter
       
    82     {
       
    83 public:  // contructors and destructor
       
    84     static CNSmlDmDevDetailAdapter* NewL(MSmlDmCallback* aDmCallback );
       
    85     static CNSmlDmDevDetailAdapter* NewLC(MSmlDmCallback* aDmCallback );
       
    86 
       
    87     virtual ~CNSmlDmDevDetailAdapter();
       
    88     virtual TInt DevDetailValueCrcL();
       
    89 
       
    90 private: // new functions
       
    91     CNSmlDmDevDetailAdapter(TAny* aEcomArguments);
       
    92     void AddObjectToBufferL( CBufBase& aCrcBuf, const TDesC8& aURI ); 
       
    93     CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, CBufBase& aObject ); 
       
    94     void SetLeafPropertiesL( MSmlDmDDFObject& aObject, 
       
    95                              const TSmlDmAccessTypes& aAccessTypes, 
       
    96                              const TDesC8& aDescription ) const;
       
    97             
       
    98 private: // functions from base classes
       
    99     // from CSmlDmAdapter
       
   100     void DDFVersionL( CBufBase& aVersion );
       
   101     void DDFStructureL( MSmlDmDDFObject& aDDF );
       
   102     void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   103                             const TDesC8& aObject, const TDesC8& aType, 
       
   104                             const TInt aStatusRef );
       
   105     void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TInt aStatusRef ); 
       
   106     void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   107                            const TDesC8& aType, const TInt aResultsRef, 
       
   108                            const TInt aStatusRef ); 
       
   109     void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   110                         const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   111                         const TInt aResultsRef, const TInt aStatusRef );  
       
   112     void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, 
       
   113                          const TInt aStatusRef );
       
   114     void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   115                             RWriteStream*& aStream, const TDesC8& aType, 
       
   116                             const TInt aStatusRef );
       
   117     void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   118                                const TDesC8& aType, const TInt aResultsRef, 
       
   119                                const TInt aStatusRef );
       
   120     void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, 
       
   121                           const TDesC8& aType, const TInt aStatusRef );
       
   122     void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, RWriteStream*& aStream, 
       
   123                           const TDesC8& aType, const TInt aStatusRef );
       
   124     void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, 
       
   125                        const TDesC8& aSourceURI, const TDesC8& aSourceLUID, 
       
   126                        const TDesC8& aType, TInt aStatusRef );
       
   127     void StartAtomicL();
       
   128     void CommitAtomicL();
       
   129     void RollbackAtomicL();
       
   130     TBool StreamingSupport( TInt& aItemSize );
       
   131     void StreamCommittedL();
       
   132     void CompleteOutstandingCmdsL();
       
   133 
       
   134 // FOTA
       
   135 private:
       
   136 
       
   137     /**
       
   138     * Enumeration specifies the data that can be fetched using
       
   139     * GetDevDetailDataL().
       
   140     */
       
   141     enum TNSmlDevDetailData
       
   142         {
       
   143         ESwVersion,
       
   144         EHwVersion
       
   145         };
       
   146 
       
   147     /**
       
   148     * Fetches and/or forms DevDetail data specified by aElement.
       
   149     * In WINSCW this data is read from file. In ARM builds the 
       
   150     * data is fetched from EInfo.
       
   151     * @param aObject The buffer where fetched data is inserted.
       
   152     * @param aElement Specifies the data that should be fetched.
       
   153     */
       
   154     void GetDevDetailDataL( CBufBase& aObject, TNSmlDevDetailData aElement ) const;
       
   155 	
       
   156 // FOTA end
       
   157 
       
   158 private:
       
   159 
       
   160     MSmlDmCallback* iDmCallback;
       
   161     
       
   162     };
       
   163 
       
   164 #endif // __NSMLDMDEVDETAILADAPTER_H__