deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.cpp
changeset 44 137912d1a556
parent 43 88e14c3d4c4f
child 45 0f9fc722d255
equal deleted inserted replaced
43:88e14c3d4c4f 44:137912d1a556
     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 DevInfo Adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 //INCLUDE FILES
       
    23 #include <implementationproxy.h> // For TImplementationProxy definition
       
    24 #include "nsmldmimpluids.h"
       
    25 #include <featmgr.h>
       
    26 
       
    27 #include "nsmldmdevinfoadapter.h"
       
    28 #include "nsmldebug.h"
       
    29 #include "nsmlphoneinfo.h"
       
    30 #include "nsmlunicodeconverter.h"
       
    31 #include "nsmlconstants.h"
       
    32 #include "nsmldmconst.h"
       
    33 #include "nsmldmdevdetailadapter.h"
       
    34 
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewL( )
       
    38 // -----------------------------------------------------------------------------
       
    39 CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewL(MSmlDmCallback* aDmCallback )
       
    40     {
       
    41     _DBG_FILE("CNSmlDmDevInfoAdapter::NewL(): begin");
       
    42     CNSmlDmDevInfoAdapter* self = NewLC( aDmCallback );
       
    43     CleanupStack::Pop();
       
    44     _DBG_FILE("CNSmlDmDevInfoAdapter::NewL(): end");
       
    45     return self;
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewLC( )
       
    50 // -----------------------------------------------------------------------------
       
    51 CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewLC(MSmlDmCallback* aDmCallback )
       
    52     {
       
    53     _DBG_FILE("CNSmlDmDevInfoAdapter::NewLC(): begin");
       
    54     CNSmlDmDevInfoAdapter* self = new (ELeave) CNSmlDmDevInfoAdapter(aDmCallback);
       
    55     CleanupStack::PushL(self);
       
    56     self->iDmCallback = aDmCallback;
       
    57     FeatureManager::InitializeLibL();
       
    58     _DBG_FILE("CNSmlDmDevInfoAdapter::NewLC(): end");
       
    59     return self;
       
    60     }
       
    61 
       
    62 
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter()
       
    66 // -----------------------------------------------------------------------------
       
    67 CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter()
       
    68     {
       
    69     _DBG_FILE("CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter(): begin");
       
    70     FeatureManager::UnInitializeLib();
       
    71     _DBG_FILE("CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter(): end");
       
    72     }
       
    73     
       
    74 // -----------------------------------------------------------------------------
       
    75 // CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter()
       
    76 // -----------------------------------------------------------------------------
       
    77 
       
    78 CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments)
       
    79     {
       
    80     _DBG_FILE("CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(aEcomArguments): begin");
       
    81     _DBG_FILE("CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(aEcomArguments): end"); 
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CNSmlDmDevInfoAdapter::SetLeafPropertiesL()
       
    86 // -----------------------------------------------------------------------------
       
    87 void CNSmlDmDevInfoAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject, 
       
    88                                                 const TSmlDmAccessTypes& aAccessTypes, 
       
    89                                                 const TDesC8& aDescription ) const
       
    90     {
       
    91     aObject.SetAccessTypesL( aAccessTypes );
       
    92     aObject.SetScopeL( MSmlDmDDFObject::EPermanent );
       
    93     aObject.SetDFFormatL( MSmlDmDDFObject::EChr );
       
    94     aObject.AddDFTypeMimeTypeL( KNSmlDMDevInfoTextPlain );
       
    95     aObject.SetDescriptionL( aDescription );
       
    96     }
       
    97 
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 //  CNSmlDmDevInfoAdapter::DDFVersionL()
       
   101 // -----------------------------------------------------------------------------
       
   102 void CNSmlDmDevInfoAdapter::DDFVersionL(CBufBase& aDDFVersion)
       
   103     {
       
   104     _DBG_FILE("CNSmlDmDevInfoAdapter::DDFVersionL(TDes& aDDFVersion): begin");
       
   105     aDDFVersion.InsertL(0,KNSmlDMDevInfoDDFVersion);
       
   106     _DBG_FILE("CNSmlDmDevInfoAdapter::DDFVersionL(TDes& aDDFVersion): end");
       
   107     }
       
   108 
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 //  CNSmlDmDevInfoAdapter::DDFStructureL()
       
   112 //
       
   113 // -----------------------------------------------------------------------------
       
   114 void CNSmlDmDevInfoAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
       
   115     {
       
   116     _DBG_FILE("CNSmlDmDevInfoAdapter::DDFStructureL(): begin");
       
   117     
       
   118     TSmlDmAccessTypes accessTypes;
       
   119     accessTypes.SetGet();
       
   120     // DevInfo
       
   121     MSmlDmDDFObject& devInfo = aDDF.AddChildObjectL( KNSmlDMDevInfoNodeName );
       
   122     devInfo.SetAccessTypesL( accessTypes ); 
       
   123     devInfo.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   124     devInfo.SetDescriptionL( KNSmlDMDevInfoDescription );
       
   125     // Man  
       
   126     MSmlDmDDFObject& man = devInfo.AddChildObjectL(KNSmlDMDevInfoManNodeName);
       
   127     SetLeafPropertiesL( man, accessTypes, KNSmlDMDevInfoManDescription );
       
   128     // Mod  
       
   129     MSmlDmDDFObject& mod = devInfo.AddChildObjectL(KNSmlDMDevInfoModNodeName );
       
   130     SetLeafPropertiesL( mod, accessTypes, KNSmlDMDevInfoModDescription );
       
   131     // DevId    
       
   132     MSmlDmDDFObject& devid = devInfo.AddChildObjectL( KNSmlDMDevInfoDevIdNodeName);
       
   133     SetLeafPropertiesL( devid, accessTypes, KNSmlDMDevInfoDevIdDescription ); 
       
   134     // Lang 
       
   135     MSmlDmDDFObject& lang = devInfo.AddChildObjectL(KNSmlDMDevInfoLangNodeName );
       
   136     SetLeafPropertiesL( lang, accessTypes, KNSmlDMDevInfoLangDescription ); 
       
   137     // DmV  
       
   138     MSmlDmDDFObject& dmv = devInfo.AddChildObjectL(KNSmlDMDevInfoDmVNodeName);
       
   139     SetLeafPropertiesL( dmv, accessTypes, KNSmlDMDevInfoDmVDescription );
       
   140     // Ext
       
   141     MSmlDmDDFObject& ext = devInfo.AddChildObjectL(KNSmlDMDevInfoExtNodeName );
       
   142     ext.SetAccessTypesL( accessTypes );
       
   143     ext.SetScopeL( MSmlDmDDFObject::EPermanent );
       
   144     ext.SetDescriptionL( KNSmlDMDevInfoExtDescription );
       
   145     // ModDDF   
       
   146     MSmlDmDDFObject& modDDF = ext.AddChildObjectL( KNSmlDMDevInfoModDDFNodeName);
       
   147     SetLeafPropertiesL( modDDF, accessTypes, KNSmlDMDevInfoModDDFDescription );
       
   148     // ModDevDet    
       
   149     MSmlDmDDFObject& modDevDet = ext.AddChildObjectL(KNSmlDMDevInfoModDevDetNodeName );
       
   150     SetLeafPropertiesL( modDevDet, accessTypes, KNSmlDMDevInfoModDevDetDescription );
       
   151     _DBG_FILE("CNSmlDmDevInfoAdapter::DDFStructureL(): end");
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 //  CNSmlDmDevInfoAdapter::UpdateLeafObjectL()
       
   156 // -----------------------------------------------------------------------------
       
   157 void CNSmlDmDevInfoAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, 
       
   158                                                const TDesC8& /*aLUID*/, 
       
   159                                                const TDesC8& /*aObject*/, 
       
   160                                                const TDesC8& /*aType*/, 
       
   161                                                const TInt aStatusRef )
       
   162     {
       
   163     _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): begin");
       
   164     _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): end");
       
   165     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   166     }
       
   167 
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // CNSmlDmDevInfoAdapter::DeleteObjectL()
       
   171 // -----------------------------------------------------------------------------
       
   172 void CNSmlDmDevInfoAdapter::DeleteObjectL( const TDesC8& /*aURI*/, 
       
   173                                            const TDesC8& /*aLUID*/, 
       
   174                                            const TInt aStatusRef )
       
   175     {
       
   176     _DBG_FILE("CNSmlDmDevInfoAdapter::DeleteLeafObjectL( ): begin");
       
   177     _DBG_FILE("CNSmlDmDevInfoAdapter::DeleteLeafObjectL( ): end");
       
   178     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   179     }
       
   180 
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 //  CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   184 // const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef )
       
   185 // -----------------------------------------------------------------------------
       
   186 void CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, 
       
   187                                               const TDesC8& /*aLUID*/, 
       
   188                                               const TDesC8& aType, 
       
   189                                               const TInt aResultsRef, 
       
   190                                               const TInt aStatusRef )
       
   191     {
       
   192     _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectL(): begin");
       
   193     
       
   194     CBufBase *object = CBufFlat::NewL( 1 );
       
   195     CleanupStack::PushL( object );
       
   196     
       
   197     CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
       
   198     
       
   199     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   200     iDmCallback->SetResultsL( aResultsRef, *object, aType );
       
   201     CleanupStack::PopAndDestroy(); //object
       
   202     _DBG_FILE("CNSmlDmDevInfoAdapt+er::FetchLeafObjectL(): end");
       
   203     }
       
   204 
       
   205 
       
   206 // -----------------------------------------------------------------------------
       
   207 //  CNSmlDmDevInfoAdapter::ChildURIListL( const TDesC& aURI, 
       
   208 // const TDesC& aParentLUID, const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   209 // const TInt aResultsRef, const TInt aStatusRef )
       
   210 // -----------------------------------------------------------------------------
       
   211 void CNSmlDmDevInfoAdapter::ChildURIListL( const TDesC8& aURI, 
       
   212                                            const TDesC8& /*aParentLUID*/, 
       
   213                                            const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/, 
       
   214                                            const TInt aResultsRef, 
       
   215                                            const TInt aStatusRef )
       
   216     {
       
   217     _DBG_FILE("CNSmlDmDevInfoAdapter::ChildURIListL(): begin");
       
   218     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
   219     CBufBase* currentURISegmentList = CBufFlat::NewL( 1 );
       
   220     CleanupStack::PushL( currentURISegmentList );
       
   221     TInt ret = aURI.LocateReverse(KNSmlDMDevInfoSeparator()[0]);
       
   222     if ( ret == KErrNotFound ) 
       
   223         {
       
   224         ret = -1;
       
   225         }
       
   226     TInt len = aURI.Length() - ( ret + 1 );
       
   227     TPtrC8 segment = aURI.Right( len );
       
   228 
       
   229     if ( segment == KNSmlDMDevInfoNodeName )
       
   230         {
       
   231         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoManNodeName() );
       
   232         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() );
       
   233         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModNodeName() );
       
   234         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() );
       
   235         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoDevIdNodeName() );
       
   236         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() );
       
   237         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoLangNodeName() );
       
   238         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() );
       
   239         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoDmVNodeName() );
       
   240         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() );
       
   241         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoExtNodeName() );
       
   242         }
       
   243     else
       
   244     if ( segment == KNSmlDMDevInfoExtNodeName )
       
   245         {
       
   246         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModDDFNodeName() );
       
   247         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() );
       
   248         currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModDevDetNodeName() );
       
   249         }
       
   250     else
       
   251         {
       
   252         retValue = CSmlDmAdapter::EError;
       
   253         }
       
   254     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   255     iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
       
   256     CleanupStack::PopAndDestroy(); //currentURISegmentList
       
   257     _DBG_FILE("CNSmlDmDevInfoAdapter::ChildURIListL(): end");
       
   258     }
       
   259 
       
   260 
       
   261 // -----------------------------------------------------------------------------
       
   262 // CNSmlDmDevInfoAdapter::AddNodeObjectL( const TDesC8& aURI, 
       
   263 // const TDesC8& aParentLUID, const TInt aStatusRef )
       
   264 // -----------------------------------------------------------------------------
       
   265 void CNSmlDmDevInfoAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, 
       
   266                                             const TDesC8& /*aParentLUID*/, 
       
   267                                             const TInt aStatusRef )
       
   268     {
       
   269     _DBG_FILE("CNSmlDmDevInfoAdapter::AddNodeObjectL(): begin");
       
   270     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   271     _DBG_FILE("CNSmlDmDevInfoAdapter::AddNodeObjectL(): end");
       
   272     }
       
   273 
       
   274 // -----------------------------------------------------------------------------
       
   275 //  CNSmlDmDevInfoAdapter::UpdateLeafObjectL()
       
   276 // -----------------------------------------------------------------------------
       
   277 void CNSmlDmDevInfoAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, 
       
   278                                                const TDesC8& /*aLUID*/, 
       
   279                                                RWriteStream*& /*aStream*/, 
       
   280                                                const TDesC8& /*aType*/, 
       
   281                                                const TInt aStatusRef )
       
   282     {
       
   283     _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: begin");
       
   284     _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: end");
       
   285     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   286     }
       
   287 
       
   288 
       
   289 // -----------------------------------------------------------------------------
       
   290 //  CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   291 //  const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef )
       
   292 // -----------------------------------------------------------------------------
       
   293 void CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, 
       
   294                                                   const TDesC8& /*aLUID*/, 
       
   295                                                   const TDesC8& aType, 
       
   296                                                   const TInt aResultsRef, 
       
   297                                                   const TInt aStatusRef )
       
   298     {
       
   299 
       
   300     _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL(): begin");
       
   301     
       
   302     CBufBase *object = CBufFlat::NewL( 1 );
       
   303     CleanupStack::PushL( object );
       
   304     CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
       
   305         
       
   306     TInt objSizeInBytes = object->Size();
       
   307     TBuf8<2> stringObjSizeInBytes;
       
   308     stringObjSizeInBytes.Num( objSizeInBytes );
       
   309     object->Reset();
       
   310     object->InsertL( 0, stringObjSizeInBytes );
       
   311     
       
   312     iDmCallback->SetStatusL( aStatusRef, retValue );
       
   313     iDmCallback->SetResultsL( aResultsRef, *object, aType );
       
   314     CleanupStack::PopAndDestroy(); //object
       
   315     _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL(): end");
       
   316     }
       
   317     
       
   318 
       
   319 // -----------------------------------------------------------------------------
       
   320 //  CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& aURI, 
       
   321 //  const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef )
       
   322 // -----------------------------------------------------------------------------
       
   323 void CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, const TInt aStatusRef )
       
   324     {
       
   325     _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): begin");
       
   326     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   327     _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): end");
       
   328     }
       
   329 
       
   330 // -----------------------------------------------------------------------------
       
   331 //  CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& aURI, 
       
   332 //  const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType, 
       
   333 //  TInt aStatusRef )
       
   334 // -----------------------------------------------------------------------------
       
   335 void CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, 
       
   336                                              const TDesC8& /*aParentLUID*/, 
       
   337                                              RWriteStream*& /*aStream*/, 
       
   338                                              const TDesC8& /*aType*/, 
       
   339                                              const TInt aStatusRef )
       
   340     {
       
   341     _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: begin");
       
   342     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   343     _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: end");
       
   344     }
       
   345 
       
   346 // -----------------------------------------------------------------------------
       
   347 //  CNSmlDmDevInfoAdapter::CopyCommandL( const TDesC8& aTargetURI, const TDesC8& 
       
   348 //  aSourceURI, const TDesC8& aSourceLUID, const TDesC8& /*aType*/, TInt aStatusRef )
       
   349 // -----------------------------------------------------------------------------
       
   350 void CNSmlDmDevInfoAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& 
       
   351                                           /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, 
       
   352                                           const TDesC8& /*aSourceLUID*/, 
       
   353                                           const TDesC8& /*aType*/, TInt aStatusRef )
       
   354     {
       
   355     _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): begin");
       
   356     iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
       
   357     _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): end");
       
   358     }
       
   359 
       
   360 // --------------------------------------
       
   361 //  CNSmlDmDevInfoAdapter::StartAtomicL()
       
   362 // --------------------------------------
       
   363 void CNSmlDmDevInfoAdapter::StartAtomicL()
       
   364     {
       
   365     _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): begin");
       
   366     _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): end");
       
   367     }
       
   368     
       
   369 // ---------------------------------------
       
   370 //  CNSmlDmDevInfoAdapter::CommitAtomicL()
       
   371 // ---------------------------------------
       
   372 void CNSmlDmDevInfoAdapter::CommitAtomicL()
       
   373     {
       
   374     _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): begin");
       
   375     _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): end");
       
   376     }
       
   377 
       
   378 // -----------------------------------------
       
   379 //  CNSmlDmDevInfoAdapter::RollbackAtomicL()
       
   380 // -----------------------------------------
       
   381 void CNSmlDmDevInfoAdapter::RollbackAtomicL()
       
   382     {
       
   383     _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): begin");
       
   384     _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): end");
       
   385     }
       
   386 
       
   387 // -----------------------------------------------------------
       
   388 //  CNSmlDmDevInfoAdapter::StreamingSupport( TInt& aItemSize )
       
   389 // -----------------------------------------------------------  
       
   390 TBool CNSmlDmDevInfoAdapter::StreamingSupport( TInt& /*aItemSize*/ )
       
   391     {
       
   392     _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): begin");
       
   393     _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): end");
       
   394     return EFalse;
       
   395     }
       
   396 
       
   397 // ------------------------------------------
       
   398 //  CNSmlDmDevInfoAdapter::StreamCommittedL()
       
   399 // ------------------------------------------
       
   400 void CNSmlDmDevInfoAdapter::StreamCommittedL()
       
   401     {
       
   402     _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): begin");
       
   403     _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): end");
       
   404     }
       
   405 
       
   406 // --------------------------------------------------
       
   407 //  CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL()
       
   408 // --------------------------------------------------   
       
   409 void CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL()
       
   410     {
       
   411     _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): begin");
       
   412     _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): end");    
       
   413     }
       
   414 
       
   415 // -----------------------------------------------------------------------------
       
   416 // CNSmlDmDevDetailAdapter::FetchLeafObjectL()
       
   417 // -----------------------------------------------------------------------------
       
   418 CSmlDmAdapter::TError CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, 
       
   419                                                                CBufBase& aObject )
       
   420     {
       
   421     _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): begin");
       
   422     CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
       
   423     TInt ret = aURI.LocateReverse(KNSmlDMDevInfoSeparator()[0]);
       
   424     if ( ret == KErrNotFound ) 
       
   425         {
       
   426         retValue = CSmlDmAdapter::EError;
       
   427         }
       
   428     else
       
   429         {
       
   430         TInt len = aURI.Length() - (ret + 1);
       
   431         TPtrC8 segment = aURI.Right( len );
       
   432         if ( segment == KNSmlDMDevInfoManNodeName ||
       
   433              segment == KNSmlDMDevInfoModNodeName ||
       
   434              segment == KNSmlDMDevInfoDevIdNodeName )
       
   435             {
       
   436             CNSmlPhoneInfo* phoneInfo = CNSmlPhoneInfo::NewLC();
       
   437             HBufC* phonedata = HBufC::NewLC( 50 );
       
   438             TPtr phonedataPtr = phonedata->Des();  
       
   439             if ( segment == KNSmlDMDevInfoManNodeName )
       
   440                 {
       
   441                 phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneManufacturer, phonedataPtr );
       
   442                 }
       
   443             if ( segment == KNSmlDMDevInfoModNodeName )
       
   444                 {
       
   445                 phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneModelId, phonedataPtr );
       
   446                 }
       
   447             if ( segment == KNSmlDMDevInfoDevIdNodeName )
       
   448                 {
       
   449                 phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneSerialNumber, phonedataPtr );
       
   450                 }
       
   451             HBufC8* phonedataInUTF8 = NULL;
       
   452             NSmlUnicodeConverter::HBufC8InUTF8LC( *phonedata, phonedataInUTF8 );
       
   453             aObject.InsertL( 0, *phonedataInUTF8 );
       
   454             CleanupStack::PopAndDestroy( 3 ); //phonedataInUTF8, phonedata, phoneInfo
       
   455             }
       
   456         else
       
   457         if ( segment == KNSmlDMDevInfoLangNodeName )
       
   458             { 
       
   459             TLanguage language = User::Language();
       
   460             TBuf8<2> langCode;
       
   461             switch ( language )
       
   462                 {
       
   463                 case ELangEnglish: 
       
   464                 case ELangAmerican:
       
   465                 case ELangAustralian:
       
   466                 case ELangNewZealand:
       
   467                 case ELangCanadianEnglish:
       
   468                 case ELangInternationalEnglish:
       
   469                 case ELangSouthAfricanEnglish:
       
   470                     langCode = KNSmlDMEnglish;
       
   471                     break; 
       
   472                 case ELangFrench:
       
   473                 case ELangSwissFrench:
       
   474                 case ELangBelgianFrench:
       
   475                 case ELangInternationalFrench:
       
   476                 case ELangCanadianFrench:
       
   477                     langCode = KNSmlDMFrench;
       
   478                     break;
       
   479                 case ELangGerman:
       
   480                 case ELangSwissGerman:
       
   481                 case ELangAustrian:
       
   482                     langCode = KNSmlDMGerman;
       
   483                     break;
       
   484                 case ELangSpanish:
       
   485                 case ELangInternationalSpanish:
       
   486                 case ELangLatinAmericanSpanish:
       
   487                     langCode = KNSmlDMSpanish;
       
   488                     break;
       
   489                 case ELangItalian:
       
   490                 case ELangSwissItalian:
       
   491                     langCode = KNSmlDMItalian;
       
   492                     break;
       
   493                 case ELangSwedish:
       
   494                 case ELangFinlandSwedish:
       
   495                     langCode = KNSmlDMSwedish;
       
   496                     break;
       
   497                 case ELangDanish:
       
   498                     langCode = KNSmlDMDanish;
       
   499                     break;
       
   500                 case ELangNorwegian:
       
   501                 case ELangNorwegianNynorsk:
       
   502                     langCode = KNSmlDMNorwegian;
       
   503                     break;
       
   504                 case ELangFinnish:
       
   505                     langCode = KNSmlDMFinnish;
       
   506                     break;
       
   507                 case ELangPortuguese:
       
   508                 case ELangBrazilianPortuguese:
       
   509                     langCode = KNSmlDMPortuguese;
       
   510                     break;
       
   511                 case ELangTurkish:
       
   512                 case ELangCyprusTurkish:
       
   513                     langCode = KNSmlDMTurkish;
       
   514                     break;
       
   515                 case ELangIcelandic:
       
   516                     langCode = KNSmlDMIcelandic;
       
   517                     break;
       
   518                 case ELangRussian:
       
   519                     langCode = KNSmlDMRussian;
       
   520                     break;
       
   521                 case ELangHungarian:
       
   522                     langCode = KNSmlDMHungarian;
       
   523                     break;
       
   524                 case ELangDutch:
       
   525                 case ELangBelgianFlemish:
       
   526                     langCode = KNSmlDMDutch;
       
   527                     break;
       
   528                 case ELangCzech:
       
   529                     langCode = KNSmlDMCzech;
       
   530                     break;
       
   531                 case ELangSlovak:
       
   532                     langCode = KNSmlDMSlovak;
       
   533                     break;
       
   534                 case ELangPolish:
       
   535                     langCode = KNSmlDMPolish;
       
   536                     break;
       
   537                 case ELangSlovenian:
       
   538                     langCode = KNSmlDMSlovenian;
       
   539                     break;
       
   540                 case ELangTaiwanChinese:
       
   541                 case ELangHongKongChinese:
       
   542                 case ELangPrcChinese:
       
   543                     langCode = KNSmlDMChinese;
       
   544                     break;
       
   545                 case ELangJapanese:
       
   546                     langCode = KNSmlDMJapanese;
       
   547                     break;
       
   548                 case ELangThai:
       
   549                     langCode = KNSmlDMThai;
       
   550                     break;
       
   551                 case ELangAfrikaans:
       
   552                     langCode = KNSmlDMAfrikaans;
       
   553                     break;
       
   554                 case ELangAlbanian:
       
   555                     langCode = KNSmlDMAlbanian;
       
   556                     break;
       
   557                 case ELangAmharic:
       
   558                     langCode = KNSmlDMAmharic;
       
   559                     break;
       
   560                 case ELangArabic:
       
   561                     langCode = KNSmlDMArabic;
       
   562                     break;
       
   563                 case ELangArmenian:
       
   564                     langCode = KNSmlDMArmenian;
       
   565                     break;
       
   566                 case ELangTagalog:
       
   567                     langCode = KNSmlDMTagalog;
       
   568                     break;
       
   569                 case ELangBelarussian:
       
   570                     langCode = KNSmlDMBelarussian;
       
   571                     break;
       
   572                 case ELangBengali:
       
   573                     langCode = KNSmlDMBengali;
       
   574                     break;
       
   575                 case ELangBulgarian:
       
   576                     langCode = KNSmlDMBulgarian;
       
   577                     break;
       
   578                 case ELangBurmese:
       
   579                     langCode = KNSmlDMBurmese;
       
   580                     break;
       
   581                 case ELangCatalan:
       
   582                     langCode = KNSmlDMCatalan;
       
   583                     break;
       
   584                 case ELangCroatian:
       
   585                     langCode = KNSmlDMCroatian;
       
   586                     break;
       
   587                 case ELangEstonian:
       
   588                     langCode = KNSmlDMEstonian;
       
   589                     break;
       
   590                 case ELangFarsi:
       
   591                     langCode = KNSmlDMFarsi;
       
   592                     break;
       
   593                 case ELangScotsGaelic:
       
   594                     langCode = KNSmlDMScotsGaelic;
       
   595                     break;
       
   596                 case ELangGeorgian:
       
   597                     langCode = KNSmlDMGeorgian;
       
   598                     break;
       
   599                 case ELangGreek:
       
   600                 case ELangCyprusGreek:
       
   601                     langCode = KNSmlDMGreek;
       
   602                     break;
       
   603                 case ELangGujarati:
       
   604                     langCode = KNSmlDMGujarati;
       
   605                     break;
       
   606                 case ELangHebrew:
       
   607                     langCode = KNSmlDMHebrew;
       
   608                     break;
       
   609                 case ELangHindi:
       
   610                     langCode = KNSmlDMHindi;
       
   611                     break;
       
   612                 case ELangIndonesian:
       
   613                     langCode = KNSmlDMIndonesian;
       
   614                     break;
       
   615                 case ELangIrish:
       
   616                     langCode = KNSmlDMIrish;
       
   617                     break;
       
   618                 case ELangKannada:
       
   619                     langCode = KNSmlDMKannada;
       
   620                     break;
       
   621                 case ELangKazakh:
       
   622                     langCode = KNSmlDMKazakh;
       
   623                     break;
       
   624                 case ELangKorean:
       
   625                     langCode = KNSmlDMKorean;
       
   626                     break;
       
   627                 case ELangLao:
       
   628                     langCode = KNSmlDMLao;
       
   629                     break;
       
   630                 case ELangLatvian:
       
   631                     langCode = KNSmlDMLatvian;
       
   632                     break;
       
   633                 case ELangLithuanian:
       
   634                     langCode = KNSmlDMLithuanian;
       
   635                     break;
       
   636                 case ELangMacedonian:
       
   637                     langCode = KNSmlDMMacedonian;
       
   638                     break;
       
   639                 case ELangMalay:
       
   640                     langCode = KNSmlDMMalay;
       
   641                     break;
       
   642                 case ELangMalayalam:
       
   643                     langCode = KNSmlDMMalayalam;
       
   644                     break;
       
   645                 case ELangMarathi:
       
   646                     langCode = KNSmlDMMarathi;
       
   647                     break;
       
   648                 case ELangMoldavian:
       
   649                     langCode = KNSmlDMMoldavian;
       
   650                     break;
       
   651                 case ELangMongolian:
       
   652                     langCode = KNSmlDMMongolian;
       
   653                     break;
       
   654                 case ELangPunjabi:
       
   655                     langCode = KNSmlDMPunjabi;
       
   656                     break;
       
   657                 case ELangRomanian:
       
   658                     langCode = KNSmlDMRomanian;
       
   659                     break;
       
   660                 case ELangSerbian:
       
   661                     langCode = KNSmlDMSerbian;
       
   662                     break;
       
   663                 case ELangSinhalese:
       
   664                     langCode = KNSmlDMSinhalese;
       
   665                     break;
       
   666                 case ELangSomali:
       
   667                     langCode = KNSmlDMSomali;
       
   668                     break;
       
   669                 case ELangSwahili:
       
   670                     langCode = KNSmlDMSwahili;
       
   671                     break;
       
   672                 case ELangTamil:
       
   673                     langCode = KNSmlDMTamil;
       
   674                     break;
       
   675                 case ELangTelugu:
       
   676                     langCode = KNSmlDMTelugu;
       
   677                     break;
       
   678                 case ELangTibetan:
       
   679                     langCode = KNSmlDMTibetan;
       
   680                     break;
       
   681                 case ELangTigrinya:
       
   682                     langCode = KNSmlDMTigrinya;
       
   683                     break;
       
   684                 case ELangTurkmen:
       
   685                     langCode = KNSmlDMTurkmen;
       
   686                     break;
       
   687                 case ELangUkrainian:
       
   688                     langCode = KNSmlDMUkrainian;
       
   689                     break;
       
   690                 case ELangUrdu:
       
   691                     langCode = KNSmlDMUrdu;
       
   692                     break;
       
   693                 case ELangVietnamese:
       
   694                     langCode = KNSmlDMVietnamese;
       
   695                     break;
       
   696                 case ELangWelsh:
       
   697                     langCode = KNSmlDMWelsh;
       
   698                     break;
       
   699                 case ELangZulu:
       
   700                     langCode = KNSmlDMZulu;
       
   701                     break;
       
   702                 default:
       
   703                     langCode = KNSmlDMEnglish;
       
   704                 }
       
   705             aObject.InsertL( 0, langCode );
       
   706             }
       
   707         else
       
   708         if ( segment == KNSmlDMDevInfoDmVNodeName )
       
   709             {
       
   710             if(!FeatureManager::FeatureSupported( KFeatureIdSyncMlDm112  ))
       
   711                 aObject.InsertL( 0, KNSmlDMDmV12 );
       
   712             else
       
   713             aObject.InsertL( 0, KNSmlDMDmV );
       
   714             }
       
   715         else
       
   716         if ( segment == KNSmlDMDevInfoModDDFNodeName )
       
   717             {
       
   718 
       
   719             }
       
   720         else
       
   721         if ( segment == KNSmlDMDevInfoModDevDetNodeName )
       
   722             {
       
   723             TUid implUID;
       
   724             implUID.iUid = KNSmlDMDevDetailAdapterImplUid;
       
   725             
       
   726             TAny* nPtr = NULL;
       
   727             MSmlDmCallback& aDmNull = reinterpret_cast<MSmlDmCallback&>(nPtr);
       
   728             CNSmlDmDevDetailAdapter* devDetAdapter = 
       
   729                 reinterpret_cast<CNSmlDmDevDetailAdapter*>(CSmlDmAdapter::NewL( implUID, aDmNull ) );
       
   730             CleanupStack::PushL(devDetAdapter);
       
   731             TInt checkSumDevDet = devDetAdapter->DevDetailValueCrcL();
       
   732             TBuf8<16> stringCheckSumDevDet; 
       
   733             stringCheckSumDevDet.Num( checkSumDevDet );
       
   734             aObject.InsertL( 0, stringCheckSumDevDet );
       
   735             CleanupStack::PopAndDestroy(); // devDetAdapter
       
   736             }
       
   737         else
       
   738             {
       
   739             retValue = CSmlDmAdapter::EError;
       
   740             }
       
   741         }
       
   742     _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): end");
       
   743     return retValue;
       
   744     }
       
   745 
       
   746 // -----------------------------------------------------------------------------
       
   747 //
       
   748 // -----------------------------------------------------------------------------
       
   749 #ifndef IMPLEMENTATION_PROXY_ENTRY
       
   750 #define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr)  {{aUid},(aFuncPtr)}
       
   751 #endif
       
   752 
       
   753 const TImplementationProxy ImplementationTable[] = 
       
   754     {
       
   755         IMPLEMENTATION_PROXY_ENTRY(KNSmlDMDevInfoAdapterImplUid, CNSmlDmDevInfoAdapter::NewL)
       
   756     };
       
   757 
       
   758 // -----------------------------------------------------------------------------
       
   759 //
       
   760 // -----------------------------------------------------------------------------
       
   761 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   762     {
       
   763     _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevInfoAdapter: begin");
       
   764     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   765     _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevInfoAdapter: end");
       
   766     return ImplementationTable;
       
   767     }
       
   768 
       
   769 // End of file
       
   770