# HG changeset patch # User hgs # Date 1278972874 -19800 # Node ID 137912d1a556cc8706e3b2e12dc9006037aa03cb # Parent 88e14c3d4c4fbbc2dc5428f2ee98437ab144053d 201021 diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/bld/bld.inf --- a/deviceupdatesui/adapters/bld/bld.inf Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: for building DM adapters -* -*/ - - - - - -#include "../devinfo/bld/bld.inf" -#include "../devdetail/bld/bld.inf" -#include "../syncmldm12/bld/bld.inf" - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/bld/DevDetail_HwV.txt --- a/deviceupdatesui/adapters/devdetail/bld/DevDetail_HwV.txt Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0000 \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/bld/DevDetail_SwV.txt --- a/deviceupdatesui/adapters/devdetail/bld/DevDetail_SwV.txt Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -xxx-xxx 0.00 00 \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/bld/bld.inf --- a/deviceupdatesui/adapters/devdetail/bld/bld.inf Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: build info file for DevDetail adapter -* -*/ - - - - -PRJ_EXPORTS -./DevDetail_SwV.txt /epoc32/release/winscw/udeb/z/resource/devman/devdetail_swv.txt -./DevDetail_SwV.txt /epoc32/release/winscw/urel/z/resource/devman/devdetail_swv.txt -./DevDetail_HwV.txt /epoc32/release/winscw/udeb/z/resource/devman/devdetail_hwv.txt -./DevDetail_HwV.txt /epoc32/release/winscw/urel/z/resource/devman/devdetail_hwv.txt - -PRJ_MMPFILES -./nsmldmdevdetailadapter.mmp - - - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/bld/nsmldmdevdetailadapter.mmp --- a/deviceupdatesui/adapters/devdetail/bld/nsmldmdevdetailadapter.mmp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for devdetail adapter -* -*/ - - - - -#include "defaultcaps.hrh" -#include - -//This flag is used for enabling Fota Multi-ROFS Support -MACRO _ENABLE_MULTIROFS_SUPPORT - -TARGET nsmldmdevdetailadapter.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x101F6DE9 -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - -SOURCEPATH ../src -USERINCLUDE ../inc -USERINCLUDE ../../inc -SOURCE nsmldmdevdetailadapter.cpp - -//#if defined(ARMCC) -SOURCE nsmldmdevdetailutils_ARM.cpp -//#elif defined(WINSCW) -//SOURCE nsmldmdevdetailutils_WINSCW.cpp -//#endif - -START RESOURCE nsmldmdevdetailadapter.rss -LANGUAGE_IDS -END - - - - -//#if defined(ARMCC) -LIBRARY sysutil.lib -//#elif defined(WINSCW) -//LIBRARY efsrv.lib -//#endif - - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY nsmldebug.lib -LIBRARY nsmlagentcommon.lib - -//For Multi-ROFS Support -LIBRARY sysversioninfo.lib - - -SMPSAFE diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/inc/nsmldmdevdetailadapter.h --- a/deviceupdatesui/adapters/devdetail/inc/nsmldmdevdetailadapter.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM DevDetail Adapter -* -*/ - - - - -#ifndef __NSMLDMDEVDETAILADAPTER_H__ -#define __NSMLDMDEVDETAILADAPTER_H__ - -// INCLUDES - -#include -#include -#include "nsmldmconstants.h" - -// the DDF version must be changed if any changes in DDF structure -// ( built in DDFStructureL() function ) -_LIT8( KNSmlDMDevDetailDDFVersion, "1.0" ); - -_LIT8( KNSmlDMDevDetailTextPlain, "text/plain" ); -_LIT8( KNSmlDMDevDetailNodeName, "DevDetail" ); -_LIT8( KNSmlDMDevDetailDescription, "The interior object holds all DevDetail objects" ); - -_LIT8( KNSmlDMDevDetailDevTypNodeName, "DevTyp" ); -_LIT8( KNSmlDMDevDetailDevTypDescription, "The type of the device" ); -_LIT8( KNSmlDMDevDetailDevTypValue, "smartphone" ); - -_LIT8( KNSmlDMDevDetailOEMNodeName, "OEM" ); -_LIT8( KNSmlDMDevDetailOEMDescription, "Original Equipment Manufacturer" ); - -_LIT8( KNSmlDMDevDetailFwVNodeName, "FwV" ); -_LIT8( KNSmlDMDevDetailFwVDescription, "The firmware revision of the device" ); - -_LIT8( KNSmlDMDevDetailSwVNodeName, "SwV" ); -_LIT8( KNSmlDMDevDetailSwVDescription, "The software revision of the device" ); - -_LIT8( KNSmlDMDevDetailHwVNodeName, "HwV" ); -_LIT8( KNSmlDMDevDetailHwVDescription, "The hardware revision of the device" ); - -_LIT8( KNSmlDMDevDetailLrgObjNodeName, "LrgObj" ); -_LIT8( KNSmlDMDevDetailLrgObjDescription, "Large object handling supported if value is true" ); -_LIT8( KNSmlDMDevDetailLrgObjValue, "true" ); - -_LIT8( KNSmlDMDevDetailURINodeName, "URI" ); -_LIT8( KNSmlDMDevDetailURIDescription, "The tree limitations branch" ); - -_LIT8( KNSmlDMDevDetailMaxDepthNodeName, "MaxDepth" ); -_LIT8( KNSmlDMDevDetailMaxDepthDescription, "Maximum tree depth" ); -_LIT8( KNSmlDMDevDetailMaxDepthValue, "0" ); - -_LIT8( KNSmlDMDevDetailMaxTotLenNodeName, "MaxTotLen" ); -_LIT8( KNSmlDMDevDetailMaxTotLenDescription, "Maximum URI length" ); -_LIT8( KNSmlDMDevDetailMaxTotLenValue, "0" ); - -_LIT8( KNSmlDMDevDetailMaxSegLenNodeName, "MaxSegLen" ); -_LIT8( KNSmlDMDevDetailMaxSegLenDescription, "Maximum URI segment length" ); -_LIT8( KNSmlDMDevDetailMaxSegLenValue, "9" ); - -_LIT8( KNSmlDMDevDetailSeparator, "/" ); - -const TInt KNSmlMaxRequestBufferLength = 128; -const TInt KNSmlMaxSizeBufferLength = 4; - -_LIT( KNSmlDevDetailPanic, "DevDetail" ); - -// CLASS DECLARATION -class CNSmlDmDevDetailAdapter : public CSmlDmAdapter - { -public: // contructors and destructor - static CNSmlDmDevDetailAdapter* NewL(MSmlDmCallback* aDmCallback ); - static CNSmlDmDevDetailAdapter* NewLC(MSmlDmCallback* aDmCallback ); - - virtual ~CNSmlDmDevDetailAdapter(); - virtual TInt DevDetailValueCrcL(); - -private: // new functions - CNSmlDmDevDetailAdapter(TAny* aEcomArguments); - void AddObjectToBufferL( CBufBase& aCrcBuf, const TDesC8& aURI ); - CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, CBufBase& aObject ); - void SetLeafPropertiesL( MSmlDmDDFObject& aObject, - const TSmlDmAccessTypes& aAccessTypes, - const TDesC8& aDescription ) const; - -private: // functions from base classes - // from CSmlDmAdapter - void DDFVersionL( CBufBase& aVersion ); - void DDFStructureL( MSmlDmDDFObject& aDDF ); - void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aObject, const TDesC8& aType, - const TInt aStatusRef ); - void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TInt aStatusRef ); - void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aType, const TInt aResultsRef, - const TInt aStatusRef ); - void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, - const CArrayFix& aPreviousURISegmentList, - const TInt aResultsRef, const TInt aStatusRef ); - void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, - const TInt aStatusRef ); - void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - RWriteStream*& aStream, const TDesC8& aType, - const TInt aStatusRef ); - void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aType, const TInt aResultsRef, - const TInt aStatusRef ); - void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, - const TDesC8& aType, const TInt aStatusRef ); - void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, RWriteStream*& aStream, - const TDesC8& aType, const TInt aStatusRef ); - void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, - const TDesC8& aSourceURI, const TDesC8& aSourceLUID, - const TDesC8& aType, TInt aStatusRef ); - void StartAtomicL(); - void CommitAtomicL(); - void RollbackAtomicL(); - TBool StreamingSupport( TInt& aItemSize ); - void StreamCommittedL(); - void CompleteOutstandingCmdsL(); - -// FOTA -private: - - /** - * Enumeration specifies the data that can be fetched using - * GetDevDetailDataL(). - */ - enum TNSmlDevDetailData - { - ESwVersion, - EHwVersion - }; - - /** - * Fetches and/or forms DevDetail data specified by aElement. - * In WINSCW this data is read from file. In ARM builds the - * data is fetched from EInfo. - * @param aObject The buffer where fetched data is inserted. - * @param aElement Specifies the data that should be fetched. - */ - void GetDevDetailDataL( CBufBase& aObject, TNSmlDevDetailData aElement ) const; - -// FOTA end - -private: - - MSmlDmCallback* iDmCallback; - - }; - -#endif // __NSMLDMDEVDETAILADAPTER_H__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailadapter.cpp --- a/deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailadapter.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,561 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM DevDetail Adapter Source Code -* -*/ - - - - -// INCLUDE FILES -#include // For TImplementationProxy definition - -#include "nsmldmimpluids.h" -#include "nsmldmdevdetailadapter.h" -#include "nsmldebug.h" -#include "nsmlphoneinfo.h" -#include "nsmlunicodeconverter.h" -#include "nsmlconstants.h" - - -// ------------------------------------------------------------------------------------------------ -// CNSmlDmDevDetailAdapter::NewL( ) -// ------------------------------------------------------------------------------------------------ -CNSmlDmDevDetailAdapter* CNSmlDmDevDetailAdapter::NewL(MSmlDmCallback* aDmCallback ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::NewL(): begin"); - CNSmlDmDevDetailAdapter* self = NewLC( aDmCallback ); - CleanupStack::Pop(); - _DBG_FILE("CNSmlDmDevDetailAdapter::NewL(): end"); - return self; - } - -// ------------------------------------------------------------------------------------------------ -// CNSmlDmDevDetailAdapter::NewLC( ) -// ------------------------------------------------------------------------------------------------ -CNSmlDmDevDetailAdapter* CNSmlDmDevDetailAdapter::NewLC(MSmlDmCallback* aDmCallback ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::NewLC(): begin"); - CNSmlDmDevDetailAdapter* self = new (ELeave) CNSmlDmDevDetailAdapter(aDmCallback); - CleanupStack::PushL(self); - self->iDmCallback=aDmCallback; - _DBG_FILE("CNSmlDmDevDetailAdapter::NewLC(): end"); - return self; - } - - -// ------------------------------------------------------------------------------------------------ -// CNSmlDmDevDetailAdapter::CNSmlDmDevDetailAdapter(TAny* aEcomArguments) -// ------------------------------------------------------------------------------------------------ -CNSmlDmDevDetailAdapter::CNSmlDmDevDetailAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::CNSmlDmDevDetailAdapter(): begin"); - _DBG_FILE("CNSmlDmDevDetailAdapter::CNSmlDmDevDetailAdapter(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::~CNSmlDmDevDetailAdapter() -// ----------------------------------------------------------------------------- -CNSmlDmDevDetailAdapter::~CNSmlDmDevDetailAdapter() - { - _DBG_FILE("CNSmlDmDevDetailAdapter::~CNSmlDmDevDetailAdapter(): begin"); - _DBG_FILE("CNSmlDmDevDetailAdapter::~CNSmlDmDevDetailAdapter(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::DevDetailValueCrcL() -// ----------------------------------------------------------------------------- -TInt CNSmlDmDevDetailAdapter::DevDetailValueCrcL() - { - CBufBase* crcBuf = CBufFlat::NewL( 1 ); - CleanupStack::PushL( crcBuf ); - - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailDevTypNodeName() ); - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailOEMNodeName() ); - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailFwVNodeName() ); - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailSwVNodeName() ); - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailHwVNodeName() ); - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailLrgObjNodeName() ); - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailMaxDepthNodeName() ); - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailMaxTotLenNodeName() ); - AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailMaxSegLenNodeName() ); - - TUint16 crc = 0; - Mem::Crc( crc, crcBuf->Ptr(0).Ptr(), crcBuf->Size() ); - CleanupStack::PopAndDestroy(); // crcBuf - return crc; - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::AddObjectToBufferL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::AddObjectToBufferL( CBufBase& aCrcBuf, - const TDesC8& aURI ) - { - CBufBase* buf = CBufFlat::NewL( 1 ); - CleanupStack::PushL( buf ); - FetchLeafObjectL( aURI, *buf ); - aCrcBuf.InsertL( aCrcBuf.Size(), buf->Ptr(0) ); - _LIT8( KNSmlDmSeparator, ";" ); - aCrcBuf.InsertL( aCrcBuf.Size(), KNSmlDmSeparator ); - CleanupStack::PopAndDestroy(); //buf - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::FetchLeafObjectL() -// ----------------------------------------------------------------------------- -CSmlDmAdapter::TError CNSmlDmDevDetailAdapter::FetchLeafObjectL( const TDesC8& aURI, - CBufBase& aObject ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectL(): begin"); - CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - - TInt ret = aURI.LocateReverse(KNSmlDMDevDetailSeparator()[0]); - if ( ret == KErrNotFound ) - { - ret = -1; - } - TInt len = aURI.Length() - ( ret + 1 ); - TPtrC8 segment = aURI.Right( len ); - if ( segment == KNSmlDMDevDetailDevTypNodeName ) - { - aObject.InsertL( 0, KNSmlDMDevDetailDevTypValue ); - } - else - if ( segment == KNSmlDMDevDetailOEMNodeName ) - { - CNSmlPhoneInfo* phoneInfo = CNSmlPhoneInfo::NewLC(); - HBufC* manufacturer = HBufC::NewLC( 50 ); - TPtr manufacturerPtr = manufacturer->Des(); - phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneManufacturer, manufacturerPtr ); - HBufC8* manufacturerInUTF8 = NULL; - NSmlUnicodeConverter::HBufC8InUTF8LC( *manufacturer, manufacturerInUTF8 ); - aObject.InsertL( 0, *manufacturerInUTF8 ); - CleanupStack::PopAndDestroy( 3 ); //manufacturerInUTF8, manufacturer, phoneInfo - } - else - if ( segment == KNSmlDMDevDetailSwVNodeName ) - { - // fetch software version - GetDevDetailDataL( aObject, ESwVersion ); - } - else - if ( segment == KNSmlDMDevDetailHwVNodeName ) - { - // fetch hardware version - GetDevDetailDataL( aObject, EHwVersion ); - } - else - if ( segment == KNSmlDMDevDetailLrgObjNodeName ) - { - aObject.InsertL( 0, KNSmlDMDevDetailLrgObjValue ); - } - else - if ( segment == KNSmlDMDevDetailMaxDepthNodeName ) - { - aObject.InsertL( 0, KNSmlDMDevDetailMaxDepthValue ); - } - else - if ( segment == KNSmlDMDevDetailMaxTotLenNodeName ) - { - aObject.InsertL( 0, KNSmlDMDevDetailMaxTotLenValue ); - } - else - if ( segment == KNSmlDMDevDetailMaxSegLenNodeName ) - { - aObject.InsertL( 0, KNSmlDMDevDetailMaxSegLenValue ); - } - else - if ( segment != KNSmlDMDevDetailFwVNodeName ) - { - retValue = CSmlDmAdapter::EError; - } - - _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectL(): end"); - return retValue; - } -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::SetLeafPropertiesL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject, - const TSmlDmAccessTypes& aAccessTypes, - const TDesC8& aDescription ) const - { - aObject.SetAccessTypesL( aAccessTypes ); - aObject.SetScopeL( MSmlDmDDFObject::EPermanent ); - aObject.SetDFFormatL( MSmlDmDDFObject::EChr ); - aObject.AddDFTypeMimeTypeL( KNSmlDMDevDetailTextPlain ); - aObject.SetDescriptionL( aDescription ); - } - - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::DDFVersionL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::DDFVersionL(CBufBase& aDDFVersion) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::DDFVersionL(TDes& aDDFVersion): begin"); - aDDFVersion.InsertL(0,KNSmlDMDevDetailDDFVersion); - _DBG_FILE("CNSmlDmDevDetailAdapter::DDFVersionL(TDes& aDDFVersion): end"); - } - - -// ----------------------------------------------------------------------------- -// void CNSmlDmDevDetailAdapter::DDFStructureL() -// -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::DDFStructureL(): begin"); - - TSmlDmAccessTypes accessTypes; - - accessTypes.SetGet(); - // DevDetail - MSmlDmDDFObject& devDetail = aDDF.AddChildObjectL( KNSmlDMDevDetailNodeName ); - devDetail.SetAccessTypesL( accessTypes ); - devDetail.SetScopeL( MSmlDmDDFObject::EPermanent ); - devDetail.SetDescriptionL( KNSmlDMDevDetailDescription ); - - // DevTyp - MSmlDmDDFObject& devTyp = devDetail.AddChildObjectL(KNSmlDMDevDetailDevTypNodeName ); - SetLeafPropertiesL( devTyp, accessTypes, KNSmlDMDevDetailDevTypDescription ); - // OEM - MSmlDmDDFObject& oem = devDetail.AddChildObjectL(KNSmlDMDevDetailOEMNodeName); - SetLeafPropertiesL( oem, accessTypes, KNSmlDMDevDetailOEMDescription ); - // FwV - MSmlDmDDFObject& fwv = devDetail.AddChildObjectL(KNSmlDMDevDetailFwVNodeName); - SetLeafPropertiesL( fwv, accessTypes, KNSmlDMDevDetailFwVDescription ); - // SwV - MSmlDmDDFObject& swv = devDetail.AddChildObjectL( KNSmlDMDevDetailSwVNodeName ); - SetLeafPropertiesL( swv, accessTypes, KNSmlDMDevDetailSwVDescription ); - // HwV - MSmlDmDDFObject& hwv = devDetail.AddChildObjectL(KNSmlDMDevDetailHwVNodeName ); - SetLeafPropertiesL( hwv, accessTypes, KNSmlDMDevDetailHwVDescription ); - // LrgObj - MSmlDmDDFObject& lrgObj = devDetail.AddChildObjectL(KNSmlDMDevDetailLrgObjNodeName ); - SetLeafPropertiesL( lrgObj, accessTypes, KNSmlDMDevDetailLrgObjDescription ); - lrgObj.SetDFFormatL( MSmlDmDDFObject::EBool ); - // URI - MSmlDmDDFObject& uri = devDetail.AddChildObjectL(KNSmlDMDevDetailURINodeName); - uri.SetAccessTypesL( accessTypes ); - uri.SetScopeL( MSmlDmDDFObject::EPermanent ); - uri.SetDescriptionL( KNSmlDMDevDetailURIDescription ); - // MaxDepth - MSmlDmDDFObject& maxDepth = uri.AddChildObjectL( KNSmlDMDevDetailMaxDepthNodeName); - SetLeafPropertiesL( maxDepth, accessTypes, KNSmlDMDevDetailMaxDepthDescription ); - // MaxTotLen - MSmlDmDDFObject& maxTotLen = uri.AddChildObjectL( KNSmlDMDevDetailMaxTotLenNodeName ); - SetLeafPropertiesL( maxTotLen, accessTypes, KNSmlDMDevDetailMaxTotLenDescription ); - // MaxSegLen - MSmlDmDDFObject& maxSegLen = uri.AddChildObjectL( KNSmlDMDevDetailMaxSegLenNodeName); - SetLeafPropertiesL( maxSegLen, accessTypes, KNSmlDMDevDetailMaxSegLenDescription ); - - _DBG_FILE("CNSmlDmDevDetailAdapter::DDFStructureL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::UpdateLeafObjectL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, - const TDesC8& /*aLUID*/, - const TDesC8& /*aObject*/, - const TDesC8& /*aType*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::UpdateLeafObjectL(): begin"); - _DBG_FILE("CNSmlDmDevDetailAdapter::UpdateLeafObjectL(): end"); - iDmCallback->SetStatusL(aStatusRef,CSmlDmAdapter::EError); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::DeleteObjectL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::DeleteObjectL( const TDesC8& /*aURI*/, - const TDesC8& /*aLUID*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::DeleteLeafObjectL( ): begin"); - _DBG_FILE("CNSmlDmDevDetailAdapter::DeleteLeafObjectL( ): end"); - iDmCallback->SetStatusL(aStatusRef,CSmlDmAdapter::EError); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::FetchLeafObjectL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::FetchLeafObjectL( const TDesC8& aURI, - const TDesC8& /*aLUID*/, - const TDesC8& aType, - const TInt aResultsRef, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectL(): begin"); - CBufBase *object = CBufFlat::NewL( 1 ); - CleanupStack::PushL( object ); - CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object ); - - iDmCallback->SetStatusL( aStatusRef, retValue ); - iDmCallback->SetResultsL( aResultsRef, *object, aType); - CleanupStack::PopAndDestroy(); //object - - _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectL(): end"); - } - - -// ----------------------------------------------------------------------------- -// CSmlDmAdapter::TError CNSmlDmDevDetailAdapter::ChildURIListL() -// ----------------------------------------------------------------------------- - -void CNSmlDmDevDetailAdapter::ChildURIListL( const TDesC8& aURI, - const TDesC8& /*aLUID*/, - const CArrayFix& /*aPreviousURISegmentList*/, - const TInt aResultsRef, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::ChildURIListL(): begin"); - CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - CBufBase *currentURISegmentList = CBufFlat::NewL(64); - CleanupStack::PushL(currentURISegmentList); - - TInt ret = aURI.LocateReverse(KNSmlDMDevDetailSeparator()[0]); - if ( ret == KErrNotFound ) - { - ret = -1; - } - TInt len = aURI.Length() - ( ret + 1 ); - TPtrC8 segment = aURI.Right( len ); - - if ( segment == KNSmlDMDevDetailNodeName ) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailDevTypNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailOEMNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailFwVNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSwVNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailHwVNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailLrgObjNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailURINodeName() ); - } - else - if ( segment == KNSmlDMDevDetailURINodeName ) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailMaxDepthNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailMaxTotLenNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailMaxSegLenNodeName() ); - } - else - { - retValue = CSmlDmAdapter::EError; - } - - iDmCallback->SetStatusL(aStatusRef,retValue); - iDmCallback->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); - CleanupStack::PopAndDestroy(); //currentURISegmentList; - _DBG_FILE("CNSmlDmDevDetailAdapter::ChildURIListL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::AddNodeObjectL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, - const TDesC8& /*aParentLUID*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::AddNodeObjectL(): begin"); - _DBG_FILE("CNSmlDmDevDetailAdapter::AddNodeObjectL(): end"); - iDmCallback->SetStatusL(aStatusRef,CSmlDmAdapter::EError); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::UpdateLeafObjectL(const TDesC8& aURI, -// const TDesC8& aLUID, RWriteStream*& aStream, const TDesC8& aType, -// const TInt aStatusRef) -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, - const TDesC8& /*aLUID*/, - RWriteStream*& /*aStream*/, - const TDesC8& /*aType*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: begin"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, -// const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef, -// const TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, - const TDesC8& /*aLUID*/, - const TDesC8& aType, - const TInt aResultsRef, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL(): begin"); - - CBufBase *object = CBufFlat::NewL( 1 ); - CleanupStack::PushL( object ); - CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object ); - - TInt objSizeInBytes = object->Size(); - TBuf8 stringObjSizeInBytes; - stringObjSizeInBytes.Num( objSizeInBytes ); - object->Reset(); - object->InsertL( 0, stringObjSizeInBytes ); - - iDmCallback->SetStatusL( aStatusRef, retValue ); - iDmCallback->SetResultsL( aResultsRef, *object, aType); - CleanupStack::PopAndDestroy(); //object - - - _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::ExecuteCommandL( const TDesC8& aURI, -// const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, -// TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): begin"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::ExecuteCommandL( const TDesC8& aURI, -// const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType, -// const TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, - const TDesC8& /*aParentLUID*/, - RWriteStream*& /*aStream*/, - const TDesC8& /*aType*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: begin"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: end"); - } -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::CopyCommandL( const TDesC8& aTargetURI, -// const TDesC8& aSourceURI, const TDesC8& aSourceLUID, const TDesC8& aType, -// const TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, - const TDesC8& /*aTargetLUID*/, - const TDesC8& /*aSourceURI*/, - const TDesC8& /*aSourceLUID*/, - const TDesC8& /*aType*/, - TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): begin"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): end"); - } - -// ---------------------------------------- -// CNSmlDmDevDetailAdapter::StartAtomicL() -// ---------------------------------------- -void CNSmlDmDevDetailAdapter::StartAtomicL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): end"); - } - -// ----------------------------------------- -// CNSmlDmDevDetailAdapter::CommitAtomicL() -// ----------------------------------------- -void CNSmlDmDevDetailAdapter::CommitAtomicL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): end"); - } - -// ------------------------------------------- -// CNSmlDmDevDetailAdapter::RollbackAtomicL() -// ------------------------------------------- -void CNSmlDmDevDetailAdapter::RollbackAtomicL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): end"); - } - -// ------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::StreamingSupport( TInt& aItemSize ) -// ------------------------------------------------------------- -TBool CNSmlDmDevDetailAdapter::StreamingSupport( TInt& /*aItemSize*/ ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): end"); - return EFalse; - } - -// -------------------------------------------- -// CNSmlDmDevDetailAdapter::StreamCommittedL() -// -------------------------------------------- -void CNSmlDmDevDetailAdapter::StreamCommittedL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): end"); - } - -// ---------------------------------------------------- -// CNSmlDmDevDetailAdapter::CompleteOutstandingCmdsL() -// ---------------------------------------------------- -void CNSmlDmDevDetailAdapter::CompleteOutstandingCmdsL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): end"); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- - -#ifndef IMPLEMENTATION_PROXY_ENTRY -#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} -#endif - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KNSmlDMDevDetailAdapterImplUid, - CNSmlDmDevDetailAdapter::NewL) - }; - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevDetailAdapter: begin"); - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevDetailAdapter: end"); - return ImplementationTable; - } - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailadapter.rss --- a/deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailadapter.rss Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of dm adapters -* This is part of omadmextensions. -* -*/ - - -CHARACTER_SET UTF8 - -/* -* ============================================================================ -* Name : 101f6de9.rss -* Part of : SyncMl -* Origin : SyncML Phase 2 -* Created : 06.03.2003 -* Implementation notes: -* -* Version : 0.1 -* $Revision: 2 $, $Modtime: 10.05.05 11:04 $ by $Author: Kollasep $ -* --------------------------------------------------------------------------- -* Version history: -* Template version: 1.02, 21.6.2000 by maparnan -* -* -* ============================================================================ -*/ - - - -#include -#include - -RESOURCE REGISTRY_INFO theRegistryInfo - { - dll_uid = 0x101F6DE9; //The DLL's 3rd UID. - interfaces = - { - INTERFACE_INFO - { - interface_uid = KNSmlDMInterfaceUid; // DM interface UID - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x101F6DEF; // DM devdetail implementation UID - version_no = 1; - display_name = ""; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailutils_ARM.cpp --- a/deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailutils_ARM.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM DevDetail Adapter Source Code, ARM implementation -* -*/ - - - - -// INCLUDES -#include -#include "nsmldmdevdetailadapter.h" -#include "nsmldebug.h" - -#if defined (_ENABLE_MULTIROFS_SUPPORT) -#include -#else -// CONSTANTS -_LIT8( KNSmlSwVersionSeparator, " " ); -#endif - -// --------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::GetDevDetailDataL( ) -// Fetches device specific data using EInfo interface. -// --------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::GetDevDetailDataL( - CBufBase& aObject, - TNSmlDevDetailData aElement ) const - { - _DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): begin (MARM)"); - - aObject.Reset(); - - switch( aElement ) - { - case ESwVersion: - { - // buffers for data fetched from sysutil -#if defined (_ENABLE_MULTIROFS_SUPPORT) - - TBuf16 temp; - TBuf8 temp8; - temp.Zero(); - temp8.Zero(); - SysVersionInfo::TVersionInfoType what = SysVersionInfo::EFWVersion; - TInt error = SysVersionInfo::GetVersionInfo(what,temp); - - User::LeaveIfError(error); - - //Ascii copy which is required - temp8.Copy(temp); - aObject.InsertL(0,temp8); - //Unicode copy if required - //aObject.InsertL(0,temp.Ptr(),temp.Length()); -#else - HBufC* verBuf = HBufC::NewLC( KSysUtilVersionTextLength ); - HBufC8* verBuf8 = HBufC8::NewLC( KSysUtilVersionTextLength ); - - TPtr ver = verBuf->Des(); - TPtr8 ver8 = verBuf8->Des(); - // fetch software version (sw.txt) from sysutil - SysUtil::GetSWVersion( ver ); - ver8.Copy( ver ); - - // parse sw fields and append to aObject - TChar separator('\n'); - TInt pos = ver8.Locate( separator ); - - if ( pos == KErrNotFound ) - { - User::Leave( KErrNotFound ); - } - - // insert version (1st field) and separator to beginning - aObject.InsertL( 0, ver8.Mid( 0, pos ) ); - aObject.InsertL( 0, KNSmlSwVersionSeparator ); - - // locate type designator (3rd field) - ver8 = ver8.Mid( pos + 1 ); - pos = ver8.Locate( separator ); - ver8 = ver8.Mid( pos + 1 ); - pos = ver8.Locate( separator ); - - if ( pos == KErrNotFound ) - { - // type designator (the rest of the string, since there was no \n found) - aObject.InsertL( 0, ver8 ); - } - else - { - // type designator to beginning - aObject.InsertL( 0, ver8.Mid( 0, pos ) ); - } - - // fetch variant (lang.txt) from sysutil - ver.Zero(); - SysUtil::GetLangVersion( ver ); - ver8.Copy( ver ); - - // insert separator and variant to the end - aObject.InsertL( aObject.Size(), KNSmlSwVersionSeparator ); - aObject.InsertL( aObject.Size(), ver8 ); - - CleanupStack::PopAndDestroy( verBuf8 ); - CleanupStack::PopAndDestroy( verBuf ); -#endif //_ENABLE_MULTIROFS_SUPPORT - break; - } - case EHwVersion: - { - break; - } - default: - User::Panic( KNSmlDevDetailPanic, KErrArgument ); - break; - } - - _DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): end (MARM)"); - } - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailutils_WINSCW.cpp --- a/deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailutils_WINSCW.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM DevDetail Adapter Source Code, WINSCW implementation -* -*/ - - - - -// INCLUDES -#include "nsmldmdevdetailadapter.h" -#include "nsmldebug.h" - -// CONSTANTS -_LIT( KNSmlDevDetailSwVFile, "z:\\Resource\\DevMan\\DevDetail_SwV.txt" ); -_LIT( KNSmlDevDetailHwVFile, "z:\\Resource\\DevMan\\DevDetail_HwV.txt" ); - -const TInt KNSmlDevDetailMaxDataSize = 2048; - -// --------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::GetDevDetailDataL( ) -// --------------------------------------------------------------------------- -void CNSmlDmDevDetailAdapter::GetDevDetailDataL( - CBufBase& aObject, - TNSmlDevDetailData aElement ) const - { - _DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): begin (WINSCW)"); - - // Select file according to aElement - HBufC* name = NULL; - - switch( aElement ) - { - case ESwVersion: - name = KNSmlDevDetailSwVFile().AllocLC(); - break; - case EHwVersion: - name = KNSmlDevDetailHwVFile().AllocLC(); - break; - default: - User::Panic( KNSmlDevDetailPanic, KErrArgument ); - } - - // open file server session - RFs fileSession; - User::LeaveIfError( fileSession.Connect() ); - CleanupClosePushL( fileSession ); - - // open file - RFile file; - TInt err = file.Open( fileSession, *name, EFileRead|EFileShareReadersOnly ); - - // if opening file succeeded, read the contents of the file - if ( err == KErrNone ) - { - CleanupClosePushL( file ); - - // read only if data size is not too large - TInt fileSize = 0; - User::LeaveIfError( file.Size( fileSize ) ); - if ( fileSize <= KNSmlDevDetailMaxDataSize ) - { - // read data - HBufC8* data = HBufC8::NewLC( fileSize ); - TPtr8 dataPtr = data->Des(); - file.Read( dataPtr, fileSize ); - - // insert data to result buffer - aObject.Reset(); - aObject.InsertL( 0, *data ); - - CleanupStack::PopAndDestroy( data ); - } - - CleanupStack::PopAndDestroy( &file ); - } - - CleanupStack::PopAndDestroy( &fileSession ); - CleanupStack::PopAndDestroy( name ); - - _DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): end (WINSCW)"); - } - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devinfo/bld/bld.inf --- a/deviceupdatesui/adapters/devinfo/bld/bld.inf Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: build info file for DevInfo adapter -* -*/ - - - - -PRJ_MMPFILES -./nsmldmdevinfoadapter.mmp - - - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devinfo/bld/nsmldmdevinfoadapter.mmp --- a/deviceupdatesui/adapters/devinfo/bld/nsmldmdevinfoadapter.mmp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of dm adapters -* This is part of omadmextensions. -* -*/ - - - - - -#include "defaultcaps.hrh" -#include - -CAPABILITY CAP_ECOM_PLUGIN -TARGET nsmldmdevinfoadapter.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x101F6DE8 -VENDORID VID_DEFAULT - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom -SOURCEPATH ../src - -USERINCLUDE ../inc ../../inc -USERINCLUDE ../../devdetail/inc -SOURCE nsmldmdevinfoadapter.cpp - -START RESOURCE nsmldmdevinfoadapter.rss -LANGUAGE_IDS -END - - - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY nsmldebug.lib -LIBRARY nsmlagentcommon.lib -LIBRARY featmgr.lib - -SMPSAFE diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devinfo/inc/nsmldmdevinfoadapter.h --- a/deviceupdatesui/adapters/devinfo/inc/nsmldmdevinfoadapter.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM DevInfo Adapter -* -*/ - - - - - - -#ifndef __NSMLDMDEVINFOADAPTER_H__ -#define __NSMLDMDEVINFOADAPTER_H__ - -// INCLUDES -#include -#include -#include "nsmldmconstants.h" - -// MACROS - -// the DDF version must be changed if any changes in DDF structure -// ( built in DDFStructureL() function ) -_LIT8( KNSmlDMDevInfoDDFVersion, "1.0" ); - -_LIT8( KNSmlDMDevInfoTextPlain, "text/plain" ); -_LIT8( KNSmlDMDevInfoNodeName, "DevInfo" ); -_LIT8( KNSmlDMDevInfoDescription, "The interior object holds all DevInfo objects" ); - -_LIT8( KNSmlDMDevInfoManNodeName, "Man" ); -_LIT8( KNSmlDMDevInfoManDescription, "The name of the device manufacturer" ); - -_LIT8( KNSmlDMDevInfoModNodeName, "Mod" ); -_LIT8( KNSmlDMDevInfoModDescription, "The name of the device model" ); - -_LIT8( KNSmlDMDevInfoDevIdNodeName, "DevId" ); -_LIT8( KNSmlDMDevInfoDevIdDescription, "The unique device identifier" ); - -_LIT8( KNSmlDMDevInfoLangNodeName, "Lang" ); -_LIT8( KNSmlDMDevInfoLangDescription, "The current language setting of the device" ); - -_LIT8( KNSmlDMDevInfoDmVNodeName, "DmV" ); -_LIT8( KNSmlDMDevInfoDmVDescription, "The current DM client revision of the device" ); - -_LIT8( KNSmlDMDevInfoExtNodeName, "Ext" ); -_LIT8( KNSmlDMDevInfoExtDescription, "The extendable DevInfo branch" ); - -_LIT8( KNSmlDMDevInfoModDDFNodeName, "ModDDF" ); -_LIT8( KNSmlDMDevInfoModDDFDescription, "The checksum counted from DDF" ); - -_LIT8( KNSmlDMDevInfoModDevDetNodeName, "ModDevDet" ); -_LIT8( KNSmlDMDevInfoModDevDetDescription, "The checksum counted from DevDetail values" ); - -_LIT8( KNSmlDmDDFChangeUri, "DDFCHANGE" ); - -_LIT8( KNSmlDMDevInfoSeparator, "/" ); - -_LIT8( KNSmlDMEnglish, "en" ); -_LIT8( KNSmlDMFrench, "fr" ); -_LIT8( KNSmlDMGerman, "de" ); -_LIT8( KNSmlDMSpanish, "es" ); -_LIT8( KNSmlDMItalian, "it" ); -_LIT8( KNSmlDMSwedish, "sv" ); -_LIT8( KNSmlDMDanish, "da" ); -_LIT8( KNSmlDMNorwegian, "no" ); -_LIT8( KNSmlDMFinnish, "fi" ); -_LIT8( KNSmlDMPortuguese, "pt" ); -_LIT8( KNSmlDMTurkish, "tr" ); -_LIT8( KNSmlDMIcelandic, "is" ); -_LIT8( KNSmlDMRussian, "ru" ); -_LIT8( KNSmlDMHungarian, "hu" ); -_LIT8( KNSmlDMDutch, "nl" ); -_LIT8( KNSmlDMCzech, "cs" ); -_LIT8( KNSmlDMSlovak, "sk" ); -_LIT8( KNSmlDMPolish, "pl" ); -_LIT8( KNSmlDMSlovenian, "sl" ); -_LIT8( KNSmlDMChinese, "ch" ); -_LIT8( KNSmlDMJapanese, "ja" ); -_LIT8( KNSmlDMThai, "th" ); -_LIT8( KNSmlDMAfrikaans, "af" ); -_LIT8( KNSmlDMAlbanian, "sq" ); -_LIT8( KNSmlDMAmharic, "am" ); -_LIT8( KNSmlDMArabic, "ar" ); -_LIT8( KNSmlDMArmenian, "hy" ); -_LIT8( KNSmlDMTagalog, "tl" ); -_LIT8( KNSmlDMBelarussian, "be" ); -_LIT8( KNSmlDMBengali, "bn" ); -_LIT8( KNSmlDMBulgarian, "bg" ); -_LIT8( KNSmlDMBurmese, "my" ); -_LIT8( KNSmlDMCatalan, "ca" ); -_LIT8( KNSmlDMCroatian, "hr" ); -_LIT8( KNSmlDMEstonian, "et" ); -_LIT8( KNSmlDMFarsi, "fo" ); -_LIT8( KNSmlDMScotsGaelic, "gl" ); -_LIT8( KNSmlDMGeorgian, "ka" ); -_LIT8( KNSmlDMGreek, "el" ); -_LIT8( KNSmlDMGujarati, "gu" ); -_LIT8( KNSmlDMHebrew, "he" ); -_LIT8( KNSmlDMHindi, "hi" ); -_LIT8( KNSmlDMIndonesian, "id" ); -_LIT8( KNSmlDMIrish, "ga" ); -_LIT8( KNSmlDMKannada, "kn" ); -_LIT8( KNSmlDMKazakh, "kk" ); -_LIT8( KNSmlDMKorean, "ko" ); -_LIT8( KNSmlDMLao, "lo" ); -_LIT8( KNSmlDMLatvian, "lv" ); -_LIT8( KNSmlDMLithuanian, "lt" ); -_LIT8( KNSmlDMMacedonian, "mk" ); -_LIT8( KNSmlDMMalay, "ms" ); -_LIT8( KNSmlDMMalayalam, "ml" ); -_LIT8( KNSmlDMMarathi, "mr" ); -_LIT8( KNSmlDMMoldavian, "mo" ); -_LIT8( KNSmlDMMongolian, "mn" ); -_LIT8( KNSmlDMPunjabi, "pa" ); -_LIT8( KNSmlDMRomanian, "ro" ); -_LIT8( KNSmlDMSerbian, "sr" ); -_LIT8( KNSmlDMSinhalese, "si" ); -_LIT8( KNSmlDMSomali, "so" ); -_LIT8( KNSmlDMSwahili, "sw" ); -_LIT8( KNSmlDMTamil, "ta" ); -_LIT8( KNSmlDMTelugu, "te" ); -_LIT8( KNSmlDMTibetan, "bo" ); -_LIT8( KNSmlDMTigrinya, "ti" ); -_LIT8( KNSmlDMTurkmen, "tk" ); -_LIT8( KNSmlDMUkrainian, "uk" ); -_LIT8( KNSmlDMUrdu, "ur" ); -_LIT8( KNSmlDMVietnamese, "vi" ); -_LIT8( KNSmlDMWelsh, "cy" ); -_LIT8( KNSmlDMZulu, "zu" ); - - -// CLASS DECLARATION -class CNSmlDmDevInfoAdapter : public CSmlDmAdapter - { -public: // constructors and destructor - static CNSmlDmDevInfoAdapter* NewL(MSmlDmCallback* aDmCallback ); - static CNSmlDmDevInfoAdapter* NewLC(MSmlDmCallback* aDmCallback ); - - virtual ~CNSmlDmDevInfoAdapter(); - -private: ///new functions - - void SetLeafPropertiesL( MSmlDmDDFObject& aObject, - const TSmlDmAccessTypes& aAccessTypes, - const TDesC8& aDescription ) const; - CNSmlDmDevInfoAdapter(TAny* aEcomArguments); - CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, CBufBase& aObject ); - -private: // from base classes - // Adapter interface from CSmlDmAdapter - void DDFVersionL( CBufBase& aDDFVersion ); - void DDFStructureL( MSmlDmDDFObject& aDDF ); - void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aObject, const TDesC8& aType, - const TInt aStatusRef ); - void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, TInt aStatusRef ); - void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aType, const TInt aResultsRef, - const TInt aStatusRef ); - void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, - const CArrayFix& aPreviousURISegmentList, - const TInt aResultsRef, const TInt aStatusRef ); - void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, - const TInt aStatusRef ); - - void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - RWriteStream*& aStream, const TDesC8& aType, - const TInt aStatusRef ); - void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aType, const TInt aResultsRef, - const TInt aStatusRef ); - - void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aArgument, - const TDesC8& aType, - const TInt aStatusRef ); - - void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, - RWriteStream*& aStream, - const TDesC8& aType, - const TInt aStatusRef ); - - void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, - const TDesC8& aSourceURI, - const TDesC8& aSourceLUID, - const TDesC8& aType, TInt aStatusRef ); - void StartAtomicL(); - void CommitAtomicL(); - void RollbackAtomicL(); - TBool StreamingSupport( TInt& aItemSize ); - void StreamCommittedL(); - void CompleteOutstandingCmdsL(); - - -private: - MSmlDmCallback* iDmCallback; - }; - -#endif // __NSMLDMDEVINFOADAPTER_H__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.cpp --- a/deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,770 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM DevInfo Adapter -* -*/ - - - - - -//INCLUDE FILES -#include // For TImplementationProxy definition -#include "nsmldmimpluids.h" -#include - -#include "nsmldmdevinfoadapter.h" -#include "nsmldebug.h" -#include "nsmlphoneinfo.h" -#include "nsmlunicodeconverter.h" -#include "nsmlconstants.h" -#include "nsmldmconst.h" -#include "nsmldmdevdetailadapter.h" - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewL( ) -// ----------------------------------------------------------------------------- -CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewL(MSmlDmCallback* aDmCallback ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::NewL(): begin"); - CNSmlDmDevInfoAdapter* self = NewLC( aDmCallback ); - CleanupStack::Pop(); - _DBG_FILE("CNSmlDmDevInfoAdapter::NewL(): end"); - return self; - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewLC( ) -// ----------------------------------------------------------------------------- -CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewLC(MSmlDmCallback* aDmCallback ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::NewLC(): begin"); - CNSmlDmDevInfoAdapter* self = new (ELeave) CNSmlDmDevInfoAdapter(aDmCallback); - CleanupStack::PushL(self); - self->iDmCallback = aDmCallback; - FeatureManager::InitializeLibL(); - _DBG_FILE("CNSmlDmDevInfoAdapter::NewLC(): end"); - return self; - } - - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter() -// ----------------------------------------------------------------------------- -CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter(): begin"); - FeatureManager::UnInitializeLib(); - _DBG_FILE("CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter() -// ----------------------------------------------------------------------------- - -CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(aEcomArguments): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(aEcomArguments): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::SetLeafPropertiesL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject, - const TSmlDmAccessTypes& aAccessTypes, - const TDesC8& aDescription ) const - { - aObject.SetAccessTypesL( aAccessTypes ); - aObject.SetScopeL( MSmlDmDDFObject::EPermanent ); - aObject.SetDFFormatL( MSmlDmDDFObject::EChr ); - aObject.AddDFTypeMimeTypeL( KNSmlDMDevInfoTextPlain ); - aObject.SetDescriptionL( aDescription ); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::DDFVersionL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::DDFVersionL(CBufBase& aDDFVersion) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::DDFVersionL(TDes& aDDFVersion): begin"); - aDDFVersion.InsertL(0,KNSmlDMDevInfoDDFVersion); - _DBG_FILE("CNSmlDmDevInfoAdapter::DDFVersionL(TDes& aDDFVersion): end"); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::DDFStructureL() -// -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::DDFStructureL(): begin"); - - TSmlDmAccessTypes accessTypes; - accessTypes.SetGet(); - // DevInfo - MSmlDmDDFObject& devInfo = aDDF.AddChildObjectL( KNSmlDMDevInfoNodeName ); - devInfo.SetAccessTypesL( accessTypes ); - devInfo.SetScopeL( MSmlDmDDFObject::EPermanent ); - devInfo.SetDescriptionL( KNSmlDMDevInfoDescription ); - // Man - MSmlDmDDFObject& man = devInfo.AddChildObjectL(KNSmlDMDevInfoManNodeName); - SetLeafPropertiesL( man, accessTypes, KNSmlDMDevInfoManDescription ); - // Mod - MSmlDmDDFObject& mod = devInfo.AddChildObjectL(KNSmlDMDevInfoModNodeName ); - SetLeafPropertiesL( mod, accessTypes, KNSmlDMDevInfoModDescription ); - // DevId - MSmlDmDDFObject& devid = devInfo.AddChildObjectL( KNSmlDMDevInfoDevIdNodeName); - SetLeafPropertiesL( devid, accessTypes, KNSmlDMDevInfoDevIdDescription ); - // Lang - MSmlDmDDFObject& lang = devInfo.AddChildObjectL(KNSmlDMDevInfoLangNodeName ); - SetLeafPropertiesL( lang, accessTypes, KNSmlDMDevInfoLangDescription ); - // DmV - MSmlDmDDFObject& dmv = devInfo.AddChildObjectL(KNSmlDMDevInfoDmVNodeName); - SetLeafPropertiesL( dmv, accessTypes, KNSmlDMDevInfoDmVDescription ); - // Ext - MSmlDmDDFObject& ext = devInfo.AddChildObjectL(KNSmlDMDevInfoExtNodeName ); - ext.SetAccessTypesL( accessTypes ); - ext.SetScopeL( MSmlDmDDFObject::EPermanent ); - ext.SetDescriptionL( KNSmlDMDevInfoExtDescription ); - // ModDDF - MSmlDmDDFObject& modDDF = ext.AddChildObjectL( KNSmlDMDevInfoModDDFNodeName); - SetLeafPropertiesL( modDDF, accessTypes, KNSmlDMDevInfoModDDFDescription ); - // ModDevDet - MSmlDmDDFObject& modDevDet = ext.AddChildObjectL(KNSmlDMDevInfoModDevDetNodeName ); - SetLeafPropertiesL( modDevDet, accessTypes, KNSmlDMDevInfoModDevDetDescription ); - _DBG_FILE("CNSmlDmDevInfoAdapter::DDFStructureL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::UpdateLeafObjectL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, - const TDesC8& /*aLUID*/, - const TDesC8& /*aObject*/, - const TDesC8& /*aType*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): end"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::DeleteObjectL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::DeleteObjectL( const TDesC8& /*aURI*/, - const TDesC8& /*aLUID*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::DeleteLeafObjectL( ): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::DeleteLeafObjectL( ): end"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, -// const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, - const TDesC8& /*aLUID*/, - const TDesC8& aType, - const TInt aResultsRef, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectL(): begin"); - - CBufBase *object = CBufFlat::NewL( 1 ); - CleanupStack::PushL( object ); - - CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object ); - - iDmCallback->SetStatusL( aStatusRef, retValue ); - iDmCallback->SetResultsL( aResultsRef, *object, aType ); - CleanupStack::PopAndDestroy(); //object - _DBG_FILE("CNSmlDmDevInfoAdapt+er::FetchLeafObjectL(): end"); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::ChildURIListL( const TDesC& aURI, -// const TDesC& aParentLUID, const CArrayFix& aPreviousURISegmentList, -// const TInt aResultsRef, const TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::ChildURIListL( const TDesC8& aURI, - const TDesC8& /*aParentLUID*/, - const CArrayFix& /*aPreviousURISegmentList*/, - const TInt aResultsRef, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::ChildURIListL(): begin"); - CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - CBufBase* currentURISegmentList = CBufFlat::NewL( 1 ); - CleanupStack::PushL( currentURISegmentList ); - TInt ret = aURI.LocateReverse(KNSmlDMDevInfoSeparator()[0]); - if ( ret == KErrNotFound ) - { - ret = -1; - } - TInt len = aURI.Length() - ( ret + 1 ); - TPtrC8 segment = aURI.Right( len ); - - if ( segment == KNSmlDMDevInfoNodeName ) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoManNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoDevIdNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoLangNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoDmVNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoExtNodeName() ); - } - else - if ( segment == KNSmlDMDevInfoExtNodeName ) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModDDFNodeName() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModDevDetNodeName() ); - } - else - { - retValue = CSmlDmAdapter::EError; - } - iDmCallback->SetStatusL( aStatusRef, retValue ); - iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); - CleanupStack::PopAndDestroy(); //currentURISegmentList - _DBG_FILE("CNSmlDmDevInfoAdapter::ChildURIListL(): end"); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::AddNodeObjectL( const TDesC8& aURI, -// const TDesC8& aParentLUID, const TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, - const TDesC8& /*aParentLUID*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::AddNodeObjectL(): begin"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - _DBG_FILE("CNSmlDmDevInfoAdapter::AddNodeObjectL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::UpdateLeafObjectL() -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, - const TDesC8& /*aLUID*/, - RWriteStream*& /*aStream*/, - const TDesC8& /*aType*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: end"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, -// const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, - const TDesC8& /*aLUID*/, - const TDesC8& aType, - const TInt aResultsRef, - const TInt aStatusRef ) - { - - _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL(): begin"); - - CBufBase *object = CBufFlat::NewL( 1 ); - CleanupStack::PushL( object ); - CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object ); - - TInt objSizeInBytes = object->Size(); - TBuf8<2> stringObjSizeInBytes; - stringObjSizeInBytes.Num( objSizeInBytes ); - object->Reset(); - object->InsertL( 0, stringObjSizeInBytes ); - - iDmCallback->SetStatusL( aStatusRef, retValue ); - iDmCallback->SetResultsL( aResultsRef, *object, aType ); - CleanupStack::PopAndDestroy(); //object - _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL(): end"); - } - - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& aURI, -// const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): begin"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& aURI, -// const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType, -// TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, - const TDesC8& /*aParentLUID*/, - RWriteStream*& /*aStream*/, - const TDesC8& /*aType*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: begin"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevInfoAdapter::CopyCommandL( const TDesC8& aTargetURI, const TDesC8& -// aSourceURI, const TDesC8& aSourceLUID, const TDesC8& /*aType*/, TInt aStatusRef ) -// ----------------------------------------------------------------------------- -void CNSmlDmDevInfoAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& - /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, - const TDesC8& /*aSourceLUID*/, - const TDesC8& /*aType*/, TInt aStatusRef ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): begin"); - iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): end"); - } - -// -------------------------------------- -// CNSmlDmDevInfoAdapter::StartAtomicL() -// -------------------------------------- -void CNSmlDmDevInfoAdapter::StartAtomicL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): end"); - } - -// --------------------------------------- -// CNSmlDmDevInfoAdapter::CommitAtomicL() -// --------------------------------------- -void CNSmlDmDevInfoAdapter::CommitAtomicL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): end"); - } - -// ----------------------------------------- -// CNSmlDmDevInfoAdapter::RollbackAtomicL() -// ----------------------------------------- -void CNSmlDmDevInfoAdapter::RollbackAtomicL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): end"); - } - -// ----------------------------------------------------------- -// CNSmlDmDevInfoAdapter::StreamingSupport( TInt& aItemSize ) -// ----------------------------------------------------------- -TBool CNSmlDmDevInfoAdapter::StreamingSupport( TInt& /*aItemSize*/ ) - { - _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): end"); - return EFalse; - } - -// ------------------------------------------ -// CNSmlDmDevInfoAdapter::StreamCommittedL() -// ------------------------------------------ -void CNSmlDmDevInfoAdapter::StreamCommittedL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): end"); - } - -// -------------------------------------------------- -// CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL() -// -------------------------------------------------- -void CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL() - { - _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): begin"); - _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDmDevDetailAdapter::FetchLeafObjectL() -// ----------------------------------------------------------------------------- -CSmlDmAdapter::TError CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, - CBufBase& aObject ) - { - _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): begin"); - CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - TInt ret = aURI.LocateReverse(KNSmlDMDevInfoSeparator()[0]); - if ( ret == KErrNotFound ) - { - retValue = CSmlDmAdapter::EError; - } - else - { - TInt len = aURI.Length() - (ret + 1); - TPtrC8 segment = aURI.Right( len ); - if ( segment == KNSmlDMDevInfoManNodeName || - segment == KNSmlDMDevInfoModNodeName || - segment == KNSmlDMDevInfoDevIdNodeName ) - { - CNSmlPhoneInfo* phoneInfo = CNSmlPhoneInfo::NewLC(); - HBufC* phonedata = HBufC::NewLC( 50 ); - TPtr phonedataPtr = phonedata->Des(); - if ( segment == KNSmlDMDevInfoManNodeName ) - { - phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneManufacturer, phonedataPtr ); - } - if ( segment == KNSmlDMDevInfoModNodeName ) - { - phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneModelId, phonedataPtr ); - } - if ( segment == KNSmlDMDevInfoDevIdNodeName ) - { - phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneSerialNumber, phonedataPtr ); - } - HBufC8* phonedataInUTF8 = NULL; - NSmlUnicodeConverter::HBufC8InUTF8LC( *phonedata, phonedataInUTF8 ); - aObject.InsertL( 0, *phonedataInUTF8 ); - CleanupStack::PopAndDestroy( 3 ); //phonedataInUTF8, phonedata, phoneInfo - } - else - if ( segment == KNSmlDMDevInfoLangNodeName ) - { - TLanguage language = User::Language(); - TBuf8<2> langCode; - switch ( language ) - { - case ELangEnglish: - case ELangAmerican: - case ELangAustralian: - case ELangNewZealand: - case ELangCanadianEnglish: - case ELangInternationalEnglish: - case ELangSouthAfricanEnglish: - langCode = KNSmlDMEnglish; - break; - case ELangFrench: - case ELangSwissFrench: - case ELangBelgianFrench: - case ELangInternationalFrench: - case ELangCanadianFrench: - langCode = KNSmlDMFrench; - break; - case ELangGerman: - case ELangSwissGerman: - case ELangAustrian: - langCode = KNSmlDMGerman; - break; - case ELangSpanish: - case ELangInternationalSpanish: - case ELangLatinAmericanSpanish: - langCode = KNSmlDMSpanish; - break; - case ELangItalian: - case ELangSwissItalian: - langCode = KNSmlDMItalian; - break; - case ELangSwedish: - case ELangFinlandSwedish: - langCode = KNSmlDMSwedish; - break; - case ELangDanish: - langCode = KNSmlDMDanish; - break; - case ELangNorwegian: - case ELangNorwegianNynorsk: - langCode = KNSmlDMNorwegian; - break; - case ELangFinnish: - langCode = KNSmlDMFinnish; - break; - case ELangPortuguese: - case ELangBrazilianPortuguese: - langCode = KNSmlDMPortuguese; - break; - case ELangTurkish: - case ELangCyprusTurkish: - langCode = KNSmlDMTurkish; - break; - case ELangIcelandic: - langCode = KNSmlDMIcelandic; - break; - case ELangRussian: - langCode = KNSmlDMRussian; - break; - case ELangHungarian: - langCode = KNSmlDMHungarian; - break; - case ELangDutch: - case ELangBelgianFlemish: - langCode = KNSmlDMDutch; - break; - case ELangCzech: - langCode = KNSmlDMCzech; - break; - case ELangSlovak: - langCode = KNSmlDMSlovak; - break; - case ELangPolish: - langCode = KNSmlDMPolish; - break; - case ELangSlovenian: - langCode = KNSmlDMSlovenian; - break; - case ELangTaiwanChinese: - case ELangHongKongChinese: - case ELangPrcChinese: - langCode = KNSmlDMChinese; - break; - case ELangJapanese: - langCode = KNSmlDMJapanese; - break; - case ELangThai: - langCode = KNSmlDMThai; - break; - case ELangAfrikaans: - langCode = KNSmlDMAfrikaans; - break; - case ELangAlbanian: - langCode = KNSmlDMAlbanian; - break; - case ELangAmharic: - langCode = KNSmlDMAmharic; - break; - case ELangArabic: - langCode = KNSmlDMArabic; - break; - case ELangArmenian: - langCode = KNSmlDMArmenian; - break; - case ELangTagalog: - langCode = KNSmlDMTagalog; - break; - case ELangBelarussian: - langCode = KNSmlDMBelarussian; - break; - case ELangBengali: - langCode = KNSmlDMBengali; - break; - case ELangBulgarian: - langCode = KNSmlDMBulgarian; - break; - case ELangBurmese: - langCode = KNSmlDMBurmese; - break; - case ELangCatalan: - langCode = KNSmlDMCatalan; - break; - case ELangCroatian: - langCode = KNSmlDMCroatian; - break; - case ELangEstonian: - langCode = KNSmlDMEstonian; - break; - case ELangFarsi: - langCode = KNSmlDMFarsi; - break; - case ELangScotsGaelic: - langCode = KNSmlDMScotsGaelic; - break; - case ELangGeorgian: - langCode = KNSmlDMGeorgian; - break; - case ELangGreek: - case ELangCyprusGreek: - langCode = KNSmlDMGreek; - break; - case ELangGujarati: - langCode = KNSmlDMGujarati; - break; - case ELangHebrew: - langCode = KNSmlDMHebrew; - break; - case ELangHindi: - langCode = KNSmlDMHindi; - break; - case ELangIndonesian: - langCode = KNSmlDMIndonesian; - break; - case ELangIrish: - langCode = KNSmlDMIrish; - break; - case ELangKannada: - langCode = KNSmlDMKannada; - break; - case ELangKazakh: - langCode = KNSmlDMKazakh; - break; - case ELangKorean: - langCode = KNSmlDMKorean; - break; - case ELangLao: - langCode = KNSmlDMLao; - break; - case ELangLatvian: - langCode = KNSmlDMLatvian; - break; - case ELangLithuanian: - langCode = KNSmlDMLithuanian; - break; - case ELangMacedonian: - langCode = KNSmlDMMacedonian; - break; - case ELangMalay: - langCode = KNSmlDMMalay; - break; - case ELangMalayalam: - langCode = KNSmlDMMalayalam; - break; - case ELangMarathi: - langCode = KNSmlDMMarathi; - break; - case ELangMoldavian: - langCode = KNSmlDMMoldavian; - break; - case ELangMongolian: - langCode = KNSmlDMMongolian; - break; - case ELangPunjabi: - langCode = KNSmlDMPunjabi; - break; - case ELangRomanian: - langCode = KNSmlDMRomanian; - break; - case ELangSerbian: - langCode = KNSmlDMSerbian; - break; - case ELangSinhalese: - langCode = KNSmlDMSinhalese; - break; - case ELangSomali: - langCode = KNSmlDMSomali; - break; - case ELangSwahili: - langCode = KNSmlDMSwahili; - break; - case ELangTamil: - langCode = KNSmlDMTamil; - break; - case ELangTelugu: - langCode = KNSmlDMTelugu; - break; - case ELangTibetan: - langCode = KNSmlDMTibetan; - break; - case ELangTigrinya: - langCode = KNSmlDMTigrinya; - break; - case ELangTurkmen: - langCode = KNSmlDMTurkmen; - break; - case ELangUkrainian: - langCode = KNSmlDMUkrainian; - break; - case ELangUrdu: - langCode = KNSmlDMUrdu; - break; - case ELangVietnamese: - langCode = KNSmlDMVietnamese; - break; - case ELangWelsh: - langCode = KNSmlDMWelsh; - break; - case ELangZulu: - langCode = KNSmlDMZulu; - break; - default: - langCode = KNSmlDMEnglish; - } - aObject.InsertL( 0, langCode ); - } - else - if ( segment == KNSmlDMDevInfoDmVNodeName ) - { - if(!FeatureManager::FeatureSupported( KFeatureIdSyncMlDm112 )) - aObject.InsertL( 0, KNSmlDMDmV12 ); - else - aObject.InsertL( 0, KNSmlDMDmV ); - } - else - if ( segment == KNSmlDMDevInfoModDDFNodeName ) - { - - } - else - if ( segment == KNSmlDMDevInfoModDevDetNodeName ) - { - TUid implUID; - implUID.iUid = KNSmlDMDevDetailAdapterImplUid; - - TAny* nPtr = NULL; - MSmlDmCallback& aDmNull = reinterpret_cast(nPtr); - CNSmlDmDevDetailAdapter* devDetAdapter = - reinterpret_cast(CSmlDmAdapter::NewL( implUID, aDmNull ) ); - CleanupStack::PushL(devDetAdapter); - TInt checkSumDevDet = devDetAdapter->DevDetailValueCrcL(); - TBuf8<16> stringCheckSumDevDet; - stringCheckSumDevDet.Num( checkSumDevDet ); - aObject.InsertL( 0, stringCheckSumDevDet ); - CleanupStack::PopAndDestroy(); // devDetAdapter - } - else - { - retValue = CSmlDmAdapter::EError; - } - } - _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): end"); - return retValue; - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -#ifndef IMPLEMENTATION_PROXY_ENTRY -#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} -#endif - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KNSmlDMDevInfoAdapterImplUid, CNSmlDmDevInfoAdapter::NewL) - }; - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevInfoAdapter: begin"); - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevInfoAdapter: end"); - return ImplementationTable; - } - -// End of file - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.rss --- a/deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.rss Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of dm adapters -* This is part of omadmextensions. -* -*/ - - -CHARACTER_SET UTF8 - -/* -* ============================================================================ -* Name : 101f6de8.rss -* Part of : SyncMl -* Origin : SyncML Phase 2 -* Created : 06.03.2003 -* Implementation notes: -* -* Version : 0.1 -* $Revision: 2 $, $Modtime: 10.05.05 11:06 $ by $Author: Kollasep $ -* --------------------------------------------------------------------------- -* Version history: -* Template version: 1.02, 21.6.2000 by maparnan -* -* -* ============================================================================ -*/ - - - -#include -#include - -RESOURCE REGISTRY_INFO theRegistryInfo - { - dll_uid = 0x101F6DE8; //The DLL's 3rd UID. - interfaces = - { - INTERFACE_INFO - { - interface_uid = KNSmlDMInterfaceUid; // DM interface UID - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x101F6DEE; // DM devinfo implementation UID - version_no = 1; - display_name = ""; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/inc/nsmldmimpluids.h --- a/deviceupdatesui/adapters/inc/nsmldmimpluids.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM tree etc. -* -*/ - - - - -#ifndef __NSMLDMIMPLUIDS_H__ -#define __NSMLDMIMPLUIDS_H__ - -// ------------------------------------------------------------------------------------------------ -// Includes -// ------------------------------------------------------------------------------------------------ -#include - -// ------------------------------------------------------------------------------------------------ -// -// ------------------------------------------------------------------------------------------------ - -// Implementation UIDs for DS adapters -const TUint KNSmlDMSettingsAdapterImplUid = 0x101F6DEC; -const TUint KNSmlDSSettingsAdapterImplUid = 0x101F6DED; -const TUint KNSmlDMDevInfoAdapterImplUid = 0x101F6DEE; -const TUint KNSmlDMDevDetailAdapterImplUid = 0x101F6DEF; -const TUint KNSmlInternetAdapterImplUid = 0x101F6DE2; -const TUint KNSmlDMEmailAdapterImplUid = 0x101F6E35; -const TUint KNSmlDMMMSAdapterImplUid = 0x101F6E37; -const TUint KNSmlDMFotaAdapterImplUid = 0x101F9A09; -#endif // __CNSMLDMIMPLUIDS_H__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/bld/bld.inf --- a/deviceupdatesui/adapters/syncmldm12/bld/bld.inf Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: build info file for SyncML DM settings adapter -* -*/ - - - - -PRJ_MMPFILES -./nsmldmsettingsadapter12.mmp - - - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/bld/nsmldmsettingsadapter12.mmp --- a/deviceupdatesui/adapters/syncmldm12/bld/nsmldmsettingsadapter12.mmp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM-settings adapter -* -*/ - - - - -#include "defaultcaps.hrh" -#include - -TARGET nsmldmsettingsadapter12.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10282CE7 -VENDORID VID_DEFAULT -CAPABILITY CAP_ECOM_PLUGIN - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - -SOURCEPATH ../src -USERINCLUDE ../inc ../../inc - -SOURCE NSmlDmSettingsAdapter12.cpp - - -START RESOURCE nsmldmsettingsadapter12.rss -END - -LIBRARY euser.lib ecom.lib charconv.lib nsmldebug.lib -LIBRARY nsmldmiapmatcher.lib -LIBRARY syncmlclientapi.lib -LIBRARY nsmltransporthandler.lib -LIBRARY nsmlprivateapi.lib -LIBRARY featmgr.lib - - -SMPSAFE -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h --- a/deviceupdatesui/adapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1021 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM Settings adapter header file -* -*/ - - - - -#ifndef __NSMLDMSETTINGSADAPTER12_H__ -#define __NSMLDMSETTINGSADAPTER12_H__ - - -// INCLUDES -#include -#include -#include -#include "NSmlPrivateAPI.h" - -// CONSTANTS -const TInt KNSmlDMGranularity = 4; -const TUint8 KNSmlDMColon = ':'; -const TUint8 KNSmlDMUriSeparator = '/'; -const TInt KPortMaxSize = 65535; -const TInt KPortMinSize = 0; -//Dynamic Node Posn Const --> DMAcc/DMIDxxx -const TInt KDynNodePosn = 2; - -_LIT8( KNSmlTrueVal, "1" ); -_LIT8( KNSmlFalseVal, "0" ); -_LIT8( KNSmlHTTPAuth, "NSmlHTTPAuth" ); -_LIT8( KNSmlHTTPUsername, "NSmlHTTPUsername" ); -_LIT8( KNSmlHTTPPassword, "NSmlHTTPPassword" ); - - -//DDF accepted DM-fieldnames -_LIT8( KNSmlDdfId, "Id" ); -_LIT8( KNSmlDdfAppId, "AppID" ); -_LIT8( KNSmlDdfServerId, "ServerID" ); -_LIT8( KNSmlDdfName, "Name" ); -_LIT8( KNSmlDdfPrefConRef, "PrefConRef" ); -_LIT8( KNSmlDdfToConRef, "ToConRef" ); -_LIT8( KNSmlDdfConRef, "ConRef" ); -_LIT8( KNSmlDdfAppAddr, "AppAddr" ); -_LIT8( KNSmlDdfAddr, "Addr" ); -_LIT8( KNSmlDdfAddrType, "AddrType" ); -_LIT8( KNSmlDdfPort, "Port" ); -_LIT8( KNSmlDdfPortNbr, "PortNbr" ); -_LIT8( KNSmlDdfAuthScheme, "AAuthPref" ); -_LIT8( KNSmlDdfAppAuth, "AppAuth" ); -_LIT8( KNSmlDdfAAuthLevel, "AAuthLevel" ); -_LIT8( KNSmlDdfAAuthType, "AAuthType" ); -_LIT8( KNSmlDdfAAuthName, "AAuthName" ); -_LIT8( KNSmlDdfAAuthSecret, "AAuthSecret" ); -_LIT8( KNSmlDdfAAuthData, "AAuthData" ); -_LIT8( KNSmlDdfExt, "Ext" ); -_LIT8( KNSmlDdfServerPW, "ServerPW" ); -_LIT8( KNSmlDdfServerNonce, "ServerNonce" ); -_LIT8( KNSmlDdfClientUserName, "UserName" ); -_LIT8( KNSmlDdfClientPW, "ClientPW" ); -_LIT8( KNSmlDdfClientNonce, "ClientNonce" ); -_LIT8( KNSmlDdfLocked, "ProfileLock" ); - - - -_LIT( KNSmlDdfMConRef, "MConRef" ); - -//Constant strings - - -_LIT8( KNSmlDdfAppIdValue, "w7" ); - - -//DDF DM-field descriptions -_LIT8( KNSmlDdfAppIdDescription, "AppID of DMSettings " ); -_LIT8( KNSmlDdfAddrDescription, "Host address of the SyncML server, IP or URL" ); -_LIT8( KNSmlDdfAddrTypeDescription, "The type of address specified in the Addr node" ); -_LIT8( KNSmlDdfPortNbrDescription, "SyncML Server port" ); -_LIT8( KNSmlDdfAuthSchemeDescription, "Scheme of authentication" ); -_LIT8( KNSmlDdfServerIdDescription, "The ServerId value for this server" ); -_LIT8( KNSmlDdfNameDescription, "Displayable name for the SyncML setings" ); -_LIT8( KNSmlDdfConRefDescription, "Logical reference to a connectivity node" ); -_LIT8( KNSmlDdfAuthLevelDescription , "AuthLevel of the AppAuth node " ); -_LIT8( KNSmlDdfAuthNameDescription , "AuthName of the AppAuth node " ); -_LIT8( KNSmlDdfAuthSecretDescription , "AuthSecret of the AppAuth node " ); -_LIT8( KNSmlDdfAuthDataDescription , "AuthData of the AppAuth node " ); -_LIT( KNSmlDdfMConRefDescription, "Parent to Multiple Connection Reference objects" ); - - -//Default data values -_LIT( KNSmlDefName, "DMAdapterIns" ); -_LIT8( KNSmlDefDMAcc, "DMAcc" ); -_LIT8( KNSmlDMStart, "DMAcc/DMId" ); -_LIT( KNSmlDefDMIAP, "AP" ); -_LIT8( KNSmlDMUriDotSlash, "./"); -_LIT8( KNSmlDMNullDesc8, ""); -_LIT8(KNSmlIAPId, "NSmlIapId"); - -_LIT8(KNSmlAddrtype, "URI"); - - -// AuthPref text values -_LIT8( KNSmlDMAuthPrefNoAuth,"syncml:auth-none"); -_LIT8( KNSmlDMAuthPrefBasic, "syncml:auth-basic"); -_LIT8( KNSmlDMAuthPrefMD5, "syncml:auth-md5"); -_LIT8( KNSmlDMAuthPrefTransport, "transport"); - -_LIT8( KNSmlDMAuthTypeBasic, "BASIC"); -_LIT8( KNSmlDMAuthTypeMD5, "DIGEST"); -_LIT8( KNSmlDMAuthTypeTransport, "TRANSPORT"); -_LIT8( KNSmlDMSettingsHTTP, "http://" ); -_LIT8( KNSmlDMSettingsHTTPS, "https://" ); - -_LIT8( KIAPid, "IAPid" ); -_LIT8( KSegmDMAcc,"AppID/ServerID/Name/PrefConRef/AppAddr/AAuthPref/AppAuth/Ext"); -_LIT8( KSegmDMAccAppAddr,"Addr/AddrType/Port"); -_LIT8( KSegmDMAccPortRT,"Port001"); -_LIT8( KSegmDMAccport,"PortNbr"); -_LIT8( KSegmDMAccAppAuth,"AAuthLevel/AAuthType/AAuthName/AAuthSecret/AAuthData"); -_LIT8( KSegmDMAccLocked,"ProfileLock"); -_LIT8( KSmlDmSlash, "/"); -_LIT8( KVersion,"1.1" ); -_LIT8( KMimeType, "text/plain" ); -_LIT8( KSyncMLText, "SyncML" ); -_LIT8( KNSmlDMadapterDesc, "DM-Settings DDF description" ); -_LIT8( KNSmlDMadapterTitle,"DM-Settings title" ); - -_LIT8( KDmAccMatch, "DMAcc/*" ); -_LIT8( KDmAccMatch3, "DMAcc/*/*" ); - -_LIT8( KDmAccMatch2, "DMAcc" ); -_LIT8 (KDmAccToConRefMatch, "DMAcc/*/ToConRef"); -_LIT8 (KDmAccToConRefId, "ConRef001"); -_LIT8 (KDmAccToConRefFullMatch, "DMAcc/*/ToConRef/ConRef001"); -_LIT8 (KDmAccAppAddrMatch, "DMAcc/*/AppAddr"); -_LIT8 (KDmAccAppAddrFullMatch, "DMAcc/*/AppAddr/*"); -_LIT8 (KDmAccPortMatch, "DMAcc/*/AppAddr/*/Port"); -_LIT8 (KDmAccExtMatch, "DMAcc/*/Ext"); -//_LIT8 (KDmAccExtFullMatch, "DMAcc/*/Ext/*"); -_LIT8 (KDmAccPortFullMatch, "DMAcc/*/AppAddr/*/Port/Port001"); -_LIT8 (KDmAccAppAuthMatch, "DMAcc/*/AppAuth"); -_LIT8 (KDmAccAppAuthFullMatch, "DMAcc/*/AppAuth/*"); -_LIT8 (KDmAccAppAuthSrvMatch, "DMAcc/*/AppAuth/AppAuthSrv"); -_LIT8 (KDmAccAppAuthCliMatch, "DMAcc/*/AppAuth/AppAuthCli"); -_LIT8 (KDmAccAppAuthObexMatch, "DMAcc/*/AppAuth/AppAuthObex"); -_LIT8 (KDmAccAppAuthHttpMatch, "DMAcc/*/AppAuth/AppAuthHttp"); -_LIT8 (KDmAccAppAuthTransMatch, "DMAcc/*/AppAuth/AppAuthTransport"); - - - -//_LIT8 (KDmAccAppAuthNodes, "AppAuthSrv/AppAuthCli/AppAuthObex/AppAuthHttp"); -_LIT8 (KDmAccAppAuthNodes, "AppAuthSrv/AppAuthCli/AppAuthTransport"); -_LIT8 (KDmAccAppAuthDyn1, "AppAuthSrv"); // serv -_LIT8 (KDmAccAppAuthDyn2, "AppAuthCli"); //client -_LIT8 (KDmAccAppAuthDyn3, "AppAuthObex"); //obex -_LIT8 (KDmAccAppAuthDyn4, "AppAuthHttp"); - -_LIT8 (KDmAccAppAuthTransport, "AppAuthTransport"); - -_LIT8 (KDmAccAppAuthDyn1LUid, "SRVCRED"); -_LIT8 (KDmAccAppAuthDyn2LUid, "CLCRED"); -_LIT8 (KDmAccAppAuthDyn3LUid, "OBEX"); -_LIT8 (KDmAccAppAuthDyn4LUid, "HTTP"); - -_LIT8 (KDmAccAppAuthLevelSrv, "SRVCRED"); -_LIT8 (KDmAccAppAuthLevelCli, "CLCRED"); -_LIT8 (KDmAccAppAuthLevelObx, "OBEX"); -_LIT8 (KDmAccAppAuthLevelHttp, "HTTP"); -_LIT8(KDmProfileLocked, "Locked"); -_LIT8(KDmProfileUnLocked, "Unlocked"); -const TInt KHttpUsed = 1; -const TInt KHttpNotUsed = 0; - - -// temporary - -_LIT8 (KDmAccAppAddrId, "Addr001"); - -// NOTE: this enum must match with property array described in -// SyncML_Sync_Agent_Client_API_Specification.doc. -enum TNSmlSyncTransportProperties - { - EPropertyIntenetAccessPoint = 0, - EPropertyHttpUsed = 5, - EPropertyHttpUserName = 6, - EPropertyHttpPassword = 7 - }; - - -// DATA TYPES -enum TNSmlDMFieldType - { - EStr, - EInt, - EBin, - EWrong - }; - -enum TNSmlDMLeafType - { - EDMUpdate, - EDMDelete, - EDMUnset - }; - -enum TNSmlDMProfileData - { - EProfileId, - EProfileName, - EProfileIAPId, - EProfileMediumType, - EProfileDMServerUsername, - EProfileDMServerPassword, - EServerNonce, - ESharedSecret, - EClientNonce, - EProfileURL, - EProfilePort, - EServerId, - EAuthenticationRequired, - ESyncAccepted, - EProfileAddrType, - EPRofileServerCred, - EPRofileClientCred, - EProfileHttpUsername, - EProfileHttpPassword, - EProfileAAuthType, - EProfileTransport, - EProfileObexUsername, - EProfileObexPassword, - ETransportAuthName, - EProfileTransportPassword, - EProfileTransportAuthData, - EProfileLock - }; - -enum TAuthenticationType - { - ENoAuth, //"syncml:auth-none" - EBasic, //"syncml:auth-basic" - EMD5 //"syncml:auth-md5" - }; - -enum TNSmlDMMediumType - { - ENone, - EHttp, - EWsp, - EObex - }; - -struct TNSmlDMLeafElement - { - HBufC8 *iUri; - HBufC8 *iData; - TInt iStatusRef; - HBufC8* iLuid; - }; - -struct TNSmlDMBufferElement - { - CArrayFixFlat *iLeafBuf; - HBufC8* iMappingName; //Holds the Dyn.Node URI - TBool iExecuted; //Node updated to dB or not - TInt iDMBuffStatusref; //Statusref for callback - TBool iAddr; - TBool iServerId; //Bools for Mandatory fields - TBool iUName; - TBool iServerName; - }; - -// CLASS DECLARATION -/** -* CNSmlDMSettingsAdapter12 class -* Contains the whole implementation of the DM settings adapter. -* -* @lib nsmldmsettingsadapter.dll -* @since Series 60 Series60_3.0 -*/ -class CNSmlDMSettingsAdapter12 : public CSmlDmAdapter - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CNSmlDMSettingsAdapter12* NewL(MSmlDmCallback* aDmCallback ); - static CNSmlDMSettingsAdapter12* NewLC(MSmlDmCallback* aDmCallback ); - - void ConstructL(); - - /** - * Destructor. - */ - virtual ~CNSmlDMSettingsAdapter12(); - - public: // Functions from base classes - - /** - * From CSmlDmAdapter DDFVersionL returns current version of the DDF. - * @since Series60_3.0 - * @param aVersion DDF version of the adapter. - * @return none - */ - void DDFVersionL( CBufBase& aVersion ); - - /** - * From CSmlDmAdapter DDFStructureL for filling the DDF structure of the adapter. - * @since Series60_3.0 - * @param aDDF Reference to root object. - * @return none - */ - void DDFStructureL( MSmlDmDDFObject& aDDF ); - - /** - * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces - * data in existing leaf objects. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aLUID LUID of the object - * @param aObject Data of the object - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command - * @return none - */ - void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aObject, const TDesC8& aType, - TInt aStatusRef ); - - /** - * From CSmlDmAdapter DeleteObjectL deletes an object and its child objects. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aLUID LUID of the object - * @param aStatusRef Reference to correct command - * @return none - */ - void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TInt aStatusRef ); - - /** - * From CSmlDmAdapter FetchLeafObjectL fetches data of a leaf object. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aLUID LUID of the object - * @param aType MIME type of the object - * @param aResultsRef Reference to correct results - * @param aStatusRef Reference to correct command - * @return none - */ - void FetchLeafObjectL( const TDesC8& aURI, - const TDesC8& aLUID, - const TDesC8& aType, - const TInt aResultsRef, - const TInt aStatusRef ); - /** - * From CSmlDmAdapter ChildURIListL fetches URI list. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aLUID LUID of the object - * @param aPreviousURISegmentList URI list with mapping LUID information - * @param aResultsRef Reference to correct results - * @param aStatusRef Reference to correct command - * @return none - */ - void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, - const CArrayFix& aPreviousURISegmentList, - const TInt aResultsRef, const TInt aStatusRef ); - - /** - * From CSmlDmAdapter AddNodeObjectL adds node object. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aParentLUID LUID of the parent object - * @param aStatusRef Reference to correct command - * @return none - */ - void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, - const TInt aStatusRef ); - - /** - * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces - * data in existing leaf objects. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aLUID LUID of the object - * @param aStream Data of the object - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command - * @return none - */ - void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - RWriteStream*& aStream, const TDesC8& aType, - const TInt aStatusRef ); - - /** - * From CSmlDmAdapter FetchLeafObjectSizeL fetches the size of a leaf object. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aLUID LUID of the object - * @param aType MIME type of the object - * @param aResultsRef Reference to correct results - * @param aStatusRef Reference to correct command - * @return none - */ - void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aType, const TInt aResultsRef, - const TInt aStatusRef ); - - /** - * From CSmlDmAdapter The function implements execute command. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aLUID LUID of the object - * @param aArgument Argument for the command - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command - * @return none - */ - void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aArgument, const TDesC8& aType, - const TInt aStatusRef ); - - /** - * From CSmlDmAdapter The function implements execute command. - * @since Series60_3.0 - * @param aURI URI of the object - * @param aLUID LUID of the object - * @param aStream Argument for the command - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command - * @return none - */ - void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, - RWriteStream*& aStream, const TDesC8& aType, - const TInt aStatusRef ); - - /** - * From CSmlDmAdapter The function implements execute command. - * @since Series60_3.0 - * @param aTargetURI Target URI for the command - * @param aTargetLUID LUID of the target object - * @param aSourceURI Source URI for the command - * @param aSourceLUID LUID of the source object - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command - * @return none - */ - void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, - const TDesC8& aSourceURI, const TDesC8& aSourceLUID, - const TDesC8& aType, TInt aStatusRef ); - - /** - * From CSmlDmAdapter The function indicates start of Atomic command. - * @since Series60_3.0 - * @param none - * @return none - */ - void StartAtomicL(); - - /** - * From CSmlDmAdapter The function indicates successful end of Atomic command. - * @since Series60_3.0 - * @param none - * @return none - */ - void CommitAtomicL(); - - /** - * From CSmlDmAdapter The function indicates unsuccessful end of Atomic command. - * @since Series60_3.0 - * @param none - * @return none - */ - void RollbackAtomicL(); - - /** - * From CSmlDmAdapter Returns ETrue if adapter supports streaming otherwise EFalse. - * @since Series60_3.0 - * @param aItemSize Size limit for stream usage. - * @return ETrue or EFalse - */ - TBool StreamingSupport( TInt& aItemSize ); - - /** - * From CSmlDmAdapter Called when stream returned from UpdateLeafObjectL or - * ExecuteCommandL has been written to and committed. - * @since Series60_3.0 - * @param none - * @return none - */ - void StreamCommittedL(); - - /** - * From CSmlDmAdapter The function tells the adapter that all the commands of the message that - * can be passed to the adapter have now been passed. - * @since Series60_3.0 - * @param none - * @return none - */ - void CompleteOutstandingCmdsL(); - - /** - * From CSmlDmAdapter The function to set profile lock - * @since Series60_3.0 - * @param profileId lockvalue - * @return TInt - */ - TInt SetProfileLockL(const TInt aPID, TInt aLockValue); - - private: - - /** - * C++ default constructor. - */ - CNSmlDMSettingsAdapter12(); - CNSmlDMSettingsAdapter12( TAny* aEcomArguments ); - - /** - * The function stores integer value to buffer and returns reference to it. - * @param aObject data to be stored to buffer. - * @return reference to data buffer. - */ - TDesC8& SetIntObjectLC( const TInt& aObject ); - - /** - * The function finds out the last element of the uri. - * @param aSource Uri object that contains all elements. - * @return KErrNone if successful. - */ - TInt SetField( const TDesC8& aSource ); - - /** - * The function sets the uri being set ot get - * @param aSource Uri object that contains all elements. - * @return KErrNone if successful. - */ - TInt SetURIInProcessL( const TDesC8& aSource ); - - - /** - * The function converts data to integer and returns it. - * @param aObject Data object to be converted. - * @return Integer value for an object. - */ - TInt GetIntObject( const TDesC8& aObject ); - - /** - * The function converts data to integer and returns it. - * @param aObject Data object to be converted. - * @return 16-bit integer value for an object. - */ - TInt GetIntObject16( const TDesC& aObject ); - - /** - * The function converts LUID to integer. - * @param aLUID LUID data to be converted. - * @return Integer value for a LUID. - */ - TInt IntLUID( const TDesC8& aLUID ); - - /** - * The function sets the IAP value acording the given URI. - * @param aLUID LUID for a profile. - * @param aObject Data object containing the URI. - * @return KErrNone if successfull. - */ - TInt SetConRefL( const TInt aLUID, const TDesC8& aObject ); - - /** - * The function gets the URI for profile IAP. - * @param aObject Object where the result will be stored. - * @return KErrNone if successfull. - */ - TInt GetConRefL( CBufBase& aObject ); - - /** - * The function checks if field to be handled is valid. - * @param none - * @return ETrue if valid field otherwise EFalse. - */ - TBool AcceptDMField(); - - /** - * The function checks if field type to be handled is valid. - * @param none - * @return enum value for a field type. - */ - TNSmlDMFieldType GetDMFieldType() const; - - /** - * The function returns enum value for a field to be handled. - * @param none - * @return enum value for a field to be handled. - */ - TNSmlDMProfileData GetDMField() ; - - /** - * The function checks if data length is valid. - * @param aProfileItem Field / Leaf ID to be handled. - * @param aSource Data to be handled. - * @return ETrue if data length is valid otherwise EFalse. - */ - TBool NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, - const TDesC8& aSource ); - - /** - * The function converts 16-bit data to 8-bit and returns reference to it. - * @param aSource Reference data to be converted. - * @return Reference to 8-bit data buffer. - */ - TDesC8& ConvertTo8LC( const TDesC& aSource ); - - /** - * The function converts 8-bit data to 16-bit and returns reference to it. - * @param aSource Reference data to be converted. - * @return Reference to 16-bit data buffer. - */ - TDesC16& ConvertTo16LC( const TDesC8& aSource ); - - /** - * The function find out the port number from URL and stores it to aPort. - * @param aRealURI Reference data to be containing the whole URI. - * @param aPort Reference variable where port number will be stored. - * @return KErrNone if successful otherwise KErrNotFound. - */ - TInt ParseUri( const TDesC8& aRealURI, TInt& aPort ); - - /** - * The function opens the server session and profile via client API. - * @param aIntLUID Integer value for a LUID of the profile. - * @param aMode Read or Read and Write mode for a profile data. - * @return KErrNone if successful otherwise KErrNotFound. - */ - TInt OpenSyncSessionAndProfileL( const TInt aIntLUID, TSmlOpenMode aMode ); - - /** - * The function checks if requested profile ID exits. - * @param aIntLUID Integer value for a LUID of the profile. - * @return ETrue if profile exits otherwise EFalse. - */ - TBool FindProfileIdL( const TInt aIntLUID ); - - /** - * The function creates new DM profile. - * @param aPID Reference to variable where new profile will be stored. - * @return KErrNone if successful otherwise error code. - */ - TInt CreateNewProfileL( TInt& aPID ); - - /** - * The function stores the server URL for a profile. - * @param aPID Profile ID. - * @param aObj Reference to server URL data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileServerURIL( const TInt aPID, const TDesC8& aObj ); - - /** - * The function stores the display name for a profile. - * @param aPID Profile ID. - * @param aObj Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileDisplayNameL( const TInt aPID, const TDesC8& aObj ); - - /** - * The function stores the user name for a profile. - * @param aPID Profile ID. - * @param aObj Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileUserNameL( const TInt aPID, const TDesC8& aObj ); - - /** - * The function stores the profile http user name for a profile. - * @param aPID Profile ID. - * @param aObj Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileHttpUserNameL( const TInt aPID, const TDesC8& aObj ); - - - /** - * The function stores the protocol version for a profile. - * @param aPID Profile ID. - * @param aObj Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileProtocolVersionL( const TInt aPID, const TDesC8& aObj ); - - /** - * The function stores the ServerId value for a profile. - * @param aPID Profile ID. - * @param aObj Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileServerIdL( const TInt aPID, const TDesC8& aObj ); - - /** - * The function stores the Server password for a profile. - * @param aPID Profile ID. - * @param aObj Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileServerPasswordL( const TInt aPID, const TDesC8& aObj ); - - /** - * The function stores the network/http password for a profile. - * @param aPID Profile ID. - * @param aObj Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileHttpPasswordL( const TInt aPID, const TDesC8& aObj ); - - - /** - * The function stores the password value for a profile. - * @param aPID Profile ID. - * @param aObj Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfilePasswordL( const TInt aPID, const TDesC8& aObj ); - - /** - * The function stores the IAP id value for a profile. - * @param aLUID Profile ID. - * @param aIAPid Reference to data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileConnectionPropertyL( const TInt aLUID, const TInt aIAPid ); - - /** - * The function deleted the profile data. - * @param aPID Profile ID. - * @return KErrNone if successful otherwise error code. - */ - TInt DeleteProfileL( const TInt aPID ); - - /** - * The function to tell whether the profile is locked. - * @param aPID - * @return 1 if locked otherwise 0 - */ - TBool IsProfileLockedL(const TInt aPID); - - /** - * The function gets the profile data acoeding to aDMField. - * @param aLUID Profile ID. - * @param aDMField Data field ID to be handled. - * @param aObject Reference where fetched data to be stored. - * @return KErrNone if successful otherwise error code. - */ - TInt GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, - CBufBase& aObject ); - - /** - * The function adds port number to address URL. - * @param aLUID Profile ID. - * @param aPort Reference to port number data. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileConnectionPortNrL( const TInt aLUID, const TDesC8& aPort ); - - /** - * The function adds port number to address URL. - * @param aSrvURI Original address URI. - * @param aNewURI New URI when port number has been added or deleted. - * @param aPort Reference to port number data. - * @return KErrNone if successful otherwise error code. - */ - void SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, - const TDesC8& aPort ); - - /** - * General function which selects which leaf to be handled. - * @param aLUID Profile LUID. - * @param aObject Data to be stored. - * @param aField Leaf of field ID to be handled. - * @return KErrNone if successful otherwise error code. - */ - TInt SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, - const TNSmlDMProfileData aField ); - /** - * The function fills the node info. - * @param aNode Reference to node or leaf which info to be filled. - * @param aAccTypes Access rights for a leaf / node. - * @param aOccurrence Occurance of the node / leaf. - * @param aScope Scope (dynamic / permanent) of the leaf / node. - * @param aFormat Data format of the leaf / node. - * @param aDescription Description of the node / leaf. - * @param aDefaultValue Default value for a leaf or node. - * @param aMimeType MIME type for a leaf / node. - * @return none - */ - void FillNodeInfoL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, - MSmlDmDDFObject::TOccurence aOccurrence, - MSmlDmDDFObject::TScope aScope, - MSmlDmDDFObject::TDFFormat aFormat, - const TDesC8& aDescription, - const TDesC8& aDefaultValue, const TDesC8& aMimeType ); - - /** - * The function reads the authentication data via private API. - * @param aLUID LUID for a profile. - * @param aField Leaf id to be handled. - * @param aObject Reference where to store the data. - * @return KErrNone if successful otherwise error code. - */ - TInt GetDMAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField, - CBufBase& aObject ); - - /** - * The function delete's the authentication data via private API. - * @param aLUID LUID for a profile. - * @param aField Leaf id to be handled. - * @return KErrNone if successful otherwise error code. - */ - TInt DeleteDMAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField ); - - /** - * The function set's the address type / medium type value for a profile. - * @param aLUID LUID for a profile. - * @param aIntObj Address type value. - * @return KErrNone if successful otherwise error code. - */ - TInt SetProfileAddrTypeL( const TInt aLUID, const TInt aIntObj ); - - /** - * The function gets the profile medium type value. - * @param aObject Reference where data to be stored. - * @return KErrNone if successful otherwise error code. - */ - TInt GetProfileConnectiontypeL( TInt& aMediumTYpe ); - - /** - * The function gets the profile http user name of value. - * @param aObject Reference where data to be stored. - * @return KErrNone if successful otherwise error code. - */ - TInt GetHttpUsernameL( CBufBase& aObject ); - - - /** - * The function gets the profile IAP value. - * @param aIAPid Reference where data to be stored. - * @return KErrNone if successful otherwise error code. - */ - TInt GetProfileIAPIdL( TInt& aIAPid ); - - /** - * The function gets the profile Server URL value. - * @param aURL Reference where data to be stored. - * @return KErrNone if successful otherwise error code. - */ - void GetProfileServerURLL( CBufBase& aURL ); - - /** - * The function checks the requested medium type if supported. - * @param aIntObj Medium type. - * @param aMediumType UID for medium type. - * @return none - */ - void GetMediumTypeL( const TInt aIntObj, TInt& aMediumType ); - - /** - * The function gets the server id value. - * @param aObject Reference where data to be stored. - * @return none - */ - void GetServerIdL( CBufBase& aObject ); - - /** - * The function gets the profile name value. - * @param aObject Reference where data to be stored. - * @return none - */ - void GetProfileNameL( CBufBase& aObject ); - - /** - * The function gets the user name value. - * @param aObject Reference where data to be stored. - * @return none - */ - void GetProfileUserNameL( CBufBase& aObject ); - - /** - * The function gets the profile port number value. - * @param aObject Reference where data to be stored. - * @return none - */ - void GetProfilePortNumberL( CBufBase& aObject ); - - /** - * The function sets the profile authentication info via private API. - * @param aLUID Profile LUID. - * @param aField Leaf ID to be handled. - * @param aObject Data to be stored. - * @param aStatus Status of the function, KErrNone if successful. - * @return none - */ - void SetAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField, - const TDesC8& aObject, TInt& aStatus ); - //Buffers Node Object <> - void AddNodeBufferL( const TDesC8& aURI, const TInt aStatusRef); - - //Buffers Leaf Object - void AddLeafBufferL( const TDesC8& aURI, const TDesC8& aObject, - const TInt aStatusRef); - // Executes Buffer - void ExecuteBufferL(); - //Extracts the ParentURI - TPtrC8 ParentURI(const TDesC8& aURI); - // Clears the elements of the passed in LeafElement Structure - void ClearBuffer( CArrayFixFlat* aBuffer); - /** - * The function checks if requested ServerID ID exits. - * @param aServerid ServerID. - * @return ETrue if ServerID exits otherwise EFalse. - */ - TBool IsServerIDExistL( const TDesC8& aServerid ); - - /** - * The function checks if the URI is of format ./DMAcc/DMId - * Example ./DMAcc/DMId000 - * @param aURI aURI. - * @return true/false - */ - TBool IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI); - - /** - * The function constructs ./DMAcc/x nodes and - * returns the profile ID matching the aURI. - * @param aURI aURI. - * @return KErrNotFound/ProfileID - */ - - TInt ConstructTreeL(const TDesC8& aURI); - - /** - * The function extracts DMAcc/x node from aURI - * @param aURI DMAcc aURI. - * @return DMAcc/x node. - */ - TPtrC8 GetDynamicDMNodeUri(const TDesC8& aURI); - - private: // Data - - // Client API session class - RSyncMLSession iSyncSession; - // Client API Device Management profile handling - RSyncMLDevManProfile iProfile; - // Callback interface for returning result or status - MSmlDmCallback* iCallBack; - - TInt iCurrentProfile; - - // Profile LUID - TInt iLUID; - // Parent LUID - TInt iParentLUID; - // For handling profile medium type - TInt iObject; - - // Buffer for URI leaf element - HBufC8* iField; - - HBufC8* iURIField; - TBool iNewProfile; - // Information about data type - TNSmlDMFieldType iFieldType; - // Information about leaf command - TNSmlDMLeafType iLeafType; - // Status information if session allready opened - TBool iSyncSessionOpen; - - // Buffer for storing port number - HBufC8* iPortNbr; - - // Private API interface for handling authebtication data - RNSmlPrivateAPI iPrivateApi; - - struct TPortBuffer - { - // buffered data for updating port number - TBufC8<5> iPortBuf; - TInt iPortBufLUID; - TInt iPortBufStatusRef; - }; - RArray iPortBuffer; - - struct TLockBuffer - { - // buffered data for profile lock - TInt iProfileLock; - TInt iProfileLockLUID; - TInt iProfileLockStatusRef; - }; - RArray iProfileLockBuffer; - - TBool iBufOn; - TBool iComplete; - TInt iExecutionIndex; - CArrayFixFlat *iBuffer; - }; - -#endif // __NSMLDMSETTINGSADAPTER12_H__ - -// End of File - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp --- a/deviceupdatesui/adapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4002 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: DM-settings adapter -* -*/ - - - - -// INCLUDE FILES -#include "NSmlDMSettingsAdapter12.h" -#include "nsmldebug.h" -#include "nsmlconstants.h" -#include "nsmldmconstants.h" -#include "nsmldmiapmatcher.h" -#include "nsmldmauthinfo.h" -#include -#include -#include -#include -#include -#include -#include -#ifndef __WINS__ -// This lowers the unnecessary compiler warning (armv5) to remark. -// "Warning: #174-D: expression has no effect..." is caused by -// DBG_ARGS8 macro in no-debug builds. -#pragma diag_remark 174 -#endif - -const TUint KNSmlDMSettingsAdapterImplUid = 0x10282CE8; - -const TInt KBufSize32 = 32; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -CNSmlDMSettingsAdapter12* CNSmlDMSettingsAdapter12::NewL( MSmlDmCallback* aDmCallback ) - { - _DBG_FILE("CNSmlDMSettingsAdapter12::NewL(): begin"); - - CNSmlDMSettingsAdapter12* self = NewLC( aDmCallback ); - CleanupStack::Pop(); - - _DBG_FILE("CNSmlDMSettingsAdapter12::NewL(): end"); - return self; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::NewLC( ) -// Loads the CNSmlDMSettingsAdapter12 class and pushes it to clenupstack. -// ----------------------------------------------------------------------------- -CNSmlDMSettingsAdapter12* CNSmlDMSettingsAdapter12::NewLC( MSmlDmCallback* aDmCallback ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::NewLC(): begin" ); - CNSmlDMSettingsAdapter12* self = new ( ELeave ) CNSmlDMSettingsAdapter12( aDmCallback ); - CleanupStack::PushL( self ); - self->iCallBack = aDmCallback; - self->ConstructL(); - self->iLeafType = EDMUnset; - - _DBG_FILE( "CNSmlDMSettingsAdapter12::NewLC(): end" ); - return self; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter() -// Default constructor. -// ----------------------------------------------------------------------------- -CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter12( TAny* aEcomArguments) : - CSmlDmAdapter(aEcomArguments ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter(): begin" ); - _DBG_FILE( "CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter(): end" ); - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter() -// Destructor. -// ----------------------------------------------------------------------------- -CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter12() - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter(): begin" ); - - delete iField; - delete iURIField; - // Client API Session & Profile - iProfile.Close(); - iSyncSession.Close(); - iSyncSessionOpen = EFalse; - // In Case the Buffer isnt cleared - if ( iBuffer) - { - for (TInt val =0; valCount ();val++) - { - delete iBuffer->At(val).iMappingName; - - ClearBuffer ( iBuffer->At(val).iLeafBuf); - delete iBuffer->At(val).iLeafBuf; - } - - iBuffer->Reset (); - delete iBuffer; - } - delete iPortNbr; - iPortBuffer.Reset(); - iPortBuffer.Close(); - iProfileLockBuffer.Reset(); - iProfileLockBuffer.Close(); - - iPrivateApi.Close(); - - iCallBack = 0; - FeatureManager::UnInitializeLib(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter(): end" ); - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::ConstructL() -// Second phase constructor. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::ConstructL() - { - iField = HBufC8::NewL( KNSmlMaxURLLength ); - iURIField = NULL; - iSyncSessionOpen = EFalse; - FeatureManager::InitializeLibL(); - // variables used for Buffering - iBufOn = EFalse; - iComplete = EFalse; - iExecutionIndex = -1; - iNewProfile = EFalse; - // initialising iBuffer - iBuffer = new (ELeave) CArrayFixFlat (KNSmlDMGranularity); - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::DDFVersionL() -// Returns the DDF version number. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::DDFVersionL( CBufBase& aVersion ) - { - _DBG_FILE( - "CNSmlDMSettingsAdapter12::DDFVersionL(CBufBase& aDDFVersion): begin" ); - aVersion.InsertL( 0, KVersion ); - _DBG_FILE( - "CNSmlDMSettingsAdapter12::DDFVersionL(CBufBase& aDDFVersion): end" ); - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::DDFStructureL() -// Fills the DDF structure of the adapter. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::DDFStructureL( MSmlDmDDFObject& aDDF ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::DDFStructureL(): begin" ); - - //Making DMAcc as root - - MSmlDmDDFObject* ddfRoot = &aDDF; - MSmlDmDDFObject& nDmDDF = ddfRoot->AddChildObjectL( KNSmlDefDMAcc ); - - TSmlDmAccessTypes *aclTypes = new ( ELeave ) TSmlDmAccessTypes(); - CleanupStack::PushL( aclTypes ); - - // Set Get as acceptable operations - aclTypes->SetGet(); - - nDmDDF.SetDFTitleL( KNSmlDMadapterTitle ); - - FillNodeInfoL( nDmDDF, *aclTypes, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, - KNullDesC8, KNullDesC8, KNullDesC8 ); - - aclTypes->SetAdd(); - // Set rest acceptable operations for data itself - aclTypes->SetReplace(); - aclTypes->SetDelete(); - - TSmlDmAccessTypes aclTypesNoGet; - aclTypesNoGet.SetReplace(); - aclTypesNoGet.SetAdd(); - aclTypesNoGet.SetDelete(); - - TSmlDmAccessTypes aclTypesAR; - aclTypesAR.SetReplace(); - aclTypesAR.SetAdd(); - - TSmlDmAccessTypes aclTypesARG; - aclTypesARG.SetReplace(); - aclTypesARG.SetAdd(); - aclTypesARG.SetGet(); - - TSmlDmAccessTypes aclTypesG; - aclTypesG.SetGet(); - - TSmlDmAccessTypes aclTypesAG; - aclTypesAG.SetGet(); - aclTypesAG.SetAdd(); - - TSmlDmAccessTypes aclTypesAGD; - aclTypesAGD.SetGet(); - aclTypesAGD.SetAdd(); - aclTypesAGD.SetDelete(); - - - MSmlDmDDFObject& nProDDF = nDmDDF.AddChildObjectGroupL(); - FillNodeInfoL( nProDDF, *aclTypes, MSmlDmDDFObject::EZeroOrMore, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, - KNullDesC8, KNullDesC8, KMimeType ); - - MSmlDmDDFObject& nAppIdDDF = nProDDF.AddChildObjectL( KNSmlDdfAppId ); // Addr - FillNodeInfoL( nAppIdDDF, aclTypesG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAppIdDescription, KNullDesC8, KMimeType ); - - //PrefConRef - MSmlDmDDFObject& nPrefConRefDDF = nProDDF.AddChildObjectL( KNSmlDdfPrefConRef ); // PrefConRef - FillNodeInfoL( nPrefConRefDDF, aclTypesARG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfConRefDescription, KNullDesC8, KMimeType ); - - - - // App Address nodes - MSmlDmDDFObject& nAppAddrDDF = nProDDF.AddChildObjectL( KNSmlDdfAppAddr ); // AppAddr - FillNodeInfoL( nAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, - KNSmlDdfAddrDescription, KNullDesC8, KMimeType ); - - MSmlDmDDFObject& rtToAppAddrRef = nAppAddrDDF.AddChildObjectGroupL(); //AppAddr/ - FillNodeInfoL(rtToAppAddrRef,aclTypesG,MSmlDmDDFObject::EOneOrMore, - MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode, - KNSmlDdfAddrDescription,KNullDesC8, KMimeType ); - - - MSmlDmDDFObject& nAddrForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfAddr ); // Addr - FillNodeInfoL( nAddrForAppAddrDDF, aclTypesARG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAddrDescription, KNullDesC8, KMimeType ); - - MSmlDmDDFObject& nAddrTypeForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfAddrType ); // AddrType - FillNodeInfoL( nAddrTypeForAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType ); - - MSmlDmDDFObject& nPortForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfPort ); // PortNbr - FillNodeInfoL( nPortForAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, - KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); - - //Runtime port address - MSmlDmDDFObject& nrtToPortDDF = nPortForAppAddrDDF.AddChildObjectGroupL(); // PortNbr - FillNodeInfoL( nrtToPortDDF, aclTypesG, MSmlDmDDFObject::EOneOrMore, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, - KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); - - MSmlDmDDFObject& nPortNbrToPortDDF = nrtToPortDDF.AddChildObjectL( KNSmlDdfPortNbr ); // PortNbr - FillNodeInfoL( nPortNbrToPortDDF, aclTypesARG, MSmlDmDDFObject::EZeroOrOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, - KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); - - - MSmlDmDDFObject& nAuthSchemeDDF = nProDDF.AddChildObjectL( KNSmlDdfAuthScheme ); // AuthPref - FillNodeInfoL( nAuthSchemeDDF, aclTypesARG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); - //APPAUthNodes - - MSmlDmDDFObject& nAppAuthDDF = nProDDF.AddChildObjectL( KNSmlDdfAppAuth ); // AppAuth - FillNodeInfoL( nAppAuthDDF, aclTypesG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, - KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); - - - MSmlDmDDFObject& nrtToAppAuthDDF = nAppAuthDDF.AddChildObjectGroupL(); // appauth/ - FillNodeInfoL( nrtToAppAuthDDF, aclTypesG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, - KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); - - - MSmlDmDDFObject& nAauthLevelDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthLevel ); // AAuthLevel - FillNodeInfoL( nAauthLevelDDF, aclTypesARG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAuthLevelDescription, KNullDesC8, KMimeType ); - - - MSmlDmDDFObject& nAauthtypeDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthType ); // AAuthType - FillNodeInfoL( nAauthtypeDDF, aclTypesG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType ); - - - MSmlDmDDFObject& nAauthNameDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthName ); // AddrType - FillNodeInfoL( nAauthNameDDF, aclTypesARG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAuthNameDescription, KNullDesC8, KMimeType ); - - - MSmlDmDDFObject& nAauthSecretDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthSecret ); // AddrType - FillNodeInfoL( nAauthSecretDDF, aclTypesAR, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAuthSecretDescription, KNullDesC8, KMimeType ); - - MSmlDmDDFObject& nAauthDataDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthData ); // AddrType - FillNodeInfoL( nAauthDataDDF, aclTypesAR, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfAuthDataDescription, KNullDesC8, KMimeType ); - - - MSmlDmDDFObject& nNameDDF = nProDDF.AddChildObjectL( KNSmlDdfName ); // Name - FillNodeInfoL( nNameDDF, aclTypesARG, MSmlDmDDFObject::EZeroOrOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfNameDescription, KNullDesC8, KMimeType ); - - - - MSmlDmDDFObject& nServerIdDDF = nProDDF.AddChildObjectL( KNSmlDdfServerId ); // ServerId - FillNodeInfoL( nServerIdDDF, aclTypesAG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); - - MSmlDmDDFObject& nextDDF = nProDDF.AddChildObjectL( KNSmlDdfExt ); // Ext - FillNodeInfoL( nextDDF, aclTypesG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, - KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); - - MSmlDmDDFObject& nlockedDDF = nextDDF.AddChildObjectL( KNSmlDdfLocked ); // locked - FillNodeInfoL( nlockedDDF, aclTypesARG, MSmlDmDDFObject::EOne, - MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, - KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); - - CleanupStack::PopAndDestroy(); //aclTypes - - _DBG_FILE("CNSmlDMSettingsAdapter12::DDFStructureL(): end"); - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::UpdateLeafObjectL -// Updates profile leaf object data based on URI. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::UpdateLeafObjectL( const TDesC8& aURI, - const TDesC8& aLUID, - const TDesC8& aObject, - const TDesC8& /*aType*/, - const TInt aStatusRef ) - { - _DBG_FILE("CNSmlDMSettingsAdapter12::UpdateLeafObjectL(): begin"); - TInt index = -1; - if ( !iBufOn) - { - for (TInt val = 0; valCount (); val++) - { - TPtrC8 firstUri = ParentURI (aURI); - if ( iBuffer->At(val).iMappingName->Compare (firstUri)== 0) - { - index = iExecutionIndex = val; - break; - } - } - } - if ( index >= 0) - AddLeafBufferL (aURI, aObject, aStatusRef); - else - { - TInt parentLUID = GetIntObject( aLUID ); - if( parentLUID < 0 ) - { - if( IsDMAccUriFormatMatchPredefined(aURI) ) - { - parentLUID = ConstructTreeL(aURI); - } - } - if( parentLUID < 0 ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL( ): ENotFound end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - - if( parentLUID != iParentLUID ) - { - if( FindProfileIdL( parentLUID ) != EFalse ) - { - iParentLUID = parentLUID; - } - else - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - } - SetField( aURI ); - SetURIInProcessL( aURI); - if( !AcceptDMField() ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): KErr field end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); - return; - } - - // Get Database field type - TNSmlDMFieldType fType = GetDMFieldType(); - if ( fType == EWrong ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - return; - } - - TNSmlDMProfileData fData = GetDMField(); - if( fData == ESyncAccepted ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - return; - } - if( NotValidStrLenght( fData, aObject ) ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): KErr length end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); - return; - } - //Authentication data leafs to be handled - if ( fData == EAuthenticationRequired || fData == EClientNonce - || fData == EServerNonce ) - { - //Check if replace command and replace data as defined - - TInt replaceStatus = KErrGeneral; - SetAuthInfoL( iParentLUID + KMaxDataSyncID, fData, aObject, replaceStatus ); - if ( replaceStatus == KErrNone ) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - } - else if ( replaceStatus == KErrNotFound ) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - } - else - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - } - - _DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL():end" ); - return; - } - - TInt rValue = SetDMFieldDataL( iParentLUID, aObject, fData ); - if ( fData == EProfilePort ) - { - // in case port is updated, save status ref to be used in - // CompleteOutstandingCmdsL - if(rValue==KErrNone) - { - iPortBuffer[iPortBuffer.Count()-1].iPortBufStatusRef = aStatusRef; - } - else if( rValue == KErrOverflow) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); - } - else - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - } - } - else if ( fData == EProfileLock && iNewProfile ) - { - if(rValue == KErrNone) - iProfileLockBuffer[iProfileLockBuffer.Count()-1].iProfileLockStatusRef = aStatusRef; - else - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed); - } - else - { - if( rValue != KErrNone ) - { - if( rValue == KErrNotFound ) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - } - else if( rValue == KErrInUse ) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); - } - else if( rValue == KErrNoMemory ) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory ); - } - else if(rValue == KErrAccessDenied) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed); - - } - else if ( rValue == KErrArgument) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject); - - } - else - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - } - } - else - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - } - } - } - _DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL():end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::DeleteObjectL -// Deletes whole profile or leaf object data acording to aURI. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::DeleteObjectL( const TDesC8& aURI, - const TDesC8& aLUID, - const TInt aStatusRef ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): begin" ); - - if( aURI.Find( KNSmlDdfConRef ) != KErrNotFound ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL(): NOT ALLOWED end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - return; - } - iLUID = IntLUID( aLUID ); - if(IsProfileLockedL(iLUID)) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL(): NOT ALLOWED end" ); - - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed ); - return; - } - - - // Check which field going to be handled - SetField( aURI ); - SetURIInProcessL(aURI); - - // Check if valid field - if( !AcceptDMField() ) - { - - // Delete whole profile if aURI called for node - TInt last = aURI.LocateReverse( '/' ); - TInt pos = aURI.Find( KNSmlDefDMAcc ); - if( last - 5 == pos ) - { - - // If called for node means that profile will deleted from database - iLUID = IntLUID( aLUID ); - DBG_ARGS8( _S8("DeleteObjectL: URI %S LUID = %d"), &aURI, iLUID ); - - if( FindProfileIdL( iLUID ) == EFalse ) - { - _DBG_FILE( - "CNSmlDMSettingsAdapter12::DeleteObjectL( ): notfound end"); - - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - else - { - TInt sRet = DeleteProfileL( iLUID + KMaxDataSyncID ); - if ( sRet != KErrNone ) - { - if( sRet == KErrNotFound ) - { - iCallBack->SetStatusL( aStatusRef, - CSmlDmAdapter::ENotFound ); - } - else if( sRet == KErrInUse ) - { - iCallBack->SetStatusL( aStatusRef, - CSmlDmAdapter::EObjectInUse ); - } - else - { - iCallBack->SetStatusL( aStatusRef, - CSmlDmAdapter::EError ); - } - return; - } - else - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): EOk end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - return; - } - } - } - else - { - _DBG_FILE( - "CNSmlDMSettingsAdapter12::DeleteObjectL( ): EInvalidObject end" ); - iCallBack->SetStatusL( aStatusRef,CSmlDmAdapter::EInvalidObject ); - return; - } - }//Delete whole Profile - - iLUID = IntLUID( aLUID ); - if ( iLUID != iParentLUID ) - { - if( FindProfileIdL( iLUID ) == EFalse ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - iParentLUID = iLUID; - } - - if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) - { - DeleteDMAuthInfoL( iLUID, EAuthenticationRequired ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - return; - } - else if( iField->Compare( KNSmlDdfClientNonce ) == 0 ) - { - DeleteDMAuthInfoL( iLUID, EClientNonce ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - return; - } - else if( iField->Compare(KNSmlDdfServerNonce) == 0 ) - { - DeleteDMAuthInfoL( iLUID, EServerNonce ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - return; - } - - // Sets default value if not null field - HBufC8* dataObject = HBufC8::NewLC( 15 ); - dataObject->Des().Format( KNullDesC8 ); - - _LIT8(aType, "text/plain"); - iLeafType = EDMDelete; - UpdateLeafObjectL( aURI, aLUID, *dataObject, aType, aStatusRef ); - CleanupStack::PopAndDestroy(); //dataObject - iLeafType = EDMUnset; - - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::FetchLeafObjectL -// Fetches profile leaf object data acordint to aURI. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::FetchLeafObjectL( const TDesC8& aURI, - const TDesC8& aLUID, - const TDesC8& aType, - const TInt aResultsRef, - const TInt aStatusRef ) - { - - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): begin" ); - DBG_ARGS(_S16( "DM:Fetch aURI - %S - %S"), &aURI, &aLUID ); - - iLUID = IntLUID( aLUID ); - if ( iLUID >= 0 ) - { - if( FindProfileIdL( iLUID ) == EFalse ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - } - else - { - - // Static node feature start - iLUID = -1; - if( IsDMAccUriFormatMatchPredefined(aURI) ) - { - iLUID = ConstructTreeL(aURI); - } - - if (iLUID == -1) - { - _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - // Static node feature end - } - - // Check which field going to be handled - SetField(aURI); - SetURIInProcessL(aURI); - - // Check if valid field - if( !AcceptDMField() ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EInvalidObject end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); - return; - } - /*if(iField->Compare(KNSmlDdfExt) == 0) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - CBufBase* extNode = CBufFlat::NewL(128); - CleanupStack::PushL(extNode); - iCallBack->SetResultsL( aResultsRef, *extNode, KNullDesC8 ); - CleanupStack::PopAndDestroy(extNode); - return; - }*/ - - // Get Database field type - TInt fType = GetDMFieldType(); - if ( fType == EWrong ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EError end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - return; - } - - TNSmlDMProfileData fieldId = GetDMField(); - if( fieldId == ESyncAccepted ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - return; - } - CBufBase *lObject = CBufFlat::NewL( 128 ); - CleanupStack::PushL( lObject ); - lObject->Reset(); - - CSmlDmAdapter::TError status; - - if ( fType == EStr || fType == EInt || fType == EBin ) - { - // Check for APPId and return w7 - TInt rValue = KErrNone; - /* if( iField->Compare(KNSmlDdfAppId ) ==0 ) - { - status = CSmlDmAdapter::EOk; - lObject->InsertL(lObject->Size(),KNSmlDdfAppIdValue); - - }*/ - - rValue = GetObjectL( iLUID, fieldId, *lObject ); - if( rValue != KErrNone ) - { - if( rValue == KErrNotFound ) - { - status = CSmlDmAdapter::ENotFound; - } - else if( rValue == KErrInUse ) - { - status = CSmlDmAdapter::EObjectInUse; - } - else if( rValue == KErrNoMemory ) - { - status = CSmlDmAdapter::ENoMemory; - } - else - { - status = CSmlDmAdapter::EError; - } - } - else - { - status = CSmlDmAdapter::EOk; - } - } - else - { - CleanupStack::PopAndDestroy(); //lObject - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - iProfile.Close(); - iSyncSession.Close(); - iSyncSessionOpen = EFalse; - return; - } - iCallBack->SetStatusL( aStatusRef, status ); - - if(status==CSmlDmAdapter::EOk) - { - iCallBack->SetResultsL( aResultsRef, *lObject, aType ); - } - - CleanupStack::PopAndDestroy(); //lObject - iProfile.Close(); - iSyncSession.Close(); - iSyncSessionOpen = EFalse; - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CSmlDmSettingsAdapter::ChildURIListL -// Function returns the list of profiles or leafs of the profile -// acording to aURI. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::ChildURIListL( const TDesC8& aURI, - const TDesC8& aLUID, - const CArrayFix& aPreviousURISegmentList, - const TInt aResultsRef, - const TInt aStatusRef ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): begin" ); - CBufBase *currentURISegmentList = CBufFlat::NewL( 128 ); - CleanupStack::PushL( currentURISegmentList ); - - if(( aURI.Match( KDmAccMatch ) != KErrNotFound ) && - (aURI.Match( KDmAccMatch3 ) == KErrNotFound )) - { - // Check if Profile exists - TInt checkLUID = GetIntObject( aLUID ); - if( FindProfileIdL( checkLUID ) ) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAcc ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); - } - else - { - // Static node feature start - checkLUID = -1; - if( IsDMAccUriFormatMatchPredefined(aURI) ) - { - checkLUID = ConstructTreeL(aURI); - } - - if (checkLUID == -1) - { - _DBG_FILE( "CNSmlDMSettingsAdapter::childURI(): ENotFound end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - CleanupStack::PopAndDestroy( ); // currentURISegmentList - _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): end" ); - return; - } - else - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAcc ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); - - } - - - // iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - // Static node feature start end - } - - CleanupStack::PopAndDestroy( ); // currentURISegmentList - _DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): end" ); - return; - } - else if(( aURI.Match( KDmAccMatch2 ) != KErrNotFound ) && - (aURI.Match( KDmAccMatch ) == KErrNotFound )) - { - if( iSyncSessionOpen == EFalse ) - { - iSyncSession.OpenL(); - iSyncSessionOpen = ETrue; - } - RArray profileIdArray; - CleanupClosePushL( profileIdArray ); - TSmlUsageType usageType = ESmlDevMan; - iSyncSession.ListProfilesL( profileIdArray, usageType ); - - for( TInt p = 0; p < profileIdArray.Count(); p++ ) - { - TBool notInList = ETrue; - TInt newline = 0; - TInt ddId = profileIdArray[p] - KMaxDataSyncID; - - while( notInList && newline < aPreviousURISegmentList.Count() ) - { - TInt ppId = GetIntObject( aPreviousURISegmentList.At(newline).iURISegLUID ); - if( ppId == ddId ) - { - notInList = EFalse; - break; - } - newline++; - } - if( notInList ) - { - _LIT8( Kprev, "DMId" ); - TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid - TInt fixedProfId = profileIdArray[p] - KMaxDataSyncID; //fit to 3 decimal - addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); - - currentURISegmentList->InsertL( currentURISegmentList->Size(), addNAME ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash ); - DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME ); - - // KNSmlDMStart includes start text for URISeg - TBuf8<20> addURI; // SyncML/DMAcc/DMIdnnn , nnn = profileid - addURI.Append( KNSmlDMStart ); - addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); - - TBuf8<3> addLUID; - addLUID.Num( fixedProfId ); - - // Also added to mapping - iCallBack->SetMappingL( addURI, addLUID ); - } - else - { // Add those in PreviousList which are on database - currentURISegmentList->InsertL( currentURISegmentList->Size(), - aPreviousURISegmentList.At(newline).iURISeg ); - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash ); -// DBG_ARGS8( _S8("InList: Id = %d Name %S"), newline, -// aPreviousURISegmentList.At(newline).iURISeg ); - } - } - CleanupStack::PopAndDestroy( 1 );//profileIdArray - } - - // AppAddr subtree - else if( ( aURI.Match( KDmAccAppAddrMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortMatch ) == KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound )) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KDmAccAppAddrId ); - } - else if(( aURI.Match( KDmAccAppAddrFullMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortMatch ) == KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound )) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAddr ); - } - else if(( aURI.Match( KDmAccPortMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound )) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccPortRT ); - } - else if( aURI.Match( KDmAccPortFullMatch ) != KErrNotFound ) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccport ); - } - - else if(( aURI.Match( KDmAccAppAuthMatch ) != KErrNotFound ) && (aURI.Match( KDmAccAppAuthFullMatch ) == KErrNotFound )) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KDmAccAppAuthNodes ); - } - else if((aURI.Match(KDmAccAppAuthSrvMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthCliMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthTransMatch) != KErrNotFound)) //|| (aURI.Match(KDmAccAppAuthObexMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthHttpMatch) != KErrNotFound)) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAuth ); - } - else if(( aURI.Match( KDmAccAppAuthFullMatch ) != KErrNotFound ) && (aURI.Find( KDmAccAppAuthNodes ) != KErrNotFound)) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAuth ); - } - - else if( aURI.Match( KDmAccExtMatch ) != KErrNotFound ) - { - currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccLocked ); - } - else - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); - CleanupStack::PopAndDestroy( 1 ); // currentURISegmentList - return; - } - - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); - iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); - CleanupStack::PopAndDestroy(); // currentURISegmentList - _DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::AddNodeObjectL -// Adds new DM-settings profile to database -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::AddNodeObjectL( const TDesC8& aURI, - const TDesC8& aParentLUID, - const TInt aStatusRef ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): begin" ); - - if( aParentLUID.Length() > 0 ) - { - iParentLUID = GetIntObject( aParentLUID ); - if( FindProfileIdL( iParentLUID ) != EFalse )// iProfile != NULL) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): EAlreadyExists end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); - return; - } - else - { - TInt ret = iCallBack->RemoveMappingL(KNSmlDMSettingsAdapterImplUid, - GetDynamicDMNodeUri( aURI ), ETrue ); - if(ret != KErrNone) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - return; - } - } - } - iNewProfile = ETrue; - AddNodeBufferL (aURI, aStatusRef); - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::UpdateLeafObjectL() -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::UpdateLeafObjectL( const TDesC8&, const TDesC8&, - RWriteStream*&, const TDesC8&, - const TInt ) - { - //Not supported because data streaming is not supported by this adapter. - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL -// This function fetches leaf object and returns its size. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL( const TDesC8& aURI, - const TDesC8& aLUID, - const TDesC8& aType, - const TInt aResultsRef, - const TInt aStatusRef ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL() : begin" ); - DBG_ARGS( _S16("DM:Fetch aURI - %S - %S"), &aURI, &aLUID ); - - iLUID = IntLUID( aLUID ); - if ( iLUID >= 0 ) - { - if( FindProfileIdL( iLUID ) == EFalse ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - } - else - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - - // Check which field going to be handled - SetField( aURI ); - SetURIInProcessL (aURI); - - // Check if valid field - if( !AcceptDMField() ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EInvalidObject end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); - return; - } - /*if(aURI.Find( KNSmlDdfExt ) != KErrNotFound) - { - return; - }*/ - - // Get Database field type - TInt fType = GetDMFieldType(); - if ( fType == EWrong ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EError end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - return; - } - - CBufBase *lObject = CBufFlat::NewL( 128 ); - CleanupStack::PushL( lObject ); - lObject->Reset(); - - if ( fType == EStr || fType == EInt || fType == EBin ) - { - TInt rValue = GetObjectL( iLUID, GetDMField(), *lObject ); - if( lObject->Size() == 0 || rValue != KErrNone ) - { - if( rValue == KErrNotFound ) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - } - else if( rValue == KErrInUse ) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); - } - else if( rValue == KErrNoMemory ) - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory ); - } - else - { - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - } - } - } - else - { - CleanupStack::PopAndDestroy();//lObject - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); - return; - } - TInt objSizeInBytes = lObject->Size(); - TBuf8<16> stringObjSizeInBytes; - stringObjSizeInBytes.Num( objSizeInBytes ); - - lObject->Reset(); - lObject->InsertL( 0, stringObjSizeInBytes ); - iCallBack->SetResultsL( aResultsRef, *lObject, aType ); - iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); - - CleanupStack::PopAndDestroy( 1 ); //lObject - _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::ExecuteCommandL() -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::ExecuteCommandL( const TDesC8&, const TDesC8&, - const TDesC8&, const TDesC8&, - const TInt ) - { - //Not supported. Command execution via DM settings adapter not possible. - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::ExecuteCommandL() -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::ExecuteCommandL( const TDesC8&, const TDesC8&, - RWriteStream*&, const TDesC8&, - const TInt ) - { - //Not supported. Command execution via DM settings adapter not possible. - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::CopyCommandL() -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::CopyCommandL( const TDesC8&, const TDesC8&, - const TDesC8&, const TDesC8&, - const TDesC8&, TInt ) - { - //Not supported. - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::StartAtomicL() -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::StartAtomicL() - { - //Not supported. Handling Atomic command cycles not supported by the adapter. - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::CommitAtomicL() -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::CommitAtomicL() - { - //Not supported. Handling Atomic command cycles not supported by the adapter. - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::RollbackAtomicL() -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::RollbackAtomicL() - { - //Not supported. Handling Atomic command cycles not supported by the adapter. - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::StreamingSupport() -// Indicates if streaming is supported. -// ----------------------------------------------------------------------------- -TBool CNSmlDMSettingsAdapter12::StreamingSupport( TInt& /*aItemSize*/ ) - { - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::StreamCommittedL() -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::StreamCommittedL() - { - //Not supported. Streaming not supported by the DM settings adapter. - } -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::CompleteOutstandingCmdsL() -// If buffering used, commands must be executed before returning this function. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::CompleteOutstandingCmdsL() - { - // Check if Buffered - for (int val=0; valCount ();val++) - { - if ( !iBuffer->At(val).iExecuted) - { - TInt count = iBuffer->At(val).iLeafBuf->Count ()-1; - iExecutionIndex = val; - iComplete = ETrue; - ExecuteBufferL (); - } - } - for (TInt i = 0;iSetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EError ); - } - else - { - iCallBack->SetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EOk ); - } - - } - iPortBuffer.Reset(); - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::AcceptDMField -// This function checks if field to be handled is valid. -// ----------------------------------------------------------------------------- -TBool CNSmlDMSettingsAdapter12::AcceptDMField() - { - _DBG_FILE("CNSmlDMSettingsAdapter12::AcceptDMField(): begin"); - - if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare( KNSmlDdfName ) == 0 ) - { - return ETrue; - } - - else if ( iField->Compare( KNSmlDdfId ) == 0 ) - { - return ETrue; - } - else if ( iField->Compare(KNSmlDdfAppId) == 0 ) - { - return ETrue; - } - else if ( iField->Compare(KNSmlDdfPrefConRef) == 0 ) - { - return ETrue; - } - else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 ) - { - return ETrue; - } - - else if (iField->Compare(KNSmlDdfAAuthType) == 0 ) - { - return ETrue; - } - else if (iField->Compare(KNSmlDdfAAuthName) == 0 ) - { - return ETrue; - } - - else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 ) - { - return ETrue; - } - else if (iField->Compare(KNSmlDdfAAuthData) == 0 ) - { - return ETrue; - } - else if (iField->Compare(KNSmlDdfLocked) == 0 ) - { - return ETrue; - } - - _DBG_FILE( "CNSmlDMSettingsAdapter12::AcceptDMField(): end" ); - return EFalse; // Not a valid Type - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetDMField -// Matches URI fieldname to DM-database. -// ----------------------------------------------------------------------------- -TNSmlDMProfileData CNSmlDMSettingsAdapter12::GetDMField() - { - - if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) - { - - return EProfileAddrType; - - } - else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) - { - return EProfileURL; - } - else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) - { - return EProfilePort; - } - else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) - { - return EAuthenticationRequired; - } - else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) - { - return EServerId; - } - else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) - { - return ESharedSecret; - } - else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) - { - return EServerNonce; - } - else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) - { - return EProfileDMServerUsername; - } - else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) - { - return EProfileDMServerPassword; - } - else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 ) - { - return EClientNonce; - } - else if ( iField->Compare( KNSmlDdfName ) == 0 ) - { - return EProfileName; - } - else if ( iField->Compare( KNSmlDdfId ) == 0 ) - { - return EProfileId; - } - - else if ( iField->Compare( KNSmlDdfPrefConRef ) == 0 ) - { - return EProfileIAPId; - } - - else if ( iField->Compare( KNSmlDdfAppId ) == 0 ) - { - return EProfileIAPId; - } - else if ( iField->Compare( KNSmlDdfLocked) == 0 ) - { - return EProfileLock; - } - - else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 ) - { - if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound) - return EPRofileServerCred; - else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound) - return EPRofileClientCred; - else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound) - return EProfileTransport; - } - - else if (iField->Compare(KNSmlDdfAAuthType) == 0 ) - { - return EProfileAAuthType; - } - else if (iField->Compare(KNSmlDdfAAuthName) == 0 ) - { - if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound) - return EProfileName; - else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound) - return EProfileDMServerUsername; - else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound) - { - return ETransportAuthName; - } - - // return ETrue; - } - - else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 ) - { - if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound) - return ESharedSecret; - else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound) - return EProfileDMServerPassword; - else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound) - { - return EProfileTransportPassword; - } - } - else if (iField->Compare(KNSmlDdfAAuthData) == 0 ) - { - if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound) - return EServerNonce; - else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound) - return EClientNonce; - else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound) - return EProfileTransportAuthData; - } - - - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMField(): Error" ); - return ESyncAccepted; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetDMFieldType -// Gets field data type. -// ----------------------------------------------------------------------------- -TNSmlDMFieldType CNSmlDMSettingsAdapter12::GetDMFieldType() const - { - if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) - { - return EInt; - } - else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) - { - return EStr; - } - else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) - { - return EInt; - } - else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) - { - return EInt; - } - else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) - { - return EStr; - } - else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) - { - return EStr; - } - else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) - { - return EBin; - } - else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) - { - return EStr; - } - else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) - { - return EStr; - } - else if (iField->Compare(KNSmlDdfClientNonce) == 0) - { - return EBin; - } - else if ( iField->Compare( KNSmlDdfName ) == 0 ) - { - return EStr; - } - - else if ( iField->Compare( KNSmlDdfId ) == 0 ) - { - return EInt; - } - else if( iField->Compare(KNSmlDdfAppId ) ==0 ) - { - return EStr; - } - else if ( iField->Compare( KNSmlDdfPrefConRef ) == 0 ) - { - return EInt; - } - else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 ) - { - return EStr; - } - - else if (iField->Compare(KNSmlDdfAAuthType) == 0 ) - { - return EStr; - } - else if (iField->Compare(KNSmlDdfAAuthName) == 0 ) - { - return EStr; - } - - else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 ) - { - return EStr; - } - else if (iField->Compare(KNSmlDdfAAuthData) == 0 ) - { - return EBin; - } - - else if(iField->Compare(KNSmlDdfLocked)==0) - { - return EStr; - } - - - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMFieldType(): Error" ); - return EWrong; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::IntLUID -// Returns integer value for a profile LUID. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::IntLUID( const TDesC8& aLUID ) - { - TLex8 lLex( aLUID ); - - if( lLex.Val( iLUID ) == KErrNone ) - { - return iLUID; - } - else - { - return -1; - } - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetIntObject -// Returns integer value for a aObject. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::GetIntObject( const TDesC8& aObject ) - { - TLex8 lLex( aObject ); - - TInt value = 0; - - if( lLex.Val( value ) != KErrNone ) - { - return KErrNotFound; - } - else - { - return value; - } - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetIntObject16() -// Returns Integer Value for a 16 bit data object. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::GetIntObject16( const TDesC& aObject ) - { - TLex16 lLex( aObject ); - - TInt value = 0; - - if( lLex.Val( value ) == KErrNone ) - { - return value; - } - else - { - return value; - } - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetIntObjectLC -// Converts integer to HBufC8 type buffer and returns reference to it. -// ----------------------------------------------------------------------------- -TDesC8& CNSmlDMSettingsAdapter12::SetIntObjectLC( const TInt& aObject ) - { - HBufC8* buf = HBufC8::NewLC( 8 ); - TPtr8 ptrBuf = buf->Des(); - - ptrBuf.Num( aObject ); - return *buf; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::NotValidStrLenght -// Checks if data length is valid. -// ----------------------------------------------------------------------------- -TBool CNSmlDMSettingsAdapter12::NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, - const TDesC8& aSource ) - { - TInt lLen = aSource.Length(); - TBool lBool = EFalse; - - switch ( aProfileItem ) - { - case ( EProfileName ) : - { - if( lLen > KNSmlMaxProfileNameLength ) - { - lBool = ETrue; - } - } - break; - - case ( EProfileDMServerUsername ) : - { - if( lLen > KNSmlMaxUsernameLength ) - { - lBool = ETrue; - } - } - break; - - case ( EProfileHttpUsername ) : - case (ETransportAuthName): - { - if( lLen > KNSmlDmMaxHttpAuthUsernameLength ) - { - lBool = ETrue; - } - } - break; - case ( EProfileHttpPassword ) : - case (EProfileTransportPassword): - { - if( lLen > KNSmlDmMaxHttpAuthPasswordLength ) - { - lBool = ETrue; - } - } - break; - case ( EProfileDMServerPassword ) : - { - if( lLen > KNSmlMaxPasswordLength ) - { - lBool = ETrue; - } - } - break; - - case ( ESharedSecret ) : - { - if( lLen > KNSmlDmSharedSecretMaxLength ) - { - lBool = ETrue; - } - } - break; - - case ( EProfileURL ) : - { - if( lLen > KNSmlMaxURLLength ) - { - lBool = ETrue; - } - } - break; - - case ( EServerId ) : - { - if( lLen > KNSmlDmServerIdMaxLength ) - { - lBool = ETrue; - } - } - break; - - case ( EProfileIAPId ) : - { - if( lLen > KNSmlMaxURLLength ) - { - lBool = ETrue; - } - } - break; - - case ( EAuthenticationRequired ) : - case ( EProfileAAuthType ) : - { - if( lLen > 20 ) - { - lBool = ETrue; - } - } - break; - - case ( EProfileId ) : - case ( EProfilePort ) : - case ( EProfileMediumType ) : - case ( EProfileAddrType ) : - - { - if( lLen > 8 ) - { - lBool = ETrue; - } - } - break; - - case ( EServerNonce ) : - case ( EClientNonce ) : - case (EProfileTransportAuthData): - { - lBool = EFalse; - } - break; - case ( EProfileTransport ): - { - lBool = EFalse; - } - break; - case EProfileLock : - { - if(lLen > 6 ) - { - lBool = ETrue; - } - - } - break; - default: - { - lBool = ETrue; - } - } - - return lBool; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetField -// Last element of the URI (after last '/') is returned. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetField( const TDesC8& aSource ) - { - if ( aSource.LocateReverse( KNSmlDMUriSeparator ) == KErrNotFound ) - { - iField->Des().Format( aSource ); - } - else - { - iField->Des().Format( aSource.Mid( aSource.LocateReverse( KNSmlDMUriSeparator ) + 1 ) ); - } - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetField -// Last element of the URI (after last '/') is returned. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetURIInProcessL( const TDesC8& aSource ) - { - - if( iURIField ) - { - delete iURIField; - iURIField = NULL; - } - iURIField = HBufC8::NewL( aSource.Length() ); - TPtr8 newPortNbr = iURIField->Des(); - newPortNbr.Append( aSource ); - - return KErrNone; - } - - - - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::ConvertTo8LC -// Converts string value to 8-bit and returns reference. -// ----------------------------------------------------------------------------- -TDesC8& CNSmlDMSettingsAdapter12::ConvertTo8LC( const TDesC& aSource ) - { - HBufC8* buf = HBufC8::NewLC( aSource.Length() * 2 ); - TPtr8 bufPtr = buf->Des(); - CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); - - return *buf; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::ConvertTo16LC -// Converts string value to 16-bit and returns reference. -// ----------------------------------------------------------------------------- -TDesC16& CNSmlDMSettingsAdapter12::ConvertTo16LC( const TDesC8& aSource) - { - HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); - TPtr16 bufPtr16 = buf16->Des(); - - CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aSource ); - - return *buf16; - } - -// ------------------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetConRefL -// Gets the URI for given aObject (IAP ID). -// ------------------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::GetConRefL( CBufBase& aObject ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetConRefL() : begin" ); - TInt profIAPid = -1; - TInt apIdResponse = GetProfileIAPIdL( profIAPid ); - if( profIAPid < 0 ) - { - return KErrNone; - } - if( apIdResponse != KErrNone ) - { - return KErrNotFound; - } - CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); - CleanupStack::PushL( apmatch ); - HBufC8* uri8 = apmatch->URIFromIAPIdL( profIAPid ); - if( uri8 ) - { - CleanupStack::PushL( uri8 ); - aObject.InsertL( aObject.Size(), uri8->Des() ); - CleanupStack::PopAndDestroy(); // uri8 - } - else - { - CleanupStack::PopAndDestroy(); // apMatch - return KErrGeneral; - } - CleanupStack::PopAndDestroy(); // iapMatch - _DBG_FILE( "CNSmlDSSettingsAdapter::GetToNAPIDL() : end" ); - return KErrNone; - } - -// ------------------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetConRefL() -// Set the profile IAP Id value according to given URI. -// ------------------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetConRefL( const TInt aLUID, const TDesC8& aObject ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetConRefL() : begin" ); - CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); - CleanupStack::PushL( apmatch ); - TInt lIAPid = apmatch->IAPIdFromURIL( aObject ); - CleanupStack::PopAndDestroy(); // iapmatch - if(aObject.Length() >0 && lIAPid == KErrNotFound) - { - return KErrGeneral; - } - TInt apIdResponse = SetProfileConnectionPropertyL( aLUID, lIAPid ); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetConRefL() : end" ); - return apIdResponse; - } - -// ------------------------------------------------------------------------------------------------ -// CNSmlDMSettingsAdapter12::ParseUri -// Resolves portnbr (separated with ':') as integer from Uri. -// ------------------------------------------------------------------------------------------------ -TInt CNSmlDMSettingsAdapter12::ParseUri( const TDesC8& aRealURI, TInt& aPort ) - { - TInt offset=0; - //http: - if( aRealURI.Find( KNSmlDMSettingsHTTP )==0 )//http: - { - offset = KNSmlDMSettingsHTTP().Length(); - } - else if( aRealURI.Find( KNSmlDMSettingsHTTPS )==0 )//https: - { - offset = KNSmlDMSettingsHTTPS().Length(); - } - - TBool portFound=EFalse; - ////123.234.345.456:80/syncml - for( TInt i = offset; i < aRealURI.Length(); i++ ) - { - if( aRealURI[i] == KNSmlDMColon )// ':' - { - portFound = ETrue; - offset=i; - } - if( portFound && aRealURI[i] == KNSmlDMUriSeparator ) // '/' - { - aPort = GetIntObject( aRealURI.Mid( (offset + 1), (i - offset-1) ) ); - } - else if ( portFound && i == aRealURI.Length() - 1 ) // last char - { - // port is from offset to the end - aPort = GetIntObject( aRealURI.Right( aRealURI.Length() - offset - 1 ) ); - } - } - - if( aPort != 0 ) - { - return KErrNone; - } - else - { - return KErrNotFound; - } - } -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::OpenSyncSessionAndDSProfileL -// The function opens the server session and DM profile. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL( const TInt aIntLUID, - TSmlOpenMode aMode ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL(): begin" ); - if( iSyncSessionOpen == EFalse ) - { - iSyncSession.OpenL(); - iSyncSessionOpen = ETrue; - } - TInt trueLuid = aIntLUID + KMaxDataSyncID; - TInt rValue(KErrNone); - - if(trueLuid!=iCurrentProfile) - { - RArray profileIdArray; - CleanupClosePushL( profileIdArray ); - TSmlUsageType usageType = ESmlDevMan; - iSyncSession.ListProfilesL( profileIdArray, usageType ); - TInt index = profileIdArray.Find( trueLuid ); - CleanupStack::PopAndDestroy(); //profileIdArray - if( index == KErrNotFound ) - { - return KErrNotFound; - } - TRAP( rValue, iProfile.OpenL( iSyncSession, trueLuid, aMode ) ); - iCurrentProfile = trueLuid; - if( rValue != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - iSyncSession.Close(); - iSyncSessionOpen = EFalse; - } - } - _DBG_FILE( "CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL(): end" ); - return rValue; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::FindProfileId -// Function checks if profile can be found. -// ----------------------------------------------------------------------------- -TBool CNSmlDMSettingsAdapter12::FindProfileIdL( const TInt aIntLUID ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): begin" ); - if( iSyncSessionOpen == EFalse ) - { - iSyncSession.OpenL(); - iSyncSessionOpen = ETrue; - } - - RArray profileList; - CleanupClosePushL( profileList ); - TSmlUsageType usageType = ESmlDevMan; - iSyncSession.ListProfilesL( profileList, usageType ); - if( profileList.Count() == 0 ) - { - CleanupStack::PopAndDestroy(); //profileList - return EFalse; - } - TInt item = profileList.Find( aIntLUID + KMaxDataSyncID ); - CleanupStack::PopAndDestroy(); //profileList - if( item != KErrNotFound ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): end" ); - return ETrue; - } - _DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): end" ); - return EFalse; - } -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::IsServerIDExistL -// Function checks if serverid exist. -// ----------------------------------------------------------------------------- -TBool CNSmlDMSettingsAdapter12::IsServerIDExistL( const TDesC8& aServerid ) -{ - _DBG_FILE( "CNSmlDMSettingsAdapter12::IsServerIDExistL(): begin" ); - if( iSyncSessionOpen == EFalse ) - { - iSyncSession.OpenL(); - iSyncSessionOpen = ETrue; - } - TBool ret(EFalse); - RArray profileList; - CleanupClosePushL( profileList ); - TSmlUsageType usageType = ESmlDevMan; - iSyncSession.ListProfilesL( profileList, usageType ); - TInt count = profileList.Count(); - if( count > 0 ) - { - for(TInt i =0; i< count; i++) - { - TInt pid = i + KMaxDataSyncID; - TInt index = profileList.Find(pid ); - if( index >= i ) - { - TInt rValue(KErrNone); - RSyncMLDevManProfile profile; - TRAP( rValue, profile.OpenL( iSyncSession, pid, ESmlOpenRead ) ); - if( rValue == KErrNone ) - { - CleanupClosePushL(profile); - if(((aServerid.Compare(profile.ServerId())) == 0) && - ((profile.ServerId()).Length() == aServerid.Length())) - { - ret = ETrue; - CleanupStack::PopAndDestroy(&profile);//profile - break; - } - CleanupStack::PopAndDestroy(&profile);//profile - } - } - } - } - CleanupStack::PopAndDestroy(); //profileList - _DBG_FILE( "CNSmlDMSettingsAdapter12::IsServerIDExistL(): end" ); - return ret; - } -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::CreateNewProfileL -// The function creates new DM profile via client API. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::CreateNewProfileL( TInt& aPID ) - { - _DBG_FILE("CNSmlDMSettingsAdapter12::CreateNewProfileL(): begin"); - if( iSyncSessionOpen == EFalse ) - { - iSyncSession.OpenL(); - iSyncSessionOpen = ETrue; - } - TRAPD( value1, iProfile.CreateL( iSyncSession ) ); - if( value1 != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - iSyncSession.Close(); - iSyncSessionOpen = EFalse; - return value1; - } - - TRAPD( value2, iProfile.UpdateL() ); - if( value2 != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - iSyncSession.Close(); - iSyncSessionOpen = EFalse; - return value2; - } - - aPID = iProfile.Identifier(); - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::CreateNewProfileL(): end" ); - return KErrNone; - } -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileServerURIL() -// The function sets the server URL for a profile. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileServerURIL( const TInt aPID, - const TDesC8& aObj ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerURIL(): begin" ); - TInt retVal = KErrNone; - retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - RArray transportIdArray; - CleanupClosePushL( transportIdArray ); - iProfile.ListConnectionsL( transportIdArray ); - if( transportIdArray.Count() == 0 ) - { - CleanupStack::PopAndDestroy();//transportIdArray - iCurrentProfile = 0; - iProfile.Close(); - return KErrGeneral; - } - - TInt newPort(0); - - RSyncMLConnection conn; - CleanupClosePushL( conn ); - conn.OpenL( iProfile, transportIdArray[0] ); - - if(ParseUri(aObj,newPort)==KErrNotFound) - { - TInt port = 0; - ParseUri(conn.ServerURI(),port); - if(port==0) - { - port = 80; - } - - TBuf8<5> buf; - buf.Num( port ); - - TInt totalSize = aObj.Length() + buf.Length() + 1; - HBufC8* newServerURI = HBufC8::NewLC( totalSize ); - SetPortNrToAddrStr( aObj, newServerURI, buf ); - conn.SetServerURIL( *newServerURI ); - conn.UpdateL(); - CleanupStack::PopAndDestroy( newServerURI ); - } - else - { - conn.SetServerURIL( aObj ); - conn.UpdateL(); - } - - - iProfile.UpdateL(); - - CleanupStack::PopAndDestroy( 2 ); //transportIdArray, conn - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerURIL(): end" ); - return KErrNone; - } -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileDisplayNameL() -// The function sets the display name for a profile. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileDisplayNameL( const TInt aPID, - const TDesC8& aObj ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): begin" ); - TInt retVal = KErrNone; - retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - iProfile.SetDisplayNameL( ConvertTo16LC( aObj ) ); - iProfile.UpdateL(); - CleanupStack::PopAndDestroy(); //ConvertTo16LC - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): end" ); - return KErrNone; - } -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::IsProfileLockedL() -// The function to tell whether the profile is locked -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::IsProfileLockedL(const TInt aPID) -{ - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): begin" ); - TInt retVal = KErrNone; - retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenRead ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - - retVal=iProfile.ProfileLocked(EFalse, EFalse); - iCurrentProfile = 0; - iProfile.Close(); - if(retVal) - { - /* CRepository* centrep = NULL; - TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) ); - TInt IsPrfoileEditable = 0; - if(!err) - centrep->Get( KDevOverrideProfileLock, IsPrfoileEditable ); - delete centrep; - if (!IsPrfoileEditable) - retVal= KErrAccessDenied; - else - retVal= KErrNone;*/ - retVal= KErrAccessDenied; - } - - - - return retVal; - -} - - - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileLockL() -// The function to setor reset the profile lock. -// ----------------------------------------------------------------------------- - -TInt CNSmlDMSettingsAdapter12::SetProfileLockL( const TInt aPID, TInt aLockValue) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileLockL(): begin" ); - TInt retVal = KErrNone; - retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - - iProfile.ProfileLocked(ETrue, aLockValue ); - iProfile.UpdateL(); - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileLockL(): end" ); - return KErrNone; - } - - - - - - - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileHttpUserNameL -// The function sets the profile http/network name. -// ----------------------------------------------------------------------------- - -TInt CNSmlDMSettingsAdapter12::SetProfileHttpUserNameL( const TInt aPID, const TDesC8& aObj ) -{ - TInt retVal = KErrNone; - retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return KErrGeneral; - } - - RSyncMLConnection connection; - TBuf8 key; - RArray connIdArray; - CleanupClosePushL( connIdArray ); - iProfile.ListConnectionsL( connIdArray ); - if( connIdArray.Count() == 1 ) - { - - connection.OpenL( iProfile, KUidNSmlMediumTypeInternet.iUid ); - CleanupClosePushL( connection ); - - connection.SetPropertyL( KNSmlHTTPAuth, KNSmlTrueVal ); - connection.SetPropertyL( KNSmlHTTPUsername, aObj ); - connection.UpdateL(); - CleanupStack::PopAndDestroy( ); - } - else - { - connection.SetPropertyL( KNSmlHTTPAuth, KNSmlFalseVal ); - connection.UpdateL(); - } - - - CleanupStack::PopAndDestroy( ); - - return retVal; - -} - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileUserNameL -// The function sets the profile user name. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileUserNameL( const TInt aPID, - const TDesC8& aObj ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileUserNameL(): begin" ); - TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return KErrGeneral; - } - iProfile.SetUserNameL( aObj ); - iProfile.UpdateL(); - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileUserNameL(): end" ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL -// The function sets the protocol version to be supported. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL( const TInt aPID, - const TDesC8& ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL(): begin" ); - TInt retVal = KErrNone; - retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - //The syncSession to Sync server is open. - TSmlProtocolVersion protocol = ESmlVersion1_2; - iProfile.SetProtocolVersionL( protocol ); - TRAPD( iError, iProfile.UpdateL() ); - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL(): begin" ); - return iError; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileServerIdL -// The function sets the profile ServerId value. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileServerIdL( const TInt aPID, - const TDesC8& aObj ) - { - _DBG_FILE("CNSmlDMSettingsAdapter12::SetProfileServerIdL(): begin"); - TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return KErrGeneral; - } - iProfile.SetServerIdL( aObj ); - TRAP(retVal,iProfile.UpdateL() ); - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerIdL(): end" ); - return retVal; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileServerPasswordL -// The function sets the profile server password. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileServerPasswordL( const TInt aPID, - const TDesC8& aObj ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerPasswordL(): begin" ); - TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return KErrGeneral; - } - iProfile.SetServerPasswordL( aObj ); - iProfile.UpdateL(); - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerPasswordL(): end" ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileHttpPasswordL -// The function sets the profile network/http password. -// ----------------------------------------------------------------------------- - - - TInt CNSmlDMSettingsAdapter12::SetProfileHttpPasswordL( const TInt aPID, const TDesC8& aObj ) - { - TInt retVal = KErrNone; - retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return KErrGeneral; - } - - RSyncMLConnection connection; - TBuf8 key; - RArray connIdArray; - CleanupClosePushL( connIdArray ); - iProfile.ListConnectionsL( connIdArray ); - if( connIdArray.Count() == 1 ) - { - - connection.OpenL( iProfile, KUidNSmlMediumTypeInternet.iUid ); - CleanupClosePushL( connection ); - - connection.SetPropertyL( KNSmlHTTPAuth, KNSmlTrueVal ); - connection.SetPropertyL( KNSmlHTTPPassword, aObj ); - connection.UpdateL(); - CleanupStack::PopAndDestroy( ); - } - else - { - // connection.SetPropertyL( KNSmlHTTPAuth, KNSmlFalseVal ); - connection.UpdateL(); - } - - - CleanupStack::PopAndDestroy( ); - - return retVal; - - - - } - - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfilePasswordL -// The function sets the profile password. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfilePasswordL( const TInt aPID, - const TDesC8& aObj ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfilePasswordL(): begin" ); - TInt retVal = KErrNone; - retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - iProfile.SetPasswordL( aObj ); - iProfile.UpdateL(); - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfilePasswordL(): begin" ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileConnectionPropertyL -// This function sets the profile IAP id. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileConnectionPropertyL( const TInt aLUID, - const TInt aIAPid ) - { - TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - RArray connIdArray; - CleanupClosePushL( connIdArray ); - iProfile.ListConnectionsL( connIdArray ); - if( connIdArray.Count() == 1 ) - { - RSyncMLTransport transport; - CleanupClosePushL( transport ); - transport.OpenL( iSyncSession, connIdArray[0] ); - const CSyncMLTransportPropertiesArray& props = transport.Properties(); - TInt index = props.Find( KNSmlIAPId ); - if( index > 0 ) - { - RSyncMLConnection conn; - CleanupClosePushL( conn ); - conn.OpenL( iProfile, connIdArray[0] ); - HBufC8* apIdBuffer = HBufC8::NewLC( 4 ); - TPtr8 ptrIapIdBuf = apIdBuffer->Des(); - ptrIapIdBuf.Num( aIAPid ); - conn.SetPropertyL( KNSmlIAPId, ptrIapIdBuf ); - conn.UpdateL(); - CleanupStack::PopAndDestroy( 2 ); //conn, apIdBuffer - retVal = KErrNone; - } - else - { - retVal = KErrNotFound; - } - CleanupStack::PopAndDestroy( 1 ); //transport - } - else - { - retVal = KErrNotFound; - } - iCurrentProfile = 0; - iProfile.Close(); - CleanupStack::PopAndDestroy(); //connIdArray - return retVal; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::DeleteProfileL -// The function deleted the profile from DM database. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::DeleteProfileL( const TInt aPID ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteProfileL(): begin" ); - if( iSyncSessionOpen == EFalse ) - { - iSyncSession.OpenL(); - iSyncSessionOpen = ETrue; - } - - RArray profileIdArray; - CleanupClosePushL( profileIdArray ); - TSmlUsageType usageType = ESmlDevMan; - iSyncSession.ListProfilesL( profileIdArray, usageType ); - TInt index = profileIdArray.Find( aPID ); - if ( index == KErrNotFound ) - { - //No match - CleanupStack::PopAndDestroy();//profileIdArray - return KErrNotFound; - } - iSyncSession.DeleteProfileL( aPID ); - iSyncSession.Close(); - iSyncSessionOpen = EFalse; - CleanupStack::PopAndDestroy();//profileIdArray - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteProfileL(): end" ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetObjectL -// The function checks which leaf data to be fetched. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, - CBufBase& aObject ) - { - TInt retVal = KErrNone; - if( iField->Compare(KNSmlDdfAppId ) ==0 ) - { - aObject.InsertL(aObject.Size(),KNSmlDdfAppIdValue); - return retVal; - - } - - retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenRead ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - switch ( aDMField ) - { - case ( EProfileName ) : - { - GetProfileNameL( aObject ); - } - break; - - case ( EProfileDMServerUsername ) : - { - GetProfileUserNameL( aObject ); - } - break; - - case ( EProfileURL ) : - { - GetProfileServerURLL( aObject ); - TInt port(0); - if(ParseUri(aObject.Ptr(0),port)==KErrNone) - { - HBufC8* addr = aObject.Ptr(0).AllocLC(); - aObject.Reset(); - TInt portStart = addr->LocateReverse(KNSmlDMColon); - aObject.InsertL(aObject.Size(),addr->Left(portStart)); - - TInt portLen=addr->Mid(portStart).Locate(KNSmlDMUriSeparator); - if(portLen!=KErrNotFound) - { - aObject.InsertL(aObject.Size(),addr->Mid(portStart+portLen)); - } - - CleanupStack::PopAndDestroy(); //addr - } - } - break; - - case ( EServerId ) : - { - GetServerIdL( aObject ); - } - break; - - case ( EProfileIAPId ) : - { - retVal = GetConRefL( aObject ); - } - break; - - case ( EProfilePort ) : - { - GetProfileServerURLL( aObject ); - if ( aObject.Size() == 0 ) - { - retVal = KErrNone; - break; - } - GetProfilePortNumberL ( aObject ); - } - break; - - case ( EProfileDMServerPassword ) : - { - retVal = EInvalidObject; - } - break; - - case ( ESharedSecret ) : - {//ServerPW - retVal = EInvalidObject; - } - break; - case ( EProfileId ) : - break; - case ( EProfileAddrType ) : - { - aObject.InsertL(aObject.Size(),KNSmlAddrtype); - } - break; - case (EProfileHttpUsername ): - { - retVal = GetHttpUsernameL(aObject); - } - break; - case (EPRofileServerCred) : - { - aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelSrv); - - } - break; - case (EPRofileClientCred) : - { - aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelCli); - } - break; - - case (ETransportAuthName) : - { - TInt mediumType= ENone; - GetProfileConnectiontypeL( mediumType ); - if( mediumType == EHttp) - { - retVal = GetHttpUsernameL(aObject); - } - else if(mediumType == EObex) - { - aObject.InsertL(aObject.Size(),KNSmlDMNullDesc8); - } - - } - break; - - - case (EProfileTransport) : - { - TInt mediumType= ENone; - GetProfileConnectiontypeL( mediumType ); - if( mediumType == EHttp) - { - aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelHttp); - } - else if(mediumType == EObex) - { - aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelObx); - } - - } - - break; - case ( EAuthenticationRequired ) : - case ( EProfileAAuthType ): - case ( EServerNonce ) : - case ( EClientNonce ) : - { - retVal = GetDMAuthInfoL( aLUID, aDMField, aObject ); - } - break; - - case EProfileLock : - { - - TBool isProfileLocked = iProfile.ProfileLocked(EFalse, EFalse); - if(isProfileLocked) - { - aObject.InsertL(aObject.Size(),KDmProfileLocked); - } - else - { - aObject.InsertL(aObject.Size(),KDmProfileUnLocked); - } - - } - break; - default: - { - User::Panic( KNSmlIndexOutOfBoundStr, KNSmlPanicIndexOutOfBound ); - } - } - iCurrentProfile = 0; - iProfile.Close(); - return retVal; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL() -// The function sets the profile port number. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL( const TInt aLUID, - const TDesC8& aPort ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): begin" ); - TInt retVal = KErrNone; - - if( iPortNbr ) - { - delete iPortNbr; - iPortNbr = NULL; - } - iPortNbr = HBufC8::NewL( aPort.Length() ); - TPtr8 newPortNbr = iPortNbr->Des(); - newPortNbr.Append( aPort ); - - retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" ); - return retVal; - } - - RArray transportIdArray; - CleanupClosePushL( transportIdArray ); - iProfile.ListConnectionsL( transportIdArray ); - - RSyncMLConnection conn; - CleanupClosePushL( conn ); - conn.OpenL( iProfile, transportIdArray[0] ); - - HBufC8* serverURI = conn.ServerURI().AllocLC(); - if( serverURI->Length() == 0 ) - { - iCurrentProfile = 0; - iProfile.Close(); - CleanupStack::PopAndDestroy( 3 ); //transportIdArray, conn, serverURI - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" ); - return retVal; - } - TInt totalSize = serverURI->Size() + newPortNbr.Size() + 1; - HBufC8* newServerURI = HBufC8::NewL( totalSize ); - CleanupStack::PushL( newServerURI ); - SetPortNrToAddrStr( *serverURI, newServerURI, newPortNbr ); - - conn.SetServerURIL( *newServerURI ); - conn.UpdateL(); - - CleanupStack::PopAndDestroy( 4 ); //transportIdArray, conn, serverURI, newServerURI - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" ); - return retVal; - } - -// ------------------------------------------------------------------------------------------------ -// CNSmlDMSettingsAdapter12::SetPortNrToAddrStr -// Sets a portnbr (separated with ':') to profile server URI. -// ------------------------------------------------------------------------------------------------ -void CNSmlDMSettingsAdapter12::SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, - const TDesC8& aPort ) - { - TInt offset=0; - if( aSrvURI.Find( KNSmlDMSettingsHTTP ) == 0 )//http:// - { - offset = KNSmlDMSettingsHTTP().Length(); - } - else if( aSrvURI.Find( KNSmlDMSettingsHTTPS ) == 0 )//https:// - { - offset = KNSmlDMSettingsHTTPS().Length(); - } - TInt portStart = -1; - TInt separatorPos = aSrvURI.Length(); - TInt i = 0; - for( i = offset; i < aSrvURI.Length(); i++ ) - { - if( aSrvURI[i] == KNSmlDMColon )// ':' - { - portStart = i; - } - if( aSrvURI[i] == KNSmlDMUriSeparator )// '/' - { - separatorPos = i; - break; - } - } - - TPtr8 ptrNewSrvURI = aNewURI->Des(); - if( portStart < 0 && separatorPos > 0 && iLeafType != EDMDelete ) - { - ptrNewSrvURI.Append( aSrvURI.Left( separatorPos ) );//http://123.234.345.456 - ptrNewSrvURI.Append( KNSmlDMColon ); - ptrNewSrvURI.Append( aPort ); - ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); - } - else if ( portStart > 0 && separatorPos > 0 && iLeafType != EDMDelete ) - { - ptrNewSrvURI.Append( aSrvURI.Left( portStart + 1 ) );//123.234.345.456: - ptrNewSrvURI.Append( aPort );//123.234.345.456:xx(x) - ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); - } - else if ( portStart > 0 && iLeafType == EDMDelete ) //delete port number from uri - { - ptrNewSrvURI.Append( aSrvURI.Left( portStart ) );//123.234.345.456 - ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); - } - else - { - ptrNewSrvURI.Append( aSrvURI ); - } - return; - } - -// ------------------------------------------------------------------------------------------------ -// CNSmlDMSettingsAdapter12::SetDMFieldDataL -// Selects and Sets value to a field based on field id got from URI. -// ------------------------------------------------------------------------------------------------ -TInt CNSmlDMSettingsAdapter12::SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, - const TNSmlDMProfileData aField ) - { - TInt rValue = KErrGeneral; - TInt lockvalue =0; - if(aField != EProfileLock) - { - rValue=IsProfileLockedL(aLUID); - if (rValue!= KErrNone) - { - return rValue; - } - - } - else if (aField == EProfileLock) - { - if (! iNewProfile) - { - lockvalue =0; - if(aObject.Length()> 1) - { - rValue = KErrArgument; - return rValue; - } - lockvalue = GetIntObject(aObject); - if(lockvalue != 0 && lockvalue != 1) - { - //lockvalue = 0; - rValue = KErrArgument; - return rValue; - } - rValue = SetProfileLockL(aLUID , lockvalue); - return rValue; - } - - } - - switch ( aField ) - { - case ( EProfileURL ) : - { - rValue = SetProfileServerURIL( aLUID, aObject ); - } - break; - case ( EServerId ) : - { - rValue = SetProfileServerIdL( aLUID, aObject ); - } - break; - case ( ESharedSecret ) : - { - rValue = SetProfileServerPasswordL( aLUID, aObject ); - } - break; - case ( EProfileDMServerUsername ) : - { - rValue = SetProfileUserNameL( aLUID, aObject ); - } - break; - case ( EProfileDMServerPassword ) : - { - rValue = SetProfilePasswordL( aLUID, aObject ); - } - break; - case ( EProfileName ) : - { - rValue = SetProfileDisplayNameL( aLUID, aObject ); - } - break; - case ( EProfileIAPId ) : - { - rValue = SetConRefL( aLUID, aObject ); - } - break; - case ( ETransportAuthName ): - { - OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); - TInt mediumType = ENone; - GetProfileConnectiontypeL( mediumType ); - if( mediumType == EHttp) - { - rValue = SetProfileHttpUserNameL ( aLUID, aObject ); - } - else if(mediumType == EObex) - { - rValue = KErrNone; - - } - - - //break; - } - break; - case ( EProfileTransportPassword ): - { - TInt mediumType = ENone; - OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); - GetProfileConnectiontypeL( mediumType ); - if( mediumType == EHttp) - { - rValue = SetProfileHttpPasswordL ( aLUID, aObject ); - } - else if(mediumType == EObex) - { - rValue = KErrNone; - - } - } - break; - case (EProfileTransportAuthData) : - { - rValue = KErrNone; - } - break; - - case ( EProfileHttpUsername ) : - { - rValue = SetProfileHttpUserNameL ( aLUID, aObject ); - } - break; - case ( EProfileHttpPassword ) : - { - rValue = SetProfileHttpPasswordL ( aLUID, aObject ); - } - break; - case ( EProfileId ) : - { - } - break; - case ( EProfilePort ) : - { - if(aObject.Size()<=5) - { - TInt port = GetIntObject(aObject); - if( port > KPortMinSize && port < KPortMaxSize ) - { - TPortBuffer element; - element.iPortBuf=aObject; - element.iPortBufLUID = aLUID; - iPortBuffer.Append(element); - rValue=KErrNone; - } - else - { - if (port <= KPortMinSize ) - rValue = KErrUnderflow; - else - rValue=KErrOverflow; - } - } - else - { - rValue=KErrOverflow; - } - // save information of the port - } - break; - - case ( EProfileAddrType ) : - { - if (aObject.Match(KNSmlAddrtype)!=KErrNotFound) - rValue=KErrNone; - - } - break; - - - case ( EProfileMediumType ) : - { - if ( iLeafType == EDMDelete ) - { - return KErrNone; - } - iObject = GetIntObject( aObject ); - if(iObject<0) - { - iObject = EHttp; - } - rValue = SetProfileAddrTypeL( aLUID, iObject ); - } - break; - case ( EProfileTransport) : - { - if (aObject.Match(KDmAccAppAuthLevelHttp)!=KErrNotFound) - { - iObject = EHttp; - } - else if (aObject.Match(KDmAccAppAuthLevelObx)!=KErrNotFound) - { - iObject = EObex; - } - rValue = SetProfileAddrTypeL( aLUID, iObject ); - } - break; - case ( EAuthenticationRequired ) : - case ( EClientNonce ) : - case ( EServerNonce ) : - break; - case ( EProfileLock ) : - lockvalue =0; - lockvalue = GetIntObject(aObject); - if(lockvalue != 0 && lockvalue != 1) - lockvalue = 0; - - TLockBuffer element; - element.iProfileLock=lockvalue; - element.iProfileLockLUID = aLUID; - iProfileLockBuffer.Append(element); - rValue=KErrNone; - - - // rValue = SetProfileLock(aLUID , lockvalue); - break; - default: - rValue = KErrNotSupported; - } - return rValue; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::FillNodeInfoL -// The function fills the node or leaf information. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::FillNodeInfoL( MSmlDmDDFObject& aNode, - TSmlDmAccessTypes aAccTypes, - MSmlDmDDFObject::TOccurence aOccurrence, - MSmlDmDDFObject::TScope aScope, - MSmlDmDDFObject::TDFFormat aFormat, - const TDesC8& aDescription, - const TDesC8& aDefaultValue, - const TDesC8& aMimeType ) - { - aNode.AddDFTypeMimeTypeL( aMimeType ); - aNode.SetAccessTypesL( aAccTypes ); - aNode.SetDescriptionL( aDescription ); - aNode.SetOccurenceL( aOccurrence ); - aNode.SetDefaultValueL( aDefaultValue ); - aNode.SetScopeL( aScope ); - aNode.SetDFFormatL( aFormat ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetDMAuthInfoL -// This function gets authentication data from private API. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::GetDMAuthInfoL( const TInt aLUID, - const TNSmlDMProfileData aField, - CBufBase& aObject ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMAuthInfoL(): begin" ); - - CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo; - CleanupStack::PushL( authInfo ); - - authInfo->iProfileId = aLUID + KMaxDataSyncID; - iPrivateApi.OpenL(); - TInt ret = KErrNone; - - TRAPD(err,iPrivateApi.GetDMAuthInfoL( *authInfo )); - - if(err==KErrNone) - { - if ( aField == EServerNonce ) - { - aObject.InsertL( aObject.Size(), *authInfo->iServerNonce ); - } - else if ( aField == EClientNonce ) - { - aObject.InsertL( aObject.Size(), *authInfo->iClientNonce ); - } - else if (( aField == EAuthenticationRequired ) || (aField == EProfileAAuthType)) - { - TUint authPref = authInfo->iAuthPref; - /*if( authPref == ENoAuth ) - { - aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefNoAuth ); - }*/ - if( authPref == EBasic ) - { - if(aField == EAuthenticationRequired) - { - aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefBasic ); - } - else - { - aObject.InsertL( aObject.Size(), KNSmlDMAuthTypeBasic ); - } - - } - else if( authPref == EMD5 ) - { - if(aField == EAuthenticationRequired) - { - aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefMD5 ); - } - else - { - aObject.InsertL( aObject.Size(), KNSmlDMAuthTypeMD5 ); - } - - } - else - { - aObject.InsertL( aObject.Size(), KNullDesC8 ); - } - } - } - iPrivateApi.Close(); - CleanupStack::PopAndDestroy(authInfo); - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMAuthInfoL(): end" ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL -// This function resets the authentication data. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL( const TInt aLUID, - const TNSmlDMProfileData aField ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL(): begin" ); - CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo;; - CleanupStack::PushL( authInfo ); - authInfo->iProfileId = aLUID; - iPrivateApi.OpenL(); - iPrivateApi.GetDMAuthInfoL( *authInfo ); - if( aField == EServerNonce ) - { - authInfo->iServerNonce->Des().Delete( 0, authInfo->iServerNonce->Des().Size() ); - authInfo->iServerNonce->Des().Insert( 0, KNullDesC8 ); - } - else if( aField == EClientNonce ) - { - authInfo->iClientNonce->Des().Delete( 0, authInfo->iClientNonce->Des().Size() ); - authInfo->iClientNonce->Des().Insert( 0, KNullDesC8 ); - } - else if( aField == EAuthenticationRequired ) - { - authInfo->iAuthPref = 0; - } - iPrivateApi.SetDMAuthInfoL( *authInfo ); - iPrivateApi.Close(); - CleanupStack::PopAndDestroy(authInfo); - _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL(): end" ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetProfileAddrTypeL -// This function sets the AddrType value. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::SetProfileAddrTypeL( const TInt aLUID, - const TInt aIntObj ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): begin" ); - TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); - if( retVal != KErrNone ) - { - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): end" ); - return retVal; - } - TInt mediumType = ENone; - GetMediumTypeL( aIntObj, mediumType ); - if( mediumType == ENone ) - { - iCurrentProfile = 0; - iProfile.Close(); - return KErrGeneral; - } - RArray transportIdArray; - CleanupClosePushL( transportIdArray ); - iProfile.ListConnectionsL( transportIdArray ); - RSyncMLConnection conn; - CleanupClosePushL( conn ); - conn.OpenL( iProfile, transportIdArray[0] ); - HBufC8* sURI = conn.ServerURI().AllocLC(); - if(mediumType!=transportIdArray[0]) - { - if ( !FeatureManager::FeatureSupported( KFeatureIdSyncMlDmObex ) ) - { - CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI - return EInvalidObject; - } - else - { - conn.CreateL(iProfile,mediumType); - } - } - conn.SetServerURIL( *sURI ); - conn.UpdateL(); - CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI - iCurrentProfile = 0; - iProfile.Close(); - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): end" ); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetHttpUsernameL -// This function gets the httpuser value. -// ----------------------------------------------------------------------------- - - -TInt CNSmlDMSettingsAdapter12::GetHttpUsernameL( CBufBase& aObject ) - { - - TInt retVal = KErrNone; - TBuf8 key; - TInt intValue; - - RArray connIdArray; - CleanupClosePushL( connIdArray ); - iProfile.ListConnectionsL( connIdArray ); - if( connIdArray.Count() == 1 ) - { - RSyncMLTransport transport; - CleanupClosePushL( transport ); - transport.OpenL( iSyncSession, connIdArray[0] ); - const CSyncMLTransportPropertiesArray& arr = transport.Properties(); - const TSyncMLTransportPropertyInfo& info = arr.At( EPropertyHttpUsed ); - key = info.iName; - RSyncMLConnection conn; - CleanupClosePushL( conn ); - conn.OpenL( iProfile, connIdArray[0] ); - HBufC8* value = conn.GetPropertyL( key ).AllocLC(); - intValue = GetIntObject( *value ); - CleanupStack::PopAndDestroy( ); //value - if ( intValue == 1 ) - { - retVal = KErrNone; - const TSyncMLTransportPropertyInfo& info2 = arr.At( EPropertyHttpUserName ); - key= info2.iName; - HBufC8* value = conn.GetPropertyL( key ).AllocLC(); - aObject.InsertL(aObject.Size(),value->Des()); - CleanupStack::PopAndDestroy( ); //value - } - else - { - retVal = KErrNotFound; - } - CleanupStack::PopAndDestroy( 2 ); // conn, transport - } - CleanupStack::PopAndDestroy( ); //connIdArray - - return retVal; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL -// The function gets the profile medium type. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL( TInt& aMediumTYpe ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL(): begin" ); - RArray transportIdArray; - CleanupClosePushL( transportIdArray ); - iProfile.ListConnectionsL( transportIdArray ); - TInt transportItems = transportIdArray.Count(); - if( transportItems == 0 ) - { - //No matching items - CleanupStack::PopAndDestroy(); //transportIdArray - return KErrGeneral; - } - else if( transportItems > 1 ) - { - //Error case : against specification - CleanupStack::PopAndDestroy(); //transportIdArray - return KErrGeneral; - } - aMediumTYpe = 0; - if ( transportIdArray[0] == KUidNSmlMediumTypeInternet.iUid ) - { - aMediumTYpe = 1; //EHttp; - } - else if ( transportIdArray[0] == KUidNSmlMediumTypeBluetooth.iUid || - transportIdArray[0] == KUidNSmlMediumTypeUSB.iUid || - transportIdArray[0] == KUidNSmlMediumTypeIrDA.iUid ) - { - aMediumTYpe = 3; //EObex; - } - CleanupStack::PopAndDestroy( 1 ); //transportIdArray, SetIntObjectLC - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetProfileIAPIdL -// The function gets the profile IAP Id. -// ----------------------------------------------------------------------------- -TInt CNSmlDMSettingsAdapter12::GetProfileIAPIdL( TInt& aIAPid ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileIAPIdL(): begin" ); - TInt retVal = KErrGeneral; - aIAPid = -1; - RArray connIdArray; - CleanupClosePushL( connIdArray ); - iProfile.ListConnectionsL( connIdArray ); - if( connIdArray.Count() == 1 ) - { - RSyncMLTransport transport; - CleanupClosePushL( transport ); - transport.OpenL( iSyncSession, connIdArray[0] ); - const CSyncMLTransportPropertiesArray& props = transport.Properties(); - TInt index = props.Find( KNSmlIAPId ); - if( index > 0 ) - { - RSyncMLConnection conn; - CleanupClosePushL( conn ); - conn.OpenL( iProfile, connIdArray[0] ); - HBufC8* apId = conn.GetPropertyL( KNSmlIAPId ).AllocLC(); - aIAPid = GetIntObject( *apId ); - CleanupStack::PopAndDestroy( 2 ); //conn, apId - retVal = KErrNone; - } - else - { - retVal = KErrNotFound; - } - CleanupStack::PopAndDestroy( 1 ); //transport - iCurrentProfile = 0; - iProfile.Close(); - } - else - { - retVal = KErrNotFound; - } - CleanupStack::PopAndDestroy(); //connIdArray - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileIAPIdL(): end" ); - return retVal; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetProfileServerURLL -// The function gets the profile Server URI. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::GetProfileServerURLL( CBufBase& aURL ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileServerURLL(): begin" ); - RArray transportIdArray; - CleanupClosePushL( transportIdArray ); - iProfile.ListConnectionsL( transportIdArray ); - if( transportIdArray.Count() > 0 ) - { - RSyncMLConnection profConn; - CleanupClosePushL( profConn ); - profConn.OpenL( iProfile, transportIdArray[0] ); - HBufC8* sURI = profConn.ServerURI().AllocL(); - CleanupStack::PushL( sURI ); - TPtr8 uriPtr = sURI->Des(); - if( uriPtr.Length() > 0 ) - { - aURL.InsertL( aURL.Size(),uriPtr ); - } - else - { - aURL.InsertL( aURL.Size(), KNullDesC8 ); - } - CleanupStack::PopAndDestroy( 2 );//profConn, sURI - } - CleanupStack::PopAndDestroy(); //transportIdArray - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileServerURLL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetMediumTypeL -// Checks the requested medium type. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::GetMediumTypeL( const TInt aIntObj, - TInt& aMediumType ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetMediumTypeL(): begin" ); - if( aIntObj == EHttp || aIntObj == EWsp ) - { - aMediumType = KUidNSmlMediumTypeInternet.iUid; - return; - } - RArray transportIdArray; - CleanupClosePushL( transportIdArray ); - iSyncSession.ListTransportsL( transportIdArray ); - - if ( transportIdArray.Find( KUidNSmlMediumTypeBluetooth.iUid ) != KErrNotFound ) - { - aMediumType = KUidNSmlMediumTypeBluetooth.iUid; - } - else if ( transportIdArray.Find( KUidNSmlMediumTypeUSB.iUid ) != KErrNotFound ) - { - aMediumType = KUidNSmlMediumTypeUSB.iUid; - } - else if ( transportIdArray.Find( KUidNSmlMediumTypeIrDA.iUid ) != KErrNotFound ) - { - aMediumType = KUidNSmlMediumTypeIrDA.iUid; - } - CleanupStack::PopAndDestroy(); //transportIdArray - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetMediumTypeL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetServerIdL -// Gets the server id value. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::GetServerIdL( CBufBase& aObject ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetServerIdL(): begin" ); - HBufC8* serverId = iProfile.ServerId().AllocL(); - CleanupStack::PushL( serverId ); - aObject.InsertL( aObject.Size(), *serverId ); - CleanupStack::PopAndDestroy( 1 ); //serverId - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetServerIdL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetProfileNameL -// Gets the display name value. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::GetProfileNameL( CBufBase& aObject ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileNameL(): begin" ); - HBufC16* dataBuf = iProfile.DisplayName().AllocL(); - CleanupStack::PushL( dataBuf ); - TPtr16 ptrDisplayName = dataBuf->Des(); - HBufC8* dataBuf8 = HBufC8::NewL( ptrDisplayName.Length() * 2 ); - CleanupStack::PushL( dataBuf8 ); - - TPtr8 ptrDisplayName8 = dataBuf8->Des(); - ptrDisplayName8 = ConvertTo8LC( ptrDisplayName ); - aObject.InsertL( aObject.Size(), ptrDisplayName8 ); - CleanupStack::PopAndDestroy( 3 );//dataBuf, ConvertTo8LC - _DBG_FILE("CNSmlDMSettingsAdapter12::GetProfileNameL(): end"); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetProfileUserNameL -// Gets the profile user name value. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::GetProfileUserNameL( CBufBase& aObject ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileUserNameL(): begin" ); - HBufC8* dataBuf = iProfile.UserName().AllocL(); - CleanupStack::PushL( dataBuf ); - TPtr8 ptrUserName = dataBuf->Des(); - aObject.InsertL( aObject.Size(), ptrUserName ); - CleanupStack::PopAndDestroy();//dataBuf - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileUserNameL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::GetProfilePortNumberL -// Gets the port number value. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::GetProfilePortNumberL( CBufBase& aObject ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfilePortNumberL(): begin" ); - TInt bSize = aObject.Size(); - TInt portNum = 0; - HBufC8* bufStorage = HBufC8::NewLC( bSize ); - TPtr8 bufStoragePtr = bufStorage->Des(); - aObject.Read( 0, bufStoragePtr, aObject.Size() ); - aObject.Reset(); - - //find out the port number - ParseUri( *bufStorage, portNum ); - aObject.InsertL( aObject.Size(), SetIntObjectLC( portNum ) ); - - CleanupStack::PopAndDestroy( 2 ); //bufStorage, SetIntObjectLC() - _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfilePortNumberL(): end" ); - return; - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSettingsAdapter12::SetAuthInfoL -// The function checks if authinfo already exits. If exits command is replace. -// ----------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::SetAuthInfoL( const TInt aLUID, - const TNSmlDMProfileData aField, - const TDesC8& aObject, TInt& aStatus ) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetAuthInfoL(): begin" ); - - CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo(); - CleanupStack::PushL( authInfo ); - authInfo->iProfileId = aLUID; - - iPrivateApi.OpenL(); - TRAPD( err, iPrivateApi.GetDMAuthInfoL( *authInfo ) ); - - if ( err ) - { - CleanupStack::PopAndDestroy( authInfo ); - iPrivateApi.Close(); - aStatus = err; - return; - } - - CNSmlDMAuthInfo* newAuthInfo = new (ELeave) CNSmlDMAuthInfo(); - CleanupStack::PushL( newAuthInfo ); - newAuthInfo->iProfileId = aLUID; - - if ( aField == EServerNonce ) - { - newAuthInfo->iServerNonce = aObject.Alloc(); - newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc(); - newAuthInfo->iAuthPref = authInfo->iAuthPref; - - iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); - } - else if ( aField == EClientNonce ) - { - newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc(); - newAuthInfo->iClientNonce = aObject.Alloc(); - newAuthInfo->iAuthPref = authInfo->iAuthPref; - - iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); - } - else if ( aField == EAuthenticationRequired ) - { - if ( aObject.Match( KNSmlDMAuthPrefNoAuth ) != KErrNotFound ) - { - newAuthInfo->iAuthPref = ENoAuth; - } - else if ( aObject.Match( KNSmlDMAuthPrefBasic ) != KErrNotFound ) - { - newAuthInfo->iAuthPref = EBasic; - } - else if ( aObject.Match( KNSmlDMAuthPrefMD5 ) != KErrNotFound ) - { - newAuthInfo->iAuthPref = EMD5; - } - newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc(); - newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc(); - - iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); - } - - CleanupStack::PopAndDestroy( newAuthInfo ); - CleanupStack::PopAndDestroy( authInfo ); - - iPrivateApi.Close(); - aStatus = KErrNone; - _DBG_FILE( "CNSmlDMSettingsAdapter12::SetAuthInfoL(): end" ); - return; - } - -//------------------------------------------------------------------------------ -// CNSmlDMSettingsAdapter12::AddNodeBufferL() -// Buffers Node Object -//------------------------------------------------------------------------------ -void CNSmlDMSettingsAdapter12::AddNodeBufferL( const TDesC8& aURI, - const TInt aStatusRef) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): begin" ); - TInt index = -1; - - for (TInt i = 0; iCount (); i++) - { - if ( iBuffer->At(i).iMappingName->Compare (aURI)== 0) - { - index = i; - //CallBack for duplicate - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): EAlreadyExists end" ); - iCallBack->SetStatusL ( aStatusRef, CSmlDmAdapter::EAlreadyExists); - break; - } - } - - if ( index<0) - { - TNSmlDMBufferElement newNode; - newNode.iMappingName = aURI.AllocLC (); - newNode.iLeafBuf = new (ELeave) CArrayFixFlat (4); - newNode.iExecuted = EFalse; - newNode.iDMBuffStatusref = aStatusRef; - newNode.iAddr = EFalse; - newNode.iServerId = EFalse; - newNode.iUName = EFalse; - newNode.iServerName = EFalse; - - iBuffer->AppendL (newNode); - //newNode.iMappingName - CleanupStack::Pop (); - } - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): end" ); - } - -//------------------------------------------------------------------------------ -// CNSmlDMSettingsAdapter12::AddLeafBufferL() -// Buffers Leaf Obj & checks for Mandatory fields -//------------------------------------------------------------------------------ -void CNSmlDMSettingsAdapter12::AddLeafBufferL( const TDesC8& aURI, - const TDesC8& aObject, const TInt aStatusRef) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafBufferL(): begin" ); - TNSmlDMLeafElement newCommand; - - newCommand.iUri = aURI.AllocLC (); - newCommand.iData = aObject.AllocLC (); - newCommand.iLuid = HBufC8::NewLC (8); //Allocate Mem. for iLUID - newCommand.iStatusRef = aStatusRef; - //Add Leaf to the index updated by UpdateLeafObj - iBuffer->At(iExecutionIndex).iLeafBuf->AppendL (newCommand); - // iUri, iData, ILuid - CleanupStack::Pop (3); - SetField ( aURI); - SetURIInProcessL ( aURI); - if ( iField->Compare (KNSmlDdfAddr)== 0) - { - iBuffer->At(iExecutionIndex).iAddr = ETrue; - } - else - if ( iField->Compare (KNSmlDdfServerId)== 0) - { - if(!IsServerIDExistL(aObject)) - iBuffer->At(iExecutionIndex).iServerId = ETrue; - } - else - if ( iField->Compare (KNSmlDdfAAuthName)== 0) - { - //AAuthName under AppAuthCli - if ( iURIField->Find (KDmAccAppAuthDyn2)!= KErrNotFound) - iBuffer->At(iExecutionIndex).iUName = ETrue; - } - else - if ( iField->Compare (KNSmlDdfName)== 0) - { - iBuffer->At(iExecutionIndex).iServerName = ETrue; - } - - // If Address,ServerId,ServerName,UserName then Add - - if ( iBuffer->At(iExecutionIndex).iAddr && iBuffer->At(iExecutionIndex).iServerId &&iBuffer->At(iExecutionIndex).iUName && iBuffer->At(iExecutionIndex).iServerName) - { - ExecuteBufferL (); - iExecutionIndex = -1; - } - _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafBufferL(): end" ); - return; - } - -//------------------------------------------------------------------------------ -// CNSmlDMSettingsAdapter12::ExecuteBufferL() -// Adds the Node/Leaf obj to the db -//------------------------------------------------------------------------------ -void CNSmlDMSettingsAdapter12::ExecuteBufferL() - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::ExecuteBufferL(): begin" ); - TBuf8<8> newLUID; - TInt rValue; - //Buffer is being Executed - iBufOn = ETrue; - - // Robustness check for Execution Index - if ( iExecutionIndex<0) - { - return; - } - - //Execute BufferL is called from CompleteOutstandingCmdsL only when - - //mandatory fields are not set. Dont update Node/Leaf to the db, return a failure - - if ( !iComplete) - rValue = CreateNewProfileL (iLUID); - else - rValue = CSmlDmAdapter::EError; - - iBuffer->At(iExecutionIndex).iExecuted = ETrue; - - if ( rValue != KErrNone) - { - if ( rValue == KErrNoMemory) - { - iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::ENoMemory); - } - else - if ( rValue == KErrNotSupported) - { - iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, - CSmlDmAdapter::EInvalidObject); - } - else - if ( rValue == KErrInUse) - { - iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, - CSmlDmAdapter::EObjectInUse); - } - else - if ( rValue == KErrDiskFull) - { - iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, - CSmlDmAdapter::EDiskFull); - } - else - { - iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, - CSmlDmAdapter::EError); - } - // dont return, UpdateLeafObjectL will update the callback status for leaf Nodes - } - else - { - if ( iLUID >= KMaxDataSyncID) - { - newLUID.Num ( iLUID - KMaxDataSyncID); - } - else - { - newLUID.Num ( iLUID); - } - - iCallBack->SetMappingL ( *iBuffer->At(iExecutionIndex).iMappingName, newLUID); - - iCallBack->SetStatusL (iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::EOk); - } - - for (TInt val= 0; val < iBuffer->At(iExecutionIndex).iLeafBuf->Count ();val++) - { - //Update the LUID data in the Leaf structure with the Profile LUID before calling UpdateLeafObj - TPtr8 tempLUID(iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid->Des ()); - tempLUID.Append (newLUID); - UpdateLeafObjectL (*iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iUri, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iData, *iBuffer->At(iExecutionIndex).iMappingName, iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iStatusRef); - - } - - // Delete the dynamically allocated buffers (Node/Leaf obj) - - ClearBuffer ( iBuffer->At(iExecutionIndex).iLeafBuf); - - delete iBuffer->At(iExecutionIndex).iLeafBuf; - - if ( iBuffer->At(iExecutionIndex).iMappingName) - { - delete iBuffer->At(iExecutionIndex).iMappingName; - iBuffer->At(iExecutionIndex).iMappingName = NULL; - } - - iBuffer->Delete (iExecutionIndex); - iBuffer->Compress (); - //Buffer Execution Complete - iBufOn = EFalse; - _DBG_FILE( "CNSmlDMSettingsAdapter12::ExecuteBufferL(): end" ); - } - -//------------------------------------------------------------------------------ -// TPtrC8 CNSmlDMSettingsAdapter12::ParentURI(const TDesC8& aURI) -// returns parent uri -// Searches till the 2nd "/" is reached -//------------------------------------------------------------------------------ -TPtrC8 CNSmlDMSettingsAdapter12::ParentURI(const TDesC8& aURI) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::ParentURI(): begin" ); - TInt count; - TInt flag = 0; - for (count=0; count<=aURI.Length ()-1;count++) - { - - if ( aURI[count]=='/') - { - flag++; - if ( flag == KDynNodePosn) // KDynNodePosn =2 --> DMAcc/DMIDxxx - break; - } - } - _DBG_FILE( "CNSmlDMSettingsAdapter12::ParentURI(): end" ); - return aURI.Left (count); - } - -//----------------------------------------------------------------------------------------- -// Clears the elements of the passed in LeafElement Structure -//----------------------------------------------------------------------------------------- -void CNSmlDMSettingsAdapter12::ClearBuffer( - CArrayFixFlat* aBuffer) - { - _DBG_FILE( "CNSmlDMSettingsAdapter12::ClearBuffer(): begin" ); - for (TInt i = 0; i < aBuffer->Count (); i++) - { - delete aBuffer->At(i).iUri; - aBuffer->At(i).iUri = NULL; - - delete aBuffer->At(i).iData; - aBuffer->At(i).iData = NULL; - - delete aBuffer->At(i).iLuid; - aBuffer->At(i).iLuid = NULL; - } - - aBuffer->Reset (); - _DBG_FILE( "CNSmlDMSettingsAdapter12::ClearBuffer(): end" ); - } - -//-------------------------------------------------------------------- -//TInt CNSmlDMSettingsAdapter::IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI) -// -//------------------------------------------------------------------- - - -TBool CNSmlDMSettingsAdapter12::IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI) -{ - - // include strings for tree for Bearer , DNS related Dynamic nodes . - - if(aURI.Match(_L8("DMAcc/DMId*")) != KErrNotFound ) - { - return ETrue; - } - else - { - return EFalse; - } - - -} - -//-------------------------------------------------------------------- -//TInt CNSmlDMSettingsAdapter::ConstructTreeL(const TDesC8& aURI) -// -//------------------------------------------------------------------- - -TInt CNSmlDMSettingsAdapter12::ConstructTreeL(const TDesC8& aURI) -{ - TInt profileID = KErrNotFound; - _LIT8( KNSmlDMIdZero, "DMAcc/DMId000" ); - TBuf8<20> zeroURI; // DMAcc/DMIdnnn , nnn = profileid - zeroURI.Append( KNSmlDMIdZero ); - HBufC8* ismapInfo = iCallBack->GetLuidAllocL(zeroURI); - if (ismapInfo->Length() != 0) // Tree is already constructrd, no need to proceed. - { - delete ismapInfo; - return profileID; - } - if( iSyncSessionOpen == EFalse ) - { - iSyncSession.OpenL(); - iSyncSessionOpen = ETrue; - } - RArray profileIdArray; - CleanupClosePushL( profileIdArray ); - TSmlUsageType usageType = ESmlDevMan; - iSyncSession.ListProfilesL( profileIdArray, usageType ); - - for( TInt p = 0; p < profileIdArray.Count(); p++ ) - { - TInt ddId = profileIdArray[p] - KMaxDataSyncID; - - _LIT8( Kprev, "DMId" ); - TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid - TInt fixedProfId = profileIdArray[p] - KMaxDataSyncID; //fit to 3 decimal - addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); - DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME ); - // KNSmlDMStart includes start text for URISeg - TBuf8<20> addURI; // DMAcc/DMIdnnn , nnn = profileid - addURI.Append( KNSmlDMStart ); - addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); - TBuf8<3> addLUID; - addLUID.Num( fixedProfId ); - - HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI); - - if (mapInfo->Length() == 0) - { - iCallBack->SetMappingL(addURI,addLUID); - if( aURI.Find(addURI) >= 0 ) - { - profileID = fixedProfId; - } - } - else - { - delete mapInfo; - } - } - - CleanupStack::PopAndDestroy( 1 );//profileIdArray - return profileID; -} - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -#ifndef IMPLEMENTATION_PROXY_ENTRY -#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} -#endif - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( KNSmlDMSettingsAdapterImplUid, CNSmlDMSettingsAdapter12::NewL ) - }; - - -// ----------------------------------------------------------------------------- -// TImplementationProxy* ImplementationGroupProxy() -// ----------------------------------------------------------------------------- -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - _DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: begin" ); - - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - _DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: end" ); - return ImplementationTable; - } - -//------------------------------------------------------------------------------ -// TPtrC8 CNSmlDMSettingsAdapter12::GetDynamicDMNodeUri( const TDesC8& aURI ) -// returns DM/xxx URI -//------------------------------------------------------------------------------ -TPtrC8 CNSmlDMSettingsAdapter12::GetDynamicDMNodeUri(const TDesC8& aURI) - { - TInt i= 0; - TBuf8<50> DmAccRoot(KNSmlDefDMAcc); - for ( i = aURI.Find( KNSmlDefDMAcc ) + DmAccRoot.Length() + 1; i < aURI.Length(); i++ ) - { - if( aURI[i] == '/' ) - { - break; - } - } - - return aURI.Left( i ); - } -// End of File - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/src/nsmldmsettingsadapter12.rss --- a/deviceupdatesui/adapters/syncmldm12/src/nsmldmsettingsadapter12.rss Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -CHARACTER_SET UTF8/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource data for Device Management Settings Adapter -* -*/ - - - - - -#include -#include "nsmldmconstants.h" - -RESOURCE REGISTRY_INFO theRegistryInfo - { - dll_uid = 0x10282CE7; //The DLL's 3rd UID. - interfaces = - { - INTERFACE_INFO - { - interface_uid = KNSmlDMInterfaceUid; // DM interface UID - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10282CE8; // DM interface implementation UID - version_no = 1; - display_name = ""; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/bwins/syncmldm12testu.def --- a/deviceupdatesui/adapters/syncmldm12/tsrc/bwins/syncmldm12testu.def Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/conf/syncmldm12test.cfg --- a/deviceupdatesui/adapters/syncmldm12/tsrc/conf/syncmldm12test.cfg Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -[Test] -title DDF -create syncmldm12test foobar jee -foobar DDFStructure -delete foobar -[Endtest] - -[Test] -title StartAtomic -create syncmldm12test foobar -foobar StartAtomic -delete foobar -[Endtest] - -[Test] -title CommitAtomic -create syncmldm12test foobar -foobar CommitAtomic -delete foobar -[Endtest] - -[Test] -title RollbackAtomic -create syncmldm12test foobar -foobar RollbackAtomic -delete foobar -[Endtest] - -[Test] -title AddDmAcc -create syncmldm12test foobar -foobar AddNode DMAcc/DMId099 -foobar UpdateLeaf DMAcc/DMId099/Name name99 -foobar UpdateLeaf DMAcc/DMId099/ServerID server99 -foobar UpdateLeaf DMAcc/DMId099/AppAddr/Addr001/Addr http://a.com -foobar UpdateLeaf DMAcc/DMId099/AppAuth/AppAuthCli/AAuthName user99 -foobar CompleteCommands -delete foobar -[Endtest] - -[Test] -title UpdateLeafDmAcc -create syncmldm12test foobar -foobar UpdateLeaf DMAcc/DMId099/Name newname99 -delete foobar -[Endtest] - -[Test] -title FetchNodeDmAcc -create syncmldm12test foobar -foobar FetchNode DMAcc/DMId099 -delete foobar -[Endtest] - -[Test] -title FetchLeafDmAcc -create syncmldm12test foobar -foobar FetchLeaf DMAcc/DMId099/Name -delete foobar -[Endtest] - -[Test] -title DeleteDmAcc -create syncmldm12test foobar -foobar DeleteNode DMAcc/DMId099 -delete foobar -[Endtest] - -[Test] -title AddDmAccAllInfo -create syncmldm12test foobar -foobar AddNode DMAcc/DMId090 -foobar AddNode DMAcc/DMId090/AAuthPref -foobar AddNode DMAcc/DMId090/AppAddr -foobar AddNode DMAcc/DMId090/AppAddr/Addr001 -foobar UpdateLeaf DMAcc/DMId090/AppAddr/Addr001/Addr https://b.com/abc -foobar UpdateLeaf DMAcc/DMId090/AppAddr/Addr001/AddrType URI -foobar AddNode DMAcc/DMId090/AppAddr/Addr001/Port -foobar AddNode DMAcc/DMId090/AppAddr/Addr001/Port/Port001 -foobar UpdateLeaf DMAcc/DMId090/AppAddr/Addr001/Port/Port001/PortNbr 443 -foobar AddNode DMAcc/DMId090/AppAuth -foobar AddNode DMAcc/DMId090/AppAuth/AppAuthCli -foobar AddNode DMAcc/DMId090/AppAuth/AppAuthCli/AAuthData -foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthCli/AAuthLevel CLCRED -foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthCli/AAuthName userx -foobar AddNode DMAcc/DMId090/AppAuth/AppAuthSrv -foobar AddNode DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthData -foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthLevel SRVCRED -foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthName userx -foobar AddNode DMAcc/DMId090/AppAuth/AppAuthTransport -foobar AddNode DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthData -foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthLevel HTTP -foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthName user -foobar UpdateLeaf DMAcc/DMId090/AppID w7 -foobar UpdateLeaf DMAcc/DMId090/Name InteliSync -foobar UpdateLeaf DMAcc/DMId090/PrefConRef AP/APId000 -foobar UpdateLeaf DMAcc/DMId090/ServerID userx -foobar CompleteCommands -delete foobar -[Endtest] - -[Test] -title FetchAllLeafDmAcc -create syncmldm12test foobarfoobar FetchLeaf DMAcc/DMId090/AppAddr/Addr001/Addr -foobar FetchLeaf DMAcc/DMId090/AppAddr/Addr001/AddrType -foobar FetchLeaf DMAcc/DMId090/AppAddr/Addr001/Port/Port001/PortNbr -foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthCli/AAuthLevel -foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthCli/AAuthName -foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthLevel -foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthName -foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthLevel -foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthName -foobar FetchLeaf DMAcc/DMId090/AppID -foobar FetchLeaf DMAcc/DMId090/Name -foobar FetchLeaf DMAcc/DMId090/PrefConRef -foobar FetchLeaf DMAcc/DMId090/ServerID -delete foobar -[Endtest] - -[Test] -title DeleteDmAcc -create syncmldm12test foobar -foobar DeleteNode DMAcc/DMId090 -delete foobar -[Endtest] diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/eabi/syncmldm12testu.def --- a/deviceupdatesui/adapters/syncmldm12/tsrc/eabi/syncmldm12testu.def Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - _ZTI15Csyncmldm12Test @ 2 NONAME ; ## - _ZTI16CTestDmDDFObject @ 3 NONAME ; ## - _ZTI8Cdmatest @ 4 NONAME ; ## - _ZTV15Csyncmldm12Test @ 5 NONAME ; ## - _ZTV16CTestDmDDFObject @ 6 NONAME ; ## - _ZTV8Cdmatest @ 7 NONAME ; ## - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/group/bld.inf --- a/deviceupdatesui/adapters/syncmldm12/tsrc/group/bld.inf Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - - - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these -DEFAULT - -PRJ_TESTEXPORTS -// NOTE: If using ARS requirements all export operations should be done under this. -// 'abld test export' - -PRJ_EXPORTS -// Specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// to the same name in /epoc32/include -// Example: - - -PRJ_TESTMMPFILES -// NOTE: If using ARS requirements .mmp file operation should be done under this. -// 'abld test build' -syncmldm12test.mmp - -PRJ_MMPFILES -// Specify the .mmp files required for building the important component -// releasables. -// -// Specify "tidy" if the component you need to build doesn't need to be -// released. Specify "ignore" if the MMP file exists but should be -// ignored. -// Example: - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/group/syncmldm12test.mmp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/group/syncmldm12test.mmp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - -#include - -TARGET syncmldm12test.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY ALL -TCB -/* Remove comments and replace 0x00000000 with correct vendor id */ -// VENDORID 0x00000000 - -//TARGETPATH ?target_path -DEFFILE syncmldm12test.def - -SOURCEPATH ../src -SOURCE dmatest.cpp -SOURCE TestDmDDFObject.cpp -SOURCE syncmldm12test.cpp -SOURCE syncmldm12testBlocks.cpp - - -USERINCLUDE ../inc -USERINCLUDE ../../inc - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - - - - -LIBRARY apgrfx.lib apmime.lib -LIBRARY euser.lib ecom.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY SWInstCli.lib - -LANG SC - - - -SMPSAFE -// End of File - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/group/syncmldm12test.pkg --- a/deviceupdatesui/adapters/syncmldm12/tsrc/group/syncmldm12test.pkg Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -; -; Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Implementation of DM adapter test component -; This is part of omadmextensions/adapter test application. -; - -;*Languages -&EN -; -;*Standard SIS file header. This section specifies the package name, -;application UID, and version/build numbers. Add the package TYPE here if needed. -#{"syncmldm12test"},(0x101FB3E8),1,0,1; -; - -;*Unique (Non-Localised) Vendor name -;This is used in combination with signing to prevent the unauthroized -;upgrade ofa a package by someone other than the rightful vendor. -:"Nokia" - -;*Localized Vendor Name -;This specifies the localised vendor name(s) correspodning to language(s). -%{"Nokia Test EN"} - -;*Files To Copy... -"\epoc32\release\armv5\urel\syncmldm12test.dll" -"C:\sys\bin\syncmldm12test.dll" -"..\conf\syncmldm12test.cfg"-"C:\TestFramework\syncmldm12test.cfg" -"..\init\syncmldm12test.ini"-"C:\TestFramework\syncmldm12test.ini" diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/inc/TestDmDDFObject.h --- a/deviceupdatesui/adapters/syncmldm12/tsrc/inc/TestDmDDFObject.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - - - -#ifndef __TESTDMDDFOBJECT_H -#define __TESTDMDDFOBJECT_H - -// INCLUDES -//#include -#include - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// DATA TYPES -//enum ?declaration -//typedef ?declaration -//extern ?data_type; - -// FUNCTION PROTOTYPES -//?type ?function_name(?arg_list); - -// FORWARD DECLARATIONS -class CStifLogger; - -// CLASS DECLARATION - -/** -* ?one_line_short_description. -* ?other_description_lines -* -* @lib ?library -* @since Series ?XX ?SeriesXX_version -*/ -class CTestDmDDFObject : public CBase, public MSmlDmDDFObject - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CTestDmDDFObject* NewL( CStifLogger *aLog ); - static CTestDmDDFObject* NewLC( CStifLogger *aLog ); - - /** - * Destructor. - */ - virtual ~CTestDmDDFObject(); - - public: // New functions - - /** - * ?member_description. - * @since Series ?XX ?SeriesXX_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - - virtual void SetNameL( const TDesC8& aName ); - - void DumpL( const TDesC8& aParentName, TBool aFullDump = ETrue ); - void ExternalizeL(RWriteStream& aStream) const; - - - - public: // Functions from base classes - -//sf- ********************************* - - void SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ); - void SetDefaultValueL( const TDesC8& aDefaultValue ); - void SetDescriptionL( const TDesC8& aDescription ); - void SetDFFormatL( TDFFormat aFormat ); - void SetOccurenceL( TOccurence aOccurence ); - void SetScopeL( TScope aScope ); - void SetDFTitleL( const TDesC8& aTitle ); - void AddDFTypeMimeTypeL( const TDesC8& aMimeType ); - void SetAsObjectGroup(); - MSmlDmDDFObject& AddChildObjectL(const TDesC8& aNodeName); - MSmlDmDDFObject& AddChildObjectGroupL(); - -//sf- ############################# - - const TDesC8& Name(); - TSmlDmAccessTypes AccessTypes(); - const TDesC8& DefaultValue(); - const TDesC8& Description(); - TDFFormat DFFormat(); - TOccurence Occurence(); - TScope Scope(); - const TDesC8& DFTitle(); - const TDesC8& DFTypeMimeType(); - TBool ObjectGroup(); - - TInt ChildObjectCount(); - CTestDmDDFObject& ChildObject( TInt aIndex ); - - CTestDmDDFObject* FindChildObject( const TDesC8& aName ); - TInt SubObjectsCount(); - - - protected: // New functions - - /** - * ?member_description. - * @since Series ?XX ?SeriesXX_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - - protected: // Functions from base classes - - /** - * From ?base_class ?member_description - */ - //?type ?member_function(); - - private: - - /** - * C++ default constructor. - */ - CTestDmDDFObject( CStifLogger *aLog ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - // Prohibit copy constructor if not deriving from CBase. - // CTestDmDDFObject( const CTestDmDDFObject& ); - // Prohibit assigment operator if not deriving from CBase. - // CTestDmDDFObject& operator=( const CTestDmDDFObject& ); - - public: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - protected: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - private: // Data - // ?one_line_short_description_of_data - //?data_declaration; - HBufC8* iName; - - TSmlDmAccessTypes iAccessTypes; - HBufC8* iDefaultValue; - HBufC8* iDescription; - TDFFormat iFormat; - TOccurence iOccurence; - TScope iScope; - HBufC8* iTitle; - HBufC8* iMimeType; - TBool iObjectGroup; - - RPointerArray iChildren; - - - // Reserved pointer for future extension - //TAny* iReserved; - - public: // Friend classes - //?friend_class_declaration; - protected: // Friend classes - //?friend_class_declaration; - private: // Friend classes - //?friend_class_declaration; - /** - * Logger. - */ - CStifLogger* iLog; - - }; - -#endif // __TESTDMDDFOBJECT_H - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/inc/dmatest.h --- a/deviceupdatesui/adapters/syncmldm12/tsrc/inc/dmatest.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,277 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - - - -#ifndef __DMA_TEST_H__ -#define __DMA_TEST_H__ - -// INCLUDES -#include -#include -#include -#include -#include -#include "NSmlDMSettingsAdapter12.h" - -class Cdmatest; - - -struct TMapping - { - TBuf8<256> iURI; - TBuf8<64> iLuid; - TMapping( const TDesC8 &aURI, const TDesC8 &aLuid ) : iURI( aURI ), iLuid( aLuid ) - { - - } - }; - -typedef RArray RMappingArray; - -typedef void (Cdmatest::* ResultsFunction)( TInt , CBufBase& , const TDesC8& ) ; - - -// CLASS DECLARATION - -/** -* ?one_line_short_description. -* ?other_description_lines -* -* @lib ?library -* @since Series ?XX ?SeriesXX_version -*/ -class Cdmatest : public CScriptBase, public MSmlDmCallback - { - - public: // Constructors and destructor - - /** - * Destructor. - */ - virtual ~Cdmatest(); - - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ) = 0; - - - public: - /** - The function is used to return the data in case of FetchLeafObjectL(), - FetchLeafObjectSizeL() and ChildURIListL() functions. It should not be - called where the DM command has failed, i.e. the error code returned in - SetStatusL is something other than EOk. - @param aResultsRef Reference to correct command - @param aObject The data which should be returned - @param aType MIME type of the object - @publishedPartner - @prototype - */ - void SetResultsL( TInt aResultsRef, CBufBase& aObject, - const TDesC8& aType ); - - /** - The function is used to return the data in case of FetchLeafObjectL() and - ChildURIListL() functions, where the size of the data being returned is - large enough for the Adapter to stream it. This function should not be - called when command was failed, i.e. the error code returned in SetStatusL - is something other than EOk. - @param aResultsRef Reference to correct command - @param aStream Large data which should be returned, DM engine - closes stream when it has read all the data - @param aType MIME type of the object - @publishedPartner - @prototype - */ - void SetResultsL( TInt /*aResultsRef*/, RReadStream*& /*aStream*/, - const TDesC8& /*aType*/ ) - { - - } - - /** - The function returns information about the Add,Update,Delete and Fetch - commands success to DM engine. The reference to correct command must be - used when calling the SetStatusL function, the reference is got from the - argument of the command functions. The SetStatusL function must be called - separately for every single command. - @param aStatusRef Reference to correct command - @param aErrorCode Information about the command success - @publishedPartner - @prototype - */ - void SetStatusL( TInt aStatusRef, - MSmlDmAdapter::TError aErrorCode ) ; - - /** - The function passes map information to DM Module. This function is called - for a new management object, both for node objects and for leaf objects. - In addition if ChildURIListL() function has returned new objects a mapping - information of the new objects must be passed. A mapping is treated as - inheritable. If the mapping is not set with this function, the mapping - LUID of the parent object is passed in following commands to the object. - @param aURI URI of the object. - @param aLUID LUID of the object. LUID must contain the all information, - which is needed for retrieve the invidual object from the - database. Typically it is ID for the database table. In - more complicated structures it can be combination of IDs, - which represent path to the object. - @publishedPartner - @prototype - */ - void SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ); - - /** - The function is used to make a fetch to other adapters. The most common - use is to make a fetch to the AP adapter, because when managing the access - points, the data comes as URI. For example, there are ToNAPId field in - some adapters, and data to it can be something like AP/IAPidx, and then - the link to AP adapter is needed. - Using FetchLinkL causes the DM Framework to make a Get request to the - appropriate DM adapter. The receiving adapter MUST complete the Get - request synchronously. - @param aURI URI of the object. - @param aData Reference to data, i.e. data is returned here - @param aStatus The status of fetch command is returned here - @publishedPartner - @prototype - */ - void FetchLinkL( const TDesC8& /*aURI*/, CBufBase& /*aData*/, - MSmlDmAdapter::TError& /*aStatus*/ ) - { - - } - - /** - The function returns the LUID which is mapped to aURI. If LUID is not - found, the function allocates a null length string, i.e. the function - allocates memory in every case. - @param aURI URI of the object. - @publishedPartner - @prototype - */ - HBufC8* GetLuidAllocL( const TDesC8& aURI ) ; - -#ifdef __TARM_SYMBIAN_CONVERGENCY - - void GetMappingInfoListL( const TDesC8& aURI, - CArrayFix& aSegmentList ); - -#else -// nothing -#endif - - protected: // New functions - - - void FetchNodeResultsL( TInt aResultsRef, CBufBase& aObject, - const TDesC8& aType ); - void SaveDataL( TInt aResultsRef, CBufBase& aObject, - const TDesC8& aType ) ; - - TPtrC8 LastURISeg( const TDesC8& aURI ); - TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); - TPtrC RemoveLastURISeg( const TDesC& aURI ); - void SetURIL( const TDesC& aURI ); - void SetURIL( const TDesC8& aURI ); - void SetURIL( HBufC8* aURI ); - HBufC8 *LoadFileLC( const TDesC &aFileName, TDataType &aType ); - HBufC8 *LoadFileLC( const TDesC8 &aFileName, TDataType &aType ); - HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); - HBufC8* GetLuidAllocLC( const TDesC8& aURI ) ; - TPtrC8 RemoveLastSeg(const TDesC8& aURI); - - TInt FetchNodeL( CStifItemParser& aItem ) ; - TInt FetchLeafL( CStifItemParser& aItem ) ; - TInt AddNodeL( CStifItemParser& aItem ); - TInt DeleteObjectL( CStifItemParser& aItem ); - TInt UpdateLeafL( CStifItemParser& aItem ) ; - TInt UpdateLeafDataL( CStifItemParser& aItem ) ; - TInt UpdateLeafDataURLL( CStifItemParser& aItem ) ; - - TInt ExecuteLeafL ( CStifItemParser& aItem ) ; - TInt ExecuteLeafDataL ( CStifItemParser& aItem ) ; - TInt StartAtomicL( CStifItemParser& aItem ) ; - TInt CommitAtomicL( CStifItemParser& aItem ) ; - TInt RollbackAtomicL( CStifItemParser& aItem ) ; - TInt CompleteCommandsL( CStifItemParser& aItem ); - TInt DDFStructureL( CStifItemParser& aItem ) ; -// TInt DeliverL( CStifItemParser& aItem ) ; -// TInt DetailsL( CStifItemParser& aItem ) ; -// TInt InstallL( CStifItemParser& aItem ) ; -// TInt BareInstallL( CStifItemParser& aItem ) ; - - protected: - - /** - * C++ default constructor. - */ - Cdmatest( CTestModuleIf& aTestModuleIf, TUid aUid ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - // Prohibit copy constructor if not deriving from CBase. - // Cdmatest( const Cdmatest& ); - // Prohibit assigment operator if not deriving from CBase. - // Cdmatest& operator=( const Cdmatest& ); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - virtual void Delete(); - void LoadMappingsL(); - void SaveMappingsL(); - public: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - protected: // Data - // ?one_line_short_description_of_data - //?data_declaration; - MSmlDmAdapter::TError iStatus ; - ResultsFunction iResultsFunction; - //CSmlDmAdapter *iAdapter ; - CNSmlDMSettingsAdapter12 *iAdapter ; - HBufC8 *iURI; - CArrayFix *iEmptyMappingInfoArray; - TFileName iSaveFileName; - RMappingArray iMappingTable; - TUid iUid; - TInt iCounter; - //class CNSmlDmMgmtTree* iMgmtTree; - class CNSmlDmMgmtTree* iMgmtTree; - CNSmlDMSettingsAdapter12 *Adapter() ; - }; - -#endif // __DMA_TEST_H__ - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/inc/syncmldm12test.h --- a/deviceupdatesui/adapters/syncmldm12/tsrc/inc/syncmldm12test.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - - - -#ifndef TCTEST_H -#define TCTEST_H - -// INCLUDES -#include -#include -#include -#include -#include "dmatest.h" - -const TUint KNSmlDMSettings12AdapterImplUid = 0x10282CE8; - - -const TUid KAdapterUid = - { - KNSmlDMSettings12AdapterImplUid - }; -// Logging path -_LIT( KamtestLogPath, "\\logs\\testframework\\tctest\\" ); -// Log file -_LIT( KamtestLogFile, "tctest.txt" ); - - -// FORWARD DECLARATIONS -class Csyncmldm12Test; - - -// CLASS DECLARATION - -/** -* Csyncmldm12Test test class for STIF Test Framework TestScripter. -* ?other_description_lines -* -* @lib ?library -* @since ?Series60_version -*/ -class Csyncmldm12Test : public Cdmatest - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static Csyncmldm12Test* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~Csyncmldm12Test(); - - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - - - private: - - /** - * C++ default constructor. - */ - Csyncmldm12Test( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - // Prohibit copy constructor if not deriving from CBase. - // ?classname( const ?classname& ); - // Prohibit assigment operator if not deriving from CBase. - // ?classname& operator=( const ?classname& ); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - virtual void Delete(); - - /** - * Test methods are listed below. - */ - - /** - * Example test method. - * @since ?Series60_version - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ -/* virtual TInt ExampleL( CStifItemParser& aItem ) ; - virtual TInt DeliverL( CStifItemParser& aItem ) ; - virtual TInt DetailsL( CStifItemParser& aItem ) ; - virtual TInt InstallL( CStifItemParser& aItem ) ; - virtual TInt BareInstallL( CStifItemParser& aItem ) ;*/ - - - private: // Data - HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); - - - }; - -#endif // TCTEST_H - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/init/syncmldm12test.ini --- a/deviceupdatesui/adapters/syncmldm12/tsrc/init/syncmldm12test.ini Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= C:\LOGS\TestFramework\ -TestReportFileName= TestReport - -TestReportFormat= TXT # Possible values: TXT or HTML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -#UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= XXXXXXXXX -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -#[New_Module] -#ModuleName= demomodule -#[End_Module] - - -[New_Module] -ModuleName= testscripter -#DM -TestCaseFile= c:\testframework\syncmldm12test.cfg -[End_Module] - - -# Load testmoduleXXX, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleXXX used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleXXX used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/src/TestDmDDFObject.cpp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/src/TestDmDDFObject.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,516 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - - - -// INCLUDE FILES - -#include "TestDmDDFObject.h" -#include "StifLogger.h" - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - - - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CTestDmDDFObject::CTestDmDDFObject -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CTestDmDDFObject::CTestDmDDFObject( CStifLogger *aLog ) - : iName( 0 ) - , iAccessTypes() - , iDefaultValue( 0 ) - , iDescription( 0 ) - , iFormat( (TDFFormat)0 ) - , iOccurence( (TOccurence)0 ) - , iScope( (TScope)0 ) - , iTitle ( 0 ) - , iMimeType( 0 ) - , iObjectGroup( EFalse ) - , iLog( aLog ) -// RPointerArray iChildren; - { - } - -// ----------------------------------------------------------------------------- -// CTestDmDDFObject::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CTestDmDDFObject::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CTestDmDDFObject::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CTestDmDDFObject* CTestDmDDFObject::NewL( CStifLogger *aLog ) - { - CTestDmDDFObject* self = CTestDmDDFObject::NewLC( aLog ); - CleanupStack::Pop( self ); - - return self; - } - -CTestDmDDFObject* CTestDmDDFObject::NewLC( CStifLogger *aLog ) - { - CTestDmDDFObject* self = new( ELeave ) CTestDmDDFObject( aLog ); - - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - - -// Destructor -CTestDmDDFObject::~CTestDmDDFObject() - { - delete iName; - delete iDefaultValue; - delete iDescription; - delete iTitle; - delete iMimeType; - iChildren.ResetAndDestroy(); - } - - -// ----------------------------------------------------------------------------- -// CTestDmDDFObject::?member_function -// ?implementation_description -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -/*?type CTestDmDDFObject::?member_function( - ?arg_type arg, - ?arg_type arg ) - { - - ?code - - } -*/ - -void CTestDmDDFObject::SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ) - { - iLog->Log( _L8( "SetAccessTypesL, aAccessTypes=%d" ), aAccessTypes.GetACL() ); - iAccessTypes = aAccessTypes; - } - -void CTestDmDDFObject::SetDefaultValueL( const TDesC8& aDefaultValue ) - { - iLog->Log( _L8( "SetDefaultValueL, aDefaultValue='%S'" ), &aDefaultValue ); - delete iDefaultValue; - iDefaultValue = 0; - iDefaultValue = aDefaultValue.AllocL(); - } - -void CTestDmDDFObject::SetDescriptionL( const TDesC8& aDescription ) - { - iLog->Log( _L8( "SetDescriptionL, aDescription='%S'" ), &aDescription ); - delete iDescription; - iDescription = 0; - iDescription = aDescription.AllocL(); - } - -void CTestDmDDFObject::SetDFFormatL( TDFFormat aFormat ) - { - iLog->Log( _L8( "SetDFFormatL, aFormat=%d" ), aFormat ); - iFormat = aFormat; - } - -void CTestDmDDFObject::SetOccurenceL( TOccurence aOccurence ) - { - iLog->Log( _L8( "SetOccurenceL, aOccurence=%d" ), aOccurence ); - iOccurence = aOccurence; - } - -void CTestDmDDFObject::SetScopeL( TScope aScope ) - { - iLog->Log( _L8( "SetScopeL, aScope=%d" ), aScope ); - iScope = aScope; - } - -void CTestDmDDFObject::SetDFTitleL( const TDesC8& aTitle ) - { - iLog->Log( _L8( "SetDFTitleL, aTitle='%S'" ), &aTitle ); - delete iTitle; - iTitle = 0; - iTitle = aTitle.AllocL(); - } - -void CTestDmDDFObject::AddDFTypeMimeTypeL( const TDesC8& aMimeType ) - { - iLog->Log( _L8( "AddDFTypeMimeTypeL, aMimeType='%S'" ), &aMimeType ); - delete iMimeType; - iMimeType = 0; - iMimeType = aMimeType.AllocL(); - } - -void CTestDmDDFObject::SetAsObjectGroup() - { - iLog->Log( _L8( "SetAsObjectGroup, true" ) ); - iObjectGroup = ETrue; - } - -MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectL(const TDesC8& aNodeName) - { - iLog->Log( _L8( "AddChildObjectL, aNodeName='%S'" ), &aNodeName ); - CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); - child->SetNameL( aNodeName ); - iChildren.AppendL( child ); - CleanupStack::Pop( child ); // Don't destroy - return *child; - } - -MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectGroupL() - { - iLog->Log( _L8( "AddChildObjectGroupL, ''" ) ); - CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, KNullDesC ); - child->SetAsObjectGroup(); - iChildren.AppendL( child ); - CleanupStack::Pop( child ); // Don't destroy - return *child; - } - -// Own functions - -void CTestDmDDFObject::SetNameL( const TDesC8& aName ) - { - delete iName; - iName = 0; - iName = aName.AllocL(); - } - -void CTestDmDDFObject::DumpL( const TDesC8& aParentName, TBool aFullDump ) - { - TPtrC8 name( _L8("") ); - if (iName && iName->Length() > 0) - { - name.Set( *iName ); - } - - HBufC8* fullName = HBufC8::NewLC( aParentName.Length() + name.Length() + 1 ); - *fullName = aParentName; - if (aParentName.Length() > 0 && aParentName[ aParentName.Length() - 1 ] != '/') - { - fullName->Des().Append( _L8("/")); - } - fullName->Des().Append( name ); - - /* Translate some members to text for dumping */ - TBuf8<20> strAccessTypes; - TUint8 accessTypes = iAccessTypes.GetACL(); - if ((accessTypes & iAccessTypes.EAccessType_Add) != 0) - { - strAccessTypes.Append( _L8("A") ); - } - if ((accessTypes & iAccessTypes.EAccessType_Copy) != 0) - { - strAccessTypes.Append( _L8("C") ); - } - if ((accessTypes & iAccessTypes.EAccessType_Delete) != 0) - { - strAccessTypes.Append( _L8("D") ); - } - if ((accessTypes & iAccessTypes.EAccessType_Exec) != 0) - { - strAccessTypes.Append( _L8("E") ); - } - if ((accessTypes & iAccessTypes.EAccessType_Get) != 0) - { - strAccessTypes.Append( _L8("G") ); - } - if ((accessTypes & iAccessTypes.EAccessType_Replace) != 0) - { - strAccessTypes.Append( _L8("R") ); - } - - TBuf8<20> strFormat; - switch( iFormat ) - { - case EB64: - strFormat = _L8("Base64"); - break; - case EBool: - strFormat = _L8("Bool"); - break; - case EChr: - strFormat = _L8("Chr"); - break; - case EInt: - strFormat = _L8("Int"); - break; - case ENode: - strFormat = _L8("Node"); - break; - case ENull: - strFormat = _L8("Null"); - break; - case EXml: - strFormat = _L8("Xml"); - break; - case EBin: - strFormat = _L8("Bin"); - break; - default: - break; - } - - - TBuf8<20> strOccurence; - switch( iOccurence ) - { - case EOne: - /** The node appears exactly once */ - strOccurence = _L8("M:1"); - break; - case EZeroOrOne: - /** The node is optional and may appear zero or once */ - strOccurence = _L8("O:0-1"); - break; - case EZeroOrMore: - /** The node is optional and may appear zero or more times */ - strOccurence = _L8("O:0-*"); - break; - case EOneOrMore: - /** The node is mandatory and may appear once or more times */ - strOccurence = _L8("M:1-*"); - break; - case EZeroOrN: - /** The node is optional and may appear between once and 'N' times */ - strOccurence = _L8("O:1-N"); - break; - case EOneOrN: - /** The node is mandatory and may appear between once and 'N' times */ - strOccurence = _L8("M:1-N"); - break; - default: - break; - } - - - TBuf8<20> strScope; - switch( iScope) - { - case EPermanent: - /** The node appears exactly once */ - strScope = _L8("Permanent"); - break; - case EDynamic: - /** The node is optional and may appear zero or once */ - strScope = _L8("O:Dynamic"); - break; - default: - break; - } - - - /* Dump main data */ - if (aFullDump) - { - iLog->Log( _L8( "DDFObject: '%S'" ), fullName ); - } - else - { - iLog->Log( _L8( "DDFObject: '%S' (%S), %S, %S, %S" ), - fullName, &strAccessTypes, &strFormat, &strOccurence, &strScope ); - } - - /* Dump members */ - if (aFullDump) - { - TPtrC8 empty( _L8( "" ) ); - #define CHK_NULL(a) ((a)==0?(TDesC8*)(&empty):(TDesC8*)(a)) - - iLog->Log( _L8( " iName=='%S'" ), iName ); - iLog->Log( _L8( " iAccessTypes=%d (%S)" ), iAccessTypes.GetACL(), &strAccessTypes ); - iLog->Log( _L8( " iDefaultValue='%S'" ), CHK_NULL(iDefaultValue)); - iLog->Log( _L8( " iDescription='%S'" ), CHK_NULL(iDescription )); - iLog->Log( _L8( " iFormat=%d (%S)" ), iFormat, &strFormat ); - iLog->Log( _L8( " iOccurence=%d (%S)" ), iOccurence, &strOccurence ); - iLog->Log( _L8( " iScope=%d (%S)" ), iScope, &strScope ); - iLog->Log( _L8( " iTitle='%S'" ), CHK_NULL(iTitle )); - iLog->Log( _L8( " iMimeType='%S'" ), CHK_NULL(iMimeType )); - iLog->Log( _L8( "----------------------------------" ) ); - } - - /* Dump children */ - for (TInt i = 0 ; i < iChildren.Count() ; i++) - { - iChildren[i]->DumpL( *fullName, aFullDump ); - } - - CleanupStack::PopAndDestroy( fullName ); - } - -/* -void CTestDmDDFObject::ExternalizeL(RWriteStream& aStream) const - { - X; - aStream << *iName << eol; - } -*/ - -const TDesC8& CTestDmDDFObject::Name() - { - return (iName != 0) ? *iName : KNullDesC8(); - } - -TSmlDmAccessTypes CTestDmDDFObject::AccessTypes() - { - return iAccessTypes; - } - -const TDesC8& CTestDmDDFObject::DefaultValue() - { - return (iDefaultValue != 0) ? *iDefaultValue : KNullDesC8(); - } - -const TDesC8& CTestDmDDFObject::Description() - { - return (iDescription != 0) ? *iDescription : KNullDesC8(); - } - -CTestDmDDFObject::TDFFormat CTestDmDDFObject::DFFormat() - { - return iFormat; - } - -CTestDmDDFObject::TOccurence CTestDmDDFObject::Occurence() - { - return iOccurence; - } - -CTestDmDDFObject::TScope CTestDmDDFObject::Scope() - { - return iScope; - } - -const TDesC8& CTestDmDDFObject::DFTitle() - { - return (iTitle != 0) ? *iTitle : KNullDesC8(); - } - -const TDesC8& CTestDmDDFObject::DFTypeMimeType() - { - return (iMimeType != 0) ? *iMimeType : KNullDesC8(); - } - -TBool CTestDmDDFObject::ObjectGroup() - { - return iObjectGroup; - } - -TInt CTestDmDDFObject::ChildObjectCount() - { - return iChildren.Count(); - } - -CTestDmDDFObject& CTestDmDDFObject::ChildObject( TInt aIndex ) - { - return *iChildren[aIndex]; - } - -CTestDmDDFObject* CTestDmDDFObject::FindChildObject( const TDesC8& aName ) - { - CTestDmDDFObject* foundObject = 0; - - for (TInt i = 0 ; i < iChildren.Count() ; i++) - { - if ( aName.CompareC( iChildren[i]->Name() ) == 0 ) - { - foundObject = iChildren[i]; - break; - } - } - - return foundObject; - } - -TInt CTestDmDDFObject::SubObjectsCount() - { - TInt count = 0; - - TInt i; - for (i = 0 ; i < iChildren.Count() ; i++) - { - count += iChildren[i]->SubObjectsCount(); - } - count += i; - - return count; - } - -/* -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// ?function_name implements... -// ?implementation_description. -// Returns: ?value_1: ?description -// ?value_n: ?description -// ?description -// ----------------------------------------------------------------------------- -// -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg ) // ?description - { - - ?code - - } -*/ -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/src/dmatest.cpp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/src/dmatest.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,954 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - - - -// INCLUDE FILES -#include "dmatest.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "TestDmDDFObject.h" - -_LIT8( KEmptyType, "" ); -_LIT8( KDefaultType, "text/plain" ); -_LIT( KMappingTableFile, "\\dmtestmappings.txt" ); -//_LIT8( KNSmlDMSeparator8, "/" ); -//const TUint8 KNSmlDMUriSeparator = 0x2f; //forward slash - -#define LEAVE_IF_ERROR(x,msg) \ - { TInt __xres = (x); if ( __xres < 0 ) { if ( iLog ) iLog->Log( (msg), __xres ); User::Leave( __xres ); } } - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Cdmatest::Cdmatest -// C++ default constructor can NOT contain any code, that -// leave. -// ----------------------------------------------------------------------------- -// -Cdmatest::Cdmatest(CTestModuleIf& aTestModuleIf, TUid aUid ): - CScriptBase( aTestModuleIf ), iMappingTable(2), iUid( aUid ) - { - - } - -// ----------------------------------------------------------------------------- -// Cdmatest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void Cdmatest::ConstructL() - { - Adapter(); - iEmptyMappingInfoArray = new ( ELeave ) CArrayFixFlat(1); - - TRAPD( err, LoadMappingsL() ); - if (err != KErrEof && err != KErrNone && err != KErrNotFound) - { - User::Leave( err ); - } - } - -CNSmlDMSettingsAdapter12 *Cdmatest::Adapter() - { - if ( iAdapter == NULL ) - { - if ( iLog ) - { - iLog->Log( _L( "Loading Adapter" ) ); - } - - TRAPD( err, iAdapter = (CNSmlDMSettingsAdapter12*) CSmlDmAdapter::NewL( iUid,*this ) ); - if ( err == KErrNone ) - { - if (iLog ) - { - iLog->Log( _L( "Loaded" ) ); - } - } - else - { - if (iLog) - { - iLog->Log( _L( "Failed to load adapter: %d" ), err ); - } - } - } - return iAdapter; - } - - -void Cdmatest::LoadMappingsL() - { - TDataType type; - HBufC8 *data = LoadFileLC( KMappingTableFile, type ); - RDesReadStream buf( *data ); - CleanupClosePushL( buf ); - - TInt len( data->Length() ); - while (buf.Source()->TellL( MStreamBuf::ERead ).Offset() < len) - { - TUint32 val = buf.ReadUint32L(); - TBuf8<256> uri; - TBuf8<64> luid; - buf.ReadL(uri, val); - val = buf.ReadUint32L(); - buf.ReadL(luid, val); - TMapping m( uri, luid ) ; - TInt err( iMappingTable.Append( m ) ); - if ( err == KErrNone ) - { - iLog->Log( _L8( "Loaded mapping: '%S' : '%S'"), &m.iURI, &m.iLuid ); - } - else - { - iLog->Log( _L8( "FAILED TO Load mapping: '%d' "), err ); - } - } - CleanupStack::PopAndDestroy( &buf); // buf - CleanupStack::PopAndDestroy( data ); // data - } - - - -void Cdmatest::SaveMappingsL() - { - TInt c( iMappingTable.Count() ); - if ( c > 0 ) - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - RFileWriteStream buf; - User::LeaveIfError( buf.Replace( fs, KMappingTableFile, EFileWrite ) ); - CleanupClosePushL( buf ); - - TInt i( 0 ) ; - do - { - buf.WriteUint32L( iMappingTable[i].iURI.Length() ); - buf.WriteL( iMappingTable[i].iURI ); - buf.WriteUint32L( iMappingTable[i].iLuid.Length() ); - buf.WriteL( iMappingTable[i].iLuid ); - } - while ( ++i < c ) ; - buf.CommitL(); - buf.Close(); - - CleanupStack::PopAndDestroy(); // buf - CleanupStack::PopAndDestroy(); // fs - } - } - - -// Destructor -Cdmatest::~Cdmatest() - { - // Delete resources allocated from test methods - TRAPD(err, SaveMappingsL() ); - if ( err != KErrNone ) - { - if(iLog) - iLog->Log( _L8( "Failed to save mappings!: %d"), err ); - } - Delete(); - - // Delete logger - delete iLog; - delete iEmptyMappingInfoArray; - delete iAdapter; - delete iURI; - iMappingTable.Reset(); - REComSession::FinalClose(); - } - - -// ----------------------------------------------------------------------------- -// Camatest::Delete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- -// -void Cdmatest::Delete() - { - - } - -// ----------------------------------------------------------------------------- -// Cdmatest::?member_function -// ?implementation_description -// (other items were commented in a header). -// ----------------------------------------------------------------------------- - - - -HBufC8 *Cdmatest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) - { - TPtrC nodename( KNullDesC ); - - TInt i( aItem.GetNextString ( nodename ) ); - if ( i != KErrNone ) - { - iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); - } - else - { - iLog->Log( _L("%S: %S"), &aName, &nodename); - } - - HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; - buf->Des().Copy( nodename ); - return buf; - } - -TInt Cdmatest::FetchNodeL( CStifItemParser& aItem ) - { - - TInt ret( KErrNone ); - // Print to UI - TestModuleIf().Printf( 0, _L("Cdmatest"), _L("FetchNodeL") ); - - iResultsFunction = FetchNodeResultsL; - - TPtrC8 nodename( GetNextStringLC( aItem, _L(" nodename" ) )->Des() ) ; - - SetURIL(nodename) ;// - HBufC8 *luid = GetLuidAllocLC( *iURI ); - - Adapter()->ChildURIListL( *iURI, *luid, *iEmptyMappingInfoArray, 4, 5) ; - - if ( iStatus == MSmlDmAdapter::EOk ) - { - } - else - { - iLog->Log( _L("FetchNodeL: ChildUriList Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - CleanupStack::PopAndDestroy( luid ) ; - CleanupStack::PopAndDestroy() ; // nodename - iLog->Log( _L("FetchNodeL: Test Complete with status %d" ), ret ); - - return ret; - } - -TInt Cdmatest::StartAtomicL( CStifItemParser& /*aItem*/ ) - { - TRAPD( err, Adapter()->StartAtomicL() ) ; - iLog->Log( _L("StartAtomicL: Atomic started resulting error %d" ), err ); - return err; - } - -TInt Cdmatest::RollbackAtomicL( CStifItemParser& /*aItem*/ ) - { - TRAPD( err, Adapter()->RollbackAtomicL() ) ; - iLog->Log( _L("RollbackAtomicL: Atomic rolled back resulting error %d" ), err ); - return err; - } - -TInt Cdmatest::CommitAtomicL( CStifItemParser& /*aItem*/ ) - { - TRAPD( err, Adapter()->CommitAtomicL() ) ; - iLog->Log( _L("RollbackAtomicL: Atomic commited resulting error %d" ), err ); - return err; - } - - -TInt Cdmatest::DDFStructureL( CStifItemParser& /*aItem*/ ) - { - CTestDmDDFObject* ddfRoot = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); - - TRAPD( err, iAdapter->DDFStructureL( *ddfRoot ) ) ; - CleanupStack::PopAndDestroy( ddfRoot ); - iLog->Log( _L("DDFStructureL: method called resulting error %d" ), err ); - return err; - } - - -TInt Cdmatest::AddNodeL( CStifItemParser& aItem ) - { - - TInt ret( KErrNone ); - // Print to UI - TestModuleIf().Printf( 0, _L("Cdmatest"), _L("AddNodeL") ); - - - TPtrC8 nodename( GetNextStringLC ( aItem, _L("nodename" ) )->Des() ) ; - SetURIL( nodename ); - - Adapter()->AddNodeObjectL( *iURI, KEmptyType, 8 ) ; - - if ( iStatus == MSmlDmAdapter::EOk ) - { - iLog->Log( _L("AddNodeL: AddNodeObjectL Successful! %d" ), iStatus ); - } - else - { - iLog->Log( _L("AddNodeL: AddNodeObjectL Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - - CleanupStack::PopAndDestroy() ; // nodename - iLog->Log( _L("AddNodeL Test Complete with status %d" ), ret ); - - return ret; - } - -TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem ) - { - - TInt ret( KErrNone ); - // Print to UI - TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") ); - - TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; - TPtrC8 data (GetNextStringLC( aItem, _L("datafile"))->Des() ); - - HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; - SetURIL( nodename ); - - TPtrC8 parentURI(RemoveLastSeg(nodename)); - HBufC8 *luid = GetLuidAllocLC( parentURI ); - - TDataType type; - - TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() ); - - /** - virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aObject, const TDesC8& aType, - TInt aStatusRef ) = 0; - */ - - Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); - - if ( iStatus == MSmlDmAdapter::EOk ) - { - iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus ); - } - else - { - iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - - CleanupStack::PopAndDestroy(); // loadfile - CleanupStack::PopAndDestroy(); // luid - CleanupStack::PopAndDestroy(); // mime - CleanupStack::PopAndDestroy(); // nodename - - iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret ); - - return ret; - } - - -TInt Cdmatest::UpdateLeafDataURLL( CStifItemParser& aItem ) - { - - TInt ret( KErrNone ); - // Print to UI - TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafDataL") ); - - TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; - TPtrC8 http (GetNextStringLC( aItem, _L("http"))->Des() ); - TPtrC8 url (GetNextStringLC( aItem, _L("rest of url"))->Des() ); - HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; - SetURIL( nodename ); - - _LIT8( KTag, "://" ); - - HBufC8 *fullurl = HBufC8::NewLC( http.Length() + KTag().Length() + url.Length() ); - TPtr8 pfullurl( fullurl->Des() ); - pfullurl.Copy( http ) ; - pfullurl.Append( KTag ); - pfullurl.Append( url ); - TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); - - HBufC8 *luid = GetLuidAllocLC( *iURI ); - /** - virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aObject, const TDesC8& aType, - TInt aStatusRef ) = 0; - */ - Adapter()->UpdateLeafObjectL( *iURI , *luid, pfullurl, mimePtr, 3); - if ( iStatus == MSmlDmAdapter::EOk ) - { - iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); - } - else - { - iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - CleanupStack::PopAndDestroy( luid ); // - CleanupStack::PopAndDestroy( mime ); // mime - CleanupStack::PopAndDestroy(); // url - CleanupStack::PopAndDestroy(); // http - CleanupStack::PopAndDestroy(); // nodename - iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); - - return ret; - } - -TInt Cdmatest::UpdateLeafDataL( CStifItemParser& aItem ) - { - - TInt ret( KErrNone ); - // Print to UI - TestModuleIf().Printf( 0, _L("Camtest"), _L("UpdateLeafDataL") ); - - TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; - TPtrC8 data (GetNextStringLC( aItem, _L("data"))->Des() ); - HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; - - SetURIL( nodename ); - - - TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); - - TPtrC8 parentURI(RemoveLastSeg(nodename)); - HBufC8 *luid = GetLuidAllocLC( parentURI ); - -// -// virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, -// const TDesC8& aObject, const TDesC8& aType, -// TInt aStatusRef ) = 0; -// - Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); - if ( iStatus == MSmlDmAdapter::EOk ) - { - iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); - } - else - { - iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - - CleanupStack::PopAndDestroy(); // mime - CleanupStack::PopAndDestroy(); // luid - CleanupStack::PopAndDestroy(); // data - CleanupStack::PopAndDestroy(); // nodename - iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); - - return ret; - } - -TInt Cdmatest::FetchLeafL( CStifItemParser& aItem ) - { - - TInt ret( KErrNone ); - // Print to UI - TestModuleIf().Printf( 0, _L("Camtest"), _L("FetchLeafL") ); - - iResultsFunction = NULL; - - TInt i( 0 ); - TPtrC8 nodename ( GetNextStringLC( aItem, _L( "nodename" ) )->Des() ) ; - - //TPtrC datafile; - TPtrC datafile( KNullDesC ); - i = aItem.GetNextString ( datafile ) ; - if ( i != KErrNone ) - { - iLog->Log(_L("FetchLeafL: ERROR Reading outfile argument: 0x%X"), i ); - //return i; - } - else - { - iSaveFileName = datafile; - iLog->Log( _L( " Save file nameis '%S'" ), &iSaveFileName ); - iResultsFunction = SaveDataL; - } - - SetURIL(nodename) ; - - /* - void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aType, TInt aResultsRef, - TInt aStatusRef ); - */ - TPtrC8 parentURI(RemoveLastSeg(nodename)); - HBufC8 *luid = GetLuidAllocLC( parentURI ); - - Adapter()->FetchLeafObjectL( *iURI, *luid, KEmptyType, 7, 8 ) ; - if ( iStatus == MSmlDmAdapter::EOk ) - { - iLog->Log( _L("FetchLeafL: FetchLeafObjectL Successful! %d" ), iStatus ); - } - else - { - iLog->Log( _L("FetchLeafL: FetchLeafObjectL Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - CleanupStack::PopAndDestroy( luid ); - CleanupStack::PopAndDestroy( ); // nodename - iLog->Log( _L("FetchLeafL Test Complete with status %d" ), ret ); - return ret; - } - - -TInt Cdmatest::ExecuteLeafL( CStifItemParser& aItem ) - { - TInt ret( KErrNone ); - // Print to UI - TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); - - iResultsFunction = NULL; - - TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; - TPtrC8 data( GetNextStringLC ( aItem, _L("Input file") )->Des() ) ; - - SetURIL(nodename) ; - - /* - virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aArgument, const TDesC8& aType, - TInt aStatusRef ) = 0; - */ - TDataType type; - - TPtrC8 parentURI(RemoveLastSeg(nodename)); - HBufC8 *luid = GetLuidAllocLC( parentURI ); - - Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; - if ( iStatus == MSmlDmAdapter::EOk ) - { - iLog->Log( _L("ExecuteLeafL: ExecuteCommandL Successful! %d" ), iStatus ); - } - else - { - iLog->Log( _L("ExecuteLeafL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - CleanupStack::PopAndDestroy( luid ); // luid - CleanupStack::PopAndDestroy(); // data - CleanupStack::PopAndDestroy(); // nodename - - iLog->Log( _L("ExecuteLeafL: Test Complete with status %d" ), ret ); - - return ret; - } - -TInt Cdmatest::CompleteCommandsL( CStifItemParser& /*aItem*/ ) - { - TRAPD( err, Adapter()->CompleteOutstandingCmdsL() ); - delete iAdapter; - iAdapter = NULL; - return err; - } -TInt Cdmatest::DeleteObjectL( CStifItemParser& aItem ) -{ - TInt ret( KErrNone ); - // Print to UI - TestModuleIf().Printf( 0, _L("Camtest"), _L("DeleteObjectL") ); - - TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; - - SetURIL(nodename) ; - - HBufC8 *luid = GetLuidAllocLC( *iURI ); - Adapter()->DeleteObjectL( *iURI, *luid, 11 ) ; - if ( iStatus == MSmlDmAdapter::EOk ) - { - iLog->Log( _L("DeleteNode: DeleteObjectL Successful! %d" ), iStatus ); - } - else - { - iLog->Log( _L("DeleteNode: DeleteObjectL FetchLeafObjectL Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - CleanupStack::PopAndDestroy( luid ); // luid - CleanupStack::PopAndDestroy(); // nodename - iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); - - return ret; -} - -TInt Cdmatest::ExecuteLeafDataL( CStifItemParser& aItem ) - { - TInt ret( KErrNone ); - - // Print to UI - TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); - - iResultsFunction = NULL; - - TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; - TPtrC8 data( GetNextStringLC ( aItem, _L("Input data") )->Des() ) ; - - SetURIL(nodename) ; - - /* - virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, - const TDesC8& aArgument, const TDesC8& aType, - TInt aStatusRef ) = 0; - */ - HBufC8 *luid = GetLuidAllocLC( *iURI ); - Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; - if ( iStatus == MSmlDmAdapter::EOk ) - { - iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL Successful! %d" ), iStatus ); - } - else - { - iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); - ret = KErrGeneral ; - } - CleanupStack::PopAndDestroy(); // luid - CleanupStack::PopAndDestroy(); // data - CleanupStack::PopAndDestroy(); // nodename - iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); - - return ret; - } - - -HBufC8 *Cdmatest::LoadFileLC( const TDesC &aFileName, TDataType &aType ) - { - RFs fs ; - LEAVE_IF_ERROR( fs.Connect(), _L( "Could not connect fileserver: %d" ) ); - - CleanupClosePushL( fs ); - RFile file ; - LEAVE_IF_ERROR( file.Open(fs,aFileName,EFileRead), _L( "Could not open file: %d" ) ); - - - - CleanupClosePushL( file ); - TInt dataSize ; - LEAVE_IF_ERROR( file.Size( dataSize ), _L( "Could not get file size: %d" ) ); - HBufC8 *nodedata = HBufC8::NewL ( dataSize ); - CleanupStack::PushL( nodedata ); - TPtr8 nodedataptr( nodedata->Des() ); - LEAVE_IF_ERROR( file.Read( nodedataptr ), _L( "Could not read file: %d" ) ); - TDataRecognitionResult aDataType; - RApaLsSession ls ; - TInt err( ls.Connect() ); - if ( err == KErrNone ) - { - CleanupClosePushL( ls ); - err = ls.RecognizeData(aFileName, nodedataptr, aDataType) ; - if ( err == KErrNone ) - { - aType = aDataType.iDataType; - } - else - { - iLog->Log( _L("LoadFileLC: WARNING Failed to get type: %d" ), err ); - aType = TDataType( KDefaultType ); - } - CleanupStack::PopAndDestroy( &ls ); - } - else - { - iLog->Log( _L("LoadFileLC: WARNING Failed to connect rapalssession: %d" ), err ); - } - CleanupStack::Pop( nodedata ); - CleanupStack::PopAndDestroy( &file ); - CleanupStack::PopAndDestroy( &fs ); - CleanupStack::PushL( nodedata ); - return nodedata ; - } - -HBufC8 *Cdmatest::LoadFileLC( const TDesC8 &aFileName, TDataType &aType ) - { - TFileName fn ; - fn.Copy( aFileName ); - return LoadFileLC( fn, aType ); - } - - -void Cdmatest::SaveDataL( TInt /*aResultsRef*/, CBufBase& aObject, - const TDesC8& aType ) - { - iLog->Log( _L8( "Saving data of type: '%S'" ), &aType ); - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - RFile file; - User::LeaveIfError( file.Replace ( fs, iSaveFileName, EFileWrite ) ); - CleanupClosePushL( file ); - TPtrC8 p( aObject.Ptr( 0 ) ); - User::LeaveIfError( file.Write( p ) ); - CleanupStack::PopAndDestroy( 2 ); // file, fs - } - - - -void Cdmatest::FetchNodeResultsL( TInt /*aResultsRef*/, CBufBase& aObject, - const TDesC8& /*aType*/ ) - { - TPtrC8 ptr( aObject.Ptr( 0 ) ); - iLog->Log( _L8("FetchNodeResultsL for '%S': '%S'" ), iURI, &ptr ); - - if ( ptr.Length() > 0 ) - { - TPtrC8 last( LastURISeg( ptr ) ); - HBufC8 *oldUri = HBufC8::NewL( iURI->Length() ); - (*oldUri) = *iURI; - do - { - iLog->Log ( _L8( " Node: '%S' "), &last ); - HBufC8 *nUri = HBufC8::NewLC( oldUri->Length() + 1 + last.Length() ); - nUri->Des().Copy( *oldUri ) ; - nUri->Des().Append( '/' ); - nUri->Des().Append( last ); - - SetURIL( nUri ); - //iResultsFunction = FetchNodeResultsL; - - //TPtrC8 parentURI(RemoveLastSeg(*nUri)); - //HBufC8 *luid = GetLuidAllocLC( parentURI ); - CleanupStack::Pop( nUri ); - - HBufC8 *luid = GetLuidAllocLC( *iURI ); - - Adapter()->ChildURIListL( *nUri, KNullDesC8, *iEmptyMappingInfoArray, 4, 5 );//Dipak - - CleanupStack::PopAndDestroy( luid ); - - ptr.Set( RemoveLastURISeg( ptr ) ); - last.Set( LastURISeg( ptr ) ); - - } - while (last != KNullDesC8); - } - - } - - - -TPtrC8 Cdmatest::LastURISeg( const TDesC8& aURI ) - { - TInt i; - for( i = aURI.Length() - 1; i >= 0; i-- ) - { - if( aURI[i] == '/' ) - { - break; - } - } - - if( i == 0 ) - { - return aURI; - } - else - { - return aURI.Mid( i+1 ); - } - } -TPtrC8 Cdmatest::RemoveLastSeg(const TDesC8& aURI) - { - TInt i; - for(i=aURI.Length()-1;i>=0;i--) - { - if(aURI[i]==KNSmlDMUriSeparator) - { - break; - } - } - - if(i>0) - { - return aURI.Left(i); - } - else - { - return KNullDesC8(); - } - } - -// ------------------------------------------------------------------------------------------------ -// TPtrC8 Cdmatest::RemoveLastURISeg(const TDesC8& aURI) -// returns parent uri, i.e. removes last uri segment -// ------------------------------------------------------------------------------------------------ -TPtrC8 Cdmatest::RemoveLastURISeg( const TDesC8& aURI ) - { - TInt i; - for ( i = aURI.Length() - 1; i >= 0 ; i-- ) - { - if( aURI[i] == '/' ) - { - break; - } - } - if ( i > -1 ) - { - return aURI.Left( i ); - } - else - { - return KNullDesC8(); - } - } - -TPtrC Cdmatest::RemoveLastURISeg( const TDesC& aURI ) - { - TInt i; - for ( i = aURI.Length() - 1; i >= 0 ; i-- ) - { - if( aURI[i] == '/' ) - { - break; - } - } - if ( i > -1 ) - { - return aURI.Left( i ); - } - else - - { - return KNullDesC(); - } - } - -void Cdmatest::SetURIL( const TDesC& aURI ) - { - if ( iURI != NULL ) - { - delete iURI ; - iURI = NULL; - } - iURI = HBufC8::NewL( aURI.Length() ) ; - iURI->Des().Copy( aURI ); - } - -void Cdmatest::SetURIL( const TDesC8& aURI ) - { - if ( iURI != NULL ) - { - delete iURI ; - iURI = NULL; - } - iURI = HBufC8::NewL( aURI.Length() ) ; - iURI->Des().Copy( aURI ); - } - -void Cdmatest::SetURIL( HBufC8* aURI ) - { - if ( iURI != NULL ) - { - delete iURI ; - iURI = NULL; - } - iURI = aURI ; - } - - - -void Cdmatest::SetResultsL( - TInt aResultsRef, - CBufBase& aObject, - const TDesC8& aType ) - { - TPtrC8 ptr( aObject.Ptr(0) ); - iLog->Log( _L8( "SetResults, ref=%d, object='%S', type='%S'" ), aResultsRef, &ptr, &aType ); - if ( iResultsFunction ) - { - (this->*iResultsFunction)( aResultsRef, aObject, aType ); - iResultsFunction = NULL ; - } - - } - - -void Cdmatest::SetStatusL( TInt aStatusRef, - MSmlDmAdapter::TError aErrorCode ) - { - iStatus = aErrorCode ; - iLog->Log( _L( "SetStatusL, ref=%d, code=%d" ), aStatusRef, aErrorCode ); - - - } - -void Cdmatest::SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ) - { - iLog->Log( _L8( "SetMappingL, aURI='%s', aLUID='%s'" ), aURI.Ptr(), aLUID.Ptr() ); - - iMappingTable.Append(TMapping( aURI, aLUID ) ) ; - } - -HBufC8* Cdmatest::GetLuidAllocL( const TDesC8& aURI ) - { - iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); - HBufC8 *res = NULL; - for( TInt i(0); i < iMappingTable.Count(); i++ ) - { - if ( aURI == iMappingTable[i].iURI ) - { - res = iMappingTable[i].iLuid.AllocL(); - } - } - if ( res == NULL ) - { - res = HBufC8::NewL( 0 ); - } - iLog->Log( _L8( "GetLuidAllocL, response='%S'" ), res ); - return res; - } - -HBufC8* Cdmatest::GetLuidAllocLC( const TDesC8& aURI ) - { - iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); - HBufC8 *res = NULL; - for( TInt i(0); i < iMappingTable.Count(); i++ ) - { - if ( aURI == iMappingTable[i].iURI ) - { - res = iMappingTable[i].iLuid.AllocLC(); - break; - } - } - if ( res == NULL ) - { - res = HBufC8::NewLC( 0 ); - } - iLog->Log( _L8( "GetLuidAllocLC, response='%S'" ), res ); - return res ; - } - -#ifdef __TARM_SYMBIAN_CONVERGENCY - -void Cdmatest::GetMappingInfoListL( const TDesC8& /*aURI*/, - CArrayFix& /*aSegmentList*/ ) - { - // do nothing - } - -#else -// nothing -#endif -//*************************************************************************** -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/src/syncmldm12test.cpp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/src/syncmldm12test.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - - - -// INCLUDE FILES -#include -#include "syncmldm12Test.h" -#include - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Csyncmldm12Test::Csyncmldm12Test -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -/*Csyncmldm12Test::Csyncmldm12Test( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - }*/ -Csyncmldm12Test::Csyncmldm12Test( CTestModuleIf& aTestModuleIf ) - : Cdmatest( aTestModuleIf, KAdapterUid ) - { - } -// ----------------------------------------------------------------------------- -// Csyncmldm12Test::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void Csyncmldm12Test::ConstructL() - { -/* iLog = CStifLogger::NewL( KamtestLogPath, - KamtestLogFile, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse );*///Commented the Part for syncmldm12Test Dipak - iLog = CStifLogger::NewL( KamtestLogPath, - KamtestLogFile, - CStifLogger::ETxt, - CStifLogger::EFile ); - - iLog->Log( _L( "Loading Adapter" ) ); - - Cdmatest::ConstructL(); - - } - -// ----------------------------------------------------------------------------- -// Csyncmldm12Test::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -Csyncmldm12Test* Csyncmldm12Test::NewL( - CTestModuleIf& aTestModuleIf ) - { - Csyncmldm12Test* self = new (ELeave) Csyncmldm12Test( aTestModuleIf ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - - } - -// Destructor -Csyncmldm12Test::~Csyncmldm12Test() - { - - // Delete resources allocated from test methods -// Delete(); - - // Delete logger -// delete iLog; - - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) Csyncmldm12Test::NewL( aTestModuleIf ); - - } - - - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/adapters/syncmldm12/tsrc/src/syncmldm12testBlocks.cpp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/src/syncmldm12testBlocks.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DM adapter test component -* This is part of omadmextensions/adapter test application. -* -*/ - - - - - - -// INCLUDE FILES -#include -#include -#include -#include "syncmldm12Test.h" -#include -#include -#include - - -//using namespace NApplicationManagement;//Dipak - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Csyncmldm12Test::Delete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- -// -void Csyncmldm12Test::Delete() - { - - } - -// ----------------------------------------------------------------------------- -// Csyncmldm12Test::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- -// -TInt Csyncmldm12Test::RunMethodL( - CStifItemParser& aItem ) - { - - TStifFunctionInfo const KFunctions[] = - { - // Copy this line for every implemented function. - // First string is the function name used in TestScripter script file. - // Second is the actual implementation member function. - ENTRY( "DDFStructure", Csyncmldm12Test::DDFStructureL), - ENTRY( "FetchNode", Csyncmldm12Test::FetchNodeL ), - ENTRY( "FetchLeaf", Csyncmldm12Test::FetchLeafL ), - ENTRY( "AddNode", Csyncmldm12Test::AddNodeL ), - ENTRY( "UpdateLeaf", Csyncmldm12Test::UpdateLeafL ), - ENTRY( "UpdateLeafData", Csyncmldm12Test::UpdateLeafDataL ), - ENTRY( "Execute", Csyncmldm12Test::ExecuteLeafL ), - ENTRY( "ExecuteData", Csyncmldm12Test::ExecuteLeafDataL ), - ENTRY( "DeleteNode", Csyncmldm12Test::DeleteObjectL ), - ENTRY( "StartAtomic", Csyncmldm12Test::StartAtomicL), - ENTRY( "CommitAtomic", Csyncmldm12Test::CommitAtomicL), - ENTRY( "RollbackAtomic", Csyncmldm12Test::RollbackAtomicL), - ENTRY( "CompleteCommands", Csyncmldm12Test::CompleteCommandsL), - }; - - const TInt count = sizeof( KFunctions ) / - sizeof( TStifFunctionInfo ); - - return RunInternalL( KFunctions, count, aItem ); - - } - - - -HBufC8 *Csyncmldm12Test::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) - { - TPtrC nodename; - nodename.Set( KNullDesC ); - - TInt i( aItem.GetNextString ( nodename ) ); - if ( i != KErrNone ) - { - iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); - } - else - { - iLog->Log( _L("%S: %S"), &aName, &nodename); - } - - HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; - buf->Des().Copy( nodename ); - - return buf; - } - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/Cpqtsp.pri --- a/deviceupdatesui/cpqtsp/Cpqtsp.pri Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -SOURCES = \ - src/main.cpp \ - src/CpQtSpMainWindow.cpp \ - src/CpQtSpView.cpp \ - src/CWPBioControl.cpp \ - src/CWPNameValue.cpp \ - src/CWPStringPair.cpp - -HEADERS = \ - inc/CpQtSpMainWindow.h \ - inc/CpQtSpView.h \ - inc/CWPBioControl.h \ - inc/CWPNameValue.h \ - inc/CWPStringPair.h \ - inc/ProvisioningUIDs.h \ - inc/ProvisioningDebug.h \ - ../../../../mw/remotemgmt/omaprovisioning/provisioning/ProvisioningEngine/Inc diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/cpqtsp.pro --- a/deviceupdatesui/cpqtsp/cpqtsp.pro Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# -# -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -TEMPLATE=app -TARGET=Cpqtsp - -symbian: { - TARGET.CAPABILITY = CAP_APPLICATION - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.UID3 = 0x2002DD2B - BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " - BLD_INF_RULES.prj_exports += "rom/cpqtsp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(cpqtsp.iby)" - BLD_INF_RULES.prj_exports += "rom/cpsqtsp_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(cpsqtsp_resources.iby)" -} - -CONFIG += hb service -include(Cpqtsp.pri) -LIBS+=-lxqservice -lxqserviceutil -lflogger -MMP_RULES += "LIBRARY msgs.lib centralrepository.lib provisioningengine.lib featmgr.lib" - -TRANSLATIONS += deviceupdates.ts - -SERVICE.FILE = resources/service_conf.xml -SERVICE.OPTIONS = embeddable -SERVICE.OPTIONS += hidden - -libFiles.sources = xqservice.dll -libFiles.path = "!:\sys\bin" -DEPLOYMENT += libFiles - -MOC_DIR = moc - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/inc/CWPBioControl.h --- a/deviceupdatesui/cpqtsp/inc/CWPBioControl.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Bio control for Provisioning documents. -* -*/ - - -#ifndef CWPBIOCONTROL_H -#define CWPBIOCONTROL_H - -// INCLUDES -#include -#include -#include "CWPBootstrap.h" - -class CWPEngine; -class CWPNameValue; -class CWPPushMessage; -class CWPBootstarp; - -// CLASS DECLARATION - -/** - * Bio control for OMA Provisioning messages. - * @since 2.0 - */ - - class CDummyObserver : public CBase, public MMsvSessionObserver -{ -public: - void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {}; -}; - - -class CWPBioControl//: public CMsgBioControl - { - public: // Constructor and destructor - - /** - * Two-phased constructor. - * @param aObserver Reference to the Bio control observer. - * @param aSession Reference to Message Server session. - * @param aId Id of the message. - * @param aEditorOrViewerMode Enum for the mode, is it as editor or viewer. - * @param aFileName The newly created object. - * @param aFile file handle to provisioning content. - */ - IMPORT_C static CWPBioControl* NewL( CMsvSession* aSession,TMsvId aId); - ~CWPBioControl(); - RPointerArray* CollectItemsLC() const; - CWPEngine* returnEngine(); - - private: // Constructors - - /** - * Constructor is prohibited. - * @param aObserver Reference to the Bio control observer. - * @param aSession Reference to Message Server session. - * @param aId Id of the message in Message Server. - * @param aEditorOrViewerMode Enum for the mode, is it as editor or viewer. - * @param aFileName The newly created object. - * @param aFile file handle to provisioning content. - */ - CWPBioControl( CMsvSession* aSession,TMsvId aId); - void ConstructL(CMsvSession* aSession,TMsvId aId); - - private: - - void AddItemsL(); - void CollateAndAddItemsL( RPointerArray& aItems ); - void DoSaveL(); - void AuthenticateL( CWPPushMessage& aMessage ); - void RestoreMsgL(); - static TInt Compare( const CWPNameValue& aImpl1,const CWPNameValue& aImpl2 ); - void SaveSettingsL(); - void SetCenrepKeyL(const TDesC8& aValue); - void SaveMessageL(); - static void Cleanup( TAny* aAny ); - - private: - CWPEngine* iEngine; - CWPPushMessage* iMessage; - CDummyObserver* iObserver; - CMsvSession* iSession; - TMsvId iId; - TMsvEntry iEntry; - }; - - - -#endif // CWPBIOCONTROL_H - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/inc/CWPNameValue.h --- a/deviceupdatesui/cpqtsp/inc/CWPNameValue.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This class encapsulates a name and value pair. -* -*/ - - - -#ifndef _CWPNameValue_H_ -#define _CWPNameValue_H_ - -// INCLUDES - -#include // CBase - -// CLASS DECLARATION - -/** - * Class holds name and value text pairs. - */ -class CWPNameValue : public CBase - { - public: // construction - - /** - * Two phased constructor. - * @param aName The field name. - * @param aValue The field value. - * @return The newly constructed object. - */ - IMPORT_C static CWPNameValue* NewL( HBufC* aName, HBufC* aValue ); - IMPORT_C static CWPNameValue* NewL(const TDesC& aName, const TDesC& aValue); - IMPORT_C static CWPNameValue* NewLC(const TDesC& aName, const TDesC& aValue); - - /// Destructor - ~CWPNameValue(); - - public: // new functions - - /// @return Name or KNullDesC - IMPORT_C const TDesC& Name() const; - /// @return Value or KNullDesC - IMPORT_C const TDesC& Value() const; - - private: // construction - - /** - * Second phase constructor. - * @param aName The field name. - * @param aValue The field value. - */ - void ConstructL( const TDesC& aName, const TDesC& aValue ); - - /** - * Second phase constructor. - * @param aName The field name. - * @param aValue The field value. - */ - void ConstructL( HBufC* aName, HBufC* aValue ); - - private: // hidden - - /// Default constructor. - CWPNameValue(); - - /// Another constructor - CWPNameValue( HBufC* aName, HBufC* aValue ); - - /// Copy contructor prohibited. - CWPNameValue(const CWPNameValue& aSource); - - /// Assignment operator prohibited. - const CWPNameValue& operator=(const CWPNameValue& aSource); - - private: - - /// Own. Pointer to the name. - HBufC* iName; - - /// Own. Pointer to the value. - HBufC* iValue; - }; - -#endif // _CWPNameValue_H_ - -// End of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/inc/CWPStringPair.h --- a/deviceupdatesui/cpqtsp/inc/CWPStringPair.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Sortable string pair. -* -*/ - - -#ifndef CWPSTRINGPAIR_H -#define CWPSTRINGPAIR_H - -// INCLUDES -#include - -// CLASS DECLARATION - -/** - * Sortable string pair - */ -class CWPStringPair : public CBase - { - public: - /** - * C++ default constructor. - */ - CWPStringPair(); - - /** - * Destructor. - */ - ~CWPStringPair(); - - public: - /** - * Sets the values for string pair. - * @param aName The name of the string - * @param aValue The value of the string - */ - void SetL( const TDesC& aName, const TDesC& aValue ); - - public: - // Points to iName. Use for constructing TKeyArrayFixPtr. - TPtrC iNamePtr; - - // Points to iValue. Use for constructing TKeyArrayFixPtr. - TPtrC iValuePtr; - - private: - // The name of the pair. Owns. - HBufC* iName; - - // The value of the pair. Owns. - HBufC* iValue; - }; - -#endif // CWPSTRINGPAIR_H - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/inc/CpQtSpMainWindow.h --- a/deviceupdatesui/cpqtsp/inc/CpQtSpMainWindow.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* -*/ - -#ifndef CPQTSPMAINWINDOW_H -#define CPQTSPMAINWINDOW_H - -#include - -class CpQtSpView; -class CpQtSp; - -class CpQtSpMainWindow : public HbMainWindow -{ - Q_OBJECT - -public: - CpQtSpMainWindow(QWidget *parent=0); - ~CpQtSpMainWindow(); -public slots: - void showView(); - -private: - CpQtSp* iServiceProvider; - CpQtSpView* iView; -}; - -#endif // CPQTSPMAINWINDOW_H diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/inc/CpQtSpView.h --- a/deviceupdatesui/cpqtsp/inc/CpQtSpView.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* -*/ - -#ifndef CPQTSPVIEW_H -#define CPQTSPVIEW_H - -#include -#include -#include -#include -#include -#include -#include - -class CObserver : public CBase, public MMsvSessionObserver -{ -public: - void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {}; -}; - - -class CpQtSp; -class XQServiceRequest; - -class CpQtSpView : public HbView -{ - Q_OBJECT - -public: - CpQtSpView(CpQtSp* service,QGraphicsItem *parent = 0); - ~CpQtSpView(); - void constructView(); - -public slots: - void requestCompleted(const QVariant& value); - void saveProvisoningMessage(); -private: - CpQtSp* iServiceProvider; - QGraphicsLinearLayout *layout; - HbFontSpec *iPrimaryFont; - HbFontSpec *iSecondaryFont; - RPointerArray* iArray; - CWPBioControl* iBio; -}; - -class CpQtSp : public XQServiceProvider -{ - Q_OBJECT -public: - CpQtSp( QObject *parent = 0 ); - ~CpQtSp(); - void complete(); - TMsvId returnId(); - CMsvSession* returnSession(); - -Q_SIGNALS: - void showView(); - -public slots: - QString ProcessMessage(const QString& number); - -private: - TMsvId iId; - CObserver* iObserver; - CMsvSession* iSession; -}; - -#endif // CPQTSPVIEW_H diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/inc/ProvisioningDebug.h --- a/deviceupdatesui/cpqtsp/inc/ProvisioningDebug.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file defines logging macros for Provisioning -* -*/ - - - -#ifndef PROVISIONINGDEBUG_H -#define PROVISIONINGDEBUG_H - -#include - -//Examples -//FLOG( _L( "[Provisioning] ProvisioningEngine::ConstructL:" ) ); -//FTRACE(RDebug::Print(_L("[Provisioning] ProvisioningEngine::ConstructL: err (%d)"), err)); -#ifdef _DEBUG - -const TInt KBTHexDumpWidth=16; -const TInt KBTLogBufferSize=100; -const TText KFullStopChar='.'; - -_LIT(KBTFirstFormatString,"%04x: "); -_LIT(KBTSecondFormatString,"%02x "); -_LIT(KBTThirdFormatString,"%c"); -_LIT(KBTThreeSpaces," "); -_LIT(KBTSeparator," "); - -inline void HexDump(const TUint8* aPtr, TInt aLen) - { - if( aPtr != NULL ) - { - TBuf line; - TInt i = 0; - - while (aLen>0) - { - TInt n = (aLen>KBTHexDumpWidth ? KBTHexDumpWidth : aLen); - line.AppendFormat(KBTFirstFormatString,i); - TInt j; - for (j=0; j126 || aPtr[i+j]==37) ? KFullStopChar : aPtr[i+j]); - - RDebug::Print(line); - - line.Zero(); - aLen-=n; - i+=n; - } - } - } - - -// ------------------------------------------ - -inline void FHex(const TUint8* aPtr, TInt aLen) - { - HexDump( aPtr, aLen ); - } - -// ------------------------------------------ - -inline void FHex(const TDesC8& aDes) - { - HexDump(aDes.Ptr(), aDes.Length()); - } - -// =========================================================================== -#ifdef __WINS__ // File logging for WINS -// =========================================================================== -#include -#include -#include - -_LIT( KLogFile, "Provisioning.log" ); -_LIT( KLogDirFullName, "c:\\logs\\" ); -_LIT( KLogDir, "Provisioning" ); - -#define FLOG( a ) { FPrint(a); } -#define FTRACE( a ) { a; } - -// Declare the FPrint function -// -inline void FPrint( const TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - RFileLogger::WriteFormat( KLogDir, - KLogFile, - EFileLoggingModeAppend, - aFmt, - list ); - } - -// =========================================================================== -#else // RDebug logging for target HW -// =========================================================================== -#include - -#define FLOG( a ) { RDebug::Print( a ); } -#define FTRACE( a ) { a; } - -#endif //__WINS__ - -// =========================================================================== -#else // // No loggings --> Reduced binary size -// =========================================================================== -#define FLOG( a ) -#define FTRACE( a ) - -#endif // _DEBUG - -#endif // PROVISIONINGDEBUG_H - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/inc/ProvisioningUIDs.h --- a/deviceupdatesui/cpqtsp/inc/ProvisioningUIDs.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: UIDs for project Provisioning -* -*/ - - - -#ifndef PROVISIONINGUID_H -#define PROVISIONINGUID_H - -// CONSTANTS - -/// ECOM plugin -#define KECOMUid2 0x10009D8D - -/// Normal Symbian OS DLL -#define KSymbianDLLUid2 0x1000008d - -/// UID2 for Provisioning BIO control -#define KProvisioningBCUid2 0x10005F5F - -/// UID3 for Provisioning BIO control -#define KProvisioningBCUid3 0x101F84D3 - -/// UID for the Provisioning Message type for BIO database -#define KProvisioningMessageTypeUid 0x101F84D1 - -/// UID2 for the handler plugin for WAP Provisioning documents -#define KProvisioningHandlerUid2 KECOMUid2 - -/// UID3 for the handler plugin DLL for WAP Provisioning documents -#define KProvisioningHandlerUid3 0x101F84D2 - -/// UID for the handler plugin implementation -#define KProvisioningHandlerImplUid 0x101F84D3 - -/// UID of the Content Type Handler plugin interface -#define KProvisioningHandlerInterface 0x101F3E5E - -/// UID2 of the Provisioning Parser DLL -#define KProvisioningParserUid2 KSymbianDLLUid2 - -/// UID3 of the Provisioning Parser DLL -#define KProvisioningParserUid3 0x101F84D4 - -/// UID of the Provisisioning Adapter plugin interface -#define KProvisioningAdapterInterface 0x101F84D5 - -/// UID2 of the Provisioning Engine DLL -#define KProvisioningEngineUid2 KSymbianDLLUid2 - -/// UID3 of the Provisioning Engine DLL -#define KProvisioningEngineUid3 0x101F84D6 - -/// UID for HTTPHeader stream in WAP Provisioning message -#define KProvisioningMessageStreamUid 0x101F84D7 - -/// UID2 for the APAdapter DLL -#define KProvisioningAPAdapterDllUid2 KECOMUid2 - -/// UID3 for the APAdapter DLL -#define KProvisioningAPAdapterDllUid3 0x101F84D8 - -/// UID for the APAdapter -#define KProvisioningAPAdapterUid 0x101F84D9 - -/// UID2 for the Browser+MMSAdapter DLL -#define KProvisioningWAPAdapterDllUid2 KECOMUid2 - -/// UID3 for the Browser+MMSAdapter DLL -#define KProvisioningWAPAdapterDllUid3 0x101F84DC - -/// UID for the BrowserAdapter -#define KProvisioningBrowserAdapterUid 0x101F84DB - -/// UID for the MMSAdapter -#define KProvisioningMMSAdapterUid 0x101F84DD - -/// UID2 for the DataSyncAdapter DLL -#define KProvisioningDataSyncAdapterDllUid2 KECOMUid2 - -/// UID3 for the DataSyncAdapter DLL -#define KProvisioningDataSyncAdapterDllUid3 0x101F84DE - -/// UID for the DataSyncAdapter -#define KProvisioningDataSyncAdapterUid 0x101F84DF - -/// UID2 for the DeviceManagementAdapter DLL -#define KProvisioningDeviceManagementAdapterDllUid2 KECOMUid2 - -/// UID3 for the DeviceManagementAdapter DLL -#define KProvisioningDeviceManagementAdapterDllUid3 0x101F84E0 - -/// UID for the DeviceManagementAdapter -#define KProvisioningDeviceManagementAdapterUid 0x101F84E1 - -/// UID2 for the IMAdapter DLL -#define KProvisioningIMAdapterDllUid2 KECOMUid2 - -/// UID3 for the IMAdapter DLL -#define KProvisioningIMAdapterDllUid3 0x101F84E2 - -/// UID for the IMAdapter -#define KProvisioningIMAdapterUid 0x101F84E3 - -/// UID2 for the StreamingAdapter DLL -#define KProvisioningStreamingAdapterUid2 KECOMUid2 - -/// UID3 for the StreamingAdapter DLL -#define KProvisioningStreamingAdapterDllUid3 0x101F84E6 - -/// UID for the StreamingAdapter -#define KProvisioningStreamingAdapterUid 0x101F84E7 - -/// UID2 for the JavaAdapter DLL -#define KProvisioningJavaAdapterUid2 KECOMUid2 - -/// UID3 for the JavaAdapter DLL -#define KProvisioningJavaAdapterDllUid3 0x101F84E8 - -/// UID for the JavaAdapter -#define KProvisioningJavaAdapterUid 0x101F84E9 - -/// UID2 for Symbian application -#define KProvisioningCxUID2 0x100039CE - -/// UID3 for ProvisioningCx application -#define KProvisioningCxUID3 0x101F8597 - -/// UID for the PresenceAdapter -#define KProvisioningPecAdapterUid 0x102072D3 - -#endif // PROVISIONINGUID_H - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/resources/service_conf.xml --- a/deviceupdatesui/cpqtsp/resources/service_conf.xml Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - OMA CP Service - - OMA CP Service Provider - - \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/rom/cpqtsp.iby --- a/deviceupdatesui/cpqtsp/rom/cpqtsp.iby Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cpqtsp.iby -* -*/ - -#ifndef __CPQTSP_IBY__ -#define __CPQTSP_IBY__ - -#include -#include - -file = ABI_DIR/BUILD_DIR/Cpqtsp.exe PROGRAMS_DIR/Cpqtsp.exe -data = DATAZ_/private/10003a3f/import/apps/Cpqtsp_reg.rsc private/10003a3f/import/apps/Cpqtsp_reg.rsc - -data=/epoc32/data/z/resource/plugins/devicedialogs/devicemanagementnotifiersplugin.qtplugin resource/plugins/devicedialogs/devicemanagementnotifiersplugin.qtplugin -file=ABI_DIR/BUILD_DIR/devicemanagementnotifiersplugin.dll SHARED_LIB_DIR/devicemanagementnotifiersplugin.dll - -#endif \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/rom/cpsqtsp_resources.iby --- a/deviceupdatesui/cpqtsp/rom/cpsqtsp_resources.iby Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cpqtspresources.iby -* -*/ - -#ifndef __CPQTSP_RESORCES_IBY__ -#define __CPQTSP_RESORCES_IBY__ - -#include - - -data=DATAZ_/resource/apps/Cpqtsp.rsc /resource/apps/Cpqtsp.rsc - - -#endif \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/src/CWPBioControl.cpp --- a/deviceupdatesui/cpqtsp/src/CWPBioControl.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,312 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Bio control for Provisioning documents. -* -*/ - -// INCLUDE FILES -#include "CWPBioControl.h" -#include -#include -#include -#include -#include -#include "CWPEngine.h" -#include "CWPAdapter.h" -#include "MWPPhone.h" -#include "WPPhoneFactory.h" -#include "CWPPushMessage.h" -#include "ProvisioningUIDs.h" -#include "MWPContextManager.h" -#include "ProvisioningDebug.h" -#include "CWPNameValue.h" -#include -#include "ProvisioningInternalCRKeys.h" - -// CONSTANTS -/// Maximum length of PIN code -const TInt KMaxPinSize = 20; -/// Number of retries for PIN -// const TInt KPinRetries = 3; // Removed, because iMtmData1 data member of TMsvEntry in CWPMessage.cpp contains Max tries, default=3. -///NONE -_LIT(KNone,""); - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Constructor. -// ----------------------------------------------------------------------------- -// -CWPBioControl::CWPBioControl(CMsvSession* aSession,TMsvId aId) - - { - } - -// ----------------------------------------------------------------------------- -// CWPBioControl::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPBioControl::ConstructL(CMsvSession* aSession,TMsvId aId) - { - FLOG( _L( "[ProvisioningBC] CWPBioControl::ConstructL:" ) ); - FeatureManager::InitializeLibL(); - iSession = aSession; - iId = aId; - iEngine = CWPEngine::NewL(); - RestoreMsgL(); - FLOG( _L( "[ProvisioningBC] CWPBioControl::ConstructL: done" ) ); - } - -// ----------------------------------------------------------------------------- -// CWPBioControl::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CWPBioControl* CWPBioControl::NewL(CMsvSession* aSession,TMsvId aId) - { - CWPBioControl* self = new( ELeave ) CWPBioControl(aSession,aId); - CleanupStack::PushL( self ); - self->ConstructL(aSession,aId); - CleanupStack::Pop(); - return self; - } -// ----------------------------------------------------------------------------- -// CWPBioControl::returnEngine -// Return CWPEngine pointer -// ----------------------------------------------------------------------------- -// -EXPORT_C CWPEngine* CWPBioControl::returnEngine() - { - return iEngine; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPBioControl::~CWPBioControl() - { - delete iEngine; - delete iMessage; - FeatureManager::UnInitializeLib(); - } -// ---------------------------------------------------------------------------- -// CWPBioControl ::RestoreMsgL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::RestoreMsgL() - { - CMsvEntry* entry = iSession->GetEntryL(iId); - CleanupStack::PushL( entry ); - TMsvEntry tentry( entry->Entry() ); - iMessage = CWPPushMessage::NewL(); - CMsvStore* readStore = entry->ReadStoreL(); - CleanupStack::PushL( readStore ); - iMessage->RestoreL( *readStore ); - CleanupStack::PopAndDestroy(); // readStore - - TRAPD( result, iEngine->ImportDocumentL( iMessage->Body() ) ); - if( result == KErrCorrupt ) - { - //result = KErrMsgBioMessageNotValid; - } - FTRACE(RDebug::Print(_L("[ProvisioningBC] CWPBioControl::RestoreMsgL result (%d)"), result)); - User::LeaveIfError( result ); - - TBool preAuthenticated( iMessage->Authenticated() ); - // If the message was not authenticated, give a warning - AuthenticateL( *iMessage ); - if( !tentry.ReadOnly() && preAuthenticated != iMessage->Authenticated() ) - { - // If the entry can be written to, get its edit store and save - // authentication flag. Failing is not dangerous, as the only - // effect is that the user has to re-enter the PIN. - // FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 4 " ) ); - TRAPD( ignoreError, SaveMessageL() ); - if ( ignoreError ) ignoreError = 0; // prevent compiler warning - } - - iEngine->PopulateL(); - if( iEngine->ItemCount() == 0 ) - { - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 7 " ) ); - } - - TPtrC8 orig8( iMessage->Originator() ); - HBufC* orig16 = HBufC::NewLC( orig8.Length() ); - orig16->Des().Copy( orig8 ); - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 8 " ) ); - if( iMessage->Authenticated() - && iEngine->ContextExistsL( *orig16 ) ) - { - TUint32 context( iEngine->ContextL( *orig16 ) ); - iEngine->SetCurrentContextL( context ); - } - else - { - iEngine->SetCurrentContextL( KWPMgrUidNoContext ); - } - - - CleanupStack::PopAndDestroy(2); - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL done" ) ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::AuthenticateL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::AuthenticateL( CWPPushMessage& aMessage ) - { - if( !aMessage.Authenticated() ) - { - MWPPhone* phone = NULL; - TBuf imsi; - TRAPD(err, phone = WPPhoneFactory::CreateL()); - if(err!=KErrNone) - { - imsi = KNone; - } - else - { - imsi = phone->SubscriberId(); - } - CWPBootstrap* bootstrap = CWPBootstrap::NewL( imsi ); - if(phone) - delete phone; - - CleanupStack::PushL( bootstrap ); - CWPBootstrap::TBootstrapResult result( bootstrap->BootstrapL(aMessage,*iEngine,KNullDesC ) ); - if( result == CWPBootstrap::EPinRequired ) - { - CMsvEntry* entry = iSession->GetEntryL(iId); - TInt count = (entry->Entry()).MtmData1(); - TInt ipin = 1234; - TBuf pin; - pin.AppendNum(ipin); - result = bootstrap->BootstrapL( aMessage, *iEngine, pin ); - CleanupStack::PopAndDestroy( bootstrap ); - } - } - if (aMessage.Authenticated() ) - { - //update Cenrep key - TBuf8<100> orig; - orig.Copy(aMessage.Originator()); - TRAPD(err, SetCenrepKeyL(orig)); - User::LeaveIfError(err); - - } - } -// ---------------------------------------------------------------------------- -// CWPBioControl ::SaveMessageL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SaveMessageL() - { - CMsvEntry* entry = iSession->GetEntryL(iId); - CleanupStack::PushL( entry ); - - CMsvStore* editStore = entry->EditStoreL(); - CleanupStack::PushL( editStore ); - iMessage->StoreL( *editStore ); - editStore->CommitL(); - CleanupStack::PopAndDestroy(2); // editStore, entry - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::CollectItemsL -// ---------------------------------------------------------------------------- -// -EXPORT_C RPointerArray* CWPBioControl::CollectItemsLC() const - { - RPointerArray* array = new(ELeave) RPointerArray; - CleanupStack::PushL( TCleanupItem( Cleanup, array ) ); - - TInt count( iEngine->ItemCount() ); - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 83 " ) ); - for( TInt index = 0; index < count; index++ ) - { - const TDesC& text = iEngine->SummaryText( index ); - const TDesC& title = iEngine->SummaryTitle( index ); - - CWPNameValue* pair = CWPNameValue::NewLC( title, text ); - User::LeaveIfError( array->Append( pair ) ); - CleanupStack::Pop( pair ); - } - array->Sort( TLinearOrder( CWPBioControl::Compare ) ); - return array; - } - -// ----------------------------------------------------------------------------- -// CWPBioControl::Cleanup -// ----------------------------------------------------------------------------- -// -void CWPBioControl::Cleanup( TAny* aAny ) - { - RPointerArray* array = reinterpret_cast*>( aAny ); - array->ResetAndDestroy(); - array->Close(); - delete array; - } - -// ----------------------------------------------------------------------------- -// CWPBioControl::Compare -// ----------------------------------------------------------------------------- -// -TInt CWPBioControl::Compare( const CWPNameValue& aItem1, - const CWPNameValue& aItem2 ) - { - return aItem1.Name().Compare( aItem2.Name() ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::SetCenrepKey -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SetCenrepKeyL(const TDesC8& aValue) - { - - FLOG( _L( "[ProvisioningBC] CWPBioControl::SetCenrepKeyL" ) ); - - CRepository* rep= NULL; - TInt errorStatus = KErrNone; - - TRAPD( errVal, rep = CRepository::NewL( KCRUidOMAProvisioningLV )) - ; - - if (errVal == KErrNone) - { - errorStatus = rep->Set(KOMAProvOriginatorContent, aValue); - } - else - { - errorStatus = errVal; - } - - if (rep) - { - delete rep; - } - - if (errorStatus != KErrNone) - { - User::Leave(errorStatus); - } - - FLOG( _L( "[ProvisioningBC] CWPBioControl::SetCenrepKeyL done" ) ); - - } -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/src/CWPNameValue.cpp --- a/deviceupdatesui/cpqtsp/src/CWPNameValue.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This class encapsulates a name and value pair -* -*/ - - -// INCLUDE FILES - -#include "CWPNameValue.h" - -// MEMBER FUNCTIONS - -EXPORT_C CWPNameValue* CWPNameValue::NewL( HBufC* aName, HBufC* aValue) - { - CWPNameValue* self = new (ELeave) CWPNameValue(aName, aValue); - return self; - } - -EXPORT_C CWPNameValue* CWPNameValue::NewL(const TDesC& aName, const TDesC& aValue) - { - CWPNameValue* self = CWPNameValue::NewLC( aName, aValue ); - CleanupStack::Pop( self ); - return self; - } - -EXPORT_C CWPNameValue* CWPNameValue::NewLC(const TDesC& aName, const TDesC& aValue) - { - CWPNameValue* self = new (ELeave) CWPNameValue; - CleanupStack::PushL(self); - self->ConstructL(aName, aValue); - return self; - } - -CWPNameValue::~CWPNameValue() - { - delete iName; - delete iValue; - } - -EXPORT_C const TDesC& CWPNameValue::Name() const - { - if (iName) - { - return *iName; - } - return KNullDesC; - } - -EXPORT_C const TDesC& CWPNameValue::Value() const - { - if (iValue) - { - return *iValue; - } - return KNullDesC; - } - -void CWPNameValue::ConstructL(const TDesC& aName, const TDesC& aValue) - { - aName.Length()==0 ? iName=KNullDesC().AllocL() : iName = aName.AllocL(); - aValue.Length()==0 ? iValue=KNullDesC().AllocL() : iValue = aValue.AllocL(); - } - -CWPNameValue::CWPNameValue() - { - } - -CWPNameValue::CWPNameValue( HBufC* aName, HBufC* aValue ) : - iName(aName), - iValue(aValue) - { - } - -// end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/src/CWPStringPair.cpp --- a/deviceupdatesui/cpqtsp/src/CWPStringPair.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Sortable pair of strings. -* -*/ - - -// INCLUDE FILES -#include "CWPStringPair.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// C++ default constructor. -CWPStringPair::CWPStringPair() - { - } - -// Destructor -CWPStringPair::~CWPStringPair() - { - delete iName; - delete iValue; - } - -// --------------------------------------------------------- -// CWPStringPair::SetL -// --------------------------------------------------------- -// -void CWPStringPair::SetL( const TDesC& aName, const TDesC& aValue ) - { - HBufC* name = aName.AllocLC(); - HBufC* value = aValue.AllocL(); - CleanupStack::Pop(); // name - - delete iName; - iName = name; - iNamePtr.Set( *iName ); - - delete iValue; - iValue = value; - iValuePtr.Set( *iValue ); - } - -// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/src/CpQtSpMainWindow.cpp --- a/deviceupdatesui/cpqtsp/src/CpQtSpMainWindow.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Bio control for Provisioning documents. -* -*/ - -#include -#include -#include - - -CpQtSpMainWindow::CpQtSpMainWindow(QWidget *parent) - : HbMainWindow(parent) -{ - iServiceProvider = new CpQtSp(); - connect(iServiceProvider,SIGNAL(showView()),this, SLOT(showView())); - iView = new CpQtSpView(iServiceProvider); - } - -CpQtSpMainWindow::~CpQtSpMainWindow() -{ - delete iView; - delete iServiceProvider; -} - -void CpQtSpMainWindow::showView() -{ - iView->constructView(); - addView(iView); -} diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/src/CpQtSpView.cpp --- a/deviceupdatesui/cpqtsp/src/CpQtSpView.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Bio control for Provisioning documents. -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -CpQtSpView::CpQtSpView(CpQtSp* service,QGraphicsItem *parent) - : HbView(parent), iServiceProvider(service) -{ - setTitle(tr("Messaging")); - HbToolBar* toolBar = this->toolBar(); - HbMenu* menu = this->menu(); - HbAction* saveAction = new HbAction("Save"); - connect(saveAction, SIGNAL(triggered()), this, SLOT(saveProvisoningMessage())); - HbAction* DeleteAction = new HbAction("Delete"); - - toolBar->addAction(saveAction); - toolBar->addAction(DeleteAction); - toolBar->setOrientation(Qt::Horizontal); - iPrimaryFont = new HbFontSpec(HbFontSpec::Primary); - iSecondaryFont = new HbFontSpec(HbFontSpec::Secondary); - - layout = new QGraphicsLinearLayout(Qt::Vertical, this); - - QString str = hbTrId("txt_device_update_dblist_configuration_message"); - QString str1 = hbTrId("txt_device_update_dblist_product_code_val_save_to"); - HbTextItem* mPrimaryItem = new HbTextItem(str, this); - HbTextItem* mSecondaryItem = new HbTextItem(str1, this); - - QFont font = iPrimaryFont->font(); - mPrimaryItem->setFont(font); - - font = iSecondaryFont->font(); - mSecondaryItem->setFont(font); - - layout->addItem(mPrimaryItem); - layout->addItem(mSecondaryItem); - - setLayout(layout); - } - -void CpQtSpView::constructView() -{ - iBio = CWPBioControl::NewL(iServiceProvider->returnSession(),iServiceProvider->returnId()); - RPointerArray* iArray = iBio->CollectItemsLC(); - TBufC<200> Name; - TBufC<200> Value; - HbTextItem* mPrimaryItem[100]; - HbTextItem* mSecondaryItem[100]; - HbTextItem* mSecondaryItemBlank = new HbTextItem("", this); - QFont pfont = iPrimaryFont->font(); - QFont sfont = iSecondaryFont->font(); - - TBuf<200> currentTitle(KNullDesC); - - for( TInt item = 0; item < iArray->Count(); item++ ) - { - CWPNameValue* pair = ((*iArray)[item]); - Name = pair->Name(); - if(Name.Compare(currentTitle) !=0 ) - { - QString qname((QChar*)Name.Ptr(),Name.Length()); - mPrimaryItem[item] = new HbTextItem(qname); - mPrimaryItem[item]->setFont(pfont); - layout->addItem(mSecondaryItemBlank); - layout->addItem(mPrimaryItem[item]); - currentTitle.Copy(Name); - } - - Value = pair->Value(); - QString qvalue((QChar*)Value.Ptr(),Value.Length()); - mSecondaryItem[item] = new HbTextItem(qvalue); - mSecondaryItem[item]->setFont(sfont); - layout->addItem(mSecondaryItem[item]); - } - CleanupStack::PopAndDestroy(); - -} - -void CpQtSpView::saveProvisoningMessage() -{ - CWPEngine* engine = iBio->returnEngine(); - int errSave = KErrNone; - - for(TInt i=0; i < engine->ItemCount(); i++) - { - TRAP( errSave, engine->SaveL(i) ); - } - - if( errSave == KErrNone ) - { - //For testing purpose. Will be removed in future. - //HbMessageBox::launchInformationMessageBox("Message Saved"); - } -} - -CpQtSpView::~CpQtSpView() -{ - delete iBio; -} - -void CpQtSpView::requestCompleted(const QVariant& value) -{ -} - - -CpQtSp::CpQtSp(QObject* parent) -: XQServiceProvider("com.nokia.services.MDM.Provisioning",parent) -{ - publishAll(); -} - -CpQtSp::~CpQtSp() -{ - delete iObserver; - delete iSession; -} - -void CpQtSp::complete() -{ - QString retvalue =""; - completeRequest(1,retvalue); -} - -QString CpQtSp::ProcessMessage(const QString& tmsvid) -{ - iId = tmsvid.toInt(); - TMsvSelectionOrdering sort; - sort.SetShowInvisibleEntries(ETrue); - iObserver = new(ELeave) CObserver; - iSession = CMsvSession::OpenSyncL(*iObserver); - emit showView(); - setCurrentRequestAsync(); - return ""; - } - -TMsvId CpQtSp::returnId() -{ - return iId; -} - -CMsvSession* CpQtSp::returnSession() -{ - return iSession; -} diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/cpqtsp/src/main.cpp --- a/deviceupdatesui/cpqtsp/src/main.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Bio control for Provisioning documents. -* -*/ - -#include -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - HbApplication a( argc, argv ); - - QTranslator *translator = new QTranslator(); - QString lang = QLocale::system().name(); - QString path = "Z:/resource/qt/translations/"; - bool fine = translator->load("deviceupdates_en.qm", path); - if (fine) - qApp->installTranslator(translator); - - QTranslator *commontranslator = new QTranslator(); - fine = commontranslator->load("common_" + lang, path); - if (fine) - qApp->installTranslator(commontranslator); - - CpQtSpMainWindow mainWindow; - mainWindow.show(); - return a.exec(); -} - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/PnpUtilLogger.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/PnpUtilLogger.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __LOGGER_H__ -#define __LOGGER_H__ - -#ifdef _DEBUG - #define LOGGING_ENABLED -#endif -#ifdef LOGGING_ENABLED // This must be enabled to use logging system - -#define LOGGER_LOGGING // Log to Logger - - - -#ifdef LOGGER_LOGGING - -// INCLUDES -#include - -// LOG SETTINGS -_LIT( KPnpLogFolder, "PnP" ); -_LIT( KPnpLogFile, "PnPUtil.TXT" ); - -#endif - -// CONSTANTS -// None. - -// MACROS -/* ------------------------------------------------------------------------------ - - INTERNAL MACROs. - - DO NOT USE THESE DIRECTLY !!! - SEE EXTERNAL MACROS - ------------------------------------------------------------------------------ -*/ - -#ifdef LOGGER_LOGGING - -_LIT( KTextFormat, "%S%S" ); -_LIT( KPnpUtil, "PnpUtil| " ); - -#define INTRLOGTEXT( AAA ) \ - { \ - RFileLogger::Write( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, AAA ); \ - } -#define INTRLOGSTRING( AAA ) \ - { \ - _LIT( tempLogDes, AAA ); \ - RFileLogger::Write( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, tempLogDes() ); \ - } -// 20 chars is left for the formatted item -#define INTRLOGSTRING2( AAA, BBB ) \ - { \ - _LIT( tempLogDes, AAA ); \ - RFileLogger::WriteFormat( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, TRefByValue( tempLogDes()), BBB ); \ - } -// 40 chars is left for the formatted items -#define INTRLOGSTRING3( AAA, BBB, CCC ) \ - { \ - _LIT( tempLogDes, AAA ); \ - RFileLogger::WriteFormat( KPnpLogFolder(), KPnpLogFile(), EFileLoggingModeAppend, TRefByValue( tempLogDes()), BBB, CCC ); \ - } -#else -#define INTRLOGTEXT( AAA ) -#define INTRLOGSTRING( AAA ) -#define INTRLOGSTRING2( AAA, BBB ) -#define INTRLOGSTRING3( AAA, BBB, CCC ) -#endif - -/* ------------------------------------------------------------------------------ - - EXTERNAL MACROs - - USE THESE MACROS IN YOUR CODE ! - ------------------------------------------------------------------------------ -*/ - - -#define LOGTEXT( AAA ) { \ - INTRLOGTEXT( AAA ); \ - } // Example: LOGTEXT( own_desc ); - -#define LOGSTRING( AAA ) { \ - INTRLOGSTRING( AAA ); \ - } // Example: LOGSTRING( "Test" ); - -#define LOGSTRING2( AAA, BBB ) { \ - INTRLOGSTRING2( AAA, BBB ); \ - } // Example: LOGSTRING( "Test %i", aValue ); - -#define LOGSTRING3( AAA, BBB, CCC ) { \ - INTRLOGSTRING3( AAA, BBB, CCC ); \ - } // Example: LOGSTRING( "Test %i %i", aValue1, aValue2 ); - - -#else // LOGGING_ENABLED - -#define LOGTEXT( AAA ) -#define LOGSTRING( AAA ) -#define LOGSTRING2( AAA, BBB ) -#define LOGSTRING3( AAA, BBB, CCC ) - -#endif // LOGGING_ENABLED - -// DATA TYPES -// None. - -// FUNCTION PROTOTYPES -// None. - -// FORWARD DECLARATIONS -// None. - -// CLASS DECLARATION -// None. - -#endif // __LOGGER_H__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierdevman.qrc --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierdevman.qrc Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - dialog.docml - dialoginformative.docml - dialogserverpushconfirm.docml - - - iconnotifier.svg - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierplugin.cpp --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierplugin.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -#include -#include "devicemanagementnotifierplugin_p.h" -#include "devicemanagementnotifierwidget_p.h" - - -Q_EXPORT_PLUGIN2(devicemanagementnotifiersplugin, devicemanagementnotifierplugin) - -// This plugin implements one device dialog type -static const struct { - const char *mTypeString; -} dialogInfos[] = { - {"com.nokia.hb.devicemanagementdialog/1.0"} -}; - -class devicemanagementnotifierpluginprivate -{ -public: - devicemanagementnotifierpluginprivate() {mError = 0;} - - int mError; -}; - -// Constructor -devicemanagementnotifierplugin::devicemanagementnotifierplugin() -{ - - d = new devicemanagementnotifierpluginprivate; - -} - -// Destructor -devicemanagementnotifierplugin::~devicemanagementnotifierplugin() -{ - - delete d; - -} - -// Check if client is allowed to use device dialog widget -bool devicemanagementnotifierplugin::accessAllowed(const QString &deviceDialogType, - const QVariantMap ¶meters, const QVariantMap &securityInfo) const -{ - - - // This plugin doesn't perform operations that may compromise security. - // All clients are allowed to use. - return true; - -} - -// Create device dialog widget -HbDeviceDialogInterface *devicemanagementnotifierplugin::createDeviceDialog( - const QString &deviceDialogType, const QVariantMap ¶meters) -{ - return new devicemanagementnotifierwidget(parameters); -} - -// Return information of device dialog the plugin creates -bool devicemanagementnotifierplugin::deviceDialogInfo(const QString &deviceDialogType, - const QVariantMap ¶meters, DeviceDialogInfo *info) const -{ - - info->group = GenericDeviceDialogGroup; - -info->flags = NoDeviceDialogFlags; - -info->priority = DefaultPriority; - return true; -} - -// Return device dialog types this plugin implements -QStringList devicemanagementnotifierplugin::deviceDialogTypes() const -{ - - QStringList types; - const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); - for(int i = 0; i < numTypes; i++) { - types.append(dialogInfos[i].mTypeString); - } - - return types; -} - -// Return plugin flags -HbDeviceDialogPlugin::PluginFlags devicemanagementnotifierplugin::pluginFlags() const -{ - - return NoPluginFlags; -} - -// Return last error -int devicemanagementnotifierplugin::error() const -{ - return d->mError; -} diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierplugin_p.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierplugin_p.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef DEVICEMANAGEMENTNOTIFIERPLUGIN_P_H -#define DEVICEMANAGEMENTNOTIFIERPLUGIN_P_H - -#include -#include - -#include - -class devicemanagementnotifierpluginprivate; - -class devicemanagementnotifierplugin : public HbDeviceDialogPlugin -{ - Q_OBJECT - -public: - friend class devicemanagementnotifierpluginprivate; - - devicemanagementnotifierplugin(); - ~devicemanagementnotifierplugin(); - - bool accessAllowed(const QString &deviceDialogType, - const QVariantMap ¶meters, const QVariantMap &securityInfo) const; - HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, - const QVariantMap ¶meters); - bool deviceDialogInfo(const QString &deviceDialogType, - const QVariantMap ¶meters, DeviceDialogInfo *info) const; - QStringList deviceDialogTypes() const; - PluginFlags pluginFlags() const; - int error() const; - -private: - Q_DISABLE_COPY(devicemanagementnotifierplugin) - devicemanagementnotifierpluginprivate *d; -}; - -#endif // devicemanagementnotifierplugin_P_H diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifiersplugin.pro --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifiersplugin.pro Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -# ##################################################################### -# Automatically generated by qmake (2.01a) Fri Jul 4 12:40:38 2008 -# ##################################################################### -TEMPLATE = lib -TARGET = devicemanagementnotifiersplugin -CONFIG += hb \ - plugin -INCLUDEPATH += . -DEPENDPATH += . - -DESTDIR = $${HB_BUILD_DIR}/plugins/devicedialogs - -SOURCES += devicemanagementnotifierplugin.cpp -SOURCES += devicemanagementnotifierwidget.cpp -SOURCES += devicemanagementnotifierutils.cpp -SOURCES += syncmlnotifierprivate.cpp -HEADERS += devicemanagementnotifierplugin_p.h -HEADERS += devicemanagementnotifierwidget_p.h -HEADERS += devicemanagementnotifierutils.h -HEADERS += syncmlnotifierprivate.h -RESOURCES = devicemanagementnotifierdevman.qrc -TRANSLATIONS += deviceupdates.ts - -symbian: { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = CAP_GENERAL_DLL - TARGET.UID3 = 0x2002DD20 - - hblib.sources = Hb.dll - hblib.path = \sys\bin - hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}" - - pluginstub.sources = devicemanagementnotifiersplugin.dll - pluginstub.path = /resource/plugins/devicedialogs - DEPLOYMENT += pluginstub - MMP_RULES += "LIBRARY syncmlclientapi.lib centralrepository.lib flogger.lib" -} -!local { - target.path = $${HB_PLUGINS_DIR}/devicedialogs - INSTALLS += target -} diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.cpp --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,348 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "SyncMLNotifierParams.h" -#include "PnpUtilLogger.h" -#include "devicemanagementnotifierutils.h" - - enum TSyncmlHbNotifierKeys - { - - EHbSOSNotifierKeyStatus = 11, // status set will complete the client subscribe - EHbSOSNotifierKeyStatusReturn = 12, // Return the content of actual status value accepted from UI - - EHbDMSyncNotifierKeyStatus = 13, - EHbDMSyncNotifierKeyStatusReturn = 14 - }; - - -devicemanagementnotifierutils::devicemanagementnotifierutils( - const QVariantMap ¶meters) - { - qDebug("devicemanagementnotifierutils"); - syncmlnotifier* notifier = new syncmlnotifier(); - notifier->launchDialog(parameters); - - } - -syncmlnotifier::syncmlnotifier() - { - qDebug("devicemanagementnotifierutils syncmlnotifier"); - QTranslator *translator = new QTranslator(); - QString lang = QLocale::system().name(); - QString path = "Z:/resource/qt/translations/"; - bool fine = translator->load("deviceupdates_en.qm", path); - if (fine) - qApp->installTranslator(translator); - - QTranslator *commontranslator = new QTranslator(); - - fine = commontranslator->load("common_" + lang, path); - if (fine) - qApp->installTranslator(commontranslator); - - msymnotifier = new syncmlnotifierprivate(); - } - -void syncmlnotifier::launchDialog(const QVariantMap ¶meters) - { - - QVariantMap::const_iterator i = parameters.constBegin(); - qDebug("devicemanagementnotifierutils syncmlnotifier launchDialog"); - //i++; - - bool profileidenabled = false; - bool uiserverinteraction = false; - bool serverpushinformativeenabled = false; - bool serverpushinteractiveenabled = false; - - int profileid = 0; - int uimode = 0; - - QString serverpushinformmessage; - QString serverpushconfirmmessage; - - QString serverdispname; - - while (i != parameters.constEnd()) - { - if (i.key().toAscii() == "profileid") - { - - profileid = i.value().toInt(); - profileidenabled = true; - } - - if (i.key().toAscii() == "uimode") - { - uiserverinteraction = true; - uimode = i.value().toInt(); - } - - if (i.key().toAscii() == "serverpushinformative") - { - qDebug("server push informative enabled"); - serverpushinformativeenabled = true; - serverpushinformmessage = i.value().toString(); - } - - if (i.key().toAscii() == "serverpushconfirmative") - { - LOGSTRING("Server Push Confirmative"); - serverpushinteractiveenabled = true; - serverpushconfirmmessage = i.value().toString(); - } - - if (i.key().toAscii() == "serverdisplayname") - { - serverdispname = i.value().toString(); - } - - ++i; - } - - if (profileidenabled && uiserverinteraction) - { - qDebug("server interaction packet 0 enabled "); - qDebug()<setnotifierorigin(EHbSOSNotifierKeyStatus); - createserverinitnotifier(profileid, uimode, serverdispname); - } - else if (serverpushinformativeenabled) - { - qDebug("server push informative enabled "); - qDebug()<setnotifierorigin(EHbDMSyncNotifierKeyStatus); - createserveralertinformative(serverpushinformmessage); - } - else if (serverpushinteractiveenabled) - { - qDebug("server push informative enabled "); - qDebug()<setnotifierorigin(EHbDMSyncNotifierKeyStatus); - createserveralertconfirmative(serverpushconfirmmessage); - } - - } - -void syncmlnotifier::createserverinitnotifier(int profileid, int uimode, - QString& servername) - { - - int inittype = msymnotifier->serverinittype(uimode); - qDebug("Notification type"); - qDebug()< (loader.findWidget( - "dialog")); - - //set heading content - HbLabel *contentheading = qobject_cast (loader.findWidget( - "qtl_dialog_pri_heading")); - QString heading = hbTrId("txt_device_update_title_update_available"); - contentheading->setPlainText(heading); - - //set body content - HbLabel *contentbody = qobject_cast (loader.findWidget( - "qtl_dialog_pri5")); - QString serverinitmessage = hbTrId( - "txt_device_update_info_recommended_update_is_avail").arg( - servername); - contentbody->setPlainText(serverinitmessage); - - //set softkeys - HbAction *primaryAction = (HbAction *) dialog->actions().first(); - QString softkeyok = hbTrId("txt_common_button_ok"); - primaryAction->setText(softkeyok); - - HbAction *secondaryAction = (HbAction *) dialog->actions().at(1); - QString softkeyCancel = hbTrId("txt_common_button_cancel"); - secondaryAction->setText(softkeyCancel); - - //set dialog properties - dialog->setTimeout(HbPopup::NoTimeout); - - //load appropriate icon from svg file - HbLabel* label1 = qobject_cast (loader.findWidget("icon")); - HbIcon* icon1 = new HbIcon(":/devman_icon/iconnotifier.svg"); - label1->setIcon(*icon1); - //label1->setMode(QIcon::Normal); - //label1->setState(QIcon::Off); - label1->setToolTip("Mode=Normal, State=Off"); - - QObject::connect(primaryAction, SIGNAL(triggered()), this, - SLOT(okSelected())); - - QObject::connect(secondaryAction, SIGNAL(triggered()), this, - SLOT(cancelSelected())); - - if (dialog) - dialog->show(); - } - else if (inittype == ESANUserInformative) - { - HbDocumentLoader loader; - bool ok = false; - loader.load(":/xml/dialoginformative.docml", &ok); - if (!ok) - { - return; - } - - //hbTrId("qtl_dialog_pri_heading"); - - HbDialog *dialog = qobject_cast (loader.findWidget( - "dialog")); - - HbLabel *content = qobject_cast (loader.findWidget( - "qtl_dialog_pri5")); - - QString serverinitmessage = hbTrId( - "txt_device_update_info_update_serverpush_informative").arg( - servername); - - //getserverspecifictexttodisplay(profileid, uimode, serverinitmessage); - content->setPlainText(serverinitmessage); - - //get string here /*TODO*/ /*QTranslations*/ - - dialog->setTimeout(3000); - - //msymnotifier->setstatus(0); - - if (dialog) - dialog->show(); - - QObject::connect(dialog, SIGNAL(aboutToClose()), this, - SLOT(okSelected())); - - } - else if (inittype == ESANSilent) - { - msymnotifier->setstatus(0); - } - - } - -void syncmlnotifier::createserveralertinformative(const QString &string) - { - qDebug("createserveralertinformative start"); - LOGSTRING("createserveralertinformative start"); - HbDocumentLoader loader; - bool ok = false; - loader.load(":/xml/dialoginformative.docml", &ok); - if (!ok) - { - return; - } - HbDialog *dialog = qobject_cast (loader.findWidget("dialog")); - - HbLabel *content = qobject_cast (loader.findWidget( - "qtl_dialog_pri5")); - - // No translations required - content->setPlainText(string); - - dialog->setTimeout(3000); - - if (dialog) - dialog->show(); - - QObject::connect(dialog, SIGNAL(aboutToClose()), this, SLOT(okSelected())); - - qDebug("createserveralertinformative end"); - - } - -void syncmlnotifier::createserveralertconfirmative(const QString &string) - { - HbDocumentLoader loader; - bool ok = false; - loader.load(":/xml/dialogserverpushconfirm.docml", &ok); - if (!ok) - { - return; - } - HbDialog *dialog = qobject_cast (loader.findWidget("dialog")); - - //set heading content - HbLabel *contentheading = qobject_cast (loader.findWidget( - "qtl_dialog_pri_heading")); - QString heading = hbTrId("txt_device_update_title_server_message"); - contentheading->setPlainText(heading); - - //set body content - HbLabel *contentbody = qobject_cast (loader.findWidget( - "qtl_dialog_pri5")); - - contentbody->setPlainText(string); - - //set softkeys - HbAction *primaryAction = (HbAction *) dialog->actions().first(); - QString softkeyok = hbTrId("txt_common_button_yes"); - primaryAction->setText(softkeyok); - - HbAction *secondaryAction = (HbAction *) dialog->actions().at(1); - QString softkeyCancel = hbTrId("txt_common_button_no"); - secondaryAction->setText(softkeyCancel); - - dialog->setTimeout(HbPopup::NoTimeout); - - QObject::connect(primaryAction, SIGNAL(triggered()), this, - SLOT(okSelected())); - - QObject::connect(secondaryAction, SIGNAL(triggered()), this, - SLOT(cancelSelected())); - - if (dialog) - dialog->show(); - } - -void syncmlnotifier::okSelected() - { - qDebug("ok selected"); - msymnotifier->setstatus(0); - } - -void syncmlnotifier::cancelSelected() - { - qDebug("cancel selected"); - msymnotifier->setstatus(-3); - - } - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef DEVICEMANAGEMENTNOTIFIERUTILS_H_ -#define DEVICEMANAGEMENTNOTIFIERUTILS_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "syncmlnotifierprivate.h" - -class syncmlnotifier; - -class devicemanagementnotifierutils :public HbDialog { - -Q_OBJECT - -public: -devicemanagementnotifierutils(const QVariantMap ¶meters); - -}; - -class syncmlnotifier:public QObject { - -Q_OBJECT - -public: -syncmlnotifier(); - -public: - void launchDialog(const QVariantMap ¶meters); - void createserverinitnotifier(int profileid, int uimode,QString& servername); - void createserveralertinformative(const QString &string); - void createserveralertconfirmative(const QString &string); - -public slots: - void okSelected(); - void cancelSelected(); - -signals: - void servertextmessage(const QString &string); - -private: - syncmlnotifierprivate* msymnotifier; - - -}; - - - -#endif diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierwidget.cpp --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierwidget.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "devicemanagementnotifierwidget_p.h" - - -// Constructor -devicemanagementnotifierwidget::devicemanagementnotifierwidget(const QVariantMap ¶meters):devicemanagementnotifierutils(parameters) -{ - -} - -// Set parameters -bool devicemanagementnotifierwidget::setDeviceDialogParameters( - const QVariantMap ¶meters) -{ - - return true; -} - -// Get error -int devicemanagementnotifierwidget::deviceDialogError() const -{ - - return 0; -} - -// Close device dialog -void devicemanagementnotifierwidget::closeDeviceDialog(bool byClient) -{ - close(); - emit deviceDialogClosed(); -} - -// Return display widget -HbDialog *devicemanagementnotifierwidget::deviceDialogWidget() const -{ - - return const_cast(this); -} diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierwidget_p.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierwidget_p.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef DEVICEMANAGEMENTNOTIFIERWIDGET_P_H -#define DEVICEMANAGEMENTNOTIFIERWIDGET_P_H - -#include -#include - -#include -#include -#include "devicemanagementnotifierutils.h" - -class HbDialog; - -class devicemanagementnotifierwidget : - public devicemanagementnotifierutils, public HbDeviceDialogInterface -{ - Q_OBJECT - -public: - devicemanagementnotifierwidget(const QVariantMap ¶meters); - - -public: //derived from HbDeviceDialogInterface - bool setDeviceDialogParameters(const QVariantMap ¶meters); - int deviceDialogError() const; - void closeDeviceDialog(bool byClient); - HbDialog *deviceDialogWidget() const; - -signals: - void deviceDialogClosed(); - void deviceDialogData(QVariantMap data); - }; - -#endif // devicemanagementnotifierwidget_P_H diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/dialog.docml --- a/deviceupdatesui/devicemanagementnotifiersplugin/dialog.docml Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/dialoginformative.docml --- a/deviceupdatesui/devicemanagementnotifiersplugin/dialoginformative.docml Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/dialogserverpushconfirm.docml --- a/deviceupdatesui/devicemanagementnotifiersplugin/dialogserverpushconfirm.docml Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/iconnotifier.svg --- a/deviceupdatesui/devicemanagementnotifiersplugin/iconnotifier.svg Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/syncmlnotifierprivate.cpp --- a/deviceupdatesui/devicemanagementnotifiersplugin/syncmlnotifierprivate.cpp Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include -#include -#include -#include -#include -#include -#include "nsmlconstantdefs.h" -#include "SyncMLNotifierParams.h" -#include "syncmlnotifierprivate.h" - - - -syncmlnotifierprivate::syncmlnotifierprivate() -{ -} - -void syncmlnotifierprivate::setstatus(TInt value) -{ - - qDebug("setstatus"); - - - - enum TSyncmlHbNotifierKeys - { - - EHbSOSNotifierKeyStatus = 11, // status set will complete the client subscribe - EHbSOSNotifierKeyStatusReturn = 12, // Return the content of actual status value accepted from UI - - EHbDMSyncNotifierKeyStatus = 13, - EHbDMSyncNotifierKeyStatusReturn = 14 - }; - - TInt err; - RProperty intProperty; - - if(iNotifierorigin== EHbSOSNotifierKeyStatus) - { - TUid uid = {0x101F99FB}; - err = intProperty.Attach(uid , EHbSOSNotifierKeyStatus, EOwnerThread); - if(err == KErrNone) - { - qDebug("EHbSOSNotifierKeyStatus entered no error"); - intProperty.Set(value); - RProperty::Set(uid, EHbSOSNotifierKeyStatusReturn, value); - qDebug("Set status of return value"); - qDebug()< serverdisplayname; - - RSyncMLSession syncSession; - - syncSession.OpenL(); - CleanupClosePushL( syncSession ); - - RSyncMLDevManProfile syncProfile; - syncProfile.OpenL( syncSession, profileid, ESmlOpenRead ); - CleanupClosePushL( syncProfile ); - - serverdisplayname= syncProfile.DisplayName(); - - - //convert TBuf serverName to QString - QString qString((QChar*)serverdisplayname.Ptr(),serverdisplayname.Length()); - servername = qString; - - - - syncProfile.Close(); - CleanupStack::Pop( &syncProfile ); - - syncSession.Close(); - CleanupStack::Pop( &syncSession ); -} - - -TInt syncmlnotifierprivate::serverinittype(TInt uimode) - { - - - TInt SanSupport = 0; - - CRepository* centrep = NULL; - TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) ); - User::LeaveIfError( err ); - centrep->Get( KDevManSANUIBitVariation, SanSupport ); - delete centrep; - - //if SAN is specified then silent operation - - if(( SanSupport == 1 )) - { - if( uimode > ESANUserInteractive && uimode < ESANNotSpecified ) - { - uimode = ESANNotSpecified; - } - - if( uimode == ESANNotSpecified || uimode == ESANUserInteractive) - { - return ESANUserInteractive; - } - if( uimode == ESANUserInformative) - { - return ESANUserInformative; - } - } - - return ESANSilent; - - - } - -void syncmlnotifierprivate::setnotifierorigin(TInt notifierorig) - { - iNotifierorigin = notifierorig; - } - diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/devicemanagementnotifiersplugin/syncmlnotifierprivate.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/syncmlnotifierprivate.h Tue Jul 13 03:42:03 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef SYNCMLNOTIFIERPRIVATE_H_ -#define SYNCMLNOTIFIERPRIVATE_H_ - -#include - -class syncmlnotifierprivate -{ -public: -syncmlnotifierprivate(); - -public: - void setstatus(TInt status); - void getdmprofileparameters(QString& displayname, TInt profileid); - TInt serverinittype(TInt uimode); - void setnotifierorigin(TInt notifierorig); - -private: - TInt iNotifierorigin; - -}; - -#endif diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/bld/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: for building DM adapters +* +*/ + +PRJ_PLATFORMS +DEFAULT +PRJ_EXPORTS +../rom/omadmadapters.iby CORE_APP_LAYER_IBY_EXPORT_PATH(omadmadapters.iby) + +#include "../devinfo/bld/bld.inf" +#include "../devdetail/bld/bld.inf" +#include "../syncmldm/bld/bld.inf" +#include "../syncmldm12/bld/bld.inf" +//#include "../browseradapter/bld/bld.inf" +//#include "../streamingadapter/bld/bld.inf" + +#include "../globalwlansettings/group/bld.inf" +//#include "../nsmldminternet/group/bld.inf" +#include "../nsmldmalwaysonadapter/group/bld.inf" +//#include "../nsmldmbmadapter/group/bld.inf" +#include "../connmoadapter/group/bld.inf" + +#ifdef __SYNCML_DM_DS +#include "../syncmlds/bld/bld.inf" +#endif + +#ifdef __SYNCML_DM_EMAIL +//#include "../email/bld/bld.inf" +#endif + +#ifdef __SYNCML_DM_MMS +#include "../mms/bld/bld.inf" +#endif + +#ifdef __SYNCML_DM_FOTA +//#include "../fota/bld/bld.inf" +#endif + +#ifdef __SYNCML_DM_IMPS +//#include "../imps/bld/bld.inf" +#endif + +//#include "../dcmodmadapter/group/bld.inf" diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/group/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,33 @@ +/* +* ============================================================================== +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================ +*/ + +#include + +PRJ_PLATFORMS + +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +connmoadapter.mmp + + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/group/connmoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/group/connmoadapter.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,44 @@ +/* +* ============================================================================== +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* ============================================================================== +*/ + +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET connmoadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2001FE5E +VENDORID VID_DEFAULT + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc +USERINCLUDE ../traces + +START RESOURCE ConnMoAdapter.rss +END + +LANG sc + +LIBRARY charconv.lib ecom.lib euser.lib +LIBRARY sysutil.lib +LIBRARY cmmanager.lib + +SOURCE ConnMoAdapter.cpp BranchBase.cpp NapBranch.cpp ProxyBranch.cpp AddBuffer.cpp Utils.cpp + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/inc/AddBuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/inc/AddBuffer.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,145 @@ +/* +* ============================================================================== +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================== +*/ + +#ifndef ADDBUFFER_H_ +#define ADDBUFFER_H_ + +TInt const KMaxFieldLength = 128; + +/** +* CConnMoNodeElement is array element for ConnMo node objects. +*/ +class CConnMoNodeElement : public CBase + { +public: + CConnMoNodeElement(); + ~CConnMoNodeElement(); + + /** Node address */ + TBuf8 iUri; + /** Unique identifier of the parent node */ + TBuf8 iParentLUID; + /** Leaf object's data */ + TBuf8 iObject; + /** Refenrence for giving commands return value to framework */ + TInt iStatusRef; + /** Information whether adapter has processed the node or not */ + TBool iProcessed; + /** Specifies if the node leaf or not */ + TBool iLeaf; +private: + }; + +/** +* CAddBuffer is array for ConnMo nodes to be added in . +* +* CConnMoAdapter uses this class to buffer node and leaf data +* addition DM commands. +*/ +class CAddBuffer : public CBase + { +public: + + /** + * Creates new instance of CAddBuffer + */ + static CAddBuffer* NewL(); + + /** + * Adds node to buffer + * + * @param aUri target node URI + * @param aParentLUID refrence to parent node + * @param aStatusRef Status reference + */ + void AddNodeToBufferL( const TDesC8& aUri, + const TDesC8& aParentLUID, + const TInt aStatusRef ); + + /** + * Adds leaf node to buffer + * + * @param aUri target node URI + * @param aParentLUID refrence to parent node + * @param aObject Leaf object data + * @param aStatusRef Status reference + */ + void AddNodeToBufferL( const TDesC8& aUri, + const TDesC8& aLUID, + const TDesC8& aObject, + const TInt aStatusRef ); + + /** + * Searches buffer for given dynamic node + * + * @param aUri target node URI + */ + CConnMoNodeElement* FindDynamicNode( const TDesC8& aUri ); + + /** + * Gets all unprocessed nodes associated to given root node + * + * Function searches buffer for all unprocessed nodes that + * belong to given group and are under same dynamic node + * + * @param aRoot target group + * @param aGroup Array for result nodes + */ + TInt GetGroup( const TDesC8& aRoot, RPointerArray* aGroup ); + + /** + * Searches buffer for givennode + * + * @param aUri target node URI + */ + CConnMoNodeElement* CacheFind( const TDesC8& aUri ); + + /** + * Searches buffer for given dynamic node + * + * @param aUri target node URI + */ + CConnMoNodeElement* CacheFindDynamicNode( const TDesC8& aUri ); + + /** + * Empties buffer and frees all allocated memory + */ + void Reset(); + + virtual ~CAddBuffer(); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + void ConstructL(); + CAddBuffer(); + + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + /** Contains all nodes to be added */ + RPointerArray iBuffer; + /** Contains group of nodes that user has previously asked */ + RPointerArray iCache; + + }; + +#endif /* ADDBUFFER_H_ */ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/inc/BranchBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/inc/BranchBase.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,186 @@ +/* +* ============================================================================== +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================== +*/ + +#ifndef BRANCHBASE_H_ +#define BRANCHBASE_H_ + +#include +#include "smldmadapter.h" + +// ------------------------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------------------------ +#define KConnMoAdapterUid 0x2001FE5F + +/** + * Abstract base class for all ConnMO branches. + */ +class CBranchBase : public CBase + { +public: + + /** + * Builds DDF structure of DM settings it governs. + * + * Implementations should build their structure using given node + * as the root node. + * + * @param aDDF Root node + */ + virtual void DDFStructureL( MSmlDmDDFObject& aDDF ) = 0; + + /** + * Updates leaf node data. + * + * @param aURI Root node + * @param aLUID refrence to branch LUID + * @param aObject Leaf object data + * @param aType Type of the node + * @param aStatusRef Status reference + */ + virtual void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ) = 0; + /** + * Deletes object pointed by aURI. + * + * @param aURI Root node + * @param aLUID refrence to branch LUID + * @param aStatusRef Status reference + */ + virtual void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ) = 0; + + /** + * Gets node data for leaf nodes and child list for parent nodes. + * + * @param aURI Root node + * @param aLUID refrence to branch LUID + * @param aObject Leaf object data + * @param aType Type of the node + * @param aResultsRef Result reference + * @param aStatusRef Status reference + */ + virtual void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) = 0; + + /** + * Gets the size of the data in leaf node. + */ + virtual void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef) = 0; + + /** + * Gets all childs of the given node. + */ + virtual void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ) = 0; + + /** + * Adds node to DM tree. + */ + virtual void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef )=0; + + + virtual ~CBranchBase(); + +protected: + + CBranchBase(); + + CBranchBase( MSmlDmCallback* aDmCallback ); + + /** + * This function gives all Connection Methods from Connection Method Manager. + * + * @param aCmArray Result Array. + * @param aCmManager CM Manager. + */ + void GetAllConnectionMethodsL( RArray& aCmArray, + RCmManagerExt& aCmManager ); + + /** + * This function checks if given CM ID is found from given URI segmentlist. + * + * @param aPreviousURISegmentList Array where to search. + * @param aCmId CM ID to be searched. + * @param aURISeg If match is found, the URI segment matching the CM ID is copied here. + * @return TBool ETrue if CM ID is found from array. + */ + TBool CheckPreviousURIList( const CArrayFix& aPreviousURISegmentList, + const TUint32 aCmId, + TDes8& aURISeg ); + + /** + * This function gets list of dynamic nodes for the specified URI + * + * @param aURI which to get the list for + * @param aLuid refrence to branch LUID + * @param aPreviousURISegmentList previous URI segment list + * @param aResultRef result reference + * @param aStatusRef status reference + * @param aCmManagerExt CM Manager reference + * @param aCurrentURISegmentList current URI segment list + * @param aField branch name + * @param aNodeCount number of dynamic nodes + * @aCallback pointer to DM callback + */ + void GetAllDynamicNodesL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + RCmManagerExt& aCmManagerExt, + CBufBase& aCurrentURISegmentList, + const TDesC8& aField, + const TInt aNodeCount, + MSmlDmCallback* aCallback ); + + /** + * This function gets connection method + * + * @param aCmManagerExt CM Manager + * @param aCm CM Manager + * @param aCmId CM ID + * @return TBool ETrue if connection method found + */ + TBool GetConnectionMethodLC( RCmManagerExt& aCmManagerExt, + RCmConnectionMethodExt& aCm, + TUint32 aCmId ); + +private: + MSmlDmCallback* iCallback; + + }; + +#endif /* BRANCHBASE_H_ */ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/inc/ConnMoAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/inc/ConnMoAdapter.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,155 @@ +/* +* ============================================================================== +* Name : ConnMoAdapter.h +* Part of : ConnMoAdapter +* Interface : ecom / ConnMOAdapter +* Description : Connection Management Object +* Version : $Revision: 61 $ $Modtime: 29.09.05 8:17 $ +* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================== +*/ + +#ifndef CONNMOADAPTER_H_ +#define CONNMOADAPTER_H_ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include + +class CNapBranch; +class CProxyBranch; +class CAddBuffer; +class CBranchBase; + +_LIT8( KCMDdfNAP, "NAP" ); +_LIT8( KCMDdfProxy, "Proxy" ); + +/** + * Implements ConnMO partition of the DM tree + */ +class CConnMoAdapter : public CSmlDmAdapter + { +public: + + static CConnMoAdapter* NewL(MSmlDmCallback* aDmCallback ); + static CConnMoAdapter* NewLC(MSmlDmCallback* aDmCallback ); + + virtual ~CConnMoAdapter(); + + // Adapter Interface inherited from CSmlDmAdapter + void DDFVersionL( CBufBase& aVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ); + + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ); + + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef ); + + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ); + + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + TInt aStatusRef ); + + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + + void CopyCommandL( const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, + TInt aStatusRef ); + + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + void ConstructL(); + CConnMoAdapter( TAny* aEcomArguments ); + + CBranchBase* GetBranch( const TDesC8& aUri ); + + MSmlDmDDFObject& AddBaseUriL( MSmlDmDDFObject& aRootDDF); + + MSmlDmDDFObject& AddBranchL( MSmlDmDDFObject& aRootDDF, + const TDesC8& aNodeName); + + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + /** Callback to framework */ + MSmlDmCallback* iCallBack; + + /** branches of ConnMo structure */ + CNapBranch* iNapBranch; + CProxyBranch* iProxyBranch; + + /** Buffer for node addition */ + CAddBuffer* iBuffer; + + /** CmMager for manipulating CM settings */ + RCmManagerExt iCmManager; + }; + + +#endif /* CONNMOADAPTER_H_ */ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/inc/NapBranch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/inc/NapBranch.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,151 @@ +/* +* ============================================================================== +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================== +*/ + + +#ifndef NAPBRANCH_H_ +#define NAPBRANCH_H_ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include +#include "BranchBase.h" +#include "AddBuffer.h" + +/** + * Class for handling Network Access Point (NAP) settings in ConnMo DM tree + */ +class CNapBranch : public CBranchBase + { +public: + + static CNapBranch* NewL(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ); + + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ); + + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ); + + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ); + + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef); + + /** + * Processes all Proxy related nodes from buffer + */ + void ProcessBufferL(); + + virtual ~CNapBranch(); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + void ConstructL( CAddBuffer* aBuffer, RCmManagerExt* aCmManagerExt ); + CNapBranch( MSmlDmCallback* aDmCallback ); + + CSmlDmAdapter::TError GetUnmodifiableFieldValueL(const TDesC8& aUri, + CBufBase* aResult ); + + CSmlDmAdapter::TError GetLeafDataL(const TDesC8& aURI, + RCmConnectionMethodExt& aCm, + CBufBase* aResult ); + + CSmlDmAdapter::TError GetUnmodifiableFieldAddResult( const TDesC8& aUri, + const TDesC8& aObject ); + + TUint32 MapUriToCmAttribute( const TDesC8& aUri ); + + void SetLeafDataL( const TDesC8& aURI, + const TDesC8& aObject, + TInt aStatusRef, + RCmConnectionMethodExt& aCm); + + void SetNodeDataL( CConnMoNodeElement* aNode, + RCmConnectionMethodExt& aCm ); + + TBool FindNewCmType( TUint32& aBearerType ); + + TBool AllMandatoryNapFieldsFound(); + + void NapChildURIListL( const TDesC8& aURI, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + CBufBase& aCurrentURISegmentList ); + + void GetAllDynamicNapNodesL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + CBufBase& aCurrentURISegmentList, + const TDesC8& aField ); + + void IpBranchDDFStructureL( MSmlDmDDFObject& aIPDDF ); + + CSmlDmAdapter::TError DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID ); + + TPtrC8 GetDynamicNAPNodeUri( const TDesC8& aURI ); + + TBool IsNAPUriFormatMatchPredefined(const TDesC8 & aURI); + + TInt GetCmIdFromURIL(const TDesC8& aURI); + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + CAddBuffer* iBuffer; + MSmlDmCallback* iCallback; + RCmManagerExt* iCmManager; + }; + + + +#endif /* NAPBRANCH_H_ */ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/inc/ProxyBranch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/inc/ProxyBranch.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,197 @@ +/* +* ============================================================================== +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================== +*/ + +#ifndef PROXYBRANCH_H_ +#define PROXYBRANCH_H_ + + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include "BranchBase.h" +#include "cmmanagerext.h" +#include "AddBuffer.h" + +/** + * Class for handling Proxy settings in ConnMo DM tree + */ +class CProxyBranch : public CBranchBase + { +public: + + static CProxyBranch* NewL(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ); + + // Adapter branch interface from CProxyBranch + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ); + + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ); + + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + + + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef); + + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ); + + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ); + + /** + * The function processes all proxy nodes from add buffer. + * @param aCmManagerExt Reference to CmManager session. + */ + void ProcessBufferL(); + + virtual ~CProxyBranch(); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + CProxyBranch(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ); + + /** + * The function returns URI list of dynamic Proxy nodes. The list is returned by + * calling the SetResultsL function of MSmlCallback callback interface. + * @param aURI URI of the parent object. + * @param aPreviousURISegmentList URI list with mapping LUID information. + * @param aResultsRef Reference to correct results. + * @param aStatusRef Reference to correct command. + * @param aCmManagerExt Reference to CmManager session. + */ + void GetAllDynamicProxyNodesL( const TDesC8& aURI, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + CBufBase& aCurrentURISegmentList ); + + /** + * The function returns URI list of requested dynamic Proxy node. + * @param aLUID LUID of the parent object. + * @param aResultsRef Reference to correct results. + * @param aStatusRef Reference to correct command. + * @param aCmManagerExt Reference to CmManager session. + */ + void GetURIListForProxyNodeL( const TDesC8& aLUID, + TInt aResultsRef, + TInt aStatusRef ); + + /** + * The function adjust DM operation return values for hardcoded fields. + * @param aURI URI of the object. + * @return CSmlDmAdapter::TError Status value for DM operation. + */ + CSmlDmAdapter::TError CheckForUnmodifiableField( const TDesC8& aUri ); + + /** + * The function returns CMManager's attribute enum that corresponds to uri. + * @param aURI URI of the object. + * @return TUint32 Attribute enum for CM. + */ + TUint32 MapUriToCmAttribute( const TDesC8& aUri ); + + /** + * The function searches for connection method that is referenced from proxy buffered + * in the addbuffer. + * @param aCmManagerExt Reference to CmManager session. + * @return TUint32 CM ID. + */ + TInt32 FindConnectionMethodL(); + + /** + * The function checs that the addbuffer contains all necessary fields + * to create new proxy entry. + * @return TBool True if all mandatory fields found. + */ + TBool AllMandatoryProxyFieldsFound(); + + /** + * The function writes information from the addbuffer to connection method. + * @param aURI URI of the object. + * @param aLUID Local UID of the leaf. + * @param aObject objecto to be written in CM. + * @param aStatusRef Reference to correct command. + * @param aCm Reference to Connection Method. + */ + void SetLeafDataL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + TInt aStatusRef, + RCmConnectionMethodExt& aCm); + + /** + * The function informs framework about new nodes. + * @param aNode Node to be saved. + * @param aCm Reference to Connection Method. + */ + void SetNodeDataL( CConnMoNodeElement* aNode, RCmConnectionMethodExt& aCm ); + + /** + * Fethces leaf object data from connection settings + * @param aURI Target node + * @param aLuid Local UID for target node + * @param buffer for returning object data + * @return CSmlDmAdapter::TError Return value informs completion status of the operation + */ + CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + CBufBase& aLeafObject ); + + TPtrC8 GetDynamicProxyNodeUri( const TDesC8& aURI ); + + TBool IsProxyUriFormatMatchPredefined(const TDesC8 & aURI); + + TInt GetCmIdFromURIL(const TDesC8& aURI); + + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + MSmlDmCallback* iCallback; + CAddBuffer* iBuffer; + RCmManagerExt* iCmManager; + }; + +#endif /* PROXYBRANCH_H_ */ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/inc/Utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/inc/Utils.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,156 @@ +/* +* ============================================================================== +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================== +*/ + +#ifndef UTILS_H_ +#define UTILS_H_ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include "ConnMoAdapter.h" + +class TLuid; + +/** + * Utilities class for ConnMo adapter needs + * + * Class contains useful helper functions etc. for parsing URI and TLuid + */ +class CUtils : public CBase + { +public: + + virtual ~CUtils(); + + /** + * Returns first segment of URI. + * + * @param aUri URI to be searched. + * @return First segment of URI. + */ + static TPtrC8 GetFirstURISeg( const TDesC8& aURI ); + + /** + * Returns second segment of URI. + * + * @param aUri URI to be searched. + * @return Second segment of URI. + */ + static TPtrC8 GetSecondURISeg( const TDesC8& aURI ); + + /** + * Returns last segment of URI. + * + * @param aUri URI to be searched. + * @return Last segment of URI. + */ + static TPtrC8 GetLastURISeg( const TDesC8& aURI ); + + /** + * Returns the end of URI starting from passed segment. + * + * @param aUri URI to be parsed. + * @param aName Segment to start. + * @return End of URI starting from aName. + */ + static TPtrC8 GetEndOfURIFromSeg( const TDesC8& aURI, const TDesC8& aName ); + + /** + * This function converts string value to 8-bit value. + * + * @param aSource String to convert. + * @return Pointer to 8-bit value. + */ + static TDesC8& ConvertTo8LC( const TDesC& aSource ); + + /** + * This function converts string value to 16-bit value. + * + * @param aSource String to convert. + * @return Pointer to 16-bit value. + */ + static TDesC16& ConvertTo16LC( const TDesC8& aSource ); + + /** + * This function sets given information to given node. + * + * @param aNode Target node. + * @param aAccTypes Node's access types. + * @param aOccurrence Amount of possible nodes of same type. + * @param aScope Describes if node is static or dynamic. + * @param aFormat Node's format. + * @param aDescription String containing description of the node. + * @return Pointer integer value. + */ + static void FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription); + + /** + * This function removes characters that are not allowed in URI from given descriptor. + * + * @param aString String to be modified. + */ + static void RemoveIllegalCharsFromURI( TDes8& aString ); + + /** + * This function returns string as bool value. + * + * @param aSource String to convert. + * @param aBool conversion result. + * @return TInt32 KErrNone if succesful conversion. + */ + static TInt32 DesToBool( const TDesC8& aString, TBool& aBool ); + + /** + * This function convert integer value to string presentation. + * + * @param aObject Int value to convert. + * @return TDesC8& Int as string. + */ + static TDesC8& IntToCharL( const TInt& aObject ); + + /** + * This function takes first segment from uri and adds it to target + * + * @param aURI Contains source uri. + * @param aTarget Target string. + * @return TInt Index of first uri delimiter. + */ + static TInt AppendFirstURISeg( TDes8& aURI, TDes8& aTarget ); + + static TInt IntLUID(const TDesC8& aLUID); + +private: + + //----------------------------------------------------------------------------- + // Private functions + //----------------------------------------------------------------------------- + CUtils(); + + //----------------------------------------------------------------------------- + // Private member variables + //----------------------------------------------------------------------------- + + }; + +#endif /* UTILS_H_ */ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/rom/connmoadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/rom/connmoadapter.iby Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,34 @@ +/* +* ============================================================================ +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================ +*/ + +#include + +#ifndef __CONNMOADAPTER_IBY__ +#define __CONNMOADAPTER_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected +#ifdef FF_DM_CONNMO_ADAPTER // nothing should be installed from this .iby file if this flag is not specified. + // old internet adapter is used in that case for access point provisioning. + +ECOM_PLUGIN(connmoadapter.dll,connmoadapter.rsc) + +#endif FF_DM_CONNMO_ADAPTER +#endif // __SYNCML_DM_WLAN + +#endif //__CONNMOADAPTER_IBY__ \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/src/AddBuffer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/src/AddBuffer.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,302 @@ +/* + * ============================================================================== + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * ============================================================================== + */ + +#include + +#include "AddBuffer.h" +#include "Utils.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "AddBufferTraces.h" +#endif + +_LIT8( KChildNodeWildCardPattern, "/*" ); +_LIT8( KNodeSeparator, "/" ); + +// ======== LOCAL FUNCTIONS ========= + +// ======== MEMBER FUNCTIONS ======== +//------------------------------------------------------------------------------ +// CConnMoNodeElement::CConnMoNodeElement() +//------------------------------------------------------------------------------ +CConnMoNodeElement::CConnMoNodeElement() + { + OstTraceFunctionEntry0( CCONNMONODEELEMENT_CCONNMONODEELEMENT_ENTRY ); + + OstTraceFunctionExit0( CCONNMONODEELEMENT_CCONNMONODEELEMENT_EXIT ); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::~CAddBuffer() +//------------------------------------------------------------------------------ +CConnMoNodeElement::~CConnMoNodeElement() + { + OstTraceFunctionEntry0( CCONNMONODEELEMENT_DELETE_ENTRY ); + + OstTraceFunctionExit0( CCONNMONODEELEMENT_DELETE_EXIT ); + } + +//----------------------------------------------------------------------------- +// CAddBuffer* CAddBuffer::NewL( ) +//----------------------------------------------------------------------------- +CAddBuffer* CAddBuffer::NewL() + { + OstTraceFunctionEntry0( CADDBUFFER_NEWL_ENTRY ); + + CAddBuffer* self = new ( ELeave ) CAddBuffer(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + CleanupStack::Pop( self ); + + OstTraceFunctionExit1( CADDBUFFER_NEWL_EXIT, ( TUint )( self ) ); + return self; + } + +//------------------------------------------------------------------------------ +// CAddBuffer::CAddBuffer() +//------------------------------------------------------------------------------ +CAddBuffer::CAddBuffer() + { + OstTraceFunctionEntry0( CADDBUFFER_CADDBUFFER_ENTRY ); + + OstTraceFunctionExit0( CADDBUFFER_CADDBUFFER_EXIT ); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::~CAddBuffer() +//------------------------------------------------------------------------------ +CAddBuffer::~CAddBuffer() + { + OstTraceFunctionEntry0( CADDBUFFER_DELETE_ENTRY ); + + iBuffer.ResetAndDestroy(); + + OstTraceFunctionExit0( CADDBUFFER_DELETE_EXIT ); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::CAddBuffer() +//------------------------------------------------------------------------------ +void CAddBuffer::ConstructL() + { + OstTraceFunctionEntry0( CADDBUFFER_CONSTRUCTL_ENTRY ); + + OstTraceFunctionExit0( CADDBUFFER_CONSTRUCTL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::AddNodeToBuffer() +//------------------------------------------------------------------------------ +void CAddBuffer::AddNodeToBufferL( const TDesC8& aUri, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_ENTRY, "ENTRY: CAddBuffer::AddNodeToBufferL;aUri=%s", aUri ); + + CConnMoNodeElement* newNode = new (ELeave) CConnMoNodeElement(); + + newNode->iUri.Copy( aUri ); + newNode->iParentLUID.Copy( aParentLUID ); + newNode->iStatusRef = aStatusRef; + newNode->iProcessed = EFalse; + newNode->iLeaf = EFalse; + + iBuffer.AppendL( newNode ); + OstTrace0( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_EXIT, "EXIT: CAddBuffer::AddNodeToBufferL"); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::AddNodeToBuffer() +//------------------------------------------------------------------------------ +void CAddBuffer::AddNodeToBufferL( const TDesC8& aUri, + const TDesC8& aLUID, + const TDesC8& aObject, + const TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_LEAF_ENTRY, "ENTRY: CAddBuffer::AddNodeToBufferL;aUri=%s", aUri ); + + CConnMoNodeElement* newNode = new (ELeave) CConnMoNodeElement(); + + newNode->iUri.Copy( aUri ); + newNode->iParentLUID.Copy( aLUID ); + newNode->iObject.Copy( aObject ); + newNode->iStatusRef = aStatusRef; + newNode->iProcessed = EFalse; + newNode->iLeaf = ETrue; + + iBuffer.AppendL( newNode ); + OstTrace0( TRACE_NORMAL, CADDBUFFER_ADDNODETOBUFFERL_LEAF_EXIT, "EXIT: CAddBuffer::AddNodeToBufferL"); + } + +//------------------------------------------------------------------------------ +// CAddBuffer::FindDynamicNode +//------------------------------------------------------------------------------ +CConnMoNodeElement* CAddBuffer::FindDynamicNode( const TDesC8& aUri ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_FINDDYNAMICNODE_ENTRY, "ENTRY: CAddBuffer::FindDynamicNode;aUri=%s", aUri ); + + CConnMoNodeElement* resultNode = NULL; + + for ( TInt i = 0; i < iBuffer.Count(); ++i ) + { + if ( iBuffer[i]->iUri.Match(aUri) != KErrNotFound ) + { + // + TBuf8 dynamicNodeChildUri(aUri); + dynamicNodeChildUri.Append( KChildNodeWildCardPattern ); + + if ( iBuffer[i]->iUri.Match( dynamicNodeChildUri ) == KErrNotFound ) + { + // Correct dynamic node found. + OstTrace0( TRACE_NORMAL, + CADDBUFFER_FINDDYNAMICNODE_MATCH_FOUND, + "CAddBuffer::FindDynamicNode;Matching node found."); + resultNode = iBuffer[i]; + break; + } + } + } + if ( resultNode != NULL ) + { + OstTraceExt1( TRACE_NORMAL, + CADDBUFFER_FINDDYNAMICNODE_EXIT, + "EXIT: CAddBuffer::FindDynamicNode;resultNode=%s", + resultNode->iUri ); + } + + return resultNode; + } + + +//------------------------------------------------------------------------------ +// CAddBuffer::Find +//------------------------------------------------------------------------------ +CConnMoNodeElement* CAddBuffer::CacheFind( const TDesC8& aUri ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_CACHEFIND_ENTRY, "ENTRY: CAddBuffer::CacheFind;aUri=%s", aUri ); + + CConnMoNodeElement* resultNode = NULL; + + for ( TInt i = 0; i < iCache.Count(); ++i ) + { + if ( iCache[i]->iUri.Match( aUri ) != KErrNotFound ) + { + OstTrace0( TRACE_NORMAL, CADDBUFFER_CACHEFIND_MATCH_FOUND, "CAddBuffer::CacheFind; Matching URI found."); + resultNode = iCache[i]; + + OstTraceExt1( TRACE_NORMAL, + CADDBUFFER_CACHEFIND_RESULT_NODE, + "CAddBuffer::CacheFind; resultNode=%s", + resultNode->iUri ); + break; + } + } + + OstTrace0( TRACE_NORMAL, CADDBUFFER_CACHEFIND_EXIT, "EXIT: CAddBuffer::CacheFind"); + return resultNode; + } + +//------------------------------------------------------------------------------ +// CAddBuffer::FindDynamicNode +//------------------------------------------------------------------------------ +CConnMoNodeElement* CAddBuffer::CacheFindDynamicNode( const TDesC8& aUri ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_CACHEFINDDYNAMICNODE_ENTRY, "ENTRY: CAddBuffer::CacheFindDynamicNode;aUri=%s", aUri ); + + CConnMoNodeElement* resultNode = NULL; + + for ( TInt i = 0; i < iCache.Count(); ++i ) + { + if ( iCache[i]->iUri.Match( aUri ) != KErrNotFound ) + { + // + TBuf8 dynamicNodeChildUri( aUri ); + dynamicNodeChildUri.Append( KChildNodeWildCardPattern ); + + if ( iCache[i]->iUri.Match(dynamicNodeChildUri) == KErrNotFound ) + { + // Correct dynamic node found. + OstTrace0( TRACE_NORMAL, + CADDBUFFER_CACHEFINDDYNAMICNODE_MATCH_FOUND, + "CAddBuffer::CacheFindDynamicNode; Matching node found."); + + resultNode = iCache[i]; + break; + } + } + } + if ( resultNode != NULL ) + { + OstTraceExt1( TRACE_NORMAL, + CADDBUFFER_CACHEFINDDYNAMICNODE_EXIT, + "EXIT: CAddBuffer::CacheFindDynamicNode;resultNode=%s", + resultNode->iUri ); + } + + return resultNode; + } +//------------------------------------------------------------------------------ +// CAddBuffer::AddNodeToBuffer() +//------------------------------------------------------------------------------ +TInt CAddBuffer::GetGroup( const TDesC8& aRoot, RPointerArray* aGroup ) + { + OstTraceExt1( TRACE_NORMAL, CADDBUFFER_GETGROUP_ENTRY, "ENTRY: CAddBuffer::GetGroup;aRoot=%s", aRoot ); + + iCache.Reset(); + TInt retval( KErrNotFound ); + TBool first = ETrue; + TBuf8 groupTag; + groupTag.Copy( aRoot ); + groupTag.Append( KChildNodeWildCardPattern ); + + for ( TInt i = 0; i < iBuffer.Count(); ++i ) + { + if ( iBuffer[i]->iUri.Match( groupTag ) != KErrNotFound + && !iBuffer[i]->iProcessed ) + { + if ( first ) + { + groupTag.Insert( aRoot.Length(), KNodeSeparator ); + groupTag.Insert( aRoot.Length() + 1, CUtils::GetSecondURISeg( iBuffer[i]->iUri ) ); + first = EFalse; + retval = 0; + } + aGroup->Append(iBuffer[i]); + iCache.Append(iBuffer[i]); + retval++; + } + } + OstTrace1( TRACE_NORMAL, CADDBUFFER_GETGROUP_EXIT, "EXIT: CAddBuffer::GetGroup;retval=%d", retval ); + + return retval; + } +//------------------------------------------------------------------------------ +// CAddBuffer::~CAddBuffer() +//------------------------------------------------------------------------------ +void CAddBuffer::Reset() + { + OstTraceFunctionEntry0( CADDBUFFER_Reset_ENTRY ); + + iBuffer.ResetAndDestroy(); + + OstTraceFunctionExit0( CADDBUFFER_Reset_EXIT ); + } + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/src/BranchBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/src/BranchBase.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,220 @@ +/* + * ============================================================================== + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * ============================================================================== + */ + +#include +#include +#include +#include "BranchBase.h" + +#include "Utils.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "BranchBaseTraces.h" +#endif + +_LIT8( KCMProxyNodeSeparator, "/" ); + + + +// ======== LOCAL FUNCTIONS ========= + +// ======== MEMBER FUNCTIONS ======== +// ------------------------------------------------------------------------------------- +// CBranchBase::CBranchBase() +// ------------------------------------------------------------------------------------- +CBranchBase::CBranchBase() + { + OstTraceFunctionEntry0( CBRANCHBASE_CBRANCHBASE_ENTRY ); + + OstTraceFunctionExit0( CBRANCHBASE_CBRANCHBASE_EXIT ); + } +// ------------------------------------------------------------------------------------- +// CBranchBase::CBranchBase +// ------------------------------------------------------------------------------------- +CBranchBase::CBranchBase( MSmlDmCallback* aDmCallback ) + + { + OstTraceFunctionEntry0( CBRANCHBASE_CBRANCHBASE_2_ENTRY ); + iCallback = aDmCallback; + OstTraceFunctionExit0( DUP1_CBRANCHBASE_CBRANCHBASE_2_EXIT ); + } +// ------------------------------------------------------------------------------------- +// CBranchBase::~CBranchBase() +// ------------------------------------------------------------------------------------- +CBranchBase::~CBranchBase() + { + OstTraceFunctionEntry0( CBRANCHBASE_DELETE_ENTRY ); + + OstTraceFunctionExit0( CBRANCHBASE_DELETE_EXIT ); + } + +// ------------------------------------------------------------------------------------- +// CBranchBase::GetAllConnectionMethodsL() +// Returns all connection methods +// ------------------------------------------------------------------------------------- +void CBranchBase::GetAllConnectionMethodsL( RArray& aCmArray, + RCmManagerExt& aCmManager ) + { + OstTraceFunctionEntry0( CBRANCHBASE_GETALLCONNECTIONMETHODSL_ENTRY ); + + // Get all connection methods + TBool supportedBearersOnly = EFalse; + TBool legacyCmsOnly = EFalse; + TBool includeEasyWlan = EFalse; + + aCmManager.ConnectionMethodL( aCmArray, + supportedBearersOnly, + legacyCmsOnly, + includeEasyWlan ); + + RCmConnectionMethodExt cm; + + // Loop all connection methods and filter away everything else besides packet data. + // Other bearer types are not supported + for( TInt i = 0; i < aCmArray.Count(); i++ ) + { + if ( GetConnectionMethodLC( aCmManager, cm, aCmArray[i] ) ) + { + TUint bearerType = cm.GetIntAttributeL( CMManager::ECmBearerType ); + + if( bearerType != KUidPacketDataBearerType ) + { + // Non supported bearer type. Remove + aCmArray.Remove( i ); + i--; + } + } + CleanupStack::PopAndDestroy( &cm ); + } + OstTrace1( TRACE_NORMAL, CBRANCHBASE_GETALLCONNECTIONMETHODSL_COUNT, "CBranchBase::GetAllConnectionMethodsL; Found %u connection methods.", aCmArray.Count() ); + + OstTraceFunctionExit0( CBRANCHBASE_GETALLCONNECTIONMETHODSL_EXIT ); + } + +//----------------------------------------------------------------------------- +// TBool CBranchBase::CheckPreviousURIList() +//----------------------------------------------------------------------------- +TBool CBranchBase::CheckPreviousURIList( const CArrayFix& aPreviousURISegmentList, + const TUint32 aCmId, + TDes8& aURISeg ) + { + OstTraceExt2( TRACE_NORMAL, CBRANCHBASE_CHECKPREVIOUSURILIST_ENTRY, "ENTRY: CBranchBase::CheckPreviousURIList;aURISeg=%s;aCmId=%u", aURISeg, aCmId ); + + TBool retval = EFalse; + + for ( TInt i = 0; i < aPreviousURISegmentList.Count(); i++ ) + { + if ( CUtils::IntLUID( aPreviousURISegmentList.At(i).iURISegLUID ) == aCmId ) + { + aURISeg.Copy( aPreviousURISegmentList.At(i).iURISeg ); + retval = ETrue; + break; + } + } + OstTrace1( TRACE_NORMAL, CBRANCHBASE_CHECKPREVIOUSURILIST_EXIT, "EXIT: CBranchBase::CheckPreviousURIList;retval=%d", retval ); + + return retval; + } + + +//----------------------------------------------------------------------------- +// CBranchBase::GetAllDynamicNodesL +//----------------------------------------------------------------------------- +void CBranchBase::GetAllDynamicNodesL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + RCmManagerExt& /*aCmManagerExt*/, + CBufBase& aCurrentURISegmentList, + const TDesC8& aField, + const TInt aNodeCount, + MSmlDmCallback* aCallback ) + { + OstTraceExt3( TRACE_NORMAL, + CBRANCHBASE_GETALLDYNAMICNODESL_ENTRY, + "ENTRY: CBranchBase::GetAllDynamicNodesL;aURI=%s;aField=%s;aNodeCount=%d", + aURI, + aField, + aNodeCount ); + + if ( aPreviousURISegmentList.Count() > 0 ) // Already mapped + { + for ( TInt i = 0; i < aPreviousURISegmentList.Count(); i++ ) + { + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), + aPreviousURISegmentList.At(i).iURISeg ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), + KCMProxyNodeSeparator ); + } + } + else + { + TBuf8 addNodeName; + + // Generate as many nodes as defined + for ( TInt i = 1; i <= aNodeCount; i++ ) + { + addNodeName.Format( _L8( "%s%d" ), aField.Ptr(), i ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), addNodeName ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), + KCMProxyNodeSeparator ); + } + } + + aCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + aCallback->SetResultsL( aResultsRef, aCurrentURISegmentList, KNullDesC8); + + OstTrace0( TRACE_NORMAL, + CBRANCHBASE_GETALLDYNAMICNODESL_EXIT, + "EXIT: CBranchBase::GetAllDynamicNodesL" ); + + } + +//------------------------------------------------------------------------------ +// TBool CBranchBase::GetConnectionMethodLC() +//------------------------------------------------------------------------------ +TBool CBranchBase::GetConnectionMethodLC( RCmManagerExt& aCmManagerExt, + RCmConnectionMethodExt& aCm, + TUint32 aCmId ) + { + OstTrace1( TRACE_NORMAL, CBRANCHBASE_GETCONNECTIONMETHODLC_ENTRY, "ENTRY: CBranchBase::GetConnectionMethodLC;aCmId=%d", aCmId ); + TInt error( KErrNone ); + + TRAP( error, aCm = aCmManagerExt.ConnectionMethodL( aCmId ) ); + + CleanupClosePushL( aCm ); + + if ( error != KErrNone ) + { + OstTrace0( TRACE_NORMAL, + CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_NOT_FOUND, + "EXIT: CBranchBase::GetConnectionMethodLC;Connection Method NOT found: EFalse." ); + return EFalse; + } + + OstTrace0( TRACE_NORMAL, + CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_FOUND, + "EXIT: CBranchBase::GetConnectionMethodLC;Connection Method FOUND: ETrue." ); + + return ETrue; + } + +// ======== GLOBAL FUNCTIONS ======== + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/src/ConnMoAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/src/ConnMoAdapter.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,571 @@ +/* + * ============================================================================== + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * ============================================================================== + */ + +#include +#include // For TImplementationProxy definition +#include + +#include "nsmldebug.h" +#include "ConnMoAdapter.h" +#include "Utils.h" +#include "BranchBase.h" +#include "NapBranch.h" +#include "ProxyBranch.h" +#include "AddBuffer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ConnMoAdapterTraces.h" +#endif + +// ------------------------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------------------------ +// DDF version number +_LIT8( KConnMoAdapterDDFversion, "1.0"); + +// URI base for ConnMo Nodes +_LIT8( KConnMoBase, ""); + +// ======== LOCAL FUNCTIONS ========= + +CBranchBase* CConnMoAdapter::GetBranch( const TDesC8& aUri ) + { + TDesC8 connMoBase( KConnMoBase ); + CBranchBase* retval = NULL; + + TPtrC8 connMoTree = + ( CUtils::GetEndOfURIFromSeg( aUri, KConnMoBase )).Mid( connMoBase.Size() ); + + if ( CUtils::GetFirstURISeg( connMoTree ).Match( KCMDdfNAP )!= KErrNotFound ) + { + retval = iNapBranch; + } + else if ( CUtils::GetFirstURISeg( connMoTree ).Match( KCMDdfProxy )!= KErrNotFound ) + { + retval = iProxyBranch; + } + return retval; + } + +// ------------------------------------------------------------------------------------- +// CConnMoAdapter::AddBaseUriL( ) +// Handles addition of possible base URI to ConnMO DDF structure +// ------------------------------------------------------------------------------------- +MSmlDmDDFObject& CConnMoAdapter::AddBaseUriL( MSmlDmDDFObject& aRootDDF ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_ADDBASEURIL_ENTRY ); + + TDesC8 base(KConnMoBase); + + if ( base.Size() > 0) + { + + // Set rest acceptable operations for data itself + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + MSmlDmDDFObject& ddf = aRootDDF.AddChildObjectL( KConnMoBase ); // CMO + + _LIT8( KDescription, "ConnMo DDF description" ); + _LIT8( KDFTitle, "ConnMo Settings Base Node" ); + + CUtils::FillNodeInfoL( ddf, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, + KDescription ); + + ddf.SetDFTitleL( KDFTitle ); + ddf.SetDefaultValueL( KNullDesC8 ); + OstTraceFunctionExit0( CCONNMOADAPTER_ADDBASEURIL_EXIT ); + return ddf; + } + else + { + OstTraceFunctionExit0( CCONNMOADAPTER_ADDBASEURIL_EXIT_2 ); + return aRootDDF; + } + + } +// ------------------------------------------------------------------------------------- +// CConnMoAdapter::AddBranchL( ) +// Adds dynamic branch to given root node with given name +// ------------------------------------------------------------------------------------- +MSmlDmDDFObject& CConnMoAdapter::AddBranchL( MSmlDmDDFObject& aRootDDF, + const TDesC8& aNodeName ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_ADDBRANCHL_ENTRY, "ENTRY: CConnMoAdapter::AddBranchL;aNodeName=%s", aNodeName ); + + // Set rest acceptable operations for data itself + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + TSmlDmAccessTypes aclTypesAll; + aclTypesAll.SetGet(); + aclTypesAll.SetReplace(); + aclTypesAll.SetAdd(); + aclTypesAll.SetDelete(); + + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + MSmlDmDDFObject& nChildRootDdf = aRootDDF.AddChildObjectL( aNodeName ); // Node + CUtils::FillNodeInfoL( nChildRootDdf, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nChildDdf = nChildRootDdf.AddChildObjectGroupL(); // Node/ + if ( aNodeName == KCMDdfNAP ) + { + CUtils::FillNodeInfoL( nChildDdf, + aclTypesAll, + MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + } + else + { + CUtils::FillNodeInfoL( nChildDdf, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + } + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_ADDBRANCHL_EXIT, "EXIT: CConnMoAdapter::AddBranchL" ); + return nChildDdf; + } + +// ======== MEMBER FUNCTIONS ======== +//----------------------------------------------------------------------------- +// CConnMoAdapter* CConnMoAdapter::NewL( ) +//----------------------------------------------------------------------------- +CConnMoAdapter* CConnMoAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_NEWL_ENTRY ); + + CConnMoAdapter* self = CConnMoAdapter::NewLC( aDmCallback ); + CleanupStack::Pop(); + + OstTraceFunctionExit1( CCONNMOADAPTER_NEWL_EXIT, ( TUint )( self ) ); + return self; + } + +//----------------------------------------------------------------------------- +// CConnMoAdapter* CConnMoAdapter::NewLC( ) +//----------------------------------------------------------------------------- +CConnMoAdapter* CConnMoAdapter::NewLC( MSmlDmCallback* aDmCallback ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_NEWLC_ENTRY ); + + CConnMoAdapter* self = new ( ELeave ) CConnMoAdapter( aDmCallback ); + CleanupStack::PushL( self ); + + self->iCallBack = aDmCallback; + self->ConstructL(); + + OstTraceFunctionExit1( CCONNMOADAPTER_NEWLC_EXIT, ( TUint )( self ) ); + return self; + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::CConnMoAdapter() +//------------------------------------------------------------------------------ +CConnMoAdapter::CConnMoAdapter( TAny* aEcomArguments ) + : CSmlDmAdapter( aEcomArguments ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_CCONNMOADAPTER_ENTRY ); + + OstTraceFunctionExit0( CCONNMOADAPTER_CCONNMOADAPTER_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::~CConnMoAdapter() +//------------------------------------------------------------------------------ +CConnMoAdapter::~CConnMoAdapter() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_DELETE_ENTRY ); + + delete iBuffer; + delete iNapBranch; + delete iProxyBranch; + iCmManager.Close(); + + OstTraceFunctionExit0( CCONNMOADAPTER_DELETE_EXIT ); + } + +//============================================= +// CConnMoAdapter::ConstructL() +// Second phase constructor. +//============================================= +void CConnMoAdapter::ConstructL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_CONSTRUCTL_ENTRY ); + + iCmManager.OpenL(); + + iBuffer = CAddBuffer::NewL(); + iNapBranch = CNapBranch::NewL( iCallBack, iBuffer, &iCmManager ); + iProxyBranch = CProxyBranch::NewL( iCallBack, iBuffer, &iCmManager ); + + OstTraceFunctionExit0( CCONNMOADAPTER_CONSTRUCTL_EXIT ); + } + +void CConnMoAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_DDFVERSIONL_ENTRY ); + + aDDFVersion.InsertL( 0, KConnMoAdapterDDFversion ); + + OstTraceFunctionExit0( CCONNMOADAPTER_DDFVERSIONL_EXIT ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::DDFStructureL() +//------------------------------------------------------------------------------ +void CConnMoAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_DDFSTRUCTUREL_ENTRY ); + + // Insert Base URI in the beginning of the tree + MSmlDmDDFObject& ddf = AddBaseUriL( aDDF); + + // NAP Branch + MSmlDmDDFObject& nNapDdf = AddBranchL( ddf, KCMDdfNAP ); + iNapBranch->DDFStructureL( nNapDdf ); + + // Proxy Branch + MSmlDmDDFObject& nProxyDdf = AddBranchL( ddf, KCMDdfProxy ); + iProxyBranch->DDFStructureL( nProxyDdf ); + + OstTraceFunctionExit0( CCONNMOADAPTER_DDFSTRUCTUREL_EXIT ); + } + +void CConnMoAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_UPDATELEAFOBJECTL_ENTRY, "ENTRY: CConnMoAdapter::UpdateLeafObjectL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->UpdateLeafObjectL( aURI, aLUID, aObject, aType, aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_UPDATELEAFOBJECTL_EXIT, "EXIT: CConnMoAdapter::UpdateLeafObjectL" ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::UpdateLeafObjectL +//------------------------------------------------------------------------------ +void CConnMoAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_ENTRY ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::UpdateLeafObjectL;Unsupported method call. CSmlDmAdapter::EError." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_EXIT ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::DeleteObjectL +//------------------------------------------------------------------------------ +void CConnMoAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_DELETEOBJECTL_ENTRY, "ENTRY: CConnMoAdapter::DeleteObjectL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->DeleteObjectL( aURI, aLUID, aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_DELETEOBJECTL_EXIT, "EXIT: CConnMoAdapter::DeleteObjectL" ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::FetchLeafObjectL +//------------------------------------------------------------------------------ +void CConnMoAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_FETCHLEAFOBJECTL_ENTRY, "ENTRY: CConnMoAdapter::FetchLeafObjectL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->FetchLeafObjectL( aURI, aLUID, aType, aResultsRef, aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_FETCHLEAFOBJECTL_EXIT, "EXIT: CConnMoAdapter::FetchLeafObjectL" ); + } + +//------------------------------------------------------------------------------ +// void CConnMoAdapter::FetchLeafObjectSizeL +//------------------------------------------------------------------------------ +void CConnMoAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_ENTRY, "ENTRY: CConnMoAdapter::FetchLeafObjectSizeL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->FetchLeafObjectSizeL( aURI, + aLUID, + aType, + aResultsRef, + aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_EXIT, "EXIT: CConnMoAdapter::FetchLeafObjectSizeL" ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::ChildURIListL +// Return childs of the requested node. +//------------------------------------------------------------------------------ +void CConnMoAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_CHILDURILISTL_ENTRY, "ENTRY: CConnMoAdapter::ChildURIListL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->ChildURIListL( aURI, aLUID, aPreviousURISegmentList, + aResultsRef, aStatusRef ); + + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_CHILDURILISTL_EXIT, "EXIT: CConnMoAdapter::ChildURIListL" ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::AddNodeObjectL +//------------------------------------------------------------------------------ +void CConnMoAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CCONNMOADAPTER_ADDNODEOBJECTL_ENTRY, "ENTRY: CConnMoAdapter::AddNodeObjectL;aURI=%s", aURI ); + + CBranchBase* implementation = GetBranch( aURI ); + + implementation->AddNodeObjectL( aURI, aParentLUID, aStatusRef ); + + OstTrace0( TRACE_NORMAL, CCONNMOADAPTER_ADDNODEOBJECTL_EXIT, "EXIT: CConnMoAdapter::AddNodeObjectL" ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::ExecuteCommandL +// Not supported. Returns EError. +//------------------------------------------------------------------------------ +void CConnMoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_EXECUTECOMMANDL_ENTRY ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_EXECUTECOMMANDL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::ExecuteCommandL;Unsupported method call. CSmlDmAdapter::EError." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_EXECUTECOMMANDL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::ExecuteCommandL +// Not supported. Returns EError. +//------------------------------------------------------------------------------ +void CConnMoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_ENTRY ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::ExecuteCommandL;Unsupported method call. CSmlDmAdapter::EError." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::CopyCommandL +// Not supported. Returns EError. +//------------------------------------------------------------------------------ +void CConnMoAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_COPYCOMMANDL_ENTRY ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_COPYCOMMANDL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::CopyCommandL;Unsupported method call. CSmlDmAdapter::EError." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_COPYCOMMANDL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::StartAtomicL +// Not supported. +//------------------------------------------------------------------------------ +void CConnMoAdapter::StartAtomicL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_STARTATOMICL_ENTRY ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_STARTATOMICL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::StartAtomicL;Unsupported method call." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_STARTATOMICL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::CommitAtomicL +// Not supported. +//------------------------------------------------------------------------------ +void CConnMoAdapter::CommitAtomicL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_COMMITATOMICL_ENTRY ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_COMMITATOMICL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::CommitAtomicL;Unsupported method call." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_COMMITATOMICL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::RollbackAtomicL +// Not supported. +//------------------------------------------------------------------------------ +void CConnMoAdapter::RollbackAtomicL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_ROLLBACKATOMICL_ENTRY ); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_ROLLBACKATOMICL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::RollbackAtomicL;Unsupported method call." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_ROLLBACKATOMICL_EXIT ); + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::StreamingSupport +// Not supported. Returns EFalse. +//------------------------------------------------------------------------------ +TBool CConnMoAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + OstTraceFunctionEntry0( CCONNMOADAPTER_STREAMINGSUPPORT_ENTRY ); + + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_STREAMINGSUPPORT_NOT_SUPPORTED, + "CConnMoAdapter::StreamingSupport;Not supported." ); + + OstTraceFunctionExitExt( CCONNMOADAPTER_STREAMINGSUPPORT_EXIT, this, EFalse ); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CConnMoAdapter::StreamCommittedL +// Not supported. Returns EError. +//------------------------------------------------------------------------------ +void CConnMoAdapter::StreamCommittedL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_STREAMCOMMITTEDL_ENTRY); + + OstTrace0( TRACE_NORMAL, + CCONNMOADAPTER_STREAMCOMMMITTEDL_UNSUPPORTED_METHOD_CALL, + "CConnMoAdapter::StreamCommittedL;Unsupported method call." ); + + OstTraceFunctionExit0( CCONNMOADAPTER_STREAMCOMMITTEDL_EXIT ); + } + +void CConnMoAdapter::CompleteOutstandingCmdsL() + { + OstTraceFunctionEntry0( CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_ENTRY ); + + iNapBranch->ProcessBufferL(); + iProxyBranch->ProcessBufferL(); + + iBuffer->Reset(); + + OstTraceFunctionExit0( CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_EXIT ); + } + +// ======== GLOBAL FUNCTIONS ======== +//------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------ +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KConnMoAdapterUid, CConnMoAdapter::NewL) + }; + +//------------------------------------------------------------------------------ +// TImplementationProxy* ImplementationGroupProxy() +//------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + OstTraceFunctionEntry1( CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_ENTRY, aTableCount ); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + OstTraceFunctionExit0( CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_EXIT ); + return ImplementationTable; + } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/src/ConnMoAdapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/src/ConnMoAdapter.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,42 @@ +/** @file +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ConnMO resources +* +*/ + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x2001FE5E; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001FE5F; // DM ConnMO Adapter + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/src/Luid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/src/Luid.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,78 @@ +/* + * ============================================================================== + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * ============================================================================== + */ + +#include "Luid.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "LuidTraces.h" +#endif + + +// ======== LOCAL FUNCTIONS ========= + +// ======== MEMBER FUNCTIONS ======== + +//------------------------------------------------------------------------------ +// TLuid::TLuid() +//------------------------------------------------------------------------------ +TLuid::TLuid() + { + + } + +//------------------------------------------------------------------------------ +// TLuid::TLuid() +//------------------------------------------------------------------------------ +TLuid::TLuid( const TDesC8& aName, const TUint32 aCmId ) + { + OstTraceExt2( TRACE_NORMAL, TLUID_TLUID, "ENTRY: TLuid::TLuid;aName=%s;aCmId=%u", aName, aCmId ); + + iName = aName; + iCmId = aCmId; + } + +//------------------------------------------------------------------------------ +// TLuid::Equals() +//------------------------------------------------------------------------------ +TBool TLuid::Equals( TUint32 aId ) const + { + OstTraceFunctionEntry1( TLUID_EQUALS_ENTRY, this ); + if ( aId == iCmId) + { + OstTraceFunctionExitExt( TLUID_EQUALS_EXIT, this, ETrue ); + return ETrue; + } + else + { + OstTraceFunctionExitExt( DUP1_TLUID_EQUALS_EXIT, this, EFalse ); + return EFalse; + } + } + +//------------------------------------------------------------------------------ +// TLuid::GetCmId() +//------------------------------------------------------------------------------ +TUint32 TLuid::GetCmId() + { + OstTrace1( TRACE_NORMAL, TLUID_GETCMID, "TLuid::GetCmId;iCmId=%u", iCmId ); + + return iCmId; + } + +// ======== GLOBAL FUNCTIONS ======== diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/src/NapBranch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/src/NapBranch.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,1350 @@ +/* + * ============================================================================== + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * ============================================================================== + */ +#include +#include +#include +#include +#include +#include +#include "NapBranch.h" +#include "Utils.h" +#include "AddBuffer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "NapBranchTraces.h" +#endif +// ------------------------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------------------------ +// NAP Branch +_LIT8( KCMDdfID, "ID" ); +_LIT8( KCMDdfName, "Name" ); +_LIT8( KCMDdfAddrType, "AddrType" ); +_LIT8( KCMDdfAddr, "Addr" ); +_LIT8( KCMDdfIP, "IP" ); +_LIT8( KCMDdfAuthInfo, "AuthInfo" ); +_LIT8( KCMDdfAuthType, "AuthType" ); +_LIT8( KCMDdfBearerType, "BearerType" ); +_LIT8( KCMDdfBearerParams, "BearerParams" ); +_LIT8( KCMDdfIPv4, "IPv4" ); +_LIT8( KCMDdfAutoConfig, "AutoConfig" ); +_LIT8( KCMDdfIPAddr, "IPAddr" ); +_LIT8( KCMDdfNetMask, "NetMask" ); +_LIT8( KCMDdfGateway, "Gateway" ); +_LIT8( KCMDdfAutoDNS, "AutoDNS" ); +_LIT8( KCMDdfDNS, "DNS" ); +_LIT8( KCMDdfServers, "Servers" ); +_LIT8( KCMDdfServer, "Server" ); +_LIT8( KCMDdfAuthName, "AuthName" ); +_LIT8( KCMDdfAuthSecret, "AuthSecret" ); +// NAP Child URI List +_LIT8( KCMNapFields, "ID/Name/AddrType/Addr/IP/AuthInfo/BearerType" ); +_LIT8( KCMNIPFields, "IPv4" ); +_LIT8( KCMNIPv4Fields, "AutoConfig/IPAddr/NetMask/Gateway/AutoDNS/DNS" ); +_LIT8( KCMNDNSFields, "Servers" ); +_LIT8( KCMNAuthInfoFields, "AuthType/AuthName/AuthSecret" ); +_LIT8( KCMNDNSServersFields, "Addr"); +_LIT8( KSlash, "/" ); +_LIT8( KDynamicNapNode, "NAP/*" ); +_LIT8( KDynamicNapNodeChildUri, "NAP/*/*" ); +_LIT8( KDynamicIPNode, "NAP/*/IP" ); +_LIT8( KDynamicIPNodeChildUri, "NAP/*/IP/*" ); +_LIT8( KDynamicIPv4Node, "NAP/*/IP/IPv4" ); +_LIT8( KDynamicIPv4NodeChildUri, "NAP/*/IP/IPv4/*" ); +_LIT8( KDynamicIPv4DnsNode, "NAP/*/IP/IPv4/DNS" ); +_LIT8( KDynamicIPv4DnsNodeChildUri, "NAP/*/IP/IPv4/DNS/*" ); +_LIT8( KDynamicIPv4DnsServersNode, "NAP/*/IP/IPv4/DNS/Servers" ); +_LIT8( KDynamicIPv4DnsServersNodeChildUri, "NAP/*/IP/IPv4/DNS/Servers/*" ); +_LIT8( KDynamicIPv4DnsServersNodeChildUriNodes, "NAP/*/IP/IPv4/DNS/Servers/*/*"); +_LIT8( KDynamicAuthInfoNode, "NAP/*/AuthInfo"); +_LIT8( KDynamicAuthInfoNodeChildUri, "NAP/*/AuthInfo/*"); +_LIT8( KNapBearerTypeUri, "NAP/*/BearerType"); +_LIT8( KNapAddrUri, "NAP/*/Addr"); +_LIT8( KNapDNSAddr1Uri, "NAP/*/Server1/Addr"); +_LIT8( KNapDNSAddr2Uri, "NAP/*/Server2/Addr"); +_LIT8( KNapIPv4AddrUri, "NAP/*/IPv4/*Addr"); +_LIT8( KPacketDataBearerType, "3GPPPS"); +_LIT8( KGPRSAddrType, "APN"); +_LIT8( KGPRSAuthType, "PAP"); + + +TInt const KInvalidBearerType = 0; +TInt const KBufferExpandSize = 128; +TInt const KNumOfNAPNodes = 8; +TInt const KMaxResultSize = 64; +TInt const KMaxDnsAddr = 2; +_LIT8( KFalse, "False"); +_LIT8( KTrue, "True"); + +_LIT8( KDynamicNodePrefix, "NAPId" ); + +// ======== LOCAL FUNCTIONS ========= +//----------------------------------------------------------------------------- +// TUint32 CNapBranch::CheckForUnmodifiableFieldL() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNapBranch::GetUnmodifiableFieldValueL( + const TDesC8& aUri, CBufBase* aResult) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_GETUNMODIFIABLEFIELDVALUEL_ENTRY, + "ENTRY: CNapBranch::GetUnmodifiableFieldValueL;aUri=%s", aUri ); + + CSmlDmAdapter::TError retval( CSmlDmAdapter::ENotFound ); + TPtrC8 nodeName = CUtils::GetLastURISeg( aUri ); + + if ( nodeName.Match( KCMDdfAddrType ) != KErrNotFound ) + { + aResult->InsertL( 0, KGPRSAddrType ); + retval = CSmlDmAdapter::EOk; + } + else if ( nodeName.Match( KCMDdfBearerType ) != KErrNotFound ) + { + aResult->InsertL( 0, KPacketDataBearerType ); + retval = CSmlDmAdapter::EOk; + } + else if ( nodeName.Match( KCMDdfAuthType ) != KErrNotFound ) + { + aResult->InsertL( 0, KGPRSAuthType ); + retval = CSmlDmAdapter::EOk; + } + else if ( nodeName.Match( KCMDdfID ) != KErrNotFound ) + { + TPtrC8 dynamicNode = GetDynamicNAPNodeUri( aUri ); + aResult->InsertL( 0, dynamicNode ); + retval = CSmlDmAdapter::EOk; + } + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_GETUNMODIFIABLEFIELDVALUEL_EXIT, + "EXIT: CNapBranch::GetUnmodifiableFieldValueL;retval=%{TError}", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// CSmlDmAdapter::TErrorCNapBranch::GetLeafData() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNapBranch::GetLeafDataL(const TDesC8& aURI, + RCmConnectionMethodExt& aCm, CBufBase* aResult) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_GETLEAFDATAL_ENTRY, + "ENTRY: CNapBranch::GetLeafDataL;aURI=%s", aURI ); + + TUint32 attributeRef( 0 ); + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + HBufC16* resultTmp; + + attributeRef = MapUriToCmAttribute( aURI ); + switch ( attributeRef ) + { + case CMManager::ECmName: + case CMManager::EPacketDataIPNameServer1: + case CMManager::EPacketDataIPNameServer2: + case CMManager::EPacketDataAPName: + case CMManager::EPacketDataIFAuthName: + case CMManager::EPacketDataIPAddr: + case CMManager::EPacketDataIPNetmask: + case CMManager::EPacketDataIPGateway: + resultTmp = aCm.GetStringAttributeL( attributeRef ); + CleanupStack::PushL( resultTmp ); + aResult->InsertL( 0, CUtils::ConvertTo8LC( *resultTmp ) ); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + CleanupStack::PopAndDestroy( resultTmp ); + break; + case CMManager::EPacketDataIPAddrFromServer: + case CMManager::EPacketDataIPDNSAddrFromServer: + if ( aCm.GetBoolAttributeL( attributeRef ) ) + { + aResult->InsertL( 0, KTrue ); + } + else + { + aResult->InsertL( 0, KFalse ); + } + + break; + default: + status = GetUnmodifiableFieldValueL( aURI, aResult ); + break; + } + OstTrace1( TRACE_NORMAL, CNAPBRANCH_GETLEAFDATAL_EXIT, + "EXIT: CNapBranch::GetLeafDataL;status=%{TError}", status ); + + return status; + } + +//----------------------------------------------------------------------------- +// CNapBranch::GetUnmodifiableFieldAddResult() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNapBranch::GetUnmodifiableFieldAddResult( + const TDesC8& aUri, const TDesC8& aObject) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_GETUNMODIFIABLEFIELDADDRESULT_ENTRY, + "ENTRY: CNapBranch::GetUnmodifiableFieldAddResult;aUri=%s", aUri ); + + CSmlDmAdapter::TError retval( CSmlDmAdapter::ENotFound ); + TPtrC8 nodeName = CUtils::GetLastURISeg( aUri ); + + if ( nodeName.Match( KCMDdfAddrType ) != KErrNotFound ) + { + if ( aObject.Match( KGPRSAddrType ) != KErrNotFound ) + { + retval = CSmlDmAdapter::EOk; + } + else + { + retval = CSmlDmAdapter::EInvalidObject; + } + } + else if ( nodeName.Match( KCMDdfAuthType ) != KErrNotFound ) + { + if ( aObject.Match( KGPRSAuthType ) != KErrNotFound ) + { + retval = CSmlDmAdapter::EOk; + } + else + { + retval = CSmlDmAdapter::EInvalidObject; + } + } + + OstTrace1( TRACE_NORMAL, DUP1_CNAPBRANCH_GETUNMODIFIABLEFIELDADDRESULT_EXIT, + "EXIT: CNapBranch::GetUnmodifiableFieldAddResult;retval=%{TError}", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// CNapBranch::MapUriToCmAttribute(() +//----------------------------------------------------------------------------- +TUint32 CNapBranch::MapUriToCmAttribute(const TDesC8& aUri) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_MAPURITOCMATTRIBUTE_ENTRY, + "ENTRY: CNapBranch::MapUriToCmAttribute;aUri=%s", aUri ); + + TUint32 retval( 0 ); + + TPtrC8 nodeName = CUtils::GetLastURISeg( aUri ); + + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_MAPURITOCMATTRIBUTE_GET_NODE, + "CNapBranch::MapUriToCmAttribute;nodeName=%s", nodeName ); + + if ( nodeName.Match( KCMDdfName ) != KErrNotFound ) + { + retval = CMManager::ECmName; + } + else if ( nodeName.Match( KCMDdfAddr ) != KErrNotFound ) + { + // IP branch and NAP branch have both "Addr" leaf. Select between them. + if ( aUri.Match( KNapAddrUri ) != KErrNotFound && + aUri.Match( KNapIPv4AddrUri ) == KErrNotFound ) + { + retval = CMManager::EPacketDataAPName; + } + else if ( aUri.Match( KNapDNSAddr1Uri ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPNameServer1; + } + else if ( aUri.Match( KNapDNSAddr2Uri ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPNameServer2; + } + } + else if ( nodeName.Match( KCMDdfBearerType ) != KErrNotFound ) + { + retval = CMManager::ECmBearerType; + } + else if ( nodeName.Match( KCMDdfAuthName ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIFAuthName; + } + else if ( nodeName.Match( KCMDdfAuthSecret ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIFAuthPass; + } + else if ( nodeName.Match( KCMDdfAutoConfig ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPAddrFromServer; + } + else if ( nodeName.Match( KCMDdfIPAddr ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPAddr; + } + else if ( nodeName.Match( KCMDdfNetMask ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPNetmask; + } + else if ( nodeName.Match( KCMDdfGateway ) != KErrNotFound ) + { + retval = CMManager::EPacketDataIPGateway; + } + else if ( nodeName.Match( KCMDdfAutoDNS )!= KErrNotFound ) + { + retval = CMManager::EPacketDataIPDNSAddrFromServer; + } + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_MAPURITOCMATTRIBUTE_EXIT, + "EXIT: CNapBranch::MapUriToCmAttribute;retval=%{TError}", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// void CNapBranch::SetLeafData() +//----------------------------------------------------------------------------- +void CNapBranch::SetLeafDataL(const TDesC8& aURI, const TDesC8& aObject, + TInt aStatusRef, RCmConnectionMethodExt& aCm) + { + OstTraceExt1( TRACE_FLOW, CNAPBRANCH_SETLEAFDATAL_ENTRY, + "ENTRY: CNapBranch::SetLeafDataL;aURI=%s", aURI ); + + TUint32 attributeRef( 0 ); + TBool tmpBool = EFalse; + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + attributeRef = MapUriToCmAttribute( aURI ); + OstTrace1( TRACE_NORMAL, CNAPBRANCH_SETLEAFDATAL_GET_CMATTRIB, + "CNapBranch::SetLeafDataL;CM Attribute:;attributeRef=%{TConnectionMethodCommonAttributes}", + attributeRef ); + + switch ( attributeRef ) + { + case CMManager::ECmName: + case CMManager::EPacketDataIPNameServer1: + case CMManager::EPacketDataIPNameServer2: + case CMManager::EPacketDataAPName: + case CMManager::EPacketDataIFAuthName: + case CMManager::EPacketDataIFAuthPass: + case CMManager::EPacketDataIPAddr: + case CMManager::EPacketDataIPNetmask: + case CMManager::EPacketDataIPGateway: + aCm.SetStringAttributeL( attributeRef, CUtils::ConvertTo16LC( aObject ) ); + CleanupStack::PopAndDestroy(); // ConvertTo16LC + break; + case CMManager::EPacketDataIPAddrFromServer: + case CMManager::EPacketDataIPDNSAddrFromServer: + if ( CUtils::DesToBool( aObject, tmpBool ) == KErrNone ) + { + aCm.SetBoolAttributeL( attributeRef, tmpBool ); + } + else + { + status = CSmlDmAdapter::EInvalidObject; + } + break; + case CMManager::ECmBearerType: + // BearerType is already set when CM was created. + break; + default: + // Attribute field was not from CM. Check if value is hard coded to CM. + status = GetUnmodifiableFieldAddResult( aURI, aObject ); + break; + } + iCallback->SetStatusL( aStatusRef, status ); + OstTrace1( TRACE_NORMAL, CNAPBRANCH_SETLEAFDATAL_EXIT, + "EXIT: CNapBranch::SetLeafDataL;status=%{TError}", status ); + } + +//----------------------------------------------------------------------------- +// TBool CNapBranch::SetNodeData() +//----------------------------------------------------------------------------- +void CNapBranch::SetNodeDataL(CConnMoNodeElement* aNode, + RCmConnectionMethodExt& aCm) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_SETNODEDATAL_ENTRY, + "ENTRY: CNapBranch::SetNodeDataL;aNode->iUri=%s", aNode->iUri ); + + if ( aNode->iParentLUID.Length() == 0 ) + { + TBuf8<16> addLUID; + _LIT8( KFormat, "%d" ); + addLUID.Format( KFormat, aCm.GetIntAttributeL( CMManager::ECmId ) ); + + iCallback->SetMappingL( aNode->iUri, addLUID ); + iCallback->SetStatusL( aNode->iStatusRef, CSmlDmAdapter::EOk ); + + OstTrace0( TRACE_NORMAL, CNAPBRANCH_SETNODEDATAL_OK, + "CNapBranch::SetNodeDataL; CSmlDmAdapter::EOk" ); + } + else + { + iCallback->SetStatusL( aNode->iStatusRef, CSmlDmAdapter::EAlreadyExists ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_SETNODEDATAL_EXISTS, + "CNapBranch::SetNodeDataL; CSmlDmAdapter::EAlreadyExists" ); + } + OstTrace0( TRACE_NORMAL, CNAPBRANCH_SETNODEDATAL_EXIT, + "EXIT: CNapBranch::SetNodeDataL" ); + } + +//----------------------------------------------------------------------------- +// TBool CNapBranch::FindNewCmType +//----------------------------------------------------------------------------- +TBool CNapBranch::FindNewCmType(TUint32& aBearerType) + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FINDNEWCMTYPE_ENTRY, "ENTRY: CNapBranch::FindNewCmType" ); + + TBool retval = EFalse; + // Find bearer type for creating a connection methdod + CConnMoNodeElement* processNode = iBuffer->CacheFind( KNapBearerTypeUri ); + if ( processNode ) + { + if ( processNode->iObject.Match( KPacketDataBearerType ) != KErrNotFound ) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_FINDNEWCMTYPE_3GPP, + "CNapBranch::FindNewCmType;Bearer Type: %s", KPacketDataBearerType ); + + aBearerType = KUidPacketDataBearerType; + retval = ETrue; + } + else + { + aBearerType = KInvalidBearerType; + } + } + OstTrace1( TRACE_NORMAL, CNAPBRANCH_FINDNEWCMTYPE_EXIT, + "EXIT: CNapBranch::FindNewCmType;retval=%d", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CNapBranch::AllMandatoryNapFieldsFound() +//----------------------------------------------------------------------------- +TBool CNapBranch::AllMandatoryNapFieldsFound() + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ALLMANDATORYNAPFIELDSFOUND_ENTRY, + "ENTRY: CNapBranch::AllMandatoryNapFieldsFound" ); + + TBool retval = ETrue; + + // Check that NAP Address addition is found + if ( !iBuffer->CacheFind( KNapAddrUri ) ) + { + retval = EFalse; + } + // Check that dynamic nap node addition is found + if ( !iBuffer->CacheFindDynamicNode( KDynamicNapNode ) ) + { + retval = EFalse; + } + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_ALLMANDATORYNAPFIELDSFOUND_EXIT, + "EXIT: CNapBranch::AllMandatoryNapFieldsFound;retval=%d", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CNapBranch::NapChildURIListL +// TBool CNapBranch::NapChildURIList( ) +//----------------------------------------------------------------------------- +void CNapBranch::NapChildURIListL(const TDesC8& aURI, const CArrayFix< + TSmlDmMappingInfo>& aPreviousURISegmentList, TInt aResultsRef, + TInt aStatusRef, CBufBase& aCurrentURISegmentList) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_NAPCHILDURILISTL_ENTRY, + "ENTRY: CNapBranch::NapChildURIListL;aURI=%s", aURI ); + + RArray CmArray; + CleanupClosePushL( CmArray ); + + TPtrC8 napTree = CUtils::GetEndOfURIFromSeg( aURI, KCMDdfNAP ); + + GetAllConnectionMethodsL( CmArray, *iCmManager ); + + for (TInt i = 0; i < CmArray.Count(); i++ ) + { + TBuf8 addURISeg; + if ( !CheckPreviousURIList( aPreviousURISegmentList, CmArray[i], addURISeg ) ) + { + // Connection Method not found in previous URI list + addURISeg.Append( aURI ); + addURISeg.Append( KSlash ); + addURISeg.Append( KDynamicNodePrefix ); + + addURISeg.AppendNumFixedWidth( CmArray[i], EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8( KFormat, "%d" ); + addLUID.Format( KFormat, CmArray[i] ); + + OstTraceExt1( TRACE_NORMAL, + CNAPBRANCH_NAPCHILDURILISTL_ADDED_TO_LIST, + "CNapBranch::NapChildURIListL;Added to list: URI=%s", addURISeg ); + + iCallback->SetMappingL( addURISeg, addLUID ); + } + + // Child is the last segment in uri + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), + CUtils::GetLastURISeg(addURISeg) ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), KSlash ); + } + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, aCurrentURISegmentList, KNullDesC8 ); + + CleanupStack::PopAndDestroy( &CmArray ); + + OstTrace0( TRACE_NORMAL, CNAPBRANCH_NAPCHILDURILISTL_EXIT, + "EXIT: CNapBranch::NapChildURIListL" ); + } +//----------------------------------------------------------------------------- +// CSmlDmAdapter::TError CNapBranch::DeleteObjectL +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNapBranch::DeleteObjectL(const TDesC8& aURI, + const TDesC8& aLUID) + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_PRIVATE_ENTRY, + "ENTRY: CNapBranch::DeleteObjectL" ); + + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + + RCmConnectionMethodExt cm; + + if( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + + // Check, if referred connection method exists + if ( GetConnectionMethodLC( *iCmManager, cm, cmId ) ) + { + cm.DeleteL(); + status = CSmlDmAdapter::EOk; + OstTrace1( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_PRIVATE_DELETE, + "CNapBranch::DeleteObjectL; Connection Method=%u deleted.", cmId ); + } + + CleanupStack::PopAndDestroy( &cm ); + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_PRIVATE_EXIT, + "EXIT: CNapBranch::DeleteObjectL;status=%{TError}", status ); + + return status; + } + +// ======== MEMBER FUNCTIONS ======== +//----------------------------------------------------------------------------- +// CNapBranch* CNapBranch::NewL( ) +//----------------------------------------------------------------------------- +CNapBranch* CNapBranch::NewL(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, RCmManagerExt* aCmManagerExt) + { + OstTraceFunctionEntry1( CNAPBRANCH_NEWL_ENTRY, ( TUint )( aDmCallback ) ); + + CNapBranch* self = new (ELeave) CNapBranch( aDmCallback ); + CleanupStack::PushL(self); + + self->ConstructL( aBuffer, aCmManagerExt ); + + CleanupStack::Pop(self); + + OstTraceFunctionExit1( CNAPBRANCH_NEWL_EXIT, ( TUint )( self ) ); + return self; + } + +//------------------------------------------------------------------------------ +// CNapBranch::CNapBranch() +//------------------------------------------------------------------------------ +CNapBranch::CNapBranch(MSmlDmCallback* aDmCallback) : + CBranchBase(aDmCallback) + { + OstTraceFunctionEntry1( CNAPBRANCH_CONSTRUCTOR_ENTRY, this ); + + iCallback = aDmCallback; + + OstTraceFunctionExit1( CNAPBRANCH_CONSTRUCTOR_EXIT, this ); + } + +//------------------------------------------------------------------------------ +// CNapBranch::~CNapBranch() +//------------------------------------------------------------------------------ +CNapBranch::~CNapBranch() + { + OstTraceFunctionEntry1( CNAPBRANCH_DESTRUCTOR_ENTRY, this ); + + OstTraceFunctionExit1( CNAPBRANCH_DESTRUCTOR_EXIT, this ); + } + +//============================================= +// CNapBranch::ConstructL() +// Second phase constructor. +//============================================= +void CNapBranch::ConstructL(CAddBuffer* aBuffer, RCmManagerExt* aCmManagerExt) + { + OstTraceFunctionEntry1( CNAPBRANCH_CONSTRUCTL_ENTRY, this ); + + iBuffer = aBuffer; + iCmManager = aCmManagerExt; + + OstTraceFunctionExit1( CNAPBRANCH_CONSTRUCTL_EXIT, this ); + } + +//------------------------------------------------------------------------------ +// void CNapBranch::DDFStructureL() +//------------------------------------------------------------------------------ +void CNapBranch::DDFStructureL(MSmlDmDDFObject& aDDF) + { + OstTraceFunctionEntry0( CNAPBRANCH_DDFSTRUCTUREL_ENTRY ); + + // + // Set rest acceptable operations for data itself + // + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + TSmlDmAccessTypes aclTypesNoGet; + aclTypesNoGet.SetReplace(); + aclTypesNoGet.SetAdd(); + aclTypesNoGet.SetDelete(); + + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + MSmlDmDDFObject& nIDDDF = aDDF.AddChildObjectL( KCMDdfID ); // ID + CUtils::FillNodeInfoL( nIDDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nNameDDF = aDDF.AddChildObjectL( KCMDdfName ); // Name + CUtils::FillNodeInfoL( nNameDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAddrTypeDDF = aDDF.AddChildObjectL( KCMDdfAddrType ); // AddrType + CUtils::FillNodeInfoL( nAddrTypeDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAddrDDF = aDDF.AddChildObjectL( KCMDdfAddr ); // Addr + CUtils::FillNodeInfoL( nAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nIPDDF = aDDF.AddChildObjectL( KCMDdfIP ); // IP + CUtils::FillNodeInfoL( nIPDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nIPv4DDF = nIPDDF.AddChildObjectL( KCMDdfIPv4 ); // IPv4 + CUtils::FillNodeInfoL( nIPv4DDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + IpBranchDDFStructureL( nIPv4DDF ); + + MSmlDmDDFObject& nAuthInfoDDF = aDDF.AddChildObjectL( KCMDdfAuthInfo ); // AuthInfo + CUtils::FillNodeInfoL( nAuthInfoDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nAuthNameDDF = nAuthInfoDDF.AddChildObjectL( KCMDdfAuthName ); // AuthName + CUtils::FillNodeInfoL( nAuthNameDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAuthTypeDDF = nAuthInfoDDF.AddChildObjectL( KCMDdfAuthType ); // AuthType + CUtils::FillNodeInfoL( nAuthTypeDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAuthSecretDDF = nAuthInfoDDF.AddChildObjectL( KCMDdfAuthSecret ); // AuthSecret + CUtils::FillNodeInfoL( nAuthSecretDDF, + aclTypesNoGet, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nBearerTypeDDF = aDDF.AddChildObjectL( KCMDdfBearerType ); // BearerType + CUtils::FillNodeInfoL( nBearerTypeDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nBearerParamsDDF = aDDF.AddChildObjectL( KCMDdfBearerParams ); // BearerParams + CUtils::FillNodeInfoL( nBearerParamsDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + OstTraceFunctionExit0( CNAPBRANCH_DDFSTRUCTUREL_EXIT ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::IpBranchDDFStructureL +// ------------------------------------------------------------------------------------- +void CNapBranch::IpBranchDDFStructureL(MSmlDmDDFObject& nIPvXDDF) + { + OstTraceFunctionEntry0( CNAPBRANCH_IPBRANCHDDFSTRUCTUREL_ENTRY ); + + // + // Set rest acceptable operations for data itself + // + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + MSmlDmDDFObject& nAutoConfigDDF = nIPvXDDF.AddChildObjectL( KCMDdfAutoConfig ); // AutoConfig + CUtils::FillNodeInfoL( nAutoConfigDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nIPAddrDDF = nIPvXDDF.AddChildObjectL( KCMDdfIPAddr ); // IPAddr + CUtils::FillNodeInfoL( nIPAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nNetMaskDDF = nIPvXDDF.AddChildObjectL( KCMDdfNetMask ); // NetMask + CUtils::FillNodeInfoL( nNetMaskDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nGatewayDDF = nIPvXDDF.AddChildObjectL( KCMDdfGateway ); // Gateway + CUtils::FillNodeInfoL( nGatewayDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAutoDNSDDF = nIPvXDDF.AddChildObjectL( KCMDdfAutoDNS ); // AutoDNS + CUtils::FillNodeInfoL( nAutoDNSDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNullDesC8 ); + + MSmlDmDDFObject& nDNSDDF = nIPvXDDF.AddChildObjectL( KCMDdfDNS ); // DNS + CUtils::FillNodeInfoL( nDNSDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nServersDDF = nDNSDDF.AddChildObjectL( KCMDdfServers ); // Servers + CUtils::FillNodeInfoL( nServersDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nServersRootDDF = nServersDDF.AddChildObjectGroupL(); // Servers/ + CUtils::FillNodeInfoL( nServersRootDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nAddrDDF = nServersRootDDF.AddChildObjectL( KCMDdfAddr ); // Addr + CUtils::FillNodeInfoL( nAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + OstTraceFunctionExit0( CNAPBRANCH_IPBRANCHDDFSTRUCTUREL_EXIT ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::UpdateLeafObjectL +// ------------------------------------------------------------------------------------- +void CNapBranch::UpdateLeafObjectL(const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& /*aType*/, TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_UPDATELEAFOBJECTL_ENTRY, + "ENTRY: CNapBranch::UpdateLeafObjectL;aURI=%s", aURI ); + + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + + if ( aLUID.Length() == 0 && cmId == KErrNotFound ) + { + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, aLUID, aObject, aStatusRef ); + } + else + { + // Existing node, update data immediately + TInt err( KErrNone ); + RCmConnectionMethodExt cm; + if ( cmId == KErrNotFound ) + { + cmId = CUtils::IntLUID( aLUID ); + } + + TRAP( err, cm = iCmManager->ConnectionMethodL( cmId ) ); + CleanupClosePushL( cm ); + + if ( !err ) + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_UPDATELEAFOBJECTL, "CNapBranch::UpdateLeafObjectL; Update existing node data immediately." ); + SetLeafDataL( aURI, aObject, aStatusRef, cm ); + cm.UpdateL(); + } + else + { + OstTrace0( TRACE_NORMAL, DUP1_CNAPBRANCH_UPDATELEAFOBJECTL, "CNapBranch::UpdateLeafObjectL; Stale LUID - Buffer setting." ); + iBuffer->AddNodeToBufferL( aURI, KNullDesC8, aObject, aStatusRef ); + } + + CleanupStack::PopAndDestroy( &cm ); + } + + OstTrace0( TRACE_NORMAL, CNAPBRANCH_UPDATELEAFOBJECTL_EXIT, + "EXIT: CNapBranch::UpdateLeafObjectL" ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::DeleteObjectL +// ------------------------------------------------------------------------------------- +void CNapBranch::DeleteObjectL(const TDesC8& aURI, const TDesC8& aLUID, + TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_ENTRY, + "ENTRY: CNapBranch::DeleteObjectL;aURI=%s", aURI ); + + CSmlDmAdapter::TError status = CSmlDmAdapter::EError; + + TPtrC8 napTree = CUtils::GetEndOfURIFromSeg( aURI, KCMDdfNAP ); + + if ( napTree.Match( KDynamicNapNode ) != KErrNotFound && + napTree.Match( KDynamicNapNodeChildUri ) == KErrNotFound ) + { + + status = DeleteObjectL( aURI, aLUID ); + + } + + iCallback->SetStatusL( aStatusRef, status ); + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_DELETEOBJECTL_EXIT, + "EXIT: CNapBranch::DeleteObjectL;status=%{TError}", status ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::FetchLeafObjectL +// ------------------------------------------------------------------------------------- +void CNapBranch::FetchLeafObjectL(const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTL_ENTRY, + "ENTRY: CNapBranch::FetchLeafObjectL;aURI=%s", aURI ); + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + if ( cmId != KErrNotFound ) + { + CBufBase* result = CBufFlat::NewL( KBufferExpandSize ); + CleanupStack::PushL( result ); + + // Open connection method. + RCmConnectionMethodExt cm; + TRAPD(err, cm = iCmManager->ConnectionMethodL( cmId ) ); + if (err != KErrNone ) + { + CleanupStack::PopAndDestroy( result ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_DUP_FETCHLEAFOBJECTL_NOT_FOUND, "CSmlDmAdapter::ENotFound" ); + return; + } + CleanupClosePushL( cm ); + + // Find data from CM + CSmlDmAdapter::TError status = GetLeafDataL( aURI, + cm, + result ); + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTL_STATUS, + "CNapBranch::FetchLeafObjectL;status=%{TError}", status ); + + if ( status == CSmlDmAdapter::EOk ) + { + iCallback->SetResultsL( aResultsRef, *result, aType ); + } + iCallback->SetStatusL( aStatusRef, status ); + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( result ); + } + else + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTL_NOT_FOUND, "CSmlDmAdapter::ENotFound" ); + } + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTL_EXIT, "EXIT: CNapBranch::FetchLeafObjectL" ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::FetchLeafObjectSizeL +// ------------------------------------------------------------------------------------- +void CNapBranch::FetchLeafObjectSizeL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY, + "ENTRY: CNapBranch::FetchLeafObjectSizeL;aURI=%s", aURI ); + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + if ( cmId != KErrNotFound ) + { + CBufBase* result = CBufFlat::NewL( KBufferExpandSize ); + CleanupStack::PushL(result); + + // Open connection method. + RCmConnectionMethodExt cm; + TRAPD(err, cm = iCmManager->ConnectionMethodL( cmId ) ); + if (err != KErrNone ) + { + CleanupStack::PopAndDestroy( result ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_DUP1_FETCHLEAFOBJECTL_NOT_FOUND, "CSmlDmAdapter::ENotFound" ); + return; + } + CleanupClosePushL( cm ); + + // Find data from CM + CSmlDmAdapter::TError status = GetLeafDataL( aURI, + cm, + result ); + + OstTrace1( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTSIZEL_STATUS, + "CNapBranch::FetchLeafObjectSizeL;status=%{TError}", status ); + + if ( status == CSmlDmAdapter::EOk ) + { + TInt size = result->Size(); + TBuf8 sizeStr; + sizeStr.AppendNum( size ); + + result->Reset(); + result->InsertL( 0, sizeStr ); + + iCallback->SetResultsL( aResultsRef, *result, aType); + } + iCallback->SetStatusL( aStatusRef, status ); + + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( result ); + } + else + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTSIZEL_NOT_FOUND, + "CNapBranch::FetchLeafObjectSizeL;CSmlDmAdapter::ENotFound" ); + } + OstTrace0( TRACE_NORMAL, CNAPBRANCH_FETCHLEAFOBJECTSIZEL_EXIT, + "EXIT: CNapBranch::FetchLeafObjectSizeL" ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::ChildURIListL +// ------------------------------------------------------------------------------------- +void CNapBranch::ChildURIListL(const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_CHILDURILISTL_ENTRY, + "ENTRY: CNapBranch::ChildURIListL;aURI=%s", aURI ); + + + TPtrC8 napTree = CUtils::GetEndOfURIFromSeg( aURI,KCMDdfNAP ); + + CBufBase* currentURISegmentList = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( currentURISegmentList ); + + // First handle ./NAP as a special case + if ( napTree.Match( KCMDdfNAP ) != KErrNotFound ) + { + NapChildURIListL( aURI, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *currentURISegmentList ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + return; + } + + // Then check if the CM exists. Use LUID or predefined ID + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + // If after this cmId is still not found then the branch does not exist + if ( cmId == KErrNotFound ) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, DUP1_CNAPBRANCH_CHILDURILISTL, "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + return; + } + + RCmConnectionMethodExt cm; + // Check it the method actually can be found + if ( !GetConnectionMethodLC( *iCmManager, cm, cmId ) ) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, DUP2_CNAPBRANCH_CHILDURILISTL, "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + return; + } + CleanupStack::PopAndDestroy( &cm ); + + if ( napTree.Match( KDynamicNapNode ) != KErrNotFound && + napTree.Match( KDynamicNapNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNapFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/IP + + else if ( napTree.Match( KDynamicIPNode ) != KErrNotFound && + napTree.Match( KDynamicIPNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNIPFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/IP/IPv4 + + else if ( napTree.Match( KDynamicIPv4Node ) != KErrNotFound && + napTree.Match( KDynamicIPv4NodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNIPv4Fields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/IP/IPv4/DNS + + else if ( napTree.Match( KDynamicIPv4DnsNode ) != KErrNotFound && + napTree.Match( KDynamicIPv4DnsNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNDNSFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/IP/IPv4/DNS/Servers + + else if ( napTree.Match( KDynamicIPv4DnsServersNode ) != KErrNotFound ) + { + GetAllDynamicNodesL( aURI, + aLUID, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *iCmManager, + *currentURISegmentList, + KCMDdfServer, + KMaxDnsAddr, + iCallback ); + } + // ./NAP/*/IP/IPv4/DNS/Servers* + + else if ( napTree.Match( KDynamicIPv4DnsServersNodeChildUri ) != KErrNotFound && + napTree.Match( KDynamicIPv4DnsServersNodeChildUriNodes ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNDNSServersFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + // ./NAP/*/AuthInfo + + else if ( napTree.Match( KDynamicAuthInfoNode ) != KErrNotFound && + napTree.Match( KDynamicAuthInfoNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMNAuthInfoFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + else + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_CHILDURILISTL, + "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + } + + CleanupStack::PopAndDestroy( currentURISegmentList ); + + OstTrace0( TRACE_NORMAL, DUP1_CNAPBRANCH_CHILDURILISTL_EXIT, + "EXIT: CNapBranch::ChildURIListL" ); + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::AddNodeObjectL +// ------------------------------------------------------------------------------------- +void CNapBranch::AddNodeObjectL(const TDesC8& aURI, + const TDesC8& aParentLUID, TInt aStatusRef) + { + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_ENTRY, + "ENTRY: CNapBranch::AddNodeObjectL;aURI=%s", aURI ); + + if ( aParentLUID.Length() == 0 ) + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + RCmConnectionMethodExt cm; + // Check if CM exists + if ( cmId != KErrNotFound && GetConnectionMethodLC( *iCmManager, cm, cmId ) ) + { + CleanupStack::PopAndDestroy( &cm ); + // Pre-defined CM already exists for this ID. + // NAPs must be added in one message. If luid is given add is done to existing AP or node + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL, + "CNapBranch::AddNodeObjectL; CSmlDmAdapter::EAlreadyExists because tried to add in predefined node format that exists" ); + return; + } + if ( cmId != KErrNotFound ) + { + CleanupStack::PopAndDestroy( &cm ); + } + + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, aParentLUID, aStatusRef ); + //iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE, + "CNapBranch::AddNodeObjectL;New node -> Add to buffer." ); + } + else + { + // Sanity check: If the dynamic name of the NAP node has is the same as deleted previously and + // DM Framework hasn't updated the tree, it will give the LUID when calling this method. Thus, + // it's needed to check that the connection method really exists. + TBuf8 parentLUID; + parentLUID.Zero(); + parentLUID = aParentLUID; + RCmConnectionMethodExt cm; + if ( !GetConnectionMethodLC( *iCmManager, cm, CUtils::IntLUID( parentLUID) ) ) + { + if(aParentLUID.Length() > 0) + { + TInt ret = iCallback->RemoveMappingL(KConnMoAdapterUid, + GetDynamicNAPNodeUri( aURI ), ETrue ); + if(ret) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + CleanupStack::PopAndDestroy( &cm ); + return; + } + } + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, KNullDesC8, aStatusRef ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE2, + "CNapBranch::AddNodeObjectL;New node -> Add to buffer." ); + } + else + { + // NAPs must be added in one message. If luid is given add is done to existing AP or node + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_ALLREADY_EXISTS, + "CNapBranch::AddNodeObjectL; CSmlDmAdapter::EAlreadyExists" ); + } + + CleanupStack::PopAndDestroy( &cm ); + } + OstTrace0( TRACE_NORMAL, CNAPBRANCH_ADDNODEOBJECTL_EXIT, "EXIT: CNapBranch::AddNodeObjectL" ); + + } + +// ------------------------------------------------------------------------------------- +// CNapBranch::ProcessNodeBufferL() +// ------------------------------------------------------------------------------------- +void CNapBranch::ProcessBufferL() + { + OstTrace0( TRACE_NORMAL, CNAPBRANCH_PROCESSBUFFERL_ENTRY, "ENTRY: CNapBranch::ProcessBufferL" ); + + TUint32 bearerType; + + RPointerArray napNodes( KNumOfNAPNodes ); + CleanupClosePushL( napNodes ); + + while ( iBuffer->GetGroup( KCMDdfNAP, &napNodes ) != KErrNotFound ) + { + + if ( FindNewCmType( bearerType ) && AllMandatoryNapFieldsFound() ) + { + // Create new connection method and update nodes + RCmConnectionMethodExt cm = iCmManager->CreateConnectionMethodL( bearerType ); + CleanupClosePushL( cm ); + cm.UpdateL(); + + for ( TInt i = 0; i < napNodes.Count(); ++i ) + { + if ( napNodes[i]->iLeaf ) + { + // Leaf data found + SetLeafDataL( napNodes[i]->iUri, + napNodes[i]->iObject, + napNodes[i]->iStatusRef, cm ); + napNodes[i]->iProcessed = ETrue; + } + else + { + // Node has no leaf data + SetNodeDataL( napNodes[i], cm); + napNodes[i]->iProcessed = ETrue; + } + } + cm.UpdateL(); + CleanupStack::PopAndDestroy( &cm ); + } + else + { + for ( TInt i = 0; i < napNodes.Count(); ++i ) + { + iCallback->SetStatusL( napNodes[i]->iStatusRef, CSmlDmAdapter::EError ); + napNodes[i]->iProcessed = ETrue; + } + } + napNodes.Reset(); + } + CleanupStack::Pop( &napNodes ); + napNodes.Close(); + + OstTrace0( TRACE_NORMAL, CNAPBRANCH_PROCESSBUFFERL_EXIT, "EXIT: CNapBranch::ProcessBufferL" ); + + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetDynamicAPNodeUri( const TDesC8& aURI ) +// returns NAP/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CNapBranch::GetDynamicNAPNodeUri(const TDesC8& aURI) + { + + OstTraceExt1( TRACE_NORMAL, CNAPBRANCH_GETDYNAMICNAPNODEURI, "CNapBranch::GetDynamicNAPNodeUri;aURI=%s", aURI ); + + TInt i= 0; + for ( i = aURI.Find( KCMDdfNAP ) + 4; i < aURI.Length(); i++ ) + { + if( aURI[i] == '/' ) + { + break; + } + } + OstTraceExt1( TRACE_NORMAL, DUP1_CNAPBRANCH_GETDYNAMICNAPNODEURI, "CNapBranch::GetDynamicNAPNodeUri;return URI=%s", aURI.Left( i ) ); + + return aURI.Left( i ); + } + +//-------------------------------------------------------------------- +//TInt CNapBranch::IsNAPUriFormatMatchPredefined(const TDesC8 & aURI) +// +//------------------------------------------------------------------- + + +TBool CNapBranch::IsNAPUriFormatMatchPredefined(const TDesC8 & aURI) +{ + if( aURI.Match( _L8( "NAP/NAPId*" ) ) != KErrNotFound ) + { + return ETrue; + } + else + { + return EFalse; + } +} +//------------------------------------------------------------------------------ +// TUint32 CNapBranch::GetAPIdFromURIL(const TDesC8& aURI) +// Get NAP id for given aURI +//------------------------------------------------------------------------------ +TInt CNapBranch::GetCmIdFromURIL(const TDesC8& aURI) + { + TInt ret(KErrNotFound); + + if( !IsNAPUriFormatMatchPredefined( aURI ) ) + { + // Cannot get CmIds from any other format URIs than predefined + return ret; + } + + TLex8 lex; + // Find xxx from ./NAP/NAPIdxxx/... + TInt start = aURI.Find( KDynamicNodePrefix ) + KDynamicNodePrefix().Length(); + lex = aURI.Mid( start, 3 ); + lex.Val( ret ); + + return ret; + } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/src/ProxyBranch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/src/ProxyBranch.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,1112 @@ +/* + * ============================================================================== + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * ============================================================================== + */ + +#include +#include +#include + +#include "ProxyBranch.h" +#include "Utils.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ProxyBranchTraces.h" +#endif + +// ------------------------------------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------------------------------------ +_LIT8( KCMProxyDdf, "Proxy" ); +_LIT8( KCMProxyDdfProxyId, "ProxyId" ); +_LIT8( KCMProxyDdfName, "Name" ); +_LIT8( KCMProxyDdfAddr, "Addr" ); +_LIT8( KCMProxyDdfToConRef, "ToConRef" ); +_LIT8( KCMProxyDdfConRef, "ConRef" ); +_LIT8( KCMProxyDdfPorts, "Ports" ); +_LIT8( KCMProxyDdfPortNbr, "PortNbr" ); +_LIT8( KCMProxyDdfProxyParams, "ProxyParams" ); +_LIT8( KCMProxyDdfProxyType, "ProxyType" ); +_LIT8( KCMProxyDdfWap, "WAP" ); +_LIT8( KCMProxyDdfStartpg, "Startpg" ); + +_LIT8( KCMProxyFields, "ProxyId/Addr/ToConRef/Ports/ProxyType/ProxyParams" ); +_LIT8( KCMProxyParamsFields, "WAP" ); +_LIT8( KCMProxyWapFields, "Startpg" ); +_LIT8( KCMProxyNodeSeparator, "/" ); + +_LIT8( KDynamicProxyNodePattern, "Proxy/*" ); +_LIT8( KDynamicProxyNodeChildUri, "Proxy/*/*" ); +_LIT8( KDynamicToConrefNode, "Proxy/*/ToConRef" ); +_LIT8( KDynamicToConrefNodeChildUri, "Proxy/*/ToConRef/*" ); +_LIT8( KDynamicToConrefNodeChildUriNodes, "Proxy/*/ToConRef/*/*" ); +_LIT8( KDynamicPortsNode, "Proxy/*/Ports" ); +_LIT8( KDynamicPortsNodeChildUri, "Proxy/*/Ports/*" ); +_LIT8( KDynamicPortsNodeChildUriNodes, "Proxy/*/Ports/*/*" ); +_LIT8( KDynamicProxyParamsNode, "Proxy/*/ProxyParams" ); +_LIT8( KDynamicProxyParamsNodeChildUri, "Proxy/*/ProxyParams/*" ); +_LIT8( KDynamicProxyParamsWapNode, "Proxy/*/ProxyParams/WAP" ); + +_LIT8( KProxyAddrUri, "Proxy/*/Addr"); +_LIT8( KProxyConrefUri, "Proxy/*/ConRef"); + +_LIT8( KRoot, "./"); + +TInt const KBufferExpandSize = 128; +TInt const KNumOfProxyNodes = 8; + +_LIT8( KDynamicNodePrefix, "ProxyId"); + +// ======== LOCAL FUNCTIONS ========= + +//----------------------------------------------------------------------------- +// CSmlDmAdapter::TError CProxyBranch::FetchLeafObjectL() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CProxyBranch::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + CBufBase& aLeafObject ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_ENTRY, + "ENTRY: CProxyBranch::FetchLeafObjectL;aURI=%s", aURI ); + + RCmConnectionMethodExt cm; + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotAllowed; + TPtrC8 leafNode = CUtils::GetLastURISeg( aURI ); + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + + if ( cmId == KErrNotFound || !GetConnectionMethodLC( *iCmManager, cm, cmId ) || + !cm.GetBoolAttributeL(CMManager::ECmProxyUsageEnabled) ) + { + if ( cmId != KErrNotFound ) + { + CleanupStack::PopAndDestroy( &cm ); + } + status = CSmlDmAdapter::ENotFound; + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_NOT_FOUND, + "CProxyBranch::FetchLeafObjectL;status=%{TError}", status ); + + return status; + } + + if ( leafNode.Compare( KCMProxyDdfAddr ) == 0 ) + { + HBufC* serverName = cm.GetStringAttributeL( CMManager::ECmProxyServerName ); + + CleanupStack::PushL( serverName ); + aLeafObject.InsertL( 0, CUtils::ConvertTo8LC( *serverName ) ); + + CleanupStack::PopAndDestroy(); // CUtils::ConvertTo8LC + CleanupStack::PopAndDestroy( serverName ); + + status = CSmlDmAdapter::EOk; + } + else if ( leafNode.Compare( KCMProxyDdfConRef ) == 0 ) + { + TBuf8 conRef; + TBuf8 napChildList; + CBufBase* napChildListBuf = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( napChildListBuf ); + + // Get all NAP node childs + iCallback->FetchLinkL( _L8("./NAP"), *napChildListBuf, status ); + napChildListBuf->Read( 0, napChildList, napChildListBuf->Size() ); + + if ( status == CSmlDmAdapter::EOk) + { + // Reset operation end status + status = CSmlDmAdapter::EError; + + // Find correct Uri + while ( napChildList.Length() > 0 && status != CSmlDmAdapter::EOk ) + { + conRef.Append( _L("NAP/") ); + CUtils::AppendFirstURISeg( napChildList, conRef ); + HBufC8* napLuid = iCallback->GetLuidAllocL( conRef ); + if ( cmId == CUtils::IntLUID( *napLuid ) ) + { + status = CSmlDmAdapter::EOk; + aLeafObject.InsertL( 0, conRef ); + } + delete napLuid; + conRef.Delete( 0, conRef.Length() ); + } + } + + CleanupStack::PopAndDestroy( napChildListBuf ); + } + else if ( leafNode.Compare( KCMProxyDdfPortNbr ) == 0 ) + { + TInt proxyPort = cm.GetIntAttributeL( CMManager::ECmProxyPortNumber ); + + aLeafObject.InsertL( 0, CUtils::IntToCharL( proxyPort ) ); + CleanupStack::PopAndDestroy(); + + status = CSmlDmAdapter::EOk; + } + else if ( leafNode.Compare( KCMProxyDdfStartpg ) == 0 ) + { + HBufC* startPage = cm.GetStringAttributeL( CMManager::ECmStartPage ); + + CleanupStack::PushL( startPage ); + aLeafObject.InsertL( 0, CUtils::ConvertTo8LC( *startPage ) ); + + CleanupStack::PopAndDestroy(); // CUtils::ConvertTo8LC + CleanupStack::PopAndDestroy( startPage ); + + status = CSmlDmAdapter::EOk; + } + else if ( leafNode.Compare( KCMProxyDdfProxyType ) == 0 ) + { + HBufC* protocolName = cm.GetStringAttributeL( CMManager::ECmProxyProtocolName ); + + CleanupStack::PushL( protocolName ); + aLeafObject.InsertL( 0, CUtils::ConvertTo8LC( *protocolName ) ); + + CleanupStack::PopAndDestroy(); // CUtils::ConvertTo8LC + CleanupStack::PopAndDestroy( protocolName ); + + status = CSmlDmAdapter::EOk; + } + else if ( leafNode.Compare( KCMProxyDdfProxyId ) == 0 ) + { + TPtrC8 dynamicNode = GetDynamicProxyNodeUri( aURI ); + aLeafObject.InsertL( 0, dynamicNode ); + status = CSmlDmAdapter::EOk; + } + + CleanupStack::PopAndDestroy( &cm ); + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_EXIT, + "EXIT: CProxyBranch::FetchLeafObjectL;status=%{TError}", status ); + return status; + } + +//----------------------------------------------------------------------------- +// TUint32 CProxyBranch::CheckForUnmodifiableField() +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CProxyBranch::CheckForUnmodifiableField(const TDesC8& aUri) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_CHECKFORUNMODIFIABLEFIELD_ENTRY, + "ENTRY: CProxyBranch::CheckForUnmodifiableField;aUri=%s", aUri ); + + CSmlDmAdapter::TError retval(CSmlDmAdapter::ENotFound); + TPtrC8 nodeName = CUtils::GetLastURISeg(aUri); + + if ( nodeName.Match(KCMProxyDdfName) != KErrNotFound || + nodeName.Match(KCMProxyDdfConRef) != KErrNotFound ) + { + retval = CSmlDmAdapter::EOk; + } + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_CHECKFORUNMODIFIABLEFIELD_EXIT, + "EXIT: CProxyBranch::CheckForUnmodifiableField;retval=%{TError}", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CProxyBranch::MapUriToCmAttribute() +//----------------------------------------------------------------------------- +TUint32 CProxyBranch::MapUriToCmAttribute( const TDesC8& aUri ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_MAPURITOCMATTRIBUTE_ENTRY, + "ENTRY: CProxyBranch::MapUriToCmAttribute;aUri=%s", aUri ); + + TUint32 retval(0); + + TPtrC8 nodeName = CUtils::GetLastURISeg( aUri ); + + if ( nodeName.Match( KCMProxyDdfAddr )!= KErrNotFound ) + { + retval = CMManager::ECmProxyServerName; + } + else if ( nodeName.Match( KCMProxyDdfPortNbr ) != KErrNotFound ) + { + retval = CMManager::ECmProxyPortNumber; + } + else if ( nodeName.Match( KCMProxyDdfStartpg ) != KErrNotFound ) + { + retval = CMManager::ECmStartPage; + } + else if ( nodeName.Match( KCMProxyDdfProxyType ) != KErrNotFound ) + { + retval = CMManager::ECmProxyProtocolName; + } + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_MAPURITOCMATTRIBUTE_EXIT, + "EXIT: CProxyBranch::MapUriToCmAttribute;retval=%{TConnectionMethodCommonAttributes}", + retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TInt32 CProxyBranch::FindConnectionMethodL() +//----------------------------------------------------------------------------- +TInt32 CProxyBranch::FindConnectionMethodL() + { + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_FINDCONNECTIONMETHODL_ENTRY, + "ENTRY: CProxyBranch::FindConnectionMethod" ); + + TInt32 retval = KErrNotFound; + + CConnMoNodeElement* processNode = iBuffer->CacheFind( KProxyConrefUri ); + + if ( processNode ) + { + + HBufC8* luid; + + // Ignore root part ("./") of the URI if present in the beginning + if ( processNode->iObject.Mid( 0, 2 ).Match( KRoot ) != KErrNotFound ) + { + luid = iCallback->GetLuidAllocL( processNode->iObject.Mid( 2 ) ); + } + else + { + luid = iCallback->GetLuidAllocL( processNode->iObject ); + } + + retval = CUtils::IntLUID( *luid ); + + delete luid; + + } + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FINDCONNECTIONMETHODL_EXIT, + "EXIT: CProxyBranch::FindConnectionMethod;CmId=%d", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CProxyBranch::AllMandatoryProxyFieldsFound() +//----------------------------------------------------------------------------- +TBool CProxyBranch::AllMandatoryProxyFieldsFound() + { + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ALLMANDATORYPROXYFIELDSFOUND_ENTRY, + "ENTRY: CProxyBranch::AllMandatoryProxyFieldsFound" ); + + TBool retval = ETrue; + + // Check that NAP Address addition is found + if ( !iBuffer->CacheFind(KProxyAddrUri) ) + { + retval = EFalse; + } + if ( !iBuffer->CacheFind(KProxyConrefUri) ) + { + retval = EFalse; + } + // Check that dynamic nap node addition is found + if ( !iBuffer->CacheFindDynamicNode(KDynamicProxyNodePattern) ) + { + retval = EFalse; + } + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_ALLMANDATORYPROXYFIELDSFOUND_EXIT, + "EXIT: CProxyBranch::AllMandatoryProxyFieldsFound;retval=%d", retval ); + + return retval; + } +//----------------------------------------------------------------------------- +// TBool CProxyBranch::SetLeafData() +//----------------------------------------------------------------------------- +void CProxyBranch::SetLeafDataL(const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aObject, + TInt aStatusRef, + RCmConnectionMethodExt& aCm) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_SETLEAFDATAL_ENTRY, + "ENTRY: CProxyBranch::SetLeafDataL;aURI=%s", aURI ); + + TUint32 attributeRef = ( 0 ); + TLex8 lex( aObject ); + TInt value = 0; + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + attributeRef = MapUriToCmAttribute( aURI ); + + switch ( attributeRef ) + { + case CMManager::ECmProxyServerName: + case CMManager::ECmStartPage: + case CMManager::ECmProxyProtocolName: + aCm.SetStringAttributeL( attributeRef, CUtils::ConvertTo16LC( aObject ) ); + CleanupStack::PopAndDestroy(); // CUtils::ConvertTo16LC + break; + case CMManager::ECmProxyPortNumber: + if ( lex.Val( value ) == KErrNone ) + { + aCm.SetIntAttributeL( attributeRef, value ); + } + else + { + status = CSmlDmAdapter::EInvalidObject; + } + break; + default: + status = CheckForUnmodifiableField( aURI ); + break; + } + iCallback->SetStatusL( aStatusRef, status ); + + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_SETLEAFDATAL_EXIT, + "EXIT: CProxyBranch::SetLeafDataL;status=%{TError}", status ); + } +//----------------------------------------------------------------------------- +// TBool CProxyBranch::SetNodeData() +//----------------------------------------------------------------------------- +void CProxyBranch::SetNodeDataL(CConnMoNodeElement* aNode, RCmConnectionMethodExt& aCm) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_SETNODEDATAL_ENTRY, "ENTRY: CProxyBranch::SetNodeDataL;aNode->iUri=%s", aNode->iUri ); + + if ( aNode->iParentLUID.Length() == 0 ) + { + TBuf8<16> addLUID; + _LIT8( KFormat, "%d" ); + addLUID.Format( KFormat, aCm.GetIntAttributeL( CMManager::ECmId ) ); + + iCallback->SetMappingL( aNode->iUri, addLUID ); + iCallback->SetStatusL( aNode->iStatusRef, CSmlDmAdapter::EOk ); + } + else + { + iCallback->SetStatusL( aNode->iStatusRef, CSmlDmAdapter::EAlreadyExists ); + } + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_SETNODEDATAL_EXIT, "EXIT: CProxyBranch::SetNodeDataL" ); + + } +//------------------------------------------------------------------------------ +// void CProxyBranch::GetAllDynamicProxyNodes() +//------------------------------------------------------------------------------ +void CProxyBranch::GetAllDynamicProxyNodesL( const TDesC8& aURI, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef, + CBufBase& aCurrentURISegmentList ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_ENTRY, + "ENTRY: CProxyBranch::GetAllDynamicProxyNodesL;aURI=%s", aURI ); + + // Array for connection methods + RArray cmArray; + + CleanupClosePushL( cmArray ); + cmArray.Reset(); + + GetAllConnectionMethodsL( cmArray, *iCmManager ); + + // Loop through all connection methods + for ( TInt i = 0; i < cmArray.Count(); i++ ) + { + RCmConnectionMethodExt cm = iCmManager->ConnectionMethodL( cmArray[i] ); + CleanupClosePushL( cm ); + + // If proxy is enabled for connection method + if ( cm.GetBoolAttributeL( CMManager::ECmProxyUsageEnabled ) ) + { + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_PROXY, + "CProxyBranch::GetAllDynamicProxyNodesL;Proxy enabled for Cm Id=%u", + cmArray[i] ); + + TBuf8addCmName; + // Check if node exists in aPreviousURISegmentList + if ( !CheckPreviousURIList( aPreviousURISegmentList, cmArray[i], addCmName ) ) + { + // Connection Method not found in previous URI list + addCmName.Append( aURI ); + addCmName.Append( KCMProxyNodeSeparator ); + addCmName.Append( KDynamicNodePrefix ); + + addCmName.AppendNumFixedWidth( cmArray[i], EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8( KFormat, "%d" ); + addLUID.Format( KFormat, cmArray[i] ); + + OstTraceExt1( TRACE_NORMAL, + CPROXYBRANCH_GETALLDYNAMICPROXYNODES_ADDED_TO_LIST, + "CProxyBranch::GetAllDynamicProxyNodesL;Added to list: URI=%s", addCmName ); + + iCallback->SetMappingL( addCmName, addLUID ); + } + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), CUtils::GetLastURISeg( addCmName ) ); + aCurrentURISegmentList.InsertL( aCurrentURISegmentList.Size(), KCMProxyNodeSeparator ); + } + CleanupStack::PopAndDestroy( &cm ); + } + + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, aCurrentURISegmentList, KNullDesC8 ); + + CleanupStack::PopAndDestroy( &cmArray ); + + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_EXIT, + "EXI: CProxyBranch::GetAllDynamicProxyNodesLT" ); + } + +// ======== MEMBER FUNCTIONS ======== +//----------------------------------------------------------------------------- +// CProxyBranch* CProxyBranch::NewL( ) +//----------------------------------------------------------------------------- +CProxyBranch* CProxyBranch::NewL(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ) + { + OstTraceFunctionEntry1( CPROXYBRANCH_NEWL_ENTRY, ( TUint )( aDmCallback ) ); + + CProxyBranch* self = new (ELeave) CProxyBranch(aDmCallback, aBuffer, aCmManagerExt ); + + OstTraceFunctionExit1( CPROXYBRANCH_NEWL_EXIT, ( TUint )( self ) ); + return self; + } + +//------------------------------------------------------------------------------ +// CProxyBranch::CProxyBranch() +//------------------------------------------------------------------------------ +CProxyBranch::CProxyBranch(MSmlDmCallback* aDmCallback, + CAddBuffer* aBuffer, + RCmManagerExt* aCmManagerExt ) + : CBranchBase( aDmCallback ) + { + OstTraceFunctionEntry1( CPROXYBRANCH_CONSTRUCTOR_ENTRY, this ); + + iCallback = aDmCallback; + iBuffer = aBuffer; + iCmManager = aCmManagerExt; + + OstTraceFunctionExit1( CPROXYBRANCH_CONSTRUCTOR_EXIT, this ); + } + +//------------------------------------------------------------------------------ +// CProxyBranch::~CProxyBranch() +//------------------------------------------------------------------------------ +CProxyBranch::~CProxyBranch() + { + OstTraceFunctionEntry1( CPROXYBRANCH_DESTRUCTOR_ENTRY, this ); + + OstTraceFunctionExit1( CPROXYBRANCH_DESTRUCTOR_EXIT, this ); + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::DDFStructureL() +//------------------------------------------------------------------------------ +void CProxyBranch::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + OstTraceFunctionEntry0( CPROXYBRANCH_DDFSTRUCTUREL_ENTRY ); + + // + // Set rest acceptable operations for data itself + // + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + TSmlDmAccessTypes aclTypesAddGet; + aclTypesAddGet.SetGet(); + aclTypesAddGet.SetAdd(); + + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + MSmlDmDDFObject& nProxyIdDDF = aDDF.AddChildObjectL( KCMProxyDdfProxyId ); // ProxyId + CUtils::FillNodeInfoL( nProxyIdDDF, + aclTypesOnlyGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nAddrDDF = aDDF.AddChildObjectL( KCMProxyDdfAddr ); // Addr + CUtils::FillNodeInfoL( nAddrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nToConRefDDF = aDDF.AddChildObjectL( KCMProxyDdfToConRef ); // ToConRef + CUtils::FillNodeInfoL( nToConRefDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nToConRefRootDDF = nToConRefDDF.AddChildObjectGroupL(); // ToConRef/ + CUtils::FillNodeInfoL( nToConRefRootDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nConRefDDF = nToConRefRootDDF.AddChildObjectL( KCMProxyDdfConRef ); // ToConRef//ConRef + CUtils::FillNodeInfoL( nConRefDDF, + aclTypesAddGet, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + MSmlDmDDFObject& nPortsDDF = aDDF.AddChildObjectL( KCMProxyDdfPorts ); // Ports + CUtils::FillNodeInfoL( nPortsDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nPortsRootDDF = nPortsDDF.AddChildObjectGroupL(); // Ports/ + CUtils::FillNodeInfoL( nPortsRootDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nPortNbrDDF = nPortsRootDDF.AddChildObjectL( KCMProxyDdfPortNbr ); // Ports//PortNbr + CUtils::FillNodeInfoL( nPortNbrDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNullDesC8 ); + + MSmlDmDDFObject& nProxyParamsDDF = aDDF.AddChildObjectL( KCMProxyDdfProxyParams ); // ProxyParams + CUtils::FillNodeInfoL( nProxyParamsDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nProxyTypeDDF = aDDF.AddChildObjectL( KCMProxyDdfProxyType ); // ProxyType + CUtils::FillNodeInfoL( nProxyTypeDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + + MSmlDmDDFObject& nWapDDF = nProxyParamsDDF.AddChildObjectL( KCMProxyDdfWap ); // WAP + CUtils::FillNodeInfoL( nWapDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNullDesC8 ); + + MSmlDmDDFObject& nStartpgDDF = nWapDDF.AddChildObjectL( KCMProxyDdfStartpg ); // Startpg + CUtils::FillNodeInfoL( nStartpgDDF, + aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNullDesC8 ); + + OstTraceFunctionEntry0( CPROXYBRANCH_DDFSTRUCTUREL_EXIT ); + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::UpdateLeafObjectL() +//------------------------------------------------------------------------------ +void CProxyBranch::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_UPDATELEAFOBJECTL_ENTRY, + "ENTRY: CProxyBranch::UpdateLeafObjectL;aURI=%s", aURI ); + + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + + if ( aLUID.Length() == 0 && cmId == KErrNotFound ) + { + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, aLUID, aObject, aStatusRef); + } + else + { + // Existing node, update data immediately + TInt err( KErrNone ); + RCmConnectionMethodExt cm; + if ( cmId == KErrNotFound ) + { + cmId = CUtils::IntLUID( aLUID ); + } + + TRAP( err, cm = iCmManager->ConnectionMethodL( cmId ) ); + CleanupClosePushL( cm ); + + if ( !err ) + { + OstTrace0( TRACE_NORMAL, DUP1_CPROXYBRANCH_UPDATELEAFOBJECTL, "CProxyBranch::UpdateLeafObjectL; Existing connection method - write value immediately." ); + SetLeafDataL( aURI, aLUID, aObject, aStatusRef, cm ); + cm.UpdateL(); + } + else + { + //iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_UPDATELEAFOBJECTL, "CProxyBranch::UpdateLeafObjectL; Stale LUID - buffer setting." ); + iBuffer->AddNodeToBufferL(aURI,KNullDesC8,aObject,aStatusRef); + } + + CleanupStack::PopAndDestroy( &cm ); + } + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_UPDATELEAFOBJECTL_EXIT, + "EXIT: CProxyBranch::UpdateLeafObjectL" ); + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::DeleteObjectL() +//------------------------------------------------------------------------------ +void CProxyBranch::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + TInt /*aStatusRef*/ ) + { + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::FetchLeafObjectL() +//------------------------------------------------------------------------------ +void CProxyBranch::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_PUPLIC_ENTRY, + "ENTRY: CProxyBranch::FetchLeafObjectL;aURI=%s", aURI ); + + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + CBufBase *leafObject = CBufFlat::NewL( KBufferExpandSize ); + CleanupStack::PushL( leafObject ); + leafObject->Reset(); + + status = FetchLeafObjectL( aURI, aLUID, *leafObject ); + + if ( status == CSmlDmAdapter::EOk ) + { + iCallback->SetResultsL( aResultsRef, *leafObject, aType ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECT_OK, + "CProxyBranch::FetchLeafObjectL; EOk" ); + } + + CleanupStack::PopAndDestroy( leafObject ); + + iCallback->SetStatusL( aStatusRef, status ); + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTL_PUPLIC_EXIT, + "EXIT: CProxyBranch::FetchLeafObjectL;status=%{TError}", status ); + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::FetchLeafObjectSizeL() +//------------------------------------------------------------------------------ +void CProxyBranch::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY, + "ENTRY: CProxyBranch::FetchLeafObjectSizeL;aURI=%s", aURI ); + + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + CBufBase *leafObject = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( leafObject ); + leafObject->Reset(); + + status = FetchLeafObjectL( aURI, aLUID, *leafObject ); + + if ( status == CSmlDmAdapter::EOk ) + { + leafObject->Compress(); + TBuf8<8> size; + size.Num( leafObject->Size() ); + leafObject->Reset(); + leafObject->InsertL(0, size ); + iCallback->SetResultsL( aResultsRef, *leafObject, aType ); + } + + CleanupStack::PopAndDestroy( leafObject ); + + iCallback->SetStatusL( aStatusRef, status ); + OstTrace1( TRACE_NORMAL, CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_EXIT, + "EXIT: CProxyBranch::FetchLeafObjectSizeL;status=%{TError}", status ); + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::ChildURIListL() +//------------------------------------------------------------------------------ +void CProxyBranch::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_CHILDURILISTL_ENTRY, + "ENTRY: CProxyBranch::ChildURIListL;aURI=%s", aURI ); + + TPtrC8 proxyDdfTree = CUtils::GetEndOfURIFromSeg( aURI, KCMProxyDdf ); + + CBufBase* currentURISegmentList = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( currentURISegmentList ); + + // Proxy (handle as special case) + if ( proxyDdfTree.Match( KCMProxyDdf ) != KErrNotFound ) + { + GetAllDynamicProxyNodesL( aURI, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *currentURISegmentList ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + return; + } + // Then check if the CM exists. Use LUID or predefined ID + TInt cmId( KErrNotFound ); + if ( aLUID.Length() > 0 ) + { + cmId = CUtils::IntLUID( aLUID ); + } + else + { + // If this is for pre-defined node then get CM id xxx from URI (NAP/NAPIdxxx) + cmId = GetCmIdFromURIL( aURI ); + } + // If after this cmId is still not found then the branch does not exist + if ( cmId == KErrNotFound ) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, DUP1_CPROXYBRANCH_CHILDURILISTL, "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + return; + } + + RCmConnectionMethodExt cm; + // Check it the method actually can be found + if ( !GetConnectionMethodLC( *iCmManager, cm, cmId ) || !cm.GetBoolAttributeL(CMManager::ECmProxyUsageEnabled ) ) + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( &cm ); + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, DUP2_CPROXYBRANCH_CHILDURILISTL, "CNapBranch::ChildURIListL; CSmlDmAdapter::ENotFound" ); + return; + } + CleanupStack::PopAndDestroy( &cm ); + + + // Proxy/ + if ( proxyDdfTree.Match( KDynamicProxyNodePattern ) != KErrNotFound && + proxyDdfTree.Match( KDynamicProxyNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Proxy//ToConRef/ + else if ( proxyDdfTree.Match( KDynamicToConrefNodeChildUri ) != KErrNotFound && + proxyDdfTree.Match( KDynamicToConrefNodeChildUriNodes ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyDdfConRef ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Proxy//ToConRef + else if ( proxyDdfTree.Match( KDynamicToConrefNode ) != KErrNotFound ) + { + GetAllDynamicNodesL( aURI, + aLUID, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *iCmManager, + *currentURISegmentList, + KCMProxyDdfToConRef, + 1, + iCallback ); + } + + // Proxy//Ports/ + else if ( proxyDdfTree.Match( KDynamicPortsNodeChildUri ) != KErrNotFound && + proxyDdfTree.Match( KDynamicPortsNodeChildUriNodes ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyDdfPortNbr ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Proxy//Ports + else if ( proxyDdfTree.Match( KDynamicPortsNode ) != KErrNotFound ) + { + GetAllDynamicNodesL( aURI, + aLUID, + aPreviousURISegmentList, + aResultsRef, + aStatusRef, + *iCmManager, + *currentURISegmentList, + KCMProxyDdfPorts, + 1, + iCallback ); + } + + // Proxy//ProxyParams + else if ( proxyDdfTree.Match( KDynamicProxyParamsNode ) != KErrNotFound && + proxyDdfTree.Match( KDynamicProxyParamsNodeChildUri ) == KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyParamsFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Proxy//ProxyParams/WAP + else if ( proxyDdfTree.Match( KDynamicProxyParamsWapNode ) != KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KCMProxyWapFields ); + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Not found + else + { + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_CHILDURILISTL_NOT_FOUND, + "CProxyBranch::ChildURIListL;CSmlDmAdapter::ENotFound" ); + + } + + CleanupStack::PopAndDestroy( currentURISegmentList ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_CHILDURILISTL_EXIT, + "EXIT: CProxyBranch::ChildURIListL" ); + + } + +//------------------------------------------------------------------------------ +// void CProxyBranch::AddNodeObjectL() +//------------------------------------------------------------------------------ +void CProxyBranch::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_ENTRY, + "ENTRY: CProxyBranch::AddNodeObjectL;aURI=%s", aURI ); + + if ( aParentLUID.Length() == 0 ) + { + // If this is for pre-defined node then get CM id xxx from URI (Proxy/ProxyIdxxx) + TInt cmId = GetCmIdFromURIL( aURI ); + RCmConnectionMethodExt cm; + // Check if CM exists + if ( cmId != KErrNotFound && GetConnectionMethodLC( *iCmManager, cm, cmId ) + && cm.GetBoolAttributeL(CMManager::ECmProxyUsageEnabled)) + { + CleanupStack::PopAndDestroy( &cm ); + // Pre-defined CM already exists for this ID. + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + return; + } + if ( cmId != KErrNotFound ) + { + CleanupStack::PopAndDestroy( &cm ); + } + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, aParentLUID, aStatusRef ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE, + "CProxyBranch::AddNodeObjectL;New node -> Add to buffer." ); + } + else + { + // Sanity check: If the dynamic name of the Proxy node has is the same as deleted previously and + // DM Framework hasn't updated the tree, it will give the LUID when calling this method. Thus, + // it's needed to check that the connection method really exists. + RCmConnectionMethodExt cm; + + + if ( !GetConnectionMethodLC( *iCmManager, cm, CUtils::IntLUID( aParentLUID ) ) ) + { + // New node, add to buffer + iBuffer->AddNodeToBufferL( aURI, KNullDesC8, aStatusRef ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE2, + "CProxyBranch::AddNodeObjectL;New node -> Add to buffer." ); + } + else + { + // Proxies must be added in one message. If luid is given add is done to existing AP or node + iCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_ALREADY_EXISTS, + "CProxyBranch::AddNodeObjectL;CSmlDmAdapter::EAlreadyExists" ); + } + + CleanupStack::PopAndDestroy( &cm ); + } + + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_ADDNODEOBJECTL_EXIT, "EXIT: CProxyBranch::AddNodeObjectL" ); + } + +// ------------------------------------------------------------------------------------- +// CProxyBranch::ProcessNodeBufferL() +// ------------------------------------------------------------------------------------- +void CProxyBranch::ProcessBufferL() + { + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_PROCESSBUFFERL_ENTRY, "ENTRY: CProxyBranch::ProcessBufferL" ); + + RPointerArray proxyNodes( KNumOfProxyNodes ); + CleanupClosePushL( proxyNodes ); + while ( iBuffer->GetGroup( KCMDdfProxy, &proxyNodes ) != KErrNotFound ) + { + TInt32 cmId = FindConnectionMethodL(); + + if ( AllMandatoryProxyFieldsFound() && cmId != KErrNotFound ) + { + // Open connection method, enable proxy and update nodes + RCmConnectionMethodExt cm; + TRAPD( err, cm = iCmManager->ConnectionMethodL( cmId ) ); + CleanupClosePushL( cm ); + + if ( !err ) + { + cm.SetBoolAttributeL( CMManager::ECmProxyUsageEnabled, ETrue ); + + for ( TInt i = 0; i < proxyNodes.Count(); ++i ) + { + if ( proxyNodes[i]->iLeaf ) + { + // Leaf data found + SetLeafDataL( proxyNodes[i]->iUri, + proxyNodes[i]->iParentLUID, + proxyNodes[i]->iObject, + proxyNodes[i]->iStatusRef, cm ); + proxyNodes[i]->iProcessed = ETrue; + } + else + { + // Node has no leaf data + SetNodeDataL( proxyNodes[i], cm ); + proxyNodes[i]->iProcessed = ETrue; + } + } + cm.UpdateL(); + } + else + { + for ( TInt i = 0; i < proxyNodes.Count(); ++i ) + { + iCallback->SetStatusL( proxyNodes[i]->iStatusRef, CSmlDmAdapter::EError ); + proxyNodes[i]->iProcessed = ETrue; + } + } + CleanupStack::PopAndDestroy( &cm ); + } + else + { + for ( TInt i = 0; i < proxyNodes.Count(); ++i ) + { + iCallback->SetStatusL( proxyNodes[i]->iStatusRef, CSmlDmAdapter::EError ); + proxyNodes[i]->iProcessed = ETrue; + } + } + proxyNodes.Reset(); + } + CleanupStack::Pop( &proxyNodes ); + proxyNodes.Close(); + + OstTrace0( TRACE_NORMAL, CPROXYBRANCH_PROCESSBUFFERL_EXIT, "EXIT: CProxyBranch::ProcessBufferL" ); + } + + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetDynamicAPNodeUri( const TDesC8& aURI ) +// returns NAP/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CProxyBranch::GetDynamicProxyNodeUri( const TDesC8& aURI ) + { + OstTraceExt1( TRACE_NORMAL, CPROXYBRANCH_GETDYNAMICPROXYNODEURI, "CProxyBranch::GetDynamicProxyNodeUri;aURI=%s", aURI ); + TInt i= 0; + for ( i = aURI.Find( KCMDdfProxy ) + 6; i < aURI.Length(); i++ ) + { + if( aURI[i] == '/' ) + { + break; + } + } + OstTraceExt1( TRACE_NORMAL, DUP1_CPROXYRANCH_GETDYNAMICPROXYNODEURI, "CProxyBranch::GetDynamicProxyNodeUri;return URI=%s", aURI.Left( i ) ); + return aURI.Left( i ); + } + +//-------------------------------------------------------------------- +//TInt CProxyBranch::IsNAPUriFormatMatchPredefined(const TDesC8 & aURI) +// +//------------------------------------------------------------------- + + +TBool CProxyBranch::IsProxyUriFormatMatchPredefined(const TDesC8 & aURI) +{ + if( aURI.Match( _L8( "Proxy/ProxyId*" ) ) != KErrNotFound ) + { + return ETrue; + } + else + { + return EFalse; + } +} +//------------------------------------------------------------------------------ +// TUint32 CProxyBranch::GetAPIdFromURIL(const TDesC8& aURI) +// Get NAP id for given aURI +//------------------------------------------------------------------------------ +TInt CProxyBranch::GetCmIdFromURIL(const TDesC8& aURI) + { + TInt ret(KErrNotFound); + + if( !IsProxyUriFormatMatchPredefined( aURI ) ) + { + // Cannot get CmIds from any other format URIs than predefined + return ret; + } + + TLex8 lex; + // Find xxx from ./Proxy/ProxyIdxxx/... + TInt start = aURI.Find( KDynamicNodePrefix ) + KDynamicNodePrefix().Length(); + lex = aURI.Mid( start, 3 ); + lex.Val( ret ); + + return ret; + } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/src/Utils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/src/Utils.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,312 @@ +/* + * ============================================================================== + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + * ============================================================================== + */ + +#include +#include +#include + +#include "Utils.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "UtilsTraces.h" +#endif + +// ======== LOCAL CONSTANTS ========= + +_LIT8( KFalse, "False" ); +_LIT8( KTrue, "True" ); +_LIT8( KWhiteSpace, " " ); + +// ======== LOCAL FUNCTIONS ========= + +// ======== MEMBER FUNCTIONS ======== +//------------------------------------------------------------------------------ +// CUtils::CUtils() +//------------------------------------------------------------------------------ +CUtils::CUtils() + { + OstTraceFunctionEntry0( CUTILS_CUTILS_ENTRY ); + OstTraceFunctionExit0( CUTILS_CUTILS_EXIT ); + } + +//------------------------------------------------------------------------------ +// CUtils::~CUtils() +//------------------------------------------------------------------------------ +CUtils::~CUtils() + { + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetFirstURISeg(const TDesC8& aURI) +//------------------------------------------------------------------------------ +TPtrC8 CUtils::GetFirstURISeg( const TDesC8& aURI ) + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETFIRSTURISEG_ENTRY, + "ENTRY: CUtils::GetFirstURISeg;aURI=%s", aURI ); + + TInt i = 0; + TInt j = 0; + + for( i =0; i <= aURI.Length()-1; i++ ) + { + if( aURI[i] == '/' ) + { + if ( i == 0 ) + { + // Skip first slash + j = 1; + continue; + } + break; + } + } + OstTraceExt1( TRACE_NORMAL, CUTILS_GETFIRSTURISEG_EXIT, + "EXIT: CUtils::GetFirstURISeg;retval=%s", aURI.Mid( j,i-j ) ); + + return aURI.Mid( j,i-j ); + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetSecondURISeg(const TDesC8& aURI) +//------------------------------------------------------------------------------ +TPtrC8 CUtils::GetSecondURISeg( const TDesC8& aURI ) + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETSECONDURISEG_ENTRY, + "ENTRY: CUtils::GetSecondURISeg;aURI=%s", aURI ); + + TInt j = 0; + TInt i = 0; + + for( i = 0; i <= aURI.Length() - 1; i++ ) + { + if( aURI[i] == '/' ) + { + for( j = i + 1; j <= aURI.Length() - 1; j++ ) + { + if( aURI[j] == '/' ) // Second slash => AP/xxxx + { + break; + } + } + break; + } + } + OstTraceExt1( TRACE_NORMAL, CUTILS_GETSECONDTURISEG_EXIT, + "EXIT: CUtils::GetSecondURISeg;retval=%s", aURI.Mid( i+1, j-1-i ) ); + + return aURI.Mid( i+1, j-1-i ); + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetLastURISeg(const TDesC8& aURI) +// Returns only the last uri segment +//------------------------------------------------------------------------------ +TPtrC8 CUtils::GetLastURISeg( const TDesC8& aURI ) + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETLASTURISEG_ENTRY, + "ENTRY: CUtils::GetLastURISeg;aURI=%s", aURI ); + + TInt i; + + for( i = aURI.Length() - 1 ; i >= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if( i == 0 ) + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETLASTURISEG_EXIT, + "EXIT: CUtils::GetLastURISeg;retval=%s", aURI ); + return aURI; + } + else + { + OstTraceExt1( TRACE_NORMAL, CUTILS_GETLASTURISEG_EXIT2, + "EXIT: CUtils::GetLastURISeg;retval=%s", aURI.Mid( i+1 ) ); + return aURI.Mid( i+1 ); + } + } + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetEndOfURIFromSeg(const TDesC8& aURI,const TDesC8 aName) +// Returns the end of aURI starting from aName +//------------------------------------------------------------------------------ +TPtrC8 CUtils::GetEndOfURIFromSeg( const TDesC8& aURI, const TDesC8& aName ) + { + OstTraceExt2( TRACE_NORMAL, CUTILS_GETENDOFURIFROMSEG_ENTRY, + "ENTRY: CUtils::GetEndOfURIFromSeg;aURI=%s;aName=%s", aURI, aName ); + + TInt begin = aURI.Find( aName ); + + if ( begin == KErrNotFound ) + { + OstTrace1( TRACE_NORMAL, CUTILS_GETENDOFURIFROMSEG_EXIT, + "EXIT: CUtils::GetEndOfURIFromSeg;%d", KErrNotFound ); + return aURI; + } + OstTraceExt1( TRACE_NORMAL, CUTILS_GETENDOFURIFROMSEG_EXIT2, + "EXIT: CUtils::GetEndOfURIFromSeg;%s", aURI.Mid(begin) ); + return aURI.Mid(begin); + } + +//------------------------------------------------------------------------------ +// CUtils::ConvertTo8LC() +// Converts string value to 8-bit +//------------------------------------------------------------------------------ +TDesC8& CUtils::ConvertTo8LC( const TDesC& aSource ) + { + HBufC8* buf = HBufC8::NewLC( aSource.Length() * 2 ); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); + + return *buf; + } + +//------------------------------------------------------------------------------ +// CUtils::ConvertTo16LC() +// Converts string value to 16-bit +//------------------------------------------------------------------------------ +TDesC16& CUtils::ConvertTo16LC( const TDesC8& aSource ) + { + HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); + TPtr bufPtr16 = buf16->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aSource ); + + return *buf16; + } + +// ------------------------------------------------------------------------------------- +// CUtils::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CUtils::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) + + { + aNode.SetAccessTypesL( aAccTypes ); + aNode.SetOccurenceL( aOccurrence ); + aNode.SetScopeL( aScope ); + aNode.SetDFFormatL( aFormat ); + if( aFormat != MSmlDmDDFObject::ENode ) + { + // aNode.AddDFTypeMimeTypeL(KNSmlMimeType); + } + if ( aDescription != KNullDesC8 ) + { + aNode.SetDescriptionL( aDescription ); + } + } + +// ------------------------------------------------------------------------------------- +// CUtils::StripWhiteSpaces() +// Removes all white spaces from a string +// ------------------------------------------------------------------------------------- +void CUtils::RemoveIllegalCharsFromURI( TDes8& aString ) + { + TInt delPos; + TInt delLen = 1; + + aString.TrimAll(); + delPos = aString.Find( KWhiteSpace ); + while ( delPos != KErrNotFound ) + { + aString.Delete( delPos,delLen ); + delPos = aString.Find( KWhiteSpace ); + } + } + +// ------------------------------------------------------------------------------------- +// TInt CUtils::DesCToBool +// ------------------------------------------------------------------------------------- +TInt32 CUtils::DesToBool( const TDesC8& aSource, TBool& aBool ) + { + TInt retval( KErrNone ); + + if ( aSource.Match( KTrue ) != KErrNotFound ) + { + aBool = ETrue; + } + else if ( aSource.Match( KFalse ) != KErrNotFound ) + { + aBool = EFalse; + } + else + { + retval = KErrGeneral; + } + + return retval; + } + +// ------------------------------------------------------------------------------------- +// CUtils::IntToCharL() +// ------------------------------------------------------------------------------------- +TDesC8& CUtils::IntToCharL( const TInt& aObject ) + { + HBufC8* buf = HBufC8::NewLC( 8 ); + TPtr8 ptrBuf = buf->Des(); + + ptrBuf.Num( aObject ); + + return *buf; + } +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::AppendFirstURISeg( TDes8& aURI, TDes8& aTarget ) +//------------------------------------------------------------------------------ +TInt CUtils::AppendFirstURISeg( TDes8& aURI, TDes8& aTarget ) + { + + TInt i = aURI.FindC(_L8("/")); + + if ( i != KErrNotFound ) + { + aTarget.Append( aURI.Left( i ) ); + aURI.Copy( aURI.Right( aURI.Length() - i - 1 ) ); + } + else + { + aTarget.Copy( aURI ); + aURI.Copy( aURI.Right( 0 ) ); + } + + return i; + } + +//============================================= +// CUtils::IntLUID() +// Returns IntValue for aLUID +//============================================= +TInt CUtils::IntLUID(const TDesC8& aLUID) + { + TInt ret(0); + + TLex8 lex(aLUID); + + lex.Val( ret ); + + return ret; + } + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/traces/OstTraceDefinitions.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,7 @@ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/traces/fixed_id.definitions Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,586 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x7 +[GROUP]TRACE_NORMAL=0x3 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CADDBUFFER_ENTRY=0x1ef +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CADDBUFFER_EXIT=0x1f0 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CONSTRUCTL_ENTRY=0x1f3 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CONSTRUCTL_EXIT=0x1f4 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_DELETE_ENTRY=0x1f7 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_DELETE_EXIT=0x1f8 +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWL_ENTRY=0x1ad +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWL_EXIT=0x1ae +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_Reset_ENTRY=0x27b +[TRACE]TRACE_FLOW[0x7]_CADDBUFFER_Reset_EXIT=0x27c +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CBRANCHBASE_2_ENTRY=0x209 +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CBRANCHBASE_ENTRY=0x207 +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CBRANCHBASE_EXIT=0x208 +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_DELETE_ENTRY=0x20b +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_DELETE_EXIT=0x20c +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_GETALLCONNECTIONMETHODSL_ENTRY=0x277 +[TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_GETALLCONNECTIONMETHODSL_EXIT=0x278 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURIL_ENTRY=0x274 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURIL_EXIT=0x275 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURIL_EXIT_2=0x276 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CCONNMOADAPTER_ENTRY=0x24f +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CCONNMOADAPTER_EXIT=0x250 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMMITATOMICL_ENTRY=0x263 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMMITATOMICL_EXIT=0x264 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_ENTRY=0x26b +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_EXIT=0x26c +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTL_ENTRY=0x253 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTL_EXIT=0x254 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COPYCOMMANDL_ENTRY=0x25f +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COPYCOMMANDL_EXIT=0x260 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFSTRUCTUREL_ENTRY=0x257 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFSTRUCTUREL_EXIT=0x258 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFVERSIONL_ENTRY=0x255 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFVERSIONL_EXIT=0x256 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETE_ENTRY=0x251 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETE_EXIT=0x252 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_ENTRY=0x25b +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_EXIT=0x25c +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_ENTRY=0x25d +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_EXIT=0x25e +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWLC_ENTRY=0x24d +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWLC_EXIT=0x24e +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWL_ENTRY=0x24b +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWL_EXIT=0x24c +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ROLLBACKATOMICL_ENTRY=0x265 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ROLLBACKATOMICL_EXIT=0x266 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STARTATOMICL_ENTRY=0x261 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STARTATOMICL_EXIT=0x262 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMCOMMITTEDL_ENTRY=0x269 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMCOMMITTEDL_EXIT=0x26a +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMINGSUPPORT_ENTRY=0x267 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMINGSUPPORT_EXIT=0x268 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_ENTRY=0x259 +[TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_EXIT=0x25a +[TRACE]TRACE_FLOW[0x7]_CCONNMONODEELEMENT_CCONNMONODEELEMENT_ENTRY=0x1eb +[TRACE]TRACE_FLOW[0x7]_CCONNMONODEELEMENT_CCONNMONODEELEMENT_EXIT=0x1ec +[TRACE]TRACE_FLOW[0x7]_CCONNMONODEELEMENT_DELETE_ENTRY=0x1f5 +[TRACE]TRACE_FLOW[0x7]_CCONNMONODEELEMENT_DELETE_EXIT=0x1f6 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CONSTRUCTL_ENTRY=0x7d +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CONSTRUCTL_EXIT=0x7e +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CONSTRUCTOR_ENTRY=0x79 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CONSTRUCTOR_EXIT=0x7a +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DDFSTRUCTUREL_ENTRY=0x7f +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DDFSTRUCTUREL_EXIT=0x80 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DESTRUCTOR_ENTRY=0x7b +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DESTRUCTOR_EXIT=0x7c +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_IPBRANCHDDFSTRUCTUREL_ENTRY=0x279 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_IPBRANCHDDFSTRUCTUREL_EXIT=0x27a +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_NEWL_ENTRY=0x77 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_NEWL_EXIT=0x78 +[TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SETLEAFDATAL_ENTRY=0x247 +[TRACE]TRACE_FLOW[0x7]_CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_ENTRY=0x26d +[TRACE]TRACE_FLOW[0x7]_CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_EXIT=0x26e +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CONSTRUCTOR_ENTRY=0x8d +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CONSTRUCTOR_EXIT=0x8e +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DDFSTRUCTUREL_ENTRY=0x91 +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DDFSTRUCTUREL_EXIT=0x92 +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DESTRUCTOR_ENTRY=0x8f +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DESTRUCTOR_EXIT=0x90 +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_NEWL_ENTRY=0x8b +[TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_NEWL_EXIT=0x8c +[TRACE]TRACE_FLOW[0x7]_CUTILS_CUTILS_ENTRY=0xe4 +[TRACE]TRACE_FLOW[0x7]_CUTILS_CUTILS_EXIT=0xe5 +[TRACE]TRACE_FLOW[0x7]_DUP1_CBRANCHBASE_CBRANCHBASE_2_EXIT=0x20a +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_ADDNODETOBUFFERL_ENTRY=0x1b +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_ADDNODETOBUFFERL_EXIT=0x1c +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_ADDNODETOBUFFERL_LEAF_ENTRY=0x1d +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_ADDNODETOBUFFERL_LEAF_EXIT=0x1e +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFINDDYNAMICNODE_ENTRY=0x49 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFINDDYNAMICNODE_EXIT=0x4b +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFINDDYNAMICNODE_MATCH_FOUND=0x4a +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_ENTRY=0x148 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_EXIT=0x48 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_MATCH_FOUND=0x47 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_RESULT_NODE=0x147 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FINDDYNAMICNODE_ENTRY=0x43 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FINDDYNAMICNODE_EXIT=0x45 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FINDDYNAMICNODE_MATCH_FOUND=0x44 +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_GETGROUP_ENTRY=0x4c +[TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_GETGROUP_EXIT=0x4d +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_CHECKPREVIOUSURILIST_ENTRY=0x61 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_CHECKPREVIOUSURILIST_EXIT=0x9d +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLCONNECTIONMETHODSL_COUNT=0x16e +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLDYNAMICNODESL_ENTRY=0x65 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLDYNAMICNODESL_EXIT=0x67 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODLC_ENTRY=0x173 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_FOUND=0x175 +[TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODLC_EXIT_NOT_FOUND=0x174 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDBRANCHL_ENTRY=0x16c +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDBRANCHL_EXIT=0x16d +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDNODEOBJECTL_ENTRY=0x157 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDNODEOBJECTL_EXIT=0x158 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_CHILDURILISTL_ENTRY=0x155 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_CHILDURILISTL_EXIT=0x156 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_COMMITATOMICL_UNSUPPORTED_METHOD_CALL=0x15d +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_COPYCOMMANDL_UNSUPPORTED_METHOD_CALL=0x15b +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DELETEOBJECTL_ENTRY=0x14f +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DELETEOBJECTL_EXIT=0x150 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_UNSUPPORTED_METHOD_CALL=0x15a +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_EXECUTECOMMANDL_UNSUPPORTED_METHOD_CALL=0x159 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTL_ENTRY=0x151 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTL_EXIT=0x152 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_ENTRY=0x153 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_EXIT=0x154 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ROLLBACKATOMICL_UNSUPPORTED_METHOD_CALL=0x15e +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STARTATOMICL_UNSUPPORTED_METHOD_CALL=0x15c +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STREAMCOMMMITTEDL_UNSUPPORTED_METHOD_CALL=0x160 +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STREAMINGSUPPORT_NOT_SUPPORTED=0x15f +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_ENTRY=0x14c +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_EXIT=0x14d +[TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_UNSUPPORTED_METHOD_CALL=0x14e +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL=0x18a +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_ALLREADY_EXISTS=0x181 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_ENTRY=0xdc +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_EXIT=0xdd +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE=0x165 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_NEW_NODE2=0x169 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ALLMANDATORYNAPFIELDSFOUND_ENTRY=0xb8 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ALLMANDATORYNAPFIELDSFOUND_EXIT=0xb9 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_CHILDURILISTL=0x6 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_CHILDURILISTL_ENTRY=0xd8 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_ENTRY=0xcb +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_EXIT=0xcc +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PRIVATE_DELETE=0x166 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PRIVATE_ENTRY=0xc7 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PRIVATE_EXIT=0xc8 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DUP1_FETCHLEAFOBJECTL_NOT_FOUND=0x189 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DUP_FETCHLEAFOBJECTL_NOT_FOUND=0x188 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTL_ENTRY=0xcf +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTL_EXIT=0xd3 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTL_NOT_FOUND=0xd2 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTL_STATUS=0xd0 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0xd4 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0xd7 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_NOT_FOUND=0xd6 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_STATUS=0xd5 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FINDNEWCMTYPE_3GPP=0xb4 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FINDNEWCMTYPE_ENTRY=0xb2 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FINDNEWCMTYPE_EXIT=0xb3 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETDYNAMICNAPNODEURI=0x17a +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETLEAFDATAL_ENTRY=0xa3 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETLEAFDATAL_EXIT=0x9a +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDADDRESULT_ENTRY=0xa4 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUEL_ENTRY=0x16f +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUEL_EXIT=0x170 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_MAPURITOCMATTRIBUTE_ENTRY=0xac +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_MAPURITOCMATTRIBUTE_EXIT=0xa8 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_MAPURITOCMATTRIBUTE_GET_NODE=0xa7 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_NAPCHILDURILISTL_ADDED_TO_LIST=0xc1 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_NAPCHILDURILISTL_ENTRY=0xc0 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_NAPCHILDURILISTL_EXIT=0xc2 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_PROCESSBUFFERL_ENTRY=0xdf +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_PROCESSBUFFERL_EXIT=0xe0 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETLEAFDATAL_EXIT=0xae +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETLEAFDATAL_GET_CMATTRIB=0xad +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETNODEDATAL_ENTRY=0xaf +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETNODEDATAL_EXISTS=0x163 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETNODEDATAL_EXIT=0x161 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_SETNODEDATAL_OK=0x162 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_UPDATELEAFOBJECTL=0x176 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_UPDATELEAFOBJECTL_ENTRY=0xc5 +[TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_UPDATELEAFOBJECTL_EXIT=0xc6 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_ALREADY_EXISTS=0x10b +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_ENTRY=0x109 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_EXIT=0x10c +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE=0x167 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE2=0x168 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ALLMANDATORYPROXYFIELDSFOUND_ENTRY=0xf2 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ALLMANDATORYPROXYFIELDSFOUND_EXIT=0xf3 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHECKFORUNMODIFIABLEFIELD_ENTRY=0xe6 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHECKFORUNMODIFIABLEFIELD_EXIT=0xe7 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHILDURILISTL_ENTRY=0x106 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHILDURILISTL_EXIT=0x108 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHILDURILISTL_NOT_FOUND=0x107 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_ENTRY=0xe3 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_EXIT=0xe5 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_NOT_FOUND=0xe4 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_PUPLIC_ENTRY=0x102 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTL_PUPLIC_EXIT=0x103 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0x104 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0x105 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECT_OK=0x18 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FINDCONNECTIONMETHODL_ENTRY=0x171 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FINDCONNECTIONMETHODL_EXIT=0x172 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_ENTRY=0xf8 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_EXIT=0xfa +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETALLDYNAMICPROXYNODESL_PROXY=0xfb +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETALLDYNAMICPROXYNODES_ADDED_TO_LIST=0x1 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETDYNAMICPROXYNODEURI=0x17e +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_MAPURITOCMATTRIBUTE_ENTRY=0xea +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_MAPURITOCMATTRIBUTE_EXIT=0xeb +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_PROCESSBUFFERL_ENTRY=0x10d +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_PROCESSBUFFERL_EXIT=0x10f +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_SETLEAFDATAL_ENTRY=0xf4 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_SETLEAFDATAL_EXIT=0xf5 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_SETNODEDATAL_ENTRY=0xf6 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_SETNODEDATAL_EXIT=0xf7 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_UPDATELEAFOBJECTL=0x179 +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_UPDATELEAFOBJECTL_ENTRY=0xfe +[TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_UPDATELEAFOBJECTL_EXIT=0xff +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETENDOFURIFROMSEG_ENTRY=0x13b +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETENDOFURIFROMSEG_EXIT=0x13c +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETENDOFURIFROMSEG_EXIT2=0x13f +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETFIRSTURISEG_ENTRY=0x110 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETFIRSTURISEG_EXIT=0x13d +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETLASTURISEG_ENTRY=0x123 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETLASTURISEG_EXIT=0x124 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETLASTURISEG_EXIT2=0x141 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSECONDTURISEG_EXIT=0x140 +[TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSECONDURISEG_ENTRY=0x112 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_CHILDURILISTL=0x182 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_CHILDURILISTL_EXIT=0xd9 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_GETDYNAMICNAPNODEURI=0x17b +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_GETUNMODIFIABLEFIELDADDRESULT_EXIT=0xa5 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CNAPBRANCH_UPDATELEAFOBJECTL=0x177 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CPROXYBRANCH_CHILDURILISTL=0x186 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CPROXYBRANCH_UPDATELEAFOBJECTL=0x178 +[TRACE]TRACE_NORMAL[0x3]_DUP1_CPROXYRANCH_GETDYNAMICPROXYNODEURI=0x17f +[TRACE]TRACE_NORMAL[0x3]_DUP2_CNAPBRANCH_CHILDURILISTL=0x183 +[TRACE]TRACE_NORMAL[0x3]_DUP2_CPROXYBRANCH_CHILDURILISTL=0x187 +[[OBSOLETE]][TRACE]TRACE_DEBUG[0x9]_CUTILS_GETSEGPOSITIONFROMURI=0x1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_AddNodeToBufferL_ENTRY=0x1b3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_AddNodeToBufferL_EXIT=0x1b4 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_AddNodeToBufferL__leaf_EXIT=0x1b6 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_AddNodeToBufferL_leaf_ENTRY=0x1b5 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CONSTRUCTOR_ENTRY=0x1af +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CONSTRUCTOR_EXIT=0x1b0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CacheFindDynamicNode_ENTRY=0x1c5 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CacheFindDynamicNode_EXIT=0x1c6 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CacheFind_ENTRY=0x1c3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_CacheFind_EXIT=0x1c4 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_DESTRUCTOR_ENTRY=0x1b1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_DESTRUCTOR_EXIT=0x1b2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_FindDynamicNode_ENTRY=0x1b9 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_FindDynamicNode_EXIT=0x1ba +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_Find_ENTRY=0x1b7 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_Find_EXIT=0x1b8 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_GetGroup_ENTRY=0x1bb +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_GetGroup_EXIT=0x1bc +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWLC_ENTRY=0x9d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWLC_EXIT=0x9e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWL_ENTRY=0x9b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CADDBUFFER_NEWL_EXIT=0x9c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CALLBACK_ENTRY=0x20d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_CALLBACK_EXIT=0x20e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_GETALLCONNECTIONMETHODS_ENTRY=0x20f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CBRANCHBASE_GETALLCONNECTIONMETHODS_EXIT=0x210 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURI_ENTRY=0x248 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURI_EXIT=0x249 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBASEURI_EXIT_2=0x24a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBRANCH_ENTRY=0x165 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDBRANCH_EXIT=0x166 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDNODEOBJECTL_ENTRY=0x181 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ADDNODEOBJECTL_EXIT=0x182 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CCONNMOADAPTER_ENTRY=0x214 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CCONNMOADAPTER_EXIT=0x215 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CHILDURILISTL_ENTRY=0x17f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CHILDURILISTL_EXIT=0x180 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMMITATOMICL_ENTRY=0x18b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMMITATOMICL_EXIT=0x18c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_ENTRY=0x193 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COMPLETEOUTSTANDINGCMDSL_EXIT=0x194 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTL_ENTRY=0x16f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTL_EXIT=0x170 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTOR_ENTRY=0x16b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_CONSTRUCTOR_EXIT=0x16c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COPYCOMMANDL_ENTRY=0x228 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_COPYCOMMANDL_EXIT=0x229 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFSTRUCTUREL_ENTRY=0x173 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFSTRUCTUREL_EXIT=0x174 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFVERSIONL_ENTRY=0x171 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DDFVERSIONL_EXIT=0x172 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETEOBJECTL_ENTRY=0x179 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETEOBJECTL_EXIT=0x17a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETE_ENTRY=0x218 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DELETE_EXIT=0x219 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DESTRUCTOR_ENTRY=0x16d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_DESTRUCTOR_EXIT=0x16e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_ENTRY=0x224 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_EXIT=0x225 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_ENTRY=0x226 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_EXIT=0x227 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_FETCHLEAFOBJECTL_ENTRY=0x17b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_FETCHLEAFOBJECTL_EXIT=0x17c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_ENTRY=0x17d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_EXIT=0x17e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWLC_ENTRY=0x169 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWLC_EXIT=0x16a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWL_ENTRY=0x167 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_NEWL_EXIT=0x168 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ROLLBACKATOMICL_ENTRY=0x18d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_ROLLBACKATOMICL_EXIT=0x18e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STARTATOMICL_ENTRY=0x189 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STARTATOMICL_EXIT=0x18a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMCOMMITTEDL_ENTRY=0x191 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMCOMMITTEDL_EXIT=0x192 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMINGSUPPORT_ENTRY=0x18f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_STREAMINGSUPPORT_EXIT=0x190 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_ENTRY=0x175 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_EXIT=0x176 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_ENTRY=0x22a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_EXIT=0x237 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_ADDNODEOBJECTL_ENTRY=0x1ab +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_ADDNODEOBJECTL_EXIT=0x1ac +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_CHILDURILISTL_ENTRY=0x1a9 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_CHILDURILISTL_EXIT=0x1aa +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_CONSTRUCTOR_ENTRY=0x233 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_CONSTRUCTOR_EXIT=0x234 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DDFSTRUCTUREL_ENTRY=0x19d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DDFSTRUCTUREL_EXIT=0x19e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DELETEOBJECTL_ENTRY=0x1a3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DELETEOBJECTL_EXIT=0x1a4 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DESTRUCTOR_ENTRY=0x235 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_DESTRUCTOR_EXIT=0x236 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_FETCHLEAFOBJECTL_ENTRY=0x1a5 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_FETCHLEAFOBJECTL_EXIT=0x1a6 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0x1a7 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0x1a8 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_NEWL_ENTRY=0x232 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_NEWL_EXIT=0x22d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_UPDATELEAFOBJECTL_ENTRY=0x19f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CEAPBRANCH_UPDATELEAFOBJECTL_EXIT=0x1a0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_ADDNODEOBJECTL_ENTRY=0xc2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_ADDNODEOBJECTL_EXIT=0xc3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_AllMandatoryNapFieldsFound_ENTRY=0x14b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_AllMandatoryNapFieldsFound_EXIT=0x14c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CHECKPREVIOUSURILIST_ENTRY=0xe8 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CHECKPREVIOUSURILIST_EXIT=0xe9 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CHILDURILISTL_ENTRY=0xc0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CHILDURILISTL_EXIT=0xc1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CheckForUnmodifiableField_ENTRY=0x141 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_CheckForUnmodifiableField_EXIT=0x142 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DELETEOBJECTL_ENTRY=0xba +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_DELETEOBJECTL_EXIT=0xbb +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FETCHLEAFOBJECTL_ENTRY=0xbc +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FETCHLEAFOBJECTL_EXIT=0xbd +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0xbe +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0xbf +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FindNewCmType_ENTRY=0x149 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_FindNewCmType_EXIT=0x14a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GETURILISTFORNAPNODEL_ENTRY=0x127 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GETURILISTFORNAPNODEL_EXIT=0x128 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GetLeafDataL_ENTRY=0x1c1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GetLeafDataL_EXIT=0x1c2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GetUnmodifiableFieldValue_ENTRY=0x1bf +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_GetUnmodifiableFieldValue_EXIT=0x1c0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_IPBRANCHDDFSTRUCTURE_ENTRY=0x81 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_IPBRANCHDDFSTRUCTURE_EXIT=0x82 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_MapUriToCmAttribute_ENTRY=0x143 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_MapUriToCmAttribute_EXIT=0x144 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_NAPCHILDURILISTL_ENTRY=0x105 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_NAPCHILDURILISTL_EXIT=0x106 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_ProcessBufferL_ENTRY=0x14d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_ProcessBufferL_EXIT=0x14e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SetLeafDataL_ENTRY=0x145 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SetLeafDataL_EXIT=0x146 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SetNodeDataL_ENTRY=0x147 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_SetNodeDataL_EXIT=0x148 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_UPDATELEAFOBJECTL_ENTRY=0xb6 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_UPDATELEAFOBJECTL_EXIT=0xb7 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_UPDATELEAFOBJECTL_STREAM_ENTRY=0xb8 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CNAPBRANCH_UPDATELEAFOBJECTL_STREAM_EXIT=0xb9 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_ENTRY=0x195 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CONNMOADAPTER_IMPLEMENTATIONGROUPPROXY_EXIT=0x196 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_ADDNODEOBJECTL_ENTRY=0x121 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_ADDNODEOBJECTL_EXIT=0x122 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_AllMandatoryProxyFieldsFound_ENTRY=0x135 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_AllMandatoryProxyFieldsFound_EXIT=0x136 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CHILDURILISTL_ENTRY=0x11f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CHILDURILISTL_EXIT=0x120 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CheckForUnmodifiableField_ENTRY=0x12f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_CheckForUnmodifiableField_EXIT=0x130 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DELETEOBJECTL_ENTRY=0x119 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_DELETEOBJECTL_EXIT=0x11a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FETCHLEAFOBJECTL_ENTRY=0x11b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FETCHLEAFOBJECTL_EXIT=0x11c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0x11d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0x11e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FindConnectionMethod_ENTRY=0x133 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_FindConnectionMethod_EXIT=0x134 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETALLDYNAMICPROXYNODES_ENTRY=0x113 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETALLDYNAMICPROXYNODES_EXIT=0x114 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETCONNECTIONMETHOD_ENTRY=0x110 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETCONNECTIONMETHOD_EXIT=0x111 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETDYNAMICNODESFORPROXYFIELDL_ENTRY=0x125 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETDYNAMICNODESFORPROXYFIELDL_EXIT=0x126 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETURILISTFORPROXYNODEL_ENTRY=0x123 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_GETURILISTFORPROXYNODEL_EXIT=0x124 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_MapUriToCmAttribute_ENTRY=0x131 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_MapUriToCmAttribute_EXIT=0x132 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_ProcessBufferL_ENTRY=0x13b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_ProcessBufferL_EXIT=0x13c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_SetLeafDataL_ENTRY=0x137 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_SetLeafDataL_EXIT=0x138 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_SetNodeDataL_ENTRY=0x139 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_SetNodeDataL_EXIT=0x13a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_UPDATELEAFOBJECTL_ENTRY=0x115 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_UPDATELEAFOBJECTL_EXIT=0x116 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_UPDATELEAFOBJECTL_STREAM_ENTRY=0x117 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CPROXYBRANCH_UPDATELEAFOBJECTL_STREAM_EXIT=0x118 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONSTRUCTL_ENTRY=0x26 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONSTRUCTL_EXIT=0x27 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONVERTTO16LC_ENTRY=0x1a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONVERTTO16LC_EXIT=0x1b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONVERTTO8LC_ENTRY=0x18 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CONVERTTO8LC_EXIT=0x19 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CUTILS_ENTRY=0x22 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_CUTILS_EXIT=0x23 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_DESTOINT_ENTRY=0x1c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_DESTOINT_EXIT=0x1d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_DesToBool_ENTRY=0x13d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_DesToBool_EXIT=0x13e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_ExtractCmId_ENTRY=0x13f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_ExtractCmId_EXIT=0x140 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETALLDYNAMICNODESL_ENTRY=0x1bd +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETALLDYNAMICNODESL_EXIT=0x1be +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETENDOFURIFROMSEG_ENTRY=0x3f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETENDOFURIFROMSEG_EXIT=0x41 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETFIRSTURISEG_ENTRY=0xea +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETFIRSTURISEG_EXIT=0x104 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETLASTURISEG_ENTRY=0x33 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETLASTURISEG_EXIT=0x36 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETLASTURISEG_EXIT2=0x37 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSECONDTURISEG_EXIT=0xec +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSECONDURISEG_ENTRY=0xeb +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSEGFROMURI_ENTRY=0x3c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSEGFROMURI_EXIT=0x3d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSEGPOSITIONFROMURI_ENTRY=0x49 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETSEGPOSITIONFROMURI_EXIT=0x4a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETURILISTFORNODEL_ENTRY=0x12d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_GETURILISTFORNODEL_EXIT=0x12e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NEWLC_ENTRY=0xe2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NEWLC_EXIT=0xe3 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NEWL_ENTRY=0xe0 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NEWL_EXIT=0xe1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NUMOFURISEGS_ENTRY=0x39 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NUMOFURISEGS_ENTRY_EXIT=0x3b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NUMOFURISEGS_EXIT=0xf +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CUTILS_NUMOFURISEG_ENTRY=0x38 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_ADDNODEOBJECTL_ENTRY=0x163 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_ADDNODEOBJECTL_EXIT=0x164 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_CHILDURILISTL_ENTRY=0x161 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_CHILDURILISTL_EXIT=0x162 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_CONSTRUCTOR_ENTRY=0x151 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_CONSTRUCTOR_EXIT=0x152 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DDFSTRUCTUREL_ENTRY=0x155 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DDFSTRUCTUREL_EXIT=0x156 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DELETEOBJECTL_ENTRY=0x15b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DELETEOBJECTL_EXIT=0x15c +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DESTRUCTOR_ENTRY=0x153 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_DESTRUCTOR_EXIT=0x154 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_FETCHLEAFOBJECTL_ENTRY=0x15d +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_FETCHLEAFOBJECTL_EXIT=0x15e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_FETCHLEAFOBJECTSIZEL_ENTRY=0x15f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_FETCHLEAFOBJECTSIZEL_EXIT=0x160 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_NEWL_ENTRY=0x14f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_NEWL_EXIT=0x150 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_UPDATELEAFOBJECTL_ENTRY=0x157 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_UPDATELEAFOBJECTL_EXIT=0x158 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_UPDATELEAFOBJECTL_STREAM_ENTRY=0x159 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_CWLANBRANCH_UPDATELEAFOBJECTL_STREAM_EXIT=0x15a +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CEAPBRANCH_UPDATELEAFOBJECTL_ENTRY=0x1a1 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CEAPBRANCH_UPDATELEAFOBJECTL_EXIT=0x1a2 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CPROXYBRANCH_GETCONNECTIONMETHOD_EXIT=0x112 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_CUTILS_ENTRY=0x24 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_CUTILS_EXIT=0x25 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_GETENDOFURIFROMSEG_EXIT=0x40 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_GETSEGFROMURI_EXIT=0x3e +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_CUTILS_GETSEGPOSITIONFROMURI_EXIT=0x4b +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP1_TLUID_EQUALS_EXIT=0x273 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_DUP2_CUTILS_GETSEGFROMURI_EXIT=0x42 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_DELETE_ENTRY=0x26f +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_DELETE_EXIT=0x270 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_EQUALS_ENTRY=0x271 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_EQUALS_EXIT=0x272 +[[OBSOLETE]][TRACE]TRACE_FLOW[0x7]_TLUID_GETCMID_EXIT=0x246 +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_COMMITATOMICL_UNSUPPORTED_METHOD_CALL=0xe +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_COPYCOMMANDL_UNSUPPORTED_METHOD_CALL=0xc +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_UNSUPPORTED_METHOD_CALL=0xb +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_EXECUTECOMMANDL_UNSUPPORTED_METHOD_CALL=0xa +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_ROLLBACKATOMICL_UNSUPPORTED_METHOD_CALL=0xf +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_STARTATOMICL_UNSUPPORTED_METHOD_CALL=0xd +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_STREAMCOMMMITTEDL_UNSUPPORTED_METHOD_CALL=0x10 +[[OBSOLETE]][TRACE]TRACE_IMPORTANT[0x2]_CCONNMOADAPTER_UPDATELEAFOBJECTL_UNSUPPORTED_METHOD_CALL=0x9 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_CACHEFIND_ENTRY=0x46 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FIND_ENTRY=0x1f +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FIND_EXIT=0x20 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CADDBUFFER_FIND_MATCH_FOUND=0x42 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_CHECKPREVIOUSURILIST_EXIT=0x62 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLCONNECTIONMETHODS_COUNT=0xf9 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLDYNAMICNODESL_ADDED_TO_LIST=0x17 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETALLDYNAMICNODESL_NOTFOUND=0x66 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODL_ENTRY=0x68 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODL_EXIT_FOUND=0x6a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETCONNECTIONMETHODL_EXIT_NOT_FOUND=0x69 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETURILISTFORNODEL_ENTRY=0x63 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETURILISTFORNODEL_EXIT=0x185 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETURILISTFORNODEL_NOTFOUND=0x184 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CBRANCHBASE_GETURILISTFORNODEL_OK=0x14 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDBRANCH_ENTRY=0x149 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDBRANCH_EXIT=0x14a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDNODEOBJECTL_ENTRY=0x7b +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ADDNODEOBJECTL_EXIT=0x7c +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_CHILDURILISTL_ENTRY=0x85 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_CHILDURILISTL_EXIT=0x86 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_COMMITATOMICL_UNSUPPORTED_METHOD_CALL=0x81 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_COPYCOMMANDL_UNSUPPORTED_METHOD_CALL=0x7f +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DDFVERSIONL_VERSION=0x14b +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DELETEOBJECTL_ENTRY=0x8b +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_DELETEOBJECTL_EXIT=0x8c +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_EXECUTECOMMANDL_STREAM_UNSUPPORTED_METHOD_CALL=0x7e +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_EXECUTECOMMANDL_UNSUPPORTED_METHOD_CALL=0x7d +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTL_ENTRY=0x89 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTL_EXIT=0x8a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_ENTRY=0x87 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_FETCHLEAFOBJECTSIZEL_EXIT=0x88 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_ROLLBACKATOMICL_UNSUPPORTED_METHOD_CALL=0x82 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STARTATOMICL_UNSUPPORTED_METHOD_CALL=0x80 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STREAMCOMMMITTEDL_UNSUPPORTED_METHOD_CALL=0x84 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_STREAMINGSUPPORT_NOT_SUPPORTED=0x83 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_ENTRY=0x8e +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_EXIT=0x8f +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMOADAPTER_UPDATELEAFOBJECTL_STREAM_UNSUPPORTED_METHOD_CALL=0x8d +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMONODEELEMENT_CCONNMONODEELEMENT_ENTRY_2=0x40 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CCONNMONODEELEMENT_CCONNMONODEELEMENT_EXIT_2=0x41 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL=0x180 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_ADDNODEOBJECTL_ALLREADY_EXISTS=0xde +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PUBLIC_ENTRY=0xc3 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_DELETEOBJECTL_PUBLIC_EXIT=0xc4 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_FINDNEWCMTYPE_WLAN=0xb5 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETLEAFDATAL=0x99 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUE=0x98 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUE_ENTRY=0x97 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETUNMODIFIABLEFIELDVALUE_EXIT=0xa2 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETURILISTFORNAPNODEL=0x7 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETURILISTFORNAPNODEL_NOTFOUND=0xf +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CNAPBRANCH_GETURILISTFORNAPNODEL_OK=0xe +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_ADDNODEOBJECTL_NEW_NODE=0x164 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_CHILDURILISTL3=0x4 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FETCHLEAFOBJECTSIZE_OK=0x19 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FINDCONNECTIONMETHOD_ENTRY=0xee +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_FINDCONNECTIONMETHOD_EXIT=0x10e +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CPROXYBRANCH_GETDYNAMICNODESFORPROXYFIELDL_ADDED_TO_LIST=0x5 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETALLDYNAMICNODESL_ADDED_TO_LIST=0x1a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGFROMURI_ENTRY=0x133 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGFROMURI_EXIT=0x136 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGFROMURI_EXIT2=0x139 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGFROMURI_EXIT3=0x142 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGPOSITIONFROMURI_ENTRY=0x143 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGPOSITIONFROMURI_EXIT=0x144 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETSEGPOSITIONFROMURI_EXIT2=0x145 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETURILISTFORNODEL_NOTFOUND=0x13 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_GETURILISTFORNODEL_OK=0x16 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_NUMOFURISEGS_ENTRY_EXIT=0x146 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_CUTILS_NUMOFURISEG_ENTRY=0x131 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_DUP2_CPROXYBRANCH_UPDATELEAFOBJECTL=0x17d +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_DUP3_CNAPBRANCH_UPDATELEAFOBJECTL=0x17c +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_GetUriListForProxyNodeL=0x2 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_GetUriListForProxyNodeL2=0x3 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_TLUID_GETCMID=0x16b +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_TLUID_TLUID=0x16a +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_TLUID_TLUID_ID=0x91 +[[OBSOLETE]][TRACE]TRACE_NORMAL[0x3]_TLUID_TLUID_NAME=0x90 diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/connmoadapter/traces/trace.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/connmoadapter/traces/trace.properties Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,117 @@ + + + +EOk +ENotFound +EInvalidObject +EAlreadyExists +ETooLargeObject +EDiskFull +EError +ERollbackFailed +EObjectInUse +ENoMemory +ECommitOK +ERollbackOK +ECommitFailed +ENotAllowed + + +ECmCoverage +ECmDefaultPriority +ECmDestination +ECmBearerHasUi +ECmIPv6Supported +ECmDefaultUiPriority +ECmBearerIcon +ECmBearerAvailableIcon +ECmBearerAvailableName +ECmBearerSupportedName +ECmBearerAvailableText +ECmBearerNamePopupNote +ECmCommsDBBearerType +ECmBearerSettingName +ECmVirtual +ECmInvalidAttribute +ECmAddToAvailableList +ECmLoadResult +ECmBearerType +ECmName +ECmIapId +ECmStartPage +ECmHidden +ECmProtected +ECmNamingMethod +ECmSeamlessnessLevel +ECmElementID +ECmNetworkId +ECmConnected +ECmId +ECmWapId +ECmIapServiceId +ECmMetaHighlight +ECmMetaHiddenAgent +ECmNextLayerIapId +ECmNextLayerSNAPId +ECmProxyUsageEnabled +ECmProxyServerName +ECmProxyProtocolName +ECmProxyPortNumber +ECmProxyExceptions +ECmProxyRangeMax +ECmChargeCardUsageEnabled +ECmChargeCardAccountNumber +ECmChargeCardPIN +ECmChargeCardLocalRule +ECmChargeCardNatRule +ECmChargeCardIntlRule +ECmChargeCardRangeMax +ECmLocationUsageEnabled +ECmLocationIntlPrefixCode +ECmLocationNatPrefixCode +ECmLocationNatCode +ECmLocationAreaCode +ECmLocationDialOutCode +ECmLocationDisableCallWaitingCode +ECmLocationMobile +ECmLocationUsePulseDial +ECmLocationWaitForDialTone +ECmLocationPauseAfterDialOut +ECmLocationRangeMax +ECmWapIPGatewayAddress +ECmWapIPWSPOption +ECmWapIPSecurity +ECmWapIPProxyPort +ECmWapIPProxyLoginName +ECmWapIPProxyLoginPass +ECmWapRangeMax +ECmCommonAttributesStart +ECmIFName +ECmIFParams +ECmIFNetworks +ECmIFPromptForAuth +ECmIFAuthName +ECmIFAuthPass +ECmIFAuthRetries +ECmIPNetmask +ECmIPGateway +ECmIPAddFromServer +ECmIPAddress +ECmIPDNSAddrFromServer +ECmIPNameServer1 +ECmIPNameServer2 +ECmIP6DNSAddrFromServer +ECmIP6NameServer1 +ECmIP6NameServer2 +ECmIPAddrLeaseValidFrom +ECmIPAddrLeaseValidTo +ECmConfigDaemonManagerName +ECmConfigDaemonName +ECmEnableLPCExtension +ECmDisablePlainTextAuth +ECmCommonAttributesEnd +ECmSpecialAttributes +ECmIsLinked +ECmSpecialAttributesEnd + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/bld/DevDetail_HwV.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/bld/DevDetail_HwV.txt Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,1 @@ +0000 \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/bld/DevDetail_SwV.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/bld/DevDetail_SwV.txt Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,1 @@ +xxx-xxx 0.00 00 \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/bld/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build info file for DevDetail adapter +* +*/ + + + + +PRJ_EXPORTS +./DevDetail_SwV.txt /epoc32/release/winscw/udeb/z/resource/devman/devdetail_swv.txt +./DevDetail_SwV.txt /epoc32/release/winscw/urel/z/resource/devman/devdetail_swv.txt +./DevDetail_HwV.txt /epoc32/release/winscw/udeb/z/resource/devman/devdetail_hwv.txt +./DevDetail_HwV.txt /epoc32/release/winscw/urel/z/resource/devman/devdetail_hwv.txt + +PRJ_MMPFILES +./nsmldmdevdetailadapter.mmp + + + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/bld/nsmldmdevdetailadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/bld/nsmldmdevdetailadapter.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project file for devdetail adapter +* +*/ + + + + +#include "defaultcaps.hrh" +#include + +//This flag is used for enabling Fota Multi-ROFS Support +MACRO _ENABLE_MULTIROFS_SUPPORT + +TARGET nsmldmdevdetailadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F6DE9 +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc +USERINCLUDE ../../inc +SOURCE nsmldmdevdetailadapter.cpp + +//#if defined(ARMCC) +SOURCE nsmldmdevdetailutils_ARM.cpp +//#elif defined(WINSCW) +//SOURCE nsmldmdevdetailutils_WINSCW.cpp +//#endif + +START RESOURCE nsmldmdevdetailadapter.rss +LANGUAGE_IDS +END + + + + +//#if defined(ARMCC) +LIBRARY sysutil.lib +//#elif defined(WINSCW) +//LIBRARY efsrv.lib +//#endif + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY nsmldebug.lib +LIBRARY nsmlagentcommon.lib + +//For Multi-ROFS Support +LIBRARY sysversioninfo.lib + + +SMPSAFE diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/inc/nsmldmdevdetailadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/inc/nsmldmdevdetailadapter.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM DevDetail Adapter +* +*/ + + + + +#ifndef __NSMLDMDEVDETAILADAPTER_H__ +#define __NSMLDMDEVDETAILADAPTER_H__ + +// INCLUDES + +#include +#include +#include "nsmldmconstants.h" + +// the DDF version must be changed if any changes in DDF structure +// ( built in DDFStructureL() function ) +_LIT8( KNSmlDMDevDetailDDFVersion, "1.0" ); + +_LIT8( KNSmlDMDevDetailTextPlain, "text/plain" ); +_LIT8( KNSmlDMDevDetailNodeName, "DevDetail" ); +_LIT8( KNSmlDMDevDetailDescription, "The interior object holds all DevDetail objects" ); + +_LIT8( KNSmlDMDevDetailDevTypNodeName, "DevTyp" ); +_LIT8( KNSmlDMDevDetailDevTypDescription, "The type of the device" ); +_LIT8( KNSmlDMDevDetailDevTypValue, "smartphone" ); + +_LIT8( KNSmlDMDevDetailOEMNodeName, "OEM" ); +_LIT8( KNSmlDMDevDetailOEMDescription, "Original Equipment Manufacturer" ); + +_LIT8( KNSmlDMDevDetailFwVNodeName, "FwV" ); +_LIT8( KNSmlDMDevDetailFwVDescription, "The firmware revision of the device" ); + +_LIT8( KNSmlDMDevDetailSwVNodeName, "SwV" ); +_LIT8( KNSmlDMDevDetailSwVDescription, "The software revision of the device" ); + +_LIT8( KNSmlDMDevDetailHwVNodeName, "HwV" ); +_LIT8( KNSmlDMDevDetailHwVDescription, "The hardware revision of the device" ); + +_LIT8( KNSmlDMDevDetailLrgObjNodeName, "LrgObj" ); +_LIT8( KNSmlDMDevDetailLrgObjDescription, "Large object handling supported if value is true" ); +_LIT8( KNSmlDMDevDetailLrgObjValue, "true" ); + +_LIT8( KNSmlDMDevDetailURINodeName, "URI" ); +_LIT8( KNSmlDMDevDetailURIDescription, "The tree limitations branch" ); + +_LIT8( KNSmlDMDevDetailMaxDepthNodeName, "MaxDepth" ); +_LIT8( KNSmlDMDevDetailMaxDepthDescription, "Maximum tree depth" ); +_LIT8( KNSmlDMDevDetailMaxDepthValue, "0" ); + +_LIT8( KNSmlDMDevDetailMaxTotLenNodeName, "MaxTotLen" ); +_LIT8( KNSmlDMDevDetailMaxTotLenDescription, "Maximum URI length" ); +_LIT8( KNSmlDMDevDetailMaxTotLenValue, "0" ); + +_LIT8( KNSmlDMDevDetailMaxSegLenNodeName, "MaxSegLen" ); +_LIT8( KNSmlDMDevDetailMaxSegLenDescription, "Maximum URI segment length" ); +_LIT8( KNSmlDMDevDetailMaxSegLenValue, "9" ); + +_LIT8( KNSmlDMDevDetailSeparator, "/" ); + +const TInt KNSmlMaxRequestBufferLength = 128; +const TInt KNSmlMaxSizeBufferLength = 4; + +_LIT( KNSmlDevDetailPanic, "DevDetail" ); + +// CLASS DECLARATION +class CNSmlDmDevDetailAdapter : public CSmlDmAdapter + { +public: // contructors and destructor + static CNSmlDmDevDetailAdapter* NewL(MSmlDmCallback* aDmCallback ); + static CNSmlDmDevDetailAdapter* NewLC(MSmlDmCallback* aDmCallback ); + + virtual ~CNSmlDmDevDetailAdapter(); + virtual TInt DevDetailValueCrcL(); + +private: // new functions + CNSmlDmDevDetailAdapter(TAny* aEcomArguments); + void AddObjectToBufferL( CBufBase& aCrcBuf, const TDesC8& aURI ); + CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, CBufBase& aObject ); + void SetLeafPropertiesL( MSmlDmDDFObject& aObject, + const TSmlDmAccessTypes& aAccessTypes, + const TDesC8& aDescription ) const; + +private: // functions from base classes + // from CSmlDmAdapter + void DDFVersionL( CBufBase& aVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + const TInt aStatusRef ); + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TInt aStatusRef ); + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef ); + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, + const TDesC8& aType, const TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, RWriteStream*& aStream, + const TDesC8& aType, const TInt aStatusRef ); + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + +// FOTA +private: + + /** + * Enumeration specifies the data that can be fetched using + * GetDevDetailDataL(). + */ + enum TNSmlDevDetailData + { + ESwVersion, + EHwVersion + }; + + /** + * Fetches and/or forms DevDetail data specified by aElement. + * In WINSCW this data is read from file. In ARM builds the + * data is fetched from EInfo. + * @param aObject The buffer where fetched data is inserted. + * @param aElement Specifies the data that should be fetched. + */ + void GetDevDetailDataL( CBufBase& aObject, TNSmlDevDetailData aElement ) const; + +// FOTA end + +private: + + MSmlDmCallback* iDmCallback; + + }; + +#endif // __NSMLDMDEVDETAILADAPTER_H__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/src/nsmldmdevdetailadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/src/nsmldmdevdetailadapter.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,561 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM DevDetail Adapter Source Code +* +*/ + + + + +// INCLUDE FILES +#include // For TImplementationProxy definition + +#include "nsmldmimpluids.h" +#include "nsmldmdevdetailadapter.h" +#include "nsmldebug.h" +#include "nsmlphoneinfo.h" +#include "nsmlunicodeconverter.h" +#include "nsmlconstants.h" + + +// ------------------------------------------------------------------------------------------------ +// CNSmlDmDevDetailAdapter::NewL( ) +// ------------------------------------------------------------------------------------------------ +CNSmlDmDevDetailAdapter* CNSmlDmDevDetailAdapter::NewL(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::NewL(): begin"); + CNSmlDmDevDetailAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop(); + _DBG_FILE("CNSmlDmDevDetailAdapter::NewL(): end"); + return self; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDmDevDetailAdapter::NewLC( ) +// ------------------------------------------------------------------------------------------------ +CNSmlDmDevDetailAdapter* CNSmlDmDevDetailAdapter::NewLC(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::NewLC(): begin"); + CNSmlDmDevDetailAdapter* self = new (ELeave) CNSmlDmDevDetailAdapter(aDmCallback); + CleanupStack::PushL(self); + self->iDmCallback=aDmCallback; + _DBG_FILE("CNSmlDmDevDetailAdapter::NewLC(): end"); + return self; + } + + +// ------------------------------------------------------------------------------------------------ +// CNSmlDmDevDetailAdapter::CNSmlDmDevDetailAdapter(TAny* aEcomArguments) +// ------------------------------------------------------------------------------------------------ +CNSmlDmDevDetailAdapter::CNSmlDmDevDetailAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::CNSmlDmDevDetailAdapter(): begin"); + _DBG_FILE("CNSmlDmDevDetailAdapter::CNSmlDmDevDetailAdapter(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::~CNSmlDmDevDetailAdapter() +// ----------------------------------------------------------------------------- +CNSmlDmDevDetailAdapter::~CNSmlDmDevDetailAdapter() + { + _DBG_FILE("CNSmlDmDevDetailAdapter::~CNSmlDmDevDetailAdapter(): begin"); + _DBG_FILE("CNSmlDmDevDetailAdapter::~CNSmlDmDevDetailAdapter(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::DevDetailValueCrcL() +// ----------------------------------------------------------------------------- +TInt CNSmlDmDevDetailAdapter::DevDetailValueCrcL() + { + CBufBase* crcBuf = CBufFlat::NewL( 1 ); + CleanupStack::PushL( crcBuf ); + + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailDevTypNodeName() ); + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailOEMNodeName() ); + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailFwVNodeName() ); + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailSwVNodeName() ); + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailHwVNodeName() ); + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailLrgObjNodeName() ); + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailMaxDepthNodeName() ); + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailMaxTotLenNodeName() ); + AddObjectToBufferL( *crcBuf, KNSmlDMDevDetailMaxSegLenNodeName() ); + + TUint16 crc = 0; + Mem::Crc( crc, crcBuf->Ptr(0).Ptr(), crcBuf->Size() ); + CleanupStack::PopAndDestroy(); // crcBuf + return crc; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::AddObjectToBufferL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::AddObjectToBufferL( CBufBase& aCrcBuf, + const TDesC8& aURI ) + { + CBufBase* buf = CBufFlat::NewL( 1 ); + CleanupStack::PushL( buf ); + FetchLeafObjectL( aURI, *buf ); + aCrcBuf.InsertL( aCrcBuf.Size(), buf->Ptr(0) ); + _LIT8( KNSmlDmSeparator, ";" ); + aCrcBuf.InsertL( aCrcBuf.Size(), KNSmlDmSeparator ); + CleanupStack::PopAndDestroy(); //buf + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::FetchLeafObjectL() +// ----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlDmDevDetailAdapter::FetchLeafObjectL( const TDesC8& aURI, + CBufBase& aObject ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectL(): begin"); + CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + + TInt ret = aURI.LocateReverse(KNSmlDMDevDetailSeparator()[0]); + if ( ret == KErrNotFound ) + { + ret = -1; + } + TInt len = aURI.Length() - ( ret + 1 ); + TPtrC8 segment = aURI.Right( len ); + if ( segment == KNSmlDMDevDetailDevTypNodeName ) + { + aObject.InsertL( 0, KNSmlDMDevDetailDevTypValue ); + } + else + if ( segment == KNSmlDMDevDetailOEMNodeName ) + { + CNSmlPhoneInfo* phoneInfo = CNSmlPhoneInfo::NewLC(); + HBufC* manufacturer = HBufC::NewLC( 50 ); + TPtr manufacturerPtr = manufacturer->Des(); + phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneManufacturer, manufacturerPtr ); + HBufC8* manufacturerInUTF8 = NULL; + NSmlUnicodeConverter::HBufC8InUTF8LC( *manufacturer, manufacturerInUTF8 ); + aObject.InsertL( 0, *manufacturerInUTF8 ); + CleanupStack::PopAndDestroy( 3 ); //manufacturerInUTF8, manufacturer, phoneInfo + } + else + if ( segment == KNSmlDMDevDetailSwVNodeName ) + { + // fetch software version + GetDevDetailDataL( aObject, ESwVersion ); + } + else + if ( segment == KNSmlDMDevDetailHwVNodeName ) + { + // fetch hardware version + GetDevDetailDataL( aObject, EHwVersion ); + } + else + if ( segment == KNSmlDMDevDetailLrgObjNodeName ) + { + aObject.InsertL( 0, KNSmlDMDevDetailLrgObjValue ); + } + else + if ( segment == KNSmlDMDevDetailMaxDepthNodeName ) + { + aObject.InsertL( 0, KNSmlDMDevDetailMaxDepthValue ); + } + else + if ( segment == KNSmlDMDevDetailMaxTotLenNodeName ) + { + aObject.InsertL( 0, KNSmlDMDevDetailMaxTotLenValue ); + } + else + if ( segment == KNSmlDMDevDetailMaxSegLenNodeName ) + { + aObject.InsertL( 0, KNSmlDMDevDetailMaxSegLenValue ); + } + else + if ( segment != KNSmlDMDevDetailFwVNodeName ) + { + retValue = CSmlDmAdapter::EError; + } + + _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectL(): end"); + return retValue; + } +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::SetLeafPropertiesL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject, + const TSmlDmAccessTypes& aAccessTypes, + const TDesC8& aDescription ) const + { + aObject.SetAccessTypesL( aAccessTypes ); + aObject.SetScopeL( MSmlDmDDFObject::EPermanent ); + aObject.SetDFFormatL( MSmlDmDDFObject::EChr ); + aObject.AddDFTypeMimeTypeL( KNSmlDMDevDetailTextPlain ); + aObject.SetDescriptionL( aDescription ); + } + + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::DDFVersionL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::DDFVersionL(TDes& aDDFVersion): begin"); + aDDFVersion.InsertL(0,KNSmlDMDevDetailDDFVersion); + _DBG_FILE("CNSmlDmDevDetailAdapter::DDFVersionL(TDes& aDDFVersion): end"); + } + + +// ----------------------------------------------------------------------------- +// void CNSmlDmDevDetailAdapter::DDFStructureL() +// +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::DDFStructureL(): begin"); + + TSmlDmAccessTypes accessTypes; + + accessTypes.SetGet(); + // DevDetail + MSmlDmDDFObject& devDetail = aDDF.AddChildObjectL( KNSmlDMDevDetailNodeName ); + devDetail.SetAccessTypesL( accessTypes ); + devDetail.SetScopeL( MSmlDmDDFObject::EPermanent ); + devDetail.SetDescriptionL( KNSmlDMDevDetailDescription ); + + // DevTyp + MSmlDmDDFObject& devTyp = devDetail.AddChildObjectL(KNSmlDMDevDetailDevTypNodeName ); + SetLeafPropertiesL( devTyp, accessTypes, KNSmlDMDevDetailDevTypDescription ); + // OEM + MSmlDmDDFObject& oem = devDetail.AddChildObjectL(KNSmlDMDevDetailOEMNodeName); + SetLeafPropertiesL( oem, accessTypes, KNSmlDMDevDetailOEMDescription ); + // FwV + MSmlDmDDFObject& fwv = devDetail.AddChildObjectL(KNSmlDMDevDetailFwVNodeName); + SetLeafPropertiesL( fwv, accessTypes, KNSmlDMDevDetailFwVDescription ); + // SwV + MSmlDmDDFObject& swv = devDetail.AddChildObjectL( KNSmlDMDevDetailSwVNodeName ); + SetLeafPropertiesL( swv, accessTypes, KNSmlDMDevDetailSwVDescription ); + // HwV + MSmlDmDDFObject& hwv = devDetail.AddChildObjectL(KNSmlDMDevDetailHwVNodeName ); + SetLeafPropertiesL( hwv, accessTypes, KNSmlDMDevDetailHwVDescription ); + // LrgObj + MSmlDmDDFObject& lrgObj = devDetail.AddChildObjectL(KNSmlDMDevDetailLrgObjNodeName ); + SetLeafPropertiesL( lrgObj, accessTypes, KNSmlDMDevDetailLrgObjDescription ); + lrgObj.SetDFFormatL( MSmlDmDDFObject::EBool ); + // URI + MSmlDmDDFObject& uri = devDetail.AddChildObjectL(KNSmlDMDevDetailURINodeName); + uri.SetAccessTypesL( accessTypes ); + uri.SetScopeL( MSmlDmDDFObject::EPermanent ); + uri.SetDescriptionL( KNSmlDMDevDetailURIDescription ); + // MaxDepth + MSmlDmDDFObject& maxDepth = uri.AddChildObjectL( KNSmlDMDevDetailMaxDepthNodeName); + SetLeafPropertiesL( maxDepth, accessTypes, KNSmlDMDevDetailMaxDepthDescription ); + // MaxTotLen + MSmlDmDDFObject& maxTotLen = uri.AddChildObjectL( KNSmlDMDevDetailMaxTotLenNodeName ); + SetLeafPropertiesL( maxTotLen, accessTypes, KNSmlDMDevDetailMaxTotLenDescription ); + // MaxSegLen + MSmlDmDDFObject& maxSegLen = uri.AddChildObjectL( KNSmlDMDevDetailMaxSegLenNodeName); + SetLeafPropertiesL( maxSegLen, accessTypes, KNSmlDMDevDetailMaxSegLenDescription ); + + _DBG_FILE("CNSmlDmDevDetailAdapter::DDFStructureL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aObject*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::UpdateLeafObjectL(): begin"); + _DBG_FILE("CNSmlDmDevDetailAdapter::UpdateLeafObjectL(): end"); + iDmCallback->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::DeleteObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::DeleteLeafObjectL( ): begin"); + _DBG_FILE("CNSmlDmDevDetailAdapter::DeleteLeafObjectL( ): end"); + iDmCallback->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::FetchLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectL(): begin"); + CBufBase *object = CBufFlat::NewL( 1 ); + CleanupStack::PushL( object ); + CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object ); + + iDmCallback->SetStatusL( aStatusRef, retValue ); + iDmCallback->SetResultsL( aResultsRef, *object, aType); + CleanupStack::PopAndDestroy(); //object + + _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectL(): end"); + } + + +// ----------------------------------------------------------------------------- +// CSmlDmAdapter::TError CNSmlDmDevDetailAdapter::ChildURIListL() +// ----------------------------------------------------------------------------- + +void CNSmlDmDevDetailAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const CArrayFix& /*aPreviousURISegmentList*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::ChildURIListL(): begin"); + CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + CBufBase *currentURISegmentList = CBufFlat::NewL(64); + CleanupStack::PushL(currentURISegmentList); + + TInt ret = aURI.LocateReverse(KNSmlDMDevDetailSeparator()[0]); + if ( ret == KErrNotFound ) + { + ret = -1; + } + TInt len = aURI.Length() - ( ret + 1 ); + TPtrC8 segment = aURI.Right( len ); + + if ( segment == KNSmlDMDevDetailNodeName ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailDevTypNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailOEMNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailFwVNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSwVNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailHwVNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailLrgObjNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailURINodeName() ); + } + else + if ( segment == KNSmlDMDevDetailURINodeName ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailMaxDepthNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailMaxTotLenNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevDetailMaxSegLenNodeName() ); + } + else + { + retValue = CSmlDmAdapter::EError; + } + + iDmCallback->SetStatusL(aStatusRef,retValue); + iDmCallback->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); + CleanupStack::PopAndDestroy(); //currentURISegmentList; + _DBG_FILE("CNSmlDmDevDetailAdapter::ChildURIListL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::AddNodeObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::AddNodeObjectL(): begin"); + _DBG_FILE("CNSmlDmDevDetailAdapter::AddNodeObjectL(): end"); + iDmCallback->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::UpdateLeafObjectL(const TDesC8& aURI, +// const TDesC8& aLUID, RWriteStream*& aStream, const TDesC8& aType, +// const TInt aStatusRef) +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef, +// const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL(): begin"); + + CBufBase *object = CBufFlat::NewL( 1 ); + CleanupStack::PushL( object ); + CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object ); + + TInt objSizeInBytes = object->Size(); + TBuf8 stringObjSizeInBytes; + stringObjSizeInBytes.Num( objSizeInBytes ); + object->Reset(); + object->InsertL( 0, stringObjSizeInBytes ); + + iDmCallback->SetStatusL( aStatusRef, retValue ); + iDmCallback->SetResultsL( aResultsRef, *object, aType); + CleanupStack::PopAndDestroy(); //object + + + _DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::ExecuteCommandL( const TDesC8& aURI, +// const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, +// TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::ExecuteCommandL( const TDesC8& aURI, +// const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType, +// const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: end"); + } +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::CopyCommandL( const TDesC8& aTargetURI, +// const TDesC8& aSourceURI, const TDesC8& aSourceLUID, const TDesC8& aType, +// const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): end"); + } + +// ---------------------------------------- +// CNSmlDmDevDetailAdapter::StartAtomicL() +// ---------------------------------------- +void CNSmlDmDevDetailAdapter::StartAtomicL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): end"); + } + +// ----------------------------------------- +// CNSmlDmDevDetailAdapter::CommitAtomicL() +// ----------------------------------------- +void CNSmlDmDevDetailAdapter::CommitAtomicL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): end"); + } + +// ------------------------------------------- +// CNSmlDmDevDetailAdapter::RollbackAtomicL() +// ------------------------------------------- +void CNSmlDmDevDetailAdapter::RollbackAtomicL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): end"); + } + +// ------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::StreamingSupport( TInt& aItemSize ) +// ------------------------------------------------------------- +TBool CNSmlDmDevDetailAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): end"); + return EFalse; + } + +// -------------------------------------------- +// CNSmlDmDevDetailAdapter::StreamCommittedL() +// -------------------------------------------- +void CNSmlDmDevDetailAdapter::StreamCommittedL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): end"); + } + +// ---------------------------------------------------- +// CNSmlDmDevDetailAdapter::CompleteOutstandingCmdsL() +// ---------------------------------------------------- +void CNSmlDmDevDetailAdapter::CompleteOutstandingCmdsL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): end"); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- + +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KNSmlDMDevDetailAdapterImplUid, + CNSmlDmDevDetailAdapter::NewL) + }; + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevDetailAdapter: begin"); + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevDetailAdapter: end"); + return ImplementationTable; + } + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/src/nsmldmdevdetailadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/src/nsmldmdevdetailadapter.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of dm adapters +* This is part of omadmextensions. +* +*/ + + +CHARACTER_SET UTF8 + +/* +* ============================================================================ +* Name : 101f6de9.rss +* Part of : SyncMl +* Origin : SyncML Phase 2 +* Created : 06.03.2003 +* Implementation notes: +* +* Version : 0.1 +* $Revision: 2 $, $Modtime: 10.05.05 11:04 $ by $Author: Kollasep $ +* --------------------------------------------------------------------------- +* Version history: +* Template version: 1.02, 21.6.2000 by maparnan +* +* +* ============================================================================ +*/ + + + +#include +#include + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F6DE9; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F6DEF; // DM devdetail implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/src/nsmldmdevdetailutils_ARM.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/src/nsmldmdevdetailutils_ARM.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM DevDetail Adapter Source Code, ARM implementation +* +*/ + + + + +// INCLUDES +#include +#include "nsmldmdevdetailadapter.h" +#include "nsmldebug.h" + +#if defined (_ENABLE_MULTIROFS_SUPPORT) +#include +#else +// CONSTANTS +_LIT8( KNSmlSwVersionSeparator, " " ); +#endif + +// --------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::GetDevDetailDataL( ) +// Fetches device specific data using EInfo interface. +// --------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::GetDevDetailDataL( + CBufBase& aObject, + TNSmlDevDetailData aElement ) const + { + _DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): begin (MARM)"); + + aObject.Reset(); + + switch( aElement ) + { + case ESwVersion: + { + // buffers for data fetched from sysutil +#if defined (_ENABLE_MULTIROFS_SUPPORT) + + TBuf16 temp; + TBuf8 temp8; + temp.Zero(); + temp8.Zero(); + SysVersionInfo::TVersionInfoType what = SysVersionInfo::EFWVersion; + TInt error = SysVersionInfo::GetVersionInfo(what,temp); + + User::LeaveIfError(error); + + //Ascii copy which is required + temp8.Copy(temp); + aObject.InsertL(0,temp8); + //Unicode copy if required + //aObject.InsertL(0,temp.Ptr(),temp.Length()); +#else + HBufC* verBuf = HBufC::NewLC( KSysUtilVersionTextLength ); + HBufC8* verBuf8 = HBufC8::NewLC( KSysUtilVersionTextLength ); + + TPtr ver = verBuf->Des(); + TPtr8 ver8 = verBuf8->Des(); + // fetch software version (sw.txt) from sysutil + SysUtil::GetSWVersion( ver ); + ver8.Copy( ver ); + + // parse sw fields and append to aObject + TChar separator('\n'); + TInt pos = ver8.Locate( separator ); + + if ( pos == KErrNotFound ) + { + User::Leave( KErrNotFound ); + } + + // insert version (1st field) and separator to beginning + aObject.InsertL( 0, ver8.Mid( 0, pos ) ); + aObject.InsertL( 0, KNSmlSwVersionSeparator ); + + // locate type designator (3rd field) + ver8 = ver8.Mid( pos + 1 ); + pos = ver8.Locate( separator ); + ver8 = ver8.Mid( pos + 1 ); + pos = ver8.Locate( separator ); + + if ( pos == KErrNotFound ) + { + // type designator (the rest of the string, since there was no \n found) + aObject.InsertL( 0, ver8 ); + } + else + { + // type designator to beginning + aObject.InsertL( 0, ver8.Mid( 0, pos ) ); + } + + // fetch variant (lang.txt) from sysutil + ver.Zero(); + SysUtil::GetLangVersion( ver ); + ver8.Copy( ver ); + + // insert separator and variant to the end + aObject.InsertL( aObject.Size(), KNSmlSwVersionSeparator ); + aObject.InsertL( aObject.Size(), ver8 ); + + CleanupStack::PopAndDestroy( verBuf8 ); + CleanupStack::PopAndDestroy( verBuf ); +#endif //_ENABLE_MULTIROFS_SUPPORT + break; + } + case EHwVersion: + { + break; + } + default: + User::Panic( KNSmlDevDetailPanic, KErrArgument ); + break; + } + + _DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): end (MARM)"); + } + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devdetail/src/nsmldmdevdetailutils_WINSCW.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devdetail/src/nsmldmdevdetailutils_WINSCW.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM DevDetail Adapter Source Code, WINSCW implementation +* +*/ + + + + +// INCLUDES +#include "nsmldmdevdetailadapter.h" +#include "nsmldebug.h" + +// CONSTANTS +_LIT( KNSmlDevDetailSwVFile, "z:\\Resource\\DevMan\\DevDetail_SwV.txt" ); +_LIT( KNSmlDevDetailHwVFile, "z:\\Resource\\DevMan\\DevDetail_HwV.txt" ); + +const TInt KNSmlDevDetailMaxDataSize = 2048; + +// --------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::GetDevDetailDataL( ) +// --------------------------------------------------------------------------- +void CNSmlDmDevDetailAdapter::GetDevDetailDataL( + CBufBase& aObject, + TNSmlDevDetailData aElement ) const + { + _DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): begin (WINSCW)"); + + // Select file according to aElement + HBufC* name = NULL; + + switch( aElement ) + { + case ESwVersion: + name = KNSmlDevDetailSwVFile().AllocLC(); + break; + case EHwVersion: + name = KNSmlDevDetailHwVFile().AllocLC(); + break; + default: + User::Panic( KNSmlDevDetailPanic, KErrArgument ); + } + + // open file server session + RFs fileSession; + User::LeaveIfError( fileSession.Connect() ); + CleanupClosePushL( fileSession ); + + // open file + RFile file; + TInt err = file.Open( fileSession, *name, EFileRead|EFileShareReadersOnly ); + + // if opening file succeeded, read the contents of the file + if ( err == KErrNone ) + { + CleanupClosePushL( file ); + + // read only if data size is not too large + TInt fileSize = 0; + User::LeaveIfError( file.Size( fileSize ) ); + if ( fileSize <= KNSmlDevDetailMaxDataSize ) + { + // read data + HBufC8* data = HBufC8::NewLC( fileSize ); + TPtr8 dataPtr = data->Des(); + file.Read( dataPtr, fileSize ); + + // insert data to result buffer + aObject.Reset(); + aObject.InsertL( 0, *data ); + + CleanupStack::PopAndDestroy( data ); + } + + CleanupStack::PopAndDestroy( &file ); + } + + CleanupStack::PopAndDestroy( &fileSession ); + CleanupStack::PopAndDestroy( name ); + + _DBG_FILE("CNSmlDmDevDetailAdapter::GetDevDetailDataL(): end (WINSCW)"); + } + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devinfo/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devinfo/bld/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build info file for DevInfo adapter +* +*/ + + + + +PRJ_MMPFILES +./nsmldmdevinfoadapter.mmp + + + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devinfo/bld/nsmldmdevinfoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devinfo/bld/nsmldmdevinfoadapter.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of dm adapters +* This is part of omadmextensions. +* +*/ + + + + + +#include "defaultcaps.hrh" +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET nsmldmdevinfoadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F6DE8 +VENDORID VID_DEFAULT + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom +SOURCEPATH ../src + +USERINCLUDE ../inc ../../inc +USERINCLUDE ../../devdetail/inc +SOURCE nsmldmdevinfoadapter.cpp + +START RESOURCE nsmldmdevinfoadapter.rss +LANGUAGE_IDS +END + + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY nsmldebug.lib +LIBRARY nsmlagentcommon.lib +LIBRARY featmgr.lib + +SMPSAFE diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devinfo/inc/nsmldmdevinfoadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devinfo/inc/nsmldmdevinfoadapter.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM DevInfo Adapter +* +*/ + + + + + + +#ifndef __NSMLDMDEVINFOADAPTER_H__ +#define __NSMLDMDEVINFOADAPTER_H__ + +// INCLUDES +#include +#include +#include "nsmldmconstants.h" + +// MACROS + +// the DDF version must be changed if any changes in DDF structure +// ( built in DDFStructureL() function ) +_LIT8( KNSmlDMDevInfoDDFVersion, "1.0" ); + +_LIT8( KNSmlDMDevInfoTextPlain, "text/plain" ); +_LIT8( KNSmlDMDevInfoNodeName, "DevInfo" ); +_LIT8( KNSmlDMDevInfoDescription, "The interior object holds all DevInfo objects" ); + +_LIT8( KNSmlDMDevInfoManNodeName, "Man" ); +_LIT8( KNSmlDMDevInfoManDescription, "The name of the device manufacturer" ); + +_LIT8( KNSmlDMDevInfoModNodeName, "Mod" ); +_LIT8( KNSmlDMDevInfoModDescription, "The name of the device model" ); + +_LIT8( KNSmlDMDevInfoDevIdNodeName, "DevId" ); +_LIT8( KNSmlDMDevInfoDevIdDescription, "The unique device identifier" ); + +_LIT8( KNSmlDMDevInfoLangNodeName, "Lang" ); +_LIT8( KNSmlDMDevInfoLangDescription, "The current language setting of the device" ); + +_LIT8( KNSmlDMDevInfoDmVNodeName, "DmV" ); +_LIT8( KNSmlDMDevInfoDmVDescription, "The current DM client revision of the device" ); + +_LIT8( KNSmlDMDevInfoExtNodeName, "Ext" ); +_LIT8( KNSmlDMDevInfoExtDescription, "The extendable DevInfo branch" ); + +_LIT8( KNSmlDMDevInfoModDDFNodeName, "ModDDF" ); +_LIT8( KNSmlDMDevInfoModDDFDescription, "The checksum counted from DDF" ); + +_LIT8( KNSmlDMDevInfoModDevDetNodeName, "ModDevDet" ); +_LIT8( KNSmlDMDevInfoModDevDetDescription, "The checksum counted from DevDetail values" ); + +_LIT8( KNSmlDmDDFChangeUri, "DDFCHANGE" ); + +_LIT8( KNSmlDMDevInfoSeparator, "/" ); + +_LIT8( KNSmlDMEnglish, "en" ); +_LIT8( KNSmlDMFrench, "fr" ); +_LIT8( KNSmlDMGerman, "de" ); +_LIT8( KNSmlDMSpanish, "es" ); +_LIT8( KNSmlDMItalian, "it" ); +_LIT8( KNSmlDMSwedish, "sv" ); +_LIT8( KNSmlDMDanish, "da" ); +_LIT8( KNSmlDMNorwegian, "no" ); +_LIT8( KNSmlDMFinnish, "fi" ); +_LIT8( KNSmlDMPortuguese, "pt" ); +_LIT8( KNSmlDMTurkish, "tr" ); +_LIT8( KNSmlDMIcelandic, "is" ); +_LIT8( KNSmlDMRussian, "ru" ); +_LIT8( KNSmlDMHungarian, "hu" ); +_LIT8( KNSmlDMDutch, "nl" ); +_LIT8( KNSmlDMCzech, "cs" ); +_LIT8( KNSmlDMSlovak, "sk" ); +_LIT8( KNSmlDMPolish, "pl" ); +_LIT8( KNSmlDMSlovenian, "sl" ); +_LIT8( KNSmlDMChinese, "ch" ); +_LIT8( KNSmlDMJapanese, "ja" ); +_LIT8( KNSmlDMThai, "th" ); +_LIT8( KNSmlDMAfrikaans, "af" ); +_LIT8( KNSmlDMAlbanian, "sq" ); +_LIT8( KNSmlDMAmharic, "am" ); +_LIT8( KNSmlDMArabic, "ar" ); +_LIT8( KNSmlDMArmenian, "hy" ); +_LIT8( KNSmlDMTagalog, "tl" ); +_LIT8( KNSmlDMBelarussian, "be" ); +_LIT8( KNSmlDMBengali, "bn" ); +_LIT8( KNSmlDMBulgarian, "bg" ); +_LIT8( KNSmlDMBurmese, "my" ); +_LIT8( KNSmlDMCatalan, "ca" ); +_LIT8( KNSmlDMCroatian, "hr" ); +_LIT8( KNSmlDMEstonian, "et" ); +_LIT8( KNSmlDMFarsi, "fo" ); +_LIT8( KNSmlDMScotsGaelic, "gl" ); +_LIT8( KNSmlDMGeorgian, "ka" ); +_LIT8( KNSmlDMGreek, "el" ); +_LIT8( KNSmlDMGujarati, "gu" ); +_LIT8( KNSmlDMHebrew, "he" ); +_LIT8( KNSmlDMHindi, "hi" ); +_LIT8( KNSmlDMIndonesian, "id" ); +_LIT8( KNSmlDMIrish, "ga" ); +_LIT8( KNSmlDMKannada, "kn" ); +_LIT8( KNSmlDMKazakh, "kk" ); +_LIT8( KNSmlDMKorean, "ko" ); +_LIT8( KNSmlDMLao, "lo" ); +_LIT8( KNSmlDMLatvian, "lv" ); +_LIT8( KNSmlDMLithuanian, "lt" ); +_LIT8( KNSmlDMMacedonian, "mk" ); +_LIT8( KNSmlDMMalay, "ms" ); +_LIT8( KNSmlDMMalayalam, "ml" ); +_LIT8( KNSmlDMMarathi, "mr" ); +_LIT8( KNSmlDMMoldavian, "mo" ); +_LIT8( KNSmlDMMongolian, "mn" ); +_LIT8( KNSmlDMPunjabi, "pa" ); +_LIT8( KNSmlDMRomanian, "ro" ); +_LIT8( KNSmlDMSerbian, "sr" ); +_LIT8( KNSmlDMSinhalese, "si" ); +_LIT8( KNSmlDMSomali, "so" ); +_LIT8( KNSmlDMSwahili, "sw" ); +_LIT8( KNSmlDMTamil, "ta" ); +_LIT8( KNSmlDMTelugu, "te" ); +_LIT8( KNSmlDMTibetan, "bo" ); +_LIT8( KNSmlDMTigrinya, "ti" ); +_LIT8( KNSmlDMTurkmen, "tk" ); +_LIT8( KNSmlDMUkrainian, "uk" ); +_LIT8( KNSmlDMUrdu, "ur" ); +_LIT8( KNSmlDMVietnamese, "vi" ); +_LIT8( KNSmlDMWelsh, "cy" ); +_LIT8( KNSmlDMZulu, "zu" ); + + +// CLASS DECLARATION +class CNSmlDmDevInfoAdapter : public CSmlDmAdapter + { +public: // constructors and destructor + static CNSmlDmDevInfoAdapter* NewL(MSmlDmCallback* aDmCallback ); + static CNSmlDmDevInfoAdapter* NewLC(MSmlDmCallback* aDmCallback ); + + virtual ~CNSmlDmDevInfoAdapter(); + +private: ///new functions + + void SetLeafPropertiesL( MSmlDmDDFObject& aObject, + const TSmlDmAccessTypes& aAccessTypes, + const TDesC8& aDescription ) const; + CNSmlDmDevInfoAdapter(TAny* aEcomArguments); + CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, CBufBase& aObject ); + +private: // from base classes + // Adapter interface from CSmlDmAdapter + void DDFVersionL( CBufBase& aDDFVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + const TInt aStatusRef ); + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, TInt aStatusRef ); + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef ); + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef ); + + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + const TInt aStatusRef ); + + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + const TInt aStatusRef ); + + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + + +private: + MSmlDmCallback* iDmCallback; + }; + +#endif // __NSMLDMDEVINFOADAPTER_H__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devinfo/src/nsmldmdevinfoadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devinfo/src/nsmldmdevinfoadapter.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,770 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM DevInfo Adapter +* +*/ + + + + + +//INCLUDE FILES +#include // For TImplementationProxy definition +#include "nsmldmimpluids.h" +#include + +#include "nsmldmdevinfoadapter.h" +#include "nsmldebug.h" +#include "nsmlphoneinfo.h" +#include "nsmlunicodeconverter.h" +#include "nsmlconstants.h" +#include "nsmldmconst.h" +#include "nsmldmdevdetailadapter.h" + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewL( ) +// ----------------------------------------------------------------------------- +CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewL(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::NewL(): begin"); + CNSmlDmDevInfoAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop(); + _DBG_FILE("CNSmlDmDevInfoAdapter::NewL(): end"); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewLC( ) +// ----------------------------------------------------------------------------- +CNSmlDmDevInfoAdapter* CNSmlDmDevInfoAdapter::NewLC(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::NewLC(): begin"); + CNSmlDmDevInfoAdapter* self = new (ELeave) CNSmlDmDevInfoAdapter(aDmCallback); + CleanupStack::PushL(self); + self->iDmCallback = aDmCallback; + FeatureManager::InitializeLibL(); + _DBG_FILE("CNSmlDmDevInfoAdapter::NewLC(): end"); + return self; + } + + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter() +// ----------------------------------------------------------------------------- +CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter(): begin"); + FeatureManager::UnInitializeLib(); + _DBG_FILE("CNSmlDmDevInfoAdapter::~CNSmlDmDevInfoAdapter(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter() +// ----------------------------------------------------------------------------- + +CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(aEcomArguments): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::CNSmlDmDevInfoAdapter(aEcomArguments): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::SetLeafPropertiesL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject, + const TSmlDmAccessTypes& aAccessTypes, + const TDesC8& aDescription ) const + { + aObject.SetAccessTypesL( aAccessTypes ); + aObject.SetScopeL( MSmlDmDDFObject::EPermanent ); + aObject.SetDFFormatL( MSmlDmDDFObject::EChr ); + aObject.AddDFTypeMimeTypeL( KNSmlDMDevInfoTextPlain ); + aObject.SetDescriptionL( aDescription ); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::DDFVersionL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::DDFVersionL(TDes& aDDFVersion): begin"); + aDDFVersion.InsertL(0,KNSmlDMDevInfoDDFVersion); + _DBG_FILE("CNSmlDmDevInfoAdapter::DDFVersionL(TDes& aDDFVersion): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::DDFStructureL() +// +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::DDFStructureL(): begin"); + + TSmlDmAccessTypes accessTypes; + accessTypes.SetGet(); + // DevInfo + MSmlDmDDFObject& devInfo = aDDF.AddChildObjectL( KNSmlDMDevInfoNodeName ); + devInfo.SetAccessTypesL( accessTypes ); + devInfo.SetScopeL( MSmlDmDDFObject::EPermanent ); + devInfo.SetDescriptionL( KNSmlDMDevInfoDescription ); + // Man + MSmlDmDDFObject& man = devInfo.AddChildObjectL(KNSmlDMDevInfoManNodeName); + SetLeafPropertiesL( man, accessTypes, KNSmlDMDevInfoManDescription ); + // Mod + MSmlDmDDFObject& mod = devInfo.AddChildObjectL(KNSmlDMDevInfoModNodeName ); + SetLeafPropertiesL( mod, accessTypes, KNSmlDMDevInfoModDescription ); + // DevId + MSmlDmDDFObject& devid = devInfo.AddChildObjectL( KNSmlDMDevInfoDevIdNodeName); + SetLeafPropertiesL( devid, accessTypes, KNSmlDMDevInfoDevIdDescription ); + // Lang + MSmlDmDDFObject& lang = devInfo.AddChildObjectL(KNSmlDMDevInfoLangNodeName ); + SetLeafPropertiesL( lang, accessTypes, KNSmlDMDevInfoLangDescription ); + // DmV + MSmlDmDDFObject& dmv = devInfo.AddChildObjectL(KNSmlDMDevInfoDmVNodeName); + SetLeafPropertiesL( dmv, accessTypes, KNSmlDMDevInfoDmVDescription ); + // Ext + MSmlDmDDFObject& ext = devInfo.AddChildObjectL(KNSmlDMDevInfoExtNodeName ); + ext.SetAccessTypesL( accessTypes ); + ext.SetScopeL( MSmlDmDDFObject::EPermanent ); + ext.SetDescriptionL( KNSmlDMDevInfoExtDescription ); + // ModDDF + MSmlDmDDFObject& modDDF = ext.AddChildObjectL( KNSmlDMDevInfoModDDFNodeName); + SetLeafPropertiesL( modDDF, accessTypes, KNSmlDMDevInfoModDDFDescription ); + // ModDevDet + MSmlDmDDFObject& modDevDet = ext.AddChildObjectL(KNSmlDMDevInfoModDevDetNodeName ); + SetLeafPropertiesL( modDevDet, accessTypes, KNSmlDMDevInfoModDevDetDescription ); + _DBG_FILE("CNSmlDmDevInfoAdapter::DDFStructureL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aObject*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): end"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::DeleteObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::DeleteLeafObjectL( ): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::DeleteLeafObjectL( ): end"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, +// const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectL(): begin"); + + CBufBase *object = CBufFlat::NewL( 1 ); + CleanupStack::PushL( object ); + + CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object ); + + iDmCallback->SetStatusL( aStatusRef, retValue ); + iDmCallback->SetResultsL( aResultsRef, *object, aType ); + CleanupStack::PopAndDestroy(); //object + _DBG_FILE("CNSmlDmDevInfoAdapt+er::FetchLeafObjectL(): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::ChildURIListL( const TDesC& aURI, +// const TDesC& aParentLUID, const CArrayFix& aPreviousURISegmentList, +// const TInt aResultsRef, const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& /*aParentLUID*/, + const CArrayFix& /*aPreviousURISegmentList*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::ChildURIListL(): begin"); + CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + CBufBase* currentURISegmentList = CBufFlat::NewL( 1 ); + CleanupStack::PushL( currentURISegmentList ); + TInt ret = aURI.LocateReverse(KNSmlDMDevInfoSeparator()[0]); + if ( ret == KErrNotFound ) + { + ret = -1; + } + TInt len = aURI.Length() - ( ret + 1 ); + TPtrC8 segment = aURI.Right( len ); + + if ( segment == KNSmlDMDevInfoNodeName ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoManNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoDevIdNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoLangNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoDmVNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoExtNodeName() ); + } + else + if ( segment == KNSmlDMDevInfoExtNodeName ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModDDFNodeName() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoSeparator() ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMDevInfoModDevDetNodeName() ); + } + else + { + retValue = CSmlDmAdapter::EError; + } + iDmCallback->SetStatusL( aStatusRef, retValue ); + iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + CleanupStack::PopAndDestroy(); //currentURISegmentList + _DBG_FILE("CNSmlDmDevInfoAdapter::ChildURIListL(): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::AddNodeObjectL( const TDesC8& aURI, +// const TDesC8& aParentLUID, const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::AddNodeObjectL(): begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmDevInfoAdapter::AddNodeObjectL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::UpdateLeafObjectL(): stream: end"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + + _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL(): begin"); + + CBufBase *object = CBufFlat::NewL( 1 ); + CleanupStack::PushL( object ); + CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object ); + + TInt objSizeInBytes = object->Size(); + TBuf8<2> stringObjSizeInBytes; + stringObjSizeInBytes.Num( objSizeInBytes ); + object->Reset(); + object->InsertL( 0, stringObjSizeInBytes ); + + iDmCallback->SetStatusL( aStatusRef, retValue ); + iDmCallback->SetResultsL( aResultsRef, *object, aType ); + CleanupStack::PopAndDestroy(); //object + _DBG_FILE("CNSmlDmDevInfoAdapter::FetchLeafObjectSizeL(): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& aURI, +// const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& aURI, +// const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType, +// TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmDevInfoAdapter::ExecuteCommandL(): stream: end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevInfoAdapter::CopyCommandL( const TDesC8& aTargetURI, const TDesC8& +// aSourceURI, const TDesC8& aSourceLUID, const TDesC8& /*aType*/, TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmDevInfoAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& + /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmDevInfoAdapter::CopyCommandL(): end"); + } + +// -------------------------------------- +// CNSmlDmDevInfoAdapter::StartAtomicL() +// -------------------------------------- +void CNSmlDmDevInfoAdapter::StartAtomicL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::StartAtomicL(): end"); + } + +// --------------------------------------- +// CNSmlDmDevInfoAdapter::CommitAtomicL() +// --------------------------------------- +void CNSmlDmDevInfoAdapter::CommitAtomicL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::CommitAtomicL(): end"); + } + +// ----------------------------------------- +// CNSmlDmDevInfoAdapter::RollbackAtomicL() +// ----------------------------------------- +void CNSmlDmDevInfoAdapter::RollbackAtomicL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::RollbackAtomicL(): end"); + } + +// ----------------------------------------------------------- +// CNSmlDmDevInfoAdapter::StreamingSupport( TInt& aItemSize ) +// ----------------------------------------------------------- +TBool CNSmlDmDevInfoAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::StreamingSupport(): end"); + return EFalse; + } + +// ------------------------------------------ +// CNSmlDmDevInfoAdapter::StreamCommittedL() +// ------------------------------------------ +void CNSmlDmDevInfoAdapter::StreamCommittedL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::StreamCommittedL(): end"); + } + +// -------------------------------------------------- +// CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL() +// -------------------------------------------------- +void CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL() + { + _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): begin"); + _DBG_FILE("CNSmlDmDevInfoAdapter::CompleteOutstandingCmdsL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::FetchLeafObjectL() +// ----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlDmDevInfoAdapter::FetchLeafObjectL( const TDesC8& aURI, + CBufBase& aObject ) + { + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): begin"); + CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + TInt ret = aURI.LocateReverse(KNSmlDMDevInfoSeparator()[0]); + if ( ret == KErrNotFound ) + { + retValue = CSmlDmAdapter::EError; + } + else + { + TInt len = aURI.Length() - (ret + 1); + TPtrC8 segment = aURI.Right( len ); + if ( segment == KNSmlDMDevInfoManNodeName || + segment == KNSmlDMDevInfoModNodeName || + segment == KNSmlDMDevInfoDevIdNodeName ) + { + CNSmlPhoneInfo* phoneInfo = CNSmlPhoneInfo::NewLC(); + HBufC* phonedata = HBufC::NewLC( 50 ); + TPtr phonedataPtr = phonedata->Des(); + if ( segment == KNSmlDMDevInfoManNodeName ) + { + phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneManufacturer, phonedataPtr ); + } + if ( segment == KNSmlDMDevInfoModNodeName ) + { + phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneModelId, phonedataPtr ); + } + if ( segment == KNSmlDMDevInfoDevIdNodeName ) + { + phoneInfo->PhoneDataL( CNSmlPhoneInfo::EPhoneSerialNumber, phonedataPtr ); + } + HBufC8* phonedataInUTF8 = NULL; + NSmlUnicodeConverter::HBufC8InUTF8LC( *phonedata, phonedataInUTF8 ); + aObject.InsertL( 0, *phonedataInUTF8 ); + CleanupStack::PopAndDestroy( 3 ); //phonedataInUTF8, phonedata, phoneInfo + } + else + if ( segment == KNSmlDMDevInfoLangNodeName ) + { + TLanguage language = User::Language(); + TBuf8<2> langCode; + switch ( language ) + { + case ELangEnglish: + case ELangAmerican: + case ELangAustralian: + case ELangNewZealand: + case ELangCanadianEnglish: + case ELangInternationalEnglish: + case ELangSouthAfricanEnglish: + langCode = KNSmlDMEnglish; + break; + case ELangFrench: + case ELangSwissFrench: + case ELangBelgianFrench: + case ELangInternationalFrench: + case ELangCanadianFrench: + langCode = KNSmlDMFrench; + break; + case ELangGerman: + case ELangSwissGerman: + case ELangAustrian: + langCode = KNSmlDMGerman; + break; + case ELangSpanish: + case ELangInternationalSpanish: + case ELangLatinAmericanSpanish: + langCode = KNSmlDMSpanish; + break; + case ELangItalian: + case ELangSwissItalian: + langCode = KNSmlDMItalian; + break; + case ELangSwedish: + case ELangFinlandSwedish: + langCode = KNSmlDMSwedish; + break; + case ELangDanish: + langCode = KNSmlDMDanish; + break; + case ELangNorwegian: + case ELangNorwegianNynorsk: + langCode = KNSmlDMNorwegian; + break; + case ELangFinnish: + langCode = KNSmlDMFinnish; + break; + case ELangPortuguese: + case ELangBrazilianPortuguese: + langCode = KNSmlDMPortuguese; + break; + case ELangTurkish: + case ELangCyprusTurkish: + langCode = KNSmlDMTurkish; + break; + case ELangIcelandic: + langCode = KNSmlDMIcelandic; + break; + case ELangRussian: + langCode = KNSmlDMRussian; + break; + case ELangHungarian: + langCode = KNSmlDMHungarian; + break; + case ELangDutch: + case ELangBelgianFlemish: + langCode = KNSmlDMDutch; + break; + case ELangCzech: + langCode = KNSmlDMCzech; + break; + case ELangSlovak: + langCode = KNSmlDMSlovak; + break; + case ELangPolish: + langCode = KNSmlDMPolish; + break; + case ELangSlovenian: + langCode = KNSmlDMSlovenian; + break; + case ELangTaiwanChinese: + case ELangHongKongChinese: + case ELangPrcChinese: + langCode = KNSmlDMChinese; + break; + case ELangJapanese: + langCode = KNSmlDMJapanese; + break; + case ELangThai: + langCode = KNSmlDMThai; + break; + case ELangAfrikaans: + langCode = KNSmlDMAfrikaans; + break; + case ELangAlbanian: + langCode = KNSmlDMAlbanian; + break; + case ELangAmharic: + langCode = KNSmlDMAmharic; + break; + case ELangArabic: + langCode = KNSmlDMArabic; + break; + case ELangArmenian: + langCode = KNSmlDMArmenian; + break; + case ELangTagalog: + langCode = KNSmlDMTagalog; + break; + case ELangBelarussian: + langCode = KNSmlDMBelarussian; + break; + case ELangBengali: + langCode = KNSmlDMBengali; + break; + case ELangBulgarian: + langCode = KNSmlDMBulgarian; + break; + case ELangBurmese: + langCode = KNSmlDMBurmese; + break; + case ELangCatalan: + langCode = KNSmlDMCatalan; + break; + case ELangCroatian: + langCode = KNSmlDMCroatian; + break; + case ELangEstonian: + langCode = KNSmlDMEstonian; + break; + case ELangFarsi: + langCode = KNSmlDMFarsi; + break; + case ELangScotsGaelic: + langCode = KNSmlDMScotsGaelic; + break; + case ELangGeorgian: + langCode = KNSmlDMGeorgian; + break; + case ELangGreek: + case ELangCyprusGreek: + langCode = KNSmlDMGreek; + break; + case ELangGujarati: + langCode = KNSmlDMGujarati; + break; + case ELangHebrew: + langCode = KNSmlDMHebrew; + break; + case ELangHindi: + langCode = KNSmlDMHindi; + break; + case ELangIndonesian: + langCode = KNSmlDMIndonesian; + break; + case ELangIrish: + langCode = KNSmlDMIrish; + break; + case ELangKannada: + langCode = KNSmlDMKannada; + break; + case ELangKazakh: + langCode = KNSmlDMKazakh; + break; + case ELangKorean: + langCode = KNSmlDMKorean; + break; + case ELangLao: + langCode = KNSmlDMLao; + break; + case ELangLatvian: + langCode = KNSmlDMLatvian; + break; + case ELangLithuanian: + langCode = KNSmlDMLithuanian; + break; + case ELangMacedonian: + langCode = KNSmlDMMacedonian; + break; + case ELangMalay: + langCode = KNSmlDMMalay; + break; + case ELangMalayalam: + langCode = KNSmlDMMalayalam; + break; + case ELangMarathi: + langCode = KNSmlDMMarathi; + break; + case ELangMoldavian: + langCode = KNSmlDMMoldavian; + break; + case ELangMongolian: + langCode = KNSmlDMMongolian; + break; + case ELangPunjabi: + langCode = KNSmlDMPunjabi; + break; + case ELangRomanian: + langCode = KNSmlDMRomanian; + break; + case ELangSerbian: + langCode = KNSmlDMSerbian; + break; + case ELangSinhalese: + langCode = KNSmlDMSinhalese; + break; + case ELangSomali: + langCode = KNSmlDMSomali; + break; + case ELangSwahili: + langCode = KNSmlDMSwahili; + break; + case ELangTamil: + langCode = KNSmlDMTamil; + break; + case ELangTelugu: + langCode = KNSmlDMTelugu; + break; + case ELangTibetan: + langCode = KNSmlDMTibetan; + break; + case ELangTigrinya: + langCode = KNSmlDMTigrinya; + break; + case ELangTurkmen: + langCode = KNSmlDMTurkmen; + break; + case ELangUkrainian: + langCode = KNSmlDMUkrainian; + break; + case ELangUrdu: + langCode = KNSmlDMUrdu; + break; + case ELangVietnamese: + langCode = KNSmlDMVietnamese; + break; + case ELangWelsh: + langCode = KNSmlDMWelsh; + break; + case ELangZulu: + langCode = KNSmlDMZulu; + break; + default: + langCode = KNSmlDMEnglish; + } + aObject.InsertL( 0, langCode ); + } + else + if ( segment == KNSmlDMDevInfoDmVNodeName ) + { + if(!FeatureManager::FeatureSupported( KFeatureIdSyncMlDm112 )) + aObject.InsertL( 0, KNSmlDMDmV12 ); + else + aObject.InsertL( 0, KNSmlDMDmV ); + } + else + if ( segment == KNSmlDMDevInfoModDDFNodeName ) + { + + } + else + if ( segment == KNSmlDMDevInfoModDevDetNodeName ) + { + TUid implUID; + implUID.iUid = KNSmlDMDevDetailAdapterImplUid; + + TAny* nPtr = NULL; + MSmlDmCallback& aDmNull = reinterpret_cast(nPtr); + CNSmlDmDevDetailAdapter* devDetAdapter = + reinterpret_cast(CSmlDmAdapter::NewL( implUID, aDmNull ) ); + CleanupStack::PushL(devDetAdapter); + TInt checkSumDevDet = devDetAdapter->DevDetailValueCrcL(); + TBuf8<16> stringCheckSumDevDet; + stringCheckSumDevDet.Num( checkSumDevDet ); + aObject.InsertL( 0, stringCheckSumDevDet ); + CleanupStack::PopAndDestroy(); // devDetAdapter + } + else + { + retValue = CSmlDmAdapter::EError; + } + } + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): end"); + return retValue; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KNSmlDMDevInfoAdapterImplUid, CNSmlDmDevInfoAdapter::NewL) + }; + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevInfoAdapter: begin"); + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmDevInfoAdapter: end"); + return ImplementationTable; + } + +// End of file + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/devinfo/src/nsmldmdevinfoadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/devinfo/src/nsmldmdevinfoadapter.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of dm adapters +* This is part of omadmextensions. +* +*/ + + +CHARACTER_SET UTF8 + +/* +* ============================================================================ +* Name : 101f6de8.rss +* Part of : SyncMl +* Origin : SyncML Phase 2 +* Created : 06.03.2003 +* Implementation notes: +* +* Version : 0.1 +* $Revision: 2 $, $Modtime: 10.05.05 11:06 $ by $Author: Kollasep $ +* --------------------------------------------------------------------------- +* Version history: +* Template version: 1.02, 21.6.2000 by maparnan +* +* +* ============================================================================ +*/ + + + +#include +#include + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F6DE8; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F6DEE; // DM devinfo implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/globalwlansettings/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/globalwlansettings/group/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build info file for globalwlanadapter +* +*/ + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +./globalwlanadapter.mmp + + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/globalwlansettings/group/globalwlanadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/globalwlansettings/group/globalwlanadapter.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project globalwlanadapter +* +*/ + + + +#include +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET globalwlanadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x1315DBD +VENDORID VID_DEFAULT + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +USERINCLUDE ../inc + +START RESOURCE ../src/globalwlanadapter.rss +END + +SOURCEPATH ../src +SOURCE globalwlanadapter.cpp + +LIBRARY charconv.lib commdb.lib efsrv.lib ecom.lib euser.lib +LIBRARY nsmldebug.lib sysutil.lib +LIBRARY inetprotutil.lib +LIBRARY centralrepository.lib bafl.lib estor.lib edbms.lib FeatMgr.lib diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/globalwlansettings/inc/globalwlanadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/globalwlansettings/inc/globalwlanadapter.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,392 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Global WLAN settings adapter +* +*/ + + + +#ifndef __GLOBALWLANADAPTER_H__ +#define __GLOBALWLANADAPTER_H__ + + +// ----------------------------------------------------------------------------------------------- +// Includes +// ----------------------------------------------------------------------------------------------- +#include +#include +#include +#include +#include + + +// ----------------------------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------------------------- + +// The nodes of the DDF structure +_LIT8( KNSmlWLan, "WLAN" ); +_LIT8( KNSmlWLanInternetConnectivityTest, "InternetConnectivityTest" ); +_LIT8( KNSmlWLanUseDefaultSettings, "UseDefaultSettings" ); +_LIT8( KNSmlWLanLongRetryLimit, "LongRetryLimit" ); +_LIT8( KNSmlWLanShortRetryLimit, "ShortRetryLimit" ); +_LIT8( KNSmlWLanRTSThreshold, "RTSThreshold" ); +_LIT8( KNSmlWLanTXPowerLevel, "TXPowerLevel" ); +_LIT8( KNSmlWLanPowerSaving, "PowerSaving" ); +_LIT8( KNSmlWLanBackgroundScanInterval, "BackgroundScanInterval" ); +_LIT8( KNSmlWLanScanRate, "ScanRate" ); +_LIT8( KNSmlWLanRCPITrigger, "RCPITrigger" ); +_LIT8( KNSmlWLanMinActiveChannelTime, "MinActiveChannelTime" ); +_LIT8( KNSmlWLanMaxActiveChannelTime, "MaxActiveChannelTime" ); +_LIT8( KNSmlWLanMaxTxMSDULifeTime, "MaxTxMSDULifeTime" ); +_LIT8( KNSmlWLanScanExpirationTimer, "ScanExpirationTimer" ); +_LIT8( KNSmlWLanUnloadDriverTimer, "UnloadDriverTimer" ); +_LIT8( KNSmlWLanRoamTimer, "RoamTimer" ); +_LIT8( KNSmlWLanRCPIDifference, "RCPIDifference" ); +_LIT8( KNSmlWLanConnRegainTimer, "ConnRegainTimer" ); +_LIT8( KNSmlWLanMaxTriesToFindNw, "MaxTriesToFindNw" ); +_LIT8( KNSmlWLanDelayBetweenFindNw, "DelayBetweenFindNw" ); +_LIT8( KNSmlWLanAllowRadioMeasurements, "AllowRadioMeasurements" ); +_LIT8( KNSmlWLanMinPassiveChannelTime, "MinPassiveChannelTime" ); +_LIT8( KNSmlWLanMaxPassiveChannelTime, "MaxPassiveChannelTime" ); +_LIT8( KNSmlWLanMaxApFailureCount, "MaxApFailureCount" ); +_LIT8( KNSmlWLanLongBeaconFindCount, "LongBeaconFindCount" ); +_LIT8( KNSmlWLanQosNullFrameInterval, "QosNullFrameInterval" ); +_LIT8( KNSmlWLanQosNullFrameTimeout, "QosNullFrameTimeout" ); +_LIT8( KNSmlWLanMTU, "MTU" ); +_LIT8( KNSmlWLanNode, "InternetConnectivityTest/UseDefaultSettings/LongRetryLimit/ShortRetryLimit/RTSThreshold/TXPowerLevel/PowerSaving/BackgroundScanInterval/ScanRate/RCPITrigger/MinActiveChannelTime/MaxActiveChannelTime/MaxTxMSDULifeTime/ScanExpirationTimer/UnloadDriverTimer/RoamTimer/RCPIDifference/ConnRegainTimer/MaxTriesToFindNw/DelayBetweenFindNw/AllowRadioMeasurements/MinPassiveChannelTime/MaxApFailureCount/LongBeaconFindCount/QosNullFrameInterval/QosNullFrameTimeout" ); + +//DDF version number +_LIT8( KNSmGlobalWlanAdapterDDFversion, "1.0"); +_LIT8( KNSmlMimeType, "text/plain" ); +_LIT8( KNSmlEmpty, ""); + + +const TInt KUriSegListLength = 128; +// Maximum input size for nodes +const TInt KInputMaxLength = 50; +// Max lenght of the DDF type +const TInt KTypeMaxLength = 40; +// Repository id +const TUid KCRUidWlanDeviceSettingsRegistryId = {0x101f8e44}; + + +// WLan engine central repository parameters +const TUint32 KWlanScanRate = 0x00000004; +const TUint32 KWlanRcpiTrigger = 0x00000005; +const TUint32 KWlanMinActiveChannelTime = 0x00000006; +const TUint32 KWlanMaxActiveChannelTime = 0x00000007; +const TUint32 KWlanMaxTxMSDULifeTime = 0x00000008; +const TUint32 KWlanScanExpirationTimer = 0x00000009; +const TUint32 KWlanUnloadDriverTimer = 0x0000000A; +const TUint32 KWlanRoamTimer = 0x0000000B; +const TUint32 KWlanRcpiDifference = 0x0000000C; +const TUint32 KWlanConnRegainTimer = 0x0000000D; +const TUint32 KWlanMaxTriesToFindNw = 0x0000000E; +const TUint32 KWlanDelayBetweenFindNw = 0x0000000F; +const TUint32 KWlanMTU = 0x00000010; +const TUint32 KWlanMinPassiveChannelTime = 0x00000011; +const TUint32 KWlanMaxPassiveChannelTime = 0x00000012; +const TUint32 KWlanMaxApFailureCount = 0x00000013; +const TUint32 KWlanLongBeaconFindCount = 0x00000014; +const TUint32 KWlanQosNullFrameInterval = 0x00000015; +const TUint32 KWlanQosNullFrameTimeout = 0x00000016; + +// ----------------------------------------------------------------------------------------------- +// Structures +// ----------------------------------------------------------------------------------------------- + +// Structure for storing the settings to be stored into cenrep and commsdb +struct TGlobalSettings +{ + TUint32 internetConnectivityTest; + TBool internetConnectivityTestPresent; + TBool useDefaultSettings; + TBool useDefaultSettingsPresent; + TUint32 longRetryLimit; + TBool longRetryLimitPresent; + TUint32 shortRetryLimit; + TBool shortRetryLimitPresent; + TUint32 RTSThreshold; + TBool RTSThresholdPresent; + TUint32 TXPowerLevel; + TBool TXPowerLevelPresent; + TBool powerSaving; + TBool powerSavingPresent; + TUint32 backgroundScanInterval; + TBool backgroundScanIntervalPresent; + TUint32 scanRate; + TBool scanRatePresent; + TUint32 RCPITrigger; + TBool RCPITriggerPresent; + TUint32 minActiveChannelTime; + TBool minActiveChannelTimePresent; + TUint32 maxActiveChannelTime; + TBool maxActiveChannelTimePresent; + TUint32 maxTxMSDULifeTime; + TBool maxTxMSDULifeTimePresent; + TUint32 scanExpirationTimer; + TBool scanExpirationTimerPresent; + TUint32 unloadDriverTimer; + TBool unloadDriverTimerPresent; + TUint32 roamTimer; + TBool roamTimerPresent; + TUint32 RCPIDifference; + TBool RCPIDifferencePresent; + TUint32 connRegainTimer; + TBool connRegainTimerPresent; + TUint32 maxTriesToFindNw; + TBool maxTriesToFindNwPresent; + TUint32 delayBetweenFindNw; + TBool delayBetweenFindNwPresent; + TBool allowRadioMeasurements; + TBool allowRadioMeasurementsPresent; + TUint32 minPassiveChannelTime; + TBool minPassiveChannelTimePresent; + TUint32 maxPassiveChannelTime; + TBool maxPassiveChannelTimePresent; + TUint32 maxApFailureCount; + TBool maxApFailureCountPresent; + TUint32 longBeaconFindCount; + TBool longBeaconFindCountPresent; + TUint32 qosNullFrameInterval; + TBool qosNullFrameIntervalPresent; + TUint32 qosNullFrameTimeout; + TBool qosNullFrameTimeoutPresent; + TUint32 MTU; + TBool MTUPresent; +}; + +// Structure for storing the result and status variables from every addition/fetch command +struct TStatusResult +{ + TInt internetConnectivityTestStatus; + TInt internetConnectivityTestResult; + TInt useDefaultSettingsStatus; + TInt useDefaultSettingsResult; + TInt longRetryLimitStatus; + TInt longRetryLimitResult; + TInt shortRetryLimitStatus; + TInt shortRetryLimitResult; + TInt RTSThresholdStatus; + TInt RTSThresholdResult; + TInt TXPowerLevelStatus; + TInt TXPowerLevelResult; + TInt powerSavingStatus; + TInt powerSavingResult; + TInt backgroundScanIntervalStatus; + TInt backgroundScanIntervalResult; + TInt scanRateStatus; + TInt scanRateResult; + TInt RCPITriggerStatus; + TInt RCPITriggerResult; + TInt minActiveChannelTimeStatus; + TInt minActiveChannelTimeResult; + TInt maxActiveChannelTimeStatus; + TInt maxActiveChannelTimeResult; + TInt maxTxMSDULifeTimeStatus; + TInt maxTxMSDULifeTimeResult; + TInt scanExpirationTimerStatus; + TInt scanExpirationTimerResult; + TInt unloadDriverTimerStatus; + TInt unloadDriverTimerResult; + TInt roamTimerStatus; + TInt roamTimerResult; + TInt RCPIDifferenceStatus; + TInt RCPIDifferenceResult; + TInt connRegainTimerStatus; + TInt connRegainTimerResult; + TInt maxTriesToFindNwStatus; + TInt maxTriesToFindNwResult; + TInt delayBetweenFindNwStatus; + TInt delayBetweenFindNwResult; + TInt allowRadioMeasurementsStatus; + TInt allowRadioMeasurementsResult; + TInt minPassiveChannelTimeStatus; + TInt minPassiveChannelTimeResult; + TInt maxPassiveChannelTimeStatus; + TInt maxPassiveChannelTimeResult; + TInt maxApFailureCountStatus; + TInt maxApFailureCountResult; + TInt longBeaconFindCountStatus; + TInt longBeaconFindCountResult; + TInt qosNullFrameIntervalStatus; + TInt qosNullFrameIntervalResult; + TInt qosNullFrameTimeoutStatus; + TInt qosNullFrameTimeoutResult; + TInt MTUStatus; + TInt MTUResult; +}; + + +// ----------------------------------------------------------------------------------------------- +// Enumerations +// ----------------------------------------------------------------------------------------------- + + +// ------------------------------------------------------------------------------------------------ +// CGlobalWLanAdapter +// ------------------------------------------------------------------------------------------------ +class CGlobalWLANAdapter : public CSmlDmAdapter + { +public: + static CGlobalWLANAdapter* NewL( MSmlDmCallback* aDmCallback ); + static CGlobalWLANAdapter* NewLC( MSmlDmCallback* aDmCallback ); + void ConstructL( ); + virtual ~CGlobalWLANAdapter(); + +// Adapter interface + void DDFVersionL( CBufBase& aDDFVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + void AddLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ); + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ); + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ); + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ); + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef ); + void CopyCommandL( const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, + TInt aStatusRef ); + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + + +private: + CGlobalWLANAdapter(TAny* aEcomArguments); + void FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ); + void ExecuteBufferL( TBool aFinal = EFalse ); + + /** + * Stores the central repository parameters + * + * @return + */ + void StoreCenRepParamsL(); + + /** + * Stores the CommsDB parameters + * + * @return + */ + void StoreCommsDBParamsL(); + + /** + * Reads the central repository parameters + * + * @return + */ + void ReadCenRepParamsL(); + + /** + * Returns the central repository parameters and updates statuses + * + * @return + */ + void UpdateStatusAndResultL( TInt aResult, TInt aStatus, TDesC8& aValue, TDesC8& aType, TInt aStoreErr ); + + /** + * Reads the CommsDB parameters + * + * @return + */ + void ReadCommsDBParamsL(); + + /** + * Gets the number of uri segments in the URI + * + * @since S60 ?S60_version + * @param aUri The URI whose segments are counted + * @return The amount of segments + */ + TInt NumOfUriSegs( const TDesC8& aUri ); + + /** + * Gets the last uri segment + * + * @since S60 ?S60_version + * @param aUri The URI whose segments are counted + * @return The last segment + */ + TPtrC8 GetLastUriSeg(const TDesC8& aURI); + + TInt DesToInt( const TDesC8& aLuid ); + void InitMemberVariables(); + + MSmlDmCallback* iCallBack; + + // Variable to store the received parameters + TGlobalSettings* iWriteSettings; + // Variable to store whick parameters are to be fetched + TGlobalSettings* iReadSettings; + // Status and result information related to fetches and additions + TStatusResult* iReadStatuses; + TStatusResult* iWriteStatuses; + + TBool iWlanSupported; + + }; + +#endif __GLOBALWLANADAPTER_H__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/globalwlansettings/rom/globalwlanadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/globalwlansettings/rom/globalwlanadapter.iby Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for project GlobalWLANAdapter +* +*/ + + + +REM SyncML Device Management internet adapter + +#include + +#ifndef __GLOBALWLANADAPTER_IBY__ +#define __GLOBALWLANADAPTER_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected + +#ifdef __SYNCML_DM_WLAN +ECOM_PLUGIN(globalwlanadapter.dll,globalwlanadapter.rsc) +#endif // __SYNCML_DM_WLAN + +#endif //__SYNCML_DM + +#endif //__GLOBALWLANADAPTER_IBY__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/globalwlansettings/src/globalwlanadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/globalwlansettings/src/globalwlanadapter.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,2998 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Global WLAN settings Adapter +* +*/ + + + +#include "globalwlanadapter.h" +#include "nsmldebug.h" +#include // For TImplementationProxy definition +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + + +//------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------ +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x1315DBE, CGlobalWLANAdapter::NewL) + }; + +//------------------------------------------------------------------------------ +// TImplementationProxy* ImplementationGroupProxy() +//------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CGlobalWLANAdapter: begin"); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + _DBG_FILE("ImplementationGroupProxy() for CGlobalWLANAdapter: end"); + return ImplementationTable; + } + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::NewL( ) +//----------------------------------------------------------------------------- +CGlobalWLANAdapter* CGlobalWLANAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CGlobalWLANAdapter::NewL(): begin"); + + CGlobalWLANAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop( self ); + + _DBG_FILE("CGlobalWLANAdapter::NewL(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::NewLC( ) +//----------------------------------------------------------------------------- +CGlobalWLANAdapter* CGlobalWLANAdapter::NewLC( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CGlobalWLANAdapter::NewLC(): begin"); + + CGlobalWLANAdapter* self = new(ELeave) CGlobalWLANAdapter(aDmCallback); + CleanupStack::PushL( self ); + + self->iCallBack = aDmCallback; + _DBG_FILE("CGlobalWLANAdapter::NewLC(): call constructL"); + self->ConstructL( ); + + _DBG_FILE("CGlobalWLANAdapter::NewLC(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// void CGlobalWLAdapter::ConstructL( ) +// Second phase constructor +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::ConstructL( ) + { + _DBG_FILE("CGlobalWLANAdapter::ConstructL(): begin"); + + // checks if Wlan feature is supported + FeatureManager::InitializeLibL(); + iWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + FeatureManager::UnInitializeLib(); + + iWriteSettings = new(ELeave) TGlobalSettings; + iReadSettings = new(ELeave) TGlobalSettings; + iReadStatuses = new(ELeave) TStatusResult; + iWriteStatuses = new(ELeave) TStatusResult; + + // set "present" variables to false, since symbian inits thems as true + InitMemberVariables(); + + _DBG_FILE("CGlobalWLANAdapter::ConstructL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter::CGlobalWLANAdapter( ) +// Constructor +//----------------------------------------------------------------------------- +CGlobalWLANAdapter::CGlobalWLANAdapter( TAny* aEcomArguments ) + : CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CGlobalWLANAdapter::CGlobalWLANAdapter(): begin"); + _DBG_FILE("CGlobalWLANAdapter::CGlobalWLANAdapter(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter::~CGlobalWLANAdapter( ) +// Destructor +//----------------------------------------------------------------------------- +CGlobalWLANAdapter::~CGlobalWLANAdapter( ) + { + _DBG_FILE("CGlobalWLANAdapter::~CGlobalWLANAdapter(): begin"); + + delete iWriteSettings; + delete iReadSettings; + delete iReadStatuses; + delete iWriteStatuses; + + _DBG_FILE("CGlobalWLANAdapter::~CGlobalWLANAdapter(): end"); + } + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::DDFVersionL( CBufBase& aDDFVersion ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + _DBG_FILE("CGlobalWLANAdapter::DDFVersionL(): begin"); + + aDDFVersion.InsertL( 0, KNSmGlobalWlanAdapterDDFversion ); + + _DBG_FILE("CGlobalWLANAdapter::DDFVersionL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CGlobalWLANAdapter::DDFStructureL(): begin"); + if( !iWlanSupported ) + { + _DBG_FILE("CGlobalWLANAdapter::DDFStructureL(): WLAN not supported."); + return; + } +// +// Set Get, add and replace as acceptable operations +// + + TSmlDmAccessTypes accessTypesGetAddReplace; + accessTypesGetAddReplace.SetAdd(); + accessTypesGetAddReplace.SetGet(); + accessTypesGetAddReplace.SetReplace(); + + //WLAN + MSmlDmDDFObject& rootWLan = aDDF.AddChildObjectL( KNSmlWLan ); + FillNodeInfoL( rootWLan, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlEmpty ); + + //WLAN/InternetConnectivityTest + MSmlDmDDFObject& internetConnectivityTest = rootWLan.AddChildObjectL( KNSmlWLanInternetConnectivityTest ); + FillNodeInfoL( internetConnectivityTest, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/UseDefaultSettings + MSmlDmDDFObject& useDefaultSettings = rootWLan.AddChildObjectL( KNSmlWLanUseDefaultSettings ); + FillNodeInfoL( useDefaultSettings, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN/LongRetryLimit + MSmlDmDDFObject& longRetryLimit = rootWLan.AddChildObjectL( KNSmlWLanLongRetryLimit ); + FillNodeInfoL( longRetryLimit, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/ShortRetryLimit + MSmlDmDDFObject& shortRetryLimit = rootWLan.AddChildObjectL( KNSmlWLanShortRetryLimit ); + FillNodeInfoL( shortRetryLimit, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + + //WLAN/RTSThreshold + MSmlDmDDFObject& RTSThreshold = rootWLan.AddChildObjectL( KNSmlWLanRTSThreshold ); + FillNodeInfoL( RTSThreshold, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/TXPowerLevel + MSmlDmDDFObject& TXPowerLevel = rootWLan.AddChildObjectL( KNSmlWLanTXPowerLevel ); + FillNodeInfoL( TXPowerLevel, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/PowerSaving + MSmlDmDDFObject& powerSaving = rootWLan.AddChildObjectL( KNSmlWLanPowerSaving ); + FillNodeInfoL( powerSaving, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN/BackgroundScanInterval + MSmlDmDDFObject& backgroundScanInterval = rootWLan.AddChildObjectL( KNSmlWLanBackgroundScanInterval ); + FillNodeInfoL( backgroundScanInterval, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/ScanRate + MSmlDmDDFObject& scanRate = rootWLan.AddChildObjectL( KNSmlWLanScanRate ); + FillNodeInfoL( scanRate, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/RCPITrigger + MSmlDmDDFObject& RCPITrigger = rootWLan.AddChildObjectL( KNSmlWLanRCPITrigger ); + FillNodeInfoL( RCPITrigger, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MinActiveChannelTime + MSmlDmDDFObject& minActiveChannelTime = rootWLan.AddChildObjectL( KNSmlWLanMinActiveChannelTime ); + FillNodeInfoL( minActiveChannelTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxActiveChannelTime + MSmlDmDDFObject& maxActiveChannelTime = rootWLan.AddChildObjectL( KNSmlWLanMaxActiveChannelTime ); + FillNodeInfoL( maxActiveChannelTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxTxMSDULifeTime + MSmlDmDDFObject& maxTxMSDULifeTime = rootWLan.AddChildObjectL( KNSmlWLanMaxTxMSDULifeTime ); + FillNodeInfoL( maxTxMSDULifeTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/ScanExpirationTimer + MSmlDmDDFObject& scanExpirationTimer = rootWLan.AddChildObjectL( KNSmlWLanScanExpirationTimer ); + FillNodeInfoL( scanExpirationTimer, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/UnloadDriverTimer + MSmlDmDDFObject& unloadDriverTimer = rootWLan.AddChildObjectL( KNSmlWLanUnloadDriverTimer ); + FillNodeInfoL( unloadDriverTimer, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/RoamTimer + MSmlDmDDFObject& roamTimer = rootWLan.AddChildObjectL( KNSmlWLanRoamTimer ); + FillNodeInfoL( roamTimer, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/KNSmlWLanRCPIDifference + MSmlDmDDFObject& RCPIDifference = rootWLan.AddChildObjectL( KNSmlWLanRCPIDifference ); + FillNodeInfoL( RCPIDifference, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/ConnRegainTimer + MSmlDmDDFObject& connRegainTimer = rootWLan.AddChildObjectL( KNSmlWLanConnRegainTimer ); + FillNodeInfoL( connRegainTimer, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxTriesToFindNw + MSmlDmDDFObject& maxTriesToFindNw = rootWLan.AddChildObjectL( KNSmlWLanMaxTriesToFindNw ); + FillNodeInfoL( maxTriesToFindNw, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/DelayBetweenFindNw + MSmlDmDDFObject& delayBetweenFindNw = rootWLan.AddChildObjectL( KNSmlWLanDelayBetweenFindNw ); + FillNodeInfoL( delayBetweenFindNw, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/AllowRadioMeasurements + MSmlDmDDFObject& allowRadioMeasurements = rootWLan.AddChildObjectL( KNSmlWLanAllowRadioMeasurements ); + FillNodeInfoL( allowRadioMeasurements, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN/MinPassiveChannelTime + MSmlDmDDFObject& minPassiveChannelTime = rootWLan.AddChildObjectL( KNSmlWLanMinPassiveChannelTime ); + FillNodeInfoL( minPassiveChannelTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxPassiveChannelTime + MSmlDmDDFObject& maxPassiveChannelTime = rootWLan.AddChildObjectL( KNSmlWLanMaxPassiveChannelTime ); + FillNodeInfoL( maxPassiveChannelTime, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MaxApFailureCount + MSmlDmDDFObject& maxApFailureCount = rootWLan.AddChildObjectL( KNSmlWLanMaxApFailureCount ); + FillNodeInfoL( maxApFailureCount, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/LongBeaconFindCount + MSmlDmDDFObject& longBeaconFindCount = rootWLan.AddChildObjectL( KNSmlWLanLongBeaconFindCount ); + FillNodeInfoL( longBeaconFindCount, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/QosNullFrameInterval + MSmlDmDDFObject& qosNullFrameInterval = rootWLan.AddChildObjectL( KNSmlWLanQosNullFrameInterval ); + FillNodeInfoL( qosNullFrameInterval, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/QosNullFrameTimeout + MSmlDmDDFObject& qosNullFrameTimeout = rootWLan.AddChildObjectL( KNSmlWLanQosNullFrameTimeout ); + FillNodeInfoL( qosNullFrameTimeout, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + //WLAN/MTU + MSmlDmDDFObject& MTU = rootWLan.AddChildObjectL( KNSmlWLanMTU ); + FillNodeInfoL( MTU, + accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlEmpty ); + + + _DBG_FILE("CGlobalWLANAdapter::DDFStructureL(): end"); + } + + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::AddLeafObjectL( const TDesC& aURI,const +// TDesC& aParentLUID, const TDesC8& aObject, const TDesC& aType, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::AddLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL - <%S> <%S>"), &aURI, &aParentLUID ); + + // Get the last uri segment and the number of uri items in the input + TInt uriSegs = NumOfUriSegs( aURI ); + TInt err(KErrNone); + TPtrC8 lastUriSeg = GetLastUriSeg( aURI ); + + //************************************************************************** + // Check which leaf is in question + //************************************************************************** + if( aURI.Match( _L8("WLAN/*" ) ) != KErrNotFound && uriSegs==2 ) + { + // ***************************************************************** + if( lastUriSeg.Match( KNSmlWLanInternetConnectivityTest ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->internetConnectivityTest = err; + iWriteSettings->internetConnectivityTestPresent = ETrue; + iWriteStatuses->internetConnectivityTestStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanUseDefaultSettings ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + if( aObject.MatchF( _L8("True")) != KErrNotFound || + aObject.MatchF( _L8("true")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->useDefaultSettings = ETrue; + iWriteSettings->useDefaultSettingsPresent = ETrue; + iWriteStatuses->useDefaultSettingsStatus = aStatusRef; + } + else if ( aObject.MatchF( _L8("False")) != KErrNotFound || + aObject.MatchF( _L8("false")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->useDefaultSettings = EFalse; + iWriteSettings->useDefaultSettingsPresent = ETrue; + iWriteStatuses->useDefaultSettingsStatus = aStatusRef; + } + else + { + err = KErrArgument; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanLongRetryLimit ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->longRetryLimit = err; + iWriteSettings->longRetryLimitPresent = ETrue; + iWriteStatuses->longRetryLimitStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanShortRetryLimit ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->shortRetryLimit = err; + iWriteSettings->shortRetryLimitPresent = ETrue; + iWriteStatuses->shortRetryLimitStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRTSThreshold ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->RTSThreshold = err; + iWriteSettings->RTSThresholdPresent = ETrue; + iWriteStatuses->RTSThresholdStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanTXPowerLevel ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + //store the parameter + err = DesToInt( aObject ); + if ( err >= 0) + { + iWriteSettings->TXPowerLevel = err; + iWriteSettings->TXPowerLevelPresent = ETrue; + iWriteStatuses->TXPowerLevelStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanPowerSaving ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + if( aObject.MatchF( _L8("True")) != KErrNotFound || + aObject.MatchF( _L8("true")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->powerSaving = ETrue; + iWriteSettings->powerSavingPresent = ETrue; + iWriteStatuses->powerSavingStatus = aStatusRef; + } + else if ( aObject.MatchF( _L8("False")) != KErrNotFound || + aObject.MatchF( _L8("false")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->powerSaving = EFalse; + iWriteSettings->powerSavingPresent = ETrue; + iWriteStatuses->powerSavingStatus = aStatusRef; + } + else + { + err = KErrArgument; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanBackgroundScanInterval ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->backgroundScanInterval = err; + iWriteSettings->backgroundScanIntervalPresent = ETrue; + iWriteStatuses->backgroundScanIntervalStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanScanRate ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->scanRate = err; + iWriteSettings->scanRatePresent = ETrue; + iWriteStatuses->scanRateStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRCPITrigger ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0) + { + iWriteSettings->RCPITrigger = err; + iWriteSettings->RCPITriggerPresent = ETrue; + iWriteStatuses->RCPITriggerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMinActiveChannelTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->minActiveChannelTime = err; + iWriteSettings->minActiveChannelTimePresent = ETrue; + iWriteStatuses->minActiveChannelTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxActiveChannelTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0) + { + iWriteSettings->maxActiveChannelTime = err; + iWriteSettings->maxActiveChannelTimePresent = ETrue; + iWriteStatuses->maxActiveChannelTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxTxMSDULifeTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->maxTxMSDULifeTime = err; + iWriteSettings->maxTxMSDULifeTimePresent = ETrue; + iWriteStatuses->maxTxMSDULifeTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanScanExpirationTimer ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->scanExpirationTimer = err; + iWriteSettings->scanExpirationTimerPresent = ETrue; + iWriteStatuses->scanExpirationTimerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanUnloadDriverTimer ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->unloadDriverTimer = err; + iWriteSettings->unloadDriverTimerPresent = ETrue; + iWriteStatuses->unloadDriverTimerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRoamTimer ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->roamTimer = err; + iWriteSettings->roamTimerPresent = ETrue; + iWriteStatuses->roamTimerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRCPIDifference ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->RCPIDifference = err; + iWriteSettings->RCPIDifferencePresent = ETrue; + iWriteStatuses->RCPIDifferenceStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanConnRegainTimer ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->connRegainTimer = err; + iWriteSettings->connRegainTimerPresent = ETrue; + iWriteStatuses->connRegainTimerStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxTriesToFindNw ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0) + { + iWriteSettings->maxTriesToFindNw = err; + iWriteSettings->maxTriesToFindNwPresent = ETrue; + iWriteStatuses->maxTriesToFindNwStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanDelayBetweenFindNw ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->delayBetweenFindNw = err; + iWriteSettings->delayBetweenFindNwPresent = ETrue; + iWriteStatuses->delayBetweenFindNwStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanAllowRadioMeasurements ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + if( aObject.MatchF( _L8("True")) != KErrNotFound || + aObject.MatchF( _L8("true")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->allowRadioMeasurements = ETrue; + iWriteSettings->allowRadioMeasurementsPresent = ETrue; + iWriteStatuses->allowRadioMeasurementsStatus = aStatusRef; + } + else if ( aObject.MatchF( _L8("False")) != KErrNotFound || + aObject.MatchF( _L8("false")) != KErrNotFound ) + { + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + iWriteSettings->allowRadioMeasurements = EFalse; + iWriteSettings->allowRadioMeasurementsPresent = ETrue; + iWriteStatuses->allowRadioMeasurementsStatus = aStatusRef; + } + else + { + err = KErrArgument; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMinPassiveChannelTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->minPassiveChannelTime = err; + iWriteSettings->minPassiveChannelTimePresent = ETrue; + iWriteStatuses->minPassiveChannelTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxPassiveChannelTime ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->maxPassiveChannelTime = err; + iWriteSettings->maxPassiveChannelTimePresent = ETrue; + iWriteStatuses->maxPassiveChannelTimeStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxApFailureCount ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->maxApFailureCount = err; + iWriteSettings->maxApFailureCountPresent = ETrue; + iWriteStatuses->maxApFailureCountStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanLongBeaconFindCount ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->longBeaconFindCount = err; + iWriteSettings->longBeaconFindCountPresent = ETrue; + iWriteStatuses->longBeaconFindCountStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanQosNullFrameInterval ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->qosNullFrameInterval = err; + iWriteSettings->qosNullFrameIntervalPresent = ETrue; + iWriteStatuses->qosNullFrameIntervalStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanQosNullFrameTimeout ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->qosNullFrameTimeout = err; + iWriteSettings->qosNullFrameTimeoutPresent = ETrue; + iWriteStatuses->qosNullFrameTimeoutStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMTU ) != KErrNotFound ) + { + // check whether input is of legal size + if ( aObject.Size() <= KInputMaxLength ) + { + //store the parameter + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddLeafObjectL, add leaf - <%S>"), &aURI ); + err = DesToInt( aObject ); + if ( err >= 0 ) + { + iWriteSettings->MTU = err; + iWriteSettings->MTUPresent = ETrue; + iWriteStatuses->MTUStatus = aStatusRef; + err = KErrNone; + } + } + else + { + err = KErrTooBig; + } + } + // ***************************************************************** + // The given leaf was not found + else + { + err = KErrNotFound; + } + } + else + { + // Something went wrong + _DBG_FILE("CGlobalWLANAdapter::AddLeafObjectL(): Leaf addition failed"); + err = KErrGeneral; + } + + // Update the possible failure to the status, success is updated when the + // actual writing to db is done + switch ( err ) + { + case KErrTooBig: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + break; + + case KErrNotFound: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + break; + + case KErrGeneral: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + break; + + case KErrArgument: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + break; + + case KErrOverflow: + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + break; + } + + _DBG_FILE("CGlobalWLANAdapter::AddLeafObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::UpdateLeafObjectL( const TDesC& aURI, +// const TDesC& aLUID, const TDesC8& aObject, const TDesC& aType, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::UpdateLeafObjectL(): begin"); + DBG_ARGS8(_S8("CGlobalWLANAdapter::UpdateLeafObjectL - <%S> <%S>"), &aURI, &aLUID ); + + AddLeafObjectL( aURI, aLUID, aObject, aType, aStatusRef ); + + _DBG_FILE("CGlobalWLANAdapter::UpdateLeafObjectL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::UpdateLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) +// Not supported +//------------------------------------------------------------------------------ + +void CGlobalWLANAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::UpdateLeafObjectL(): streaming: begin"); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + _DBG_FILE("CGlobalWLANAdapter::UpdateLeafObjectL() streaming: end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::DeleteObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TInt aStatusRef ) +// Not supported +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::DeleteObjectL(): begin"); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + _DBG_FILE("CGlobalWLANAdapter::DeleteObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +// not supported +//----------------------------------------------------------------------------- + +void CGlobalWLANAdapter::FetchLeafObjectSizeL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aType*/, + TInt /*aResultsRef*/, + TInt /*aStatusRef*/ ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectSizeL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectSizeL(): end"); + return; + } + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::FetchLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +// +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /*aType*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): begin"); + DBG_ARGS8(_S8("Fetch aURI - %S - %S"), &aURI, &aLUID); + + // Store the required parameters into the struct. Actual reading will be done in + // when CompleteOutstandingCommands is called + + // Get the last uri segment + TPtrC8 lastUriSeg = GetLastUriSeg( aURI ); + DBG_ARGS8(_S8("Fetch leaf, lasturiseg - %S"), &lastUriSeg); + + //************************************************************************** + // Check which leaf is in question + //************************************************************************** + if( aURI.Match( _L8("WLAN/*" ) ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): WLAN/* found in uri"); + // ***************************************************************** + if( lastUriSeg.Match( KNSmlWLanInternetConnectivityTest ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->internetConnectivityTestPresent = ETrue; + iReadStatuses->internetConnectivityTestResult = aResultsRef; + iReadStatuses->internetConnectivityTestStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanUseDefaultSettings ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->useDefaultSettingsPresent = ETrue; + iReadStatuses->useDefaultSettingsResult = aResultsRef; + iReadStatuses->useDefaultSettingsStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanLongRetryLimit ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->longRetryLimitPresent = ETrue; + iReadStatuses->longRetryLimitResult = aResultsRef; + iReadStatuses->longRetryLimitStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanShortRetryLimit ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->shortRetryLimitPresent = ETrue; + iReadStatuses->shortRetryLimitResult = aResultsRef; + iReadStatuses->shortRetryLimitStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRTSThreshold ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->RTSThresholdPresent = ETrue; + iReadStatuses->RTSThresholdResult = aResultsRef; + iReadStatuses->RTSThresholdStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanTXPowerLevel ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->TXPowerLevelPresent = ETrue; + iReadStatuses->TXPowerLevelResult = aResultsRef; + iReadStatuses->TXPowerLevelStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanPowerSaving ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->powerSavingPresent = ETrue; + iReadStatuses->powerSavingResult = aResultsRef; + iReadStatuses->powerSavingStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanBackgroundScanInterval ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->backgroundScanIntervalPresent = ETrue; + iReadStatuses->backgroundScanIntervalResult = aResultsRef; + iReadStatuses->backgroundScanIntervalStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanScanRate ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->scanRatePresent = ETrue; + iReadStatuses->scanRateResult = aResultsRef; + iReadStatuses->scanRateStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRCPITrigger ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->RCPITriggerPresent = ETrue; + iReadStatuses->RCPITriggerResult = aResultsRef; + iReadStatuses->RCPITriggerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMinActiveChannelTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->minActiveChannelTimePresent = ETrue; + iReadStatuses->minActiveChannelTimeResult = aResultsRef; + iReadStatuses->minActiveChannelTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxActiveChannelTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxActiveChannelTimePresent = ETrue; + iReadStatuses->maxActiveChannelTimeResult = aResultsRef; + iReadStatuses->maxActiveChannelTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxTxMSDULifeTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxTxMSDULifeTimePresent = ETrue; + iReadStatuses->maxTxMSDULifeTimeResult = aResultsRef; + iReadStatuses->maxTxMSDULifeTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanScanExpirationTimer ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->scanExpirationTimerPresent = ETrue; + iReadStatuses->scanExpirationTimerResult = aResultsRef; + iReadStatuses->scanExpirationTimerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanUnloadDriverTimer ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->unloadDriverTimerPresent = ETrue; + iReadStatuses->unloadDriverTimerResult = aResultsRef; + iReadStatuses->unloadDriverTimerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRoamTimer ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->roamTimerPresent = ETrue; + iReadStatuses->roamTimerResult = aResultsRef; + iReadStatuses->roamTimerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanRCPIDifference ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->RCPIDifferencePresent = ETrue; + iReadStatuses->RCPIDifferenceResult = aResultsRef; + iReadStatuses->RCPIDifferenceStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanConnRegainTimer ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->connRegainTimerPresent = ETrue; + iReadStatuses->connRegainTimerResult = aResultsRef; + iReadStatuses->connRegainTimerStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxTriesToFindNw ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxTriesToFindNwPresent = ETrue; + iReadStatuses->maxTriesToFindNwResult = aResultsRef; + iReadStatuses->maxTriesToFindNwStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanDelayBetweenFindNw ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->delayBetweenFindNwPresent = ETrue; + iReadStatuses->delayBetweenFindNwResult = aResultsRef; + iReadStatuses->delayBetweenFindNwStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanAllowRadioMeasurements ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->allowRadioMeasurementsPresent = ETrue; + iReadStatuses->allowRadioMeasurementsResult = aResultsRef; + iReadStatuses->allowRadioMeasurementsStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMinPassiveChannelTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->minPassiveChannelTimePresent = ETrue; + iReadStatuses->minPassiveChannelTimeResult = aResultsRef; + iReadStatuses->minPassiveChannelTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxPassiveChannelTime ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxPassiveChannelTimePresent = ETrue; + iReadStatuses->maxPassiveChannelTimeResult = aResultsRef; + iReadStatuses->maxPassiveChannelTimeStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMaxApFailureCount ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->maxApFailureCountPresent = ETrue; + iReadStatuses->maxApFailureCountResult = aResultsRef; + iReadStatuses->maxApFailureCountStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanLongBeaconFindCount ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->longBeaconFindCountPresent = ETrue; + iReadStatuses->longBeaconFindCountResult = aResultsRef; + iReadStatuses->longBeaconFindCountStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanQosNullFrameInterval ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->qosNullFrameIntervalPresent = ETrue; + iReadStatuses->qosNullFrameIntervalResult = aResultsRef; + iReadStatuses->qosNullFrameIntervalStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanQosNullFrameTimeout ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->qosNullFrameTimeoutPresent = ETrue; + iReadStatuses->qosNullFrameTimeoutResult = aResultsRef; + iReadStatuses->qosNullFrameTimeoutStatus = aStatusRef; + } + + // ***************************************************************** + else if( lastUriSeg.Match( KNSmlWLanMTU ) != KErrNotFound ) + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): leaf"); + iReadSettings->MTUPresent = ETrue; + iReadStatuses->MTUResult = aResultsRef; + iReadStatuses->MTUStatus = aStatusRef; + } + + // ***************************************************************** + // The given leaf was not found + else + { + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): No matchin leaf was found"); + iCallBack->SetStatusL(aStatusRef, ENotFound); + } + } + else + { + // Something went wrong + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): No matchin node was found"); + iCallBack->SetStatusL(aStatusRef, EInvalidObject); + } + + _DBG_FILE("CGlobalWLANAdapter::FetchLeafObjectL(): end"); + + } + + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::ChildURIListL( const TDesC& aURI, +// const TDesC& aLUID, const CArrayFix& aPreviousURISegmentList, +// const TInt aResultsRef, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const CArrayFix& /*aPreviousURISegmentList*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::ChildURIListL(): begin"); + DBG_ARGS8(_S8("globalwlanadapter::ChildUriList - <%S>"), &aURI ); + + CBufBase* currentUriSegmentList = CBufFlat::NewL( KUriSegListLength ); + CleanupStack::PushL( currentUriSegmentList ); + TEntry currentEntry; + TInt uriSegs = NumOfUriSegs( aURI ); + + // Check whether WLAN node in question + if ( aURI.Match(_L8("WLAN" ))!= KErrNotFound && uriSegs == 1 ) + { + _DBG_FILE("CGlobalWLANAdapter::ChildURIListL(): WLAN"); + currentUriSegmentList->InsertL( 0, KNSmlWLanNode ); + iCallBack->SetResultsL( aResultsRef, *currentUriSegmentList, KNullDesC8 ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + _DBG_FILE("CGlobalWLANAdapter::ChildURIListL(): WLAN leafs returned"); + } + + // Some illegal node/leaf in question + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + } + + // delete the list + CleanupStack::PopAndDestroy( currentUriSegmentList ); + _DBG_FILE("CGlobalWLANAdapter::ChildURIListL(): end"); + } + +//----------------------------------------------------------------------------- +// void CGlobalWLANAdapter::AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + + DBG_ARGS8(_S8("CGlobalWLANAdapter::AddNodeObjectL - uri: <%S> to aParentLuid: <%S>"), + &aURI, &aParentLUID ); + + TInt uriSegs = NumOfUriSegs( aURI ); + + // The only node is WLAN, lets check if that is in question + if( aURI.Match( _L8("WLAN" ) ) != KErrNotFound && uriSegs==1 ) + { + // No actions needed, the table is created and filled in the + // Execution function. + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + + _DBG_FILE("CGlobalWLANAdapter::AddNodeObjectL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::ExecuteCommandL +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::ExecuteCommandL(): begin"); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + _DBG_FILE("CGlobalWLANAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::ExecuteCommandL ( .. RWriteStream ..) +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + TInt aStatusref ) + { + _DBG_FILE("CGlobalWLANAdapter::ExecuteCommandL(): begin"); + + iCallBack->SetStatusL( aStatusref, CSmlDmAdapter::EError ); + + _DBG_FILE("CGlobalWLANAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::CopyCommandL +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /* aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CGlobalWLANAdapter::CopyCommandL(): begin"); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + _DBG_FILE("CGlobalWLANAdapter::CopyCommandL(): end"); + } +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::StartAtomicL +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::StartAtomicL() + { + _DBG_FILE("CGlobalWLANAdapter::StartAtomicL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::StartAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::CommitAtomicL +// not supported +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::CommitAtomicL() + { + _DBG_FILE("CGlobalWLANAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::CommitAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::RollbackAtomicL +// returns EError +//------------------------------------------------------------------------------ +void CGlobalWLANAdapter::RollbackAtomicL() + { + _DBG_FILE("CGlobalWLANAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::RollbackAtomicL(): end"); + } + + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::StreamingSupport +// returns ETrue, streaming is supported +//------------------------------------------------------------------------------ + +TBool CGlobalWLANAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + _DBG_FILE("CGlobalWLANAdapter::StreamingSupport(): begin"); + _DBG_FILE("CGlobalWLANAdapter::StreamingSupport(): end"); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CGlobalWLANAdapter::StreamCommittedL +// not used in this adapter +//------------------------------------------------------------------------------ + +void CGlobalWLANAdapter::StreamCommittedL() + { + _DBG_FILE("CGlobalWLANAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CGlobalWLANAdapter::StreamCommittedL(): end"); + } + +//----------------------------------------------------------------------------- +// CGlobalWLANAdapter* CGlobalWLANAdapter::CompleteOutstandingCmdsL( ) +//----------------------------------------------------------------------------- +void CGlobalWLANAdapter::CompleteOutstandingCmdsL( ) + { + _DBG_FILE("CGlobalWLANAdapter::CompleteOutStandingCmdsL(): begin"); + + ExecuteBufferL( ETrue ); + + _DBG_FILE("CGlobalWLANAdapter::CompleteOutStandingCmdsL(): end"); + } + + +// ------------------------------------------------------------------------------------- +// CGlobalWLANAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CGlobalWLANAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) + + { + aNode.SetAccessTypesL(aAccTypes); + aNode.SetOccurenceL(aOccurrence); + aNode.SetScopeL(aScope); + aNode.SetDFFormatL(aFormat); + if(aFormat!=MSmlDmDDFObject::ENode) + { + aNode.AddDFTypeMimeTypeL(KNSmlMimeType); + } + aNode.SetDescriptionL(aDescription); + } + + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::ExecuteBufferL( TBool aFinal ) +// Executes buffered commands +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ExecuteBufferL( TBool /*aFinal*/ ) + { + + _DBG_FILE("CGlobalWLANAdapter::ExecuteBuffer(): begin"); + + // Store the given values into cenrep and commsdb and + // read the required parameters from cenrep and commsdb + TRAPD (err1, StoreCenRepParamsL()); + TRAPD (err2, StoreCommsDBParamsL()); + TRAPD (err3, ReadCenRepParamsL()); + TRAPD (err4, ReadCommsDBParamsL()); + + // Init the member variables after updates + InitMemberVariables(); + + // If some of the operations failed, then leave + User::LeaveIfError( err1 ); + User::LeaveIfError( err2 ); + User::LeaveIfError( err3 ); + User::LeaveIfError( err4 ); + + _DBG_FILE("CGlobalWLANAdapter::ExecuteBuffer(): End"); + } + + +// ------------------------------------------------------------------------------------------------ +// TBool CGlobalWLANAdapter::StoreCenRepParamsL( ) +// Stores the parameters to central repository +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::StoreCenRepParamsL() + { + + _DBG_FILE("CGlobalWLANAdapter::StoreCenRepParams(): begin"); + + CRepository* repository = NULL; + CRepository* conSettRep = NULL; + TInt err = KErrNone; + + + // Write KWlanInternetConnectivityTest + if ( iWriteSettings->internetConnectivityTestPresent ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanInternetConnectivityTest start " ); + // Open the cenrep for internet connectivity settings. This is the only global wlan parameter + // from this cenrep + conSettRep = CRepository::NewL( KCRUidInternetConnectivitySettings ); + + // There is no pointer to the repository, leave + if ( conSettRep == NULL ) + { + User::LeaveIfError( KErrGeneral ); + } + + CleanupStack::PushL(conSettRep); + + err = conSettRep->Set( KIctsTestPermission, static_cast( iWriteSettings->internetConnectivityTest ) ); + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanInternetConnectivityTest set to cenRep " ); + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanInternetConnectivityTest" ); + iCallBack->SetStatusL(iWriteStatuses->internetConnectivityTestStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanInternetConnectivityTest failed " ); + iCallBack->SetStatusL(iWriteStatuses->internetConnectivityTestStatus, CSmlDmAdapter::EError); + } + CleanupStack::PopAndDestroy(conSettRep); + } + + + // The rest of the parameters are stored to Wlan device settings cenRep + repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ); + + // There is no pointer to the repository, leave + if ( repository == NULL ) + { + User::LeaveIfError( KErrGeneral ); + } + + CleanupStack::PushL(repository); + + if ( iWriteSettings->MTUPresent ) + { + err = repository->Set( KWlanMTU, static_cast( iWriteSettings->MTU ) ); + + DBG_ARGS8(_S8("CGlobalWLANAdapter::StoreCenRepParams, MTU status - (%d)"), err ); + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() MTU" ); + iCallBack->SetStatusL(iWriteStatuses->MTUStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() MTU failed " ); + iCallBack->SetStatusL(iWriteStatuses->MTUStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanScanRate + if ( iWriteSettings->scanRatePresent ) + { + err = repository->Set( KWlanScanRate, static_cast( iWriteSettings->scanRate ) ); + + DBG_ARGS8(_S8("CGlobalWLANAdapter::StoreCenRepParams, scanrate status - (%d)"), err ); + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() WlanScanRate" ); + iCallBack->SetStatusL(iWriteStatuses->scanRateStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() WlanScanRate failed " ); + iCallBack->SetStatusL(iWriteStatuses->scanRateStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanRcpiTrigger + if ( iWriteSettings->RCPITriggerPresent ) + { + err = repository->Set( KWlanRcpiTrigger, static_cast( iWriteSettings->RCPITrigger ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRcpiTrigger" ); + iCallBack->SetStatusL(iWriteStatuses->RCPITriggerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRcpiTrigger failed" ); + iCallBack->SetStatusL(iWriteStatuses->RCPITriggerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMinActiveChannelTime + if ( iWriteSettings->minActiveChannelTimePresent ) + { + err = repository->Set( KWlanMinActiveChannelTime, static_cast( iWriteSettings->minActiveChannelTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMinActiveChannelTime" ); + iCallBack->SetStatusL(iWriteStatuses->minActiveChannelTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMinActiveChannelTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->minActiveChannelTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxActiveChannelTime + if ( iWriteSettings->maxActiveChannelTimePresent ) + { + err = repository->Set( KWlanMaxActiveChannelTime, static_cast( iWriteSettings->maxActiveChannelTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxActiveChannelTime" ); + iCallBack->SetStatusL(iWriteStatuses->maxActiveChannelTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxActiveChannelTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->maxActiveChannelTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxTxMSDULifeTime + if ( iWriteSettings->maxTxMSDULifeTimePresent ) + { + err = repository->Set( KWlanMaxTxMSDULifeTime, static_cast( iWriteSettings->maxTxMSDULifeTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanMaxTxMSDULifeTime" ); + iCallBack->SetStatusL(iWriteStatuses->maxTxMSDULifeTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanMaxTxMSDULifeTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->maxTxMSDULifeTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanScanExpirationTimer + if ( iWriteSettings->scanExpirationTimerPresent ) + { + err = repository->Set( KWlanScanExpirationTimer, static_cast( iWriteSettings->scanExpirationTimer ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanScanExpirationTimer" ); + iCallBack->SetStatusL(iWriteStatuses->scanExpirationTimerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanScanExpirationTimer failed" ); + iCallBack->SetStatusL(iWriteStatuses->scanExpirationTimerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanUnloadDriverTimer + if ( iWriteSettings->unloadDriverTimerPresent ) + { + err = repository->Set( KWlanUnloadDriverTimer, static_cast( iWriteSettings->unloadDriverTimer ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanUnloadDriverTimer" ); + iCallBack->SetStatusL(iWriteStatuses->unloadDriverTimerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams()KWlanUnloadDriverTimer failed" ); + iCallBack->SetStatusL(iWriteStatuses->unloadDriverTimerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanRoamTimer + if ( iWriteSettings->roamTimerPresent ) + { + err = repository->Set( KWlanRoamTimer, static_cast( iWriteSettings->roamTimer ) ); + + if( err == KErrNone) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRoamTimer" ); + iCallBack->SetStatusL(iWriteStatuses->roamTimerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRoamTimer failed" ); + iCallBack->SetStatusL(iWriteStatuses->roamTimerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanRcpiDifference + if ( iWriteSettings->RCPIDifferencePresent ) + { + err = repository->Set( KWlanRcpiDifference, static_cast( iWriteSettings->RCPIDifference ) ); + + DBG_ARGS8(_S8("CGlobalWLANAdapter::StoreCenRepParams, rcpidifference status - (%d)"), err ); + if( err == KErrNone) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRcpiDifference" ); + iCallBack->SetStatusL(iWriteStatuses->RCPIDifferenceStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanRcpiDifference failed" ); + iCallBack->SetStatusL(iWriteStatuses->RCPIDifferenceStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanConnRegainTimer + if ( iWriteSettings->connRegainTimerPresent ) + { + err = repository->Set( KWlanConnRegainTimer, static_cast( iWriteSettings->connRegainTimer ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanConnRegainTimer" ); + iCallBack->SetStatusL(iWriteStatuses->connRegainTimerStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanConnRegainTimer failed" ); + iCallBack->SetStatusL(iWriteStatuses->connRegainTimerStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxTriesToFindNw + if ( iWriteSettings->maxTriesToFindNwPresent ) + { + err = repository->Set( KWlanMaxTriesToFindNw, static_cast( iWriteSettings->maxTriesToFindNw ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxTriesToFindNw "); + iCallBack->SetStatusL(iWriteStatuses->maxTriesToFindNwStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxTriesToFindNw failed"); + iCallBack->SetStatusL(iWriteStatuses->maxTriesToFindNwStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanDelayBetweenFindNw + if ( iWriteSettings->delayBetweenFindNwPresent ) + { + err = repository->Set( KWlanDelayBetweenFindNw, static_cast( iWriteSettings->delayBetweenFindNw ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanDelayBetweenFindNw" ); + iCallBack->SetStatusL(iWriteStatuses->delayBetweenFindNwStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanDelayBetweenFindNw failed" ); + iCallBack->SetStatusL(iWriteStatuses->delayBetweenFindNwStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMinPassiveChannelTime + if ( iWriteSettings->minPassiveChannelTimePresent ) + { + err = repository->Set( KWlanMinPassiveChannelTime, static_cast( iWriteSettings->minPassiveChannelTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMinPassiveChannelTime" ); + iCallBack->SetStatusL(iWriteStatuses->minPassiveChannelTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMinPassiveChannelTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->minPassiveChannelTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxPassiveChannelTime + if ( iWriteSettings->maxPassiveChannelTimePresent ) + { + err = repository->Set( KWlanMaxPassiveChannelTime, static_cast( iWriteSettings->maxPassiveChannelTime ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxPassiveChannelTime" ); + iCallBack->SetStatusL(iWriteStatuses->maxPassiveChannelTimeStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxPassiveChannelTime failed" ); + iCallBack->SetStatusL(iWriteStatuses->maxPassiveChannelTimeStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanMaxApFailureCount + if ( iWriteSettings->maxApFailureCountPresent ) + { + err = repository->Set( KWlanMaxApFailureCount, static_cast( iWriteSettings->maxApFailureCount ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxApFailureCount" ); + iCallBack->SetStatusL(iWriteStatuses->maxApFailureCountStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanMaxApFailureCount failed" ); + iCallBack->SetStatusL(iWriteStatuses->maxApFailureCountStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanLongBeaconFindCount + if ( iWriteSettings->longBeaconFindCountPresent ) + { + err = repository->Set( KWlanLongBeaconFindCount, static_cast( iWriteSettings->longBeaconFindCount ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanLongBeaconFindCount" ); + iCallBack->SetStatusL(iWriteStatuses->longBeaconFindCountStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanLongBeaconFindCount failed" ); + iCallBack->SetStatusL(iWriteStatuses->longBeaconFindCountStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanQosNullFrameInterval + if ( iWriteSettings->qosNullFrameIntervalPresent ) + { + err = repository->Set( KWlanQosNullFrameInterval, static_cast( iWriteSettings->qosNullFrameInterval ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanQosNullFrameInterval" ); + iCallBack->SetStatusL(iWriteStatuses->qosNullFrameIntervalStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanQosNullFrameInterval failed" ); + iCallBack->SetStatusL(iWriteStatuses->qosNullFrameIntervalStatus, CSmlDmAdapter::EError); + } + } + + // Write KWlanQosNullFrameTimeout + if ( iWriteSettings->qosNullFrameTimeoutPresent ) + { + err = repository->Set( KWlanQosNullFrameTimeout, static_cast( iWriteSettings->qosNullFrameTimeout ) ); + + if( err == KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanQosNullFrameTimeout" ); + iCallBack->SetStatusL(iWriteStatuses->qosNullFrameTimeoutStatus, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CGlobalWLANAdapter:StoreCenRepParams() KWlanQosNullFrameTimeout failed" ); + iCallBack->SetStatusL(iWriteStatuses->qosNullFrameTimeoutStatus, CSmlDmAdapter::EError); + } + } + + // Cleanup + CleanupStack::PopAndDestroy(repository); + _DBG_FILE("CGlobalWLANAdapter::StoreCenRepParams(): end"); + return; + } + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::StoreCommsDBParams( ) +// Stores the parameters to central repository +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::StoreCommsDBParamsL() + { + + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): begin"); + + CCommsDatabase* db = CCommsDatabase::NewL(); + CleanupStack::PushL(db); + + // User defined WLAN device settings table from Comms database + CCommsDbTableView* usrTable; + + // Open user settings. + usrTable = db->OpenViewMatchingUintLC( TPtrC(WLAN_DEVICE_SETTINGS), + TPtrC(WLAN_DEVICE_SETTINGS_TYPE), + KWlanUserSettings ); + + // if record did not exist, then it is created. + if ( usrTable->GotoFirstRecord() != KErrNone ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): Record creation"); + TUint32 id; + User::LeaveIfError( usrTable->InsertRecord( id ) ); + + usrTable->WriteUintL( TPtrC(WLAN_DEVICE_SETTINGS_TYPE), KWlanUserSettings ); + //usrTable->WriteUintL( TPtrC(WLAN_TABLE_VERSION), KWlanDeviceSettingsTableVersion ); + User::LeaveIfError( usrTable->PutRecordChanges() ); // End and save changes. + } + + // Write CommsDat settings + User::LeaveIfError( usrTable->UpdateRecord() ); // Begin changes. + + // Check which parameters are present in the structure, store them into commsdb and + // update the status to OK/Error accordingly + if ( iWriteSettings->backgroundScanIntervalPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KBgScanInterval"); + TRAPD( err, usrTable->WriteUintL( TPtrC(WLAN_BG_SCAN_INTERVAL), iWriteSettings->backgroundScanInterval )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->backgroundScanIntervalStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->backgroundScanIntervalStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->useDefaultSettingsPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KUseDefaultSettings"); + TRAPD( err, usrTable->WriteBoolL( TPtrC(WLAN_USE_DEFAULT_SETTINGS), iWriteSettings->useDefaultSettings )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->useDefaultSettingsStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->useDefaultSettingsStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->longRetryLimitPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanLongRetry"); + TRAPD( err, usrTable->WriteUintL( TPtrC(WLAN_LONG_RETRY), iWriteSettings->longRetryLimit )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->longRetryLimitStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->longRetryLimitStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->shortRetryLimitPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanShortRetry"); + TRAPD( err, usrTable->WriteUintL( TPtrC(WLAN_SHORT_RETRY), iWriteSettings->shortRetryLimit )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->shortRetryLimitStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->shortRetryLimitStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->RTSThresholdPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanRTSThreshold"); + TRAPD( err, usrTable->WriteUintL( TPtrC(WLAN_RTS_THRESHOLD), iWriteSettings->RTSThreshold )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->RTSThresholdStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->RTSThresholdStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->TXPowerLevelPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanTxPowerLevel"); + TRAPD( err, usrTable->WriteUintL( TPtrC(NU_WLAN_TX_POWER_LEVEL), iWriteSettings->TXPowerLevel )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->TXPowerLevelStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->TXPowerLevelStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->allowRadioMeasurementsPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanAllowRadioMeasurements"); + TRAPD( err, usrTable->WriteBoolL( TPtrC(WLAN_ALLOW_RADIO_MEASUREMENTS), iWriteSettings->allowRadioMeasurements )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->allowRadioMeasurementsStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->allowRadioMeasurementsStatus, CSmlDmAdapter::EError); + } + } + + if ( iWriteSettings->powerSavingPresent ) + { + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): write KWlanPowerSaving"); + TRAPD( err, usrTable->WriteBoolL( TPtrC(WLAN_POWER_MODE), iWriteSettings->powerSaving )); + if ( err == KErrNone) + { + iCallBack->SetStatusL(iWriteStatuses->powerSavingStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iWriteStatuses->powerSavingStatus, CSmlDmAdapter::EError); + } + } + + _DBG_FILE("CGlobalWLANAdapter::StoreCommsDBParams(): end"); + User::LeaveIfError( usrTable->PutRecordChanges() ); // End and save changes. + CleanupStack::PopAndDestroy( usrTable ); + CleanupStack::PopAndDestroy( db ); + return; + + } + + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::ReadCenRepParams( ) +// Reads parameters from central repository +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ReadCenRepParamsL() + { + + _DBG_FILE("CGlobalWLANAdapter::ReadCenRepParams(): begin"); + + TInt err = KErrNone; + CRepository* repository = NULL; + TBuf8 value; + TBuf8 type; + TInt temp = 0; + + // InternetConnectivityTest parameter is in a different cenRep than the other parameters + // Write KWlanScanRate + if ( iReadSettings->internetConnectivityTestPresent ) + { + // This parameter is in the internet connectivity settings cenRep, open the repository + repository = CRepository::NewL( KCRUidInternetConnectivitySettings ); + CleanupStack::PushL(repository); + + value.Zero(); + type.Zero(); + + // if opening the cenrtral repository failed, then leave this function + if ( repository == NULL ) + { + User::LeaveIfError( KErrGeneral ); + } + + err = repository->Get( KIctsTestPermission, temp ); + value.Num(temp); + type.Append( KNSmlWLanInternetConnectivityTest ); + UpdateStatusAndResultL( iReadStatuses->internetConnectivityTestResult, iReadStatuses->internetConnectivityTestStatus, + value, type, err ); + + CleanupStack::PopAndDestroy(repository); + } + + // The rest of the parameters are in WlanDeviceSettings cenRep + repository = CRepository::NewL( KCRUidWlanDeviceSettingsRegistryId ); + CleanupStack::PushL(repository); + + // if opening the cenrtral repository failed, then leave this function + if ( repository == NULL ) + { + User::LeaveIfError( KErrGeneral ); + } + + if ( iReadSettings->MTUPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMTU, temp ); + value.Num(temp); + type.Append( KNSmlWLanMTU ); + UpdateStatusAndResultL( iReadStatuses->MTUResult, iReadStatuses->MTUStatus, + value, type, err ); + } + + // Write KWlanScanRate + if ( iReadSettings->scanRatePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanScanRate, temp ); + value.Num(temp); + type.Append( KNSmlWLanScanRate ); + UpdateStatusAndResultL( iReadStatuses->scanRateResult, iReadStatuses->scanRateStatus, + value, type, err ); + } + + // Write KWlanRcpiTrigger + if ( iReadSettings->RCPITriggerPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanRcpiTrigger, temp ); + value.Num(temp); + type.Append( KNSmlWLanRCPITrigger ); + UpdateStatusAndResultL( iReadStatuses->RCPITriggerResult, iReadStatuses->RCPITriggerStatus, + value, type, err ); + } + + // Write KWlanMinActiveChannelTime + if ( iReadSettings->minActiveChannelTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMinActiveChannelTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanMinActiveChannelTime ); + UpdateStatusAndResultL( iReadStatuses->minActiveChannelTimeResult, iReadStatuses->minActiveChannelTimeStatus, + value, type, err ); + } + + // Write KWlanMaxActiveChannelTime + if ( iReadSettings->maxActiveChannelTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxActiveChannelTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanMaxActiveChannelTime ); + UpdateStatusAndResultL( iReadStatuses->maxActiveChannelTimeResult, iReadStatuses->maxActiveChannelTimeStatus, + value, type, err ); + } + + // Write KWlanMaxTxMSDULifeTime + if ( iReadSettings->maxTxMSDULifeTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxTxMSDULifeTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanMaxTxMSDULifeTime ); + UpdateStatusAndResultL( iReadStatuses->maxTxMSDULifeTimeResult, iReadStatuses->maxTxMSDULifeTimeStatus, + value, type, err ); + } + + // Write KWlanScanExpirationTimer + if ( iReadSettings->scanExpirationTimerPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanScanExpirationTimer, temp ); + value.Num(temp); + type.Append( KNSmlWLanScanExpirationTimer ); + UpdateStatusAndResultL( iReadStatuses->scanExpirationTimerResult, iReadStatuses->scanExpirationTimerStatus, + value, type, err ); + } + + // Write KWlanUnloadDriverTimer + if ( iReadSettings->unloadDriverTimerPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanUnloadDriverTimer, temp ); + value.Num(temp); + type.Append( KNSmlWLanUnloadDriverTimer ); + UpdateStatusAndResultL( iReadStatuses->unloadDriverTimerResult, iReadStatuses->unloadDriverTimerStatus, + value, type, err ); + } + + // Write KWlanRoamTimer + if ( iReadSettings->roamTimerPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanRoamTimer, temp ); + value.Num(temp); + type.Append( KNSmlWLanRoamTimer ); + UpdateStatusAndResultL( iReadStatuses->roamTimerResult, iReadStatuses->roamTimerStatus, + value, type, err ); + } + + // Write KWlanRcpiDifference + if ( iReadSettings->RCPIDifferencePresent ) + { + value.Zero(); + type.Zero(); + type.Append( KNSmlWLanRCPIDifference ); + err = repository->Get( KWlanRcpiDifference, temp ); + value.Num(temp); + UpdateStatusAndResultL( iReadStatuses->RCPIDifferenceResult, iReadStatuses->RCPIDifferenceStatus, + value, type, err ); + } + + // Write KWlanConnRegainTimer + if ( iReadSettings->connRegainTimerPresent ) + { + value.Zero(); + type.Zero(); + type.Append( KNSmlWLanConnRegainTimer ); + err = repository->Get( KWlanConnRegainTimer, temp ); + value.Num(temp); + UpdateStatusAndResultL( iReadStatuses->connRegainTimerResult, iReadStatuses->connRegainTimerStatus, + value, type, err ); + } + + // Write KWlanMaxTriesToFindNw + if ( iReadSettings->maxTriesToFindNwPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxTriesToFindNw, temp ); + value.Num(temp); + type.Append( KNSmlWLanMaxTriesToFindNw ); + UpdateStatusAndResultL( iReadStatuses->maxTriesToFindNwResult, iReadStatuses->maxTriesToFindNwStatus, + value, type, err ); + } + + // Write KWlanDelayBetweenFindNw + if ( iReadSettings->delayBetweenFindNwPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanDelayBetweenFindNw, temp ); + value.Num(temp); + type.Append( KNSmlWLanDelayBetweenFindNw ); + UpdateStatusAndResultL( iReadStatuses->delayBetweenFindNwResult, iReadStatuses->delayBetweenFindNwStatus, + value, type, err ); + } + + // Write KWlanMinPassiveChannelTime + if ( iReadSettings->minPassiveChannelTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMinPassiveChannelTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanRCPITrigger ); + UpdateStatusAndResultL( iReadStatuses->minPassiveChannelTimeResult, iReadStatuses->minPassiveChannelTimeStatus, + value, type, err ); + } + + // Write KWlanMaxPassiveChannelTime + if ( iReadSettings->maxPassiveChannelTimePresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxPassiveChannelTime, temp ); + value.Num(temp); + type.Append( KNSmlWLanMinPassiveChannelTime ); + UpdateStatusAndResultL( iReadStatuses->maxPassiveChannelTimeResult, iReadStatuses->maxPassiveChannelTimeStatus, + value, type, err ); + } + + // Write KWlanMaxApFailureCount + if ( iReadSettings->maxApFailureCountPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanMaxApFailureCount, temp ); + value.Num(temp); + type.Append( KNSmlWLanMaxApFailureCount ); + UpdateStatusAndResultL( iReadStatuses->maxApFailureCountResult, iReadStatuses->maxApFailureCountStatus, + value, type, err ); + } + + // Write KWlanLongBeaconFindCount + if ( iReadSettings->longBeaconFindCountPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanLongBeaconFindCount, temp ); + value.Num(temp); + type.Append( KNSmlWLanLongBeaconFindCount ); + UpdateStatusAndResultL( iReadStatuses->longBeaconFindCountResult, iReadStatuses->longBeaconFindCountStatus, + value, type, err ); + } + + // Write KWlanQosNullFrameInterval + if ( iReadSettings->qosNullFrameIntervalPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanQosNullFrameInterval, temp ); + value.Num(temp); + type.Append( KNSmlWLanQosNullFrameInterval ); + UpdateStatusAndResultL( iReadStatuses->qosNullFrameIntervalResult, iReadStatuses->qosNullFrameIntervalStatus, + value, type, err ); + } + + // Write KWlanQosNullFrameTimeout + if ( iReadSettings->qosNullFrameTimeoutPresent ) + { + value.Zero(); + type.Zero(); + err = repository->Get( KWlanQosNullFrameTimeout, temp ); + value.Num(temp); + type.Append( KNSmlWLanQosNullFrameTimeout ); + UpdateStatusAndResultL( iReadStatuses->qosNullFrameTimeoutResult, iReadStatuses->qosNullFrameTimeoutStatus, + value, type, err ); + } + + // Cleanup + CleanupStack::PopAndDestroy(repository); + _DBG_FILE("CGlobalWLANAdapter::ReadCenRepParams(): end"); + return; + + } + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::UpdateStatusAndResultL( ) +// Reads parameters from cenrep and updates result/status +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::UpdateStatusAndResultL( TInt aResult, TInt aStatus, TDesC8& aValue, TDesC8& aType, TInt aStoreErr ) + { + + _DBG_FILE("CGlobalWLANAdapter::UpdateStatusAndResultL(): begin"); + + CBufBase *lObject = CBufFlat::NewL(KInputMaxLength); + CleanupStack::PushL(lObject); + + // If reading went ok, then we can set the results and statuses + if ( aStoreErr == KErrNone ) + { + lObject->InsertL(0, aValue); + iCallBack->SetResultsL( aResult,*lObject,aType ); + iCallBack->SetStatusL( aStatus, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL( aStatus, CSmlDmAdapter::EError ); + } + + _DBG_FILE("CGlobalWLANAdapter::UpdateStatusAndResultL(): end"); + CleanupStack::PopAndDestroy(lObject); + return; + } + +// ------------------------------------------------------------------------------------------------ +// void CGlobalWLANAdapter::ReadCommsDBParams( ) +// Reads parameters from commsDB +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::ReadCommsDBParamsL() + { + _DBG_FILE("CGlobalWLANAdapter::ReadCommsDBParams() begin" ); + + CCommsDatabase* db = CCommsDatabase::NewL(); + CleanupStack::PushL(db); + + // User defined WLAN device settings table from Comms database + CCommsDbTableView* usrTable; + + // Open user settings. + usrTable = db->OpenViewMatchingUintLC( TPtrC(WLAN_DEVICE_SETTINGS), + TPtrC(WLAN_DEVICE_SETTINGS_TYPE), + KWlanUserSettings ); + + TUint32 intVal; + TBool boolVal = EFalse; + TBuf8 value; + TBuf8 type; + TInt err = KErrNone; + TInt readErr = KErrNone; + _LIT8(KTrue,"True"); + _LIT8(KFalse,"False"); + + // if record did not exist, then we don't do anything + if ( usrTable == NULL ) + readErr = KErrGeneral; + else + readErr = usrTable->GotoFirstRecord(); + + // Check whether parameter was requested to be fetched + if ( iReadSettings->backgroundScanIntervalPresent ) + { + // The reading is done if the commdb record was opened successfully, otherwise the err + // is updated so that the ReadAndSetStatus function can update thet status correctly + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(WLAN_BG_SCAN_INTERVAL), intVal )); + } + else + { + err=readErr; + } + + value.Zero(); + type.Zero(); + value.Num(intVal); + type.Append( KNSmlWLanBackgroundScanInterval ); + UpdateStatusAndResultL( iReadStatuses->backgroundScanIntervalResult, iReadStatuses->backgroundScanIntervalStatus, + value, type, err ); + } + + if ( iReadSettings->useDefaultSettingsPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadBoolL( TPtrC(WLAN_USE_DEFAULT_SETTINGS), boolVal )); + } + else + { + err=readErr; + } + + value.Zero(); + type.Zero(); + if ( boolVal == 0 ) + value.Copy(KFalse); + else + value.Copy(KTrue); + + type.Append( KNSmlWLanUseDefaultSettings ); + _DBG_FILE("CGlobalWLANAdapter::ReadCommsDBParams() go set status" ); + UpdateStatusAndResultL( iReadStatuses->useDefaultSettingsResult, iReadStatuses->useDefaultSettingsStatus, + value, type, err ); + } + + if ( iReadSettings->longRetryLimitPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(WLAN_LONG_RETRY), intVal )); + } + else + { + err = readErr; + } + + value.Zero(); + value.Num(intVal); + type.Zero(); + type.Append( KNSmlWLanLongRetryLimit ); + UpdateStatusAndResultL( iReadStatuses->longRetryLimitResult, iReadStatuses->longRetryLimitStatus, + value, type, err ); + } + + if ( iReadSettings->shortRetryLimitPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(WLAN_SHORT_RETRY), intVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + value.Num(intVal); + type.Append( KNSmlWLanShortRetryLimit ); + UpdateStatusAndResultL( iReadStatuses->shortRetryLimitResult, iReadStatuses->shortRetryLimitStatus, + value, type, err ); + } + + if ( iReadSettings->RTSThresholdPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(WLAN_RTS_THRESHOLD), intVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + value.Num(intVal); + type.Append( KNSmlWLanRTSThreshold ); + UpdateStatusAndResultL( iReadStatuses->RTSThresholdResult, iReadStatuses->RTSThresholdStatus, + value, type, err ); + } + + if ( iReadSettings->TXPowerLevelPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadUintL( TPtrC(NU_WLAN_TX_POWER_LEVEL), intVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + value.Num(intVal); + type.Append( KNSmlWLanTXPowerLevel ); + UpdateStatusAndResultL( iReadStatuses->TXPowerLevelResult, iReadStatuses->TXPowerLevelStatus, + value, type, err ); + } + + if ( iReadSettings->allowRadioMeasurementsPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadBoolL( TPtrC(WLAN_ALLOW_RADIO_MEASUREMENTS), boolVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + if ( boolVal ) + value.Copy(_L8("True")); + else + value.Copy(_L8("False")); + + type.Append( KNSmlWLanAllowRadioMeasurements ); + UpdateStatusAndResultL( iReadStatuses->allowRadioMeasurementsResult, iReadStatuses->allowRadioMeasurementsStatus, + value, type, err ); + } + + if ( iReadSettings->powerSavingPresent ) + { + if ( readErr == KErrNone ) + { + TRAP( err, usrTable->ReadBoolL( TPtrC(WLAN_POWER_MODE), boolVal )); + } + else + { + err = readErr; + } + + value.Zero(); + type.Zero(); + if ( boolVal ) + value.Copy(_L8("True")); + else + value.Copy(_L8("False")); + + type.Append( KNSmlWLanPowerSaving ); + UpdateStatusAndResultL( iReadStatuses->powerSavingResult, iReadStatuses->powerSavingStatus, + value, type, err ); + } + + CleanupStack::PopAndDestroy( usrTable ); + CleanupStack::PopAndDestroy( db ); + _DBG_FILE("CGlobalWLANAdapter::ReadCommsDBParams() end" ); + return; + } + + + +// ------------------------------------------------------------------------------------------------ +// TInt CGlobalWLANAdapter::NumOfUriSegs( const TDesC8& aUri ) +// Return count of URI segments of aUri +// ------------------------------------------------------------------------------------------------ +TInt CGlobalWLANAdapter::NumOfUriSegs( const TDesC8& aUri ) + { + _DBG_FILE("CGlobalWLANAdapter::NumOfUriSegs(): begin"); + + TInt count = 1; + for( TInt i=0; i= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + if( i == 0 ) + { + _DBG_FILE("CGlobalWLANAdapter::GetLastUriSeg(): end"); + return aURI; + } + else + { + _DBG_FILE("CGlobalWLANAdapter::GetLastUriSeg(): end"); + return aURI.Mid( i + 1 ); + } + } + + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::DesToInt( const TDesC8& aNumber ) +// Returns aLuid as integer value +// ------------------------------------------------------------------------------------------------ +TInt CGlobalWLANAdapter::DesToInt( const TDesC8& aNumber ) + { + _DBG_FILE("CGlobalWLANAdapter::DesToInt(): begin"); + + TInt err = KErrNone; + TLex8 lex(aNumber); + TInt value = 0; + err = lex.Val( value ); + + DBG_ARGS8(_S8("CGlobalWLANAdapter::DesToInt() - Des: <%S> Int: <%D>"), &aNumber, value ); + _DBG_FILE("CGlobalWLANAdapter::DesToInt(): end"); + + // the input might have been illegal. Return error code if conversion failed. + if ( err == KErrNone ) + return value; + else + return err; + } + + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::InitMemberVariables +// Inits the member variable structures +// ------------------------------------------------------------------------------------------------ +void CGlobalWLANAdapter::InitMemberVariables() + { + _DBG_FILE("CGlobalWLANAdapter::InitMemberVariables(): begin"); + + iWriteSettings->RCPITriggerPresent=EFalse; + iWriteSettings->internetConnectivityTestPresent=EFalse; + iWriteSettings->useDefaultSettingsPresent=EFalse; + iWriteSettings->longRetryLimitPresent=EFalse; + iWriteSettings->shortRetryLimitPresent=EFalse; + iWriteSettings->RTSThresholdPresent=EFalse; + iWriteSettings->TXPowerLevelPresent=EFalse; + iWriteSettings->powerSavingPresent=EFalse; + iWriteSettings->backgroundScanIntervalPresent=EFalse; + iWriteSettings->scanRatePresent=EFalse; + iWriteSettings->RCPITriggerPresent=EFalse; + iWriteSettings->minActiveChannelTimePresent=EFalse; + iWriteSettings->maxActiveChannelTimePresent=EFalse; + iWriteSettings->maxTxMSDULifeTimePresent=EFalse; + iWriteSettings->scanExpirationTimerPresent=EFalse; + iWriteSettings->unloadDriverTimerPresent=EFalse; + iWriteSettings->roamTimerPresent=EFalse; + iWriteSettings->RCPIDifferencePresent=EFalse; + iWriteSettings->connRegainTimerPresent=EFalse; + iWriteSettings->maxTriesToFindNwPresent=EFalse; + iWriteSettings->delayBetweenFindNwPresent=EFalse; + iWriteSettings->allowRadioMeasurementsPresent=EFalse; + iWriteSettings->minPassiveChannelTimePresent=EFalse; + iWriteSettings->maxPassiveChannelTimePresent=EFalse; + iWriteSettings->maxApFailureCountPresent=EFalse; + iWriteSettings->longBeaconFindCountPresent=EFalse; + iWriteSettings->qosNullFrameIntervalPresent=EFalse; + iWriteSettings->qosNullFrameTimeoutPresent=EFalse; + iWriteSettings->MTUPresent=EFalse; + + iReadSettings->RCPITriggerPresent=EFalse; + iReadSettings->internetConnectivityTestPresent=EFalse; + iReadSettings->useDefaultSettingsPresent=EFalse; + iReadSettings->longRetryLimitPresent=EFalse; + iReadSettings->shortRetryLimitPresent=EFalse; + iReadSettings->RTSThresholdPresent=EFalse; + iReadSettings->TXPowerLevelPresent=EFalse; + iReadSettings->powerSavingPresent=EFalse; + iReadSettings->backgroundScanIntervalPresent=EFalse; + iReadSettings->scanRatePresent=EFalse; + iReadSettings->RCPITriggerPresent=EFalse; + iReadSettings->minActiveChannelTimePresent=EFalse; + iReadSettings->maxActiveChannelTimePresent=EFalse; + iReadSettings->maxTxMSDULifeTimePresent=EFalse; + iReadSettings->scanExpirationTimerPresent=EFalse; + iReadSettings->unloadDriverTimerPresent=EFalse; + iReadSettings->roamTimerPresent=EFalse; + iReadSettings->RCPIDifferencePresent=EFalse; + iReadSettings->connRegainTimerPresent=EFalse; + iReadSettings->maxTriesToFindNwPresent=EFalse; + iReadSettings->delayBetweenFindNwPresent=EFalse; + iReadSettings->allowRadioMeasurementsPresent=EFalse; + iReadSettings->minPassiveChannelTimePresent=EFalse; + iReadSettings->maxPassiveChannelTimePresent=EFalse; + iReadSettings->maxApFailureCountPresent=EFalse; + iReadSettings->longBeaconFindCountPresent=EFalse; + iReadSettings->qosNullFrameIntervalPresent=EFalse; + iReadSettings->qosNullFrameTimeoutPresent=EFalse; + iReadSettings->MTUPresent=EFalse; + + _DBG_FILE("CGlobalWLANAdapter::InitMemberVariables(): begin"); + } + +// end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/globalwlansettings/src/globalwlanadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/globalwlansettings/src/globalwlanadapter.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,45 @@ +CHARACTER_SET UTF8/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: glowal wlan-settings adapter resources +* +*/ + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x1315DBD; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x1315DBE; // Global WLAN Adapter + version_no = 1; + display_name = "GlobalWLanAdapter"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/inc/nsmldmimpluids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/inc/nsmldmimpluids.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM tree etc. +* +*/ + + + + +#ifndef __NSMLDMIMPLUIDS_H__ +#define __NSMLDMIMPLUIDS_H__ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ + +// Implementation UIDs for DS adapters +const TUint KNSmlDMSettingsAdapterImplUid = 0x101F6DEC; +const TUint KNSmlDSSettingsAdapterImplUid = 0x101F6DED; +const TUint KNSmlDMDevInfoAdapterImplUid = 0x101F6DEE; +const TUint KNSmlDMDevDetailAdapterImplUid = 0x101F6DEF; +const TUint KNSmlInternetAdapterImplUid = 0x101F6DE2; +const TUint KNSmlDMEmailAdapterImplUid = 0x101F6E35; +const TUint KNSmlDMMMSAdapterImplUid = 0x101F6E37; +const TUint KNSmlDMFotaAdapterImplUid = 0x101F9A09; +#endif // __CNSMLDMIMPLUIDS_H__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/bld/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build info file for MMS settings adapter +* +*/ + + + + +PRJ_MMPFILES +./nsmldmmmsadapter.mmp + + + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/bld/nsmldmmmsadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/bld/nsmldmmmsadapter.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM MMS Settings Adapter +* +*/ + + + + +#include "defaultcaps.hrh" +#include + +TARGET nsmldmmmsadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F6E36 +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/comms-infras/commdb/protection +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +SYSTEMINCLUDE /epoc32/include/platform/comms-infras/commdb/protection +#endif + +SOURCEPATH ../src +USERINCLUDE ../inc ../../inc + +SOURCE nsmldmmmsadapter.cpp + +START RESOURCE nsmldmmmsadapter.rss +TARGET nsmldmmmsadapter.rsc +LANGUAGE_IDS +END + + +LIBRARY euser.lib ecom.lib msgs.lib charconv.lib nsmldebug.lib +LIBRARY commdb.lib cmmanager.lib mmsserversettings.lib +LIBRARY nsmldmiapmatcher.lib +LIBRARY nsmldmtreedbclient.lib + + +SMPSAFE +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/inc/nsmldmmmsadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/inc/nsmldmmmsadapter.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,379 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM MMS Settings Adapter + * +*/ + + + + + +#ifndef __NSMLDMMMSADAPTER_H__ +#define __NSMLDMMMSADAPTER_H__ + +// ----------------------------------------------------------------------------- +// Includes +// ----------------------------------------------------------------------------- +#include +#include +#include +#include + +// -------------------------------------------------------------------------- +// Class forwards +// -------------------------------------------------------------------------- +class CClientMtmRegistry; +class CMsvSession; +class CMmsClientMtm; + +// -------------------------------------------------------------------------- +// Constant definitions +// -------------------------------------------------------------------------- + +const TInt KNSmlDMMMSDefaultExpiry = 72 * 3600; //3 days +const TInt KNSmlDMMMSExpiryHour = 3600; //1 hour +const TInt KNSmlDMMMSExpirySixHours = 6*3600; //6 hours +const TInt KNSmlDMMMSExpiryDay = 24*3600; //24 hours +const TInt KNSmlDMMMSExpiryThreeDays = 3*24*3600; //3 days +const TInt KNSmlDMMMSExpiryWeek = 7*24*3600; //1 week +const TInt KNSmlDMMMSExpiryMaximum = 0; +//Iap id which is not found from commsdb +const TUint32 KNSmlDMMMSIapNotDefined = 999999; +const TInt KNSmlMMSUndefinedStatusRef = -1; + +const TInt KNSmlDMMMSFirstAccessPointId = 0; +const TInt KNSmlDMMMSSecondAccessPointId = 1; +const TUint8 KNSmlDMMMSSeparatorDef = 0x2f; //forward slash +const TUint8 KNSmlDmMmsObjectSizeWidth = 4; + +// the DDF version must be changed if any changes in DDF structure +// ( built in DDFStructureL() function ) + +// -------------------------------------------------------------------------- +// Literal definitions +// -------------------------------------------------------------------------- + +_LIT8( KNSmlDMMMSDDFVersion, "1.1" ); + +_LIT8( KNSmlDMMMSNodeName, "MMS" ); +_LIT8( KNSmlDMMMSName, "Name" ); +_LIT8( KNSmlDMMMSMMRecep, "MMRecep" ); +_LIT8( KNSmlDMMMSAMsg, "AMsg" ); +_LIT8( KNSmlDMMMSRcvAds, "RcvAds" ); +_LIT8( KNSmlDMMMSImgSize, "ImgSize" ); +_LIT8( KNSmlDMMMSDRepSnd, "DRepSnd" ); +_LIT8( KNSmlDMMMSRcvRep, "RcvRep" ); +_LIT8( KNSmlDMMMSMsgVal, "MsgVal" ); +_LIT8( KNSmlDMMMSCon, "Con" ); +_LIT8( KNSmlDMMMSMToNapID, "MToNapID" ); +_LIT8( KNSmlDMMMSMToNapIDL, "MToNapIDL" ); +_LIT8( KNSmlDMMMSCreMode, "CreMode" ); + +_LIT8( KNSmlDMMMSConSlash, "Con/" ); +_LIT8( KNSmlDMMMSTextPlain, "text/plain" ); + +_LIT8( KNSmlDMMMSNodeNameDescription, "The interior object holds all MMS objects" ); +_LIT8( KNSmlDMMMSDynamicNodeDescription, "Placeholder for one set of MMS settings" ); +_LIT8( KNSmlDMMMSNameDescription, "Displayable Account Name for the MMS Settings" ); +_LIT8( KNSmlDMMMSMMRecepDescription, "Level of MMS protocol operations" ); +_LIT8( KNSmlDMMMSAMsgDescription, "Anonymous messages allowed or not" ); +_LIT8( KNSmlDMMMSRcvAdsDescription, "Receiving adverts allowed or not" ); +_LIT8( KNSmlDMMMSImgSizeDescription, "Image resolution in sending messages" ); +_LIT8( KNSmlDMMMSDRepSndDescription, "Sending of Delivery Reports is allowed or not" ); +_LIT8( KNSmlDMMMSRcvRepDescription, "Defines whether the delivery report is requested by default from each recipient or not" ); +_LIT8( KNSmlDMMMSMsgValDescription, "Message validity time" ); +_LIT8( KNSmlDMMMSMMSSAddrDescription, "MMS server address" ); + +_LIT8( KNSmlDMMMSConNodeDescription, "Parent for MMS connectivity object" ); +_LIT8( KNSmlDMMMSConRtNodeDescription, "Place holder for one or more connectivity objects" ); +_LIT8( KNSmlDMMMSMToNapIDDescription, "Parent to multiple NAP connection reference objects" ); +_LIT8( KNSmlDMMMSMToNapIDLDescription, "Link to internet access point" ); +_LIT8( KNSmlDMMMSCreModeDescription, "MMS creation mode" ); +_LIT8( KNSmlDMMMSTextPlainDescription, "text/plain" ); + +_LIT8( KNSmlDMMMSAccount8, "MMSAcc" ); +_LIT( KNSmlDMMMSAccount16, "MMSAcc" ); +_LIT8( KNSmlDMMMSListOfLeafsLo, "MMRecep/CreMode/AMsg/RcvAds/ImgSize/DRepSnd/RcvRep/MsgVal/Con" ); +_LIT8( KNSmlDMMMSListOfLeafsMid, "MMSSAddr/MToNapID" ); +_LIT8( KNSmlDMMMSListOfLeafsHi, "MToNapIDL" ); +_LIT8( KNSmlDMMMSConDynamicName8, "DCon" ); +_LIT8( KNSmlDMMMSConDynamicName16, "DCon" ); +_LIT8( KNSmlDMMMSMMSSAddr, "MMSSAddr" ); + +_LIT8( KNSmlDMMMSDynamicPrimary, "Primary" ); + + +_LIT( KNSmlDMMMSSeparator16, "/" ); +_LIT8( KNSmlDMMMSSeparator8, "/" ); + +_LIT8( KNSmlDMMMSValueTrue, "True" ); +_LIT8( KNSmlDMMMSValueFalse, "False" ); +_LIT8( KNSmlDMMMSValueAlwaysOn, "Always on" ); + +_LIT8( KNSmlDMMMSValueAutomaticAtHome, "Automatic at home" ); +_LIT8( KNSmlDMMMSValueAutomaticAtHomeShort, "Aut" ); +_LIT8( KNSmlDMMMSValueAlwaysManual, "Always Manual" ); +_LIT8( KNSmlDMMMSValueAlwaysManual2, "Always manual" ); +_LIT8( KNSmlDMMMSValueOff, "Off" ); +_LIT8( KNSmlDMMMSValueFree, "Free" ); +_LIT8( KNSmlDMMMSValueRestricted, "Restricted" ); +_LIT8( KNSmlDMMMSValueWarning, "Warning" ); + +_LIT8( KNSmlDMMMSValueLow, "Low" ); +_LIT8( KNSmlDMMMSValueNormal, "Normal" ); +_LIT8( KNSmlDMMMSValueHigh, "High" ); +_LIT8( KNSmlDMMMSValueSmall, "Small" ); +_LIT8( KNSmlDMMMSValueLarge, "Large" ); +_LIT8( KNSmlDMMMSValueOriginal, "Original" ); + +_LIT8( KNSmlDMMMSValueHour, "one hour" ); +_LIT8( KNSmlDMMMSValueSixHours, "six hours" ); +_LIT8( KNSmlDMMMSValueDay, "24 hours" ); +_LIT8( KNSmlDMMMSValueThreeDays, "three days" ); +_LIT8( KNSmlDMMMSValueWeek, "a week" ); + +_LIT8( KNSmlDMMMSValueHourShort, "hour" ); +_LIT8( KNSmlDMMMSValueSixHoursShort, "six" ); +_LIT8( KNSmlDMMMSValueSixHoursShortNum, "6" ); +_LIT8( KNSmlDMMMSValueDayShort, "24" ); +_LIT8( KNSmlDMMMSValueThreeDaysShort, "three" ); +_LIT8( KNSmlDMMMSValueThreeDaysShortNum, "3" ); +_LIT8( KNSmlDMMMSValueWeekShort, "week" ); +_LIT8( KNSmlDMMMSValueMaximumTimeShort, "max" ); +_LIT8( KNSmlDMMMSValueMaximumTime , "maximum time" ); + +_LIT8( KNSmlDMMMSValuePrimary, "Primary" ); +_LIT8( KNSmlDMMMSValueSecondary, "Secondary" ); +_LIT8( KNSmlMMSUriDotSlash, "./"); +_LIT8( KNSmlDMMMSIAPUri, "AP" ); + +_LIT8( KNSmlDMMMSLevel3Parents, "MMS/MMSAcc" ); +_LIT8( KNSmlDMMMSLevel5Parents, "MMS/MMSAcc/Con/DCon" ); +_LIT8( KNSmlDMMMSLevel7Parents1, "MMS/MMSAcc/Con/DCon/MToNapID/Primary" ); +_LIT8( KNSmlDMMMSLevel7Parents2, "MMS/MMSAcc/Con/DCon/MToNapID/Secondary" ); + +_LIT8( KNSmlDMMMSAclName, "MMS/MMSAcc/Name" ); +_LIT8( KNSmlDMMMSAclMMRecep, "MMS/MMSAcc/MMRecep" ); +_LIT8( KNSmlDMMMSAclCreMode, "MMS/MMSAcc/CreMode" ); +_LIT8( KNSmlDMMMSAclAMsg, "MMS/MMSAcc/AMsg" ); +_LIT8( KNSmlDMMMSAclRcvAds, "MMS/MMSAcc/RcvAds" ); +_LIT8( KNSmlDMMMSAclImgSize, "MMS/MMSAcc/ImgSize" ); +_LIT8( KNSmlDMMMSAclDRepSnd, "MMS/MMSAcc/DRepSnd" ); +_LIT8( KNSmlDMMMSAclRcvRep, "MMS/MMSAcc/RcvRep" ); +_LIT8( KNSmlDMMMSAclMsgVal, "MMS/MMSAcc/MsgVal" ); +_LIT8( KNSmlDMMMSAclMMSSAddr, "MMS/MMSAcc/Con/DCon/MMSSAddr" ); +_LIT8( KNSmlDMMMSAclPrimaryMToNapIDL, "MMS/MMSAcc/Con/DCon/MToNapID/Primary/MToNapIDL" ); + +_LIT8(KNSmlDmMMSAclDefault, "Get=*&Replace=*"); +_LIT8(KNSmlDmMMSAclGet, "Get=*"); + +/** +* The main class of the SyncML DM MMS adapter. +* +* @since +*/ + +class CNSmlDmMMSAdapter : public CSmlDmAdapter, public MMsvSessionObserver + { +public: + static CNSmlDmMMSAdapter* NewL(MSmlDmCallback* aDmCallback ); + + ~CNSmlDmMMSAdapter(); + + // Adapter interface from CSmlDmAdapter + void DDFVersionL( CBufBase& aDDFVersion ); + void DDFStructureL( MSmlDmDDFObject& aDDF ); + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ); + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TInt aStatusRef ); + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef ); + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef ); + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + const TInt aStatusRef ); + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + void StartAtomicL(); + void CommitAtomicL(); + void RollbackAtomicL(); + TBool StreamingSupport( TInt& aItemSize ); + void StreamCommittedL(); + void CompleteOutstandingCmdsL(); + + // from MMsvSessionObserver + void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, + TAny* aArg3 ); + +private: +/** + * Default constructor + * @param aDmCallback Pointer to callback interface + * @return + */ + CNSmlDmMMSAdapter( MSmlDmCallback* aDmCallback ); + +/** +* Second level constructor +* @param +* @return +*/ + void ConstructL(); + +/** +* Converts a descriptor to integer. +* @param aLuid Descriptor to convert. +* @return TInt value +*/ + TInt DesToInt( const TDesC& aLuid ); +/** +* Removes the last uri segment, ie. everything after and including the last "/" character. +* @param aURI The URI to process. +* @return The modified aURI +*/ + + TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); +/** +* Calculates the number of the URI segments. +* @param aURI URI to process. +* @return The number of segments. +*/ + + TInt NumOfURISegs( const TDesC8& aURI ); +/** +* Parses the last segment of URI, ie everything after the last "/" character. +* @param aURI The URI to parse. +* @return The last segment of the URI. +*/ + + TPtrC8 LastURISeg( const TDesC8& aURI ); +/** +* Performs the actual UPDATE operation. +* @param aURI The URI to update. +* @param aParentLUID LUID of the object. +* @param aObject The new data to update. +* @param aStatusRef The command reference. +* @return Status of the UPDATE operation +*/ + + CSmlDmAdapter::TError UpdateDataL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + TInt aStatusRef ); +/** +* Replaces accesspoint in iMmsSettings's accesspoint array. +* @param aIapId The new IAP id to update. +* @param aPos A position to update IAP id +* @return +*/ + + void ReplaceAPL( TInt aIapId, TInt aPos ); +/** +* Performs updating of MMSAddr field. +* @param +* @return Status of the update. +*/ + + CSmlDmAdapter::TError UpdateMMSAddrL(); +/** +* Retrieves the paramters to iMmsSettings class from phones permanent storage. +* @param +* @return +*/ + + void CreateMMSClientL(); + +/** +* Updates the parameters of given DDF node +* @param aNode The node to update. +* @param aAccTypes Access types of the node. +* @param aOccurrence Occurrance of the node. +* @param aScope Scope of the node. +* @param aFormat Format of the node. +* @param aDescription A description of the node. +* @return +*/ + + void FillNodeInfoL( MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription); + +/** +* Fetches a value from iMmsSettings class. +* @param aURI The URI to fetch +* @param aObject The container for the result. +* @return Status of the operation. +*/ + + CSmlDmAdapter::TError FetchObjectL( const TDesC8& aURI, CBufBase& aObject ); +/** +* Stores the contents of iMmsSettings class to phones permanen storage. +* @param +* @return +*/ + + void StoreSettingsL(); +/** +* Checks the URI validity. +* @param aURI The URI to check. +* @return Status of the operation. +*/ + + CSmlDmAdapter::TError ValidateUriL(const TDesC8& aURI ); + + TBool IsWAPAccessPointRecordLockedL(TUint32 aRecord); + +/** +* Gets the IAP ID using CMManager +* @param aUid the accesspointID +* @return the IAP ID +*/ + TUint32 GetIapIdL( TUint32 aUid ); + + + TInt DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect); +private: + CClientMtmRegistry* iClientMtmRegistry; + CMsvSession* iMsvSession; + CMmsClientMtm *iMmsClient; + CMmsSettings* iMmsSettings; + MSmlDmCallback* iCallback; + TInt iStatusRef; + HBufC8 *iMMSSAddr; + TInt iImgSizeStatusRef; + CCommsDatabase* iDatabase; + }; + +#endif // __NSMLDMMMSADAPTER_H__ + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/src/nsmldmmmsadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/src/nsmldmmmsadapter.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,1514 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM MMS Settings Adapter + * +*/ + + + +#include +#include +#include +#include +#include // For TImplementationProxy definition +#include +#include // CommsDB columname defs +#include +#include +#include +#include +#include + +#include "nsmldmimpluids.h" +#include "nsmldmmmsadapter.h" +#include "nsmldebug.h" +#include "nsmlconstants.h" +#include "nsmldmconst.h" +#include "nsmldmiapmatcher.h" +#include "nsmldmtreedbclient.h" + +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter* CNSmlDmMMSAdapter::NewL( ) +// ----------------------------------------------------------------------------- +CNSmlDmMMSAdapter* CNSmlDmMMSAdapter::NewL(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmMMSAdapter::NewL(): begin"); + CNSmlDmMMSAdapter* self = new (ELeave) CNSmlDmMMSAdapter(aDmCallback); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + _DBG_FILE("CNSmlDmMMSAdapter::NewL(): end"); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::CNSmlDmMMSAdapter() +// ----------------------------------------------------------------------------- +CNSmlDmMMSAdapter::CNSmlDmMMSAdapter(MSmlDmCallback* aDmCallback) + : CSmlDmAdapter(aDmCallback) + { + _DBG_FILE("CNSmlDmMMSAdapter::CNSmlDmMMSAdapter(): begin"); + _DBG_FILE("CNSmlDmMMSAdapter::CNSmlDmMMSAdapter(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::ConstructL() +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::ConstructL() + { + _DBG_FILE("CNSmlDmMMSAdapter::ConstructL(): begin"); + iStatusRef = KNSmlMMSUndefinedStatusRef; + iImgSizeStatusRef = KNSmlMMSUndefinedStatusRef; + iDatabase = CCommsDatabase::NewL(EDatabaseTypeIAP); + _DBG_FILE("CNSmlDmMMSAdapter::ConstructL(): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::~CNSmlDmMMSAdapter() +// ----------------------------------------------------------------------------- +CNSmlDmMMSAdapter::~CNSmlDmMMSAdapter() + { + _DBG_FILE("CNSmlDmMMSAdapter::~CNSmlDmMMSAdapter(): begin"); + delete iMmsClient; + delete iClientMtmRegistry; + delete iMsvSession; + delete iMMSSAddr; + delete iMmsSettings; + if(iDatabase) + delete iDatabase; + _DBG_FILE("CNSmlDmMMSAdapter::~CNSmlDmMMSAdapter(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::DDFVersionL() +// Returns the DDF version of the adapter +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + _DBG_FILE("CNSmlDmMMSAdapter::DDFVersionL(TDes& aDDFVersion): begin"); + aDDFVersion.InsertL(0,KNSmlDMMMSDDFVersion); + _DBG_FILE("CNSmlDmMMSAdapter::DDFVersionL(TDes& aDDFVersion): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::DDFStructureL() +// Builds the DDF structure of adapter +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CNSmlDmMMSAdapter::DDFStructureL(): begin"); + + TSmlDmAccessTypes accessTypesGetAdd; + accessTypesGetAdd.SetGet(); + accessTypesGetAdd.SetAdd(); + + TSmlDmAccessTypes accessTypesGet; + accessTypesGet.SetGet(); + + TSmlDmAccessTypes accessTypesNoDelete; + accessTypesNoDelete.SetGet(); + accessTypesNoDelete.SetAdd(); + accessTypesNoDelete.SetReplace(); + + // MMS + MSmlDmDDFObject& MMS = aDDF.AddChildObjectL(KNSmlDMMMSNodeName); + FillNodeInfoL(MMS,accessTypesGet,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent,MSmlDmDDFObject::ENode, + KNSmlDMMMSNodeNameDescription); + + //run time node + MSmlDmDDFObject& rtAcc = MMS.AddChildObjectGroupL(); + FillNodeInfoL(rtAcc,accessTypesGet,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode, + KNSmlDMMMSDynamicNodeDescription); + + //level of mms protocol operations + MSmlDmDDFObject& mmRecep = rtAcc.AddChildObjectL(KNSmlDMMMSMMRecep); + FillNodeInfoL(mmRecep,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMMSMMRecepDescription); + + //Creation mode + MSmlDmDDFObject& creMode = rtAcc.AddChildObjectL(KNSmlDMMMSCreMode); + FillNodeInfoL(creMode,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMMSCreModeDescription); + + //anonymous messages allowed + MSmlDmDDFObject& amsg = rtAcc.AddChildObjectL(KNSmlDMMMSAMsg); + FillNodeInfoL(amsg,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMMMSAMsgDescription); + + //adverts messages allowed + MSmlDmDDFObject& rcvAds = rtAcc.AddChildObjectL(KNSmlDMMMSRcvAds); + FillNodeInfoL(rcvAds,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMMMSRcvAdsDescription); + + //image size in sending + MSmlDmDDFObject& imgSize = rtAcc.AddChildObjectL(KNSmlDMMMSImgSize); + FillNodeInfoL(imgSize,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMMSImgSizeDescription); + + //deny delivery report sending + MSmlDmDDFObject& dRepSnd = rtAcc.AddChildObjectL(KNSmlDMMMSDRepSnd); + FillNodeInfoL(dRepSnd,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMMMSDRepSndDescription); + + //delivery report requested by default + MSmlDmDDFObject& rcvRep = rtAcc.AddChildObjectL(KNSmlDMMMSRcvRep); + FillNodeInfoL(rcvRep,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMMMSRcvRepDescription); + + //message validity time + MSmlDmDDFObject& msgVal = rtAcc.AddChildObjectL(KNSmlDMMMSMsgVal); + FillNodeInfoL(msgVal,accessTypesNoDelete,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMMSMsgValDescription); + + // MMS//Con + MSmlDmDDFObject& con = rtAcc.AddChildObjectL(KNSmlDMMMSCon); + FillNodeInfoL(con,accessTypesGet,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode, + KNSmlDMMMSConNodeDescription); + + + // MMS//Con/ + MSmlDmDDFObject& rtCon = con.AddChildObjectL(KNSmlDMMMSConDynamicName16); + FillNodeInfoL(rtCon,accessTypesGet,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode, + KNSmlDMMMSConRtNodeDescription); + + + // MMS//Con//MMSSAddr + MSmlDmDDFObject& mmsAddr = rtCon.AddChildObjectL(KNSmlDMMMSMMSSAddr); + FillNodeInfoL(mmsAddr,accessTypesNoDelete,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMMSMMSSAddrDescription); + + // MMS//Con//MToNapID + MSmlDmDDFObject& mToNapID = rtCon.AddChildObjectL(KNSmlDMMMSMToNapID); + FillNodeInfoL(mToNapID,accessTypesGet,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode, + KNSmlDMMMSConRtNodeDescription); + + // MMS//Con//MToNapID/ + MSmlDmDDFObject& rtNapIds = mToNapID.AddChildObjectL(KNullDesC8); + FillNodeInfoL(rtNapIds,accessTypesGet,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode, + KNSmlDMMMSConRtNodeDescription); + + // MMS//Con//MToNapID//MToNapIdL + MSmlDmDDFObject& mToNapIDL = rtNapIds.AddChildObjectL(KNSmlDMMMSMToNapIDL); + FillNodeInfoL(mToNapIDL,accessTypesNoDelete,MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMMSMToNapIDLDescription); + + RNSmlDMCallbackSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL(session); + + session.UpdateAclL(KNSmlDMMMSLevel3Parents,KNSmlDmMMSAclGet); + session.UpdateAclL(KNSmlDMMMSAclName,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclMMRecep,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclCreMode,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclAMsg,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclRcvAds,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclImgSize,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclDRepSnd,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclRcvRep,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclMsgVal,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclMMSSAddr,KNSmlDmMMSAclDefault); + session.UpdateAclL(KNSmlDMMMSAclPrimaryMToNapIDL,KNSmlDmMMSAclDefault); + CleanupStack::PopAndDestroy(); //session + + _DBG_FILE("CNSmlDmMMSAdapter::DDFStructureL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::UpdateLeafObjectL() +// Updates value of leaf object +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(): begin"); + CSmlDmAdapter::TError status = ValidateUriL( aURI ); + if ( status == EOk ) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(): OK update"); + status = UpdateDataL(aURI, aLUID, aObject, aStatusRef); + } + // ImgSize and MMSAddr are always stored last, from the + // CompleteOutstandingCmdsL() function + if( ( aStatusRef != iStatusRef ) && (aStatusRef != iImgSizeStatusRef )) + { + StoreSettingsL(); + Callback().SetStatusL(aStatusRef, status); + } + _DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(): end"); + } +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID ) +// This should delete values or accounts, but in case of MMS adapter the delete +// is not allowed +// and the adapters returns allways the EError. +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmMMSAdapter::DeleteLeafObjectL( ): begin"); + + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmMMSAdapter::DeleteLeafObjectL( ): end"); + } +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::FetchLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, +// const TDesC8& aType, +// const TInt aResultsRef, +// const TInt aStatusRef ) +// Fetches the values of leaf objects. +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmMMSAdapter::FetchLeafObjectL(): begin"); + CBufBase* result = CBufFlat::NewL(64); + CleanupStack::PushL(result); + CSmlDmAdapter::TError status = FetchObjectL(aURI, *result); + if(status == CSmlDmAdapter::EOk) + { + Callback().SetResultsL(aResultsRef,*result,aType); + } + Callback().SetStatusL(aStatusRef, status); + + CleanupStack::PopAndDestroy(); //result + _DBG_FILE("CNSmlDmMMSAdapter::FetchLeafObjectL(): end"); + } + +//---------------------------------------------------------------------- +// TUint32 GetIapIdL( TUint32 aUid ) +// Gets the IAP ID +//---------------------------------------------------------------------- +TUint32 CNSmlDmMMSAdapter::GetIapIdL( TUint32 aUid ) + { + TUint32 retval( 0 ); + RCmManagerExt cmmanagerExt; + cmmanagerExt.OpenL(); + CleanupClosePushL(cmmanagerExt); + RCmConnectionMethodExt cm; + cm = cmmanagerExt.ConnectionMethodL( aUid ); + CleanupClosePushL( cm ); + retval = cm.GetIntAttributeL(CMManager::ECmIapId); + CleanupStack::PopAndDestroy( 2 ); //cmmanagerext,cm + return retval; + + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::ChildURIListL( const TDesC8& aURI, +// const TDesC8& /*aLUID*/, +// const CArrayFix& +// /*aPreviousURISegmentList*/, +// const TInt aResultsRef, +// const TInt aStatusRef ) +// Retuns the list of children of the node +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const CArrayFix& + /*aPreviousURISegmentList*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): begin"); + TRAPD(err, CreateMMSClientL()); + if(err!=KErrNone) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): EError end"); + return; + } + + CBufBase* currentList = CBufFlat::NewL(1); + CleanupStack::PushL(currentList); + + TMsvId id = iMmsSettings->Service(); + if(id==KMsvNullIndexEntryId) + { + if(aURI.Compare(KNSmlDMMMSNodeName)==0) + { + Callback().SetResultsL(aResultsRef,*currentList,KNullDesC8); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): end"); + } + else + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): ENotFound end"); + } + CleanupStack::PopAndDestroy(); //currentList + return; + } + + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + TPtrC8 lastSeg = LastURISeg(aURI); + TInt num = NumOfURISegs(aURI); + + if(aURI.Compare(KNSmlDMMMSNodeName)==0) + { + currentList->InsertL(0,KNSmlDMMMSAccount8); + } + else if(num==2&&aURI.Find(KNSmlDMMMSAccount8)>=0) + { + currentList->InsertL(0,KNSmlDMMMSListOfLeafsLo); + } + else if(num==3&&lastSeg.Compare(KNSmlDMMMSCon)==0) + { + currentList->InsertL(0,KNSmlDMMMSConDynamicName8); + } + else if(num==4&&lastSeg.Compare(KNSmlDMMMSConDynamicName16)==0) + { + currentList->InsertL(0,KNSmlDMMMSListOfLeafsMid); + } + else if(num==5&&lastSeg.Compare(KNSmlDMMMSMToNapID)==0) + { + currentList->InsertL(0,KNSmlDMMMSValuePrimary); + } + else if(num==6&&(lastSeg.Compare(KNSmlDMMMSDynamicPrimary)==0)) + { + currentList->InsertL(0,KNSmlDMMMSListOfLeafsHi); + } + else + { + status=CSmlDmAdapter::ENotFound; + } + Callback().SetStatusL(aStatusRef, status); + if(status==CSmlDmAdapter::EOk) + { + Callback().SetResultsL(aResultsRef,*currentList,KNullDesC8); + } + CleanupStack::PopAndDestroy(); //currentList + + _DBG_FILE("CNSmlDmMMSAdapter::ChildURIListL(): end"); + } +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::AddNodeObjectL( const TDesC8& aURI, +// const TDesC8& aParentLUID ) +// This should add a new account, but in case of MMS settings only one +// account exist, +// and so the add is not possible. Returns allways CSmlDmAdapter::EError. +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmMMSAdapter::AddNodeObjectL(): begin"); + //If add is needed in future then add call to AddObjectL function here + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmMMSAdapter::AddNodeObjectL(): end"); + } +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::UpdateLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, RWriteStream*& aStream, const TDesC8& aType, +// const TInt aStatusRef ) +// This should update a stream object, but in case of MMS settings streaming is +// not supported. +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(stream): begin"); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmMMSAdapter::UpdateLeafObjectL(stream): end"); + } +// ----------------------------------------------------------------------------- +// void CNSmlDmMMSAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef, +// const TInt aStatusRef ) +// Fetches data object and returns its size. +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmMMSAdapter::FetchLeafObjectSizeL(): begin"); + + CBufBase* result = CBufFlat::NewL(64); + CleanupStack::PushL(result); + CSmlDmAdapter::TError status = FetchObjectL(aURI, *result); + if( status == CSmlDmAdapter::EOk ) + { + TInt objSizeInBytes = result->Size(); + TBuf8 stringObjSizeInBytes; + stringObjSizeInBytes.Num( objSizeInBytes ); + result->Reset(); + result->InsertL( 0, stringObjSizeInBytes ); + Callback().SetResultsL(aResultsRef, *result, aType); + } + Callback().SetStatusL(aStatusRef, status); + CleanupStack::PopAndDestroy(); //result + _DBG_FILE("CNSmlDmMMSAdapter::FetchLeafObjectSizeL(): end"); + } +//============================================================================== +// CNSmlDmMMSAdapter::ExecuteCommandL() +//============================================================================== +void CNSmlDmMMSAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + //Not supported + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + +//============================================================================== +// CNSmlDmMMSAdapter::ExecuteCommandL() +//============================================================================== +void CNSmlDmMMSAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + //Not supported + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + +//============================================================================== +// CNSmlDmMMSAdapter::CopyCommandL() +//============================================================================== +void CNSmlDmMMSAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + //Not supported + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + } + +//============================================================================== +// CNSmlDmMMSAdapter::StartAtomicL() +//============================================================================== +void CNSmlDmMMSAdapter::StartAtomicL() + { + //Not supported + } + +//============================================================================== +// CNSmlDmMMSAdapter::CommitAtomicL() +//============================================================================== +void CNSmlDmMMSAdapter::CommitAtomicL() + { + //Not supported + } + +//============================================================================== +// CNSmlDmMMSAdapter::RollbackAtomicL() +//============================================================================== +void CNSmlDmMMSAdapter::RollbackAtomicL() + { + //Not supported + } + +//============================================================================== +// CNSmlDmMMSAdapter::StreamingSupport() +//============================================================================== +TBool CNSmlDmMMSAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + return EFalse; + } + +//============================================================================== +// CNSmlDmMMSAdapter::StreamCommittedL() +//============================================================================== +void CNSmlDmMMSAdapter::StreamCommittedL() + { + //Not supported + } +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::CompleteOutstandingCmdsL() +// Indication of message ending. The buffered commands must be executed before +// return of this function. +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::CompleteOutstandingCmdsL() + { + _DBG_FILE("CNSmlDmMMSAdapter::CompleteOutstandingCmdsL(): begin"); + if(iStatusRef!=KNSmlMMSUndefinedStatusRef) + { + Callback().SetStatusL(iStatusRef,UpdateMMSAddrL()); + delete iMMSSAddr; + iMMSSAddr = 0; + iStatusRef = KNSmlMMSUndefinedStatusRef; + } + StoreSettingsL(); + _DBG_FILE("CNSmlDmMMSAdapter::CompleteOutstandingCmdsL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::HandleSessionEventL() +// Inherited from MMsvSessionObserver, and this is needs to implemented for +// opening the CMsvSession +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::HandleSessionEventL( TMsvSessionEvent /*aEvent*/, + TAny* /*aArg1*/, + TAny* /*aArg2*/, + TAny* /*aArg3*/ ) + { + } + + +// ----------------------------------------------------------------------------- +// CSmlDmAdapter::TError CNSmlDmMMSAdapter::UpdateDataL() +// The function is used for updating the MMS settings. The function is used in +// AddLeafObjectL() and UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlDmMMSAdapter::UpdateDataL(const TDesC8& aURI, + const TDesC8& /*aParentLUID*/, + const TDesC8& aObject, + TInt aStatusRef) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): begin"); + HBufC8* data = NULL; + TRAPD(err, CreateMMSClientL()); + if(err!=KErrNone) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): EError end"); + return CSmlDmAdapter::EError; + } + + TMsvId id = iMmsSettings->Service(); + + if( id == KMsvNullIndexEntryId || aURI.Find( KNSmlDMMMSAccount8 ) + ==KErrNotFound ) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + + TPtrC8 uriSeg = LastURISeg(aURI); + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + if(uriSeg.Compare(KNSmlDMMMSName)==0) + { + // Not supported. + _DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): ENotFound end"); + status = CSmlDmAdapter::ENotFound; + } + else if(uriSeg.Compare(KNSmlDMMMSMMRecep)==0) + { + data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + if(dataPtr.Find(KNSmlDMMMSValueAlwaysOn)==0) + { + iMmsSettings->SetReceivingModeHome(EMmsReceivingAutomatic); + iMmsSettings->SetReceivingModeForeign(EMmsReceivingAutomatic); + } + else if(dataPtr.Compare(KNSmlDMMMSValueOff)==0) + { + iMmsSettings->SetReceivingModeHome(EMmsReceivingReject); + iMmsSettings->SetReceivingModeForeign(EMmsReceivingReject); + } + else if(dataPtr.Find(KNSmlDMMMSValueAutomaticAtHome)==0) + { + iMmsSettings->SetReceivingModeHome(EMmsReceivingAutomatic); + iMmsSettings->SetReceivingModeForeign(EMmsReceivingReject); + } + else if (dataPtr.Find(KNSmlDMMMSValueAlwaysManual2)==0 || + dataPtr.Find(KNSmlDMMMSValueAlwaysManual)==0 ) + { + iMmsSettings->SetReceivingModeHome(EMmsReceivingManual); + iMmsSettings->SetReceivingModeForeign(EMmsReceivingManual); + } + else + { + status = CSmlDmAdapter::EInvalidObject; + } + CleanupStack::PopAndDestroy(); //data + } + else if(uriSeg.Compare(KNSmlDMMMSCreMode)==0) + { + data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + if(dataPtr.Find(KNSmlDMMMSValueFree)==0) + { + iMmsSettings->SetCreationMode(EMmsCreationModeFree); + } + else if(dataPtr.Find(KNSmlDMMMSValueRestricted)==0) + { + iMmsSettings->SetImageWidth(KImageRichWidth); + iMmsSettings->SetImageHeight(KImageRichHeight); + iMmsSettings->SetCreationMode(EMmsCreationModeRestricted); + } + else if(dataPtr.Find(KNSmlDMMMSValueWarning)==0) + { + iMmsSettings->SetCreationMode(EMmsCreationModeWarning); + } + else + { + status = CSmlDmAdapter::EInvalidObject; + } + CleanupStack::PopAndDestroy(); //data + } + else if( uriSeg.Compare(KNSmlDMMMSAMsg) == 0 ) + { + data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + TBool object=EFalse; + if(dataPtr.Find(KNSmlDMMMSValueTrue)>=0) + { + object = ETrue; + } + iMmsSettings->SetAcceptAnonymousMessages(object); + CleanupStack::PopAndDestroy(); //data + } + else if( uriSeg.Compare(KNSmlDMMMSRcvAds) == 0 ) + { + data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + TBool object=EFalse; + if(dataPtr.Find(KNSmlDMMMSValueTrue)>=0) + { + object = ETrue; + } + iMmsSettings->SetAcceptAdvertisementMessages(object); + CleanupStack::PopAndDestroy(); //data + } + else if(uriSeg.Compare(KNSmlDMMMSImgSize)==0) + { + data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + if(dataPtr.Compare(KNSmlDMMMSValueLarge)==0) + { + switch(iMmsSettings->CreationMode()) + { + case EMmsCreationModeRestricted: + status = CSmlDmAdapter::EInvalidObject; + break; + default : + iMmsSettings->SetImageWidth(KImageMegapixelWidth); + iMmsSettings->SetImageHeight(KImageMegapixelHeight); + break; + } + iImgSizeStatusRef = KNSmlMMSUndefinedStatusRef; + } + else if(dataPtr.Compare(KNSmlDMMMSValueSmall)==0) + { + iMmsSettings->SetImageWidth(KImageRichWidth); + iMmsSettings->SetImageHeight(KImageRichHeight); + iImgSizeStatusRef = KNSmlMMSUndefinedStatusRef; + } + else + { + status = CSmlDmAdapter::EInvalidObject; + } + CleanupStack::PopAndDestroy(); //data + } + else if(uriSeg.Compare(KNSmlDMMMSDRepSnd)==0) + { + data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + if(dataPtr.Compare(KNSmlDMMMSValueFalse)==0) + { + iMmsSettings->SetDeliveryReportSendingAllowed(KMmsYes); + } + else + { + iMmsSettings->SetDeliveryReportSendingAllowed(KMmsNo); + } + CleanupStack::PopAndDestroy(); //data + } + else if(uriSeg.Compare(KNSmlDMMMSRcvRep)==0) + { + data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + if(dataPtr.Compare(KNSmlDMMMSValueTrue)==0) + { + iMmsSettings->SetDeliveryReportWanted(KMmsYes); + } + else + { + iMmsSettings->SetDeliveryReportWanted(KMmsNo); + } + CleanupStack::PopAndDestroy(); //data + } + else if(uriSeg.Compare(KNSmlDMMMSMsgVal)==0) + { + data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.LowerCase(); + if(dataPtr.Compare(KNSmlDMMMSValueHour)==0 || + dataPtr.Compare(KNSmlDMMMSValueHourShort)==0) + { + iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryHour); + } + else if(dataPtr.Find(KNSmlDMMMSValueSixHoursShort)==0 || + dataPtr.Find(KNSmlDMMMSValueSixHoursShortNum)==0) + { + iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpirySixHours); + } + else if(dataPtr.Find(KNSmlDMMMSValueDayShort)==0) + { + iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryDay); + } + else if(dataPtr.Find(KNSmlDMMMSValueThreeDaysShort)==0 || + dataPtr.Find(KNSmlDMMMSValueThreeDaysShortNum)==0) + { + iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryThreeDays); + } + else if(dataPtr.Find(KNSmlDMMMSValueWeekShort)>=0) + { + iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryWeek); + } + else if(dataPtr.Find(KNSmlDMMMSValueMaximumTimeShort)==0) + { + iMmsSettings->SetExpiryInterval(KNSmlDMMMSExpiryMaximum); + } + else + { + status = CSmlDmAdapter::EInvalidObject; + } + CleanupStack::PopAndDestroy(); //data + } + else if(uriSeg.Compare(KNSmlDMMMSMToNapIDL)==0) + { + TPtrC8 seg=LastURISeg(RemoveLastURISeg(aURI)); + if( seg.Compare(KNSmlDMMMSDynamicPrimary)==0 ) + { + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + + TInt iap = iapmatch->IAPIdFromURIL( aObject ); + + CleanupStack::PopAndDestroy(); // iapmatch + + if ( iap != KErrNotFound ) + { + TRAP(err, iap = GetIapIdL( iap ) ); + DBG_ARGS(_S("IAP = %d"), iap); + + if( err == KErrNone) + { + ReplaceAPL( iap, KNSmlDMMMSFirstAccessPointId ); + } + else + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): \ + err!=KErrNone"); + iap = KNSmlDMMMSIapNotDefined; + status = CSmlDmAdapter::EInvalidObject; + } + } + else + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): status = \ + CSmlDmAdapter::EInvalidObject"); + status = CSmlDmAdapter::EInvalidObject; + } + } + else + { + if( status == CSmlDmAdapter::EOk ) + { + status = CSmlDmAdapter::ENotFound; + } + } + } + else if(uriSeg.Compare(KNSmlDMMMSMMSSAddr)==0) + { + if(iMMSSAddr) + { + delete iMMSSAddr; + iMMSSAddr = 0; + } + if(iStatusRef != KNSmlMMSUndefinedStatusRef) + { + Callback().SetStatusL(iStatusRef,CSmlDmAdapter::EError); + } + iMMSSAddr = aObject.AllocL(); + iStatusRef = aStatusRef; + } + + _DBG_FILE("CNSmlDmMMSAdapter::UpdateDataL(): end"); + return status; + } + +// ----------------------------------------------------------------------------- +// void CNSmlDmMMSAdapter::ReplaceAP( TInt aIapId, TInt aPos ) +// replace AP, if no AP exitst in aPos then just add it. +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::ReplaceAPL( TInt aIapId, TInt aPos ) + { + if( iMmsSettings->AccessPoint( aPos ) != KErrNotFound ) + { + iMmsSettings->DeleteAccessPointL( aPos ); + } + iMmsSettings->AddAccessPointL( aIapId, aPos ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::UpdateMMSAddrL() +// Executes the buffered MMSSAddr update command. +// This command is called from CompleteOutstandingCmdsL() +// ----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlDmMMSAdapter::UpdateMMSAddrL() + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL(): begin"); + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + TBool ok = EFalse; + TUint32 wapid = iMmsSettings->AccessPoint(KNSmlDMMMSFirstAccessPointId); + + //Check if locked , if locked unlock else execute normal sequence. + + TBool reclock = EFalse; + TBool lockerror =KErrNone; + reclock = IsWAPAccessPointRecordLockedL(wapid); + if(reclock) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL():making record unlock"); + //unlock the record + lockerror = DoProtectWAPAccessRecordL(wapid,EFalse); + _DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL():record unlocked with error as "); + DBG_ARGS(_S("err = %d"), lockerror); + } + + + CCommsDbTableView* tableView=0; + tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), wapid ); + if(tableView->GotoFirstRecord()==KErrNone) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL(): GotoFirstRecord"); + + + //If it was unlocked, lock it again + + if(lockerror == KErrNone) + { + TInt err = tableView->UpdateRecord(); + if(err == KErrNone) + { + HBufC* object = HBufC::NewLC(iMMSSAddr->Length()); + TPtr obPtr = object->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( obPtr, *iMMSSAddr); + + TRAPD(err,tableView->WriteLongTextL(TPtrC(WAP_START_PAGE),obPtr)); + DBG_ARGS(_S("err = %d"), err); + if(err==KErrNone) + { + _DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL(): Write OK"); + tableView->PutRecordChanges(); + ok = ETrue; + } + CleanupStack::PopAndDestroy(); //object + + } + + } + + } + CleanupStack::PopAndDestroy(1); //tableview //, commDb--iDatabase +if(reclock) + { + TInt err = DoProtectWAPAccessRecordL(wapid,ETrue); + _DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL():record again locked with error as "); + DBG_ARGS(_S("err = %d"), err); + reclock = EFalse; + } + if(!ok) + { + status = CSmlDmAdapter::EError; + } + + _DBG_FILE("CNSmlDmMMSAdapter::UpdateMMSAddrL(): end"); + return status; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::DesToInt() +// Converts a 16 bit descriptor to TInt +// ----------------------------------------------------------------------------- +TInt CNSmlDmMMSAdapter::DesToInt(const TDesC& aLuid) + { + TLex16 lex(aLuid); + TInt value = 0; + lex.Val(value); + return value; + } + + +// ----------------------------------------------------------------------------- +// TPtrC8 CNSmlDmMMSAdapter::RemoveLastURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ----------------------------------------------------------------------------- +TPtrC8 CNSmlDmMMSAdapter::RemoveLastURISeg(const TDesC8& aURI) + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMMMSSeparatorDef) + { + break; + } + } + return aURI.Left(i); + } + + + +// ----------------------------------------------------------------------------- +// TInt CNSmlDmMMSAdapter::NumOfURISegs(const TDesC8& aURI) +// Returns the num of uri segs +// ----------------------------------------------------------------------------- +TInt CNSmlDmMMSAdapter::NumOfURISegs(const TDesC8& aURI) + { + TInt numOfURISegs = 1; + for(TInt i=0;i=0;i--) + { + if(aURI[i]==KNSmlDMMMSSeparatorDef) + { + break; + } + } + _DBG_FILE("CNSmlDmMMSAdapter::LastURISeg() : end"); + if(i==0) + { + return aURI; + } + else + { + return aURI.Mid(i+1); + } + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::CreateMMSClientL() +// Creates MMS client mtm +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::CreateMMSClientL() + { + if(iMmsClient ==0) + { + iMsvSession = CMsvSession::OpenSyncL( *this ); + iClientMtmRegistry = CClientMtmRegistry::NewL(* iMsvSession ); + iMmsClient = (CMmsClientMtm *) iClientMtmRegistry-> + NewMtmL( KUidMsgTypeMultimedia ); + iMmsClient->RestoreSettingsL(); + iMmsSettings = CMmsSettings::NewL(); + iMmsSettings->CopyL( iMmsClient->MmsSettings() ); + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDmMMSAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription) + { + aNode.SetAccessTypesL(aAccTypes); + aNode.SetOccurenceL(aOccurrence); + aNode.SetScopeL(aScope); + aNode.SetDFFormatL(aFormat); + if(aFormat!=MSmlDmDDFObject::ENode) + { + aNode.AddDFTypeMimeTypeL(KNSmlDMMMSTextPlain); + } + aNode.SetDescriptionL(aDescription); + + } + +// ----------------------------------------------------------------------------- +// CSmlDmAdapter::TError FetchObjectL(const TDesC8& aURI, const TDesC8& aObject) +// Fetches data object and returns it in parameter. +// Return values according to CSmlDmAdapter::TError. +// ----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlDmMMSAdapter::FetchObjectL(const TDesC8& aURI, + CBufBase& aObject) + { + _DBG_FILE("CNSmlDmMMSAdapter::FetchObjectL(): begin"); + TRAPD(err, CreateMMSClientL()); + if(err!=KErrNone) + { + _DBG_FILE("CNSmlDmMMSAdapter::FetchObjectL(): EError end"); + return CSmlDmAdapter::EError; + } + + TMsvId id = iMmsSettings->Service(); + + if(id == KMsvNullIndexEntryId||aURI.Find(KNSmlDMMMSAccount8)==KErrNotFound) + { + _DBG_FILE("CNSmlDmMMSAdapter::FetchObjectL(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + + TPtrC8 uriSeg = LastURISeg(aURI); + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + if(uriSeg.Compare(KNSmlDMMMSName)==0) + { + status = CSmlDmAdapter::ENotFound; + } + else if(uriSeg.Compare(KNSmlDMMMSMMRecep)==0) + { + TMmsReceivingMode rcvHome = iMmsSettings->ReceivingModeHome(); + TMmsReceivingMode rcvForeign = iMmsSettings->ReceivingModeForeign(); + if ( rcvHome == EMmsReceivingAutomatic ) + { + if ( rcvForeign == EMmsReceivingAutomatic ) + { + aObject.InsertL( 0, KNSmlDMMMSValueAlwaysOn ); + } + else + { + aObject.InsertL( 0, KNSmlDMMMSValueAutomaticAtHome ); + } + } + else if ( rcvHome == EMmsReceivingReject ) + { + aObject.InsertL( 0, KNSmlDMMMSValueOff ); + } + else if ( rcvHome == EMmsReceivingManual ) + { + aObject.InsertL( 0, KNSmlDMMMSValueAlwaysManual ); + } + else + { + aObject.InsertL( 0, KNSmlDMMMSValueAutomaticAtHome ); + } + + } + else if(uriSeg.Compare(KNSmlDMMMSCreMode)==0) + { + switch(iMmsSettings->CreationMode()) + { + case EMmsCreationModeWarning: + aObject.InsertL(0,KNSmlDMMMSValueWarning); + break; + + case EMmsCreationModeFree: + aObject.InsertL(0,KNSmlDMMMSValueFree); + break; + + case EMmsCreationModeRestricted: + aObject.InsertL(0,KNSmlDMMMSValueRestricted); + break; + + default: + aObject.InsertL(0,KNSmlDMMMSValueWarning); + break; + } + } + else if(uriSeg.Compare(KNSmlDMMMSAMsg)==0) + { + if(iMmsSettings->AcceptAnonymousMessages()) + { + aObject.InsertL(0,KNSmlDMMMSValueTrue); + } + else + { + aObject.InsertL(0,KNSmlDMMMSValueFalse); + } + } + else if(uriSeg.Compare(KNSmlDMMMSRcvAds)==0) + { + if(iMmsSettings->AcceptAdvertisementMessages()) + { + aObject.InsertL(0,KNSmlDMMMSValueTrue); + } + else + { + aObject.InsertL(0,KNSmlDMMMSValueFalse); + } + } + else if(uriSeg.Compare(KNSmlDMMMSImgSize)==0) + { + if( iMmsSettings->ImageWidth() == KImageRichWidth && + iMmsSettings->ImageHeight() == KImageRichHeight ) + { + aObject.InsertL(0,KNSmlDMMMSValueSmall); + } + else if ( iMmsSettings->ImageWidth() == KImageMegapixelWidth && + iMmsSettings->ImageHeight() == KImageMegapixelHeight ) + { + aObject.InsertL(0,KNSmlDMMMSValueLarge); + } + } + else if(uriSeg.Compare(KNSmlDMMMSDRepSnd)==0) + { + if( iMmsSettings->DeliveryReportSendingAllowed() == KMmsYes) + { + aObject.InsertL(0,KNSmlDMMMSValueFalse); + } + else + { + aObject.InsertL(0,KNSmlDMMMSValueTrue); + } + } + else if(uriSeg.Compare(KNSmlDMMMSRcvRep)==0) + { + if( iMmsSettings->DeliveryReportWanted() == KMmsYes) + { + aObject.InsertL(0,KNSmlDMMMSValueTrue); + } + else + { + aObject.InsertL(0,KNSmlDMMMSValueFalse); + } + } + else if( uriSeg.Compare( KNSmlDMMMSMsgVal ) == 0 ) + { + switch(iMmsSettings->ExpiryInterval()) + { + case KNSmlDMMMSExpiryHour: + aObject.InsertL(0,KNSmlDMMMSValueHourShort); + break; + + case KNSmlDMMMSExpirySixHours: + aObject.InsertL(0,KNSmlDMMMSValueSixHours); + break; + + case KNSmlDMMMSExpiryDay: + aObject.InsertL(0,KNSmlDMMMSValueDay); + break; + + case KNSmlDMMMSExpiryThreeDays: + aObject.InsertL(0,KNSmlDMMMSValueThreeDays); + break; + + case KNSmlDMMMSExpiryWeek: + aObject.InsertL(0,KNSmlDMMMSValueWeek); + break; + + case KNSmlDMMMSExpiryMaximum: + aObject.InsertL(0,KNSmlDMMMSValueMaximumTime); + break; + + default: + aObject.InsertL(0,KNSmlDMMMSValueThreeDays); + break; + } + } + else if(uriSeg.Compare(KNSmlDMMMSMToNapIDL)==0) + { + TUint32 iap = KNSmlDMMMSIapNotDefined; + TInt32 mmsIap = -1; + + + if(LastURISeg(RemoveLastURISeg(aURI)).Compare( + KNSmlDMMMSDynamicPrimary)==0) + { + mmsIap = iMmsSettings->AccessPoint( KNSmlDMMMSFirstAccessPointId ); + } + + if(mmsIap != KErrNotFound ) + { + iap = mmsIap; + TRAPD(err, iap =GetIapIdL(iap) ); + + if( iap != KNSmlDMMMSIapNotDefined && err == KErrNone ) + { + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + + HBufC8* uri8 = iapmatch->URIFromIAPIdL( iap ); + + if( uri8 ) + { + CleanupStack::PushL(uri8); + aObject.InsertL(0,uri8->Des()); + status = CSmlDmAdapter::EOk; + CleanupStack::PopAndDestroy(); // uri8 + } + CleanupStack::PopAndDestroy(); // iapMatch + } + } + } + else if(uriSeg.Compare(KNSmlDMMMSMMSSAddr)==0) + { + CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP); + CleanupStack::PushL(commDb); + + TBool ok = EFalse; + + CCommsDbTableView* tableView=0; + + TInt apId = iMmsSettings->AccessPoint(KNSmlDMMMSFirstAccessPointId); + + if ( apId != KErrNotFound ) + { + + tableView = commDb->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), + apId); + + if(tableView->GotoFirstRecord()==KErrNone) + { + TBuf columnValue; + HBufC* tmpPage; + tmpPage = tableView->ReadLongTextLC(TPtrC(WAP_START_PAGE)); + + if(err==KErrNone) + { + HBufC8* val8 = HBufC8::NewLC(tmpPage->Size()); + TPtr8 valPtr = val8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( valPtr, + *tmpPage); + aObject.InsertL(0,valPtr); + ok = ETrue; + CleanupStack::PopAndDestroy(); //val8 + } + CleanupStack::PopAndDestroy(tmpPage); + } + CleanupStack::PopAndDestroy(); //tableview + } + CleanupStack::PopAndDestroy(); //commDb + if(!ok) + { + status = CSmlDmAdapter::EError; + } + } + else + { + status = CSmlDmAdapter::ENotFound; + } + _DBG_FILE("CNSmlDmMMSAdapter::FetchObjectL(): end"); + return status; + } + +// ----------------------------------------------------------------------------- +// void StoreSettingsL() +// Stores the MMS settings to the phone. +// +// ----------------------------------------------------------------------------- +void CNSmlDmMMSAdapter::StoreSettingsL() + { + _DBG_FILE("CNSmlDmMMSAdapter::StoreSettingsL(): begin"); + if ( iMmsSettings && iMmsClient ) + { + iMmsSettings->SaveSettingsL(); + iMmsClient->SetSettingsL( *iMmsSettings ); + } + _DBG_FILE("CNSmlDmMMSAdapter::StoreSettingsL(): end"); + } + +// ----------------------------------------------------------------------------- +// CSmlDmAdapter::TError ValidateUriL( const TDesC8& aURI ) +// Validate URI, return error if not valid. +// +// ----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlDmMMSAdapter::ValidateUriL( const TDesC8& aURI ) + { + _DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): begin"); + CSmlDmAdapter::TError status = EOk; + TPtrC8 parentUri = RemoveLastURISeg(aURI); + switch ( NumOfURISegs( aURI ) ) + { + case 3: + if ( parentUri.Match( KNSmlDMMMSLevel3Parents ) != 0 ) + { + _DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): 3"); + status = ENotFound; + } + break; + case 5: + if ( parentUri.Match( KNSmlDMMMSLevel5Parents ) != 0 ) + { + _DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): 5"); + status = ENotFound; + } + break; + case 7: + if ( parentUri.Match( KNSmlDMMMSLevel7Parents1 ) != 0 && + parentUri.Match( KNSmlDMMMSLevel7Parents2 ) != 0) + { + _DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): 7"); + status = ENotFound; + } + break; + default: + status = ENotFound; + break; + + } + _DBG_FILE("CNSmlDmMMSAdapter::ValidateUriL(): end"); + return status; + } + +// ----------------------------------------------------------------------------- +// TImplementationProxy ImplementationTable[] +// Needed because of ECOM architecture +// ----------------------------------------------------------------------------- + +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KNSmlDMMMSAdapterImplUid, + CNSmlDmMMSAdapter::NewL) + }; + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy() +// Needed because of ECOM architecture +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& + aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmMMSAdapter: begin"); + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmMMSAdapter: end"); + return ImplementationTable; + } + + +//---------------------------------------------------------------------- +//TBool CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL(TUint32 aRecord) +//check for wap access point record lock status +//---------------------------------------------------------------------- + +TBool CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL(): BEGIN"); + + TBool ret = EFalse; + CCommsDbTableView* wapView; + DBG_ARGS8(_S8("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL record being checked = %d"),aRecord); + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), + aRecord); + + TInt aAccess( 0 ); + if(wapView!=NULL) + { + _DBG_FILE("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL():wap record exists, check for access type"); + TInt err = (((CCommsDbProtectTableView*) wapView )->GetRecordAccess( aAccess ) ); + DBG_ARGS8(_S8("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); + CleanupStack::PopAndDestroy( wapView); + if(aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlDmMMSAdapter::IsWAPAccessPointRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect wapaccesspoint record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect) + { + _DBG_FILE("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(): BEGIN"); + DBG_ARGS8(_S8("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL , record and protect value =%d = %d"),aRecord, aProtect); + TInt err = KErrNone; + + CCommsDbTableView* wapView; + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), + aRecord); + if( wapView != NULL ) + { + _DBG_FILE("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(): wap record exists"); + if( !aProtect ) + { + err = ( (CCommsDbProtectTableView*) wapView )->UnprotectRecord(); + DBG_ARGS8(_S8("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL ,error code of Unprotectrecord = %d"),err); + } + + else + { + err = ( (CCommsDbProtectTableView*) wapView )->ProtectRecord(); + DBG_ARGS8(_S8("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL ,error code of ProtectRecord = %d"),err); + } + + CleanupStack::PopAndDestroy( wapView); + } + + _DBG_FILE("CNSmlDmMMSAdapter::DoProtectWAPAccessRecordL(): END"); + return err; + } + + + + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/src/nsmldmmmsadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/src/nsmldmmmsadapter.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of dm adapters +* This is part of omadmextensions. +* +*/ + + +CHARACTER_SET UTF8 + +/* +* ============================================================================ +* Name : 101f6e36.rss +* Part of : SyncMl +* Interface: ecom / SmlDmAdapter +* Origin : SyncML Phase 2 +* Created : 06.03.2003 +* Implementation notes: +* +* Version : 0.1 +* $Revision: 4 $, $Modtime: 6.06.05 10:28 $ +* --------------------------------------------------------------------------- +* Version history: +* Template version: 1.02, 21.6.2000 by maparnan +* +* +* ============================================================================ +*/ + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F6E36; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F6E37; // DM MMS implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/bwins/mmstestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/bwins/mmstestu.def Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/conf/mmstest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/conf/mmstest.cfg Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,111 @@ +[Test] +title DDF +create mmstest foobar jee +foobar DDFStructure +delete foobar +[Endtest] + +[Test] +title StartAtomic +create mmstest foobar +foobar StartAtomic +delete foobar +[Endtest] + +[Test] +title CommitAtomic +create mmstest foobar +foobar CommitAtomic +delete foobar +[Endtest] + +[Test] +title RollbackAtomic +create mmstest foobar +foobar RollbackAtomic +delete foobar +[Endtest] + +[Test] +title UpdateMMSSAddr +create mmstest foobar +foobar UpdateLeaf MMS/MMSAcc/Con/DCon/MMSSAddr newname99 +delete foobar +[Endtest] + +[Test] +title UpdateMToNapIDL +create mmstest foobar +foobar UpdateLeaf MMS/MMSAcc/Con/DCon/MToNapID/Primary/MToNapIDL AP/APId000 +delete foobar +[Endtest] + +[Test] +title FetchNodemms +create mmstest foobar +foobar FetchNode MMS/MMSAcc/Con/DCon +delete foobar +[Endtest] + +[Test] +title FetchMMSSAddr +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/Con/DCon/MMSSAddr +delete foobar +[Endtest] + +[Test] +title FetchMToNapIDL +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/Con/DCon/MToNapID/Primary/MToNapIDL +delete foobar +[Endtest] + +[Test] +title FetchCreMode +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/CreMode +delete foobar +[Endtest] + +[Test] +title FetchDRepSnd +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/DRepSnd +delete foobar +[Endtest] + +[Test] +title FetchImgSize +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/ImgSize +delete foobar +[Endtest] + +[Test] +title FetchMMRecep +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/MMRecep +delete foobar +[Endtest] + +[Test] +title FetchMsgVal +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/MsgVal +delete foobar +[Endtest] + +[Test] +title FetchRcvAds +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/RcvAds +delete foobar +[Endtest] + +[Test] +title FetchRcvRep +create mmstest foobar +foobar FetchLeaf MMS/MMSAcc/RcvRep +delete foobar +[Endtest] diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/eabi/mmstestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/eabi/mmstestu.def Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,9 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI16CTestDmDDFObject @ 2 NONAME ; ## + _ZTI8Cdmatest @ 3 NONAME ; ## + _ZTI8CmmsTest @ 4 NONAME ; ## + _ZTV16CTestDmDDFObject @ 5 NONAME ; ## + _ZTV8Cdmatest @ 6 NONAME ; ## + _ZTV8CmmsTest @ 7 NONAME ; ## + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/group/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: + + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +mmstest.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/group/mmstest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/group/mmstest.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + +#include + +TARGET mmstest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE mmstest.def + +SOURCEPATH ../src +SOURCE dmatest.cpp +SOURCE TestDmDDFObject.cpp +SOURCE mmstest.cpp +SOURCE mmstestBlocks.cpp + + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + + +LIBRARY apgrfx.lib apmime.lib +LIBRARY euser.lib ecom.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY SWInstCli.lib +LIBRARY msgs.lib charconv.lib nsmldebug.lib +LIBRARY commdb.lib apengine.lib mmsserversettings.lib + +LANG SC + + + +SMPSAFE +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/group/mmstest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/group/mmstest.pkg Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,38 @@ +; +; Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Implementation of DM adapter test component +; This is part of omadmextensions/adapter test application. +; + +;*Languages +&EN +; +;*Standard SIS file header. This section specifies the package name, +;application UID, and version/build numbers. Add the package TYPE here if needed. +#{"mmstest"},(0x101FB3E8),1,0,1; +; + +;*Unique (Non-Localised) Vendor name +;This is used in combination with signing to prevent the unauthroized +;upgrade ofa a package by someone other than the rightful vendor. +:"Nokia" + +;*Localized Vendor Name +;This specifies the localised vendor name(s) correspodning to language(s). +%{"Nokia Test EN"} + +;*Files To Copy... +"\epoc32\release\armv5\urel\mmstest.dll" -"C:\sys\bin\mmstest.dll" +"..\conf\mmstest.cfg"-"C:\TestFramework\mmstest.cfg" +"..\init\mmstest.ini"-"C:\TestFramework\mmstest.ini" diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/inc/TestDmDDFObject.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef __TESTDMDDFOBJECT_H +#define __TESTDMDDFOBJECT_H + +// INCLUDES +//#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +class CStifLogger; + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class CTestDmDDFObject : public CBase, public MSmlDmDDFObject + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CTestDmDDFObject* NewL( CStifLogger *aLog ); + static CTestDmDDFObject* NewLC( CStifLogger *aLog ); + + /** + * Destructor. + */ + virtual ~CTestDmDDFObject(); + + public: // New functions + + /** + * ?member_description. + * @since Series ?XX ?SeriesXX_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + virtual void SetNameL( const TDesC8& aName ); + + void DumpL( const TDesC8& aParentName, TBool aFullDump = ETrue ); + void ExternalizeL(RWriteStream& aStream) const; + + + + public: // Functions from base classes + +//sf- ********************************* + + void SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ); + void SetDefaultValueL( const TDesC8& aDefaultValue ); + void SetDescriptionL( const TDesC8& aDescription ); + void SetDFFormatL( TDFFormat aFormat ); + void SetOccurenceL( TOccurence aOccurence ); + void SetScopeL( TScope aScope ); + void SetDFTitleL( const TDesC8& aTitle ); + void AddDFTypeMimeTypeL( const TDesC8& aMimeType ); + void SetAsObjectGroup(); + MSmlDmDDFObject& AddChildObjectL(const TDesC8& aNodeName); + MSmlDmDDFObject& AddChildObjectGroupL(); + +//sf- ############################# + + const TDesC8& Name(); + TSmlDmAccessTypes AccessTypes(); + const TDesC8& DefaultValue(); + const TDesC8& Description(); + TDFFormat DFFormat(); + TOccurence Occurence(); + TScope Scope(); + const TDesC8& DFTitle(); + const TDesC8& DFTypeMimeType(); + TBool ObjectGroup(); + + TInt ChildObjectCount(); + CTestDmDDFObject& ChildObject( TInt aIndex ); + + CTestDmDDFObject* FindChildObject( const TDesC8& aName ); + TInt SubObjectsCount(); + + + protected: // New functions + + /** + * ?member_description. + * @since Series ?XX ?SeriesXX_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CTestDmDDFObject( CStifLogger *aLog ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // CTestDmDDFObject( const CTestDmDDFObject& ); + // Prohibit assigment operator if not deriving from CBase. + // CTestDmDDFObject& operator=( const CTestDmDDFObject& ); + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + // ?one_line_short_description_of_data + //?data_declaration; + HBufC8* iName; + + TSmlDmAccessTypes iAccessTypes; + HBufC8* iDefaultValue; + HBufC8* iDescription; + TDFFormat iFormat; + TOccurence iOccurence; + TScope iScope; + HBufC8* iTitle; + HBufC8* iMimeType; + TBool iObjectGroup; + + RPointerArray iChildren; + + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + /** + * Logger. + */ + CStifLogger* iLog; + + }; + +#endif // __TESTDMDDFOBJECT_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/inc/dmatest.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef __DMA_TEST_H__ +#define __DMA_TEST_H__ + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include "nsmldmmmsadapter.h" + +class Cdmatest; + + +struct TMapping + { + TBuf8<256> iURI; + TBuf8<64> iLuid; + TMapping( const TDesC8 &aURI, const TDesC8 &aLuid ) : iURI( aURI ), iLuid( aLuid ) + { + + } + }; + +typedef RArray RMappingArray; + +typedef void (Cdmatest::* ResultsFunction)( TInt , CBufBase& , const TDesC8& ) ; + + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class Cdmatest : public CScriptBase, public MSmlDmCallback + { + + public: // Constructors and destructor + + /** + * Destructor. + */ + virtual ~Cdmatest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ) = 0; + + + public: + /** + The function is used to return the data in case of FetchLeafObjectL(), + FetchLeafObjectSizeL() and ChildURIListL() functions. It should not be + called where the DM command has failed, i.e. the error code returned in + SetStatusL is something other than EOk. + @param aResultsRef Reference to correct command + @param aObject The data which should be returned + @param aType MIME type of the object + @publishedPartner + @prototype + */ + void SetResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); + + /** + The function is used to return the data in case of FetchLeafObjectL() and + ChildURIListL() functions, where the size of the data being returned is + large enough for the Adapter to stream it. This function should not be + called when command was failed, i.e. the error code returned in SetStatusL + is something other than EOk. + @param aResultsRef Reference to correct command + @param aStream Large data which should be returned, DM engine + closes stream when it has read all the data + @param aType MIME type of the object + @publishedPartner + @prototype + */ + void SetResultsL( TInt /*aResultsRef*/, RReadStream*& /*aStream*/, + const TDesC8& /*aType*/ ) + { + + } + + /** + The function returns information about the Add,Update,Delete and Fetch + commands success to DM engine. The reference to correct command must be + used when calling the SetStatusL function, the reference is got from the + argument of the command functions. The SetStatusL function must be called + separately for every single command. + @param aStatusRef Reference to correct command + @param aErrorCode Information about the command success + @publishedPartner + @prototype + */ + void SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) ; + + /** + The function passes map information to DM Module. This function is called + for a new management object, both for node objects and for leaf objects. + In addition if ChildURIListL() function has returned new objects a mapping + information of the new objects must be passed. A mapping is treated as + inheritable. If the mapping is not set with this function, the mapping + LUID of the parent object is passed in following commands to the object. + @param aURI URI of the object. + @param aLUID LUID of the object. LUID must contain the all information, + which is needed for retrieve the invidual object from the + database. Typically it is ID for the database table. In + more complicated structures it can be combination of IDs, + which represent path to the object. + @publishedPartner + @prototype + */ + void SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ); + + /** + The function is used to make a fetch to other adapters. The most common + use is to make a fetch to the AP adapter, because when managing the access + points, the data comes as URI. For example, there are ToNAPId field in + some adapters, and data to it can be something like AP/IAPidx, and then + the link to AP adapter is needed. + Using FetchLinkL causes the DM Framework to make a Get request to the + appropriate DM adapter. The receiving adapter MUST complete the Get + request synchronously. + @param aURI URI of the object. + @param aData Reference to data, i.e. data is returned here + @param aStatus The status of fetch command is returned here + @publishedPartner + @prototype + */ + void FetchLinkL( const TDesC8& /*aURI*/, CBufBase& /*aData*/, + MSmlDmAdapter::TError& /*aStatus*/ ) + { + + } + + /** + The function returns the LUID which is mapped to aURI. If LUID is not + found, the function allocates a null length string, i.e. the function + allocates memory in every case. + @param aURI URI of the object. + @publishedPartner + @prototype + */ + HBufC8* GetLuidAllocL( const TDesC8& aURI ) ; + +#ifdef __TARM_SYMBIAN_CONVERGENCY + + void GetMappingInfoListL( const TDesC8& aURI, + CArrayFix& aSegmentList ); + +#else +// nothing +#endif + + protected: // New functions + + + void FetchNodeResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); + void SaveDataL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ) ; + + TPtrC8 LastURISeg( const TDesC8& aURI ); + TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); + TPtrC RemoveLastURISeg( const TDesC& aURI ); + void SetURIL( const TDesC& aURI ); + void SetURIL( const TDesC8& aURI ); + void SetURIL( HBufC8* aURI ); + HBufC8 *LoadFileLC( const TDesC &aFileName, TDataType &aType ); + HBufC8 *LoadFileLC( const TDesC8 &aFileName, TDataType &aType ); + HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); + HBufC8* GetLuidAllocLC( const TDesC8& aURI ) ; + TPtrC8 RemoveLastSeg(const TDesC8& aURI); + + TInt FetchNodeL( CStifItemParser& aItem ) ; + TInt FetchLeafL( CStifItemParser& aItem ) ; + TInt AddNodeL( CStifItemParser& aItem ); + TInt DeleteObjectL( CStifItemParser& aItem ); + TInt UpdateLeafL( CStifItemParser& aItem ) ; + TInt UpdateLeafDataL( CStifItemParser& aItem ) ; + TInt UpdateLeafDataURLL( CStifItemParser& aItem ) ; + + TInt ExecuteLeafL ( CStifItemParser& aItem ) ; + TInt ExecuteLeafDataL ( CStifItemParser& aItem ) ; + TInt StartAtomicL( CStifItemParser& aItem ) ; + TInt CommitAtomicL( CStifItemParser& aItem ) ; + TInt RollbackAtomicL( CStifItemParser& aItem ) ; + TInt CompleteCommandsL( CStifItemParser& aItem ); + TInt DDFStructureL( CStifItemParser& aItem ) ; +// TInt DeliverL( CStifItemParser& aItem ) ; +// TInt DetailsL( CStifItemParser& aItem ) ; +// TInt InstallL( CStifItemParser& aItem ) ; +// TInt BareInstallL( CStifItemParser& aItem ) ; + + protected: + + /** + * C++ default constructor. + */ + Cdmatest( CTestModuleIf& aTestModuleIf, TUid aUid ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // Cdmatest( const Cdmatest& ); + // Prohibit assigment operator if not deriving from CBase. + // Cdmatest& operator=( const Cdmatest& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + virtual void Delete(); + void LoadMappingsL(); + void SaveMappingsL(); + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + MSmlDmAdapter::TError iStatus ; + ResultsFunction iResultsFunction; + //CSmlDmAdapter *iAdapter ; + CNSmlDmMMSAdapter *iAdapter ; + HBufC8 *iURI; + CArrayFix *iEmptyMappingInfoArray; + TFileName iSaveFileName; + RMappingArray iMappingTable; + TUid iUid; + TInt iCounter; + //class CNSmlDmMgmtTree* iMgmtTree; + class CNSmlDmMgmtTree* iMgmtTree; + CNSmlDmMMSAdapter *Adapter() ; + }; + +#endif // __DMA_TEST_H__ + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/inc/mmstest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/inc/mmstest.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef TCTEST_H +#define TCTEST_H + +// INCLUDES +#include +#include +#include +#include +#include "dmatest.h" + +const TUint KNSmlmmsAdapterImplUid = 0x101F6E37; + + +const TUid KAdapterUid = + { + KNSmlmmsAdapterImplUid + }; +// Logging path +_LIT( KamtestLogPath, "\\logs\\testframework\\tctest\\" ); +// Log file +_LIT( KamtestLogFile, "tctest.txt" ); + + +// FORWARD DECLARATIONS +class CmmsTest; + + +// CLASS DECLARATION + +/** +* CmmsTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +class CmmsTest : public Cdmatest + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CmmsTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CmmsTest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + + private: + + /** + * C++ default constructor. + */ + CmmsTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + virtual void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ +/* virtual TInt ExampleL( CStifItemParser& aItem ) ; + virtual TInt DeliverL( CStifItemParser& aItem ) ; + virtual TInt DetailsL( CStifItemParser& aItem ) ; + virtual TInt InstallL( CStifItemParser& aItem ) ; + virtual TInt BareInstallL( CStifItemParser& aItem ) ;*/ + + + private: // Data + HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); + + + }; + +#endif // TCTEST_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/init/mmstest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/init/mmstest.ini Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,204 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +[New_Module] +ModuleName= testscripter +#DM +TestCaseFile= c:\testframework\mmstest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/src/TestDmDDFObject.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,516 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES + +#include "TestDmDDFObject.h" +#include "StifLogger.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::CTestDmDDFObject +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CTestDmDDFObject::CTestDmDDFObject( CStifLogger *aLog ) + : iName( 0 ) + , iAccessTypes() + , iDefaultValue( 0 ) + , iDescription( 0 ) + , iFormat( (TDFFormat)0 ) + , iOccurence( (TOccurence)0 ) + , iScope( (TScope)0 ) + , iTitle ( 0 ) + , iMimeType( 0 ) + , iObjectGroup( EFalse ) + , iLog( aLog ) +// RPointerArray iChildren; + { + } + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CTestDmDDFObject::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTestDmDDFObject* CTestDmDDFObject::NewL( CStifLogger *aLog ) + { + CTestDmDDFObject* self = CTestDmDDFObject::NewLC( aLog ); + CleanupStack::Pop( self ); + + return self; + } + +CTestDmDDFObject* CTestDmDDFObject::NewLC( CStifLogger *aLog ) + { + CTestDmDDFObject* self = new( ELeave ) CTestDmDDFObject( aLog ); + + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + + +// Destructor +CTestDmDDFObject::~CTestDmDDFObject() + { + delete iName; + delete iDefaultValue; + delete iDescription; + delete iTitle; + delete iMimeType; + iChildren.ResetAndDestroy(); + } + + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/*?type CTestDmDDFObject::?member_function( + ?arg_type arg, + ?arg_type arg ) + { + + ?code + + } +*/ + +void CTestDmDDFObject::SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ) + { + iLog->Log( _L8( "SetAccessTypesL, aAccessTypes=%d" ), aAccessTypes.GetACL() ); + iAccessTypes = aAccessTypes; + } + +void CTestDmDDFObject::SetDefaultValueL( const TDesC8& aDefaultValue ) + { + iLog->Log( _L8( "SetDefaultValueL, aDefaultValue='%S'" ), &aDefaultValue ); + delete iDefaultValue; + iDefaultValue = 0; + iDefaultValue = aDefaultValue.AllocL(); + } + +void CTestDmDDFObject::SetDescriptionL( const TDesC8& aDescription ) + { + iLog->Log( _L8( "SetDescriptionL, aDescription='%S'" ), &aDescription ); + delete iDescription; + iDescription = 0; + iDescription = aDescription.AllocL(); + } + +void CTestDmDDFObject::SetDFFormatL( TDFFormat aFormat ) + { + iLog->Log( _L8( "SetDFFormatL, aFormat=%d" ), aFormat ); + iFormat = aFormat; + } + +void CTestDmDDFObject::SetOccurenceL( TOccurence aOccurence ) + { + iLog->Log( _L8( "SetOccurenceL, aOccurence=%d" ), aOccurence ); + iOccurence = aOccurence; + } + +void CTestDmDDFObject::SetScopeL( TScope aScope ) + { + iLog->Log( _L8( "SetScopeL, aScope=%d" ), aScope ); + iScope = aScope; + } + +void CTestDmDDFObject::SetDFTitleL( const TDesC8& aTitle ) + { + iLog->Log( _L8( "SetDFTitleL, aTitle='%S'" ), &aTitle ); + delete iTitle; + iTitle = 0; + iTitle = aTitle.AllocL(); + } + +void CTestDmDDFObject::AddDFTypeMimeTypeL( const TDesC8& aMimeType ) + { + iLog->Log( _L8( "AddDFTypeMimeTypeL, aMimeType='%S'" ), &aMimeType ); + delete iMimeType; + iMimeType = 0; + iMimeType = aMimeType.AllocL(); + } + +void CTestDmDDFObject::SetAsObjectGroup() + { + iLog->Log( _L8( "SetAsObjectGroup, true" ) ); + iObjectGroup = ETrue; + } + +MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectL(const TDesC8& aNodeName) + { + iLog->Log( _L8( "AddChildObjectL, aNodeName='%S'" ), &aNodeName ); + CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); + child->SetNameL( aNodeName ); + iChildren.AppendL( child ); + CleanupStack::Pop( child ); // Don't destroy + return *child; + } + +MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectGroupL() + { + iLog->Log( _L8( "AddChildObjectGroupL, ''" ) ); + CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, KNullDesC ); + child->SetAsObjectGroup(); + iChildren.AppendL( child ); + CleanupStack::Pop( child ); // Don't destroy + return *child; + } + +// Own functions + +void CTestDmDDFObject::SetNameL( const TDesC8& aName ) + { + delete iName; + iName = 0; + iName = aName.AllocL(); + } + +void CTestDmDDFObject::DumpL( const TDesC8& aParentName, TBool aFullDump ) + { + TPtrC8 name( _L8("") ); + if (iName && iName->Length() > 0) + { + name.Set( *iName ); + } + + HBufC8* fullName = HBufC8::NewLC( aParentName.Length() + name.Length() + 1 ); + *fullName = aParentName; + if (aParentName.Length() > 0 && aParentName[ aParentName.Length() - 1 ] != '/') + { + fullName->Des().Append( _L8("/")); + } + fullName->Des().Append( name ); + + /* Translate some members to text for dumping */ + TBuf8<20> strAccessTypes; + TUint8 accessTypes = iAccessTypes.GetACL(); + if ((accessTypes & iAccessTypes.EAccessType_Add) != 0) + { + strAccessTypes.Append( _L8("A") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Copy) != 0) + { + strAccessTypes.Append( _L8("C") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Delete) != 0) + { + strAccessTypes.Append( _L8("D") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Exec) != 0) + { + strAccessTypes.Append( _L8("E") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Get) != 0) + { + strAccessTypes.Append( _L8("G") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Replace) != 0) + { + strAccessTypes.Append( _L8("R") ); + } + + TBuf8<20> strFormat; + switch( iFormat ) + { + case EB64: + strFormat = _L8("Base64"); + break; + case EBool: + strFormat = _L8("Bool"); + break; + case EChr: + strFormat = _L8("Chr"); + break; + case EInt: + strFormat = _L8("Int"); + break; + case ENode: + strFormat = _L8("Node"); + break; + case ENull: + strFormat = _L8("Null"); + break; + case EXml: + strFormat = _L8("Xml"); + break; + case EBin: + strFormat = _L8("Bin"); + break; + default: + break; + } + + + TBuf8<20> strOccurence; + switch( iOccurence ) + { + case EOne: + /** The node appears exactly once */ + strOccurence = _L8("M:1"); + break; + case EZeroOrOne: + /** The node is optional and may appear zero or once */ + strOccurence = _L8("O:0-1"); + break; + case EZeroOrMore: + /** The node is optional and may appear zero or more times */ + strOccurence = _L8("O:0-*"); + break; + case EOneOrMore: + /** The node is mandatory and may appear once or more times */ + strOccurence = _L8("M:1-*"); + break; + case EZeroOrN: + /** The node is optional and may appear between once and 'N' times */ + strOccurence = _L8("O:1-N"); + break; + case EOneOrN: + /** The node is mandatory and may appear between once and 'N' times */ + strOccurence = _L8("M:1-N"); + break; + default: + break; + } + + + TBuf8<20> strScope; + switch( iScope) + { + case EPermanent: + /** The node appears exactly once */ + strScope = _L8("Permanent"); + break; + case EDynamic: + /** The node is optional and may appear zero or once */ + strScope = _L8("O:Dynamic"); + break; + default: + break; + } + + + /* Dump main data */ + if (aFullDump) + { + iLog->Log( _L8( "DDFObject: '%S'" ), fullName ); + } + else + { + iLog->Log( _L8( "DDFObject: '%S' (%S), %S, %S, %S" ), + fullName, &strAccessTypes, &strFormat, &strOccurence, &strScope ); + } + + /* Dump members */ + if (aFullDump) + { + TPtrC8 empty( _L8( "" ) ); + #define CHK_NULL(a) ((a)==0?(TDesC8*)(&empty):(TDesC8*)(a)) + + iLog->Log( _L8( " iName=='%S'" ), iName ); + iLog->Log( _L8( " iAccessTypes=%d (%S)" ), iAccessTypes.GetACL(), &strAccessTypes ); + iLog->Log( _L8( " iDefaultValue='%S'" ), CHK_NULL(iDefaultValue)); + iLog->Log( _L8( " iDescription='%S'" ), CHK_NULL(iDescription )); + iLog->Log( _L8( " iFormat=%d (%S)" ), iFormat, &strFormat ); + iLog->Log( _L8( " iOccurence=%d (%S)" ), iOccurence, &strOccurence ); + iLog->Log( _L8( " iScope=%d (%S)" ), iScope, &strScope ); + iLog->Log( _L8( " iTitle='%S'" ), CHK_NULL(iTitle )); + iLog->Log( _L8( " iMimeType='%S'" ), CHK_NULL(iMimeType )); + iLog->Log( _L8( "----------------------------------" ) ); + } + + /* Dump children */ + for (TInt i = 0 ; i < iChildren.Count() ; i++) + { + iChildren[i]->DumpL( *fullName, aFullDump ); + } + + CleanupStack::PopAndDestroy( fullName ); + } + +/* +void CTestDmDDFObject::ExternalizeL(RWriteStream& aStream) const + { + X; + aStream << *iName << eol; + } +*/ + +const TDesC8& CTestDmDDFObject::Name() + { + return (iName != 0) ? *iName : KNullDesC8(); + } + +TSmlDmAccessTypes CTestDmDDFObject::AccessTypes() + { + return iAccessTypes; + } + +const TDesC8& CTestDmDDFObject::DefaultValue() + { + return (iDefaultValue != 0) ? *iDefaultValue : KNullDesC8(); + } + +const TDesC8& CTestDmDDFObject::Description() + { + return (iDescription != 0) ? *iDescription : KNullDesC8(); + } + +CTestDmDDFObject::TDFFormat CTestDmDDFObject::DFFormat() + { + return iFormat; + } + +CTestDmDDFObject::TOccurence CTestDmDDFObject::Occurence() + { + return iOccurence; + } + +CTestDmDDFObject::TScope CTestDmDDFObject::Scope() + { + return iScope; + } + +const TDesC8& CTestDmDDFObject::DFTitle() + { + return (iTitle != 0) ? *iTitle : KNullDesC8(); + } + +const TDesC8& CTestDmDDFObject::DFTypeMimeType() + { + return (iMimeType != 0) ? *iMimeType : KNullDesC8(); + } + +TBool CTestDmDDFObject::ObjectGroup() + { + return iObjectGroup; + } + +TInt CTestDmDDFObject::ChildObjectCount() + { + return iChildren.Count(); + } + +CTestDmDDFObject& CTestDmDDFObject::ChildObject( TInt aIndex ) + { + return *iChildren[aIndex]; + } + +CTestDmDDFObject* CTestDmDDFObject::FindChildObject( const TDesC8& aName ) + { + CTestDmDDFObject* foundObject = 0; + + for (TInt i = 0 ; i < iChildren.Count() ; i++) + { + if ( aName.CompareC( iChildren[i]->Name() ) == 0 ) + { + foundObject = iChildren[i]; + break; + } + } + + return foundObject; + } + +TInt CTestDmDDFObject::SubObjectsCount() + { + TInt count = 0; + + TInt i; + for (i = 0 ; i < iChildren.Count() ; i++) + { + count += iChildren[i]->SubObjectsCount(); + } + count += i; + + return count; + } + +/* +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ?function_name implements... +// ?implementation_description. +// Returns: ?value_1: ?description +// ?value_n: ?description +// ?description +// ----------------------------------------------------------------------------- +// +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg ) // ?description + { + + ?code + + } +*/ +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/src/dmatest.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,954 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include "dmatest.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "TestDmDDFObject.h" + +_LIT8( KEmptyType, "" ); +_LIT8( KDefaultType, "text/plain" ); +_LIT( KMappingTableFile, "\\dmtestmappings.txt" ); +//_LIT8( KNSmlDMSeparator8, "/" ); +const TUint8 KNSmlDMUriSeparator = 0x2f; //forward slash + +#define LEAVE_IF_ERROR(x,msg) \ + { TInt __xres = (x); if ( __xres < 0 ) { if ( iLog ) iLog->Log( (msg), __xres ); User::Leave( __xres ); } } + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cdmatest::Cdmatest +// C++ default constructor can NOT contain any code, that +// leave. +// ----------------------------------------------------------------------------- +// +Cdmatest::Cdmatest(CTestModuleIf& aTestModuleIf, TUid aUid ): + CScriptBase( aTestModuleIf ), iMappingTable(2), iUid( aUid ) + { + + } + +// ----------------------------------------------------------------------------- +// Cdmatest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cdmatest::ConstructL() + { + Adapter(); + iEmptyMappingInfoArray = new ( ELeave ) CArrayFixFlat(1); + + TRAPD( err, LoadMappingsL() ); + if (err != KErrEof && err != KErrNone && err != KErrNotFound) + { + User::Leave( err ); + } + } + +CNSmlDmMMSAdapter *Cdmatest::Adapter() + { + if ( iAdapter == NULL ) + { + if ( iLog ) + { + iLog->Log( _L( "Loading Adapter" ) ); + } + + TRAPD( err, iAdapter = (CNSmlDmMMSAdapter*) CSmlDmAdapter::NewL( iUid,*this ) ); + if ( err == KErrNone ) + { + if (iLog ) + { + iLog->Log( _L( "Loaded" ) ); + } + } + else + { + if (iLog) + { + iLog->Log( _L( "Failed to load adapter: %d" ), err ); + } + } + } + return iAdapter; + } + + +void Cdmatest::LoadMappingsL() + { + TDataType type; + HBufC8 *data = LoadFileLC( KMappingTableFile, type ); + RDesReadStream buf( *data ); + CleanupClosePushL( buf ); + + TInt len( data->Length() ); + while (buf.Source()->TellL( MStreamBuf::ERead ).Offset() < len) + { + TUint32 val = buf.ReadUint32L(); + TBuf8<256> uri; + TBuf8<64> luid; + buf.ReadL(uri, val); + val = buf.ReadUint32L(); + buf.ReadL(luid, val); + TMapping m( uri, luid ) ; + TInt err( iMappingTable.Append( m ) ); + if ( err == KErrNone ) + { + iLog->Log( _L8( "Loaded mapping: '%S' : '%S'"), &m.iURI, &m.iLuid ); + } + else + { + iLog->Log( _L8( "FAILED TO Load mapping: '%d' "), err ); + } + } + CleanupStack::PopAndDestroy( &buf); // buf + CleanupStack::PopAndDestroy( data ); // data + } + + + +void Cdmatest::SaveMappingsL() + { + TInt c( iMappingTable.Count() ); + if ( c > 0 ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFileWriteStream buf; + User::LeaveIfError( buf.Replace( fs, KMappingTableFile, EFileWrite ) ); + CleanupClosePushL( buf ); + + TInt i( 0 ) ; + do + { + buf.WriteUint32L( iMappingTable[i].iURI.Length() ); + buf.WriteL( iMappingTable[i].iURI ); + buf.WriteUint32L( iMappingTable[i].iLuid.Length() ); + buf.WriteL( iMappingTable[i].iLuid ); + } + while ( ++i < c ) ; + buf.CommitL(); + buf.Close(); + + CleanupStack::PopAndDestroy(); // buf + CleanupStack::PopAndDestroy(); // fs + } + } + + +// Destructor +Cdmatest::~Cdmatest() + { + // Delete resources allocated from test methods + TRAPD(err, SaveMappingsL() ); + if ( err != KErrNone ) + { + if(iLog) + iLog->Log( _L8( "Failed to save mappings!: %d"), err ); + } + Delete(); + + // Delete logger + delete iLog; + delete iEmptyMappingInfoArray; + delete iAdapter; + delete iURI; + iMappingTable.Reset(); + REComSession::FinalClose(); + } + + +// ----------------------------------------------------------------------------- +// Camatest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cdmatest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cdmatest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + + + +HBufC8 *Cdmatest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) + { + TPtrC nodename( KNullDesC ); + + TInt i( aItem.GetNextString ( nodename ) ); + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); + } + else + { + iLog->Log( _L("%S: %S"), &aName, &nodename); + } + + HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; + buf->Des().Copy( nodename ); + return buf; + } + +TInt Cdmatest::FetchNodeL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("FetchNodeL") ); + + iResultsFunction = FetchNodeResultsL; + + TPtrC8 nodename( GetNextStringLC( aItem, _L(" nodename" ) )->Des() ) ; + + SetURIL(nodename) ;// + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + Adapter()->ChildURIListL( *iURI, *luid, *iEmptyMappingInfoArray, 4, 5) ; + + if ( iStatus == MSmlDmAdapter::EOk ) + { + } + else + { + iLog->Log( _L("FetchNodeL: ChildUriList Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ) ; + CleanupStack::PopAndDestroy() ; // nodename + iLog->Log( _L("FetchNodeL: Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::StartAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->StartAtomicL() ) ; + iLog->Log( _L("StartAtomicL: Atomic started resulting error %d" ), err ); + return err; + } + +TInt Cdmatest::RollbackAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->RollbackAtomicL() ) ; + iLog->Log( _L("RollbackAtomicL: Atomic rolled back resulting error %d" ), err ); + return err; + } + +TInt Cdmatest::CommitAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->CommitAtomicL() ) ; + iLog->Log( _L("RollbackAtomicL: Atomic commited resulting error %d" ), err ); + return err; + } + + +TInt Cdmatest::DDFStructureL( CStifItemParser& /*aItem*/ ) + { + CTestDmDDFObject* ddfRoot = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); + + TRAPD( err, iAdapter->DDFStructureL( *ddfRoot ) ) ; + CleanupStack::PopAndDestroy( ddfRoot ); + iLog->Log( _L("DDFStructureL: method called resulting error %d" ), err ); + return err; + } + + +TInt Cdmatest::AddNodeL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("AddNodeL") ); + + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("nodename" ) )->Des() ) ; + SetURIL( nodename ); + + Adapter()->AddNodeObjectL( *iURI, KEmptyType, 8 ) ; + + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("AddNodeL: AddNodeObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("AddNodeL: AddNodeObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy() ; // nodename + iLog->Log( _L("AddNodeL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 data (GetNextStringLC( aItem, _L("datafile"))->Des() ); + + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + TDataType type; + + TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() ); + + /** + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + + Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); + + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy(); // loadfile + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // nodename + + iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret ); + + return ret; + } + + +TInt Cdmatest::UpdateLeafDataURLL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafDataL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 http (GetNextStringLC( aItem, _L("http"))->Des() ); + TPtrC8 url (GetNextStringLC( aItem, _L("rest of url"))->Des() ); + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + _LIT8( KTag, "://" ); + + HBufC8 *fullurl = HBufC8::NewLC( http.Length() + KTag().Length() + url.Length() ); + TPtr8 pfullurl( fullurl->Des() ); + pfullurl.Copy( http ) ; + pfullurl.Append( KTag ); + pfullurl.Append( url ); + TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + /** + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + Adapter()->UpdateLeafObjectL( *iURI , *luid, pfullurl, mimePtr, 3); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // + CleanupStack::PopAndDestroy( mime ); // mime + CleanupStack::PopAndDestroy(); // url + CleanupStack::PopAndDestroy(); // http + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::UpdateLeafDataL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("UpdateLeafDataL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 data (GetNextStringLC( aItem, _L("data"))->Des() ); + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + + SetURIL( nodename ); + + + TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + +// +// virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, +// const TDesC8& aObject, const TDesC8& aType, +// TInt aStatusRef ) = 0; +// + Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::FetchLeafL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("FetchLeafL") ); + + iResultsFunction = NULL; + + TInt i( 0 ); + TPtrC8 nodename ( GetNextStringLC( aItem, _L( "nodename" ) )->Des() ) ; + + //TPtrC datafile; + TPtrC datafile( KNullDesC ); + i = aItem.GetNextString ( datafile ) ; + if ( i != KErrNone ) + { + iLog->Log(_L("FetchLeafL: ERROR Reading outfile argument: 0x%X"), i ); + //return i; + } + else + { + iSaveFileName = datafile; + iLog->Log( _L( " Save file nameis '%S'" ), &iSaveFileName ); + iResultsFunction = SaveDataL; + } + + SetURIL(nodename) ; + + /* + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + */ + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->FetchLeafObjectL( *iURI, *luid, KEmptyType, 7, 8 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("FetchLeafL: FetchLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("FetchLeafL: FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); + CleanupStack::PopAndDestroy( ); // nodename + iLog->Log( _L("FetchLeafL Test Complete with status %d" ), ret ); + return ret; + } + + +TInt Cdmatest::ExecuteLeafL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + TPtrC8 data( GetNextStringLC ( aItem, _L("Input file") )->Des() ) ; + + SetURIL(nodename) ; + + /* + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + TDataType type; + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("ExecuteLeafL: ExecuteCommandL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("ExecuteLeafL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + + iLog->Log( _L("ExecuteLeafL: Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::CompleteCommandsL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->CompleteOutstandingCmdsL() ); + delete iAdapter; + iAdapter = NULL; + return err; + } +TInt Cdmatest::DeleteObjectL( CStifItemParser& aItem ) +{ + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("DeleteObjectL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + + SetURIL(nodename) ; + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + Adapter()->DeleteObjectL( *iURI, *luid, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("DeleteNode: DeleteObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("DeleteNode: DeleteObjectL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); + + return ret; +} + +TInt Cdmatest::ExecuteLeafDataL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + TPtrC8 data( GetNextStringLC ( aItem, _L("Input data") )->Des() ) ; + + SetURIL(nodename) ; + + /* + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + HBufC8 *luid = GetLuidAllocLC( *iURI ); + Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + + +HBufC8 *Cdmatest::LoadFileLC( const TDesC &aFileName, TDataType &aType ) + { + RFs fs ; + LEAVE_IF_ERROR( fs.Connect(), _L( "Could not connect fileserver: %d" ) ); + + CleanupClosePushL( fs ); + RFile file ; + LEAVE_IF_ERROR( file.Open(fs,aFileName,EFileRead), _L( "Could not open file: %d" ) ); + + + + CleanupClosePushL( file ); + TInt dataSize ; + LEAVE_IF_ERROR( file.Size( dataSize ), _L( "Could not get file size: %d" ) ); + HBufC8 *nodedata = HBufC8::NewL ( dataSize ); + CleanupStack::PushL( nodedata ); + TPtr8 nodedataptr( nodedata->Des() ); + LEAVE_IF_ERROR( file.Read( nodedataptr ), _L( "Could not read file: %d" ) ); + TDataRecognitionResult aDataType; + RApaLsSession ls ; + TInt err( ls.Connect() ); + if ( err == KErrNone ) + { + CleanupClosePushL( ls ); + err = ls.RecognizeData(aFileName, nodedataptr, aDataType) ; + if ( err == KErrNone ) + { + aType = aDataType.iDataType; + } + else + { + iLog->Log( _L("LoadFileLC: WARNING Failed to get type: %d" ), err ); + aType = TDataType( KDefaultType ); + } + CleanupStack::PopAndDestroy( &ls ); + } + else + { + iLog->Log( _L("LoadFileLC: WARNING Failed to connect rapalssession: %d" ), err ); + } + CleanupStack::Pop( nodedata ); + CleanupStack::PopAndDestroy( &file ); + CleanupStack::PopAndDestroy( &fs ); + CleanupStack::PushL( nodedata ); + return nodedata ; + } + +HBufC8 *Cdmatest::LoadFileLC( const TDesC8 &aFileName, TDataType &aType ) + { + TFileName fn ; + fn.Copy( aFileName ); + return LoadFileLC( fn, aType ); + } + + +void Cdmatest::SaveDataL( TInt /*aResultsRef*/, CBufBase& aObject, + const TDesC8& aType ) + { + iLog->Log( _L8( "Saving data of type: '%S'" ), &aType ); + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFile file; + User::LeaveIfError( file.Replace ( fs, iSaveFileName, EFileWrite ) ); + CleanupClosePushL( file ); + TPtrC8 p( aObject.Ptr( 0 ) ); + User::LeaveIfError( file.Write( p ) ); + CleanupStack::PopAndDestroy( 2 ); // file, fs + } + + + +void Cdmatest::FetchNodeResultsL( TInt /*aResultsRef*/, CBufBase& aObject, + const TDesC8& /*aType*/ ) + { + TPtrC8 ptr( aObject.Ptr( 0 ) ); + iLog->Log( _L8("FetchNodeResultsL for '%S': '%S'" ), iURI, &ptr ); + + if ( ptr.Length() > 0 ) + { + TPtrC8 last( LastURISeg( ptr ) ); + HBufC8 *oldUri = HBufC8::NewL( iURI->Length() ); + (*oldUri) = *iURI; + do + { + iLog->Log ( _L8( " Node: '%S' "), &last ); + HBufC8 *nUri = HBufC8::NewLC( oldUri->Length() + 1 + last.Length() ); + nUri->Des().Copy( *oldUri ) ; + nUri->Des().Append( '/' ); + nUri->Des().Append( last ); + + SetURIL( nUri ); + //iResultsFunction = FetchNodeResultsL; + + //TPtrC8 parentURI(RemoveLastSeg(*nUri)); + //HBufC8 *luid = GetLuidAllocLC( parentURI ); + CleanupStack::Pop( nUri ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + Adapter()->ChildURIListL( *nUri, KNullDesC8, *iEmptyMappingInfoArray, 4, 5 );//Dipak + + CleanupStack::PopAndDestroy( luid ); + + ptr.Set( RemoveLastURISeg( ptr ) ); + last.Set( LastURISeg( ptr ) ); + + } + while (last != KNullDesC8); + } + + } + + + +TPtrC8 Cdmatest::LastURISeg( const TDesC8& aURI ) + { + TInt i; + for( i = aURI.Length() - 1; i >= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + if( i == 0 ) + { + return aURI; + } + else + { + return aURI.Mid( i+1 ); + } + } +TPtrC8 Cdmatest::RemoveLastSeg(const TDesC8& aURI) + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMUriSeparator) + { + break; + } + } + + if(i>0) + { + return aURI.Left(i); + } + else + { + return KNullDesC8(); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 Cdmatest::RemoveLastURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 Cdmatest::RemoveLastURISeg( const TDesC8& aURI ) + { + TInt i; + for ( i = aURI.Length() - 1; i >= 0 ; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if ( i > -1 ) + { + return aURI.Left( i ); + } + else + { + return KNullDesC8(); + } + } + +TPtrC Cdmatest::RemoveLastURISeg( const TDesC& aURI ) + { + TInt i; + for ( i = aURI.Length() - 1; i >= 0 ; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if ( i > -1 ) + { + return aURI.Left( i ); + } + else + + { + return KNullDesC(); + } + } + +void Cdmatest::SetURIL( const TDesC& aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = HBufC8::NewL( aURI.Length() ) ; + iURI->Des().Copy( aURI ); + } + +void Cdmatest::SetURIL( const TDesC8& aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = HBufC8::NewL( aURI.Length() ) ; + iURI->Des().Copy( aURI ); + } + +void Cdmatest::SetURIL( HBufC8* aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = aURI ; + } + + + +void Cdmatest::SetResultsL( + TInt aResultsRef, + CBufBase& aObject, + const TDesC8& aType ) + { + TPtrC8 ptr( aObject.Ptr(0) ); + iLog->Log( _L8( "SetResults, ref=%d, object='%S', type='%S'" ), aResultsRef, &ptr, &aType ); + if ( iResultsFunction ) + { + (this->*iResultsFunction)( aResultsRef, aObject, aType ); + iResultsFunction = NULL ; + } + + } + + +void Cdmatest::SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) + { + iStatus = aErrorCode ; + iLog->Log( _L( "SetStatusL, ref=%d, code=%d" ), aStatusRef, aErrorCode ); + + + } + +void Cdmatest::SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ) + { + iLog->Log( _L8( "SetMappingL, aURI='%s', aLUID='%s'" ), aURI.Ptr(), aLUID.Ptr() ); + + iMappingTable.Append(TMapping( aURI, aLUID ) ) ; + } + +HBufC8* Cdmatest::GetLuidAllocL( const TDesC8& aURI ) + { + iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); + HBufC8 *res = NULL; + for( TInt i(0); i < iMappingTable.Count(); i++ ) + { + if ( aURI == iMappingTable[i].iURI ) + { + res = iMappingTable[i].iLuid.AllocL(); + } + } + if ( res == NULL ) + { + res = HBufC8::NewL( 0 ); + } + iLog->Log( _L8( "GetLuidAllocL, response='%S'" ), res ); + return res; + } + +HBufC8* Cdmatest::GetLuidAllocLC( const TDesC8& aURI ) + { + iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); + HBufC8 *res = NULL; + for( TInt i(0); i < iMappingTable.Count(); i++ ) + { + if ( aURI == iMappingTable[i].iURI ) + { + res = iMappingTable[i].iLuid.AllocLC(); + break; + } + } + if ( res == NULL ) + { + res = HBufC8::NewLC( 0 ); + } + iLog->Log( _L8( "GetLuidAllocLC, response='%S'" ), res ); + return res ; + } + +#ifdef __TARM_SYMBIAN_CONVERGENCY + +void Cdmatest::GetMappingInfoListL( const TDesC8& /*aURI*/, + CArrayFix& /*aSegmentList*/ ) + { + // do nothing + } + +#else +// nothing +#endif +//*************************************************************************** +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/src/mmstest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/src/mmstest.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include "mmsTest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CmmsTest::CmmsTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +/*CmmsTest::CmmsTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + }*/ +CmmsTest::CmmsTest( CTestModuleIf& aTestModuleIf ) + : Cdmatest( aTestModuleIf, KAdapterUid ) + { + } +// ----------------------------------------------------------------------------- +// CmmsTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CmmsTest::ConstructL() + { +/* iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse );*///Commented the Part for mmsTest Dipak + iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile ); + + iLog->Log( _L( "Loading Adapter" ) ); + + Cdmatest::ConstructL(); + + } + +// ----------------------------------------------------------------------------- +// CmmsTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CmmsTest* CmmsTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CmmsTest* self = new (ELeave) CmmsTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CmmsTest::~CmmsTest() + { + + // Delete resources allocated from test methods +// Delete(); + + // Delete logger +// delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CmmsTest::NewL( aTestModuleIf ); + + } + + + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/mms/tsrc/src/mmstestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/mms/tsrc/src/mmstestBlocks.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include +#include +#include "mmsTest.h" +#include +#include +#include + + +//using namespace NApplicationManagement;//Dipak + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CmmsTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CmmsTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CmmsTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CmmsTest::RunMethodL( + CStifItemParser& aItem ) + { + + TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "DDFStructure", CmmsTest::DDFStructureL), + ENTRY( "FetchNode", CmmsTest::FetchNodeL ), + ENTRY( "FetchLeaf", CmmsTest::FetchLeafL ), + ENTRY( "AddNode", CmmsTest::AddNodeL ), + ENTRY( "UpdateLeaf", CmmsTest::UpdateLeafL ), + ENTRY( "UpdateLeafData", CmmsTest::UpdateLeafDataL ), + ENTRY( "Execute", CmmsTest::ExecuteLeafL ), + ENTRY( "ExecuteData", CmmsTest::ExecuteLeafDataL ), + ENTRY( "DeleteNode", CmmsTest::DeleteObjectL ), + ENTRY( "StartAtomic", CmmsTest::StartAtomicL), + ENTRY( "CommitAtomic", CmmsTest::CommitAtomicL), + ENTRY( "RollbackAtomic", CmmsTest::RollbackAtomicL), + ENTRY( "CompleteCommands", CmmsTest::CompleteCommandsL), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + + +HBufC8 *CmmsTest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) + { + TPtrC nodename; + nodename.Set( KNullDesC ); + + TInt i( aItem.GetNextString ( nodename ) ); + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); + } + else + { + iLog->Log( _L("%S: %S"), &aName, &nodename); + } + + HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; + buf->Des().Copy( nodename ); + + return buf; + } + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/group/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project nsmldmalwaysonadapter +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + + +PRJ_MMPFILES +nsmldmalwaysonadapter.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/group/nsmldmalwaysonadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/group/nsmldmalwaysonadapter.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project nsmldmalwaysonadapter +* +*/ + +#include +#include + +TARGET nsmldmalwaysonadapter.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x101f6d36 + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE nsmldmalwaysonadapter.cpp +SOURCE nsmldmalwaysonsettingstore.cpp + +START RESOURCE nsmldmalwaysonadapter.rss +END + +USERINCLUDE ../inc + +//Default system include paths for middleware layer modules +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib ecom.lib charconv.lib flogger.lib +LIBRARY centralrepository.lib diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/inc/logger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/inc/logger.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides logging services. +* +*/ + + +#ifndef ALWAYSONLOGGER_H +#define ALWAYSONLOGGER_H + +#ifdef _DEBUG + // 0 = No logging, +#define LOGGING_METHOD 1 // 1 = Flogger, + // 2 = RDebug +#else + +#define LOGGING_METHOD 0 // No logging in UREL builds + +#endif // _DEBUG + + +#if LOGGING_METHOD == 1 // Flogger + +#include +_LIT(KLOGFolder,"ALWAYSONADAPTER"); +_LIT(KLOGFile,"ALWAYSONADAPTER.txt"); + +#define LOGTEXT(x)\ + {\ + RFileLogger::Write(KLOGFolder(),KLOGFile(),EFileLoggingModeAppend,\ + x);\ + } + +#define LOGSTRING(x)\ + {\ + _LIT8(tempLogDes,x);\ + RFileLogger::Write(KLOGFolder(),KLOGFile(),EFileLoggingModeAppend,\ + tempLogDes());\ + } + +#define LOGSTRING2(x,y)\ + { _LIT8(tempLogDes,x);\ + RFileLogger::WriteFormat(KLOGFolder(),\ + KLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),y);\ + } + +#define LOGSTRING3(x,y,z)\ + { _LIT8(tempLogDes,x);\ + RFileLogger::WriteFormat(KLOGFolder(),\ + KLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),y,z);\ + } + +#define LOGSTRING4(w,x,y,z)\ + { _LIT8(tempLogDes,w);\ + RFileLogger::WriteFormat(KLOGFolder(),\ + KLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),x,y,z);\ + } + + +#elif _LOGGING_METHOD == 2 // RDebug + +#include + +#define LOGSTRING(x) RDebug::Print(x); +#define LOGSTRING(x) RDebug::Print(_L(x)); +#define LOGSTRING2(x,y) RDebug::Print(_L(x),y); +#define LOGSTRING3(x,y,z) RDebug::Print(_L(x),y,z); +#define LOGSTRING4(w,x,y,z) RDebug::Print(_L(w),x,y,z); + +#else // LOGGING_METHOD == 0 or invalid + +#define LOGSTRING(x) +#define LOGSTRING(x) +#define LOGSTRING2(x,y) +#define LOGSTRING3(x,y,z) +#define LOGSTRING4(w,x,y,z) + +#endif // LOGGING_METHOD + +#endif // ALWAYSONLOGGER_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,581 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM adapter for handling always-on settings. +* +*/ + + +#ifndef NSMLDMALWAYSONADAPTER_H +#define NSMLDMALWAYSONADAPTER_H + +#include + +#include "nsmldmalwaysonsettingstore.h" + +class CSmlDmAOCommandElement; +class CNSmlDmAOSettingStore; + +// The DDF version must be changed if any changes in DDF structure +// ( built in DDFStructureL() function ) +_LIT8( KNSmlDmAOAdapterDDFVersion, "1.0" ); +_LIT8( KNSmlDmAOAdapterTextPlain, "text/plain" ); + +// Names of the nodes +// When updating KNSmlDmAOAdapterAOURI also update +// KNSmlDmAOAdapterURIMaxLength! */ +_LIT8(KNSmlDmAOAdapterAOURI, "./VENDORCONFIG"); +_LIT8(KNSmlDmAOAdapterAO, "VENDORCONFIG"); +_LIT8(KNSmlDmAOAdapterName, "NAME"); +_LIT8(KNSmlDmAOAdapterAwonPdpc, "AWON-PDPC"); +_LIT8(KNSmlDmAOAdapterTRetry, "T-RETRY"); + + +// Descriptions of the nodes +_LIT8( KNSmlDmAOAdapterAODescription, + "Always-on provides management of connections"); +_LIT8( KNSmlDmAOAdapterNameDescription, + "Name of the VENDORCONFIG"); +_LIT8( KNSmlDmAOAdapterAwonPdpcDescription, + "Always-on setting in home and visited network"); +_LIT8( KNSmlDmAOAdapterTRetryDescription, + "T-Retry timer interval"); + +// Leaf nodes of VENDORCONFIG node +_LIT8( KNSmlDmAOAllLeafNodes, + "NAME/AWON-PDPC/T-RETRY"); + +// URI segment separator +// When updating this literal also update +// KNSmlDmAOAdapterAPURIMaxLength and KNSmlDmAOAdapterURIMaxLength! +_LIT8( KNSmlDmAOSeparator, "/" ); + +// URI segment separator +// When updating KNSmlDmAOAdapterAOURI also update +// KNSmlDmAOAdapterAPURIMaxLength and KNSmlDmAOAdapterURIMaxLength! +_LIT8( KNSmlDmAOUriListSeparator, "," ); + +// Prefix in URIs (removed for LUID mapping) +_LIT8( KNSmlDmAOAdapterURIPrefix, "./" ); + +// Name prefix for unnamed VENDORCONFIG nodes +_LIT8( KNSmlDmAONamePrefix, "VENDORCONFIG" ); + +const TInt KNSmlDmAOGranularity = 4; +const TInt KNSmlDmAOInvalidRef = -1; + +// Maximum length of VENDORCONFIG URI including a separator +// character in URI List. Node is not calculated here. +// KNSmlDmAOAdapterAOURI + KNSmlDmAOSeparator + KNSmlDmAOUriListSeparator +const TInt KNSmlDmAOAdapterURIMaxLength = 16; + +/** + * Always-on device management adapter + * + * Always-on device management adapter manages settings + * related to VENDORCONFIG. + * + * @lib nsmldmalwaysonadapter + * @since S60 v3.2 + */ +class CNSmlDmAOAdapter : public CSmlDmAdapter + { + +public: + +/** Possible command types */ +enum TCommandType + { + EAddCmd, + EGetCmd, + EGetSizeCmd, + EDeleteCmd + }; + + + static CNSmlDmAOAdapter* NewL( MSmlDmCallback* aDmCallback ); + + virtual ~CNSmlDmAOAdapter(); + + +// from base class CSmlDmAdapter + + /** + * The function returns current version of the DDF. + * + * @since S60 v3.2 + * @param aVersion DDF version of the + * adapter. (filled by the adapter) + */ + void DDFVersionL( CBufBase& aDDFVersion ); + + /** + * The function for filling the DDF structure of the adapter + * + * @since S60 v3.2 + * @param aDDFObject Reference to root object. + */ + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + /** + * The function creates new leaf objects, or replaces data in existing + * leaf objects. The information about the success of the command is + * returned by calling SetStatusL function of MSmlDmCallback callback + * interface. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @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 TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ); + /** + * The function deletes an object and its child objects. + * + * @since S60 v3.2 + * @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 TDesC8& aURI, const TDesC8& aLUID, + TInt aStatusRef ); + + /** + * The function fetches data of a leaf object. The SetStatusL is used + * as described in UpdateLeafObjectL(). The data is returned by using the + * SetResultsL function of MSmlCallback callback interface. + * + * @since S60 v3.2 + * @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 TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + + /** + * The function fetches the size of the data of a leaf object. The size + * is in bytes, and must reflect the number of bytes that will be + * transferred when the framework calls FetchLeafObjectL. + * + * @since S60 v3.2 + * @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 FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + 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 + * MSmlCallback callback interface. + * + * @since S60 v3.2 + * @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 aPreviousURISegmentList URI list with mapping LUID + * information, which is known by DM + * engine. + * @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 TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef ); + + /** + * The function adds node object. + * + * @since S60 v3.2 + * @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 TDesC8& aURI, const TDesC8& aParentLUID, + TInt aStatusRef ); + /** + * The adapter does not support streaming and no implementation is + * provided for this function. + * + * @since S60 v3.2 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream 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 TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support execute command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aURI URI of the command + * @param aLUID LUID of the object + * @param aArgument Argument for the command + * @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 ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support execute command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aURI URI of the command + * @param aLUID LUID of the object + * @param aStream Argument for the command. + * @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 ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ); + /** + * The adapter does not support copy command and does not + * provide implementation for this function. + * + * @since S60 v3.2 + * @param aTargetURI Target URI for the command + * @param aSourceLUID LUID of the target object + * @param aSourceURI Source URI for the command + * @param aSourceLUID LUID of the source object + * @param aType MIME type of the objects + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + */ + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + /** + * Not supported + * @since S60 v3.2 + */ + void StartAtomicL(); + /** + * Not Supported + * @since S60 v3.2 + * + */ + void CommitAtomicL(); + /** + * Not supported. + * @since S60 v3.2 + */ + void RollbackAtomicL(); + /** + * Returns EFalse as the adapter does not support streaming + * + * @since S60 v3.2 + * @param aItemSize size limit for stream usage + * @return TBool EFalse as streaming is not supported + */ + TBool StreamingSupport( TInt& aItemSize ); + /** + * Not supported + * + * @since S60 v3.2 + */ + void StreamCommittedL(); + /** + * The function tells the adapter that all the commands of the message + * that can be passed to the adapter have now been passed. This + * indciates that the adapter must supply status codes and results to + * any buffered commands. This must be done at latest by the time this + * function returns. This function is used at the end of SyncML messages, + * and during processing of Atomic. + * + * @since S60 v3.2 + */ + void CompleteOutstandingCmdsL(); + + /** + * Converts integer to 8bit descriptor + * + * @since S60 v3.2 + * @param aLuid The integer to be converted + * @return The Integer as a descriptor + */ + HBufC8* IntToDes8L( TInt aLuid) const; + + /** + * Converts 8bit descriptor to integer + * + * @since S60 v3.2 + * @param aLuid The descriptor to be converted + * @return Integer value of the descriptor + */ + TUint DesToIntL(const TDesC8& aLuid) const; + + +private: + + /** + * Constructor + */ + CNSmlDmAOAdapter(); + + /** + * Constructor + * @param aDmCallback Callback object to the framework + */ + CNSmlDmAOAdapter( MSmlDmCallback* aDmCallback ); + + /** + * Second phase constructor + */ + void ConstructL(); + + /** + * Parses the last URI segment from URI + * @param aURI The whole URI + * @return The last URI segment + */ + TPtrC8 LastURISeg(const TDesC8& aURI) const; + + +private: //data + + /** + * Setting store object, which is called for managing settings + * in CommsDat. Own. + */ + CNSmlDmAOSettingStore * iSettingStore; + + }; + + +/** + * CSmlDmAOCommandElement + * + * Helper class, which stores a single command for a VENDORCONFIG. + * @lib nsmldmalwaysonadapter + * @since S60 v3.2 + */ + +class CSmlDmAOCommandElement : public CBase + { + +public: + + static CSmlDmAOCommandElement* NewLC( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmAOAdapter::TCommandType aCmdType, + const TDesC8& aLastUriSeg, + const TDesC8& aData ); + + ~CSmlDmAOCommandElement(); + + /** + * Returns the iExecuted member value of the object + * + * @since S60 v3.2 + * @return The iExecuted member value of the object + */ + inline TBool Executed(); + + /** + * Sets the iExecuted member value of the object + * + * @since S60 v3.2 + * @param aExecuted Executed value for the object. + */ + inline void SetExecuted( TBool aExecuted ); + + /** + * Returns the iStatus member value of the object + * + * @since S60 v3.2 + * @return The iStatus value of the object + */ + inline CSmlDmAdapter::TError Status(); + + /** + * Sets the iStatus member value of the object + * + * @since S60 v3.2 + * @param aStatus Status value for the object. + */ + inline void SetStatus( CSmlDmAdapter::TError aStatus ); + + /** + * Returns the iLeaf member value of the object + * + * @since S60 v3.2 + * @return The iLeaf member value of the object + */ + inline TBool Leaf(); + + /** + * Returns the iStatusRef member value of the object + * + * @since S60 v3.2 + * @return The iStatusRef member value of the object + */ + inline TInt StatusRef(); + + /** + * Returns the iResultRef member value of the object + * + * @since S60 v3.2 + * @return The iResultRef member value of the object + */ + inline TInt ResultRef(); + + /** + * Returns the iCmdType member value of the object + * + * @since S60 v3.2 + * @return The iCmdType member value of the object + */ + inline CNSmlDmAOAdapter::TCommandType CmdType(); + + /** + * Returns the iData member value of the object + * + * @since S60 v3.2 + * @return The iData member value of the object + */ + inline const HBufC8* Data(); + + /** + * Returns the iLastUriSeg member value of the object + * + * @since S60 v3.2 + * @return The iLastUriSeg member value of the object + */ + inline const HBufC8* LastUriSeg(); + + /** + * Sets the iData member value of the object + * + * @since S60 v3.2 + * @param aData Data set to the object. The data will be owned by + * the command object. + */ + inline void SetData( HBufC8* aData ); + +private: + + CSmlDmAOCommandElement( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmAOAdapter::TCommandType aCmdType ); + + void ConstructL( const TDesC8& aLastUriSeg, const TDesC8& aData ); + + +private: //data + + /** + * Has command been executed. + * Set to ETrue when command is executed. + */ + TBool iExecuted; + + /** + * The execution status of an exeuted command. + * Filled in when command is executed. + */ + CSmlDmAdapter::TError iStatus; + + + /** + * True if commend is for a leaf node, False if it is for a NAPDEF node. + */ + const TBool iLeaf; + + /** + * Reference for returning the status to DM framework. + */ + const TInt iStatusRef; + + /** + * Reference for returning result of Get command to the DM framework. + */ + const TInt iResultRef; + + /** + * Type of command. + */ + const CNSmlDmAOAdapter::TCommandType iCmdType; + + + /** + * Data which is either ment to be stored to setting store + * or which has been fetched from there. + */ + HBufC8* iData; + + /** + * Last segment in the command URI, which indicates the leaf node + * in question. For non leaf command empty string. + */ + HBufC8* iLastUriSeg; + + }; + +#include "nsmldmalwaysonadapter.inl" + +#endif // NSMLDMALWAYSONADAPTER_H diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.inl Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains implementations of inline functions. +* +*/ + + +// ----------------------------------------------------------------------------- +// Returns the iExecuted member of the object +// ----------------------------------------------------------------------------- +// +TBool CSmlDmAOCommandElement::Executed() + { + return iExecuted; + } + +// ----------------------------------------------------------------------------- +// Returns the iStatus member of the object +// ----------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CSmlDmAOCommandElement::Status() + { + return iStatus; + } + +// ----------------------------------------------------------------------------- +// Returns the iLeaf member of the object +// ----------------------------------------------------------------------------- +// +TBool CSmlDmAOCommandElement::Leaf() + { + return iLeaf; + } + +// ----------------------------------------------------------------------------- +// Returns the iStatusRef member of the object +// ----------------------------------------------------------------------------- +// +TInt CSmlDmAOCommandElement::StatusRef() + { + return iStatusRef; + } + +// ----------------------------------------------------------------------------- +// Returns the iResultRef member of the object +// ----------------------------------------------------------------------------- +// +TInt CSmlDmAOCommandElement::ResultRef() + { + return iResultRef; + } + +// ----------------------------------------------------------------------------- +// Returns the iCmdType member of the object +// ----------------------------------------------------------------------------- +// +CNSmlDmAOAdapter::TCommandType CSmlDmAOCommandElement::CmdType() + { + return iCmdType; + } + +// ----------------------------------------------------------------------------- +// Returns the iData member of the object +// ----------------------------------------------------------------------------- +// +const HBufC8* CSmlDmAOCommandElement::Data() + { + return iData; + } + +// ----------------------------------------------------------------------------- +// Returns the iLastUriSeg member of the object +// ----------------------------------------------------------------------------- +// +const HBufC8* CSmlDmAOCommandElement::LastUriSeg() + { + return iLastUriSeg; + } + +// ----------------------------------------------------------------------------- +// Sets the iExecuted member of the object +// ----------------------------------------------------------------------------- +// +void CSmlDmAOCommandElement::SetExecuted( TBool aExecuted ) + { + iExecuted = aExecuted; + } + +// ----------------------------------------------------------------------------- +// Sets the iStatus member of the object +// ----------------------------------------------------------------------------- +// +void CSmlDmAOCommandElement::SetStatus( CSmlDmAdapter::TError aStatus ) + { + iStatus = aStatus; + } + + +// ----------------------------------------------------------------------------- +// Sets the iData member of the object. Ownership of aData argument will be +// transfered to the CSmlDmAOCommandElement +// ----------------------------------------------------------------------------- +// +void CSmlDmAOCommandElement::SetData( HBufC8* aData ) + { + iData = aData; + } + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonsettingstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonsettingstore.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Manages always-on settings in Central Repository. +* +*/ + + +#ifndef NSMLDMALWAYSONSETTINGSTORE_H +#define NSMLDMALWAYSONSETTINGSTORE_H + +#include "nsmldmalwaysonadapter.h" + +#include + +const TInt KDefaultLuid = 1; + +class CNSmlDmAOAdapter; +class CSmlDmAOCommandElement; + +/** + * Setting Store is used for managing settings in CentralRepository + * + * The class provides functions for executing commands + * and sets of commands that involve manipulation of + * data in CentralRepository. + * + * @lib nsmldmalwaysonadapter + * @since S60 v3.2 + */ +class CNSmlDmAOSettingStore : public CBase + { + +public: + + static CNSmlDmAOSettingStore * NewL( CNSmlDmAOAdapter* aAdapter ); + + virtual ~CNSmlDmAOSettingStore(); + + /** + * Executes the argument command. + * + * @since S60 v3.2 + * @param aCmd Command to be executed + * @param aLUID LUID of the VENDORCONFIG which command is referring. + */ + void ExecuteCmdL( CSmlDmAOCommandElement& aCmd, TUint aLuid); + + /** + * Fetches all VENDORCONFIGs and inserts id of each VENDORCONFIG + * into the argument array (in practise there is only one VENDORCONFIG) + * + * @since S60 v3.2 + * @param aLUIDArray Array for VENDORCONFIG ids + */ + void GetVendorConfigsL( RArray& aLUIDArray ); + +private: + + CNSmlDmAOSettingStore( CNSmlDmAOAdapter * aAdapter ); + + void ConstructL(); + +//----------- Commands for managing leaf nodes -------------------// + + /** + * Executes VENDORCONFIG commands. The valid commands include + * get. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aLuid The id of the VENDORCONFIG + */ + void ExecuteVendorConfigCmdL( CSmlDmAOCommandElement& aCmd, TUint aLuid ); + + /** + * Executes NAME commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aCenrep Pointer to PdpContextManager2 repository + */ + void ExecuteNameCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ); + + + /** + * Executes AWON-PDPC commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aCenrep Pointer to PdpContextManager2 repository + */ + void ExecuteAwonPdpcCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ); + + + /** + * Executes T-RETRY commands. The valid commands include + * update and get. With update commands data is read from the + * iData memeber of the argument command. With get commands the iData + * memeber is used to pass fetched data back to caller. + * After execution of command the function fills in the status + * in aCmd.iStatus memeber and sets aCmd.iExecuted as True. The function + * leaves if command can not be executed for some reason. + * + * @param aCmd The command to be executed + * @param aCenrep Pointer to PdpContextManager2 repository + */ + void ExecuteTRetryCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ); + + /** + * Parses integer from descriptor + * + * @param aPtr Descriptor containing value + * @param aInt Value as integer + */ + void ParseIntegerL( const TDesC& aPtr, TInt& aInt ); + + /** + * Parses settings for home network and visited network + * + * @param aInt Interger containing home & visited network setting + * @param aHplmn "1" when always-on enabled in hplmn, otherwise "0" + * @param aVplmn "1" when always-on enabled in vplmn, otherwise "0" + */ + void ParseAwonPdpcValuesL( const TInt aInt, TInt& aHplmn, TInt& aVplmn ); + +private: //data + + /** + * Pointer to the adapter. This is used for + * querying data from DM framework when necessary + * and using helper functions. Not own. + */ + CNSmlDmAOAdapter* iAdapter; + + }; + + +#endif // NSMLDMALWAYSONSETTINGSTORE_H diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/rom/nsmldmalwaysonadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/rom/nsmldmalwaysonadapter.iby Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Image description file for project nsmldmalwaysonadapter +* +*/ + + +#ifndef NSMLDMALWAYSONADAPTER_IBY +#define NSMLDMALWAYSONADAPTER_IBY + +#include + +#ifdef __ALWAYS_ONLINE_PDPCONTEXT2 +#ifdef __SYNCML_DM + +ECOM_PLUGIN( nsmldmalwaysonadapter.dll, nsmldmalwaysonadapter.rsc ) + +#endif // __SYNCML_DM +#endif // __ALWAYS_ONLINE_PDPCONTEXT2 + +#endif // NSMLDMALWAYSONADAPTER_IBY diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,647 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides handling of Always-on settings in Device management. +* +*/ + + +#include + +#include "nsmldmalwaysonadapter.h" +#include "logger.h" + +// ======== MEMBER FUNCTIONS ======== + + +// -------------------------------------------------------------------------- +// Maps plugin UID to its factory function (constructor) +// -------------------------------------------------------------------------- +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101f6d36, + CNSmlDmAOAdapter::NewL) + }; + +// -------------------------------------------------------------------------- +// For ecom plugin implementation +// ------------------------------------------------------------------------- + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::NewL +// -------------------------------------------------------------------------- +CNSmlDmAOAdapter* CNSmlDmAOAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + LOGSTRING("CNSmlDmAOAdapter::NewL: Start"); + + CNSmlDmAOAdapter* self = new (ELeave) CNSmlDmAOAdapter( aDmCallback ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + + LOGSTRING("CNSmlDmAOAdapter::NewL: End"); + return self; + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::CNSmlDmAOAdapter +// -------------------------------------------------------------------------- + +CNSmlDmAOAdapter::CNSmlDmAOAdapter( MSmlDmCallback* aDmCallback ) + : CSmlDmAdapter( aDmCallback ) + { + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::ConstructL +// -------------------------------------------------------------------------- +void CNSmlDmAOAdapter::ConstructL() + { + LOGSTRING( "CNSmlDmAOAdapter::CNSmlDmAOAdapter: Start" ); + + iSettingStore = CNSmlDmAOSettingStore::NewL( this ); + + LOGSTRING( "CNSmlDmAOAdapter::CNSmlDmAOAdapter: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::~CNSmlDmAOAdapter +// -------------------------------------------------------------------------- +CNSmlDmAOAdapter::~CNSmlDmAOAdapter() + { + LOGSTRING( "CNSmlDmAOAdapter::~CNSmlDmAOAdapter: Start" ); + + //iBuffer.ResetAndDestroy(); + //iBuffer.Close(); + delete iSettingStore; + + LOGSTRING( "CNSmlDmAOAdapter::~CNSmlDmAOAdapter: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::DDFVersionL +// Returns ddf version nr +// -------------------------------------------------------------------------- +void CNSmlDmAOAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + LOGSTRING( "CNSmlDmAOAdapter::DDFVersionL: Start" ); + + aDDFVersion.InsertL( 0, KNSmlDmAOAdapterDDFVersion ); + + LOGSTRING( "CNSmlDmAOAdapter::DDFVersionL:End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::DDFStructureL +// Constructs the DDF structure +// -------------------------------------------------------------------------- +void CNSmlDmAOAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + LOGSTRING( "CNSmlDmAOAdapter::DDFStructureL: Start" ); + TSmlDmAccessTypes accessTypes; + + // VENDORCONFIG + MSmlDmDDFObject& ao = aDDF.AddChildObjectL( KNSmlDmAOAdapterAO ); + + accessTypes.SetGet(); + + ao.SetAccessTypesL( accessTypes ); + ao.SetOccurenceL( MSmlDmDDFObject::EOne ); + ao.SetScopeL( MSmlDmDDFObject::EPermanent ); + ao.SetDFFormatL( MSmlDmDDFObject::ENode ); + ao.AddDFTypeMimeTypeL( KNSmlDmAOAdapterTextPlain ); + ao.SetDescriptionL( KNSmlDmAOAdapterAODescription ); + accessTypes.Reset(); + + // VENDORCONFIG/Name + MSmlDmDDFObject& name = ao.AddChildObjectL( KNSmlDmAOAdapterName ); + + accessTypes.SetGet(); + accessTypes.SetReplace(); + accessTypes.SetAdd(); + + name.SetAccessTypesL( accessTypes ); + name.SetOccurenceL( MSmlDmDDFObject::EOne ); + name.SetScopeL( MSmlDmDDFObject::EDynamic ); + name.SetDFFormatL( MSmlDmDDFObject::EChr ); + name.SetDescriptionL( KNSmlDmAOAdapterNameDescription ); + accessTypes.Reset(); + + // VENDORCONFIG/AWON-PDPC + MSmlDmDDFObject& awonPdpc = + ao.AddChildObjectL( KNSmlDmAOAdapterAwonPdpc ); + + accessTypes.SetGet(); + accessTypes.SetReplace(); + accessTypes.SetAdd(); + + awonPdpc.SetAccessTypesL( accessTypes ); + awonPdpc.SetOccurenceL( MSmlDmDDFObject::EOne ); + awonPdpc.SetScopeL( MSmlDmDDFObject::EDynamic ); + awonPdpc.SetDFFormatL( MSmlDmDDFObject::EChr ); + awonPdpc.SetDescriptionL( KNSmlDmAOAdapterAwonPdpcDescription ); + accessTypes.Reset(); + + // VENDORCONFIG/T-RETRY + MSmlDmDDFObject& tRetry = + ao.AddChildObjectL( KNSmlDmAOAdapterTRetry ); + + accessTypes.SetGet(); + accessTypes.SetReplace(); + accessTypes.SetAdd(); + + tRetry.SetAccessTypesL( accessTypes ); + tRetry.SetOccurenceL( MSmlDmDDFObject::EOne ); + tRetry.SetScopeL( MSmlDmDDFObject::EDynamic ); + tRetry.SetDFFormatL( MSmlDmDDFObject::EChr ); + tRetry.SetDescriptionL( KNSmlDmAOAdapterTRetryDescription ); + accessTypes.Reset(); + + LOGSTRING( "CNSmlDmAOAdapter::DDFStructureL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::UpdateLeafObjectL +// Adds or updates leaf node value. +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::UpdateLeafObjectL: Start" ); + LOGSTRING4( "\tUpdateLeafObjectL \tURI: %S, \n\tLUID: %S,\ + \tobject: %S ", + &aURI, &aLUID, &aObject ); + + // execute command and return status + CSmlDmAOCommandElement* cmd = + CSmlDmAOCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmAOInvalidRef, + CNSmlDmAOAdapter::EAddCmd, + LastURISeg( aURI ), + aObject); + + TInt luid( KDefaultLuid ); + + if ( aLUID.Length() > 0 ) + { + luid = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, luid ); + + LOGSTRING2( "\tCmd executed with status: %d", + cmd->Status() ); + Callback().SetStatusL( aStatusRef, cmd->Status() ); + CleanupStack::PopAndDestroy( cmd ); + + LOGSTRING( "CNSmlDmAOAdapter::UpdateLeafObjectL: End" ); + } +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::DeleteObjectL +// Not supported +// -------------------------------------------------------------------------- + +void CNSmlDmAOAdapter::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::DeleteObjectL: Start" ); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + LOGSTRING( "CNSmlDmAOAdapter::DeleteObjectL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::FetchLeafObjectL +// Fetches leaf object value. +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /*aType*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + LOGSTRING( "NSmlDmAOAdapter::FetchLeafObjectL: Start" ); + LOGSTRING3( "\tFetchLeafObjectL \tURI: %S, \tLUID: %S,", + &aURI, &aLUID ); + + CSmlDmAOCommandElement* cmd = + CSmlDmAOCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmAOAdapter::EGetCmd, + LastURISeg( aURI ), + KNullDesC8); + + TInt luid( KDefaultLuid ); + + if ( aLUID.Length() > 0 ) + { + luid = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, luid ); + LOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ); + + // if executed return status + if ( cmd->Executed() ) + { + Callback().SetStatusL( aStatusRef, cmd->Status() ); + // if successful set results + if ( cmd->Status() == CSmlDmAdapter::EOk ) + { + LOGSTRING2( "\tCmd executed with result: %S ", + cmd->Data() ); + CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() ); + CleanupStack::PushL( result ); + result->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, *result, KNullDesC8 ); + CleanupStack::PopAndDestroy( result ); + } + } + else + { + // failed to execute command + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + CleanupStack::PopAndDestroy( cmd ); + + + LOGSTRING( "NSmlDmAOAdapter::FetchLeafObjectL: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::FetchLeafObjectSizeL +// Fetches leaf object size. +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /* aType */, + TInt aResultsRef, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::FetchLeafObjectSizeL: Start" ); + LOGSTRING3( "\tFetchLeafObjectSizeL \tURI: %S, \tLUID: %S,", + &aURI, &aLUID ); + + CSmlDmAOCommandElement* cmd = + CSmlDmAOCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmAOAdapter::EGetSizeCmd, + LastURISeg( aURI ), + KNullDesC8); + + TInt luid( KDefaultLuid ); + + if ( aLUID.Length() > 0 ) + { + luid = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, luid ); + + LOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ); + // if executed get status + if ( cmd->Executed() ) + { + Callback().SetStatusL( aStatusRef, cmd->Status() ); + // if successful get results + if ( cmd->Status() == CSmlDmAdapter::EOk ) + { + LOGSTRING2( "\tCmd executed with result: %S ", + cmd->Data() ); + CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() ); + CleanupStack::PushL( result ); + result->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, *result, KNullDesC8 ); + CleanupStack::PopAndDestroy( result ); + } + } + else + { + // failed to execute command + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + + CleanupStack::PopAndDestroy( cmd ); + + LOGSTRING( "CNSmlDmAOAdapter::FetchLeafObjectSizeL: End" ); + } + +// ------------------------------------------------------------------------ +// CNSmlDmAOAdapter::ChildURIListL +// Fetches child nodes of a node. these may be either all VENDORCONFIG +// nodes or leaf nodes under a VENDORCONFIG node. +// ------------------------------------------------------------------------ +void CNSmlDmAOAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& + /*aPreviousURISegmentList*/, + TInt aResultsRef, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::ChildURIListL: Start" ); + LOGSTRING3( "\tChildURIListL URI: %S, LUID: %S ", + &aURI, &aLUID ); + + CBufBase* resultList = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( resultList ); + + // get all leaf nodes below VENDORCONFIG node + if ( !aURI.Compare( KNSmlDmAOAdapterAO ) ) + { + CSmlDmAOCommandElement* cmd = + CSmlDmAOCommandElement::NewLC( EFalse, + aStatusRef, + aResultsRef, + CNSmlDmAOAdapter::EGetCmd, + KNullDesC8, + KNullDesC8 ); + + TInt luid( KDefaultLuid ); + + if ( aLUID.Length() > 0 ) + { + luid = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, luid ); + + LOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ); + + Callback().SetStatusL( aStatusRef, cmd->Status() ); + if( cmd->Status() == CSmlDmAdapter::EOk ) + { + resultList->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( aResultsRef, + *resultList, + KNullDesC8 ); + } + + CleanupStack::PopAndDestroy( cmd ); + } + + CleanupStack::PopAndDestroy( resultList ); + LOGSTRING( "CNSmlDmAOAdapter::ChildURIListL: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::AddNodeObjectL +// Not supported +// -------------------------------------------------------------------------- +void CNSmlDmAOAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::AddNodeObjectL: Start" ); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + LOGSTRING( "CNSmlDmAOAdapter::AddNodeObjectL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::UpdateLeafObjectL +// Not supported from stream +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::UpdateLeafObjectL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::UpdateLeafObjectL: Start" ); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + LOGSTRING( "CNSmlDmAOAdapter::UpdateLeafObjectL: End" ); + } + + + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::ExecuteCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + const TDesC8& /* aArgument */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::ExecuteCommandL: Start" ); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + LOGSTRING( "CNSmlDmAOAdapter::ExecuteCommandL: End" ); + } +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::ExecuteCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + LOGSTRING( "CNSmlDmAOAdapter::ExecuteCommandL: Start" ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + LOGSTRING( "CNSmlDmAOAdapter::ExecuteCommandL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::CopyCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::CopyCommandL( const TDesC8& /* aTargetURI */ , + const TDesC8& /* aTargetLUID */ , + const TDesC8& /* aSourceURI */ , + const TDesC8& /* aSourceLUID */, + const TDesC8& /* aType */ , + TInt aStatusRef ) + { + //not supported + LOGSTRING( "CNSmlDmAOAdapter::CopyCommandL: Sart" ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + LOGSTRING( "CNSmlDmAOAdapter::CopyCommandL: End" ); + } +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::StartAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::StartAtomicL() + { + LOGSTRING( "CNSmlDmAOAdapter::StartAtomicL: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::StartAtomicL: End" ); + } +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::CommitAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::CommitAtomicL() + { + LOGSTRING( "CNSmlDmAOAdapter::CommitAtomicL: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::CommitAtomicL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::RollbackAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::RollbackAtomicL() + { + LOGSTRING( "CNSmlDmAOAdapter::RollbackAtomicL: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::RollbackAtomicL: End" ); + } + +TBool CNSmlDmAOAdapter::StreamingSupport( TInt& /* aItemSize */ ) + { + LOGSTRING( "CNSmlDmAOAdapter::StreamingSupport: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::StreamingSupport: End" ); + return EFalse; + } +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::StreamCommittedL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::StreamCommittedL() + { + LOGSTRING( "CNSmlDmAOAdapter::StreamCommittedL: Start" ); + LOGSTRING( "CNSmlDmAOAdapter::StreamCommittedL: End" ); + } + +// ------------------------------------------------------------------------- +// CNSmlDmAOAdapter::CompleteOutstandingCmdsL +// Buffering not needed because nodes can't be added +// ------------------------------------------------------------------------- +void CNSmlDmAOAdapter::CompleteOutstandingCmdsL() + { + LOGSTRING( "CNSmlDmAOAdapter::CompleteOutstandingCmdsL: Start"); + LOGSTRING( "CNSmlDmAOAdapter::CompleteOutstandingCmdsL: End" ); + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::IntToDes8L +// Converts integer to 8bit descriptor +// -------------------------------------------------------------------------- +HBufC8* CNSmlDmAOAdapter::IntToDes8L( TInt aLuid ) const + { + HBufC8* buf = HBufC8::NewL( 10 ); //10 = max length of 32bit integer + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num( aLuid ); + return buf; + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::DesToIntL +// Converts 8bit descriptor to int +// -------------------------------------------------------------------------- +TUint CNSmlDmAOAdapter::DesToIntL( const TDesC8& aLuid ) const + { + TLex8 lex( aLuid ); + TUint value( 0 ); + User::LeaveIfError( lex.Val( value ) ); + return value; + } + +// -------------------------------------------------------------------------- +// CNSmlDmAOAdapter::LastURISeg +// Returns the last uri segemnt of a uri. +// -------------------------------------------------------------------------- +TPtrC8 CNSmlDmAOAdapter::LastURISeg( const TDesC8& aURI ) const + { + TInt i; + for ( i=aURI.Length()-1; i >= 0; i-- ) + { + if ( aURI[i]=='/' ) + { + break; + } + } + + if ( i==0 ) + { + return aURI; + } + else + { + return aURI.Mid( i + 1 ); + } + } + + +//---------------------- CSmlDmAOCommandElement -------------------------// + +// -------------------------------------------------------------------------- +// CSmlDmAOCommandElement* CSmlDmAOCommandElement::NewLC +// -------------------------------------------------------------------------- + +CSmlDmAOCommandElement* CSmlDmAOCommandElement::NewLC( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmAOAdapter::TCommandType aCmdType, + const TDesC8& aLastUriSeg, + const TDesC8& aData ) + { + CSmlDmAOCommandElement* self = new (ELeave) CSmlDmAOCommandElement( aLeaf, + aStatusRef, + aResultRef, + aCmdType ); + CleanupStack::PushL(self); + self->ConstructL( aLastUriSeg, aData ); + return self; + } + +// -------------------------------------------------------------------------- +// CSmlDmAOCommandElement::~CSmlDmAOCommandElement +// -------------------------------------------------------------------------- +CSmlDmAOCommandElement::~CSmlDmAOCommandElement() + { + delete iLastUriSeg; + delete iData; + } + +// -------------------------------------------------------------------------- +// CSmlDmAOCommandElement::CSmlDmAOCommandElement +// -------------------------------------------------------------------------- +CSmlDmAOCommandElement::CSmlDmAOCommandElement( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmAOAdapter::TCommandType aCmdType ) + : iStatus( CSmlDmAdapter::EError ), + iLeaf( aLeaf ), + iStatusRef( aStatusRef ), + iResultRef( aResultRef ), + iCmdType( aCmdType ), + iData( NULL ) + + { + } + +// -------------------------------------------------------------------------- +// CSmlDmAOCommandElement::ConstructL +// -------------------------------------------------------------------------- +void CSmlDmAOCommandElement::ConstructL( const TDesC8& aLastUriSeg, + const TDesC8& aData ) + { + iLastUriSeg = aLastUriSeg.AllocL(); + iData = aData.AllocL(); + } diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,45 @@ +CHARACTER_SET UTF8/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource definitions for project nsmldmalwaysonadapter +* +*/ + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101f6d36; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; //DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101f6d36; // adapter implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonsettingstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonsettingstore.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,396 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Provides settings management in Central Repository. +* +*/ + + + +#include +#include + +#include "nsmldmalwaysonsettingstore.h" +#include "nsmldmalwaysonadapter.h" +#include "logger.h" + +// AWON-PDPC +// Values are XY, where X is related to 3G flag and Y is related to 2G flag. +// Possible values are: +// "00", AlwaysOn is OFF for both 3G and 2G +// "10", AlwaysOn is ON for 3G, OFF for 2G +// "01", AlwaysOn is OFF for 3G, ON for 2G +// "11", AlwaysOn is ON for 3G, ON for 2G +const TInt KAwonPdpc_Off3G_Off2G = 00; +const TInt KAwonPdpc_Off3G_On2G = 01; +const TInt KAwonPdpc_On3G_Off2G = 10; +const TInt KAwonPdpc_On3G_On2G = 11; + +const TInt KBufSize = 10; + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::NewL +// ----------------------------------------------------------------------------- +CNSmlDmAOSettingStore* CNSmlDmAOSettingStore::NewL( CNSmlDmAOAdapter * aAdapter ) + { + CNSmlDmAOSettingStore* self = new (ELeave) CNSmlDmAOSettingStore( aAdapter ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::CNSmlDmAOSettingStore +// ----------------------------------------------------------------------------- +CNSmlDmAOSettingStore::CNSmlDmAOSettingStore( CNSmlDmAOAdapter * aAdapter ) + : iAdapter( aAdapter ) + { + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ConstructL +// ----------------------------------------------------------------------------- +void CNSmlDmAOSettingStore::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::~CNSmlDmAOSettingStore +// ----------------------------------------------------------------------------- +CNSmlDmAOSettingStore::~CNSmlDmAOSettingStore() + { + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteCmdL +// Executes a single command +// ----------------------------------------------------------------------------- +void CNSmlDmAOSettingStore::ExecuteCmdL( CSmlDmAOCommandElement& aCmd, TUint aLuid) + { + if( !aCmd.Leaf() ) + { + ExecuteVendorConfigCmdL( aCmd, aLuid ); + } + else + { + CRepository* cenrep = CRepository::NewL( KCRUidPDPContextManager ); + CleanupStack::PushL( cenrep ); + + // name + if ( !aCmd.LastUriSeg()->Compare( KNSmlDmAOAdapterName ) ) + { + ExecuteNameCmdL( aCmd, cenrep ); + } + // awon-pdpc + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmAOAdapterAwonPdpc ) ) + { + ExecuteAwonPdpcCmdL( aCmd, cenrep ); + } + // t-retry + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmAOAdapterTRetry ) ) + { + ExecuteTRetryCmdL( aCmd, cenrep ); + } + else + { + // invalid node + LOGSTRING( "ExecuteCmdL: Error, Invalid node name" ); + aCmd.SetStatus( CSmlDmAdapter::ENotFound ); + } + + aCmd.SetExecuted( ETrue ); + + CleanupStack::PopAndDestroy( cenrep ); + } + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::GetVendorConfigsL +// Fetches all VENDORCONFIG ids +// ----------------------------------------------------------------------------- +void CNSmlDmAOSettingStore::GetVendorConfigsL( RArray& aLUIDArray ) + { + // Only one VENDORCONFIG node possible at the moment + aLUIDArray.Append( KDefaultLuid ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteVendorConfigCmdL +// Executes a command for VENDORCONFIG node. Either delete or get, adds are handled +// in StoreVendorConfigL +// ----------------------------------------------------------------------------- +void CNSmlDmAOSettingStore::ExecuteVendorConfigCmdL( CSmlDmAOCommandElement& aCmd, + TUint /*aLuid*/ ) + { + + if ( aCmd.CmdType() == CNSmlDmAOAdapter::EGetCmd ) + { + aCmd.SetData( KNSmlDmAOAllLeafNodes().AllocL() ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else if ( aCmd.CmdType() == CNSmlDmAOAdapter::EDeleteCmd ) + { + // Should not be possible to delete + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + LOGSTRING( "ExecuteVendorConfigCmdL: Error, Invalid cmd type" ); + aCmd.SetStatus( CSmlDmAdapter::EError ); + } + } + + +// --------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteNameCmdL +// Executes NAME command (add or get ) +// --------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ExecuteNameCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* /*aCenrep*/ ) + { + if ( aCmd.CmdType() == CNSmlDmAOAdapter::EAddCmd ) + { + HBufC* name = HBufC::NewLC( aCmd.Data()->Size() ); + TPtr namePtr = name->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, *aCmd.Data() ); + + // name is not written to the CentralRepository + // Add write to CR here + + CleanupStack::PopAndDestroy( name ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( aCmd.CmdType() == CNSmlDmAOAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + // name is not written/read to/from the CentralRepository + // Add read from CR here + + //HBufC* data = ...read name + + //HBufC8* data8 = HBufC8::NewLC( data->Size() ); + //TPtr8 toPtr = data8->Des(); + //CnvUtfConverter::ConvertFromUnicodeToUtf8( toPtr, *data ); + //aCmd.SetData( data8 ); + //CleanupStack::Pop( data8 ); + //CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + + //if( aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + // { + // HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + // aCmd.SetData( size ); + // } + + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + LOGSTRING( "ExecuteNameCmdL: Error, Only Add, Get and Get size commands supported" ); + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteAwonPdpcCmdL +// Executes AWON-PDPC command (add or get ) +// --------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ExecuteAwonPdpcCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ) + { + if ( aCmd.CmdType() == CNSmlDmAOAdapter::EAddCmd ) + { + HBufC* data = HBufC::NewLC( aCmd.Data()->Size() ); + TPtr dataPtr = data->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( dataPtr, *aCmd.Data() ); + + // write to the CentralRepository + TInt value( 0 ); + TInt hplmn( 0 ); + TInt vplmn( 0 ); + + ParseIntegerL( dataPtr, value ); + ParseAwonPdpcValuesL( value, hplmn, vplmn ); + + User::LeaveIfError( aCenrep->Set( KPDPContextManagerEnableWhenHome, + hplmn ) ); + User::LeaveIfError( aCenrep->Set( KPDPContextManagerEnableWhenRoaming, + vplmn ) ); + + CleanupStack::PopAndDestroy( data ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( aCmd.CmdType() == CNSmlDmAOAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + // read from CentralRepository + TInt hplmn( 0 ); + TInt vplmn( 0 ); + + User::LeaveIfError( + aCenrep->Get( KPDPContextManagerEnableWhenHome, hplmn ) ); + User::LeaveIfError( + aCenrep->Get( KPDPContextManagerEnableWhenRoaming, vplmn ) ); + + HBufC* data = HBufC::NewLC( KBufSize ); + TPtr dataPtr = data->Des(); + + dataPtr.Zero(); + dataPtr.FillZ(); + dataPtr.AppendNum( hplmn ); + dataPtr.AppendNum( vplmn ); + + HBufC8* data8 = HBufC8::NewLC( data->Size() ); + TPtr8 toPtr = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( toPtr, *data ); + aCmd.SetData( data8 ); + CleanupStack::Pop( data8 ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + aCmd.SetData( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + LOGSTRING( "ExecuteNameCmdL: Error, Only Add, Get and Get size commands supported" ); + } + } + + // --------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ExecuteTRetryCmdL +// Executes T-RETRY command (add or get ) +// --------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ExecuteTRetryCmdL( CSmlDmAOCommandElement& aCmd, + CRepository* aCenrep ) + { + if ( aCmd.CmdType() == CNSmlDmAOAdapter::EAddCmd ) + { + HBufC* data = HBufC::NewLC( aCmd.Data()->Size() ); + TPtr dataPtr = data->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( dataPtr, *aCmd.Data() ); + + // write to the CentralRepository + TInt value( 0 ); + ParseIntegerL( dataPtr, value ); + + User::LeaveIfError( aCenrep->Set( KPDPContextManagerRetryTimer, + value ) ); + + CleanupStack::PopAndDestroy( data ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( aCmd.CmdType() == CNSmlDmAOAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + // Read from CentralRepository + TInt value( 0 ); + User::LeaveIfError( aCenrep->Get( KPDPContextManagerRetryTimer, + value ) ); + + HBufC* data = HBufC::NewLC( KBufSize ); + TPtr dataPtr = data->Des(); + + dataPtr.Zero(); + dataPtr.FillZ(); + dataPtr.AppendNum( value ); + + HBufC8* data8 = HBufC8::NewLC( data->Size() ); + TPtr8 toPtr = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( toPtr, *data ); + aCmd.SetData( data8 ); + CleanupStack::Pop( data8 ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmAOAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + aCmd.SetData( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + LOGSTRING( "ExecuteNameCmdL: Error, Only Add, Get and Get size commands supported" ); + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ParseIntegerL +// ----------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ParseIntegerL( const TDesC& aPtr, TInt& aInt ) + { + TLex lex( aPtr ); + User::LeaveIfError( lex.Val( aInt ) ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmAOSettingStore::ParseAwonPdpcValuesL +// ----------------------------------------------------------------------------- +// +void CNSmlDmAOSettingStore::ParseAwonPdpcValuesL( const TInt aInt, + TInt& aHplmn, + TInt& aVplmn ) + { + switch( aInt ) + { + case KAwonPdpc_Off3G_Off2G: + aHplmn = 0; + aVplmn = 0; + break; + case KAwonPdpc_Off3G_On2G: + aHplmn = 0; + aVplmn = 1; + break; + case KAwonPdpc_On3G_Off2G: + aHplmn = 1; + aVplmn = 0; + break; + case KAwonPdpc_On3G_On2G: + aHplmn = 1; + aVplmn = 1; + break; + default: + User::Leave( KErrNotSupported ); + break; + } + } + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/rom/omadmadapters.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/rom/omadmadapters.iby Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +REM SyncML Device Management + +#include + +#ifndef __OMADMADAPTERS_IBY__ +#define __OMADMADAPTERS_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected + + +REM SyncML Device Management plug-in adapters +ECOM_PLUGIN(nsmldmdevdetailadapter.dll,nsmldmdevdetailadapter.rsc) +ECOM_PLUGIN(nsmldmdevinfoadapter.dll,nsmldmdevinfoadapter.rsc) +#ifdef __SYNCML_DM_1_1_2 +ECOM_PLUGIN(nsmldmsettingsadapter.dll,nsmldmsettingsadapter.rsc) +#else +ECOM_PLUGIN(nsmldmsettingsadapter12.dll,nsmldmsettingsadapter12.rsc) +#endif + +#ifdef FF_DM_STREAMING_ADAPTER +REM ECOM_PLUGIN(nsmldmstreamingadapter.dll,nsmldmstreamingadapter.rsc) +#endif + +#ifdef FF_DM_BROWSER_ADAPTER +REM ECOM_PLUGIN(nsmldmbrowseradapter.dll,nsmldmbrowseradapter.rsc) +#endif + +#ifdef __SYNCML_DS // SyncML data synchronization +#ifdef __SYNCML_DM_DS // SyncML device management data sync settings plug-in +ECOM_PLUGIN(nsmldssettingsadapter.dll,nsmldssettingsadapter.rsc) +#endif // __SYNCML_DM_DS +#endif // __SYNCML_DS + +#ifdef __SYNCML_DM_EMAIL // SyncML device management email settings plug-in +REM ECOM_PLUGIN(nsmldmemailadapter.dll,nsmldmemailadapter.rsc) +#endif // __SYNCML_DM_EMAIL + +#ifdef __SYNCML_DM_MMS // SyncML device management MMS settings plug-in +ECOM_PLUGIN(nsmldmmmsadapter.dll,nsmldmmmsadapter.rsc) +#endif // __SYNCML_DM_MMS + +#ifdef __SYNCML_DM_FOTA // SyncML device management Firmware update plug-in +REM ECOM_PLUGIN(nsmldmfotaadapter.dll,nsmldmfotaadapter.rsc) +REM data=ABI_DIR\BUILD_DIR\z\private\100012a5\policy\101F9A02.SPD private\100012a5\policy\101F9A02.SPD +#endif // __SYNCML_DM_FOTA + + +#ifdef FF_DM_CONNMO_ADAPTER +// old internet adapter is not used in that case for access point provisioning. +ECOM_PLUGIN(connmoadapter.dll,connmoadapter.rsc) +#else +REM ECOM_PLUGIN(nsmlinternetadapter.dll,nsmlinternetadapter.rsc) +#endif FF_DM_CONNMO_ADAPTER + +#ifdef __SYNCML_DM_WLAN +ECOM_PLUGIN(globalwlanadapter.dll,globalwlanadapter.rsc) +#endif // __SYNCML_DM_WLAN + +#ifdef __ALWAYS_ONLINE_PDPCONTEXT2 +ECOM_PLUGIN( nsmldmalwaysonadapter.dll, nsmldmalwaysonadapter.rsc ) +#endif // __ALWAYS_ONLINE_PDPCONTEXT2 + +REM ECOM_PLUGIN( nsmldmbmadapter.dll, nsmldmbmadapter.rsc ) + +#ifdef FF_RUNTIME_DEVICE_CAPABILITY_CONFIGURATION +REM ECOM_PLUGIN(dcmodmadapter.dll,dcmodmadapter.rsc) +#endif + +#endif //__SYNCML_DM + +#endif //__OMADMADAPTERS_IBY__ diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/bld/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build info file for SyncML DM settings adapter +* +*/ + + + + +PRJ_MMPFILES +./nsmldmsettingsadapter.mmp + + + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/bld/nsmldmsettingsadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/bld/nsmldmsettingsadapter.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM-settings adapter +* +*/ + + + + +#include "defaultcaps.hrh" +#include + +TARGET nsmldmsettingsadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F6DE6 +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc ../../inc + +SOURCE NSmlDmSettingsAdapter.cpp + + +START RESOURCE nsmldmsettingsadapter.rss +END + +LIBRARY euser.lib ecom.lib charconv.lib nsmldebug.lib +LIBRARY nsmldmiapmatcher.lib +LIBRARY syncmlclientapi.lib +LIBRARY nsmltransporthandler.lib +LIBRARY nsmlprivateapi.lib +LIBRARY featmgr.lib + + +SMPSAFE +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/inc/NSmlDMSettingsAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/inc/NSmlDMSettingsAdapter.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,813 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM Settings adapter header file +* +*/ + + + + +#ifndef __NSMLDMSETTINGSADAPTER_H__ +#define __NSMLDMSETTINGSADAPTER_H__ + + +// INCLUDES +#include +#include +#include +#include "NSmlPrivateAPI.h" + +// CONSTANTS +const TInt KNSmlDMGranularity = 4; +const TUint8 KNSmlDMColon = ':'; +const TUint8 KNSmlDMUriSeparator = '/'; +const TInt KPortMaxSize = 65535; +const TInt KPortMinSize = 0; +//Dynamic Node Posn Const --> SyncML/DMAcc/DMIDxxx +const TInt KDynNodePosn = 3; + +//DDF accepted DM-fieldnames +_LIT8( KNSmlDdfId, "Id" ); +_LIT8( KNSmlDdfAddr, "Addr" ); +_LIT8( KNSmlDdfAddrType, "AddrType" ); +_LIT8( KNSmlDdfPortNbr, "PortNbr" ); +_LIT8( KNSmlDdfAuthScheme, "AuthPref" ); +_LIT8( KNSmlDdfServerId, "ServerId" ); +_LIT8( KNSmlDdfServerPW, "ServerPW" ); +_LIT8( KNSmlDdfServerNonce, "ServerNonce" ); +_LIT8( KNSmlDdfClientUserName, "UserName" ); +_LIT8( KNSmlDdfClientPW, "ClientPW" ); +_LIT8( KNSmlDdfClientNonce, "ClientNonce" ); +_LIT8( KNSmlDdfName, "Name" ); +_LIT8( KNSmlDdfConRef, "ConRef" ); +_LIT( KNSmlDdfMConRef, "MConRef" ); + +//DDF DM-field descriptions +_LIT8( KNSmlDdfAddrDescription, "Host address of the SyncML server, IP or URL" ); +_LIT8( KNSmlDdfAddrTypeDescription, "The type of address specified in the Addr node" ); +_LIT8( KNSmlDdfPortNbrDescription, "SyncML Server port" ); +_LIT8( KNSmlDdfAuthSchemeDescription, "Scheme of authentication" ); +_LIT8( KNSmlDdfServerIdDescription, "The ServerId value for this server" ); +_LIT8( KNSmlDdfServerPWDescription, "The password or secret that the server will use to authenticate itself to the client" ); +_LIT8( KNSmlDdfServerNonceDescription, "The next nonce that the server will use to authenticate itself to the client" ); +_LIT8( KNSmlDdfClientUserNameDescription, "The username of the device (or user)" ); +_LIT8( KNSmlDdfClientPWDescription, "The password or secret that the client will use to authenticate itself to the server" ); +_LIT8( KNSmlDdfClientNonceDescription, "The next nonce that the client will use to authenticate itself to the server" ); +_LIT8( KNSmlDdfNameDescription, "Displayable name for the SyncML setings" ); +_LIT8( KNSmlDdfConRefDescription, "Logical reference to a connectivity node" ); +_LIT( KNSmlDdfMConRefDescription, "Parent to Multiple Connection Reference objects" ); + +//Default data values +_LIT( KNSmlDefName, "DMAdapterIns" ); +_LIT8( KNSmlDefDMAcc, "DMAcc" ); +_LIT8( KNSmlDMStart, "SyncML/DMAcc/DMId" ); +_LIT( KNSmlDefDMIAP, "AP" ); +_LIT8( KNSmlDMUriDotSlash, "./"); +_LIT8( KNSmlDMNullDesc8, ""); +_LIT8(KNSmlIAPId, "NSmlIapId"); + +// AuthPref text values +_LIT8( KNSmlDMAuthPrefNoAuth,"syncml:auth-none"); +_LIT8( KNSmlDMAuthPrefBasic, "syncml:auth-basic"); +_LIT8( KNSmlDMAuthPrefMD5, "syncml:auth-md5"); + +_LIT8( KNSmlDMSettingsHTTP, "http://" ); +_LIT8( KNSmlDMSettingsHTTPS, "https://" ); + +_LIT8( KIAPid, "IAPid" ); +_LIT8( KSegmDMAcc,"Addr/AddrType/PortNbr/AuthPref/ServerId/ServerPW/ServerNonce/UserName/ClientPW/ClientNonce/Name/ConRef"); +_LIT8( KSmlDmSlash, "/"); +_LIT8( KVersion,"1.1" ); +_LIT8( KMimeType, "text/plain" ); +_LIT8( KSyncMLText, "SyncML" ); +_LIT8( KNSmlDMadapterDesc, "DM-Settings DDF description" ); +_LIT8( KNSmlDMadapterTitle,"DM-Settings title" ); +_LIT8( KDmAccMatch, "SyncML/DMAcc/*" ); +_LIT8( KDmAccMatch2, "SyncML/DMAcc" ); + + +// DATA TYPES +enum TNSmlDMFieldType + { + EStr, + EInt, + EBin, + EWrong + }; + +enum TNSmlDMLeafType + { + EDMUpdate, + EDMDelete, + EDMUnset + }; + +enum TNSmlDMProfileData + { + EProfileId, + EProfileName, + EProfileIAPId, + EProfileMediumType, + EProfileDMServerUsername, + EProfileDMServerPassword, + EServerNonce, + ESharedSecret, + EClientNonce, + EProfileURL, + EProfilePort, + EServerId, + EAuthenticationRequired, + ESyncAccepted + }; + +enum TAuthenticationType + { + ENoAuth, //"syncml:auth-none" + EBasic, //"syncml:auth-basic" + EMD5 //"syncml:auth-md5" + }; + +enum TNSmlDMMediumType + { + ENone, + EHttp, + EWsp, + EObex + }; + +struct TNSmlDMLeafElement + { + HBufC8 *iUri; + HBufC8 *iData; + TInt iStatusRef; + HBufC8* iLuid; + }; + +struct TNSmlDMBufferElement + { + CArrayFixFlat *iLeafBuf; + HBufC8* iMappingName; //Holds the Dyn.Node URI + TBool iExecuted; //Node updated to dB or not + TInt iDMBuffStatusref; //Statusref for callback + TBool iAddr; + TBool iServerId; //Bools for Mandatory fields + TBool iUName; + TBool iServerName; + }; +// CLASS DECLARATION +/** +* CNSmlDMSettingsAdapter class +* Contains the whole implementation of the DM settings adapter. +* +* @lib nsmldmsettingsadapter.dll +* @since Series 60 Series60_3.0 +*/ +class CNSmlDMSettingsAdapter : public CSmlDmAdapter + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CNSmlDMSettingsAdapter* NewL(MSmlDmCallback* aDmCallback ); + static CNSmlDMSettingsAdapter* NewLC(MSmlDmCallback* aDmCallback ); + + void ConstructL(); + + /** + * Destructor. + */ + virtual ~CNSmlDMSettingsAdapter(); + + public: // Functions from base classes + + /** + * From CSmlDmAdapter DDFVersionL returns current version of the DDF. + * @since Series60_3.0 + * @param aVersion DDF version of the adapter. + * @return none + */ + void DDFVersionL( CBufBase& aVersion ); + + /** + * From CSmlDmAdapter DDFStructureL for filling the DDF structure of the adapter. + * @since Series60_3.0 + * @param aDDF Reference to root object. + * @return none + */ + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + /** + * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces + * data in existing leaf objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aObject Data of the object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ); + + /** + * From CSmlDmAdapter DeleteObjectL deletes an object and its child objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter FetchLeafObjectL fetches data of a leaf object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ); + /** + * From CSmlDmAdapter ChildURIListL fetches URI list. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aPreviousURISegmentList URI list with mapping LUID information + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef ); + + /** + * From CSmlDmAdapter AddNodeObjectL adds node object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aParentLUID LUID of the parent object + * @param aStatusRef Reference to correct command + * @return none + */ + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces + * data in existing leaf objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream Data of the object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter FetchLeafObjectSizeL fetches the size of a leaf object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aArgument Argument for the command + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream Argument for the command + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aTargetURI Target URI for the command + * @param aTargetLUID LUID of the target object + * @param aSourceURI Source URI for the command + * @param aSourceLUID LUID of the source object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function indicates start of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void StartAtomicL(); + + /** + * From CSmlDmAdapter The function indicates successful end of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void CommitAtomicL(); + + /** + * From CSmlDmAdapter The function indicates unsuccessful end of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void RollbackAtomicL(); + + /** + * From CSmlDmAdapter Returns ETrue if adapter supports streaming otherwise EFalse. + * @since Series60_3.0 + * @param aItemSize Size limit for stream usage. + * @return ETrue or EFalse + */ + TBool StreamingSupport( TInt& aItemSize ); + + /** + * From CSmlDmAdapter Called when stream returned from UpdateLeafObjectL or + * ExecuteCommandL has been written to and committed. + * @since Series60_3.0 + * @param none + * @return none + */ + void StreamCommittedL(); + + /** + * From CSmlDmAdapter The function tells the adapter that all the commands of the message that + * can be passed to the adapter have now been passed. + * @since Series60_3.0 + * @param none + * @return none + */ + void CompleteOutstandingCmdsL(); + + private: + + /** + * C++ default constructor. + */ + CNSmlDMSettingsAdapter(); + CNSmlDMSettingsAdapter( TAny* aEcomArguments ); + + /** + * The function stores integer value to buffer and returns reference to it. + * @param aObject data to be stored to buffer. + * @return reference to data buffer. + */ + TDesC8& SetIntObjectLC( const TInt& aObject ); + + /** + * The function finds out the last element of the uri. + * @param aSource Uri object that contains all elements. + * @return KErrNone if successful. + */ + TInt SetField( const TDesC8& aSource ); + + /** + * The function converts data to integer and returns it. + * @param aObject Data object to be converted. + * @return Integer value for an object. + */ + TInt GetIntObject( const TDesC8& aObject ); + + /** + * The function converts data to integer and returns it. + * @param aObject Data object to be converted. + * @return 16-bit integer value for an object. + */ + TInt GetIntObject16( const TDesC& aObject ); + + /** + * The function converts LUID to integer. + * @param aLUID LUID data to be converted. + * @return Integer value for a LUID. + */ + TInt IntLUID( const TDesC8& aLUID ); + + /** + * The function sets the IAP value acording the given URI. + * @param aLUID LUID for a profile. + * @param aObject Data object containing the URI. + * @return KErrNone if successfull. + */ + TInt SetConRefL( const TInt aLUID, const TDesC8& aObject ); + + /** + * The function gets the URI for profile IAP. + * @param aObject Object where the result will be stored. + * @return KErrNone if successfull. + */ + TInt GetConRefL( CBufBase& aObject ); + + /** + * The function checks if field to be handled is valid. + * @param none + * @return ETrue if valid field otherwise EFalse. + */ + TBool AcceptDMField(); + + /** + * The function checks if field type to be handled is valid. + * @param none + * @return enum value for a field type. + */ + TNSmlDMFieldType GetDMFieldType() const; + + /** + * The function returns enum value for a field to be handled. + * @param none + * @return enum value for a field to be handled. + */ + TNSmlDMProfileData GetDMField() const; + + /** + * The function checks if data length is valid. + * @param aProfileItem Field / Leaf ID to be handled. + * @param aSource Data to be handled. + * @return ETrue if data length is valid otherwise EFalse. + */ + TBool NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, + const TDesC8& aSource ); + + /** + * The function converts 16-bit data to 8-bit and returns reference to it. + * @param aSource Reference data to be converted. + * @return Reference to 8-bit data buffer. + */ + TDesC8& ConvertTo8LC( const TDesC& aSource ); + + /** + * The function converts 8-bit data to 16-bit and returns reference to it. + * @param aSource Reference data to be converted. + * @return Reference to 16-bit data buffer. + */ + TDesC16& ConvertTo16LC( const TDesC8& aSource ); + + /** + * The function find out the port number from URL and stores it to aPort. + * @param aRealURI Reference data to be containing the whole URI. + * @param aPort Reference variable where port number will be stored. + * @return KErrNone if successful otherwise KErrNotFound. + */ + TInt ParseUri( const TDesC8& aRealURI, TInt& aPort ); + + /** + * The function opens the server session and profile via client API. + * @param aIntLUID Integer value for a LUID of the profile. + * @param aMode Read or Read and Write mode for a profile data. + * @return KErrNone if successful otherwise KErrNotFound. + */ + TInt OpenSyncSessionAndProfileL( const TInt aIntLUID, TSmlOpenMode aMode ); + + /** + * The function checks if requested profile ID exits. + * @param aIntLUID Integer value for a LUID of the profile. + * @return ETrue if profile exits otherwise EFalse. + */ + TBool FindProfileIdL( const TInt aIntLUID ); + + /** + * The function creates new DM profile. + * @param aPID Reference to variable where new profile will be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt CreateNewProfileL( TInt& aPID ); + + /** + * The function stores the server URL for a profile. + * @param aPID Profile ID. + * @param aObj Reference to server URL data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileServerURIL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the display name for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileDisplayNameL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the user name for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileUserNameL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the protocol version for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileProtocolVersionL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the ServerId value for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileServerIdL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the Server password for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileServerPasswordL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the password value for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfilePasswordL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the IAP id value for a profile. + * @param aLUID Profile ID. + * @param aIAPid Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileConnectionPropertyL( const TInt aLUID, const TInt aIAPid ); + + /** + * The function deleted the profile data. + * @param aPID Profile ID. + * @return KErrNone if successful otherwise error code. + */ + TInt DeleteProfileL( const TInt aPID ); + + /** + * The function gets the profile data acoeding to aDMField. + * @param aLUID Profile ID. + * @param aDMField Data field ID to be handled. + * @param aObject Reference where fetched data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, + CBufBase& aObject ); + + /** + * The function adds port number to address URL. + * @param aLUID Profile ID. + * @param aPort Reference to port number data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileConnectionPortNrL( const TInt aLUID, const TDesC8& aPort ); + + /** + * The function adds port number to address URL. + * @param aSrvURI Original address URI. + * @param aNewURI New URI when port number has been added or deleted. + * @param aPort Reference to port number data. + * @return KErrNone if successful otherwise error code. + */ + void SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, + const TDesC8& aPort ); + + /** + * General function which selects which leaf to be handled. + * @param aLUID Profile LUID. + * @param aObject Data to be stored. + * @param aField Leaf of field ID to be handled. + * @return KErrNone if successful otherwise error code. + */ + TInt SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, + const TNSmlDMProfileData aField ); + /** + * The function fills the node info. + * @param aNode Reference to node or leaf which info to be filled. + * @param aAccTypes Access rights for a leaf / node. + * @param aOccurrence Occurance of the node / leaf. + * @param aScope Scope (dynamic / permanent) of the leaf / node. + * @param aFormat Data format of the leaf / node. + * @param aDescription Description of the node / leaf. + * @param aDefaultValue Default value for a leaf or node. + * @param aMimeType MIME type for a leaf / node. + * @return none + */ + void FillNodeInfoL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription, + const TDesC8& aDefaultValue, const TDesC8& aMimeType ); + + /** + * The function reads the authentication data via private API. + * @param aLUID LUID for a profile. + * @param aField Leaf id to be handled. + * @param aObject Reference where to store the data. + * @return KErrNone if successful otherwise error code. + */ + TInt GetDMAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField, + CBufBase& aObject ); + + /** + * The function delete's the authentication data via private API. + * @param aLUID LUID for a profile. + * @param aField Leaf id to be handled. + * @return KErrNone if successful otherwise error code. + */ + TInt DeleteDMAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField ); + + /** + * The function set's the address type / medium type value for a profile. + * @param aLUID LUID for a profile. + * @param aIntObj Address type value. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileAddrTypeL( const TInt aLUID, const TInt aIntObj ); + + /** + * The function gets the profile medium type value. + * @param aObject Reference where data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileConnectiontypeL( CBufBase& aObject ); + + /** + * The function gets the profile IAP value. + * @param aIAPid Reference where data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileIAPIdL( TInt& aIAPid ); + + /** + * The function gets the profile Server URL value. + * @param aURL Reference where data to be stored. + * @return KErrNone if successful otherwise error code. + */ + void GetProfileServerURLL( CBufBase& aURL ); + + /** + * The function checks the requested medium type if supported. + * @param aIntObj Medium type. + * @param aMediumType UID for medium type. + * @return none + */ + void GetMediumTypeL( const TInt aIntObj, TInt& aMediumType ); + + /** + * The function gets the server id value. + * @param aObject Reference where data to be stored. + * @return none + */ + void GetServerIdL( CBufBase& aObject ); + + /** + * The function gets the profile name value. + * @param aObject Reference where data to be stored. + * @return none + */ + void GetProfileNameL( CBufBase& aObject ); + + /** + * The function gets the user name value. + * @param aObject Reference where data to be stored. + * @return none + */ + void GetProfileUserNameL( CBufBase& aObject ); + + /** + * The function gets the profile port number value. + * @param aObject Reference where data to be stored. + * @return none + */ + void GetProfilePortNumberL( CBufBase& aObject ); + + /** + * The function sets the profile authentication info via private API. + * @param aLUID Profile LUID. + * @param aField Leaf ID to be handled. + * @param aObject Data to be stored. + * @param aStatus Status of the function, KErrNone if successful. + * @return none + */ + void SetAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField, + const TDesC8& aObject, TInt& aStatus ); + //Buffers Node Object + void AddNodeBufferL( const TDesC8& aURI, const TInt aStatusRef); + //Buffers Leaf Object + void AddLeafBufferL( const TDesC8& aURI, const TDesC8& aObject, + const TInt aStatusRef); + // Executes Buffer + void ExecuteBufferL(); + //Extracts the ParentURI + TPtrC8 ParentURI(const TDesC8& aURI); + // Clears the elements of the passed in LeafElement Structure + void ClearBuffer( CArrayFixFlat* aBuffer); + private: // Data + + // Client API session class + RSyncMLSession iSyncSession; + // Client API Device Management profile handling + RSyncMLDevManProfile iProfile; + // Callback interface for returning result or status + MSmlDmCallback* iCallBack; + + TInt iCurrentProfile; + + // Profile LUID + TInt iLUID; + // Parent LUID + TInt iParentLUID; + // For handling profile medium type + TInt iObject; + + // Buffer for URI leaf element + HBufC8* iField; + + // Information about data type + TNSmlDMFieldType iFieldType; + // Information about leaf command + TNSmlDMLeafType iLeafType; + // Status information if session allready opened + TBool iSyncSessionOpen; + + // Buffer for storing port number + HBufC8* iPortNbr; + + // Private API interface for handling authebtication data + RNSmlPrivateAPI iPrivateApi; + + struct TPortBuffer + { + // buffered data for updating port number + TBufC8<5> iPortBuf; + TInt iPortBufLUID; + TInt iPortBufStatusRef; + }; + RArray iPortBuffer; + TBool iBufOn; + TBool iComplete; + TInt iExecutionIndex; + CArrayFixFlat *iBuffer; + }; + +#endif // __NSMLDMSETTINGSADAPTER_H__ + +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/src/NSmlDmSettingsAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/src/NSmlDmSettingsAdapter.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,3011 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM-settings adapter +* +*/ + + + + +// INCLUDE FILES +#include "NSmlDMSettingsAdapter.h" +#include "nsmldebug.h" +#include "nsmlconstants.h" +#include "nsmldmconstants.h" +#include "nsmldmimpluids.h" +#include "nsmldmiapmatcher.h" +#include "nsmldmauthinfo.h" +#include +#include +#include +#include + + +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CNSmlDMSettingsAdapter* CNSmlDMSettingsAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDMSettingsAdapter::NewL(): begin"); + + CNSmlDMSettingsAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop(); + + _DBG_FILE("CNSmlDMSettingsAdapter::NewL(): end"); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::NewLC( ) +// Loads the CNSmlDMSettingsAdapter class and pushes it to clenupstack. +// ----------------------------------------------------------------------------- +CNSmlDMSettingsAdapter* CNSmlDMSettingsAdapter::NewLC( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::NewLC(): begin" ); + CNSmlDMSettingsAdapter* self = new ( ELeave ) CNSmlDMSettingsAdapter( aDmCallback ); + CleanupStack::PushL( self ); + self->iCallBack = aDmCallback; + self->ConstructL(); + self->iLeafType = EDMUnset; + + _DBG_FILE( "CNSmlDMSettingsAdapter::NewLC(): end" ); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::CNSmlDMSettingsAdapter() +// Default constructor. +// ----------------------------------------------------------------------------- +CNSmlDMSettingsAdapter::CNSmlDMSettingsAdapter( TAny* aEcomArguments) : + CSmlDmAdapter(aEcomArguments ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::CNSmlDMSettingsAdapter(): begin" ); + _DBG_FILE( "CNSmlDMSettingsAdapter::CNSmlDMSettingsAdapter(): end" ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::~CNSmlDMSettingsAdapter() +// Destructor. +// ----------------------------------------------------------------------------- +CNSmlDMSettingsAdapter::~CNSmlDMSettingsAdapter() + { + _DBG_FILE( "CNSmlDMSettingsAdapter::~CNSmlDMSettingsAdapter(): begin" ); + + delete iField; + + // Client API Session & Profile + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + + // In Case the Buffer isnt cleared + if ( iBuffer) + { + for (TInt val =0; valCount ();val++) + { + delete iBuffer->At(val).iMappingName; + + ClearBuffer ( iBuffer->At(val).iLeafBuf); + delete iBuffer->At(val).iLeafBuf; + } + + iBuffer->Reset (); + delete iBuffer; + } + delete iPortNbr; + iPortBuffer.Reset(); + iPortBuffer.Close(); + iPrivateApi.Close(); + + iCallBack = 0; + + _DBG_FILE( "CNSmlDMSettingsAdapter::~CNSmlDMSettingsAdapter(): end" ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::ConstructL() +// Second phase constructor. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::ConstructL() + { + iField = HBufC8::NewL( KNSmlMaxURLLength ); + iSyncSessionOpen = EFalse; + // variables used for Buffering + iBufOn = EFalse; + iComplete = EFalse; + iExecutionIndex = -1; + // initialising iBuffer + iBuffer = new (ELeave) CArrayFixFlat (KNSmlDMGranularity); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::DDFVersionL() +// Returns the DDF version number. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::DDFVersionL( CBufBase& aVersion ) + { + _DBG_FILE( + "CNSmlDMSettingsAdapter::DDFVersionL(CBufBase& aDDFVersion): begin" ); + aVersion.InsertL( 0, KVersion ); + _DBG_FILE( + "CNSmlDMSettingsAdapter::DDFVersionL(CBufBase& aDDFVersion): end" ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::DDFStructureL() +// Fills the DDF structure of the adapter. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::DDFStructureL(): begin" ); + + MSmlDmDDFObject* ddfRoot = &aDDF; + MSmlDmDDFObject& ddf = ddfRoot->AddChildObjectL( KSyncMLText ); + + TSmlDmAccessTypes *aclTypes = new ( ELeave ) TSmlDmAccessTypes(); + CleanupStack::PushL( aclTypes ); + + // Set Get as acceptable operations + aclTypes->SetGet(); + + ddf.SetDFTitleL( KNSmlDMadapterTitle ); + FillNodeInfoL( ddf, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KNSmlDMadapterDesc, KNullDesC8, KNullDesC8 ); + + + MSmlDmDDFObject& nDmDDF = ddf.AddChildObjectL( KNSmlDefDMAcc ); + FillNodeInfoL( nDmDDF, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KNullDesC8, KNullDesC8, KNullDesC8 ); + + aclTypes->SetAdd(); + // Set rest acceptable operations for data itself + aclTypes->SetReplace(); + aclTypes->SetDelete(); + + TSmlDmAccessTypes aclTypesNoGet; + aclTypesNoGet.SetReplace(); + aclTypesNoGet.SetAdd(); + aclTypesNoGet.SetDelete(); + + TSmlDmAccessTypes aclTypesAR; + aclTypesAR.SetReplace(); + aclTypesAR.SetAdd(); + + TSmlDmAccessTypes aclTypesARG; + aclTypesARG.SetReplace(); + aclTypesARG.SetAdd(); + aclTypesARG.SetGet(); + + TSmlDmAccessTypes aclTypesAG; + aclTypesAG.SetGet(); + aclTypesAG.SetAdd(); + + MSmlDmDDFObject& nProDDF = nDmDDF.AddChildObjectGroupL(); + FillNodeInfoL( nProDDF, *aclTypes, MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNullDesC8, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nAddrDDF = nProDDF.AddChildObjectL( KNSmlDdfAddr ); // Addr + FillNodeInfoL( nAddrDDF, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAddrDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nAddrTypeDDF = nProDDF.AddChildObjectL( KNSmlDdfAddrType ); // AddrType + FillNodeInfoL( nAddrTypeDDF, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nPortNbrDDF = nProDDF.AddChildObjectL( KNSmlDdfPortNbr ); // PortNbr + FillNodeInfoL( nPortNbrDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, + KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nAuthSchemeDDF = nProDDF.AddChildObjectL( KNSmlDdfAuthScheme ); // AuthPref + FillNodeInfoL( nAuthSchemeDDF, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nServerIdDDF = nProDDF.AddChildObjectL( KNSmlDdfServerId ); // ServerId + FillNodeInfoL( nServerIdDDF, aclTypesAG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nServerPWDDF = nProDDF.AddChildObjectL( KNSmlDdfServerPW ); // ServerPW + FillNodeInfoL( nServerPWDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfServerPWDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nServerNonceDDF = nProDDF.AddChildObjectL( KNSmlDdfServerNonce );// ServerNonce + FillNodeInfoL( nServerNonceDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfServerNonceDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nClientUserNameDDF = nProDDF.AddChildObjectL( KNSmlDdfClientUserName ); // ClientUserName + FillNodeInfoL( nClientUserNameDDF, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfClientUserNameDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nClientPWDDF = nProDDF.AddChildObjectL( KNSmlDdfClientPW ); // ClientPW + FillNodeInfoL( nClientPWDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfClientPWDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nClientNonceDDF = nProDDF.AddChildObjectL( KNSmlDdfClientNonce ); // ClientNonce + FillNodeInfoL( nClientNonceDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfClientNonceDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nNameDDF = nProDDF.AddChildObjectL( KNSmlDdfName ); // Name + FillNodeInfoL( nNameDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfNameDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nConRefDDF = nProDDF.AddChildObjectL( KNSmlDdfConRef ); // ConRef + FillNodeInfoL( nConRefDDF, aclTypesARG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfConRefDescription, KNullDesC8, KMimeType ); + + CleanupStack::PopAndDestroy(); //aclTypes + + _DBG_FILE("CNSmlDMSettingsAdapter::DDFStructureL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::UpdateLeafObjectL +// Updates profile leaf object data based on URI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDMSettingsAdapter::UpdateLeafObjectL(): begin"); + TInt index = -1; + if ( !iBufOn) + { + for (TInt val = 0; valCount (); val++) + { + TPtrC8 firstUri = ParentURI (aURI); + if ( iBuffer->At(val).iMappingName->Compare (firstUri)== 0) + { + index = iExecutionIndex = val; + break; + } + } + } + if ( index >= 0) + AddLeafBufferL (aURI, aObject, aStatusRef); + else + { + if( aLUID.Length() == 0 ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::UpdateLeafObjectL( ): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + TInt parentLUID = GetIntObject( aLUID ); + if( parentLUID != iParentLUID ) + { + if( FindProfileIdL( parentLUID ) != EFalse ) + { + iParentLUID = parentLUID; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + SetField( aURI ); + if( !AcceptDMField() ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): KErr field end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + + // Get Database field type + TNSmlDMFieldType fType = GetDMFieldType(); + if ( fType == EWrong ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + TNSmlDMProfileData fData = GetDMField(); + if( fData == ESyncAccepted ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + if( NotValidStrLenght( fData, aObject ) ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): KErr length end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + return; + } + //Authentication data leafs to be handled + if ( fData == EAuthenticationRequired || fData == EClientNonce + || fData == EServerNonce ) + { + //Check if replace command and replace data as defined + + TInt replaceStatus = KErrGeneral; + SetAuthInfoL( iParentLUID + KMaxDataSyncID, fData, aObject, replaceStatus ); + if ( replaceStatus == KErrNone ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + else if ( replaceStatus == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + + _DBG_FILE( "CNSmlDMSettingsAdapter::UpdateLeafObjectL():end" ); + return; + } + + TInt rValue = SetDMFieldDataL( iParentLUID, aObject, fData ); + if ( fData == EProfilePort ) + { + // in case port is updated, save status ref to be used in + // CompleteOutstandingCmdsL + if(rValue==KErrNone) + { + iPortBuffer[iPortBuffer.Count()-1].iPortBufStatusRef = aStatusRef; + } + else if( rValue == KErrOverflow) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + else + { + if( rValue != KErrNone ) + { + if( rValue == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else if( rValue == KErrInUse ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); + } + else if( rValue == KErrNoMemory ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + } + } + + _DBG_FILE( "CNSmlDMSettingsAdapter::UpdateLeafObjectL():end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::DeleteObjectL +// Deletes whole profile or leaf object data acording to aURI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL( ): begin" ); + + if( aURI.Find( KNSmlDdfConRef ) != KErrNotFound ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL(): NOT ALLOWED end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + // Check which field going to be handled + SetField( aURI ); + + // Check if valid field + if( !AcceptDMField() ) + { + + // Delete whole profile if aURI called for node + TInt last = aURI.LocateReverse( '/' ); + TInt pos = aURI.Find( KNSmlDefDMAcc ); + if( last - 5 == pos ) + { + + // If called for node means that profile will deleted from database + iLUID = IntLUID( aLUID ); + DBG_ARGS8( _S8("DeleteObjectL: URI %S LUID = %d"), &aURI, iLUID ); + + if( FindProfileIdL( iLUID ) == EFalse ) + { + _DBG_FILE( + "CNSmlDMSettingsAdapter::DeleteObjectL( ): notfound end"); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + else + { + TInt sRet = DeleteProfileL( iLUID + KMaxDataSyncID ); + if ( sRet != KErrNone ) + { + if( sRet == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, + CSmlDmAdapter::ENotFound ); + } + else if( sRet == KErrInUse ) + { + iCallBack->SetStatusL( aStatusRef, + CSmlDmAdapter::EObjectInUse ); + } + else + { + iCallBack->SetStatusL( aStatusRef, + CSmlDmAdapter::EError ); + } + return; + } + else + { + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL( ): EOk end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + } + } + else + { + _DBG_FILE( + "CNSmlDMSettingsAdapter::DeleteObjectL( ): EInvalidObject end" ); + iCallBack->SetStatusL( aStatusRef,CSmlDmAdapter::EInvalidObject ); + return; + } + }//Delete whole Profile + + iLUID = IntLUID( aLUID ); + if ( iLUID != iParentLUID ) + { + if( FindProfileIdL( iLUID ) == EFalse ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL( ): end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + iParentLUID = iLUID; + } + + if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) + { + DeleteDMAuthInfoL( iLUID, EAuthenticationRequired ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + else if( iField->Compare( KNSmlDdfClientNonce ) == 0 ) + { + DeleteDMAuthInfoL( iLUID, EClientNonce ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + else if( iField->Compare(KNSmlDdfServerNonce) == 0 ) + { + DeleteDMAuthInfoL( iLUID, EServerNonce ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + + // Sets default value if not null field + HBufC8* dataObject = HBufC8::NewLC( 15 ); + dataObject->Des().Format( KNullDesC8 ); + + _LIT8(aType, "text/plain"); + iLeafType = EDMDelete; + UpdateLeafObjectL( aURI, aLUID, *dataObject, aType, aStatusRef ); + CleanupStack::PopAndDestroy(); //dataObject + iLeafType = EDMUnset; + + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL( ): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::FetchLeafObjectL +// Fetches profile leaf object data acordint to aURI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): begin" ); + DBG_ARGS(_S16( "DM:Fetch aURI - %S - %S"), &aURI, &aLUID ); + + iLUID = IntLUID( aLUID ); + if ( iLUID >= 0 ) + { + if( FindProfileIdL( iLUID ) == EFalse ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + else + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + // Check which field going to be handled + SetField(aURI); + + // Check if valid field + if( !AcceptDMField() ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): EInvalidObject end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + + // Get Database field type + TInt fType = GetDMFieldType(); + if ( fType == EWrong ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + TNSmlDMProfileData fieldId = GetDMField(); + if( fieldId == ESyncAccepted ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + CBufBase *lObject = CBufFlat::NewL( 128 ); + CleanupStack::PushL( lObject ); + lObject->Reset(); + + CSmlDmAdapter::TError status; + + if ( fType == EStr || fType == EInt || fType == EBin ) + { + TInt rValue = GetObjectL( iLUID, fieldId, *lObject ); + if( rValue != KErrNone ) + { + if( rValue == KErrNotFound ) + { + status = CSmlDmAdapter::ENotFound; + } + else if( rValue == KErrInUse ) + { + status = CSmlDmAdapter::EObjectInUse; + } + else if( rValue == KErrNoMemory ) + { + status = CSmlDmAdapter::ENoMemory; + } + else + { + status = CSmlDmAdapter::EError; + } + } + else + { + status = CSmlDmAdapter::EOk; + } + } + else + { + CleanupStack::PopAndDestroy(); //lObject + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + return; + } + iCallBack->SetStatusL( aStatusRef, status ); + + if(status==CSmlDmAdapter::EOk) + { + iCallBack->SetResultsL( aResultsRef, *lObject, aType ); + } + + CleanupStack::PopAndDestroy(); //lObject + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CSmlDmSettingsAdapter::ChildURIListL +// Function returns the list of profiles or leafs of the profile +// acording to aURI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): begin" ); + CBufBase *currentURISegmentList = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentURISegmentList ); + + if( aURI.Match( KDmAccMatch ) != KErrNotFound ) + { + // Check if Profile exists + TInt checkLUID = GetIntObject( aLUID ); + if( FindProfileIdL( checkLUID ) ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAcc ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + + CleanupStack::PopAndDestroy( ); // currentURISegmentList + _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): end" ); + return; + } + else if( aURI.Match( KDmAccMatch2 ) != KErrNotFound ) + { + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + + for( TInt p = 0; p < profileIdArray.Count(); p++ ) + { + TBool notInList = ETrue; + TInt newline = 0; + TInt ddId = profileIdArray[p] - KMaxDataSyncID; + + while( notInList && newline < aPreviousURISegmentList.Count() ) + { + TInt ppId = GetIntObject( aPreviousURISegmentList.At(newline).iURISegLUID ); + if( ppId == ddId ) + { + notInList = EFalse; + break; + } + newline++; + } + if( notInList ) + { + _LIT8( Kprev, "DMId" ); + TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid + TInt fixedProfId = profileIdArray[p] - KMaxDataSyncID; //fit to 3 decimal + addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); + + currentURISegmentList->InsertL( currentURISegmentList->Size(), addNAME ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash ); + DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME ); + + // KNSmlDMStart includes start text for URISeg + TBuf8<20> addURI; // SyncML/DMAcc/DMIdnnn , nnn = profileid + addURI.Append( KNSmlDMStart ); + addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); + + TBuf8<3> addLUID; + addLUID.Num( fixedProfId ); + + // Also added to mapping + iCallBack->SetMappingL( addURI, addLUID ); + } + else + { // Add those in PreviousList which are on database + currentURISegmentList->InsertL( currentURISegmentList->Size(), + aPreviousURISegmentList.At(newline).iURISeg ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash ); +// DBG_ARGS8( _S8("InList: Id = %d Name %S"), newline, +// aPreviousURISegmentList.At(newline).iURISeg ); + } + } + CleanupStack::PopAndDestroy( 1 );//profileIdArray + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + CleanupStack::PopAndDestroy( 1 ); // currentURISegmentList + return; + } + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::AddNodeObjectL +// Adds new DM-settings profile to database +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeObjectL(): begin" ); + + if( aParentLUID.Length() > 0 ) + { + iParentLUID = GetIntObject( aParentLUID ); + if( FindProfileIdL( iParentLUID ) != EFalse )// iProfile != NULL) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeObjectL(): EAlreadyExists end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + return; + } + } + AddNodeBufferL (aURI, aStatusRef); + _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeObjectL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::UpdateLeafObjectL( const TDesC8&, const TDesC8&, + RWriteStream*&, const TDesC8&, + const TInt ) + { + //Not supported because data streaming is not supported by this adapter. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::FetchLeafObjectSizeL +// This function fetches leaf object and returns its size. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectSizeL() : begin" ); + DBG_ARGS( _S16("DM:Fetch aURI - %S - %S"), &aURI, &aLUID ); + + iLUID = IntLUID( aLUID ); + if ( iLUID >= 0 ) + { + if( FindProfileIdL( iLUID ) == EFalse ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + else + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + // Check which field going to be handled + SetField( aURI ); + + // Check if valid field + if( !AcceptDMField() ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): EInvalidObject end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + + // Get Database field type + TInt fType = GetDMFieldType(); + if ( fType == EWrong ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + CBufBase *lObject = CBufFlat::NewL( 128 ); + CleanupStack::PushL( lObject ); + lObject->Reset(); + + if ( fType == EStr || fType == EInt || fType == EBin ) + { + TInt rValue = GetObjectL( iLUID, GetDMField(), *lObject ); + if( lObject->Size() == 0 || rValue != KErrNone ) + { + if( rValue == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else if( rValue == KErrInUse ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); + } + else if( rValue == KErrNoMemory ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + } + else + { + CleanupStack::PopAndDestroy();//lObject + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + TInt objSizeInBytes = lObject->Size(); + TBuf8<16> stringObjSizeInBytes; + stringObjSizeInBytes.Num( objSizeInBytes ); + + lObject->Reset(); + lObject->InsertL( 0, stringObjSizeInBytes ); + iCallBack->SetResultsL( aResultsRef, *lObject, aType ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); + + CleanupStack::PopAndDestroy( 1 ); //lObject + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectSizeL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::ExecuteCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::ExecuteCommandL( const TDesC8&, const TDesC8&, + const TDesC8&, const TDesC8&, + const TInt ) + { + //Not supported. Command execution via DM settings adapter not possible. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::ExecuteCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::ExecuteCommandL( const TDesC8&, const TDesC8&, + RWriteStream*&, const TDesC8&, + const TInt ) + { + //Not supported. Command execution via DM settings adapter not possible. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::CopyCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::CopyCommandL( const TDesC8&, const TDesC8&, + const TDesC8&, const TDesC8&, + const TDesC8&, TInt ) + { + //Not supported. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::StartAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::StartAtomicL() + { + //Not supported. Handling Atomic command cycles not supported by the adapter. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::CommitAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::CommitAtomicL() + { + //Not supported. Handling Atomic command cycles not supported by the adapter. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::RollbackAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::RollbackAtomicL() + { + //Not supported. Handling Atomic command cycles not supported by the adapter. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::StreamingSupport() +// Indicates if streaming is supported. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::StreamCommittedL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::StreamCommittedL() + { + //Not supported. Streaming not supported by the DM settings adapter. + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::CompleteOutstandingCmdsL() +// If buffering used, commands must be executed before returning this function. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::CompleteOutstandingCmdsL() + { + // Check if Buffered + for (int val=0; valCount ();val++) + { + if ( !iBuffer->At(val).iExecuted) + { + TInt count = iBuffer->At(val).iLeafBuf->Count ()-1; + iExecutionIndex = val; + iComplete = ETrue; + ExecuteBufferL (); + } + } + // if port was updated, set it + for (TInt i = 0;iSetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EError ); + } + else + { + iCallBack->SetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EOk ); + } + + } + iPortBuffer.Reset(); + iComplete = EFalse; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::AcceptDMField +// This function checks if field to be handled is valid. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter::AcceptDMField() + { + _DBG_FILE("CNSmlDMSettingsAdapter::AcceptDMField(): begin"); + + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfConRef ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfId ) == 0 ) + { + return ETrue; + } + + _DBG_FILE( "CNSmlDMSettingsAdapter::AcceptDMField(): end" ); + return EFalse; // Not a valid Type + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetDMField +// Matches URI fieldname to DM-database. +// ----------------------------------------------------------------------------- +TNSmlDMProfileData CNSmlDMSettingsAdapter::GetDMField() const + { + + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + return EProfileMediumType; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) + { + return EProfileURL; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + return EProfilePort; + } + else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) + { + return EAuthenticationRequired; + } + else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) + { + return EServerId; + } + else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) + { + return ESharedSecret; + } + else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) + { + return EServerNonce; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + return EProfileDMServerUsername; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) + { + return EProfileDMServerPassword; + } + else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 ) + { + return EClientNonce; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + return EProfileName; + } + else if ( iField->Compare( KNSmlDdfId ) == 0 ) + { + return EProfileId; + } + else if ( iField->Compare( KNSmlDdfConRef ) == 0 ) + { + return EProfileIAPId; + } + + _DBG_FILE( "CNSmlDMSettingsAdapter::GetDMField(): Error" ); + return ESyncAccepted; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetDMFieldType +// Gets field data type. +// ----------------------------------------------------------------------------- +TNSmlDMFieldType CNSmlDMSettingsAdapter::GetDMFieldType() const + { + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + return EInt; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + return EInt; + } + else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) + { + return EInt; + } + else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) + { + return EBin; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) + { + return EStr; + } + else if (iField->Compare(KNSmlDdfClientNonce) == 0) + { + return EBin; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfConRef ) == 0 ) + { + return EInt; + } + else if ( iField->Compare( KNSmlDdfId ) == 0 ) + { + return EInt; + } + + _DBG_FILE( "CNSmlDMSettingsAdapter::GetDMFieldType(): Error" ); + return EWrong; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::IntLUID +// Returns integer value for a profile LUID. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::IntLUID( const TDesC8& aLUID ) + { + TLex8 lLex( aLUID ); + + if( lLex.Val( iLUID ) == KErrNone ) + { + return iLUID; + } + else + { + return -1; + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetIntObject +// Returns integer value for a aObject. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::GetIntObject( const TDesC8& aObject ) + { + TLex8 lLex( aObject ); + + TInt value = 0; + + if( lLex.Val( value ) != KErrNone ) + { + return KErrNotFound; + } + else + { + return value; + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetIntObject16() +// Returns Integer Value for a 16 bit data object. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::GetIntObject16( const TDesC& aObject ) + { + TLex16 lLex( aObject ); + + TInt value = 0; + + if( lLex.Val( value ) == KErrNone ) + { + return value; + } + else + { + return value; + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetIntObjectLC +// Converts integer to HBufC8 type buffer and returns reference to it. +// ----------------------------------------------------------------------------- +TDesC8& CNSmlDMSettingsAdapter::SetIntObjectLC( const TInt& aObject ) + { + HBufC8* buf = HBufC8::NewLC( 8 ); + TPtr8 ptrBuf = buf->Des(); + + ptrBuf.Num( aObject ); + return *buf; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::NotValidStrLenght +// Checks if data length is valid. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter::NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, + const TDesC8& aSource ) + { + TInt lLen = aSource.Length(); + TBool lBool = EFalse; + + switch ( aProfileItem ) + { + case ( EProfileName ) : + { + if( lLen > KNSmlMaxProfileNameLength ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileDMServerUsername ) : + { + if( lLen > KNSmlMaxUsernameLength ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileDMServerPassword ) : + { + if( lLen > KNSmlMaxPasswordLength ) + { + lBool = ETrue; + } + } + break; + + case ( ESharedSecret ) : + { + if( lLen > KNSmlDmSharedSecretMaxLength ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileURL ) : + { + if( lLen > KNSmlMaxURLLength ) + { + lBool = ETrue; + } + } + break; + + case ( EServerId ) : + { + if( lLen > KNSmlDmServerIdMaxLength ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileIAPId ) : + { + if( lLen > KNSmlMaxURLLength ) + { + lBool = ETrue; + } + } + break; + + case ( EAuthenticationRequired ) : + { + if( lLen > 20 ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileId ) : + case ( EProfilePort ) : + case ( EProfileMediumType ) : + { + if( lLen > 8 ) + { + lBool = ETrue; + } + } + break; + + case ( EServerNonce ) : + case ( EClientNonce ) : + { + lBool = EFalse; + } + break; + + default: + { + lBool = ETrue; + } + } + + return lBool; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetField +// Last element of the URI (after last '/') is returned. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetField( const TDesC8& aSource ) + { + if ( aSource.LocateReverse( KNSmlDMUriSeparator ) == KErrNotFound ) + { + iField->Des().Format( aSource ); + } + else + { + iField->Des().Format( aSource.Mid( aSource.LocateReverse( KNSmlDMUriSeparator ) + 1 ) ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::ConvertTo8LC +// Converts string value to 8-bit and returns reference. +// ----------------------------------------------------------------------------- +TDesC8& CNSmlDMSettingsAdapter::ConvertTo8LC( const TDesC& aSource ) + { + HBufC8* buf = HBufC8::NewLC( aSource.Length() * 2 ); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); + + return *buf; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::ConvertTo16LC +// Converts string value to 16-bit and returns reference. +// ----------------------------------------------------------------------------- +TDesC16& CNSmlDMSettingsAdapter::ConvertTo16LC( const TDesC8& aSource) + { + HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); + TPtr16 bufPtr16 = buf16->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aSource ); + + return *buf16; + } + +// ------------------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetConRefL +// Gets the URI for given aObject (IAP ID). +// ------------------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::GetConRefL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetConRefL() : begin" ); + TInt profIAPid = -1; + TInt apIdResponse = GetProfileIAPIdL( profIAPid ); + if( profIAPid < 0 ) + { + return KErrNone; + } + if( apIdResponse != KErrNone ) + { + return KErrNotFound; + } + CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); + CleanupStack::PushL( apmatch ); + HBufC8* uri8 = apmatch->URIFromIAPIdL( profIAPid ); + if( uri8 ) + { + CleanupStack::PushL( uri8 ); + aObject.InsertL( aObject.Size(), uri8->Des() ); + CleanupStack::PopAndDestroy(); // uri8 + } + else + { + CleanupStack::PopAndDestroy(); // apMatch + return KErrGeneral; + } + CleanupStack::PopAndDestroy(); // iapMatch + _DBG_FILE( "CNSmlDSSettingsAdapter::GetToNAPIDL() : end" ); + return KErrNone; + } + +// ------------------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetConRefL() +// Set the profile IAP Id value according to given URI. +// ------------------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetConRefL( const TInt aLUID, const TDesC8& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetConRefL() : begin" ); + CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); + CleanupStack::PushL( apmatch ); + TInt lIAPid = apmatch->IAPIdFromURIL( aObject ); + CleanupStack::PopAndDestroy(); // iapmatch + if(aObject.Length() >0 && lIAPid == KErrNotFound) + { + return KErrGeneral; + } + TInt apIdResponse = SetProfileConnectionPropertyL( aLUID, lIAPid ); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetConRefL() : end" ); + return apIdResponse; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter::ParseUri +// Resolves portnbr (separated with ':') as integer from Uri. +// ------------------------------------------------------------------------------------------------ +TInt CNSmlDMSettingsAdapter::ParseUri( const TDesC8& aRealURI, TInt& aPort ) + { + TInt offset=0; + //http: + if( aRealURI.Find( KNSmlDMSettingsHTTP )==0 )//http: + { + offset = KNSmlDMSettingsHTTP().Length(); + } + else if( aRealURI.Find( KNSmlDMSettingsHTTPS )==0 )//https: + { + offset = KNSmlDMSettingsHTTPS().Length(); + } + + TBool portFound=EFalse; + ////123.234.345.456:80/syncml + for( TInt i = offset; i < aRealURI.Length(); i++ ) + { + if( aRealURI[i] == KNSmlDMColon )// ':' + { + portFound = ETrue; + offset=i; + } + if( portFound && aRealURI[i] == KNSmlDMUriSeparator ) // '/' + { + aPort = GetIntObject( aRealURI.Mid( (offset + 1), (i - offset-1) ) ); + } + else if ( portFound && i == aRealURI.Length() - 1 ) // last char + { + // port is from offset to the end + aPort = GetIntObject( aRealURI.Right( aRealURI.Length() - offset - 1 ) ); + } + } + + if( aPort != 0 ) + { + return KErrNone; + } + else + { + return KErrNotFound; + } + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::OpenSyncSessionAndDSProfileL +// The function opens the server session and DM profile. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::OpenSyncSessionAndProfileL( const TInt aIntLUID, + TSmlOpenMode aMode ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::OpenSyncSessionAndProfileL(): begin" ); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + TInt trueLuid = aIntLUID + KMaxDataSyncID; + TInt rValue(KErrNone); + + if(trueLuid!=iCurrentProfile) + { + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + TInt index = profileIdArray.Find( trueLuid ); + CleanupStack::PopAndDestroy(); //profileIdArray + if( index == KErrNotFound ) + { + return KErrNotFound; + } + TRAP( rValue, iProfile.OpenL( iSyncSession, trueLuid, aMode ) ); + iCurrentProfile = trueLuid; + if( rValue != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + } + } + _DBG_FILE( "CNSmlDMSettingsAdapter::OpenSyncSessionAndProfileL(): end" ); + return rValue; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::FindProfileId +// Function checks if profile can be found. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter::FindProfileIdL( const TInt aIntLUID ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FindProfileIdL(): begin" ); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + + RArray profileList; + CleanupClosePushL( profileList ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileList, usageType ); + if( profileList.Count() == 0 ) + { + CleanupStack::PopAndDestroy(); //profileList + return EFalse; + } + TInt item = profileList.Find( aIntLUID + KMaxDataSyncID ); + CleanupStack::PopAndDestroy(); //profileList + if( item != KErrNotFound ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FindProfileIdL(): end" ); + return ETrue; + } + _DBG_FILE( "CNSmlDMSettingsAdapter::FindProfileIdL(): end" ); + return EFalse; + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::CreateNewProfileL +// The function creates new DM profile via client API. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::CreateNewProfileL( TInt& aPID ) + { + _DBG_FILE("CNSmlDMSettingsAdapter::CreateNewProfileL(): begin"); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + TRAPD( value1, iProfile.CreateL( iSyncSession ) ); + if( value1 != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + return value1; + } + + TRAPD( value2, iProfile.UpdateL() ); + if( value2 != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + return value2; + } + + aPID = iProfile.Identifier(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::CreateNewProfileL(): end" ); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileServerURIL() +// The function sets the server URL for a profile. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileServerURIL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerURIL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + if( transportIdArray.Count() == 0 ) + { + CleanupStack::PopAndDestroy();//transportIdArray + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + + TInt newPort(0); + + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, transportIdArray[0] ); + + if(ParseUri(aObj,newPort)==KErrNotFound) + { + TInt port = 0; + ParseUri(conn.ServerURI(),port); + if(port==0) + { + port = 80; + } + + TBuf8<5> buf; + buf.Num( port ); + + TInt totalSize = aObj.Length() + buf.Length() + 1; + HBufC8* newServerURI = HBufC8::NewLC( totalSize ); + SetPortNrToAddrStr( aObj, newServerURI, buf ); + conn.SetServerURIL( *newServerURI ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( newServerURI ); + } + else + { + conn.SetServerURIL( aObj ); + conn.UpdateL(); + } + + + iProfile.UpdateL(); + + CleanupStack::PopAndDestroy( 2 ); //transportIdArray, conn + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerURIL(): end" ); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileDisplayNameL() +// The function sets the display name for a profile. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileDisplayNameL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileDisplayNameL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + iProfile.SetDisplayNameL( ConvertTo16LC( aObj ) ); + iProfile.UpdateL(); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileDisplayNameL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileUserNameL +// The function sets the profile user name. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileUserNameL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileUserNameL(): begin" ); + TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + iProfile.SetUserNameL( aObj ); + iProfile.UpdateL(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileUserNameL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileProtocolVersionL +// The function sets the protocol version to be supported. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileProtocolVersionL( const TInt aPID, + const TDesC8& ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileProtocolVersionL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + //The syncSession to Sync server is open. + TSmlProtocolVersion protocol = ESmlVersion1_2; + iProfile.SetProtocolVersionL( protocol ); + TRAPD( iError, iProfile.UpdateL() ); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileProtocolVersionL(): begin" ); + return iError; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileServerIdL +// The function sets the profile ServerId value. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileServerIdL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE("CNSmlDMSettingsAdapter::SetProfileServerIdL(): begin"); + TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + iProfile.SetServerIdL( aObj ); + TRAP(retVal,iProfile.UpdateL() ); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerIdL(): end" ); + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileServerPasswordL +// The function sets the profile server password. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileServerPasswordL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerPasswordL(): begin" ); + TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + iProfile.SetServerPasswordL( aObj ); + iProfile.UpdateL(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerPasswordL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfilePasswordL +// The function sets the profile password. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfilePasswordL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfilePasswordL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + iProfile.SetPasswordL( aObj ); + iProfile.UpdateL(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfilePasswordL(): begin" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileConnectionPropertyL +// This function sets the profile IAP id. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileConnectionPropertyL( const TInt aLUID, + const TInt aIAPid ) + { + TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + RSyncMLTransport transport; + CleanupClosePushL( transport ); + transport.OpenL( iSyncSession, connIdArray[0] ); + const CSyncMLTransportPropertiesArray& props = transport.Properties(); + TInt index = props.Find( KNSmlIAPId ); + if( index > 0 ) + { + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, connIdArray[0] ); + HBufC8* apIdBuffer = HBufC8::NewLC( 4 ); + TPtr8 ptrIapIdBuf = apIdBuffer->Des(); + ptrIapIdBuf.Num( aIAPid ); + conn.SetPropertyL( KNSmlIAPId, ptrIapIdBuf ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( 2 ); //conn, apIdBuffer + retVal = KErrNone; + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy( 1 ); //transport + } + else + { + retVal = KErrNotFound; + } + iCurrentProfile = 0; + iProfile.Close(); + CleanupStack::PopAndDestroy(); //connIdArray + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::DeleteProfileL +// The function deleted the profile from DM database. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::DeleteProfileL( const TInt aPID ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteProfileL(): begin" ); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + TInt index = profileIdArray.Find( aPID ); + if ( index == KErrNotFound ) + { + //No match + CleanupStack::PopAndDestroy();//profileIdArray + return KErrNotFound; + } + iSyncSession.DeleteProfileL( aPID ); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + CleanupStack::PopAndDestroy();//profileIdArray + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteProfileL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetObjectL +// The function checks which leaf data to be fetched. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, + CBufBase& aObject ) + { + TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + switch ( aDMField ) + { + case ( EProfileName ) : + { + GetProfileNameL( aObject ); + } + break; + + case ( EProfileDMServerUsername ) : + { + GetProfileUserNameL( aObject ); + } + break; + + case ( EProfileURL ) : + { + GetProfileServerURLL( aObject ); + TInt port(0); + if(ParseUri(aObject.Ptr(0),port)==KErrNone) + { + HBufC8* addr = aObject.Ptr(0).AllocLC(); + aObject.Reset(); + TInt portStart = addr->LocateReverse(KNSmlDMColon); + aObject.InsertL(aObject.Size(),addr->Left(portStart)); + + TInt portLen=addr->Mid(portStart).Locate(KNSmlDMUriSeparator); + if(portLen!=KErrNotFound) + { + aObject.InsertL(aObject.Size(),addr->Mid(portStart+portLen)); + } + + CleanupStack::PopAndDestroy(); //addr + } + } + break; + + case ( EServerId ) : + { + GetServerIdL( aObject ); + } + break; + + case ( EProfileIAPId ) : + { + retVal = GetConRefL( aObject ); + } + break; + + case ( EProfilePort ) : + { + GetProfileServerURLL( aObject ); + if ( aObject.Size() == 0 ) + { + retVal = KErrNone; + break; + } + GetProfilePortNumberL ( aObject ); + } + break; + + case ( EProfileDMServerPassword ) : + { + retVal = EInvalidObject; + } + break; + + case ( ESharedSecret ) : + {//ServerPW + retVal = EInvalidObject; + } + break; + case ( EProfileId ) : + break; + case ( EProfileMediumType ) : + { + retVal = GetProfileConnectiontypeL( aObject ); + } + break; + + case ( EAuthenticationRequired ) : + case ( EServerNonce ) : + case ( EClientNonce ) : + { + retVal = GetDMAuthInfoL( aLUID, aDMField, aObject ); + } + break; + + default: + { + User::Panic( KNSmlIndexOutOfBoundStr, KNSmlPanicIndexOutOfBound ); + } + } + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL() +// The function sets the profile port number. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL( const TInt aLUID, + const TDesC8& aPort ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL(): begin" ); + TInt retVal = KErrNone; + + if( iPortNbr ) + { + delete iPortNbr; + iPortNbr = NULL; + } + iPortNbr = HBufC8::NewL( aPort.Length() ); + TPtr8 newPortNbr = iPortNbr->Des(); + newPortNbr.Append( aPort ); + + retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL(): end" ); + return retVal; + } + + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, transportIdArray[0] ); + + HBufC8* serverURI = conn.ServerURI().AllocLC(); + if( serverURI->Length() == 0 ) + { + iCurrentProfile = 0; + iProfile.Close(); + CleanupStack::PopAndDestroy( 3 ); //transportIdArray, conn, serverURI + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL(): end" ); + return retVal; + } + TInt totalSize = serverURI->Size() + newPortNbr.Size() + 1; + HBufC8* newServerURI = HBufC8::NewL( totalSize ); + CleanupStack::PushL( newServerURI ); + SetPortNrToAddrStr( *serverURI, newServerURI, newPortNbr ); + + conn.SetServerURIL( *newServerURI ); + conn.UpdateL(); + + CleanupStack::PopAndDestroy( 4 ); //transportIdArray, conn, serverURI, newServerURI + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL(): end" ); + return retVal; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter::SetPortNrToAddrStr +// Sets a portnbr (separated with ':') to profile server URI. +// ------------------------------------------------------------------------------------------------ +void CNSmlDMSettingsAdapter::SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, + const TDesC8& aPort ) + { + TInt offset=0; + if( aSrvURI.Find( KNSmlDMSettingsHTTP ) == 0 )//http:// + { + offset = KNSmlDMSettingsHTTP().Length(); + } + else if( aSrvURI.Find( KNSmlDMSettingsHTTPS ) == 0 )//https:// + { + offset = KNSmlDMSettingsHTTPS().Length(); + } + TInt portStart = -1; + TInt separatorPos = aSrvURI.Length(); + TInt i = 0; + for( i = offset; i < aSrvURI.Length(); i++ ) + { + if( aSrvURI[i] == KNSmlDMColon )// ':' + { + portStart = i; + } + if( aSrvURI[i] == KNSmlDMUriSeparator )// '/' + { + separatorPos = i; + break; + } + } + + TPtr8 ptrNewSrvURI = aNewURI->Des(); + if( portStart < 0 && separatorPos > 0 && iLeafType != EDMDelete ) + { + ptrNewSrvURI.Append( aSrvURI.Left( separatorPos ) );//http://123.234.345.456 + ptrNewSrvURI.Append( KNSmlDMColon ); + ptrNewSrvURI.Append( aPort ); + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); + } + else if ( portStart > 0 && separatorPos > 0 && iLeafType != EDMDelete ) + { + ptrNewSrvURI.Append( aSrvURI.Left( portStart + 1 ) );//123.234.345.456: + ptrNewSrvURI.Append( aPort );//123.234.345.456:xx(x) + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); + } + else if ( portStart > 0 && iLeafType == EDMDelete ) //delete port number from uri + { + ptrNewSrvURI.Append( aSrvURI.Left( portStart ) );//123.234.345.456 + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); + } + else + { + ptrNewSrvURI.Append( aSrvURI ); + } + return; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter::SetDMFieldDataL +// Selects and Sets value to a field based on field id got from URI. +// ------------------------------------------------------------------------------------------------ +TInt CNSmlDMSettingsAdapter::SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, + const TNSmlDMProfileData aField ) + { + TInt rValue = KErrGeneral; + switch ( aField ) + { + case ( EProfileURL ) : + { + rValue = SetProfileServerURIL( aLUID, aObject ); + } + break; + case ( EServerId ) : + { + rValue = SetProfileServerIdL( aLUID, aObject ); + } + break; + case ( ESharedSecret ) : + { + rValue = SetProfileServerPasswordL( aLUID, aObject ); + } + break; + case ( EProfileDMServerUsername ) : + { + rValue = SetProfileUserNameL( aLUID, aObject ); + } + break; + case ( EProfileDMServerPassword ) : + { + rValue = SetProfilePasswordL( aLUID, aObject ); + } + break; + case ( EProfileName ) : + { + rValue = SetProfileDisplayNameL( aLUID, aObject ); + } + break; + case ( EProfileIAPId ) : + { + rValue = SetConRefL( aLUID, aObject ); + } + break; + case ( EProfileId ) : + { + } + break; + case ( EProfilePort ) : + { + if(aObject.Size()<=5) + { + TInt port = GetIntObject(aObject); + if( port > KPortMinSize && port < KPortMaxSize ) + { + TPortBuffer element; + element.iPortBuf=aObject; + element.iPortBufLUID = aLUID; + iPortBuffer.Append(element); + rValue=KErrNone; + } + else + { + if (port <= KPortMinSize ) + rValue = KErrUnderflow; + else + rValue=KErrOverflow; + } + } + else + { + rValue=KErrOverflow; + } + // save information of the port + } + break; + case ( EProfileMediumType ) : + { + if ( iLeafType == EDMDelete ) + { + return KErrNone; + } + iObject = GetIntObject( aObject ); + if(iObject<0) + { + iObject = EHttp; + } + rValue = SetProfileAddrTypeL( aLUID, iObject ); + } + break; + case ( EAuthenticationRequired ) : + case ( EClientNonce ) : + case ( EServerNonce ) : + break; + + default: + rValue = KErrNotSupported; + } + return rValue; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::FillNodeInfoL +// The function fills the node or leaf information. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription, + const TDesC8& aDefaultValue, + const TDesC8& aMimeType ) + { + aNode.AddDFTypeMimeTypeL( aMimeType ); + aNode.SetAccessTypesL( aAccTypes ); + aNode.SetDescriptionL( aDescription ); + aNode.SetOccurenceL( aOccurrence ); + aNode.SetDefaultValueL( aDefaultValue ); + aNode.SetScopeL( aScope ); + aNode.SetDFFormatL( aFormat ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetDMAuthInfoL +// This function gets authentication data from private API. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::GetDMAuthInfoL( const TInt aLUID, + const TNSmlDMProfileData aField, + CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetDMAuthInfoL(): begin" ); + + CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo; + CleanupStack::PushL( authInfo ); + + authInfo->iProfileId = aLUID + KMaxDataSyncID; + iPrivateApi.OpenL(); + TInt ret = KErrNone; + + TRAPD(err,iPrivateApi.GetDMAuthInfoL( *authInfo )); + + if(err==KErrNone) + { + if ( aField == EServerNonce ) + { + aObject.InsertL( aObject.Size(), *authInfo->iServerNonce ); + } + else if ( aField == EClientNonce ) + { + aObject.InsertL( aObject.Size(), *authInfo->iClientNonce ); + } + else if ( aField == EAuthenticationRequired ) + { + TUint authPref = authInfo->iAuthPref; + if( authPref == ENoAuth ) + { + aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefNoAuth ); + } + else if( authPref == EBasic ) + { + aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefBasic ); + } + else if( authPref == EMD5 ) + { + aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefMD5 ); + } + else + { + aObject.InsertL( aObject.Size(), KNullDesC8 ); + ret = KErrGeneral; + } + } + } + iPrivateApi.Close(); + CleanupStack::PopAndDestroy(authInfo); + _DBG_FILE( "CNSmlDMSettingsAdapter::GetDMAuthInfoL(): end" ); + return ret; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::DeleteDMAuthInfoL +// This function resets the authentication data. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::DeleteDMAuthInfoL( const TInt aLUID, + const TNSmlDMProfileData aField ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteDMAuthInfoL(): begin" ); + CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo;; + CleanupStack::PushL( authInfo ); + authInfo->iProfileId = aLUID; + iPrivateApi.OpenL(); + iPrivateApi.GetDMAuthInfoL( *authInfo ); + if( aField == EServerNonce ) + { + authInfo->iServerNonce->Des().Delete( 0, authInfo->iServerNonce->Des().Size() ); + authInfo->iServerNonce->Des().Insert( 0, KNullDesC8 ); + } + else if( aField == EClientNonce ) + { + authInfo->iClientNonce->Des().Delete( 0, authInfo->iClientNonce->Des().Size() ); + authInfo->iClientNonce->Des().Insert( 0, KNullDesC8 ); + } + else if( aField == EAuthenticationRequired ) + { + authInfo->iAuthPref = 0; + } + iPrivateApi.SetDMAuthInfoL( *authInfo ); + iPrivateApi.Close(); + CleanupStack::PopAndDestroy(authInfo); + _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteDMAuthInfoL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetProfileAddrTypeL +// This function sets the AddrType value. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::SetProfileAddrTypeL( const TInt aLUID, + const TInt aIntObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileAddrTypeL(): begin" ); + TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileAddrTypeL(): end" ); + return retVal; + } + TInt mediumType = ENone; + GetMediumTypeL( aIntObj, mediumType ); + if( mediumType == ENone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, transportIdArray[0] ); + if(mediumType!=transportIdArray[0]) + { + if ( !FeatureManager::FeatureSupported( KFeatureIdSyncMlDmObex ) ) + { + CleanupStack::PopAndDestroy( 2 );//transportIdArray, conn + return EInvalidObject; + } + else + { + conn.CreateL(iProfile,mediumType); + } + } + HBufC8* sURI = conn.ServerURI().AllocLC(); + conn.SetServerURIL( *sURI ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileAddrTypeL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetProfileConnectiontypeL +// The function gets the profile medium type. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::GetProfileConnectiontypeL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileConnectiontypeL(): begin" ); + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + TInt transportItems = transportIdArray.Count(); + if( transportItems == 0 ) + { + //No matching items + CleanupStack::PopAndDestroy(); //transportIdArray + return KErrGeneral; + } + else if( transportItems > 1 ) + { + //Error case : against specification + CleanupStack::PopAndDestroy(); //transportIdArray + return KErrGeneral; + } + TInt mediumType = ENone; + if ( transportIdArray[0] == KUidNSmlMediumTypeInternet.iUid ) + { + mediumType = EHttp; + } + else if ( transportIdArray[0] == KUidNSmlMediumTypeBluetooth.iUid || + transportIdArray[0] == KUidNSmlMediumTypeUSB.iUid || + transportIdArray[0] == KUidNSmlMediumTypeIrDA.iUid ) + { + mediumType = EObex; + } + aObject.InsertL( aObject.Size(), SetIntObjectLC( mediumType ) ); + CleanupStack::PopAndDestroy( 2 ); //transportIdArray, SetIntObjectLC + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetProfileIAPIdL +// The function gets the profile IAP Id. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter::GetProfileIAPIdL( TInt& aIAPid ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileIAPIdL(): begin" ); + TInt retVal = KErrGeneral; + aIAPid = -1; + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + RSyncMLTransport transport; + CleanupClosePushL( transport ); + transport.OpenL( iSyncSession, connIdArray[0] ); + const CSyncMLTransportPropertiesArray& props = transport.Properties(); + TInt index = props.Find( KNSmlIAPId ); + if( index > 0 ) + { + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, connIdArray[0] ); + HBufC8* apId = conn.GetPropertyL( KNSmlIAPId ).AllocLC(); + aIAPid = GetIntObject( *apId ); + CleanupStack::PopAndDestroy( 2 ); //conn, apId + retVal = KErrNone; + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy( 1 ); //transport + iCurrentProfile = 0; + iProfile.Close(); + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy(); //connIdArray + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileIAPIdL(): end" ); + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetProfileServerURLL +// The function gets the profile Server URI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::GetProfileServerURLL( CBufBase& aURL ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileServerURLL(): begin" ); + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + if( transportIdArray.Count() > 0 ) + { + RSyncMLConnection profConn; + CleanupClosePushL( profConn ); + profConn.OpenL( iProfile, transportIdArray[0] ); + HBufC8* sURI = profConn.ServerURI().AllocL(); + CleanupStack::PushL( sURI ); + TPtr8 uriPtr = sURI->Des(); + if( uriPtr.Length() > 0 ) + { + aURL.InsertL( aURL.Size(),uriPtr ); + } + else + { + aURL.InsertL( aURL.Size(), KNullDesC8 ); + } + CleanupStack::PopAndDestroy( 2 );//profConn, sURI + } + CleanupStack::PopAndDestroy(); //transportIdArray + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileServerURLL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetMediumTypeL +// Checks the requested medium type. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::GetMediumTypeL( const TInt aIntObj, + TInt& aMediumType ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetMediumTypeL(): begin" ); + if( aIntObj == EHttp || aIntObj == EWsp ) + { + aMediumType = KUidNSmlMediumTypeInternet.iUid; + return; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iSyncSession.ListTransportsL( transportIdArray ); + + if ( transportIdArray.Find( KUidNSmlMediumTypeBluetooth.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeBluetooth.iUid; + } + else if ( transportIdArray.Find( KUidNSmlMediumTypeUSB.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeUSB.iUid; + } + else if ( transportIdArray.Find( KUidNSmlMediumTypeIrDA.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeIrDA.iUid; + } + CleanupStack::PopAndDestroy(); //transportIdArray + _DBG_FILE( "CNSmlDMSettingsAdapter::GetMediumTypeL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetServerIdL +// Gets the server id value. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::GetServerIdL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetServerIdL(): begin" ); + HBufC8* serverId = iProfile.ServerId().AllocL(); + CleanupStack::PushL( serverId ); + aObject.InsertL( aObject.Size(), *serverId ); + CleanupStack::PopAndDestroy( 1 ); //serverId + _DBG_FILE( "CNSmlDMSettingsAdapter::GetServerIdL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetProfileNameL +// Gets the display name value. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::GetProfileNameL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileNameL(): begin" ); + HBufC16* dataBuf = iProfile.DisplayName().AllocL(); + CleanupStack::PushL( dataBuf ); + TPtr16 ptrDisplayName = dataBuf->Des(); + HBufC8* dataBuf8 = HBufC8::NewL( ptrDisplayName.Length() * 2 ); + CleanupStack::PushL( dataBuf8 ); + + TPtr8 ptrDisplayName8 = dataBuf8->Des(); + ptrDisplayName8 = ConvertTo8LC( ptrDisplayName ); + aObject.InsertL( aObject.Size(), ptrDisplayName8 ); + CleanupStack::PopAndDestroy( 3 );//dataBuf, ConvertTo8LC + _DBG_FILE("CNSmlDMSettingsAdapter::GetProfileNameL(): end"); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetProfileUserNameL +// Gets the profile user name value. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::GetProfileUserNameL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileUserNameL(): begin" ); + HBufC8* dataBuf = iProfile.UserName().AllocL(); + CleanupStack::PushL( dataBuf ); + TPtr8 ptrUserName = dataBuf->Des(); + aObject.InsertL( aObject.Size(), ptrUserName ); + CleanupStack::PopAndDestroy();//dataBuf + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileUserNameL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::GetProfilePortNumberL +// Gets the port number value. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::GetProfilePortNumberL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfilePortNumberL(): begin" ); + TInt bSize = aObject.Size(); + TInt portNum = 0; + HBufC8* bufStorage = HBufC8::NewLC( bSize ); + TPtr8 bufStoragePtr = bufStorage->Des(); + aObject.Read( 0, bufStoragePtr, aObject.Size() ); + aObject.Reset(); + + //find out the port number + ParseUri( *bufStorage, portNum ); + aObject.InsertL( aObject.Size(), SetIntObjectLC( portNum ) ); + + CleanupStack::PopAndDestroy( 2 ); //bufStorage, SetIntObjectLC() + _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfilePortNumberL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter::SetAuthInfoL +// The function checks if authinfo already exits. If exits command is replace. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::SetAuthInfoL( const TInt aLUID, + const TNSmlDMProfileData aField, + const TDesC8& aObject, TInt& aStatus ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::SetAuthInfoL(): begin" ); + + CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo(); + CleanupStack::PushL( authInfo ); + authInfo->iProfileId = aLUID; + + iPrivateApi.OpenL(); + TRAPD( err, iPrivateApi.GetDMAuthInfoL( *authInfo ) ); + + if ( err ) + { + CleanupStack::PopAndDestroy( authInfo ); + iPrivateApi.Close(); + aStatus = err; + return; + } + + CNSmlDMAuthInfo* newAuthInfo = new (ELeave) CNSmlDMAuthInfo(); + CleanupStack::PushL( newAuthInfo ); + newAuthInfo->iProfileId = aLUID; + + if ( aField == EServerNonce ) + { + newAuthInfo->iServerNonce = aObject.Alloc(); + newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc(); + newAuthInfo->iAuthPref = authInfo->iAuthPref; + + iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); + } + else if ( aField == EClientNonce ) + { + newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc(); + newAuthInfo->iClientNonce = aObject.Alloc(); + newAuthInfo->iAuthPref = authInfo->iAuthPref; + + iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); + } + else if ( aField == EAuthenticationRequired ) + { + if ( aObject.Match( KNSmlDMAuthPrefNoAuth ) != KErrNotFound ) + { + newAuthInfo->iAuthPref = ENoAuth; + } + else if ( aObject.Match( KNSmlDMAuthPrefBasic ) != KErrNotFound ) + { + newAuthInfo->iAuthPref = EBasic; + } + else if ( aObject.Match( KNSmlDMAuthPrefMD5 ) != KErrNotFound ) + { + newAuthInfo->iAuthPref = EMD5; + } + newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc(); + newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc(); + + iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); + } + + CleanupStack::PopAndDestroy( newAuthInfo ); + CleanupStack::PopAndDestroy( authInfo ); + + iPrivateApi.Close(); + aStatus = KErrNone; + _DBG_FILE( "CNSmlDMSettingsAdapter::SetAuthInfoL(): end" ); + return; + } +//------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter::AddNodeBufferL() +// Buffers Node Object +//------------------------------------------------------------------------------ +void CNSmlDMSettingsAdapter::AddNodeBufferL( const TDesC8& aURI, + const TInt aStatusRef) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeBufferL(): begin" ); + TInt index = -1; + + for (TInt i = 0; iCount (); i++) + { + if ( iBuffer->At(i).iMappingName->Compare (aURI)== 0) + { + index = i; + //CallBack for duplicate + _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeBufferL(): EAlreadyExists end" ); + iCallBack->SetStatusL ( aStatusRef, CSmlDmAdapter::EAlreadyExists); + break; + } + } + + if ( index<0) + { + TNSmlDMBufferElement newNode; + newNode.iMappingName = aURI.AllocLC (); + newNode.iLeafBuf = new (ELeave) CArrayFixFlat (4); + newNode.iExecuted = EFalse; + newNode.iDMBuffStatusref = aStatusRef; + newNode.iAddr = EFalse; + newNode.iServerId = EFalse; + newNode.iUName = EFalse; + newNode.iServerName = EFalse; + + iBuffer->AppendL (newNode); + //newNode.iMappingName + CleanupStack::Pop (); + } + _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeBufferL(): end" ); + } +//------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter::AddLeafBufferL() +// Buffers Leaf Obj & checks for Mandatory fields +//------------------------------------------------------------------------------ +void CNSmlDMSettingsAdapter::AddLeafBufferL( const TDesC8& aURI, + const TDesC8& aObject, const TInt aStatusRef) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafBufferL(): begin" ); + TNSmlDMLeafElement newCommand; + + newCommand.iUri = aURI.AllocLC (); + newCommand.iData = aObject.AllocLC (); + newCommand.iLuid = HBufC8::NewLC (8); //Allocate Mem. for iLUID + newCommand.iStatusRef = aStatusRef; + //Add Leaf to the index updated by UpdateLeafObj + iBuffer->At(iExecutionIndex).iLeafBuf->AppendL (newCommand); + // iUri, iData, ILuid + CleanupStack::Pop (3); + SetField ( aURI); + + if ( iField->Compare (KNSmlDdfAddr)== 0) + { + iBuffer->At(iExecutionIndex).iAddr = ETrue; + } + else + if ( iField->Compare (KNSmlDdfServerId)== 0) + { + iBuffer->At(iExecutionIndex).iServerId = ETrue; + } + else + if ( iField->Compare (KNSmlDdfClientUserName)== 0) + { + iBuffer->At(iExecutionIndex).iUName = ETrue; + } + else + if ( iField->Compare (KNSmlDdfName)== 0) + { + iBuffer->At(iExecutionIndex).iServerName = ETrue; + } + + // If Address,ServerId,ServerName,UserName then Add + + if ( iBuffer->At(iExecutionIndex).iAddr && iBuffer->At(iExecutionIndex).iServerId &&iBuffer->At(iExecutionIndex).iUName && iBuffer->At(iExecutionIndex).iServerName) + { + ExecuteBufferL (); + iExecutionIndex = -1; + } + _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafBufferL(): end" ); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter::ExecuteBufferL() +// Adds the Node/Leaf obj to the db +//------------------------------------------------------------------------------ +void CNSmlDMSettingsAdapter::ExecuteBufferL() + { + _DBG_FILE( "CNSmlDMSettingsAdapter::ExecuteBufferL(): begin" ); + TBuf8<8> newLUID; + TInt rValue; + //Buffer is being Executed + iBufOn = ETrue; + + // Robustness check + if ( iExecutionIndex<0) + { + return; + } + + //Execute BufferL is called from CompleteOutstandingCmdsL only when + //Mandatory fields are not set. Dont update Node/Leaf to the db, return a failure + + if ( !iComplete) + rValue = CreateNewProfileL (iLUID); + else + rValue = CSmlDmAdapter::EError; + + iBuffer->At(iExecutionIndex).iExecuted = ETrue; + + if ( rValue != KErrNone) + { + if ( rValue == KErrNoMemory) + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::ENoMemory); + } + else + if ( rValue == KErrNotSupported) + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, + CSmlDmAdapter::EInvalidObject); + } + else + if ( rValue == KErrInUse) + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, + CSmlDmAdapter::EObjectInUse); + } + else + if ( rValue == KErrDiskFull) + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, + CSmlDmAdapter::EDiskFull); + } + else + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, + CSmlDmAdapter::EError); + } + // dont return, UpdateLeafObjectL will update the callback status for leaf Nodes + } + else + { + if ( iLUID >= KMaxDataSyncID) + { + newLUID.Num ( iLUID - KMaxDataSyncID); + } + else + { + newLUID.Num ( iLUID); + } + + iCallBack->SetMappingL ( *iBuffer->At(iExecutionIndex).iMappingName, newLUID); + + iCallBack->SetStatusL (iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::EOk); + } + + for (TInt val= 0; val < iBuffer->At(iExecutionIndex).iLeafBuf->Count ();val++) + { + //Update the LUID data in the Leaf structure with the Profile LUID before calling UpdateLeafObj + TPtr8 tempLUID(iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid->Des ()); + tempLUID.Append (newLUID); + UpdateLeafObjectL (*iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iUri, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iData, *iBuffer->At(iExecutionIndex).iMappingName, iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iStatusRef); + } + + // Delete the dynamically allocated buffers (Node/Leaf obj) + + ClearBuffer ( iBuffer->At(iExecutionIndex).iLeafBuf); + + delete iBuffer->At(iExecutionIndex).iLeafBuf; + + if ( iBuffer->At(iExecutionIndex).iMappingName) + { + delete iBuffer->At(iExecutionIndex).iMappingName; + iBuffer->At(iExecutionIndex).iMappingName = NULL; + } + + iBuffer->Delete (iExecutionIndex); + iBuffer->Compress (); + + iBufOn = EFalse; + _DBG_FILE( "CNSmlDMSettingsAdapter::ExecuteBufferL(): end" ); + } + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlDMSettingsAdapter::ParentURI(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// Searches till the third "/" is reached +//------------------------------------------------------------------------------ +TPtrC8 CNSmlDMSettingsAdapter::ParentURI(const TDesC8& aURI) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::ParentURI(): begin" ); + TInt count; + TInt flag = 0; + for (count=0; count<=aURI.Length ()-1;count++) + { + + if ( aURI[count]=='/') + { + flag++; + if ( flag == KDynNodePosn) //KDynNodePosn =3 --> SyncML/DMAcc/DMIDxx + break; + } + } + + _DBG_FILE( "CNSmlDMSettingsAdapter::ParentURI(): end" ); + return aURI.Left (count); + } + +//----------------------------------------------------------------------------------------- +// Clears the elements of the passed in LeafElement Structure +//---------------------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter::ClearBuffer( + CArrayFixFlat* aBuffer) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::ClearBuffer(): begin" ); + for (TInt i = 0; i < aBuffer->Count (); i++) + { + delete aBuffer->At(i).iUri; + aBuffer->At(i).iUri = NULL; + + delete aBuffer->At(i).iData; + aBuffer->At(i).iData = NULL; + + delete aBuffer->At(i).iLuid; + aBuffer->At(i).iLuid = NULL; + } + + aBuffer->Reset (); + _DBG_FILE( "CNSmlDMSettingsAdapter::ClearBuffer(): end" ); + } +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KNSmlDMSettingsAdapterImplUid, CNSmlDMSettingsAdapter::NewL ) + }; + + +// ----------------------------------------------------------------------------- +// TImplementationProxy* ImplementationGroupProxy() +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: begin" ); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + _DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: end" ); + return ImplementationTable; + } + +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/src/nsmldmsettingsadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/src/nsmldmsettingsadapter.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,48 @@ +CHARACTER_SET UTF8/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource data for Device Management Settings Adapter +* +*/ + + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F6DE6; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F6DEC; // DM interface implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/bwins/syncmldmtestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/bwins/syncmldmtestu.def Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/conf/syncmldmtest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/conf/syncmldmtest.cfg Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,81 @@ +[Test] +title DDF +create syncmldmtest foobar jee +foobar DDFStructure +delete foobar +[Endtest] + +[Test] +title StartAtomic +create syncmldmtest foobar +foobar StartAtomic +delete foobar +[Endtest] + +[Test] +title CommitAtomic +create syncmldmtest foobar +foobar CommitAtomic +delete foobar +[Endtest] + +[Test] +title RollbackAtomic +create syncmldmtest foobar +foobar RollbackAtomic +delete foobar +[Endtest] + +[Test] +title AddDmAcc +create syncmldmtest foobar +foobar AddNode SyncML/DMAcc/DMId099 +foobar UpdateLeaf SyncML/DMAcc/DMId099/Name name99 +foobar UpdateLeaf SyncML/DMAcc/DMId099/ServerId server99 +foobar UpdateLeaf SyncML/DMAcc/DMId099/Addr http://a.com +foobar UpdateLeaf SyncML/DMAcc/DMId099/UserName user99 +foobar CompleteCommands +delete foobar +[Endtest] + +[Test] +title UpdateName +create syncmldmtest foobar +foobar UpdateLeaf SyncML/DMAcc/DMId099/Name newname99 +delete foobar +[Endtest] + +[Test] +title UpdateAddr +create syncmldmtest foobar +foobar UpdateLeaf SyncML/DMAcc/DMId099/Addr http://b.com +delete foobar +[Endtest] + +[Test] +title UpdateUserName +create syncmldmtest foobar +foobar UpdateLeaf SyncML/DMAcc/DMId099/UserName user +delete foobar +[Endtest] + +[Test] +title FetchNodeDmAcc +create syncmldmtest foobar +foobar FetchNode SyncML/DMAcc +delete foobar +[Endtest] + +[Test] +title FetchLeafDmAcc +create syncmldmtest foobar +foobar FetchLeaf SyncML/DMAcc/DMId099/Name +delete foobar +[Endtest] + +[Test] +title DeleteDmAcc +create syncmldmtest foobar +foobar DeleteNode SyncML/DMAcc/DMId005 +delete foobar +[Endtest] diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/eabi/syncmldmtestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/eabi/syncmldmtestu.def Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,9 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI13Csyncmldmtest @ 2 NONAME ; ## + _ZTI16CTestDmDDFObject @ 3 NONAME ; ## + _ZTI8Cdmatest @ 4 NONAME ; ## + _ZTV13Csyncmldmtest @ 5 NONAME ; ## + _ZTV16CTestDmDDFObject @ 6 NONAME ; ## + _ZTV8Cdmatest @ 7 NONAME ; ## + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/group/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: + + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +syncmldmtest.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/group/syncmldmtest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/group/syncmldmtest.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + +#include + +TARGET syncmldmtest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE syncmldmtest.def + +SOURCEPATH ../src +SOURCE dmatest.cpp +SOURCE TestDmDDFObject.cpp +SOURCE syncmldmtest.cpp +SOURCE syncmldmtestBlocks.cpp + + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +SYSTEMINCLUDE /epoc32/include/ecom +APP_LAYER_SYSTEMINCLUDE + + + +LIBRARY apgrfx.lib apmime.lib +LIBRARY euser.lib ecom.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY SWInstCli.lib + +LANG SC + + + +SMPSAFE +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/group/syncmldmtest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/group/syncmldmtest.pkg Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,38 @@ +; +; Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Implementation of DM adapter test component +; This is part of omadmextensions/adapter test application. +; + +;*Languages +&EN +; +;*Standard SIS file header. This section specifies the package name, +;application UID, and version/build numbers. Add the package TYPE here if needed. +#{"syncmldmtest"},(0x101FB3E8),1,0,1; +; + +;*Unique (Non-Localised) Vendor name +;This is used in combination with signing to prevent the unauthroized +;upgrade ofa a package by someone other than the rightful vendor. +:"Nokia" + +;*Localized Vendor Name +;This specifies the localised vendor name(s) correspodning to language(s). +%{"Nokia Test EN"} + +;*Files To Copy... +"\epoc32\release\armv5\urel\syncmldmtest.dll" -"C:\sys\bin\syncmldmtest.dll" +"..\conf\syncmldmtest.cfg"-"C:\TestFramework\syncmldmtest.cfg" +"..\init\syncmldmtest.ini"-"C:\TestFramework\syncmldmtest.ini" diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/inc/TestDmDDFObject.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef __TESTDMDDFOBJECT_H +#define __TESTDMDDFOBJECT_H + +// INCLUDES +//#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +class CStifLogger; + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class CTestDmDDFObject : public CBase, public MSmlDmDDFObject + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CTestDmDDFObject* NewL( CStifLogger *aLog ); + static CTestDmDDFObject* NewLC( CStifLogger *aLog ); + + /** + * Destructor. + */ + virtual ~CTestDmDDFObject(); + + public: // New functions + + /** + * ?member_description. + * @since Series ?XX ?SeriesXX_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + virtual void SetNameL( const TDesC8& aName ); + + void DumpL( const TDesC8& aParentName, TBool aFullDump = ETrue ); + void ExternalizeL(RWriteStream& aStream) const; + + + + public: // Functions from base classes + +//sf- ********************************* + + void SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ); + void SetDefaultValueL( const TDesC8& aDefaultValue ); + void SetDescriptionL( const TDesC8& aDescription ); + void SetDFFormatL( TDFFormat aFormat ); + void SetOccurenceL( TOccurence aOccurence ); + void SetScopeL( TScope aScope ); + void SetDFTitleL( const TDesC8& aTitle ); + void AddDFTypeMimeTypeL( const TDesC8& aMimeType ); + void SetAsObjectGroup(); + MSmlDmDDFObject& AddChildObjectL(const TDesC8& aNodeName); + MSmlDmDDFObject& AddChildObjectGroupL(); + +//sf- ############################# + + const TDesC8& Name(); + TSmlDmAccessTypes AccessTypes(); + const TDesC8& DefaultValue(); + const TDesC8& Description(); + TDFFormat DFFormat(); + TOccurence Occurence(); + TScope Scope(); + const TDesC8& DFTitle(); + const TDesC8& DFTypeMimeType(); + TBool ObjectGroup(); + + TInt ChildObjectCount(); + CTestDmDDFObject& ChildObject( TInt aIndex ); + + CTestDmDDFObject* FindChildObject( const TDesC8& aName ); + TInt SubObjectsCount(); + + + protected: // New functions + + /** + * ?member_description. + * @since Series ?XX ?SeriesXX_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CTestDmDDFObject( CStifLogger *aLog ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // CTestDmDDFObject( const CTestDmDDFObject& ); + // Prohibit assigment operator if not deriving from CBase. + // CTestDmDDFObject& operator=( const CTestDmDDFObject& ); + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + // ?one_line_short_description_of_data + //?data_declaration; + HBufC8* iName; + + TSmlDmAccessTypes iAccessTypes; + HBufC8* iDefaultValue; + HBufC8* iDescription; + TDFFormat iFormat; + TOccurence iOccurence; + TScope iScope; + HBufC8* iTitle; + HBufC8* iMimeType; + TBool iObjectGroup; + + RPointerArray iChildren; + + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + /** + * Logger. + */ + CStifLogger* iLog; + + }; + +#endif // __TESTDMDDFOBJECT_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/inc/dmatest.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,277 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef __DMA_TEST_H__ +#define __DMA_TEST_H__ + +// INCLUDES +#include +#include +#include +#include +#include +#include "NSmlDMSettingsAdapter.h" + +class Cdmatest; + + +struct TMapping + { + TBuf8<256> iURI; + TBuf8<64> iLuid; + TMapping( const TDesC8 &aURI, const TDesC8 &aLuid ) : iURI( aURI ), iLuid( aLuid ) + { + + } + }; + +typedef RArray RMappingArray; + +typedef void (Cdmatest::* ResultsFunction)( TInt , CBufBase& , const TDesC8& ) ; + + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class Cdmatest : public CScriptBase, public MSmlDmCallback + { + + public: // Constructors and destructor + + /** + * Destructor. + */ + virtual ~Cdmatest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ) = 0; + + + public: + /** + The function is used to return the data in case of FetchLeafObjectL(), + FetchLeafObjectSizeL() and ChildURIListL() functions. It should not be + called where the DM command has failed, i.e. the error code returned in + SetStatusL is something other than EOk. + @param aResultsRef Reference to correct command + @param aObject The data which should be returned + @param aType MIME type of the object + @publishedPartner + @prototype + */ + void SetResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); + + /** + The function is used to return the data in case of FetchLeafObjectL() and + ChildURIListL() functions, where the size of the data being returned is + large enough for the Adapter to stream it. This function should not be + called when command was failed, i.e. the error code returned in SetStatusL + is something other than EOk. + @param aResultsRef Reference to correct command + @param aStream Large data which should be returned, DM engine + closes stream when it has read all the data + @param aType MIME type of the object + @publishedPartner + @prototype + */ + void SetResultsL( TInt /*aResultsRef*/, RReadStream*& /*aStream*/, + const TDesC8& /*aType*/ ) + { + + } + + /** + The function returns information about the Add,Update,Delete and Fetch + commands success to DM engine. The reference to correct command must be + used when calling the SetStatusL function, the reference is got from the + argument of the command functions. The SetStatusL function must be called + separately for every single command. + @param aStatusRef Reference to correct command + @param aErrorCode Information about the command success + @publishedPartner + @prototype + */ + void SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) ; + + /** + The function passes map information to DM Module. This function is called + for a new management object, both for node objects and for leaf objects. + In addition if ChildURIListL() function has returned new objects a mapping + information of the new objects must be passed. A mapping is treated as + inheritable. If the mapping is not set with this function, the mapping + LUID of the parent object is passed in following commands to the object. + @param aURI URI of the object. + @param aLUID LUID of the object. LUID must contain the all information, + which is needed for retrieve the invidual object from the + database. Typically it is ID for the database table. In + more complicated structures it can be combination of IDs, + which represent path to the object. + @publishedPartner + @prototype + */ + void SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ); + + /** + The function is used to make a fetch to other adapters. The most common + use is to make a fetch to the AP adapter, because when managing the access + points, the data comes as URI. For example, there are ToNAPId field in + some adapters, and data to it can be something like AP/IAPidx, and then + the link to AP adapter is needed. + Using FetchLinkL causes the DM Framework to make a Get request to the + appropriate DM adapter. The receiving adapter MUST complete the Get + request synchronously. + @param aURI URI of the object. + @param aData Reference to data, i.e. data is returned here + @param aStatus The status of fetch command is returned here + @publishedPartner + @prototype + */ + void FetchLinkL( const TDesC8& /*aURI*/, CBufBase& /*aData*/, + MSmlDmAdapter::TError& /*aStatus*/ ) + { + + } + + /** + The function returns the LUID which is mapped to aURI. If LUID is not + found, the function allocates a null length string, i.e. the function + allocates memory in every case. + @param aURI URI of the object. + @publishedPartner + @prototype + */ + HBufC8* GetLuidAllocL( const TDesC8& aURI ) ; + +#ifdef __TARM_SYMBIAN_CONVERGENCY + + void GetMappingInfoListL( const TDesC8& aURI, + CArrayFix& aSegmentList ); + +#else +// nothing +#endif + + protected: // New functions + + + void FetchNodeResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); + void SaveDataL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ) ; + + TPtrC8 LastURISeg( const TDesC8& aURI ); + TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); + TPtrC RemoveLastURISeg( const TDesC& aURI ); + void SetURIL( const TDesC& aURI ); + void SetURIL( const TDesC8& aURI ); + void SetURIL( HBufC8* aURI ); + HBufC8 *LoadFileLC( const TDesC &aFileName, TDataType &aType ); + HBufC8 *LoadFileLC( const TDesC8 &aFileName, TDataType &aType ); + HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); + HBufC8* GetLuidAllocLC( const TDesC8& aURI ) ; + TPtrC8 RemoveLastSeg(const TDesC8& aURI); + + TInt FetchNodeL( CStifItemParser& aItem ) ; + TInt FetchLeafL( CStifItemParser& aItem ) ; + TInt AddNodeL( CStifItemParser& aItem ); + TInt DeleteObjectL( CStifItemParser& aItem ); + TInt UpdateLeafL( CStifItemParser& aItem ) ; + TInt UpdateLeafDataL( CStifItemParser& aItem ) ; + TInt UpdateLeafDataURLL( CStifItemParser& aItem ) ; + + TInt ExecuteLeafL ( CStifItemParser& aItem ) ; + TInt ExecuteLeafDataL ( CStifItemParser& aItem ) ; + TInt StartAtomicL( CStifItemParser& aItem ) ; + TInt CommitAtomicL( CStifItemParser& aItem ) ; + TInt RollbackAtomicL( CStifItemParser& aItem ) ; + TInt CompleteCommandsL( CStifItemParser& aItem ); + TInt DDFStructureL( CStifItemParser& aItem ) ; +// TInt DeliverL( CStifItemParser& aItem ) ; +// TInt DetailsL( CStifItemParser& aItem ) ; +// TInt InstallL( CStifItemParser& aItem ) ; +// TInt BareInstallL( CStifItemParser& aItem ) ; + + protected: + + /** + * C++ default constructor. + */ + Cdmatest( CTestModuleIf& aTestModuleIf, TUid aUid ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // Cdmatest( const Cdmatest& ); + // Prohibit assigment operator if not deriving from CBase. + // Cdmatest& operator=( const Cdmatest& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + virtual void Delete(); + void LoadMappingsL(); + void SaveMappingsL(); + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + MSmlDmAdapter::TError iStatus ; + ResultsFunction iResultsFunction; + //CSmlDmAdapter *iAdapter ; + CNSmlDMSettingsAdapter *iAdapter ; + HBufC8 *iURI; + CArrayFix *iEmptyMappingInfoArray; + TFileName iSaveFileName; + RMappingArray iMappingTable; + TUid iUid; + TInt iCounter; + //class CNSmlDmMgmtTree* iMgmtTree; + class CNSmlDmMgmtTree* iMgmtTree; + CNSmlDMSettingsAdapter *Adapter() ; + }; + +#endif // __DMA_TEST_H__ + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/inc/syncmldmtest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/inc/syncmldmtest.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef TCTEST_H +#define TCTEST_H + +// INCLUDES +#include +#include +#include +#include +#include "dmatest.h" + +const TUint KNSmlDMSettingsAdapterImplUid = 0x101F6DEC; + + +const TUid KAdapterUid = + { + KNSmlDMSettingsAdapterImplUid + }; +// Logging path +_LIT( KamtestLogPath, "\\logs\\testframework\\tctest\\" ); +// Log file +_LIT( KamtestLogFile, "tctest.txt" ); + + +// FORWARD DECLARATIONS +class Csyncmldmtest; + + +// CLASS DECLARATION + +/** +* Csyncmldmtest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +class Csyncmldmtest : public Cdmatest + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Csyncmldmtest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Csyncmldmtest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + + private: + + /** + * C++ default constructor. + */ + Csyncmldmtest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + virtual void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ +/* virtual TInt ExampleL( CStifItemParser& aItem ) ; + virtual TInt DeliverL( CStifItemParser& aItem ) ; + virtual TInt DetailsL( CStifItemParser& aItem ) ; + virtual TInt InstallL( CStifItemParser& aItem ) ; + virtual TInt BareInstallL( CStifItemParser& aItem ) ;*/ + + + private: // Data + HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); + + + }; + +#endif // TCTEST_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/init/syncmldmtest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/init/syncmldmtest.ini Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,204 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +[New_Module] +ModuleName= testscripter +#DM +TestCaseFile= c:\testframework\syncmldmtest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/src/TestDmDDFObject.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,516 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES + +#include "TestDmDDFObject.h" +#include "StifLogger.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::CTestDmDDFObject +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CTestDmDDFObject::CTestDmDDFObject( CStifLogger *aLog ) + : iName( 0 ) + , iAccessTypes() + , iDefaultValue( 0 ) + , iDescription( 0 ) + , iFormat( (TDFFormat)0 ) + , iOccurence( (TOccurence)0 ) + , iScope( (TScope)0 ) + , iTitle ( 0 ) + , iMimeType( 0 ) + , iObjectGroup( EFalse ) + , iLog( aLog ) +// RPointerArray iChildren; + { + } + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CTestDmDDFObject::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTestDmDDFObject* CTestDmDDFObject::NewL( CStifLogger *aLog ) + { + CTestDmDDFObject* self = CTestDmDDFObject::NewLC( aLog ); + CleanupStack::Pop( self ); + + return self; + } + +CTestDmDDFObject* CTestDmDDFObject::NewLC( CStifLogger *aLog ) + { + CTestDmDDFObject* self = new( ELeave ) CTestDmDDFObject( aLog ); + + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + + +// Destructor +CTestDmDDFObject::~CTestDmDDFObject() + { + delete iName; + delete iDefaultValue; + delete iDescription; + delete iTitle; + delete iMimeType; + iChildren.ResetAndDestroy(); + } + + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/*?type CTestDmDDFObject::?member_function( + ?arg_type arg, + ?arg_type arg ) + { + + ?code + + } +*/ + +void CTestDmDDFObject::SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ) + { + iLog->Log( _L8( "SetAccessTypesL, aAccessTypes=%d" ), aAccessTypes.GetACL() ); + iAccessTypes = aAccessTypes; + } + +void CTestDmDDFObject::SetDefaultValueL( const TDesC8& aDefaultValue ) + { + iLog->Log( _L8( "SetDefaultValueL, aDefaultValue='%S'" ), &aDefaultValue ); + delete iDefaultValue; + iDefaultValue = 0; + iDefaultValue = aDefaultValue.AllocL(); + } + +void CTestDmDDFObject::SetDescriptionL( const TDesC8& aDescription ) + { + iLog->Log( _L8( "SetDescriptionL, aDescription='%S'" ), &aDescription ); + delete iDescription; + iDescription = 0; + iDescription = aDescription.AllocL(); + } + +void CTestDmDDFObject::SetDFFormatL( TDFFormat aFormat ) + { + iLog->Log( _L8( "SetDFFormatL, aFormat=%d" ), aFormat ); + iFormat = aFormat; + } + +void CTestDmDDFObject::SetOccurenceL( TOccurence aOccurence ) + { + iLog->Log( _L8( "SetOccurenceL, aOccurence=%d" ), aOccurence ); + iOccurence = aOccurence; + } + +void CTestDmDDFObject::SetScopeL( TScope aScope ) + { + iLog->Log( _L8( "SetScopeL, aScope=%d" ), aScope ); + iScope = aScope; + } + +void CTestDmDDFObject::SetDFTitleL( const TDesC8& aTitle ) + { + iLog->Log( _L8( "SetDFTitleL, aTitle='%S'" ), &aTitle ); + delete iTitle; + iTitle = 0; + iTitle = aTitle.AllocL(); + } + +void CTestDmDDFObject::AddDFTypeMimeTypeL( const TDesC8& aMimeType ) + { + iLog->Log( _L8( "AddDFTypeMimeTypeL, aMimeType='%S'" ), &aMimeType ); + delete iMimeType; + iMimeType = 0; + iMimeType = aMimeType.AllocL(); + } + +void CTestDmDDFObject::SetAsObjectGroup() + { + iLog->Log( _L8( "SetAsObjectGroup, true" ) ); + iObjectGroup = ETrue; + } + +MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectL(const TDesC8& aNodeName) + { + iLog->Log( _L8( "AddChildObjectL, aNodeName='%S'" ), &aNodeName ); + CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); + child->SetNameL( aNodeName ); + iChildren.AppendL( child ); + CleanupStack::Pop( child ); // Don't destroy + return *child; + } + +MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectGroupL() + { + iLog->Log( _L8( "AddChildObjectGroupL, ''" ) ); + CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, KNullDesC ); + child->SetAsObjectGroup(); + iChildren.AppendL( child ); + CleanupStack::Pop( child ); // Don't destroy + return *child; + } + +// Own functions + +void CTestDmDDFObject::SetNameL( const TDesC8& aName ) + { + delete iName; + iName = 0; + iName = aName.AllocL(); + } + +void CTestDmDDFObject::DumpL( const TDesC8& aParentName, TBool aFullDump ) + { + TPtrC8 name( _L8("") ); + if (iName && iName->Length() > 0) + { + name.Set( *iName ); + } + + HBufC8* fullName = HBufC8::NewLC( aParentName.Length() + name.Length() + 1 ); + *fullName = aParentName; + if (aParentName.Length() > 0 && aParentName[ aParentName.Length() - 1 ] != '/') + { + fullName->Des().Append( _L8("/")); + } + fullName->Des().Append( name ); + + /* Translate some members to text for dumping */ + TBuf8<20> strAccessTypes; + TUint8 accessTypes = iAccessTypes.GetACL(); + if ((accessTypes & iAccessTypes.EAccessType_Add) != 0) + { + strAccessTypes.Append( _L8("A") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Copy) != 0) + { + strAccessTypes.Append( _L8("C") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Delete) != 0) + { + strAccessTypes.Append( _L8("D") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Exec) != 0) + { + strAccessTypes.Append( _L8("E") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Get) != 0) + { + strAccessTypes.Append( _L8("G") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Replace) != 0) + { + strAccessTypes.Append( _L8("R") ); + } + + TBuf8<20> strFormat; + switch( iFormat ) + { + case EB64: + strFormat = _L8("Base64"); + break; + case EBool: + strFormat = _L8("Bool"); + break; + case EChr: + strFormat = _L8("Chr"); + break; + case EInt: + strFormat = _L8("Int"); + break; + case ENode: + strFormat = _L8("Node"); + break; + case ENull: + strFormat = _L8("Null"); + break; + case EXml: + strFormat = _L8("Xml"); + break; + case EBin: + strFormat = _L8("Bin"); + break; + default: + break; + } + + + TBuf8<20> strOccurence; + switch( iOccurence ) + { + case EOne: + /** The node appears exactly once */ + strOccurence = _L8("M:1"); + break; + case EZeroOrOne: + /** The node is optional and may appear zero or once */ + strOccurence = _L8("O:0-1"); + break; + case EZeroOrMore: + /** The node is optional and may appear zero or more times */ + strOccurence = _L8("O:0-*"); + break; + case EOneOrMore: + /** The node is mandatory and may appear once or more times */ + strOccurence = _L8("M:1-*"); + break; + case EZeroOrN: + /** The node is optional and may appear between once and 'N' times */ + strOccurence = _L8("O:1-N"); + break; + case EOneOrN: + /** The node is mandatory and may appear between once and 'N' times */ + strOccurence = _L8("M:1-N"); + break; + default: + break; + } + + + TBuf8<20> strScope; + switch( iScope) + { + case EPermanent: + /** The node appears exactly once */ + strScope = _L8("Permanent"); + break; + case EDynamic: + /** The node is optional and may appear zero or once */ + strScope = _L8("O:Dynamic"); + break; + default: + break; + } + + + /* Dump main data */ + if (aFullDump) + { + iLog->Log( _L8( "DDFObject: '%S'" ), fullName ); + } + else + { + iLog->Log( _L8( "DDFObject: '%S' (%S), %S, %S, %S" ), + fullName, &strAccessTypes, &strFormat, &strOccurence, &strScope ); + } + + /* Dump members */ + if (aFullDump) + { + TPtrC8 empty( _L8( "" ) ); + #define CHK_NULL(a) ((a)==0?(TDesC8*)(&empty):(TDesC8*)(a)) + + iLog->Log( _L8( " iName=='%S'" ), iName ); + iLog->Log( _L8( " iAccessTypes=%d (%S)" ), iAccessTypes.GetACL(), &strAccessTypes ); + iLog->Log( _L8( " iDefaultValue='%S'" ), CHK_NULL(iDefaultValue)); + iLog->Log( _L8( " iDescription='%S'" ), CHK_NULL(iDescription )); + iLog->Log( _L8( " iFormat=%d (%S)" ), iFormat, &strFormat ); + iLog->Log( _L8( " iOccurence=%d (%S)" ), iOccurence, &strOccurence ); + iLog->Log( _L8( " iScope=%d (%S)" ), iScope, &strScope ); + iLog->Log( _L8( " iTitle='%S'" ), CHK_NULL(iTitle )); + iLog->Log( _L8( " iMimeType='%S'" ), CHK_NULL(iMimeType )); + iLog->Log( _L8( "----------------------------------" ) ); + } + + /* Dump children */ + for (TInt i = 0 ; i < iChildren.Count() ; i++) + { + iChildren[i]->DumpL( *fullName, aFullDump ); + } + + CleanupStack::PopAndDestroy( fullName ); + } + +/* +void CTestDmDDFObject::ExternalizeL(RWriteStream& aStream) const + { + X; + aStream << *iName << eol; + } +*/ + +const TDesC8& CTestDmDDFObject::Name() + { + return (iName != 0) ? *iName : KNullDesC8(); + } + +TSmlDmAccessTypes CTestDmDDFObject::AccessTypes() + { + return iAccessTypes; + } + +const TDesC8& CTestDmDDFObject::DefaultValue() + { + return (iDefaultValue != 0) ? *iDefaultValue : KNullDesC8(); + } + +const TDesC8& CTestDmDDFObject::Description() + { + return (iDescription != 0) ? *iDescription : KNullDesC8(); + } + +CTestDmDDFObject::TDFFormat CTestDmDDFObject::DFFormat() + { + return iFormat; + } + +CTestDmDDFObject::TOccurence CTestDmDDFObject::Occurence() + { + return iOccurence; + } + +CTestDmDDFObject::TScope CTestDmDDFObject::Scope() + { + return iScope; + } + +const TDesC8& CTestDmDDFObject::DFTitle() + { + return (iTitle != 0) ? *iTitle : KNullDesC8(); + } + +const TDesC8& CTestDmDDFObject::DFTypeMimeType() + { + return (iMimeType != 0) ? *iMimeType : KNullDesC8(); + } + +TBool CTestDmDDFObject::ObjectGroup() + { + return iObjectGroup; + } + +TInt CTestDmDDFObject::ChildObjectCount() + { + return iChildren.Count(); + } + +CTestDmDDFObject& CTestDmDDFObject::ChildObject( TInt aIndex ) + { + return *iChildren[aIndex]; + } + +CTestDmDDFObject* CTestDmDDFObject::FindChildObject( const TDesC8& aName ) + { + CTestDmDDFObject* foundObject = 0; + + for (TInt i = 0 ; i < iChildren.Count() ; i++) + { + if ( aName.CompareC( iChildren[i]->Name() ) == 0 ) + { + foundObject = iChildren[i]; + break; + } + } + + return foundObject; + } + +TInt CTestDmDDFObject::SubObjectsCount() + { + TInt count = 0; + + TInt i; + for (i = 0 ; i < iChildren.Count() ; i++) + { + count += iChildren[i]->SubObjectsCount(); + } + count += i; + + return count; + } + +/* +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ?function_name implements... +// ?implementation_description. +// Returns: ?value_1: ?description +// ?value_n: ?description +// ?description +// ----------------------------------------------------------------------------- +// +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg ) // ?description + { + + ?code + + } +*/ +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/src/dmatest.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,954 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include "dmatest.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "TestDmDDFObject.h" + +_LIT8( KEmptyType, "" ); +_LIT8( KDefaultType, "text/plain" ); +_LIT( KMappingTableFile, "\\dmtestmappings.txt" ); +//_LIT8( KNSmlDMSeparator8, "/" ); +//const TUint8 KNSmlDMUriSeparator = 0x2f; //forward slash + +#define LEAVE_IF_ERROR(x,msg) \ + { TInt __xres = (x); if ( __xres < 0 ) { if ( iLog ) iLog->Log( (msg), __xres ); User::Leave( __xres ); } } + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cdmatest::Cdmatest +// C++ default constructor can NOT contain any code, that +// leave. +// ----------------------------------------------------------------------------- +// +Cdmatest::Cdmatest(CTestModuleIf& aTestModuleIf, TUid aUid ): + CScriptBase( aTestModuleIf ), iMappingTable(2), iUid( aUid ) + { + + } + +// ----------------------------------------------------------------------------- +// Cdmatest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cdmatest::ConstructL() + { + Adapter(); + iEmptyMappingInfoArray = new ( ELeave ) CArrayFixFlat(1); + + TRAPD( err, LoadMappingsL() ); + if (err != KErrEof && err != KErrNone && err != KErrNotFound) + { + User::Leave( err ); + } + } + +CNSmlDMSettingsAdapter *Cdmatest::Adapter() + { + if ( iAdapter == NULL ) + { + if ( iLog ) + { + iLog->Log( _L( "Loading Adapter" ) ); + } + + TRAPD( err, iAdapter = (CNSmlDMSettingsAdapter*) CSmlDmAdapter::NewL( iUid,*this ) ); + if ( err == KErrNone ) + { + if (iLog ) + { + iLog->Log( _L( "Loaded" ) ); + } + } + else + { + if (iLog) + { + iLog->Log( _L( "Failed to load adapter: %d" ), err ); + } + } + } + return iAdapter; + } + + +void Cdmatest::LoadMappingsL() + { + TDataType type; + HBufC8 *data = LoadFileLC( KMappingTableFile, type ); + RDesReadStream buf( *data ); + CleanupClosePushL( buf ); + + TInt len( data->Length() ); + while (buf.Source()->TellL( MStreamBuf::ERead ).Offset() < len) + { + TUint32 val = buf.ReadUint32L(); + TBuf8<256> uri; + TBuf8<64> luid; + buf.ReadL(uri, val); + val = buf.ReadUint32L(); + buf.ReadL(luid, val); + TMapping m( uri, luid ) ; + TInt err( iMappingTable.Append( m ) ); + if ( err == KErrNone ) + { + iLog->Log( _L8( "Loaded mapping: '%S' : '%S'"), &m.iURI, &m.iLuid ); + } + else + { + iLog->Log( _L8( "FAILED TO Load mapping: '%d' "), err ); + } + } + CleanupStack::PopAndDestroy( &buf); // buf + CleanupStack::PopAndDestroy( data ); // data + } + + + +void Cdmatest::SaveMappingsL() + { + TInt c( iMappingTable.Count() ); + if ( c > 0 ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFileWriteStream buf; + User::LeaveIfError( buf.Replace( fs, KMappingTableFile, EFileWrite ) ); + CleanupClosePushL( buf ); + + TInt i( 0 ) ; + do + { + buf.WriteUint32L( iMappingTable[i].iURI.Length() ); + buf.WriteL( iMappingTable[i].iURI ); + buf.WriteUint32L( iMappingTable[i].iLuid.Length() ); + buf.WriteL( iMappingTable[i].iLuid ); + } + while ( ++i < c ) ; + buf.CommitL(); + buf.Close(); + + CleanupStack::PopAndDestroy(); // buf + CleanupStack::PopAndDestroy(); // fs + } + } + + +// Destructor +Cdmatest::~Cdmatest() + { + // Delete resources allocated from test methods + TRAPD(err, SaveMappingsL() ); + if ( err != KErrNone ) + { + if(iLog) + iLog->Log( _L8( "Failed to save mappings!: %d"), err ); + } + Delete(); + + // Delete logger + delete iLog; + delete iEmptyMappingInfoArray; + delete iAdapter; + delete iURI; + iMappingTable.Reset(); + REComSession::FinalClose(); + } + + +// ----------------------------------------------------------------------------- +// Camatest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cdmatest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cdmatest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + + + +HBufC8 *Cdmatest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) + { + TPtrC nodename( KNullDesC ); + + TInt i( aItem.GetNextString ( nodename ) ); + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); + } + else + { + iLog->Log( _L("%S: %S"), &aName, &nodename); + } + + HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; + buf->Des().Copy( nodename ); + return buf; + } + +TInt Cdmatest::FetchNodeL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("FetchNodeL") ); + + iResultsFunction = FetchNodeResultsL; + + TPtrC8 nodename( GetNextStringLC( aItem, _L(" nodename" ) )->Des() ) ; + + SetURIL(nodename) ;// + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + Adapter()->ChildURIListL( *iURI, *luid, *iEmptyMappingInfoArray, 4, 5) ; + + if ( iStatus == MSmlDmAdapter::EOk ) + { + } + else + { + iLog->Log( _L("FetchNodeL: ChildUriList Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ) ; + CleanupStack::PopAndDestroy() ; // nodename + iLog->Log( _L("FetchNodeL: Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::StartAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->StartAtomicL() ) ; + iLog->Log( _L("StartAtomicL: Atomic started resulting error %d" ), err ); + return err; + } + +TInt Cdmatest::RollbackAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->RollbackAtomicL() ) ; + iLog->Log( _L("RollbackAtomicL: Atomic rolled back resulting error %d" ), err ); + return err; + } + +TInt Cdmatest::CommitAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->CommitAtomicL() ) ; + iLog->Log( _L("RollbackAtomicL: Atomic commited resulting error %d" ), err ); + return err; + } + + +TInt Cdmatest::DDFStructureL( CStifItemParser& /*aItem*/ ) + { + CTestDmDDFObject* ddfRoot = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); + + TRAPD( err, iAdapter->DDFStructureL( *ddfRoot ) ) ; + CleanupStack::PopAndDestroy( ddfRoot ); + iLog->Log( _L("DDFStructureL: method called resulting error %d" ), err ); + return err; + } + + +TInt Cdmatest::AddNodeL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("AddNodeL") ); + + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("nodename" ) )->Des() ) ; + SetURIL( nodename ); + + Adapter()->AddNodeObjectL( *iURI, KEmptyType, 8 ) ; + + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("AddNodeL: AddNodeObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("AddNodeL: AddNodeObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy() ; // nodename + iLog->Log( _L("AddNodeL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 data (GetNextStringLC( aItem, _L("datafile"))->Des() ); + + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + TDataType type; + + TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() ); + + /** + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + + Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); + + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy(); // loadfile + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // nodename + + iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret ); + + return ret; + } + + +TInt Cdmatest::UpdateLeafDataURLL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafDataL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 http (GetNextStringLC( aItem, _L("http"))->Des() ); + TPtrC8 url (GetNextStringLC( aItem, _L("rest of url"))->Des() ); + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + _LIT8( KTag, "://" ); + + HBufC8 *fullurl = HBufC8::NewLC( http.Length() + KTag().Length() + url.Length() ); + TPtr8 pfullurl( fullurl->Des() ); + pfullurl.Copy( http ) ; + pfullurl.Append( KTag ); + pfullurl.Append( url ); + TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + /** + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + Adapter()->UpdateLeafObjectL( *iURI , *luid, pfullurl, mimePtr, 3); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // + CleanupStack::PopAndDestroy( mime ); // mime + CleanupStack::PopAndDestroy(); // url + CleanupStack::PopAndDestroy(); // http + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::UpdateLeafDataL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("UpdateLeafDataL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 data (GetNextStringLC( aItem, _L("data"))->Des() ); + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + + SetURIL( nodename ); + + + TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + +// +// virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, +// const TDesC8& aObject, const TDesC8& aType, +// TInt aStatusRef ) = 0; +// + Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::FetchLeafL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("FetchLeafL") ); + + iResultsFunction = NULL; + + TInt i( 0 ); + TPtrC8 nodename ( GetNextStringLC( aItem, _L( "nodename" ) )->Des() ) ; + + //TPtrC datafile; + TPtrC datafile( KNullDesC ); + i = aItem.GetNextString ( datafile ) ; + if ( i != KErrNone ) + { + iLog->Log(_L("FetchLeafL: ERROR Reading outfile argument: 0x%X"), i ); + //return i; + } + else + { + iSaveFileName = datafile; + iLog->Log( _L( " Save file nameis '%S'" ), &iSaveFileName ); + iResultsFunction = SaveDataL; + } + + SetURIL(nodename) ; + + /* + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + */ + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->FetchLeafObjectL( *iURI, *luid, KEmptyType, 7, 8 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("FetchLeafL: FetchLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("FetchLeafL: FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); + CleanupStack::PopAndDestroy( ); // nodename + iLog->Log( _L("FetchLeafL Test Complete with status %d" ), ret ); + return ret; + } + + +TInt Cdmatest::ExecuteLeafL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + TPtrC8 data( GetNextStringLC ( aItem, _L("Input file") )->Des() ) ; + + SetURIL(nodename) ; + + /* + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + TDataType type; + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("ExecuteLeafL: ExecuteCommandL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("ExecuteLeafL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + + iLog->Log( _L("ExecuteLeafL: Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::CompleteCommandsL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->CompleteOutstandingCmdsL() ); + delete iAdapter; + iAdapter = NULL; + return err; + } +TInt Cdmatest::DeleteObjectL( CStifItemParser& aItem ) +{ + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("DeleteObjectL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + + SetURIL(nodename) ; + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + Adapter()->DeleteObjectL( *iURI, *luid, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("DeleteNode: DeleteObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("DeleteNode: DeleteObjectL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); + + return ret; +} + +TInt Cdmatest::ExecuteLeafDataL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + TPtrC8 data( GetNextStringLC ( aItem, _L("Input data") )->Des() ) ; + + SetURIL(nodename) ; + + /* + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + HBufC8 *luid = GetLuidAllocLC( *iURI ); + Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + + +HBufC8 *Cdmatest::LoadFileLC( const TDesC &aFileName, TDataType &aType ) + { + RFs fs ; + LEAVE_IF_ERROR( fs.Connect(), _L( "Could not connect fileserver: %d" ) ); + + CleanupClosePushL( fs ); + RFile file ; + LEAVE_IF_ERROR( file.Open(fs,aFileName,EFileRead), _L( "Could not open file: %d" ) ); + + + + CleanupClosePushL( file ); + TInt dataSize ; + LEAVE_IF_ERROR( file.Size( dataSize ), _L( "Could not get file size: %d" ) ); + HBufC8 *nodedata = HBufC8::NewL ( dataSize ); + CleanupStack::PushL( nodedata ); + TPtr8 nodedataptr( nodedata->Des() ); + LEAVE_IF_ERROR( file.Read( nodedataptr ), _L( "Could not read file: %d" ) ); + TDataRecognitionResult aDataType; + RApaLsSession ls ; + TInt err( ls.Connect() ); + if ( err == KErrNone ) + { + CleanupClosePushL( ls ); + err = ls.RecognizeData(aFileName, nodedataptr, aDataType) ; + if ( err == KErrNone ) + { + aType = aDataType.iDataType; + } + else + { + iLog->Log( _L("LoadFileLC: WARNING Failed to get type: %d" ), err ); + aType = TDataType( KDefaultType ); + } + CleanupStack::PopAndDestroy( &ls ); + } + else + { + iLog->Log( _L("LoadFileLC: WARNING Failed to connect rapalssession: %d" ), err ); + } + CleanupStack::Pop( nodedata ); + CleanupStack::PopAndDestroy( &file ); + CleanupStack::PopAndDestroy( &fs ); + CleanupStack::PushL( nodedata ); + return nodedata ; + } + +HBufC8 *Cdmatest::LoadFileLC( const TDesC8 &aFileName, TDataType &aType ) + { + TFileName fn ; + fn.Copy( aFileName ); + return LoadFileLC( fn, aType ); + } + + +void Cdmatest::SaveDataL( TInt /*aResultsRef*/, CBufBase& aObject, + const TDesC8& aType ) + { + iLog->Log( _L8( "Saving data of type: '%S'" ), &aType ); + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFile file; + User::LeaveIfError( file.Replace ( fs, iSaveFileName, EFileWrite ) ); + CleanupClosePushL( file ); + TPtrC8 p( aObject.Ptr( 0 ) ); + User::LeaveIfError( file.Write( p ) ); + CleanupStack::PopAndDestroy( 2 ); // file, fs + } + + + +void Cdmatest::FetchNodeResultsL( TInt /*aResultsRef*/, CBufBase& aObject, + const TDesC8& /*aType*/ ) + { + TPtrC8 ptr( aObject.Ptr( 0 ) ); + iLog->Log( _L8("FetchNodeResultsL for '%S': '%S'" ), iURI, &ptr ); + + if ( ptr.Length() > 0 ) + { + TPtrC8 last( LastURISeg( ptr ) ); + HBufC8 *oldUri = HBufC8::NewL( iURI->Length() ); + (*oldUri) = *iURI; + do + { + iLog->Log ( _L8( " Node: '%S' "), &last ); + HBufC8 *nUri = HBufC8::NewLC( oldUri->Length() + 1 + last.Length() ); + nUri->Des().Copy( *oldUri ) ; + nUri->Des().Append( '/' ); + nUri->Des().Append( last ); + + SetURIL( nUri ); + //iResultsFunction = FetchNodeResultsL; + + //TPtrC8 parentURI(RemoveLastSeg(*nUri)); + //HBufC8 *luid = GetLuidAllocLC( parentURI ); + CleanupStack::Pop( nUri ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + Adapter()->ChildURIListL( *nUri, KNullDesC8, *iEmptyMappingInfoArray, 4, 5 );//Dipak + + CleanupStack::PopAndDestroy( luid ); + + ptr.Set( RemoveLastURISeg( ptr ) ); + last.Set( LastURISeg( ptr ) ); + + } + while (last != KNullDesC8); + } + + } + + + +TPtrC8 Cdmatest::LastURISeg( const TDesC8& aURI ) + { + TInt i; + for( i = aURI.Length() - 1; i >= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + if( i == 0 ) + { + return aURI; + } + else + { + return aURI.Mid( i+1 ); + } + } +TPtrC8 Cdmatest::RemoveLastSeg(const TDesC8& aURI) + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMUriSeparator) + { + break; + } + } + + if(i>0) + { + return aURI.Left(i); + } + else + { + return KNullDesC8(); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 Cdmatest::RemoveLastURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 Cdmatest::RemoveLastURISeg( const TDesC8& aURI ) + { + TInt i; + for ( i = aURI.Length() - 1; i >= 0 ; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if ( i > -1 ) + { + return aURI.Left( i ); + } + else + { + return KNullDesC8(); + } + } + +TPtrC Cdmatest::RemoveLastURISeg( const TDesC& aURI ) + { + TInt i; + for ( i = aURI.Length() - 1; i >= 0 ; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if ( i > -1 ) + { + return aURI.Left( i ); + } + else + + { + return KNullDesC(); + } + } + +void Cdmatest::SetURIL( const TDesC& aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = HBufC8::NewL( aURI.Length() ) ; + iURI->Des().Copy( aURI ); + } + +void Cdmatest::SetURIL( const TDesC8& aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = HBufC8::NewL( aURI.Length() ) ; + iURI->Des().Copy( aURI ); + } + +void Cdmatest::SetURIL( HBufC8* aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = aURI ; + } + + + +void Cdmatest::SetResultsL( + TInt aResultsRef, + CBufBase& aObject, + const TDesC8& aType ) + { + TPtrC8 ptr( aObject.Ptr(0) ); + iLog->Log( _L8( "SetResults, ref=%d, object='%S', type='%S'" ), aResultsRef, &ptr, &aType ); + if ( iResultsFunction ) + { + (this->*iResultsFunction)( aResultsRef, aObject, aType ); + iResultsFunction = NULL ; + } + + } + + +void Cdmatest::SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) + { + iStatus = aErrorCode ; + iLog->Log( _L( "SetStatusL, ref=%d, code=%d" ), aStatusRef, aErrorCode ); + + + } + +void Cdmatest::SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ) + { + iLog->Log( _L8( "SetMappingL, aURI='%s', aLUID='%s'" ), aURI.Ptr(), aLUID.Ptr() ); + + iMappingTable.Append(TMapping( aURI, aLUID ) ) ; + } + +HBufC8* Cdmatest::GetLuidAllocL( const TDesC8& aURI ) + { + iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); + HBufC8 *res = NULL; + for( TInt i(0); i < iMappingTable.Count(); i++ ) + { + if ( aURI == iMappingTable[i].iURI ) + { + res = iMappingTable[i].iLuid.AllocL(); + } + } + if ( res == NULL ) + { + res = HBufC8::NewL( 0 ); + } + iLog->Log( _L8( "GetLuidAllocL, response='%S'" ), res ); + return res; + } + +HBufC8* Cdmatest::GetLuidAllocLC( const TDesC8& aURI ) + { + iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); + HBufC8 *res = NULL; + for( TInt i(0); i < iMappingTable.Count(); i++ ) + { + if ( aURI == iMappingTable[i].iURI ) + { + res = iMappingTable[i].iLuid.AllocLC(); + break; + } + } + if ( res == NULL ) + { + res = HBufC8::NewLC( 0 ); + } + iLog->Log( _L8( "GetLuidAllocLC, response='%S'" ), res ); + return res ; + } + +#ifdef __TARM_SYMBIAN_CONVERGENCY + +void Cdmatest::GetMappingInfoListL( const TDesC8& /*aURI*/, + CArrayFix& /*aSegmentList*/ ) + { + // do nothing + } + +#else +// nothing +#endif +//*************************************************************************** +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/src/syncmldmtest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/src/syncmldmtest.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include "syncmldmtest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Csyncmldmtest::Csyncmldmtest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +/*Csyncmldmtest::Csyncmldmtest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + }*/ +Csyncmldmtest::Csyncmldmtest( CTestModuleIf& aTestModuleIf ) + : Cdmatest( aTestModuleIf, KAdapterUid ) + { + } +// ----------------------------------------------------------------------------- +// Csyncmldmtest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Csyncmldmtest::ConstructL() + { +/* iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse );*///Commented the Part for syncmldmtest Dipak + iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile ); + + iLog->Log( _L( "Loading Adapter" ) ); + + Cdmatest::ConstructL(); + + } + +// ----------------------------------------------------------------------------- +// Csyncmldmtest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Csyncmldmtest* Csyncmldmtest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Csyncmldmtest* self = new (ELeave) Csyncmldmtest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Csyncmldmtest::~Csyncmldmtest() + { + + // Delete resources allocated from test methods +// Delete(); + + // Delete logger +// delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) Csyncmldmtest::NewL( aTestModuleIf ); + + } + + + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm/tsrc/src/syncmldmtestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm/tsrc/src/syncmldmtestBlocks.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include +#include +#include "syncmldmtest.h" +#include +#include +#include + + +//using namespace NApplicationManagement;//Dipak + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Csyncmldmtest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Csyncmldmtest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Csyncmldmtest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Csyncmldmtest::RunMethodL( + CStifItemParser& aItem ) + { + + TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "DDFStructure", Csyncmldmtest::DDFStructureL), + ENTRY( "FetchNode", Csyncmldmtest::FetchNodeL ), + ENTRY( "FetchLeaf", Csyncmldmtest::FetchLeafL ), + ENTRY( "AddNode", Csyncmldmtest::AddNodeL ), + ENTRY( "UpdateLeaf", Csyncmldmtest::UpdateLeafL ), + ENTRY( "UpdateLeafData", Csyncmldmtest::UpdateLeafDataL ), + ENTRY( "Execute", Csyncmldmtest::ExecuteLeafL ), + ENTRY( "ExecuteData", Csyncmldmtest::ExecuteLeafDataL ), + ENTRY( "DeleteNode", Csyncmldmtest::DeleteObjectL ), + ENTRY( "StartAtomic", Csyncmldmtest::StartAtomicL), + ENTRY( "CommitAtomic", Csyncmldmtest::CommitAtomicL), + ENTRY( "RollbackAtomic", Csyncmldmtest::RollbackAtomicL), + ENTRY( "CompleteCommands", Csyncmldmtest::CompleteCommandsL), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + + +HBufC8 *Csyncmldmtest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) + { + TPtrC nodename; + nodename.Set( KNullDesC ); + + TInt i( aItem.GetNextString ( nodename ) ); + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); + } + else + { + iLog->Log( _L("%S: %S"), &aName, &nodename); + } + + HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; + buf->Des().Copy( nodename ); + + return buf; + } + + + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/bld/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build info file for SyncML DM settings adapter +* +*/ + + + + +PRJ_MMPFILES +./nsmldmsettingsadapter12.mmp + + + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/bld/nsmldmsettingsadapter12.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/bld/nsmldmsettingsadapter12.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM-settings adapter +* +*/ + + + + +#include "defaultcaps.hrh" +#include + +TARGET nsmldmsettingsadapter12.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x10282CE7 +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc ../../inc + +SOURCE NSmlDmSettingsAdapter12.cpp + + +START RESOURCE nsmldmsettingsadapter12.rss +END + +LIBRARY euser.lib ecom.lib charconv.lib nsmldebug.lib +LIBRARY nsmldmiapmatcher.lib +LIBRARY syncmlclientapi.lib +LIBRARY nsmltransporthandler.lib +LIBRARY nsmlprivateapi.lib +LIBRARY featmgr.lib + + +SMPSAFE +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,1021 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM Settings adapter header file +* +*/ + + + + +#ifndef __NSMLDMSETTINGSADAPTER12_H__ +#define __NSMLDMSETTINGSADAPTER12_H__ + + +// INCLUDES +#include +#include +#include +#include "NSmlPrivateAPI.h" + +// CONSTANTS +const TInt KNSmlDMGranularity = 4; +const TUint8 KNSmlDMColon = ':'; +const TUint8 KNSmlDMUriSeparator = '/'; +const TInt KPortMaxSize = 65535; +const TInt KPortMinSize = 0; +//Dynamic Node Posn Const --> DMAcc/DMIDxxx +const TInt KDynNodePosn = 2; + +_LIT8( KNSmlTrueVal, "1" ); +_LIT8( KNSmlFalseVal, "0" ); +_LIT8( KNSmlHTTPAuth, "NSmlHTTPAuth" ); +_LIT8( KNSmlHTTPUsername, "NSmlHTTPUsername" ); +_LIT8( KNSmlHTTPPassword, "NSmlHTTPPassword" ); + + +//DDF accepted DM-fieldnames +_LIT8( KNSmlDdfId, "Id" ); +_LIT8( KNSmlDdfAppId, "AppID" ); +_LIT8( KNSmlDdfServerId, "ServerID" ); +_LIT8( KNSmlDdfName, "Name" ); +_LIT8( KNSmlDdfPrefConRef, "PrefConRef" ); +_LIT8( KNSmlDdfToConRef, "ToConRef" ); +_LIT8( KNSmlDdfConRef, "ConRef" ); +_LIT8( KNSmlDdfAppAddr, "AppAddr" ); +_LIT8( KNSmlDdfAddr, "Addr" ); +_LIT8( KNSmlDdfAddrType, "AddrType" ); +_LIT8( KNSmlDdfPort, "Port" ); +_LIT8( KNSmlDdfPortNbr, "PortNbr" ); +_LIT8( KNSmlDdfAuthScheme, "AAuthPref" ); +_LIT8( KNSmlDdfAppAuth, "AppAuth" ); +_LIT8( KNSmlDdfAAuthLevel, "AAuthLevel" ); +_LIT8( KNSmlDdfAAuthType, "AAuthType" ); +_LIT8( KNSmlDdfAAuthName, "AAuthName" ); +_LIT8( KNSmlDdfAAuthSecret, "AAuthSecret" ); +_LIT8( KNSmlDdfAAuthData, "AAuthData" ); +_LIT8( KNSmlDdfExt, "Ext" ); +_LIT8( KNSmlDdfServerPW, "ServerPW" ); +_LIT8( KNSmlDdfServerNonce, "ServerNonce" ); +_LIT8( KNSmlDdfClientUserName, "UserName" ); +_LIT8( KNSmlDdfClientPW, "ClientPW" ); +_LIT8( KNSmlDdfClientNonce, "ClientNonce" ); +_LIT8( KNSmlDdfLocked, "ProfileLock" ); + + + +_LIT( KNSmlDdfMConRef, "MConRef" ); + +//Constant strings + + +_LIT8( KNSmlDdfAppIdValue, "w7" ); + + +//DDF DM-field descriptions +_LIT8( KNSmlDdfAppIdDescription, "AppID of DMSettings " ); +_LIT8( KNSmlDdfAddrDescription, "Host address of the SyncML server, IP or URL" ); +_LIT8( KNSmlDdfAddrTypeDescription, "The type of address specified in the Addr node" ); +_LIT8( KNSmlDdfPortNbrDescription, "SyncML Server port" ); +_LIT8( KNSmlDdfAuthSchemeDescription, "Scheme of authentication" ); +_LIT8( KNSmlDdfServerIdDescription, "The ServerId value for this server" ); +_LIT8( KNSmlDdfNameDescription, "Displayable name for the SyncML setings" ); +_LIT8( KNSmlDdfConRefDescription, "Logical reference to a connectivity node" ); +_LIT8( KNSmlDdfAuthLevelDescription , "AuthLevel of the AppAuth node " ); +_LIT8( KNSmlDdfAuthNameDescription , "AuthName of the AppAuth node " ); +_LIT8( KNSmlDdfAuthSecretDescription , "AuthSecret of the AppAuth node " ); +_LIT8( KNSmlDdfAuthDataDescription , "AuthData of the AppAuth node " ); +_LIT( KNSmlDdfMConRefDescription, "Parent to Multiple Connection Reference objects" ); + + +//Default data values +_LIT( KNSmlDefName, "DMAdapterIns" ); +_LIT8( KNSmlDefDMAcc, "DMAcc" ); +_LIT8( KNSmlDMStart, "DMAcc/DMId" ); +_LIT( KNSmlDefDMIAP, "AP" ); +_LIT8( KNSmlDMUriDotSlash, "./"); +_LIT8( KNSmlDMNullDesc8, ""); +_LIT8(KNSmlIAPId, "NSmlIapId"); + +_LIT8(KNSmlAddrtype, "URI"); + + +// AuthPref text values +_LIT8( KNSmlDMAuthPrefNoAuth,"syncml:auth-none"); +_LIT8( KNSmlDMAuthPrefBasic, "syncml:auth-basic"); +_LIT8( KNSmlDMAuthPrefMD5, "syncml:auth-md5"); +_LIT8( KNSmlDMAuthPrefTransport, "transport"); + +_LIT8( KNSmlDMAuthTypeBasic, "BASIC"); +_LIT8( KNSmlDMAuthTypeMD5, "DIGEST"); +_LIT8( KNSmlDMAuthTypeTransport, "TRANSPORT"); +_LIT8( KNSmlDMSettingsHTTP, "http://" ); +_LIT8( KNSmlDMSettingsHTTPS, "https://" ); + +_LIT8( KIAPid, "IAPid" ); +_LIT8( KSegmDMAcc,"AppID/ServerID/Name/PrefConRef/AppAddr/AAuthPref/AppAuth/Ext"); +_LIT8( KSegmDMAccAppAddr,"Addr/AddrType/Port"); +_LIT8( KSegmDMAccPortRT,"Port001"); +_LIT8( KSegmDMAccport,"PortNbr"); +_LIT8( KSegmDMAccAppAuth,"AAuthLevel/AAuthType/AAuthName/AAuthSecret/AAuthData"); +_LIT8( KSegmDMAccLocked,"ProfileLock"); +_LIT8( KSmlDmSlash, "/"); +_LIT8( KVersion,"1.1" ); +_LIT8( KMimeType, "text/plain" ); +_LIT8( KSyncMLText, "SyncML" ); +_LIT8( KNSmlDMadapterDesc, "DM-Settings DDF description" ); +_LIT8( KNSmlDMadapterTitle,"DM-Settings title" ); + +_LIT8( KDmAccMatch, "DMAcc/*" ); +_LIT8( KDmAccMatch3, "DMAcc/*/*" ); + +_LIT8( KDmAccMatch2, "DMAcc" ); +_LIT8 (KDmAccToConRefMatch, "DMAcc/*/ToConRef"); +_LIT8 (KDmAccToConRefId, "ConRef001"); +_LIT8 (KDmAccToConRefFullMatch, "DMAcc/*/ToConRef/ConRef001"); +_LIT8 (KDmAccAppAddrMatch, "DMAcc/*/AppAddr"); +_LIT8 (KDmAccAppAddrFullMatch, "DMAcc/*/AppAddr/*"); +_LIT8 (KDmAccPortMatch, "DMAcc/*/AppAddr/*/Port"); +_LIT8 (KDmAccExtMatch, "DMAcc/*/Ext"); +//_LIT8 (KDmAccExtFullMatch, "DMAcc/*/Ext/*"); +_LIT8 (KDmAccPortFullMatch, "DMAcc/*/AppAddr/*/Port/Port001"); +_LIT8 (KDmAccAppAuthMatch, "DMAcc/*/AppAuth"); +_LIT8 (KDmAccAppAuthFullMatch, "DMAcc/*/AppAuth/*"); +_LIT8 (KDmAccAppAuthSrvMatch, "DMAcc/*/AppAuth/AppAuthSrv"); +_LIT8 (KDmAccAppAuthCliMatch, "DMAcc/*/AppAuth/AppAuthCli"); +_LIT8 (KDmAccAppAuthObexMatch, "DMAcc/*/AppAuth/AppAuthObex"); +_LIT8 (KDmAccAppAuthHttpMatch, "DMAcc/*/AppAuth/AppAuthHttp"); +_LIT8 (KDmAccAppAuthTransMatch, "DMAcc/*/AppAuth/AppAuthTransport"); + + + +//_LIT8 (KDmAccAppAuthNodes, "AppAuthSrv/AppAuthCli/AppAuthObex/AppAuthHttp"); +_LIT8 (KDmAccAppAuthNodes, "AppAuthSrv/AppAuthCli/AppAuthTransport"); +_LIT8 (KDmAccAppAuthDyn1, "AppAuthSrv"); // serv +_LIT8 (KDmAccAppAuthDyn2, "AppAuthCli"); //client +_LIT8 (KDmAccAppAuthDyn3, "AppAuthObex"); //obex +_LIT8 (KDmAccAppAuthDyn4, "AppAuthHttp"); + +_LIT8 (KDmAccAppAuthTransport, "AppAuthTransport"); + +_LIT8 (KDmAccAppAuthDyn1LUid, "SRVCRED"); +_LIT8 (KDmAccAppAuthDyn2LUid, "CLCRED"); +_LIT8 (KDmAccAppAuthDyn3LUid, "OBEX"); +_LIT8 (KDmAccAppAuthDyn4LUid, "HTTP"); + +_LIT8 (KDmAccAppAuthLevelSrv, "SRVCRED"); +_LIT8 (KDmAccAppAuthLevelCli, "CLCRED"); +_LIT8 (KDmAccAppAuthLevelObx, "OBEX"); +_LIT8 (KDmAccAppAuthLevelHttp, "HTTP"); +_LIT8(KDmProfileLocked, "Locked"); +_LIT8(KDmProfileUnLocked, "Unlocked"); +const TInt KHttpUsed = 1; +const TInt KHttpNotUsed = 0; + + +// temporary + +_LIT8 (KDmAccAppAddrId, "Addr001"); + +// NOTE: this enum must match with property array described in +// SyncML_Sync_Agent_Client_API_Specification.doc. +enum TNSmlSyncTransportProperties + { + EPropertyIntenetAccessPoint = 0, + EPropertyHttpUsed = 5, + EPropertyHttpUserName = 6, + EPropertyHttpPassword = 7 + }; + + +// DATA TYPES +enum TNSmlDMFieldType + { + EStr, + EInt, + EBin, + EWrong + }; + +enum TNSmlDMLeafType + { + EDMUpdate, + EDMDelete, + EDMUnset + }; + +enum TNSmlDMProfileData + { + EProfileId, + EProfileName, + EProfileIAPId, + EProfileMediumType, + EProfileDMServerUsername, + EProfileDMServerPassword, + EServerNonce, + ESharedSecret, + EClientNonce, + EProfileURL, + EProfilePort, + EServerId, + EAuthenticationRequired, + ESyncAccepted, + EProfileAddrType, + EPRofileServerCred, + EPRofileClientCred, + EProfileHttpUsername, + EProfileHttpPassword, + EProfileAAuthType, + EProfileTransport, + EProfileObexUsername, + EProfileObexPassword, + ETransportAuthName, + EProfileTransportPassword, + EProfileTransportAuthData, + EProfileLock + }; + +enum TAuthenticationType + { + ENoAuth, //"syncml:auth-none" + EBasic, //"syncml:auth-basic" + EMD5 //"syncml:auth-md5" + }; + +enum TNSmlDMMediumType + { + ENone, + EHttp, + EWsp, + EObex + }; + +struct TNSmlDMLeafElement + { + HBufC8 *iUri; + HBufC8 *iData; + TInt iStatusRef; + HBufC8* iLuid; + }; + +struct TNSmlDMBufferElement + { + CArrayFixFlat *iLeafBuf; + HBufC8* iMappingName; //Holds the Dyn.Node URI + TBool iExecuted; //Node updated to dB or not + TInt iDMBuffStatusref; //Statusref for callback + TBool iAddr; + TBool iServerId; //Bools for Mandatory fields + TBool iUName; + TBool iServerName; + }; + +// CLASS DECLARATION +/** +* CNSmlDMSettingsAdapter12 class +* Contains the whole implementation of the DM settings adapter. +* +* @lib nsmldmsettingsadapter.dll +* @since Series 60 Series60_3.0 +*/ +class CNSmlDMSettingsAdapter12 : public CSmlDmAdapter + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CNSmlDMSettingsAdapter12* NewL(MSmlDmCallback* aDmCallback ); + static CNSmlDMSettingsAdapter12* NewLC(MSmlDmCallback* aDmCallback ); + + void ConstructL(); + + /** + * Destructor. + */ + virtual ~CNSmlDMSettingsAdapter12(); + + public: // Functions from base classes + + /** + * From CSmlDmAdapter DDFVersionL returns current version of the DDF. + * @since Series60_3.0 + * @param aVersion DDF version of the adapter. + * @return none + */ + void DDFVersionL( CBufBase& aVersion ); + + /** + * From CSmlDmAdapter DDFStructureL for filling the DDF structure of the adapter. + * @since Series60_3.0 + * @param aDDF Reference to root object. + * @return none + */ + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + /** + * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces + * data in existing leaf objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aObject Data of the object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ); + + /** + * From CSmlDmAdapter DeleteObjectL deletes an object and its child objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter FetchLeafObjectL fetches data of a leaf object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ); + /** + * From CSmlDmAdapter ChildURIListL fetches URI list. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aPreviousURISegmentList URI list with mapping LUID information + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef ); + + /** + * From CSmlDmAdapter AddNodeObjectL adds node object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aParentLUID LUID of the parent object + * @param aStatusRef Reference to correct command + * @return none + */ + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces + * data in existing leaf objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream Data of the object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter FetchLeafObjectSizeL fetches the size of a leaf object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aArgument Argument for the command + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream Argument for the command + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aTargetURI Target URI for the command + * @param aTargetLUID LUID of the target object + * @param aSourceURI Source URI for the command + * @param aSourceLUID LUID of the source object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function indicates start of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void StartAtomicL(); + + /** + * From CSmlDmAdapter The function indicates successful end of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void CommitAtomicL(); + + /** + * From CSmlDmAdapter The function indicates unsuccessful end of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void RollbackAtomicL(); + + /** + * From CSmlDmAdapter Returns ETrue if adapter supports streaming otherwise EFalse. + * @since Series60_3.0 + * @param aItemSize Size limit for stream usage. + * @return ETrue or EFalse + */ + TBool StreamingSupport( TInt& aItemSize ); + + /** + * From CSmlDmAdapter Called when stream returned from UpdateLeafObjectL or + * ExecuteCommandL has been written to and committed. + * @since Series60_3.0 + * @param none + * @return none + */ + void StreamCommittedL(); + + /** + * From CSmlDmAdapter The function tells the adapter that all the commands of the message that + * can be passed to the adapter have now been passed. + * @since Series60_3.0 + * @param none + * @return none + */ + void CompleteOutstandingCmdsL(); + + /** + * From CSmlDmAdapter The function to set profile lock + * @since Series60_3.0 + * @param profileId lockvalue + * @return TInt + */ + TInt SetProfileLockL(const TInt aPID, TInt aLockValue); + + private: + + /** + * C++ default constructor. + */ + CNSmlDMSettingsAdapter12(); + CNSmlDMSettingsAdapter12( TAny* aEcomArguments ); + + /** + * The function stores integer value to buffer and returns reference to it. + * @param aObject data to be stored to buffer. + * @return reference to data buffer. + */ + TDesC8& SetIntObjectLC( const TInt& aObject ); + + /** + * The function finds out the last element of the uri. + * @param aSource Uri object that contains all elements. + * @return KErrNone if successful. + */ + TInt SetField( const TDesC8& aSource ); + + /** + * The function sets the uri being set ot get + * @param aSource Uri object that contains all elements. + * @return KErrNone if successful. + */ + TInt SetURIInProcessL( const TDesC8& aSource ); + + + /** + * The function converts data to integer and returns it. + * @param aObject Data object to be converted. + * @return Integer value for an object. + */ + TInt GetIntObject( const TDesC8& aObject ); + + /** + * The function converts data to integer and returns it. + * @param aObject Data object to be converted. + * @return 16-bit integer value for an object. + */ + TInt GetIntObject16( const TDesC& aObject ); + + /** + * The function converts LUID to integer. + * @param aLUID LUID data to be converted. + * @return Integer value for a LUID. + */ + TInt IntLUID( const TDesC8& aLUID ); + + /** + * The function sets the IAP value acording the given URI. + * @param aLUID LUID for a profile. + * @param aObject Data object containing the URI. + * @return KErrNone if successfull. + */ + TInt SetConRefL( const TInt aLUID, const TDesC8& aObject ); + + /** + * The function gets the URI for profile IAP. + * @param aObject Object where the result will be stored. + * @return KErrNone if successfull. + */ + TInt GetConRefL( CBufBase& aObject ); + + /** + * The function checks if field to be handled is valid. + * @param none + * @return ETrue if valid field otherwise EFalse. + */ + TBool AcceptDMField(); + + /** + * The function checks if field type to be handled is valid. + * @param none + * @return enum value for a field type. + */ + TNSmlDMFieldType GetDMFieldType() const; + + /** + * The function returns enum value for a field to be handled. + * @param none + * @return enum value for a field to be handled. + */ + TNSmlDMProfileData GetDMField() ; + + /** + * The function checks if data length is valid. + * @param aProfileItem Field / Leaf ID to be handled. + * @param aSource Data to be handled. + * @return ETrue if data length is valid otherwise EFalse. + */ + TBool NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, + const TDesC8& aSource ); + + /** + * The function converts 16-bit data to 8-bit and returns reference to it. + * @param aSource Reference data to be converted. + * @return Reference to 8-bit data buffer. + */ + TDesC8& ConvertTo8LC( const TDesC& aSource ); + + /** + * The function converts 8-bit data to 16-bit and returns reference to it. + * @param aSource Reference data to be converted. + * @return Reference to 16-bit data buffer. + */ + TDesC16& ConvertTo16LC( const TDesC8& aSource ); + + /** + * The function find out the port number from URL and stores it to aPort. + * @param aRealURI Reference data to be containing the whole URI. + * @param aPort Reference variable where port number will be stored. + * @return KErrNone if successful otherwise KErrNotFound. + */ + TInt ParseUri( const TDesC8& aRealURI, TInt& aPort ); + + /** + * The function opens the server session and profile via client API. + * @param aIntLUID Integer value for a LUID of the profile. + * @param aMode Read or Read and Write mode for a profile data. + * @return KErrNone if successful otherwise KErrNotFound. + */ + TInt OpenSyncSessionAndProfileL( const TInt aIntLUID, TSmlOpenMode aMode ); + + /** + * The function checks if requested profile ID exits. + * @param aIntLUID Integer value for a LUID of the profile. + * @return ETrue if profile exits otherwise EFalse. + */ + TBool FindProfileIdL( const TInt aIntLUID ); + + /** + * The function creates new DM profile. + * @param aPID Reference to variable where new profile will be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt CreateNewProfileL( TInt& aPID ); + + /** + * The function stores the server URL for a profile. + * @param aPID Profile ID. + * @param aObj Reference to server URL data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileServerURIL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the display name for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileDisplayNameL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the user name for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileUserNameL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the profile http user name for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileHttpUserNameL( const TInt aPID, const TDesC8& aObj ); + + + /** + * The function stores the protocol version for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileProtocolVersionL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the ServerId value for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileServerIdL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the Server password for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileServerPasswordL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the network/http password for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileHttpPasswordL( const TInt aPID, const TDesC8& aObj ); + + + /** + * The function stores the password value for a profile. + * @param aPID Profile ID. + * @param aObj Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfilePasswordL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function stores the IAP id value for a profile. + * @param aLUID Profile ID. + * @param aIAPid Reference to data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileConnectionPropertyL( const TInt aLUID, const TInt aIAPid ); + + /** + * The function deleted the profile data. + * @param aPID Profile ID. + * @return KErrNone if successful otherwise error code. + */ + TInt DeleteProfileL( const TInt aPID ); + + /** + * The function to tell whether the profile is locked. + * @param aPID + * @return 1 if locked otherwise 0 + */ + TBool IsProfileLockedL(const TInt aPID); + + /** + * The function gets the profile data acoeding to aDMField. + * @param aLUID Profile ID. + * @param aDMField Data field ID to be handled. + * @param aObject Reference where fetched data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, + CBufBase& aObject ); + + /** + * The function adds port number to address URL. + * @param aLUID Profile ID. + * @param aPort Reference to port number data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileConnectionPortNrL( const TInt aLUID, const TDesC8& aPort ); + + /** + * The function adds port number to address URL. + * @param aSrvURI Original address URI. + * @param aNewURI New URI when port number has been added or deleted. + * @param aPort Reference to port number data. + * @return KErrNone if successful otherwise error code. + */ + void SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, + const TDesC8& aPort ); + + /** + * General function which selects which leaf to be handled. + * @param aLUID Profile LUID. + * @param aObject Data to be stored. + * @param aField Leaf of field ID to be handled. + * @return KErrNone if successful otherwise error code. + */ + TInt SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, + const TNSmlDMProfileData aField ); + /** + * The function fills the node info. + * @param aNode Reference to node or leaf which info to be filled. + * @param aAccTypes Access rights for a leaf / node. + * @param aOccurrence Occurance of the node / leaf. + * @param aScope Scope (dynamic / permanent) of the leaf / node. + * @param aFormat Data format of the leaf / node. + * @param aDescription Description of the node / leaf. + * @param aDefaultValue Default value for a leaf or node. + * @param aMimeType MIME type for a leaf / node. + * @return none + */ + void FillNodeInfoL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription, + const TDesC8& aDefaultValue, const TDesC8& aMimeType ); + + /** + * The function reads the authentication data via private API. + * @param aLUID LUID for a profile. + * @param aField Leaf id to be handled. + * @param aObject Reference where to store the data. + * @return KErrNone if successful otherwise error code. + */ + TInt GetDMAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField, + CBufBase& aObject ); + + /** + * The function delete's the authentication data via private API. + * @param aLUID LUID for a profile. + * @param aField Leaf id to be handled. + * @return KErrNone if successful otherwise error code. + */ + TInt DeleteDMAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField ); + + /** + * The function set's the address type / medium type value for a profile. + * @param aLUID LUID for a profile. + * @param aIntObj Address type value. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileAddrTypeL( const TInt aLUID, const TInt aIntObj ); + + /** + * The function gets the profile medium type value. + * @param aObject Reference where data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileConnectiontypeL( TInt& aMediumTYpe ); + + /** + * The function gets the profile http user name of value. + * @param aObject Reference where data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetHttpUsernameL( CBufBase& aObject ); + + + /** + * The function gets the profile IAP value. + * @param aIAPid Reference where data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileIAPIdL( TInt& aIAPid ); + + /** + * The function gets the profile Server URL value. + * @param aURL Reference where data to be stored. + * @return KErrNone if successful otherwise error code. + */ + void GetProfileServerURLL( CBufBase& aURL ); + + /** + * The function checks the requested medium type if supported. + * @param aIntObj Medium type. + * @param aMediumType UID for medium type. + * @return none + */ + void GetMediumTypeL( const TInt aIntObj, TInt& aMediumType ); + + /** + * The function gets the server id value. + * @param aObject Reference where data to be stored. + * @return none + */ + void GetServerIdL( CBufBase& aObject ); + + /** + * The function gets the profile name value. + * @param aObject Reference where data to be stored. + * @return none + */ + void GetProfileNameL( CBufBase& aObject ); + + /** + * The function gets the user name value. + * @param aObject Reference where data to be stored. + * @return none + */ + void GetProfileUserNameL( CBufBase& aObject ); + + /** + * The function gets the profile port number value. + * @param aObject Reference where data to be stored. + * @return none + */ + void GetProfilePortNumberL( CBufBase& aObject ); + + /** + * The function sets the profile authentication info via private API. + * @param aLUID Profile LUID. + * @param aField Leaf ID to be handled. + * @param aObject Data to be stored. + * @param aStatus Status of the function, KErrNone if successful. + * @return none + */ + void SetAuthInfoL( const TInt aLUID, const TNSmlDMProfileData aField, + const TDesC8& aObject, TInt& aStatus ); + //Buffers Node Object <> + void AddNodeBufferL( const TDesC8& aURI, const TInt aStatusRef); + + //Buffers Leaf Object + void AddLeafBufferL( const TDesC8& aURI, const TDesC8& aObject, + const TInt aStatusRef); + // Executes Buffer + void ExecuteBufferL(); + //Extracts the ParentURI + TPtrC8 ParentURI(const TDesC8& aURI); + // Clears the elements of the passed in LeafElement Structure + void ClearBuffer( CArrayFixFlat* aBuffer); + /** + * The function checks if requested ServerID ID exits. + * @param aServerid ServerID. + * @return ETrue if ServerID exits otherwise EFalse. + */ + TBool IsServerIDExistL( const TDesC8& aServerid ); + + /** + * The function checks if the URI is of format ./DMAcc/DMId + * Example ./DMAcc/DMId000 + * @param aURI aURI. + * @return true/false + */ + TBool IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI); + + /** + * The function constructs ./DMAcc/x nodes and + * returns the profile ID matching the aURI. + * @param aURI aURI. + * @return KErrNotFound/ProfileID + */ + + TInt ConstructTreeL(const TDesC8& aURI); + + /** + * The function extracts DMAcc/x node from aURI + * @param aURI DMAcc aURI. + * @return DMAcc/x node. + */ + TPtrC8 GetDynamicDMNodeUri(const TDesC8& aURI); + + private: // Data + + // Client API session class + RSyncMLSession iSyncSession; + // Client API Device Management profile handling + RSyncMLDevManProfile iProfile; + // Callback interface for returning result or status + MSmlDmCallback* iCallBack; + + TInt iCurrentProfile; + + // Profile LUID + TInt iLUID; + // Parent LUID + TInt iParentLUID; + // For handling profile medium type + TInt iObject; + + // Buffer for URI leaf element + HBufC8* iField; + + HBufC8* iURIField; + TBool iNewProfile; + // Information about data type + TNSmlDMFieldType iFieldType; + // Information about leaf command + TNSmlDMLeafType iLeafType; + // Status information if session allready opened + TBool iSyncSessionOpen; + + // Buffer for storing port number + HBufC8* iPortNbr; + + // Private API interface for handling authebtication data + RNSmlPrivateAPI iPrivateApi; + + struct TPortBuffer + { + // buffered data for updating port number + TBufC8<5> iPortBuf; + TInt iPortBufLUID; + TInt iPortBufStatusRef; + }; + RArray iPortBuffer; + + struct TLockBuffer + { + // buffered data for profile lock + TInt iProfileLock; + TInt iProfileLockLUID; + TInt iProfileLockStatusRef; + }; + RArray iProfileLockBuffer; + + TBool iBufOn; + TBool iComplete; + TInt iExecutionIndex; + CArrayFixFlat *iBuffer; + }; + +#endif // __NSMLDMSETTINGSADAPTER12_H__ + +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,4002 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM-settings adapter +* +*/ + + + + +// INCLUDE FILES +#include "NSmlDMSettingsAdapter12.h" +#include "nsmldebug.h" +#include "nsmlconstants.h" +#include "nsmldmconstants.h" +#include "nsmldmiapmatcher.h" +#include "nsmldmauthinfo.h" +#include +#include +#include +#include +#include +#include +#include +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + +const TUint KNSmlDMSettingsAdapterImplUid = 0x10282CE8; + +const TInt KBufSize32 = 32; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CNSmlDMSettingsAdapter12* CNSmlDMSettingsAdapter12::NewL( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDMSettingsAdapter12::NewL(): begin"); + + CNSmlDMSettingsAdapter12* self = NewLC( aDmCallback ); + CleanupStack::Pop(); + + _DBG_FILE("CNSmlDMSettingsAdapter12::NewL(): end"); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::NewLC( ) +// Loads the CNSmlDMSettingsAdapter12 class and pushes it to clenupstack. +// ----------------------------------------------------------------------------- +CNSmlDMSettingsAdapter12* CNSmlDMSettingsAdapter12::NewLC( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::NewLC(): begin" ); + CNSmlDMSettingsAdapter12* self = new ( ELeave ) CNSmlDMSettingsAdapter12( aDmCallback ); + CleanupStack::PushL( self ); + self->iCallBack = aDmCallback; + self->ConstructL(); + self->iLeafType = EDMUnset; + + _DBG_FILE( "CNSmlDMSettingsAdapter12::NewLC(): end" ); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter() +// Default constructor. +// ----------------------------------------------------------------------------- +CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter12( TAny* aEcomArguments) : + CSmlDmAdapter(aEcomArguments ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter(): begin" ); + _DBG_FILE( "CNSmlDMSettingsAdapter12::CNSmlDMSettingsAdapter(): end" ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter() +// Destructor. +// ----------------------------------------------------------------------------- +CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter12() + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter(): begin" ); + + delete iField; + delete iURIField; + // Client API Session & Profile + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + // In Case the Buffer isnt cleared + if ( iBuffer) + { + for (TInt val =0; valCount ();val++) + { + delete iBuffer->At(val).iMappingName; + + ClearBuffer ( iBuffer->At(val).iLeafBuf); + delete iBuffer->At(val).iLeafBuf; + } + + iBuffer->Reset (); + delete iBuffer; + } + delete iPortNbr; + iPortBuffer.Reset(); + iPortBuffer.Close(); + iProfileLockBuffer.Reset(); + iProfileLockBuffer.Close(); + + iPrivateApi.Close(); + + iCallBack = 0; + FeatureManager::UnInitializeLib(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::~CNSmlDMSettingsAdapter(): end" ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::ConstructL() +// Second phase constructor. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::ConstructL() + { + iField = HBufC8::NewL( KNSmlMaxURLLength ); + iURIField = NULL; + iSyncSessionOpen = EFalse; + FeatureManager::InitializeLibL(); + // variables used for Buffering + iBufOn = EFalse; + iComplete = EFalse; + iExecutionIndex = -1; + iNewProfile = EFalse; + // initialising iBuffer + iBuffer = new (ELeave) CArrayFixFlat (KNSmlDMGranularity); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::DDFVersionL() +// Returns the DDF version number. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::DDFVersionL( CBufBase& aVersion ) + { + _DBG_FILE( + "CNSmlDMSettingsAdapter12::DDFVersionL(CBufBase& aDDFVersion): begin" ); + aVersion.InsertL( 0, KVersion ); + _DBG_FILE( + "CNSmlDMSettingsAdapter12::DDFVersionL(CBufBase& aDDFVersion): end" ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::DDFStructureL() +// Fills the DDF structure of the adapter. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::DDFStructureL(): begin" ); + + //Making DMAcc as root + + MSmlDmDDFObject* ddfRoot = &aDDF; + MSmlDmDDFObject& nDmDDF = ddfRoot->AddChildObjectL( KNSmlDefDMAcc ); + + TSmlDmAccessTypes *aclTypes = new ( ELeave ) TSmlDmAccessTypes(); + CleanupStack::PushL( aclTypes ); + + // Set Get as acceptable operations + aclTypes->SetGet(); + + nDmDDF.SetDFTitleL( KNSmlDMadapterTitle ); + + FillNodeInfoL( nDmDDF, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KNullDesC8, KNullDesC8, KNullDesC8 ); + + aclTypes->SetAdd(); + // Set rest acceptable operations for data itself + aclTypes->SetReplace(); + aclTypes->SetDelete(); + + TSmlDmAccessTypes aclTypesNoGet; + aclTypesNoGet.SetReplace(); + aclTypesNoGet.SetAdd(); + aclTypesNoGet.SetDelete(); + + TSmlDmAccessTypes aclTypesAR; + aclTypesAR.SetReplace(); + aclTypesAR.SetAdd(); + + TSmlDmAccessTypes aclTypesARG; + aclTypesARG.SetReplace(); + aclTypesARG.SetAdd(); + aclTypesARG.SetGet(); + + TSmlDmAccessTypes aclTypesG; + aclTypesG.SetGet(); + + TSmlDmAccessTypes aclTypesAG; + aclTypesAG.SetGet(); + aclTypesAG.SetAdd(); + + TSmlDmAccessTypes aclTypesAGD; + aclTypesAGD.SetGet(); + aclTypesAGD.SetAdd(); + aclTypesAGD.SetDelete(); + + + MSmlDmDDFObject& nProDDF = nDmDDF.AddChildObjectGroupL(); + FillNodeInfoL( nProDDF, *aclTypes, MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNullDesC8, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nAppIdDDF = nProDDF.AddChildObjectL( KNSmlDdfAppId ); // Addr + FillNodeInfoL( nAppIdDDF, aclTypesG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAppIdDescription, KNullDesC8, KMimeType ); + + //PrefConRef + MSmlDmDDFObject& nPrefConRefDDF = nProDDF.AddChildObjectL( KNSmlDdfPrefConRef ); // PrefConRef + FillNodeInfoL( nPrefConRefDDF, aclTypesARG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfConRefDescription, KNullDesC8, KMimeType ); + + + + // App Address nodes + MSmlDmDDFObject& nAppAddrDDF = nProDDF.AddChildObjectL( KNSmlDdfAppAddr ); // AppAddr + FillNodeInfoL( nAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNSmlDdfAddrDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& rtToAppAddrRef = nAppAddrDDF.AddChildObjectGroupL(); //AppAddr/ + FillNodeInfoL(rtToAppAddrRef,aclTypesG,MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode, + KNSmlDdfAddrDescription,KNullDesC8, KMimeType ); + + + MSmlDmDDFObject& nAddrForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfAddr ); // Addr + FillNodeInfoL( nAddrForAppAddrDDF, aclTypesARG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAddrDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nAddrTypeForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfAddrType ); // AddrType + FillNodeInfoL( nAddrTypeForAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nPortForAppAddrDDF = rtToAppAddrRef.AddChildObjectL( KNSmlDdfPort ); // PortNbr + FillNodeInfoL( nPortForAppAddrDDF, aclTypesG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); + + //Runtime port address + MSmlDmDDFObject& nrtToPortDDF = nPortForAppAddrDDF.AddChildObjectGroupL(); // PortNbr + FillNodeInfoL( nrtToPortDDF, aclTypesG, MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nPortNbrToPortDDF = nrtToPortDDF.AddChildObjectL( KNSmlDdfPortNbr ); // PortNbr + FillNodeInfoL( nPortNbrToPortDDF, aclTypesARG, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, + KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); + + + MSmlDmDDFObject& nAuthSchemeDDF = nProDDF.AddChildObjectL( KNSmlDdfAuthScheme ); // AuthPref + FillNodeInfoL( nAuthSchemeDDF, aclTypesARG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); + //APPAUthNodes + + MSmlDmDDFObject& nAppAuthDDF = nProDDF.AddChildObjectL( KNSmlDdfAppAuth ); // AppAuth + FillNodeInfoL( nAppAuthDDF, aclTypesG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); + + + MSmlDmDDFObject& nrtToAppAuthDDF = nAppAuthDDF.AddChildObjectGroupL(); // appauth/ + FillNodeInfoL( nrtToAppAuthDDF, aclTypesG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); + + + MSmlDmDDFObject& nAauthLevelDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthLevel ); // AAuthLevel + FillNodeInfoL( nAauthLevelDDF, aclTypesARG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAuthLevelDescription, KNullDesC8, KMimeType ); + + + MSmlDmDDFObject& nAauthtypeDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthType ); // AAuthType + FillNodeInfoL( nAauthtypeDDF, aclTypesG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType ); + + + MSmlDmDDFObject& nAauthNameDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthName ); // AddrType + FillNodeInfoL( nAauthNameDDF, aclTypesARG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAuthNameDescription, KNullDesC8, KMimeType ); + + + MSmlDmDDFObject& nAauthSecretDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthSecret ); // AddrType + FillNodeInfoL( nAauthSecretDDF, aclTypesAR, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAuthSecretDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nAauthDataDDF = nrtToAppAuthDDF.AddChildObjectL( KNSmlDdfAAuthData ); // AddrType + FillNodeInfoL( nAauthDataDDF, aclTypesAR, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAuthDataDescription, KNullDesC8, KMimeType ); + + + MSmlDmDDFObject& nNameDDF = nProDDF.AddChildObjectL( KNSmlDdfName ); // Name + FillNodeInfoL( nNameDDF, aclTypesARG, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfNameDescription, KNullDesC8, KMimeType ); + + + + MSmlDmDDFObject& nServerIdDDF = nProDDF.AddChildObjectL( KNSmlDdfServerId ); // ServerId + FillNodeInfoL( nServerIdDDF, aclTypesAG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nextDDF = nProDDF.AddChildObjectL( KNSmlDdfExt ); // Ext + FillNodeInfoL( nextDDF, aclTypesG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nlockedDDF = nextDDF.AddChildObjectL( KNSmlDdfLocked ); // locked + FillNodeInfoL( nlockedDDF, aclTypesARG, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); + + CleanupStack::PopAndDestroy(); //aclTypes + + _DBG_FILE("CNSmlDMSettingsAdapter12::DDFStructureL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::UpdateLeafObjectL +// Updates profile leaf object data based on URI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDMSettingsAdapter12::UpdateLeafObjectL(): begin"); + TInt index = -1; + if ( !iBufOn) + { + for (TInt val = 0; valCount (); val++) + { + TPtrC8 firstUri = ParentURI (aURI); + if ( iBuffer->At(val).iMappingName->Compare (firstUri)== 0) + { + index = iExecutionIndex = val; + break; + } + } + } + if ( index >= 0) + AddLeafBufferL (aURI, aObject, aStatusRef); + else + { + TInt parentLUID = GetIntObject( aLUID ); + if( parentLUID < 0 ) + { + if( IsDMAccUriFormatMatchPredefined(aURI) ) + { + parentLUID = ConstructTreeL(aURI); + } + } + if( parentLUID < 0 ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL( ): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + if( parentLUID != iParentLUID ) + { + if( FindProfileIdL( parentLUID ) != EFalse ) + { + iParentLUID = parentLUID; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + SetField( aURI ); + SetURIInProcessL( aURI); + if( !AcceptDMField() ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): KErr field end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + + // Get Database field type + TNSmlDMFieldType fType = GetDMFieldType(); + if ( fType == EWrong ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + TNSmlDMProfileData fData = GetDMField(); + if( fData == ESyncAccepted ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + if( NotValidStrLenght( fData, aObject ) ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): KErr length end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + return; + } + //Authentication data leafs to be handled + if ( fData == EAuthenticationRequired || fData == EClientNonce + || fData == EServerNonce ) + { + //Check if replace command and replace data as defined + + TInt replaceStatus = KErrGeneral; + SetAuthInfoL( iParentLUID + KMaxDataSyncID, fData, aObject, replaceStatus ); + if ( replaceStatus == KErrNone ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + else if ( replaceStatus == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + + _DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL():end" ); + return; + } + + TInt rValue = SetDMFieldDataL( iParentLUID, aObject, fData ); + if ( fData == EProfilePort ) + { + // in case port is updated, save status ref to be used in + // CompleteOutstandingCmdsL + if(rValue==KErrNone) + { + iPortBuffer[iPortBuffer.Count()-1].iPortBufStatusRef = aStatusRef; + } + else if( rValue == KErrOverflow) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + else if ( fData == EProfileLock && iNewProfile ) + { + if(rValue == KErrNone) + iProfileLockBuffer[iProfileLockBuffer.Count()-1].iProfileLockStatusRef = aStatusRef; + else + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed); + } + else + { + if( rValue != KErrNone ) + { + if( rValue == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else if( rValue == KErrInUse ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); + } + else if( rValue == KErrNoMemory ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory ); + } + else if(rValue == KErrAccessDenied) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed); + + } + else if ( rValue == KErrArgument) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject); + + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + } + } + _DBG_FILE( "CNSmlDMSettingsAdapter12::UpdateLeafObjectL():end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::DeleteObjectL +// Deletes whole profile or leaf object data acording to aURI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): begin" ); + + if( aURI.Find( KNSmlDdfConRef ) != KErrNotFound ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL(): NOT ALLOWED end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + iLUID = IntLUID( aLUID ); + if(IsProfileLockedL(iLUID)) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL(): NOT ALLOWED end" ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed ); + return; + } + + + // Check which field going to be handled + SetField( aURI ); + SetURIInProcessL(aURI); + + // Check if valid field + if( !AcceptDMField() ) + { + + // Delete whole profile if aURI called for node + TInt last = aURI.LocateReverse( '/' ); + TInt pos = aURI.Find( KNSmlDefDMAcc ); + if( last - 5 == pos ) + { + + // If called for node means that profile will deleted from database + iLUID = IntLUID( aLUID ); + DBG_ARGS8( _S8("DeleteObjectL: URI %S LUID = %d"), &aURI, iLUID ); + + if( FindProfileIdL( iLUID ) == EFalse ) + { + _DBG_FILE( + "CNSmlDMSettingsAdapter12::DeleteObjectL( ): notfound end"); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + else + { + TInt sRet = DeleteProfileL( iLUID + KMaxDataSyncID ); + if ( sRet != KErrNone ) + { + if( sRet == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, + CSmlDmAdapter::ENotFound ); + } + else if( sRet == KErrInUse ) + { + iCallBack->SetStatusL( aStatusRef, + CSmlDmAdapter::EObjectInUse ); + } + else + { + iCallBack->SetStatusL( aStatusRef, + CSmlDmAdapter::EError ); + } + return; + } + else + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): EOk end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + } + } + else + { + _DBG_FILE( + "CNSmlDMSettingsAdapter12::DeleteObjectL( ): EInvalidObject end" ); + iCallBack->SetStatusL( aStatusRef,CSmlDmAdapter::EInvalidObject ); + return; + } + }//Delete whole Profile + + iLUID = IntLUID( aLUID ); + if ( iLUID != iParentLUID ) + { + if( FindProfileIdL( iLUID ) == EFalse ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + iParentLUID = iLUID; + } + + if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) + { + DeleteDMAuthInfoL( iLUID, EAuthenticationRequired ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + else if( iField->Compare( KNSmlDdfClientNonce ) == 0 ) + { + DeleteDMAuthInfoL( iLUID, EClientNonce ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + else if( iField->Compare(KNSmlDdfServerNonce) == 0 ) + { + DeleteDMAuthInfoL( iLUID, EServerNonce ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + + // Sets default value if not null field + HBufC8* dataObject = HBufC8::NewLC( 15 ); + dataObject->Des().Format( KNullDesC8 ); + + _LIT8(aType, "text/plain"); + iLeafType = EDMDelete; + UpdateLeafObjectL( aURI, aLUID, *dataObject, aType, aStatusRef ); + CleanupStack::PopAndDestroy(); //dataObject + iLeafType = EDMUnset; + + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteObjectL( ): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::FetchLeafObjectL +// Fetches profile leaf object data acordint to aURI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): begin" ); + DBG_ARGS(_S16( "DM:Fetch aURI - %S - %S"), &aURI, &aLUID ); + + iLUID = IntLUID( aLUID ); + if ( iLUID >= 0 ) + { + if( FindProfileIdL( iLUID ) == EFalse ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + else + { + + // Static node feature start + iLUID = -1; + if( IsDMAccUriFormatMatchPredefined(aURI) ) + { + iLUID = ConstructTreeL(aURI); + } + + if (iLUID == -1) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + // Static node feature end + } + + // Check which field going to be handled + SetField(aURI); + SetURIInProcessL(aURI); + + // Check if valid field + if( !AcceptDMField() ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EInvalidObject end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + /*if(iField->Compare(KNSmlDdfExt) == 0) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + CBufBase* extNode = CBufFlat::NewL(128); + CleanupStack::PushL(extNode); + iCallBack->SetResultsL( aResultsRef, *extNode, KNullDesC8 ); + CleanupStack::PopAndDestroy(extNode); + return; + }*/ + + // Get Database field type + TInt fType = GetDMFieldType(); + if ( fType == EWrong ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + TNSmlDMProfileData fieldId = GetDMField(); + if( fieldId == ESyncAccepted ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + CBufBase *lObject = CBufFlat::NewL( 128 ); + CleanupStack::PushL( lObject ); + lObject->Reset(); + + CSmlDmAdapter::TError status; + + if ( fType == EStr || fType == EInt || fType == EBin ) + { + // Check for APPId and return w7 + TInt rValue = KErrNone; + /* if( iField->Compare(KNSmlDdfAppId ) ==0 ) + { + status = CSmlDmAdapter::EOk; + lObject->InsertL(lObject->Size(),KNSmlDdfAppIdValue); + + }*/ + + rValue = GetObjectL( iLUID, fieldId, *lObject ); + if( rValue != KErrNone ) + { + if( rValue == KErrNotFound ) + { + status = CSmlDmAdapter::ENotFound; + } + else if( rValue == KErrInUse ) + { + status = CSmlDmAdapter::EObjectInUse; + } + else if( rValue == KErrNoMemory ) + { + status = CSmlDmAdapter::ENoMemory; + } + else + { + status = CSmlDmAdapter::EError; + } + } + else + { + status = CSmlDmAdapter::EOk; + } + } + else + { + CleanupStack::PopAndDestroy(); //lObject + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + return; + } + iCallBack->SetStatusL( aStatusRef, status ); + + if(status==CSmlDmAdapter::EOk) + { + iCallBack->SetResultsL( aResultsRef, *lObject, aType ); + } + + CleanupStack::PopAndDestroy(); //lObject + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CSmlDmSettingsAdapter::ChildURIListL +// Function returns the list of profiles or leafs of the profile +// acording to aURI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): begin" ); + CBufBase *currentURISegmentList = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentURISegmentList ); + + if(( aURI.Match( KDmAccMatch ) != KErrNotFound ) && + (aURI.Match( KDmAccMatch3 ) == KErrNotFound )) + { + // Check if Profile exists + TInt checkLUID = GetIntObject( aLUID ); + if( FindProfileIdL( checkLUID ) ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAcc ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + else + { + // Static node feature start + checkLUID = -1; + if( IsDMAccUriFormatMatchPredefined(aURI) ) + { + checkLUID = ConstructTreeL(aURI); + } + + if (checkLUID == -1) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::childURI(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( ); // currentURISegmentList + _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): end" ); + return; + } + else + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAcc ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + + } + + + // iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + // Static node feature start end + } + + CleanupStack::PopAndDestroy( ); // currentURISegmentList + _DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): end" ); + return; + } + else if(( aURI.Match( KDmAccMatch2 ) != KErrNotFound ) && + (aURI.Match( KDmAccMatch ) == KErrNotFound )) + { + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + + for( TInt p = 0; p < profileIdArray.Count(); p++ ) + { + TBool notInList = ETrue; + TInt newline = 0; + TInt ddId = profileIdArray[p] - KMaxDataSyncID; + + while( notInList && newline < aPreviousURISegmentList.Count() ) + { + TInt ppId = GetIntObject( aPreviousURISegmentList.At(newline).iURISegLUID ); + if( ppId == ddId ) + { + notInList = EFalse; + break; + } + newline++; + } + if( notInList ) + { + _LIT8( Kprev, "DMId" ); + TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid + TInt fixedProfId = profileIdArray[p] - KMaxDataSyncID; //fit to 3 decimal + addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); + + currentURISegmentList->InsertL( currentURISegmentList->Size(), addNAME ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash ); + DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME ); + + // KNSmlDMStart includes start text for URISeg + TBuf8<20> addURI; // SyncML/DMAcc/DMIdnnn , nnn = profileid + addURI.Append( KNSmlDMStart ); + addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); + + TBuf8<3> addLUID; + addLUID.Num( fixedProfId ); + + // Also added to mapping + iCallBack->SetMappingL( addURI, addLUID ); + } + else + { // Add those in PreviousList which are on database + currentURISegmentList->InsertL( currentURISegmentList->Size(), + aPreviousURISegmentList.At(newline).iURISeg ); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash ); +// DBG_ARGS8( _S8("InList: Id = %d Name %S"), newline, +// aPreviousURISegmentList.At(newline).iURISeg ); + } + } + CleanupStack::PopAndDestroy( 1 );//profileIdArray + } + + // AppAddr subtree + else if( ( aURI.Match( KDmAccAppAddrMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortMatch ) == KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound )) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KDmAccAppAddrId ); + } + else if(( aURI.Match( KDmAccAppAddrFullMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortMatch ) == KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound )) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAddr ); + } + else if(( aURI.Match( KDmAccPortMatch ) != KErrNotFound ) && (aURI.Match( KDmAccPortFullMatch ) == KErrNotFound )) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccPortRT ); + } + else if( aURI.Match( KDmAccPortFullMatch ) != KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccport ); + } + + else if(( aURI.Match( KDmAccAppAuthMatch ) != KErrNotFound ) && (aURI.Match( KDmAccAppAuthFullMatch ) == KErrNotFound )) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KDmAccAppAuthNodes ); + } + else if((aURI.Match(KDmAccAppAuthSrvMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthCliMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthTransMatch) != KErrNotFound)) //|| (aURI.Match(KDmAccAppAuthObexMatch) != KErrNotFound) || (aURI.Match(KDmAccAppAuthHttpMatch) != KErrNotFound)) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAuth ); + } + else if(( aURI.Match( KDmAccAppAuthFullMatch ) != KErrNotFound ) && (aURI.Find( KDmAccAppAuthNodes ) != KErrNotFound)) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccAppAuth ); + } + + else if( aURI.Match( KDmAccExtMatch ) != KErrNotFound ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAccLocked ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + CleanupStack::PopAndDestroy( 1 ); // currentURISegmentList + return; + } + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE( "CNSmlDMSettingsAdapter12::ChildURIListL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::AddNodeObjectL +// Adds new DM-settings profile to database +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): begin" ); + + if( aParentLUID.Length() > 0 ) + { + iParentLUID = GetIntObject( aParentLUID ); + if( FindProfileIdL( iParentLUID ) != EFalse )// iProfile != NULL) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): EAlreadyExists end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + return; + } + else + { + TInt ret = iCallBack->RemoveMappingL(KNSmlDMSettingsAdapterImplUid, + GetDynamicDMNodeUri( aURI ), ETrue ); + if(ret != KErrNone) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + } + } + iNewProfile = ETrue; + AddNodeBufferL (aURI, aStatusRef); + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeObjectL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::UpdateLeafObjectL( const TDesC8&, const TDesC8&, + RWriteStream*&, const TDesC8&, + const TInt ) + { + //Not supported because data streaming is not supported by this adapter. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL +// This function fetches leaf object and returns its size. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL() : begin" ); + DBG_ARGS( _S16("DM:Fetch aURI - %S - %S"), &aURI, &aLUID ); + + iLUID = IntLUID( aLUID ); + if ( iLUID >= 0 ) + { + if( FindProfileIdL( iLUID ) == EFalse ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + else + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + // Check which field going to be handled + SetField( aURI ); + SetURIInProcessL (aURI); + + // Check if valid field + if( !AcceptDMField() ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EInvalidObject end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + /*if(aURI.Find( KNSmlDdfExt ) != KErrNotFound) + { + return; + }*/ + + // Get Database field type + TInt fType = GetDMFieldType(); + if ( fType == EWrong ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): EError end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + CBufBase *lObject = CBufFlat::NewL( 128 ); + CleanupStack::PushL( lObject ); + lObject->Reset(); + + if ( fType == EStr || fType == EInt || fType == EBin ) + { + TInt rValue = GetObjectL( iLUID, GetDMField(), *lObject ); + if( lObject->Size() == 0 || rValue != KErrNone ) + { + if( rValue == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else if( rValue == KErrInUse ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); + } + else if( rValue == KErrNoMemory ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + } + else + { + CleanupStack::PopAndDestroy();//lObject + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectL(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + TInt objSizeInBytes = lObject->Size(); + TBuf8<16> stringObjSizeInBytes; + stringObjSizeInBytes.Num( objSizeInBytes ); + + lObject->Reset(); + lObject->InsertL( 0, stringObjSizeInBytes ); + iCallBack->SetResultsL( aResultsRef, *lObject, aType ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); + + CleanupStack::PopAndDestroy( 1 ); //lObject + _DBG_FILE( "CNSmlDMSettingsAdapter12::FetchLeafObjectSizeL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::ExecuteCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::ExecuteCommandL( const TDesC8&, const TDesC8&, + const TDesC8&, const TDesC8&, + const TInt ) + { + //Not supported. Command execution via DM settings adapter not possible. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::ExecuteCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::ExecuteCommandL( const TDesC8&, const TDesC8&, + RWriteStream*&, const TDesC8&, + const TInt ) + { + //Not supported. Command execution via DM settings adapter not possible. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::CopyCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::CopyCommandL( const TDesC8&, const TDesC8&, + const TDesC8&, const TDesC8&, + const TDesC8&, TInt ) + { + //Not supported. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::StartAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::StartAtomicL() + { + //Not supported. Handling Atomic command cycles not supported by the adapter. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::CommitAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::CommitAtomicL() + { + //Not supported. Handling Atomic command cycles not supported by the adapter. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::RollbackAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::RollbackAtomicL() + { + //Not supported. Handling Atomic command cycles not supported by the adapter. + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::StreamingSupport() +// Indicates if streaming is supported. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter12::StreamingSupport( TInt& /*aItemSize*/ ) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::StreamCommittedL() +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::StreamCommittedL() + { + //Not supported. Streaming not supported by the DM settings adapter. + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::CompleteOutstandingCmdsL() +// If buffering used, commands must be executed before returning this function. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::CompleteOutstandingCmdsL() + { + // Check if Buffered + for (int val=0; valCount ();val++) + { + if ( !iBuffer->At(val).iExecuted) + { + TInt count = iBuffer->At(val).iLeafBuf->Count ()-1; + iExecutionIndex = val; + iComplete = ETrue; + ExecuteBufferL (); + } + } + for (TInt i = 0;iSetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EError ); + } + else + { + iCallBack->SetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EOk ); + } + + } + iPortBuffer.Reset(); + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::AcceptDMField +// This function checks if field to be handled is valid. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter12::AcceptDMField() + { + _DBG_FILE("CNSmlDMSettingsAdapter12::AcceptDMField(): begin"); + + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + return ETrue; + } + + else if ( iField->Compare( KNSmlDdfId ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare(KNSmlDdfAppId) == 0 ) + { + return ETrue; + } + else if ( iField->Compare(KNSmlDdfPrefConRef) == 0 ) + { + return ETrue; + } + else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 ) + { + return ETrue; + } + + else if (iField->Compare(KNSmlDdfAAuthType) == 0 ) + { + return ETrue; + } + else if (iField->Compare(KNSmlDdfAAuthName) == 0 ) + { + return ETrue; + } + + else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 ) + { + return ETrue; + } + else if (iField->Compare(KNSmlDdfAAuthData) == 0 ) + { + return ETrue; + } + else if (iField->Compare(KNSmlDdfLocked) == 0 ) + { + return ETrue; + } + + _DBG_FILE( "CNSmlDMSettingsAdapter12::AcceptDMField(): end" ); + return EFalse; // Not a valid Type + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetDMField +// Matches URI fieldname to DM-database. +// ----------------------------------------------------------------------------- +TNSmlDMProfileData CNSmlDMSettingsAdapter12::GetDMField() + { + + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + + return EProfileAddrType; + + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) + { + return EProfileURL; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + return EProfilePort; + } + else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) + { + return EAuthenticationRequired; + } + else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) + { + return EServerId; + } + else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) + { + return ESharedSecret; + } + else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) + { + return EServerNonce; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + return EProfileDMServerUsername; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) + { + return EProfileDMServerPassword; + } + else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 ) + { + return EClientNonce; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + return EProfileName; + } + else if ( iField->Compare( KNSmlDdfId ) == 0 ) + { + return EProfileId; + } + + else if ( iField->Compare( KNSmlDdfPrefConRef ) == 0 ) + { + return EProfileIAPId; + } + + else if ( iField->Compare( KNSmlDdfAppId ) == 0 ) + { + return EProfileIAPId; + } + else if ( iField->Compare( KNSmlDdfLocked) == 0 ) + { + return EProfileLock; + } + + else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 ) + { + if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound) + return EPRofileServerCred; + else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound) + return EPRofileClientCred; + else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound) + return EProfileTransport; + } + + else if (iField->Compare(KNSmlDdfAAuthType) == 0 ) + { + return EProfileAAuthType; + } + else if (iField->Compare(KNSmlDdfAAuthName) == 0 ) + { + if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound) + return EProfileName; + else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound) + return EProfileDMServerUsername; + else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound) + { + return ETransportAuthName; + } + + // return ETrue; + } + + else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 ) + { + if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound) + return ESharedSecret; + else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound) + return EProfileDMServerPassword; + else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound) + { + return EProfileTransportPassword; + } + } + else if (iField->Compare(KNSmlDdfAAuthData) == 0 ) + { + if(iURIField->Find(KDmAccAppAuthDyn1) != KErrNotFound) + return EServerNonce; + else if (iURIField->Find(KDmAccAppAuthDyn2)!= KErrNotFound) + return EClientNonce; + else if (iURIField->Find(KDmAccAppAuthTransport)!= KErrNotFound) + return EProfileTransportAuthData; + } + + + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMField(): Error" ); + return ESyncAccepted; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetDMFieldType +// Gets field data type. +// ----------------------------------------------------------------------------- +TNSmlDMFieldType CNSmlDMSettingsAdapter12::GetDMFieldType() const + { + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + return EInt; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + return EInt; + } + else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) + { + return EInt; + } + else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) + { + return EBin; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) + { + return EStr; + } + else if (iField->Compare(KNSmlDdfClientNonce) == 0) + { + return EBin; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + return EStr; + } + + else if ( iField->Compare( KNSmlDdfId ) == 0 ) + { + return EInt; + } + else if( iField->Compare(KNSmlDdfAppId ) ==0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfPrefConRef ) == 0 ) + { + return EInt; + } + else if (iField->Compare(KNSmlDdfAAuthLevel) == 0 ) + { + return EStr; + } + + else if (iField->Compare(KNSmlDdfAAuthType) == 0 ) + { + return EStr; + } + else if (iField->Compare(KNSmlDdfAAuthName) == 0 ) + { + return EStr; + } + + else if (iField->Compare(KNSmlDdfAAuthSecret) == 0 ) + { + return EStr; + } + else if (iField->Compare(KNSmlDdfAAuthData) == 0 ) + { + return EBin; + } + + else if(iField->Compare(KNSmlDdfLocked)==0) + { + return EStr; + } + + + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMFieldType(): Error" ); + return EWrong; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::IntLUID +// Returns integer value for a profile LUID. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::IntLUID( const TDesC8& aLUID ) + { + TLex8 lLex( aLUID ); + + if( lLex.Val( iLUID ) == KErrNone ) + { + return iLUID; + } + else + { + return -1; + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetIntObject +// Returns integer value for a aObject. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::GetIntObject( const TDesC8& aObject ) + { + TLex8 lLex( aObject ); + + TInt value = 0; + + if( lLex.Val( value ) != KErrNone ) + { + return KErrNotFound; + } + else + { + return value; + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetIntObject16() +// Returns Integer Value for a 16 bit data object. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::GetIntObject16( const TDesC& aObject ) + { + TLex16 lLex( aObject ); + + TInt value = 0; + + if( lLex.Val( value ) == KErrNone ) + { + return value; + } + else + { + return value; + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetIntObjectLC +// Converts integer to HBufC8 type buffer and returns reference to it. +// ----------------------------------------------------------------------------- +TDesC8& CNSmlDMSettingsAdapter12::SetIntObjectLC( const TInt& aObject ) + { + HBufC8* buf = HBufC8::NewLC( 8 ); + TPtr8 ptrBuf = buf->Des(); + + ptrBuf.Num( aObject ); + return *buf; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::NotValidStrLenght +// Checks if data length is valid. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter12::NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, + const TDesC8& aSource ) + { + TInt lLen = aSource.Length(); + TBool lBool = EFalse; + + switch ( aProfileItem ) + { + case ( EProfileName ) : + { + if( lLen > KNSmlMaxProfileNameLength ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileDMServerUsername ) : + { + if( lLen > KNSmlMaxUsernameLength ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileHttpUsername ) : + case (ETransportAuthName): + { + if( lLen > KNSmlDmMaxHttpAuthUsernameLength ) + { + lBool = ETrue; + } + } + break; + case ( EProfileHttpPassword ) : + case (EProfileTransportPassword): + { + if( lLen > KNSmlDmMaxHttpAuthPasswordLength ) + { + lBool = ETrue; + } + } + break; + case ( EProfileDMServerPassword ) : + { + if( lLen > KNSmlMaxPasswordLength ) + { + lBool = ETrue; + } + } + break; + + case ( ESharedSecret ) : + { + if( lLen > KNSmlDmSharedSecretMaxLength ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileURL ) : + { + if( lLen > KNSmlMaxURLLength ) + { + lBool = ETrue; + } + } + break; + + case ( EServerId ) : + { + if( lLen > KNSmlDmServerIdMaxLength ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileIAPId ) : + { + if( lLen > KNSmlMaxURLLength ) + { + lBool = ETrue; + } + } + break; + + case ( EAuthenticationRequired ) : + case ( EProfileAAuthType ) : + { + if( lLen > 20 ) + { + lBool = ETrue; + } + } + break; + + case ( EProfileId ) : + case ( EProfilePort ) : + case ( EProfileMediumType ) : + case ( EProfileAddrType ) : + + { + if( lLen > 8 ) + { + lBool = ETrue; + } + } + break; + + case ( EServerNonce ) : + case ( EClientNonce ) : + case (EProfileTransportAuthData): + { + lBool = EFalse; + } + break; + case ( EProfileTransport ): + { + lBool = EFalse; + } + break; + case EProfileLock : + { + if(lLen > 6 ) + { + lBool = ETrue; + } + + } + break; + default: + { + lBool = ETrue; + } + } + + return lBool; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetField +// Last element of the URI (after last '/') is returned. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetField( const TDesC8& aSource ) + { + if ( aSource.LocateReverse( KNSmlDMUriSeparator ) == KErrNotFound ) + { + iField->Des().Format( aSource ); + } + else + { + iField->Des().Format( aSource.Mid( aSource.LocateReverse( KNSmlDMUriSeparator ) + 1 ) ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetField +// Last element of the URI (after last '/') is returned. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetURIInProcessL( const TDesC8& aSource ) + { + + if( iURIField ) + { + delete iURIField; + iURIField = NULL; + } + iURIField = HBufC8::NewL( aSource.Length() ); + TPtr8 newPortNbr = iURIField->Des(); + newPortNbr.Append( aSource ); + + return KErrNone; + } + + + + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::ConvertTo8LC +// Converts string value to 8-bit and returns reference. +// ----------------------------------------------------------------------------- +TDesC8& CNSmlDMSettingsAdapter12::ConvertTo8LC( const TDesC& aSource ) + { + HBufC8* buf = HBufC8::NewLC( aSource.Length() * 2 ); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); + + return *buf; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::ConvertTo16LC +// Converts string value to 16-bit and returns reference. +// ----------------------------------------------------------------------------- +TDesC16& CNSmlDMSettingsAdapter12::ConvertTo16LC( const TDesC8& aSource) + { + HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); + TPtr16 bufPtr16 = buf16->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aSource ); + + return *buf16; + } + +// ------------------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetConRefL +// Gets the URI for given aObject (IAP ID). +// ------------------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::GetConRefL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetConRefL() : begin" ); + TInt profIAPid = -1; + TInt apIdResponse = GetProfileIAPIdL( profIAPid ); + if( profIAPid < 0 ) + { + return KErrNone; + } + if( apIdResponse != KErrNone ) + { + return KErrNotFound; + } + CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); + CleanupStack::PushL( apmatch ); + HBufC8* uri8 = apmatch->URIFromIAPIdL( profIAPid ); + if( uri8 ) + { + CleanupStack::PushL( uri8 ); + aObject.InsertL( aObject.Size(), uri8->Des() ); + CleanupStack::PopAndDestroy(); // uri8 + } + else + { + CleanupStack::PopAndDestroy(); // apMatch + return KErrGeneral; + } + CleanupStack::PopAndDestroy(); // iapMatch + _DBG_FILE( "CNSmlDSSettingsAdapter::GetToNAPIDL() : end" ); + return KErrNone; + } + +// ------------------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetConRefL() +// Set the profile IAP Id value according to given URI. +// ------------------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetConRefL( const TInt aLUID, const TDesC8& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetConRefL() : begin" ); + CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); + CleanupStack::PushL( apmatch ); + TInt lIAPid = apmatch->IAPIdFromURIL( aObject ); + CleanupStack::PopAndDestroy(); // iapmatch + if(aObject.Length() >0 && lIAPid == KErrNotFound) + { + return KErrGeneral; + } + TInt apIdResponse = SetProfileConnectionPropertyL( aLUID, lIAPid ); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetConRefL() : end" ); + return apIdResponse; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter12::ParseUri +// Resolves portnbr (separated with ':') as integer from Uri. +// ------------------------------------------------------------------------------------------------ +TInt CNSmlDMSettingsAdapter12::ParseUri( const TDesC8& aRealURI, TInt& aPort ) + { + TInt offset=0; + //http: + if( aRealURI.Find( KNSmlDMSettingsHTTP )==0 )//http: + { + offset = KNSmlDMSettingsHTTP().Length(); + } + else if( aRealURI.Find( KNSmlDMSettingsHTTPS )==0 )//https: + { + offset = KNSmlDMSettingsHTTPS().Length(); + } + + TBool portFound=EFalse; + ////123.234.345.456:80/syncml + for( TInt i = offset; i < aRealURI.Length(); i++ ) + { + if( aRealURI[i] == KNSmlDMColon )// ':' + { + portFound = ETrue; + offset=i; + } + if( portFound && aRealURI[i] == KNSmlDMUriSeparator ) // '/' + { + aPort = GetIntObject( aRealURI.Mid( (offset + 1), (i - offset-1) ) ); + } + else if ( portFound && i == aRealURI.Length() - 1 ) // last char + { + // port is from offset to the end + aPort = GetIntObject( aRealURI.Right( aRealURI.Length() - offset - 1 ) ); + } + } + + if( aPort != 0 ) + { + return KErrNone; + } + else + { + return KErrNotFound; + } + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::OpenSyncSessionAndDSProfileL +// The function opens the server session and DM profile. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL( const TInt aIntLUID, + TSmlOpenMode aMode ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL(): begin" ); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + TInt trueLuid = aIntLUID + KMaxDataSyncID; + TInt rValue(KErrNone); + + if(trueLuid!=iCurrentProfile) + { + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + TInt index = profileIdArray.Find( trueLuid ); + CleanupStack::PopAndDestroy(); //profileIdArray + if( index == KErrNotFound ) + { + return KErrNotFound; + } + TRAP( rValue, iProfile.OpenL( iSyncSession, trueLuid, aMode ) ); + iCurrentProfile = trueLuid; + if( rValue != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + } + } + _DBG_FILE( "CNSmlDMSettingsAdapter12::OpenSyncSessionAndProfileL(): end" ); + return rValue; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::FindProfileId +// Function checks if profile can be found. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter12::FindProfileIdL( const TInt aIntLUID ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): begin" ); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + + RArray profileList; + CleanupClosePushL( profileList ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileList, usageType ); + if( profileList.Count() == 0 ) + { + CleanupStack::PopAndDestroy(); //profileList + return EFalse; + } + TInt item = profileList.Find( aIntLUID + KMaxDataSyncID ); + CleanupStack::PopAndDestroy(); //profileList + if( item != KErrNotFound ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): end" ); + return ETrue; + } + _DBG_FILE( "CNSmlDMSettingsAdapter12::FindProfileIdL(): end" ); + return EFalse; + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::IsServerIDExistL +// Function checks if serverid exist. +// ----------------------------------------------------------------------------- +TBool CNSmlDMSettingsAdapter12::IsServerIDExistL( const TDesC8& aServerid ) +{ + _DBG_FILE( "CNSmlDMSettingsAdapter12::IsServerIDExistL(): begin" ); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + TBool ret(EFalse); + RArray profileList; + CleanupClosePushL( profileList ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileList, usageType ); + TInt count = profileList.Count(); + if( count > 0 ) + { + for(TInt i =0; i< count; i++) + { + TInt pid = i + KMaxDataSyncID; + TInt index = profileList.Find(pid ); + if( index >= i ) + { + TInt rValue(KErrNone); + RSyncMLDevManProfile profile; + TRAP( rValue, profile.OpenL( iSyncSession, pid, ESmlOpenRead ) ); + if( rValue == KErrNone ) + { + CleanupClosePushL(profile); + if(((aServerid.Compare(profile.ServerId())) == 0) && + ((profile.ServerId()).Length() == aServerid.Length())) + { + ret = ETrue; + CleanupStack::PopAndDestroy(&profile);//profile + break; + } + CleanupStack::PopAndDestroy(&profile);//profile + } + } + } + } + CleanupStack::PopAndDestroy(); //profileList + _DBG_FILE( "CNSmlDMSettingsAdapter12::IsServerIDExistL(): end" ); + return ret; + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::CreateNewProfileL +// The function creates new DM profile via client API. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::CreateNewProfileL( TInt& aPID ) + { + _DBG_FILE("CNSmlDMSettingsAdapter12::CreateNewProfileL(): begin"); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + TRAPD( value1, iProfile.CreateL( iSyncSession ) ); + if( value1 != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + return value1; + } + + TRAPD( value2, iProfile.UpdateL() ); + if( value2 != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + return value2; + } + + aPID = iProfile.Identifier(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::CreateNewProfileL(): end" ); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileServerURIL() +// The function sets the server URL for a profile. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileServerURIL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerURIL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + if( transportIdArray.Count() == 0 ) + { + CleanupStack::PopAndDestroy();//transportIdArray + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + + TInt newPort(0); + + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, transportIdArray[0] ); + + if(ParseUri(aObj,newPort)==KErrNotFound) + { + TInt port = 0; + ParseUri(conn.ServerURI(),port); + if(port==0) + { + port = 80; + } + + TBuf8<5> buf; + buf.Num( port ); + + TInt totalSize = aObj.Length() + buf.Length() + 1; + HBufC8* newServerURI = HBufC8::NewLC( totalSize ); + SetPortNrToAddrStr( aObj, newServerURI, buf ); + conn.SetServerURIL( *newServerURI ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( newServerURI ); + } + else + { + conn.SetServerURIL( aObj ); + conn.UpdateL(); + } + + + iProfile.UpdateL(); + + CleanupStack::PopAndDestroy( 2 ); //transportIdArray, conn + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerURIL(): end" ); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileDisplayNameL() +// The function sets the display name for a profile. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileDisplayNameL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + iProfile.SetDisplayNameL( ConvertTo16LC( aObj ) ); + iProfile.UpdateL(); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): end" ); + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::IsProfileLockedL() +// The function to tell whether the profile is locked +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::IsProfileLockedL(const TInt aPID) +{ + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileDisplayNameL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + + retVal=iProfile.ProfileLocked(EFalse, EFalse); + iCurrentProfile = 0; + iProfile.Close(); + if(retVal) + { + /* CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) ); + TInt IsPrfoileEditable = 0; + if(!err) + centrep->Get( KDevOverrideProfileLock, IsPrfoileEditable ); + delete centrep; + if (!IsPrfoileEditable) + retVal= KErrAccessDenied; + else + retVal= KErrNone;*/ + retVal= KErrAccessDenied; + } + + + + return retVal; + +} + + + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileLockL() +// The function to setor reset the profile lock. +// ----------------------------------------------------------------------------- + +TInt CNSmlDMSettingsAdapter12::SetProfileLockL( const TInt aPID, TInt aLockValue) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileLockL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + + iProfile.ProfileLocked(ETrue, aLockValue ); + iProfile.UpdateL(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileLockL(): end" ); + return KErrNone; + } + + + + + + + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileHttpUserNameL +// The function sets the profile http/network name. +// ----------------------------------------------------------------------------- + +TInt CNSmlDMSettingsAdapter12::SetProfileHttpUserNameL( const TInt aPID, const TDesC8& aObj ) +{ + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + + RSyncMLConnection connection; + TBuf8 key; + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + + connection.OpenL( iProfile, KUidNSmlMediumTypeInternet.iUid ); + CleanupClosePushL( connection ); + + connection.SetPropertyL( KNSmlHTTPAuth, KNSmlTrueVal ); + connection.SetPropertyL( KNSmlHTTPUsername, aObj ); + connection.UpdateL(); + CleanupStack::PopAndDestroy( ); + } + else + { + connection.SetPropertyL( KNSmlHTTPAuth, KNSmlFalseVal ); + connection.UpdateL(); + } + + + CleanupStack::PopAndDestroy( ); + + return retVal; + +} + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileUserNameL +// The function sets the profile user name. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileUserNameL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileUserNameL(): begin" ); + TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + iProfile.SetUserNameL( aObj ); + iProfile.UpdateL(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileUserNameL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL +// The function sets the protocol version to be supported. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL( const TInt aPID, + const TDesC8& ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + //The syncSession to Sync server is open. + TSmlProtocolVersion protocol = ESmlVersion1_2; + iProfile.SetProtocolVersionL( protocol ); + TRAPD( iError, iProfile.UpdateL() ); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileProtocolVersionL(): begin" ); + return iError; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileServerIdL +// The function sets the profile ServerId value. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileServerIdL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE("CNSmlDMSettingsAdapter12::SetProfileServerIdL(): begin"); + TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + iProfile.SetServerIdL( aObj ); + TRAP(retVal,iProfile.UpdateL() ); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerIdL(): end" ); + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileServerPasswordL +// The function sets the profile server password. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileServerPasswordL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerPasswordL(): begin" ); + TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + iProfile.SetServerPasswordL( aObj ); + iProfile.UpdateL(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileServerPasswordL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileHttpPasswordL +// The function sets the profile network/http password. +// ----------------------------------------------------------------------------- + + + TInt CNSmlDMSettingsAdapter12::SetProfileHttpPasswordL( const TInt aPID, const TDesC8& aObj ) + { + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + + RSyncMLConnection connection; + TBuf8 key; + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + + connection.OpenL( iProfile, KUidNSmlMediumTypeInternet.iUid ); + CleanupClosePushL( connection ); + + connection.SetPropertyL( KNSmlHTTPAuth, KNSmlTrueVal ); + connection.SetPropertyL( KNSmlHTTPPassword, aObj ); + connection.UpdateL(); + CleanupStack::PopAndDestroy( ); + } + else + { + // connection.SetPropertyL( KNSmlHTTPAuth, KNSmlFalseVal ); + connection.UpdateL(); + } + + + CleanupStack::PopAndDestroy( ); + + return retVal; + + + + } + + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfilePasswordL +// The function sets the profile password. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfilePasswordL( const TInt aPID, + const TDesC8& aObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfilePasswordL(): begin" ); + TInt retVal = KErrNone; + retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + iProfile.SetPasswordL( aObj ); + iProfile.UpdateL(); + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfilePasswordL(): begin" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileConnectionPropertyL +// This function sets the profile IAP id. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileConnectionPropertyL( const TInt aLUID, + const TInt aIAPid ) + { + TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + RSyncMLTransport transport; + CleanupClosePushL( transport ); + transport.OpenL( iSyncSession, connIdArray[0] ); + const CSyncMLTransportPropertiesArray& props = transport.Properties(); + TInt index = props.Find( KNSmlIAPId ); + if( index > 0 ) + { + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, connIdArray[0] ); + HBufC8* apIdBuffer = HBufC8::NewLC( 4 ); + TPtr8 ptrIapIdBuf = apIdBuffer->Des(); + ptrIapIdBuf.Num( aIAPid ); + conn.SetPropertyL( KNSmlIAPId, ptrIapIdBuf ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( 2 ); //conn, apIdBuffer + retVal = KErrNone; + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy( 1 ); //transport + } + else + { + retVal = KErrNotFound; + } + iCurrentProfile = 0; + iProfile.Close(); + CleanupStack::PopAndDestroy(); //connIdArray + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::DeleteProfileL +// The function deleted the profile from DM database. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::DeleteProfileL( const TInt aPID ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteProfileL(): begin" ); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + TInt index = profileIdArray.Find( aPID ); + if ( index == KErrNotFound ) + { + //No match + CleanupStack::PopAndDestroy();//profileIdArray + return KErrNotFound; + } + iSyncSession.DeleteProfileL( aPID ); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + CleanupStack::PopAndDestroy();//profileIdArray + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteProfileL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetObjectL +// The function checks which leaf data to be fetched. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, + CBufBase& aObject ) + { + TInt retVal = KErrNone; + if( iField->Compare(KNSmlDdfAppId ) ==0 ) + { + aObject.InsertL(aObject.Size(),KNSmlDdfAppIdValue); + return retVal; + + } + + retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + switch ( aDMField ) + { + case ( EProfileName ) : + { + GetProfileNameL( aObject ); + } + break; + + case ( EProfileDMServerUsername ) : + { + GetProfileUserNameL( aObject ); + } + break; + + case ( EProfileURL ) : + { + GetProfileServerURLL( aObject ); + TInt port(0); + if(ParseUri(aObject.Ptr(0),port)==KErrNone) + { + HBufC8* addr = aObject.Ptr(0).AllocLC(); + aObject.Reset(); + TInt portStart = addr->LocateReverse(KNSmlDMColon); + aObject.InsertL(aObject.Size(),addr->Left(portStart)); + + TInt portLen=addr->Mid(portStart).Locate(KNSmlDMUriSeparator); + if(portLen!=KErrNotFound) + { + aObject.InsertL(aObject.Size(),addr->Mid(portStart+portLen)); + } + + CleanupStack::PopAndDestroy(); //addr + } + } + break; + + case ( EServerId ) : + { + GetServerIdL( aObject ); + } + break; + + case ( EProfileIAPId ) : + { + retVal = GetConRefL( aObject ); + } + break; + + case ( EProfilePort ) : + { + GetProfileServerURLL( aObject ); + if ( aObject.Size() == 0 ) + { + retVal = KErrNone; + break; + } + GetProfilePortNumberL ( aObject ); + } + break; + + case ( EProfileDMServerPassword ) : + { + retVal = EInvalidObject; + } + break; + + case ( ESharedSecret ) : + {//ServerPW + retVal = EInvalidObject; + } + break; + case ( EProfileId ) : + break; + case ( EProfileAddrType ) : + { + aObject.InsertL(aObject.Size(),KNSmlAddrtype); + } + break; + case (EProfileHttpUsername ): + { + retVal = GetHttpUsernameL(aObject); + } + break; + case (EPRofileServerCred) : + { + aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelSrv); + + } + break; + case (EPRofileClientCred) : + { + aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelCli); + } + break; + + case (ETransportAuthName) : + { + TInt mediumType= ENone; + GetProfileConnectiontypeL( mediumType ); + if( mediumType == EHttp) + { + retVal = GetHttpUsernameL(aObject); + } + else if(mediumType == EObex) + { + aObject.InsertL(aObject.Size(),KNSmlDMNullDesc8); + } + + } + break; + + + case (EProfileTransport) : + { + TInt mediumType= ENone; + GetProfileConnectiontypeL( mediumType ); + if( mediumType == EHttp) + { + aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelHttp); + } + else if(mediumType == EObex) + { + aObject.InsertL(aObject.Size(),KDmAccAppAuthLevelObx); + } + + } + + break; + case ( EAuthenticationRequired ) : + case ( EProfileAAuthType ): + case ( EServerNonce ) : + case ( EClientNonce ) : + { + retVal = GetDMAuthInfoL( aLUID, aDMField, aObject ); + } + break; + + case EProfileLock : + { + + TBool isProfileLocked = iProfile.ProfileLocked(EFalse, EFalse); + if(isProfileLocked) + { + aObject.InsertL(aObject.Size(),KDmProfileLocked); + } + else + { + aObject.InsertL(aObject.Size(),KDmProfileUnLocked); + } + + } + break; + default: + { + User::Panic( KNSmlIndexOutOfBoundStr, KNSmlPanicIndexOutOfBound ); + } + } + iCurrentProfile = 0; + iProfile.Close(); + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL() +// The function sets the profile port number. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL( const TInt aLUID, + const TDesC8& aPort ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): begin" ); + TInt retVal = KErrNone; + + if( iPortNbr ) + { + delete iPortNbr; + iPortNbr = NULL; + } + iPortNbr = HBufC8::NewL( aPort.Length() ); + TPtr8 newPortNbr = iPortNbr->Des(); + newPortNbr.Append( aPort ); + + retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" ); + return retVal; + } + + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, transportIdArray[0] ); + + HBufC8* serverURI = conn.ServerURI().AllocLC(); + if( serverURI->Length() == 0 ) + { + iCurrentProfile = 0; + iProfile.Close(); + CleanupStack::PopAndDestroy( 3 ); //transportIdArray, conn, serverURI + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" ); + return retVal; + } + TInt totalSize = serverURI->Size() + newPortNbr.Size() + 1; + HBufC8* newServerURI = HBufC8::NewL( totalSize ); + CleanupStack::PushL( newServerURI ); + SetPortNrToAddrStr( *serverURI, newServerURI, newPortNbr ); + + conn.SetServerURIL( *newServerURI ); + conn.UpdateL(); + + CleanupStack::PopAndDestroy( 4 ); //transportIdArray, conn, serverURI, newServerURI + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileConnectionPortNrL(): end" ); + return retVal; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter12::SetPortNrToAddrStr +// Sets a portnbr (separated with ':') to profile server URI. +// ------------------------------------------------------------------------------------------------ +void CNSmlDMSettingsAdapter12::SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, + const TDesC8& aPort ) + { + TInt offset=0; + if( aSrvURI.Find( KNSmlDMSettingsHTTP ) == 0 )//http:// + { + offset = KNSmlDMSettingsHTTP().Length(); + } + else if( aSrvURI.Find( KNSmlDMSettingsHTTPS ) == 0 )//https:// + { + offset = KNSmlDMSettingsHTTPS().Length(); + } + TInt portStart = -1; + TInt separatorPos = aSrvURI.Length(); + TInt i = 0; + for( i = offset; i < aSrvURI.Length(); i++ ) + { + if( aSrvURI[i] == KNSmlDMColon )// ':' + { + portStart = i; + } + if( aSrvURI[i] == KNSmlDMUriSeparator )// '/' + { + separatorPos = i; + break; + } + } + + TPtr8 ptrNewSrvURI = aNewURI->Des(); + if( portStart < 0 && separatorPos > 0 && iLeafType != EDMDelete ) + { + ptrNewSrvURI.Append( aSrvURI.Left( separatorPos ) );//http://123.234.345.456 + ptrNewSrvURI.Append( KNSmlDMColon ); + ptrNewSrvURI.Append( aPort ); + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); + } + else if ( portStart > 0 && separatorPos > 0 && iLeafType != EDMDelete ) + { + ptrNewSrvURI.Append( aSrvURI.Left( portStart + 1 ) );//123.234.345.456: + ptrNewSrvURI.Append( aPort );//123.234.345.456:xx(x) + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); + } + else if ( portStart > 0 && iLeafType == EDMDelete ) //delete port number from uri + { + ptrNewSrvURI.Append( aSrvURI.Left( portStart ) );//123.234.345.456 + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); + } + else + { + ptrNewSrvURI.Append( aSrvURI ); + } + return; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter12::SetDMFieldDataL +// Selects and Sets value to a field based on field id got from URI. +// ------------------------------------------------------------------------------------------------ +TInt CNSmlDMSettingsAdapter12::SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, + const TNSmlDMProfileData aField ) + { + TInt rValue = KErrGeneral; + TInt lockvalue =0; + if(aField != EProfileLock) + { + rValue=IsProfileLockedL(aLUID); + if (rValue!= KErrNone) + { + return rValue; + } + + } + else if (aField == EProfileLock) + { + if (! iNewProfile) + { + lockvalue =0; + if(aObject.Length()> 1) + { + rValue = KErrArgument; + return rValue; + } + lockvalue = GetIntObject(aObject); + if(lockvalue != 0 && lockvalue != 1) + { + //lockvalue = 0; + rValue = KErrArgument; + return rValue; + } + rValue = SetProfileLockL(aLUID , lockvalue); + return rValue; + } + + } + + switch ( aField ) + { + case ( EProfileURL ) : + { + rValue = SetProfileServerURIL( aLUID, aObject ); + } + break; + case ( EServerId ) : + { + rValue = SetProfileServerIdL( aLUID, aObject ); + } + break; + case ( ESharedSecret ) : + { + rValue = SetProfileServerPasswordL( aLUID, aObject ); + } + break; + case ( EProfileDMServerUsername ) : + { + rValue = SetProfileUserNameL( aLUID, aObject ); + } + break; + case ( EProfileDMServerPassword ) : + { + rValue = SetProfilePasswordL( aLUID, aObject ); + } + break; + case ( EProfileName ) : + { + rValue = SetProfileDisplayNameL( aLUID, aObject ); + } + break; + case ( EProfileIAPId ) : + { + rValue = SetConRefL( aLUID, aObject ); + } + break; + case ( ETransportAuthName ): + { + OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); + TInt mediumType = ENone; + GetProfileConnectiontypeL( mediumType ); + if( mediumType == EHttp) + { + rValue = SetProfileHttpUserNameL ( aLUID, aObject ); + } + else if(mediumType == EObex) + { + rValue = KErrNone; + + } + + + //break; + } + break; + case ( EProfileTransportPassword ): + { + TInt mediumType = ENone; + OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); + GetProfileConnectiontypeL( mediumType ); + if( mediumType == EHttp) + { + rValue = SetProfileHttpPasswordL ( aLUID, aObject ); + } + else if(mediumType == EObex) + { + rValue = KErrNone; + + } + } + break; + case (EProfileTransportAuthData) : + { + rValue = KErrNone; + } + break; + + case ( EProfileHttpUsername ) : + { + rValue = SetProfileHttpUserNameL ( aLUID, aObject ); + } + break; + case ( EProfileHttpPassword ) : + { + rValue = SetProfileHttpPasswordL ( aLUID, aObject ); + } + break; + case ( EProfileId ) : + { + } + break; + case ( EProfilePort ) : + { + if(aObject.Size()<=5) + { + TInt port = GetIntObject(aObject); + if( port > KPortMinSize && port < KPortMaxSize ) + { + TPortBuffer element; + element.iPortBuf=aObject; + element.iPortBufLUID = aLUID; + iPortBuffer.Append(element); + rValue=KErrNone; + } + else + { + if (port <= KPortMinSize ) + rValue = KErrUnderflow; + else + rValue=KErrOverflow; + } + } + else + { + rValue=KErrOverflow; + } + // save information of the port + } + break; + + case ( EProfileAddrType ) : + { + if (aObject.Match(KNSmlAddrtype)!=KErrNotFound) + rValue=KErrNone; + + } + break; + + + case ( EProfileMediumType ) : + { + if ( iLeafType == EDMDelete ) + { + return KErrNone; + } + iObject = GetIntObject( aObject ); + if(iObject<0) + { + iObject = EHttp; + } + rValue = SetProfileAddrTypeL( aLUID, iObject ); + } + break; + case ( EProfileTransport) : + { + if (aObject.Match(KDmAccAppAuthLevelHttp)!=KErrNotFound) + { + iObject = EHttp; + } + else if (aObject.Match(KDmAccAppAuthLevelObx)!=KErrNotFound) + { + iObject = EObex; + } + rValue = SetProfileAddrTypeL( aLUID, iObject ); + } + break; + case ( EAuthenticationRequired ) : + case ( EClientNonce ) : + case ( EServerNonce ) : + break; + case ( EProfileLock ) : + lockvalue =0; + lockvalue = GetIntObject(aObject); + if(lockvalue != 0 && lockvalue != 1) + lockvalue = 0; + + TLockBuffer element; + element.iProfileLock=lockvalue; + element.iProfileLockLUID = aLUID; + iProfileLockBuffer.Append(element); + rValue=KErrNone; + + + // rValue = SetProfileLock(aLUID , lockvalue); + break; + default: + rValue = KErrNotSupported; + } + return rValue; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::FillNodeInfoL +// The function fills the node or leaf information. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription, + const TDesC8& aDefaultValue, + const TDesC8& aMimeType ) + { + aNode.AddDFTypeMimeTypeL( aMimeType ); + aNode.SetAccessTypesL( aAccTypes ); + aNode.SetDescriptionL( aDescription ); + aNode.SetOccurenceL( aOccurrence ); + aNode.SetDefaultValueL( aDefaultValue ); + aNode.SetScopeL( aScope ); + aNode.SetDFFormatL( aFormat ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetDMAuthInfoL +// This function gets authentication data from private API. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::GetDMAuthInfoL( const TInt aLUID, + const TNSmlDMProfileData aField, + CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMAuthInfoL(): begin" ); + + CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo; + CleanupStack::PushL( authInfo ); + + authInfo->iProfileId = aLUID + KMaxDataSyncID; + iPrivateApi.OpenL(); + TInt ret = KErrNone; + + TRAPD(err,iPrivateApi.GetDMAuthInfoL( *authInfo )); + + if(err==KErrNone) + { + if ( aField == EServerNonce ) + { + aObject.InsertL( aObject.Size(), *authInfo->iServerNonce ); + } + else if ( aField == EClientNonce ) + { + aObject.InsertL( aObject.Size(), *authInfo->iClientNonce ); + } + else if (( aField == EAuthenticationRequired ) || (aField == EProfileAAuthType)) + { + TUint authPref = authInfo->iAuthPref; + /*if( authPref == ENoAuth ) + { + aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefNoAuth ); + }*/ + if( authPref == EBasic ) + { + if(aField == EAuthenticationRequired) + { + aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefBasic ); + } + else + { + aObject.InsertL( aObject.Size(), KNSmlDMAuthTypeBasic ); + } + + } + else if( authPref == EMD5 ) + { + if(aField == EAuthenticationRequired) + { + aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefMD5 ); + } + else + { + aObject.InsertL( aObject.Size(), KNSmlDMAuthTypeMD5 ); + } + + } + else + { + aObject.InsertL( aObject.Size(), KNullDesC8 ); + } + } + } + iPrivateApi.Close(); + CleanupStack::PopAndDestroy(authInfo); + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetDMAuthInfoL(): end" ); + return ret; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL +// This function resets the authentication data. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL( const TInt aLUID, + const TNSmlDMProfileData aField ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL(): begin" ); + CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo;; + CleanupStack::PushL( authInfo ); + authInfo->iProfileId = aLUID; + iPrivateApi.OpenL(); + iPrivateApi.GetDMAuthInfoL( *authInfo ); + if( aField == EServerNonce ) + { + authInfo->iServerNonce->Des().Delete( 0, authInfo->iServerNonce->Des().Size() ); + authInfo->iServerNonce->Des().Insert( 0, KNullDesC8 ); + } + else if( aField == EClientNonce ) + { + authInfo->iClientNonce->Des().Delete( 0, authInfo->iClientNonce->Des().Size() ); + authInfo->iClientNonce->Des().Insert( 0, KNullDesC8 ); + } + else if( aField == EAuthenticationRequired ) + { + authInfo->iAuthPref = 0; + } + iPrivateApi.SetDMAuthInfoL( *authInfo ); + iPrivateApi.Close(); + CleanupStack::PopAndDestroy(authInfo); + _DBG_FILE( "CNSmlDMSettingsAdapter12::DeleteDMAuthInfoL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetProfileAddrTypeL +// This function sets the AddrType value. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::SetProfileAddrTypeL( const TInt aLUID, + const TInt aIntObj ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): begin" ); + TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): end" ); + return retVal; + } + TInt mediumType = ENone; + GetMediumTypeL( aIntObj, mediumType ); + if( mediumType == ENone ) + { + iCurrentProfile = 0; + iProfile.Close(); + return KErrGeneral; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, transportIdArray[0] ); + HBufC8* sURI = conn.ServerURI().AllocLC(); + if(mediumType!=transportIdArray[0]) + { + if ( !FeatureManager::FeatureSupported( KFeatureIdSyncMlDmObex ) ) + { + CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI + return EInvalidObject; + } + else + { + conn.CreateL(iProfile,mediumType); + } + } + conn.SetServerURIL( *sURI ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI + iCurrentProfile = 0; + iProfile.Close(); + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetProfileAddrTypeL(): end" ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetHttpUsernameL +// This function gets the httpuser value. +// ----------------------------------------------------------------------------- + + +TInt CNSmlDMSettingsAdapter12::GetHttpUsernameL( CBufBase& aObject ) + { + + TInt retVal = KErrNone; + TBuf8 key; + TInt intValue; + + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + RSyncMLTransport transport; + CleanupClosePushL( transport ); + transport.OpenL( iSyncSession, connIdArray[0] ); + const CSyncMLTransportPropertiesArray& arr = transport.Properties(); + const TSyncMLTransportPropertyInfo& info = arr.At( EPropertyHttpUsed ); + key = info.iName; + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, connIdArray[0] ); + HBufC8* value = conn.GetPropertyL( key ).AllocLC(); + intValue = GetIntObject( *value ); + CleanupStack::PopAndDestroy( ); //value + if ( intValue == 1 ) + { + retVal = KErrNone; + const TSyncMLTransportPropertyInfo& info2 = arr.At( EPropertyHttpUserName ); + key= info2.iName; + HBufC8* value = conn.GetPropertyL( key ).AllocLC(); + aObject.InsertL(aObject.Size(),value->Des()); + CleanupStack::PopAndDestroy( ); //value + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy( 2 ); // conn, transport + } + CleanupStack::PopAndDestroy( ); //connIdArray + + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL +// The function gets the profile medium type. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL( TInt& aMediumTYpe ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileConnectiontypeL(): begin" ); + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + TInt transportItems = transportIdArray.Count(); + if( transportItems == 0 ) + { + //No matching items + CleanupStack::PopAndDestroy(); //transportIdArray + return KErrGeneral; + } + else if( transportItems > 1 ) + { + //Error case : against specification + CleanupStack::PopAndDestroy(); //transportIdArray + return KErrGeneral; + } + aMediumTYpe = 0; + if ( transportIdArray[0] == KUidNSmlMediumTypeInternet.iUid ) + { + aMediumTYpe = 1; //EHttp; + } + else if ( transportIdArray[0] == KUidNSmlMediumTypeBluetooth.iUid || + transportIdArray[0] == KUidNSmlMediumTypeUSB.iUid || + transportIdArray[0] == KUidNSmlMediumTypeIrDA.iUid ) + { + aMediumTYpe = 3; //EObex; + } + CleanupStack::PopAndDestroy( 1 ); //transportIdArray, SetIntObjectLC + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetProfileIAPIdL +// The function gets the profile IAP Id. +// ----------------------------------------------------------------------------- +TInt CNSmlDMSettingsAdapter12::GetProfileIAPIdL( TInt& aIAPid ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileIAPIdL(): begin" ); + TInt retVal = KErrGeneral; + aIAPid = -1; + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + RSyncMLTransport transport; + CleanupClosePushL( transport ); + transport.OpenL( iSyncSession, connIdArray[0] ); + const CSyncMLTransportPropertiesArray& props = transport.Properties(); + TInt index = props.Find( KNSmlIAPId ); + if( index > 0 ) + { + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iProfile, connIdArray[0] ); + HBufC8* apId = conn.GetPropertyL( KNSmlIAPId ).AllocLC(); + aIAPid = GetIntObject( *apId ); + CleanupStack::PopAndDestroy( 2 ); //conn, apId + retVal = KErrNone; + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy( 1 ); //transport + iCurrentProfile = 0; + iProfile.Close(); + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy(); //connIdArray + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileIAPIdL(): end" ); + return retVal; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetProfileServerURLL +// The function gets the profile Server URI. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::GetProfileServerURLL( CBufBase& aURL ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileServerURLL(): begin" ); + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iProfile.ListConnectionsL( transportIdArray ); + if( transportIdArray.Count() > 0 ) + { + RSyncMLConnection profConn; + CleanupClosePushL( profConn ); + profConn.OpenL( iProfile, transportIdArray[0] ); + HBufC8* sURI = profConn.ServerURI().AllocL(); + CleanupStack::PushL( sURI ); + TPtr8 uriPtr = sURI->Des(); + if( uriPtr.Length() > 0 ) + { + aURL.InsertL( aURL.Size(),uriPtr ); + } + else + { + aURL.InsertL( aURL.Size(), KNullDesC8 ); + } + CleanupStack::PopAndDestroy( 2 );//profConn, sURI + } + CleanupStack::PopAndDestroy(); //transportIdArray + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileServerURLL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetMediumTypeL +// Checks the requested medium type. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::GetMediumTypeL( const TInt aIntObj, + TInt& aMediumType ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetMediumTypeL(): begin" ); + if( aIntObj == EHttp || aIntObj == EWsp ) + { + aMediumType = KUidNSmlMediumTypeInternet.iUid; + return; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iSyncSession.ListTransportsL( transportIdArray ); + + if ( transportIdArray.Find( KUidNSmlMediumTypeBluetooth.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeBluetooth.iUid; + } + else if ( transportIdArray.Find( KUidNSmlMediumTypeUSB.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeUSB.iUid; + } + else if ( transportIdArray.Find( KUidNSmlMediumTypeIrDA.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeIrDA.iUid; + } + CleanupStack::PopAndDestroy(); //transportIdArray + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetMediumTypeL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetServerIdL +// Gets the server id value. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::GetServerIdL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetServerIdL(): begin" ); + HBufC8* serverId = iProfile.ServerId().AllocL(); + CleanupStack::PushL( serverId ); + aObject.InsertL( aObject.Size(), *serverId ); + CleanupStack::PopAndDestroy( 1 ); //serverId + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetServerIdL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetProfileNameL +// Gets the display name value. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::GetProfileNameL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileNameL(): begin" ); + HBufC16* dataBuf = iProfile.DisplayName().AllocL(); + CleanupStack::PushL( dataBuf ); + TPtr16 ptrDisplayName = dataBuf->Des(); + HBufC8* dataBuf8 = HBufC8::NewL( ptrDisplayName.Length() * 2 ); + CleanupStack::PushL( dataBuf8 ); + + TPtr8 ptrDisplayName8 = dataBuf8->Des(); + ptrDisplayName8 = ConvertTo8LC( ptrDisplayName ); + aObject.InsertL( aObject.Size(), ptrDisplayName8 ); + CleanupStack::PopAndDestroy( 3 );//dataBuf, ConvertTo8LC + _DBG_FILE("CNSmlDMSettingsAdapter12::GetProfileNameL(): end"); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetProfileUserNameL +// Gets the profile user name value. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::GetProfileUserNameL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileUserNameL(): begin" ); + HBufC8* dataBuf = iProfile.UserName().AllocL(); + CleanupStack::PushL( dataBuf ); + TPtr8 ptrUserName = dataBuf->Des(); + aObject.InsertL( aObject.Size(), ptrUserName ); + CleanupStack::PopAndDestroy();//dataBuf + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfileUserNameL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::GetProfilePortNumberL +// Gets the port number value. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::GetProfilePortNumberL( CBufBase& aObject ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfilePortNumberL(): begin" ); + TInt bSize = aObject.Size(); + TInt portNum = 0; + HBufC8* bufStorage = HBufC8::NewLC( bSize ); + TPtr8 bufStoragePtr = bufStorage->Des(); + aObject.Read( 0, bufStoragePtr, aObject.Size() ); + aObject.Reset(); + + //find out the port number + ParseUri( *bufStorage, portNum ); + aObject.InsertL( aObject.Size(), SetIntObjectLC( portNum ) ); + + CleanupStack::PopAndDestroy( 2 ); //bufStorage, SetIntObjectLC() + _DBG_FILE( "CNSmlDMSettingsAdapter12::GetProfilePortNumberL(): end" ); + return; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMSettingsAdapter12::SetAuthInfoL +// The function checks if authinfo already exits. If exits command is replace. +// ----------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::SetAuthInfoL( const TInt aLUID, + const TNSmlDMProfileData aField, + const TDesC8& aObject, TInt& aStatus ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetAuthInfoL(): begin" ); + + CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo(); + CleanupStack::PushL( authInfo ); + authInfo->iProfileId = aLUID; + + iPrivateApi.OpenL(); + TRAPD( err, iPrivateApi.GetDMAuthInfoL( *authInfo ) ); + + if ( err ) + { + CleanupStack::PopAndDestroy( authInfo ); + iPrivateApi.Close(); + aStatus = err; + return; + } + + CNSmlDMAuthInfo* newAuthInfo = new (ELeave) CNSmlDMAuthInfo(); + CleanupStack::PushL( newAuthInfo ); + newAuthInfo->iProfileId = aLUID; + + if ( aField == EServerNonce ) + { + newAuthInfo->iServerNonce = aObject.Alloc(); + newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc(); + newAuthInfo->iAuthPref = authInfo->iAuthPref; + + iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); + } + else if ( aField == EClientNonce ) + { + newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc(); + newAuthInfo->iClientNonce = aObject.Alloc(); + newAuthInfo->iAuthPref = authInfo->iAuthPref; + + iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); + } + else if ( aField == EAuthenticationRequired ) + { + if ( aObject.Match( KNSmlDMAuthPrefNoAuth ) != KErrNotFound ) + { + newAuthInfo->iAuthPref = ENoAuth; + } + else if ( aObject.Match( KNSmlDMAuthPrefBasic ) != KErrNotFound ) + { + newAuthInfo->iAuthPref = EBasic; + } + else if ( aObject.Match( KNSmlDMAuthPrefMD5 ) != KErrNotFound ) + { + newAuthInfo->iAuthPref = EMD5; + } + newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc(); + newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc(); + + iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); + } + + CleanupStack::PopAndDestroy( newAuthInfo ); + CleanupStack::PopAndDestroy( authInfo ); + + iPrivateApi.Close(); + aStatus = KErrNone; + _DBG_FILE( "CNSmlDMSettingsAdapter12::SetAuthInfoL(): end" ); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter12::AddNodeBufferL() +// Buffers Node Object +//------------------------------------------------------------------------------ +void CNSmlDMSettingsAdapter12::AddNodeBufferL( const TDesC8& aURI, + const TInt aStatusRef) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): begin" ); + TInt index = -1; + + for (TInt i = 0; iCount (); i++) + { + if ( iBuffer->At(i).iMappingName->Compare (aURI)== 0) + { + index = i; + //CallBack for duplicate + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): EAlreadyExists end" ); + iCallBack->SetStatusL ( aStatusRef, CSmlDmAdapter::EAlreadyExists); + break; + } + } + + if ( index<0) + { + TNSmlDMBufferElement newNode; + newNode.iMappingName = aURI.AllocLC (); + newNode.iLeafBuf = new (ELeave) CArrayFixFlat (4); + newNode.iExecuted = EFalse; + newNode.iDMBuffStatusref = aStatusRef; + newNode.iAddr = EFalse; + newNode.iServerId = EFalse; + newNode.iUName = EFalse; + newNode.iServerName = EFalse; + + iBuffer->AppendL (newNode); + //newNode.iMappingName + CleanupStack::Pop (); + } + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddNodeBufferL(): end" ); + } + +//------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter12::AddLeafBufferL() +// Buffers Leaf Obj & checks for Mandatory fields +//------------------------------------------------------------------------------ +void CNSmlDMSettingsAdapter12::AddLeafBufferL( const TDesC8& aURI, + const TDesC8& aObject, const TInt aStatusRef) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafBufferL(): begin" ); + TNSmlDMLeafElement newCommand; + + newCommand.iUri = aURI.AllocLC (); + newCommand.iData = aObject.AllocLC (); + newCommand.iLuid = HBufC8::NewLC (8); //Allocate Mem. for iLUID + newCommand.iStatusRef = aStatusRef; + //Add Leaf to the index updated by UpdateLeafObj + iBuffer->At(iExecutionIndex).iLeafBuf->AppendL (newCommand); + // iUri, iData, ILuid + CleanupStack::Pop (3); + SetField ( aURI); + SetURIInProcessL ( aURI); + if ( iField->Compare (KNSmlDdfAddr)== 0) + { + iBuffer->At(iExecutionIndex).iAddr = ETrue; + } + else + if ( iField->Compare (KNSmlDdfServerId)== 0) + { + if(!IsServerIDExistL(aObject)) + iBuffer->At(iExecutionIndex).iServerId = ETrue; + } + else + if ( iField->Compare (KNSmlDdfAAuthName)== 0) + { + //AAuthName under AppAuthCli + if ( iURIField->Find (KDmAccAppAuthDyn2)!= KErrNotFound) + iBuffer->At(iExecutionIndex).iUName = ETrue; + } + else + if ( iField->Compare (KNSmlDdfName)== 0) + { + iBuffer->At(iExecutionIndex).iServerName = ETrue; + } + + // If Address,ServerId,ServerName,UserName then Add + + if ( iBuffer->At(iExecutionIndex).iAddr && iBuffer->At(iExecutionIndex).iServerId &&iBuffer->At(iExecutionIndex).iUName && iBuffer->At(iExecutionIndex).iServerName) + { + ExecuteBufferL (); + iExecutionIndex = -1; + } + _DBG_FILE( "CNSmlDMSettingsAdapter12::AddLeafBufferL(): end" ); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlDMSettingsAdapter12::ExecuteBufferL() +// Adds the Node/Leaf obj to the db +//------------------------------------------------------------------------------ +void CNSmlDMSettingsAdapter12::ExecuteBufferL() + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::ExecuteBufferL(): begin" ); + TBuf8<8> newLUID; + TInt rValue; + //Buffer is being Executed + iBufOn = ETrue; + + // Robustness check for Execution Index + if ( iExecutionIndex<0) + { + return; + } + + //Execute BufferL is called from CompleteOutstandingCmdsL only when - + //mandatory fields are not set. Dont update Node/Leaf to the db, return a failure + + if ( !iComplete) + rValue = CreateNewProfileL (iLUID); + else + rValue = CSmlDmAdapter::EError; + + iBuffer->At(iExecutionIndex).iExecuted = ETrue; + + if ( rValue != KErrNone) + { + if ( rValue == KErrNoMemory) + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::ENoMemory); + } + else + if ( rValue == KErrNotSupported) + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, + CSmlDmAdapter::EInvalidObject); + } + else + if ( rValue == KErrInUse) + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, + CSmlDmAdapter::EObjectInUse); + } + else + if ( rValue == KErrDiskFull) + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, + CSmlDmAdapter::EDiskFull); + } + else + { + iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, + CSmlDmAdapter::EError); + } + // dont return, UpdateLeafObjectL will update the callback status for leaf Nodes + } + else + { + if ( iLUID >= KMaxDataSyncID) + { + newLUID.Num ( iLUID - KMaxDataSyncID); + } + else + { + newLUID.Num ( iLUID); + } + + iCallBack->SetMappingL ( *iBuffer->At(iExecutionIndex).iMappingName, newLUID); + + iCallBack->SetStatusL (iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::EOk); + } + + for (TInt val= 0; val < iBuffer->At(iExecutionIndex).iLeafBuf->Count ();val++) + { + //Update the LUID data in the Leaf structure with the Profile LUID before calling UpdateLeafObj + TPtr8 tempLUID(iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid->Des ()); + tempLUID.Append (newLUID); + UpdateLeafObjectL (*iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iUri, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iData, *iBuffer->At(iExecutionIndex).iMappingName, iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iStatusRef); + + } + + // Delete the dynamically allocated buffers (Node/Leaf obj) + + ClearBuffer ( iBuffer->At(iExecutionIndex).iLeafBuf); + + delete iBuffer->At(iExecutionIndex).iLeafBuf; + + if ( iBuffer->At(iExecutionIndex).iMappingName) + { + delete iBuffer->At(iExecutionIndex).iMappingName; + iBuffer->At(iExecutionIndex).iMappingName = NULL; + } + + iBuffer->Delete (iExecutionIndex); + iBuffer->Compress (); + //Buffer Execution Complete + iBufOn = EFalse; + _DBG_FILE( "CNSmlDMSettingsAdapter12::ExecuteBufferL(): end" ); + } + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlDMSettingsAdapter12::ParentURI(const TDesC8& aURI) +// returns parent uri +// Searches till the 2nd "/" is reached +//------------------------------------------------------------------------------ +TPtrC8 CNSmlDMSettingsAdapter12::ParentURI(const TDesC8& aURI) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::ParentURI(): begin" ); + TInt count; + TInt flag = 0; + for (count=0; count<=aURI.Length ()-1;count++) + { + + if ( aURI[count]=='/') + { + flag++; + if ( flag == KDynNodePosn) // KDynNodePosn =2 --> DMAcc/DMIDxxx + break; + } + } + _DBG_FILE( "CNSmlDMSettingsAdapter12::ParentURI(): end" ); + return aURI.Left (count); + } + +//----------------------------------------------------------------------------------------- +// Clears the elements of the passed in LeafElement Structure +//----------------------------------------------------------------------------------------- +void CNSmlDMSettingsAdapter12::ClearBuffer( + CArrayFixFlat* aBuffer) + { + _DBG_FILE( "CNSmlDMSettingsAdapter12::ClearBuffer(): begin" ); + for (TInt i = 0; i < aBuffer->Count (); i++) + { + delete aBuffer->At(i).iUri; + aBuffer->At(i).iUri = NULL; + + delete aBuffer->At(i).iData; + aBuffer->At(i).iData = NULL; + + delete aBuffer->At(i).iLuid; + aBuffer->At(i).iLuid = NULL; + } + + aBuffer->Reset (); + _DBG_FILE( "CNSmlDMSettingsAdapter12::ClearBuffer(): end" ); + } + +//-------------------------------------------------------------------- +//TInt CNSmlDMSettingsAdapter::IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI) +// +//------------------------------------------------------------------- + + +TBool CNSmlDMSettingsAdapter12::IsDMAccUriFormatMatchPredefined(const TDesC8 & aURI) +{ + + // include strings for tree for Bearer , DNS related Dynamic nodes . + + if(aURI.Match(_L8("DMAcc/DMId*")) != KErrNotFound ) + { + return ETrue; + } + else + { + return EFalse; + } + + +} + +//-------------------------------------------------------------------- +//TInt CNSmlDMSettingsAdapter::ConstructTreeL(const TDesC8& aURI) +// +//------------------------------------------------------------------- + +TInt CNSmlDMSettingsAdapter12::ConstructTreeL(const TDesC8& aURI) +{ + TInt profileID = KErrNotFound; + _LIT8( KNSmlDMIdZero, "DMAcc/DMId000" ); + TBuf8<20> zeroURI; // DMAcc/DMIdnnn , nnn = profileid + zeroURI.Append( KNSmlDMIdZero ); + HBufC8* ismapInfo = iCallBack->GetLuidAllocL(zeroURI); + if (ismapInfo->Length() != 0) // Tree is already constructrd, no need to proceed. + { + delete ismapInfo; + return profileID; + } + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDevMan; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + + for( TInt p = 0; p < profileIdArray.Count(); p++ ) + { + TInt ddId = profileIdArray[p] - KMaxDataSyncID; + + _LIT8( Kprev, "DMId" ); + TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid + TInt fixedProfId = profileIdArray[p] - KMaxDataSyncID; //fit to 3 decimal + addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); + DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME ); + // KNSmlDMStart includes start text for URISeg + TBuf8<20> addURI; // DMAcc/DMIdnnn , nnn = profileid + addURI.Append( KNSmlDMStart ); + addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); + TBuf8<3> addLUID; + addLUID.Num( fixedProfId ); + + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI); + + if (mapInfo->Length() == 0) + { + iCallBack->SetMappingL(addURI,addLUID); + if( aURI.Find(addURI) >= 0 ) + { + profileID = fixedProfId; + } + } + else + { + delete mapInfo; + } + } + + CleanupStack::PopAndDestroy( 1 );//profileIdArray + return profileID; +} + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KNSmlDMSettingsAdapterImplUid, CNSmlDMSettingsAdapter12::NewL ) + }; + + +// ----------------------------------------------------------------------------- +// TImplementationProxy* ImplementationGroupProxy() +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: begin" ); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + _DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: end" ); + return ImplementationTable; + } + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlDMSettingsAdapter12::GetDynamicDMNodeUri( const TDesC8& aURI ) +// returns DM/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CNSmlDMSettingsAdapter12::GetDynamicDMNodeUri(const TDesC8& aURI) + { + TInt i= 0; + TBuf8<50> DmAccRoot(KNSmlDefDMAcc); + for ( i = aURI.Find( KNSmlDefDMAcc ) + DmAccRoot.Length() + 1; i < aURI.Length(); i++ ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + return aURI.Left( i ); + } +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/src/nsmldmsettingsadapter12.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/src/nsmldmsettingsadapter12.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,48 @@ +CHARACTER_SET UTF8/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource data for Device Management Settings Adapter +* +*/ + + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x10282CE7; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10282CE8; // DM interface implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/bwins/syncmldm12testu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/bwins/syncmldm12testu.def Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/conf/syncmldm12test.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/conf/syncmldm12test.cfg Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,125 @@ +[Test] +title DDF +create syncmldm12test foobar jee +foobar DDFStructure +delete foobar +[Endtest] + +[Test] +title StartAtomic +create syncmldm12test foobar +foobar StartAtomic +delete foobar +[Endtest] + +[Test] +title CommitAtomic +create syncmldm12test foobar +foobar CommitAtomic +delete foobar +[Endtest] + +[Test] +title RollbackAtomic +create syncmldm12test foobar +foobar RollbackAtomic +delete foobar +[Endtest] + +[Test] +title AddDmAcc +create syncmldm12test foobar +foobar AddNode DMAcc/DMId099 +foobar UpdateLeaf DMAcc/DMId099/Name name99 +foobar UpdateLeaf DMAcc/DMId099/ServerID server99 +foobar UpdateLeaf DMAcc/DMId099/AppAddr/Addr001/Addr http://a.com +foobar UpdateLeaf DMAcc/DMId099/AppAuth/AppAuthCli/AAuthName user99 +foobar CompleteCommands +delete foobar +[Endtest] + +[Test] +title UpdateLeafDmAcc +create syncmldm12test foobar +foobar UpdateLeaf DMAcc/DMId099/Name newname99 +delete foobar +[Endtest] + +[Test] +title FetchNodeDmAcc +create syncmldm12test foobar +foobar FetchNode DMAcc/DMId099 +delete foobar +[Endtest] + +[Test] +title FetchLeafDmAcc +create syncmldm12test foobar +foobar FetchLeaf DMAcc/DMId099/Name +delete foobar +[Endtest] + +[Test] +title DeleteDmAcc +create syncmldm12test foobar +foobar DeleteNode DMAcc/DMId099 +delete foobar +[Endtest] + +[Test] +title AddDmAccAllInfo +create syncmldm12test foobar +foobar AddNode DMAcc/DMId090 +foobar AddNode DMAcc/DMId090/AAuthPref +foobar AddNode DMAcc/DMId090/AppAddr +foobar AddNode DMAcc/DMId090/AppAddr/Addr001 +foobar UpdateLeaf DMAcc/DMId090/AppAddr/Addr001/Addr https://b.com/abc +foobar UpdateLeaf DMAcc/DMId090/AppAddr/Addr001/AddrType URI +foobar AddNode DMAcc/DMId090/AppAddr/Addr001/Port +foobar AddNode DMAcc/DMId090/AppAddr/Addr001/Port/Port001 +foobar UpdateLeaf DMAcc/DMId090/AppAddr/Addr001/Port/Port001/PortNbr 443 +foobar AddNode DMAcc/DMId090/AppAuth +foobar AddNode DMAcc/DMId090/AppAuth/AppAuthCli +foobar AddNode DMAcc/DMId090/AppAuth/AppAuthCli/AAuthData +foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthCli/AAuthLevel CLCRED +foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthCli/AAuthName userx +foobar AddNode DMAcc/DMId090/AppAuth/AppAuthSrv +foobar AddNode DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthData +foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthLevel SRVCRED +foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthName userx +foobar AddNode DMAcc/DMId090/AppAuth/AppAuthTransport +foobar AddNode DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthData +foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthLevel HTTP +foobar UpdateLeaf DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthName user +foobar UpdateLeaf DMAcc/DMId090/AppID w7 +foobar UpdateLeaf DMAcc/DMId090/Name InteliSync +foobar UpdateLeaf DMAcc/DMId090/PrefConRef AP/APId000 +foobar UpdateLeaf DMAcc/DMId090/ServerID userx +foobar CompleteCommands +delete foobar +[Endtest] + +[Test] +title FetchAllLeafDmAcc +create syncmldm12test foobarfoobar FetchLeaf DMAcc/DMId090/AppAddr/Addr001/Addr +foobar FetchLeaf DMAcc/DMId090/AppAddr/Addr001/AddrType +foobar FetchLeaf DMAcc/DMId090/AppAddr/Addr001/Port/Port001/PortNbr +foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthCli/AAuthLevel +foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthCli/AAuthName +foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthLevel +foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthSrv/AAuthName +foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthLevel +foobar FetchLeaf DMAcc/DMId090/AppAuth/AppAuthTransport/AAuthName +foobar FetchLeaf DMAcc/DMId090/AppID +foobar FetchLeaf DMAcc/DMId090/Name +foobar FetchLeaf DMAcc/DMId090/PrefConRef +foobar FetchLeaf DMAcc/DMId090/ServerID +delete foobar +[Endtest] + +[Test] +title DeleteDmAcc +create syncmldm12test foobar +foobar DeleteNode DMAcc/DMId090 +delete foobar +[Endtest] diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/eabi/syncmldm12testu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/eabi/syncmldm12testu.def Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,9 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI15Csyncmldm12Test @ 2 NONAME ; ## + _ZTI16CTestDmDDFObject @ 3 NONAME ; ## + _ZTI8Cdmatest @ 4 NONAME ; ## + _ZTV15Csyncmldm12Test @ 5 NONAME ; ## + _ZTV16CTestDmDDFObject @ 6 NONAME ; ## + _ZTV8Cdmatest @ 7 NONAME ; ## + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/group/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: + + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +syncmldm12test.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/group/syncmldm12test.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/group/syncmldm12test.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + +#include + +TARGET syncmldm12test.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE syncmldm12test.def + +SOURCEPATH ../src +SOURCE dmatest.cpp +SOURCE TestDmDDFObject.cpp +SOURCE syncmldm12test.cpp +SOURCE syncmldm12testBlocks.cpp + + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + + + + +LIBRARY apgrfx.lib apmime.lib +LIBRARY euser.lib ecom.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY SWInstCli.lib + +LANG SC + + + +SMPSAFE +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/group/syncmldm12test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/group/syncmldm12test.pkg Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,38 @@ +; +; Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Implementation of DM adapter test component +; This is part of omadmextensions/adapter test application. +; + +;*Languages +&EN +; +;*Standard SIS file header. This section specifies the package name, +;application UID, and version/build numbers. Add the package TYPE here if needed. +#{"syncmldm12test"},(0x101FB3E8),1,0,1; +; + +;*Unique (Non-Localised) Vendor name +;This is used in combination with signing to prevent the unauthroized +;upgrade ofa a package by someone other than the rightful vendor. +:"Nokia" + +;*Localized Vendor Name +;This specifies the localised vendor name(s) correspodning to language(s). +%{"Nokia Test EN"} + +;*Files To Copy... +"\epoc32\release\armv5\urel\syncmldm12test.dll" -"C:\sys\bin\syncmldm12test.dll" +"..\conf\syncmldm12test.cfg"-"C:\TestFramework\syncmldm12test.cfg" +"..\init\syncmldm12test.ini"-"C:\TestFramework\syncmldm12test.ini" diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/inc/TestDmDDFObject.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef __TESTDMDDFOBJECT_H +#define __TESTDMDDFOBJECT_H + +// INCLUDES +//#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +class CStifLogger; + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class CTestDmDDFObject : public CBase, public MSmlDmDDFObject + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CTestDmDDFObject* NewL( CStifLogger *aLog ); + static CTestDmDDFObject* NewLC( CStifLogger *aLog ); + + /** + * Destructor. + */ + virtual ~CTestDmDDFObject(); + + public: // New functions + + /** + * ?member_description. + * @since Series ?XX ?SeriesXX_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + virtual void SetNameL( const TDesC8& aName ); + + void DumpL( const TDesC8& aParentName, TBool aFullDump = ETrue ); + void ExternalizeL(RWriteStream& aStream) const; + + + + public: // Functions from base classes + +//sf- ********************************* + + void SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ); + void SetDefaultValueL( const TDesC8& aDefaultValue ); + void SetDescriptionL( const TDesC8& aDescription ); + void SetDFFormatL( TDFFormat aFormat ); + void SetOccurenceL( TOccurence aOccurence ); + void SetScopeL( TScope aScope ); + void SetDFTitleL( const TDesC8& aTitle ); + void AddDFTypeMimeTypeL( const TDesC8& aMimeType ); + void SetAsObjectGroup(); + MSmlDmDDFObject& AddChildObjectL(const TDesC8& aNodeName); + MSmlDmDDFObject& AddChildObjectGroupL(); + +//sf- ############################# + + const TDesC8& Name(); + TSmlDmAccessTypes AccessTypes(); + const TDesC8& DefaultValue(); + const TDesC8& Description(); + TDFFormat DFFormat(); + TOccurence Occurence(); + TScope Scope(); + const TDesC8& DFTitle(); + const TDesC8& DFTypeMimeType(); + TBool ObjectGroup(); + + TInt ChildObjectCount(); + CTestDmDDFObject& ChildObject( TInt aIndex ); + + CTestDmDDFObject* FindChildObject( const TDesC8& aName ); + TInt SubObjectsCount(); + + + protected: // New functions + + /** + * ?member_description. + * @since Series ?XX ?SeriesXX_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CTestDmDDFObject( CStifLogger *aLog ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // CTestDmDDFObject( const CTestDmDDFObject& ); + // Prohibit assigment operator if not deriving from CBase. + // CTestDmDDFObject& operator=( const CTestDmDDFObject& ); + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + // ?one_line_short_description_of_data + //?data_declaration; + HBufC8* iName; + + TSmlDmAccessTypes iAccessTypes; + HBufC8* iDefaultValue; + HBufC8* iDescription; + TDFFormat iFormat; + TOccurence iOccurence; + TScope iScope; + HBufC8* iTitle; + HBufC8* iMimeType; + TBool iObjectGroup; + + RPointerArray iChildren; + + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + /** + * Logger. + */ + CStifLogger* iLog; + + }; + +#endif // __TESTDMDDFOBJECT_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/inc/dmatest.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,277 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef __DMA_TEST_H__ +#define __DMA_TEST_H__ + +// INCLUDES +#include +#include +#include +#include +#include +#include "NSmlDMSettingsAdapter12.h" + +class Cdmatest; + + +struct TMapping + { + TBuf8<256> iURI; + TBuf8<64> iLuid; + TMapping( const TDesC8 &aURI, const TDesC8 &aLuid ) : iURI( aURI ), iLuid( aLuid ) + { + + } + }; + +typedef RArray RMappingArray; + +typedef void (Cdmatest::* ResultsFunction)( TInt , CBufBase& , const TDesC8& ) ; + + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class Cdmatest : public CScriptBase, public MSmlDmCallback + { + + public: // Constructors and destructor + + /** + * Destructor. + */ + virtual ~Cdmatest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ) = 0; + + + public: + /** + The function is used to return the data in case of FetchLeafObjectL(), + FetchLeafObjectSizeL() and ChildURIListL() functions. It should not be + called where the DM command has failed, i.e. the error code returned in + SetStatusL is something other than EOk. + @param aResultsRef Reference to correct command + @param aObject The data which should be returned + @param aType MIME type of the object + @publishedPartner + @prototype + */ + void SetResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); + + /** + The function is used to return the data in case of FetchLeafObjectL() and + ChildURIListL() functions, where the size of the data being returned is + large enough for the Adapter to stream it. This function should not be + called when command was failed, i.e. the error code returned in SetStatusL + is something other than EOk. + @param aResultsRef Reference to correct command + @param aStream Large data which should be returned, DM engine + closes stream when it has read all the data + @param aType MIME type of the object + @publishedPartner + @prototype + */ + void SetResultsL( TInt /*aResultsRef*/, RReadStream*& /*aStream*/, + const TDesC8& /*aType*/ ) + { + + } + + /** + The function returns information about the Add,Update,Delete and Fetch + commands success to DM engine. The reference to correct command must be + used when calling the SetStatusL function, the reference is got from the + argument of the command functions. The SetStatusL function must be called + separately for every single command. + @param aStatusRef Reference to correct command + @param aErrorCode Information about the command success + @publishedPartner + @prototype + */ + void SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) ; + + /** + The function passes map information to DM Module. This function is called + for a new management object, both for node objects and for leaf objects. + In addition if ChildURIListL() function has returned new objects a mapping + information of the new objects must be passed. A mapping is treated as + inheritable. If the mapping is not set with this function, the mapping + LUID of the parent object is passed in following commands to the object. + @param aURI URI of the object. + @param aLUID LUID of the object. LUID must contain the all information, + which is needed for retrieve the invidual object from the + database. Typically it is ID for the database table. In + more complicated structures it can be combination of IDs, + which represent path to the object. + @publishedPartner + @prototype + */ + void SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ); + + /** + The function is used to make a fetch to other adapters. The most common + use is to make a fetch to the AP adapter, because when managing the access + points, the data comes as URI. For example, there are ToNAPId field in + some adapters, and data to it can be something like AP/IAPidx, and then + the link to AP adapter is needed. + Using FetchLinkL causes the DM Framework to make a Get request to the + appropriate DM adapter. The receiving adapter MUST complete the Get + request synchronously. + @param aURI URI of the object. + @param aData Reference to data, i.e. data is returned here + @param aStatus The status of fetch command is returned here + @publishedPartner + @prototype + */ + void FetchLinkL( const TDesC8& /*aURI*/, CBufBase& /*aData*/, + MSmlDmAdapter::TError& /*aStatus*/ ) + { + + } + + /** + The function returns the LUID which is mapped to aURI. If LUID is not + found, the function allocates a null length string, i.e. the function + allocates memory in every case. + @param aURI URI of the object. + @publishedPartner + @prototype + */ + HBufC8* GetLuidAllocL( const TDesC8& aURI ) ; + +#ifdef __TARM_SYMBIAN_CONVERGENCY + + void GetMappingInfoListL( const TDesC8& aURI, + CArrayFix& aSegmentList ); + +#else +// nothing +#endif + + protected: // New functions + + + void FetchNodeResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); + void SaveDataL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ) ; + + TPtrC8 LastURISeg( const TDesC8& aURI ); + TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); + TPtrC RemoveLastURISeg( const TDesC& aURI ); + void SetURIL( const TDesC& aURI ); + void SetURIL( const TDesC8& aURI ); + void SetURIL( HBufC8* aURI ); + HBufC8 *LoadFileLC( const TDesC &aFileName, TDataType &aType ); + HBufC8 *LoadFileLC( const TDesC8 &aFileName, TDataType &aType ); + HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); + HBufC8* GetLuidAllocLC( const TDesC8& aURI ) ; + TPtrC8 RemoveLastSeg(const TDesC8& aURI); + + TInt FetchNodeL( CStifItemParser& aItem ) ; + TInt FetchLeafL( CStifItemParser& aItem ) ; + TInt AddNodeL( CStifItemParser& aItem ); + TInt DeleteObjectL( CStifItemParser& aItem ); + TInt UpdateLeafL( CStifItemParser& aItem ) ; + TInt UpdateLeafDataL( CStifItemParser& aItem ) ; + TInt UpdateLeafDataURLL( CStifItemParser& aItem ) ; + + TInt ExecuteLeafL ( CStifItemParser& aItem ) ; + TInt ExecuteLeafDataL ( CStifItemParser& aItem ) ; + TInt StartAtomicL( CStifItemParser& aItem ) ; + TInt CommitAtomicL( CStifItemParser& aItem ) ; + TInt RollbackAtomicL( CStifItemParser& aItem ) ; + TInt CompleteCommandsL( CStifItemParser& aItem ); + TInt DDFStructureL( CStifItemParser& aItem ) ; +// TInt DeliverL( CStifItemParser& aItem ) ; +// TInt DetailsL( CStifItemParser& aItem ) ; +// TInt InstallL( CStifItemParser& aItem ) ; +// TInt BareInstallL( CStifItemParser& aItem ) ; + + protected: + + /** + * C++ default constructor. + */ + Cdmatest( CTestModuleIf& aTestModuleIf, TUid aUid ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // Cdmatest( const Cdmatest& ); + // Prohibit assigment operator if not deriving from CBase. + // Cdmatest& operator=( const Cdmatest& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + virtual void Delete(); + void LoadMappingsL(); + void SaveMappingsL(); + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + MSmlDmAdapter::TError iStatus ; + ResultsFunction iResultsFunction; + //CSmlDmAdapter *iAdapter ; + CNSmlDMSettingsAdapter12 *iAdapter ; + HBufC8 *iURI; + CArrayFix *iEmptyMappingInfoArray; + TFileName iSaveFileName; + RMappingArray iMappingTable; + TUid iUid; + TInt iCounter; + //class CNSmlDmMgmtTree* iMgmtTree; + class CNSmlDmMgmtTree* iMgmtTree; + CNSmlDMSettingsAdapter12 *Adapter() ; + }; + +#endif // __DMA_TEST_H__ + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/inc/syncmldm12test.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/inc/syncmldm12test.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef TCTEST_H +#define TCTEST_H + +// INCLUDES +#include +#include +#include +#include +#include "dmatest.h" + +const TUint KNSmlDMSettings12AdapterImplUid = 0x10282CE8; + + +const TUid KAdapterUid = + { + KNSmlDMSettings12AdapterImplUid + }; +// Logging path +_LIT( KamtestLogPath, "\\logs\\testframework\\tctest\\" ); +// Log file +_LIT( KamtestLogFile, "tctest.txt" ); + + +// FORWARD DECLARATIONS +class Csyncmldm12Test; + + +// CLASS DECLARATION + +/** +* Csyncmldm12Test test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +class Csyncmldm12Test : public Cdmatest + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Csyncmldm12Test* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Csyncmldm12Test(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + + private: + + /** + * C++ default constructor. + */ + Csyncmldm12Test( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + virtual void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ +/* virtual TInt ExampleL( CStifItemParser& aItem ) ; + virtual TInt DeliverL( CStifItemParser& aItem ) ; + virtual TInt DetailsL( CStifItemParser& aItem ) ; + virtual TInt InstallL( CStifItemParser& aItem ) ; + virtual TInt BareInstallL( CStifItemParser& aItem ) ;*/ + + + private: // Data + HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); + + + }; + +#endif // TCTEST_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/init/syncmldm12test.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/init/syncmldm12test.ini Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,204 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +[New_Module] +ModuleName= testscripter +#DM +TestCaseFile= c:\testframework\syncmldm12test.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/src/TestDmDDFObject.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,516 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES + +#include "TestDmDDFObject.h" +#include "StifLogger.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::CTestDmDDFObject +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CTestDmDDFObject::CTestDmDDFObject( CStifLogger *aLog ) + : iName( 0 ) + , iAccessTypes() + , iDefaultValue( 0 ) + , iDescription( 0 ) + , iFormat( (TDFFormat)0 ) + , iOccurence( (TOccurence)0 ) + , iScope( (TScope)0 ) + , iTitle ( 0 ) + , iMimeType( 0 ) + , iObjectGroup( EFalse ) + , iLog( aLog ) +// RPointerArray iChildren; + { + } + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CTestDmDDFObject::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTestDmDDFObject* CTestDmDDFObject::NewL( CStifLogger *aLog ) + { + CTestDmDDFObject* self = CTestDmDDFObject::NewLC( aLog ); + CleanupStack::Pop( self ); + + return self; + } + +CTestDmDDFObject* CTestDmDDFObject::NewLC( CStifLogger *aLog ) + { + CTestDmDDFObject* self = new( ELeave ) CTestDmDDFObject( aLog ); + + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + + +// Destructor +CTestDmDDFObject::~CTestDmDDFObject() + { + delete iName; + delete iDefaultValue; + delete iDescription; + delete iTitle; + delete iMimeType; + iChildren.ResetAndDestroy(); + } + + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/*?type CTestDmDDFObject::?member_function( + ?arg_type arg, + ?arg_type arg ) + { + + ?code + + } +*/ + +void CTestDmDDFObject::SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ) + { + iLog->Log( _L8( "SetAccessTypesL, aAccessTypes=%d" ), aAccessTypes.GetACL() ); + iAccessTypes = aAccessTypes; + } + +void CTestDmDDFObject::SetDefaultValueL( const TDesC8& aDefaultValue ) + { + iLog->Log( _L8( "SetDefaultValueL, aDefaultValue='%S'" ), &aDefaultValue ); + delete iDefaultValue; + iDefaultValue = 0; + iDefaultValue = aDefaultValue.AllocL(); + } + +void CTestDmDDFObject::SetDescriptionL( const TDesC8& aDescription ) + { + iLog->Log( _L8( "SetDescriptionL, aDescription='%S'" ), &aDescription ); + delete iDescription; + iDescription = 0; + iDescription = aDescription.AllocL(); + } + +void CTestDmDDFObject::SetDFFormatL( TDFFormat aFormat ) + { + iLog->Log( _L8( "SetDFFormatL, aFormat=%d" ), aFormat ); + iFormat = aFormat; + } + +void CTestDmDDFObject::SetOccurenceL( TOccurence aOccurence ) + { + iLog->Log( _L8( "SetOccurenceL, aOccurence=%d" ), aOccurence ); + iOccurence = aOccurence; + } + +void CTestDmDDFObject::SetScopeL( TScope aScope ) + { + iLog->Log( _L8( "SetScopeL, aScope=%d" ), aScope ); + iScope = aScope; + } + +void CTestDmDDFObject::SetDFTitleL( const TDesC8& aTitle ) + { + iLog->Log( _L8( "SetDFTitleL, aTitle='%S'" ), &aTitle ); + delete iTitle; + iTitle = 0; + iTitle = aTitle.AllocL(); + } + +void CTestDmDDFObject::AddDFTypeMimeTypeL( const TDesC8& aMimeType ) + { + iLog->Log( _L8( "AddDFTypeMimeTypeL, aMimeType='%S'" ), &aMimeType ); + delete iMimeType; + iMimeType = 0; + iMimeType = aMimeType.AllocL(); + } + +void CTestDmDDFObject::SetAsObjectGroup() + { + iLog->Log( _L8( "SetAsObjectGroup, true" ) ); + iObjectGroup = ETrue; + } + +MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectL(const TDesC8& aNodeName) + { + iLog->Log( _L8( "AddChildObjectL, aNodeName='%S'" ), &aNodeName ); + CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); + child->SetNameL( aNodeName ); + iChildren.AppendL( child ); + CleanupStack::Pop( child ); // Don't destroy + return *child; + } + +MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectGroupL() + { + iLog->Log( _L8( "AddChildObjectGroupL, ''" ) ); + CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, KNullDesC ); + child->SetAsObjectGroup(); + iChildren.AppendL( child ); + CleanupStack::Pop( child ); // Don't destroy + return *child; + } + +// Own functions + +void CTestDmDDFObject::SetNameL( const TDesC8& aName ) + { + delete iName; + iName = 0; + iName = aName.AllocL(); + } + +void CTestDmDDFObject::DumpL( const TDesC8& aParentName, TBool aFullDump ) + { + TPtrC8 name( _L8("") ); + if (iName && iName->Length() > 0) + { + name.Set( *iName ); + } + + HBufC8* fullName = HBufC8::NewLC( aParentName.Length() + name.Length() + 1 ); + *fullName = aParentName; + if (aParentName.Length() > 0 && aParentName[ aParentName.Length() - 1 ] != '/') + { + fullName->Des().Append( _L8("/")); + } + fullName->Des().Append( name ); + + /* Translate some members to text for dumping */ + TBuf8<20> strAccessTypes; + TUint8 accessTypes = iAccessTypes.GetACL(); + if ((accessTypes & iAccessTypes.EAccessType_Add) != 0) + { + strAccessTypes.Append( _L8("A") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Copy) != 0) + { + strAccessTypes.Append( _L8("C") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Delete) != 0) + { + strAccessTypes.Append( _L8("D") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Exec) != 0) + { + strAccessTypes.Append( _L8("E") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Get) != 0) + { + strAccessTypes.Append( _L8("G") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Replace) != 0) + { + strAccessTypes.Append( _L8("R") ); + } + + TBuf8<20> strFormat; + switch( iFormat ) + { + case EB64: + strFormat = _L8("Base64"); + break; + case EBool: + strFormat = _L8("Bool"); + break; + case EChr: + strFormat = _L8("Chr"); + break; + case EInt: + strFormat = _L8("Int"); + break; + case ENode: + strFormat = _L8("Node"); + break; + case ENull: + strFormat = _L8("Null"); + break; + case EXml: + strFormat = _L8("Xml"); + break; + case EBin: + strFormat = _L8("Bin"); + break; + default: + break; + } + + + TBuf8<20> strOccurence; + switch( iOccurence ) + { + case EOne: + /** The node appears exactly once */ + strOccurence = _L8("M:1"); + break; + case EZeroOrOne: + /** The node is optional and may appear zero or once */ + strOccurence = _L8("O:0-1"); + break; + case EZeroOrMore: + /** The node is optional and may appear zero or more times */ + strOccurence = _L8("O:0-*"); + break; + case EOneOrMore: + /** The node is mandatory and may appear once or more times */ + strOccurence = _L8("M:1-*"); + break; + case EZeroOrN: + /** The node is optional and may appear between once and 'N' times */ + strOccurence = _L8("O:1-N"); + break; + case EOneOrN: + /** The node is mandatory and may appear between once and 'N' times */ + strOccurence = _L8("M:1-N"); + break; + default: + break; + } + + + TBuf8<20> strScope; + switch( iScope) + { + case EPermanent: + /** The node appears exactly once */ + strScope = _L8("Permanent"); + break; + case EDynamic: + /** The node is optional and may appear zero or once */ + strScope = _L8("O:Dynamic"); + break; + default: + break; + } + + + /* Dump main data */ + if (aFullDump) + { + iLog->Log( _L8( "DDFObject: '%S'" ), fullName ); + } + else + { + iLog->Log( _L8( "DDFObject: '%S' (%S), %S, %S, %S" ), + fullName, &strAccessTypes, &strFormat, &strOccurence, &strScope ); + } + + /* Dump members */ + if (aFullDump) + { + TPtrC8 empty( _L8( "" ) ); + #define CHK_NULL(a) ((a)==0?(TDesC8*)(&empty):(TDesC8*)(a)) + + iLog->Log( _L8( " iName=='%S'" ), iName ); + iLog->Log( _L8( " iAccessTypes=%d (%S)" ), iAccessTypes.GetACL(), &strAccessTypes ); + iLog->Log( _L8( " iDefaultValue='%S'" ), CHK_NULL(iDefaultValue)); + iLog->Log( _L8( " iDescription='%S'" ), CHK_NULL(iDescription )); + iLog->Log( _L8( " iFormat=%d (%S)" ), iFormat, &strFormat ); + iLog->Log( _L8( " iOccurence=%d (%S)" ), iOccurence, &strOccurence ); + iLog->Log( _L8( " iScope=%d (%S)" ), iScope, &strScope ); + iLog->Log( _L8( " iTitle='%S'" ), CHK_NULL(iTitle )); + iLog->Log( _L8( " iMimeType='%S'" ), CHK_NULL(iMimeType )); + iLog->Log( _L8( "----------------------------------" ) ); + } + + /* Dump children */ + for (TInt i = 0 ; i < iChildren.Count() ; i++) + { + iChildren[i]->DumpL( *fullName, aFullDump ); + } + + CleanupStack::PopAndDestroy( fullName ); + } + +/* +void CTestDmDDFObject::ExternalizeL(RWriteStream& aStream) const + { + X; + aStream << *iName << eol; + } +*/ + +const TDesC8& CTestDmDDFObject::Name() + { + return (iName != 0) ? *iName : KNullDesC8(); + } + +TSmlDmAccessTypes CTestDmDDFObject::AccessTypes() + { + return iAccessTypes; + } + +const TDesC8& CTestDmDDFObject::DefaultValue() + { + return (iDefaultValue != 0) ? *iDefaultValue : KNullDesC8(); + } + +const TDesC8& CTestDmDDFObject::Description() + { + return (iDescription != 0) ? *iDescription : KNullDesC8(); + } + +CTestDmDDFObject::TDFFormat CTestDmDDFObject::DFFormat() + { + return iFormat; + } + +CTestDmDDFObject::TOccurence CTestDmDDFObject::Occurence() + { + return iOccurence; + } + +CTestDmDDFObject::TScope CTestDmDDFObject::Scope() + { + return iScope; + } + +const TDesC8& CTestDmDDFObject::DFTitle() + { + return (iTitle != 0) ? *iTitle : KNullDesC8(); + } + +const TDesC8& CTestDmDDFObject::DFTypeMimeType() + { + return (iMimeType != 0) ? *iMimeType : KNullDesC8(); + } + +TBool CTestDmDDFObject::ObjectGroup() + { + return iObjectGroup; + } + +TInt CTestDmDDFObject::ChildObjectCount() + { + return iChildren.Count(); + } + +CTestDmDDFObject& CTestDmDDFObject::ChildObject( TInt aIndex ) + { + return *iChildren[aIndex]; + } + +CTestDmDDFObject* CTestDmDDFObject::FindChildObject( const TDesC8& aName ) + { + CTestDmDDFObject* foundObject = 0; + + for (TInt i = 0 ; i < iChildren.Count() ; i++) + { + if ( aName.CompareC( iChildren[i]->Name() ) == 0 ) + { + foundObject = iChildren[i]; + break; + } + } + + return foundObject; + } + +TInt CTestDmDDFObject::SubObjectsCount() + { + TInt count = 0; + + TInt i; + for (i = 0 ; i < iChildren.Count() ; i++) + { + count += iChildren[i]->SubObjectsCount(); + } + count += i; + + return count; + } + +/* +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ?function_name implements... +// ?implementation_description. +// Returns: ?value_1: ?description +// ?value_n: ?description +// ?description +// ----------------------------------------------------------------------------- +// +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg ) // ?description + { + + ?code + + } +*/ +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/src/dmatest.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,954 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include "dmatest.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "TestDmDDFObject.h" + +_LIT8( KEmptyType, "" ); +_LIT8( KDefaultType, "text/plain" ); +_LIT( KMappingTableFile, "\\dmtestmappings.txt" ); +//_LIT8( KNSmlDMSeparator8, "/" ); +//const TUint8 KNSmlDMUriSeparator = 0x2f; //forward slash + +#define LEAVE_IF_ERROR(x,msg) \ + { TInt __xres = (x); if ( __xres < 0 ) { if ( iLog ) iLog->Log( (msg), __xres ); User::Leave( __xres ); } } + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cdmatest::Cdmatest +// C++ default constructor can NOT contain any code, that +// leave. +// ----------------------------------------------------------------------------- +// +Cdmatest::Cdmatest(CTestModuleIf& aTestModuleIf, TUid aUid ): + CScriptBase( aTestModuleIf ), iMappingTable(2), iUid( aUid ) + { + + } + +// ----------------------------------------------------------------------------- +// Cdmatest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cdmatest::ConstructL() + { + Adapter(); + iEmptyMappingInfoArray = new ( ELeave ) CArrayFixFlat(1); + + TRAPD( err, LoadMappingsL() ); + if (err != KErrEof && err != KErrNone && err != KErrNotFound) + { + User::Leave( err ); + } + } + +CNSmlDMSettingsAdapter12 *Cdmatest::Adapter() + { + if ( iAdapter == NULL ) + { + if ( iLog ) + { + iLog->Log( _L( "Loading Adapter" ) ); + } + + TRAPD( err, iAdapter = (CNSmlDMSettingsAdapter12*) CSmlDmAdapter::NewL( iUid,*this ) ); + if ( err == KErrNone ) + { + if (iLog ) + { + iLog->Log( _L( "Loaded" ) ); + } + } + else + { + if (iLog) + { + iLog->Log( _L( "Failed to load adapter: %d" ), err ); + } + } + } + return iAdapter; + } + + +void Cdmatest::LoadMappingsL() + { + TDataType type; + HBufC8 *data = LoadFileLC( KMappingTableFile, type ); + RDesReadStream buf( *data ); + CleanupClosePushL( buf ); + + TInt len( data->Length() ); + while (buf.Source()->TellL( MStreamBuf::ERead ).Offset() < len) + { + TUint32 val = buf.ReadUint32L(); + TBuf8<256> uri; + TBuf8<64> luid; + buf.ReadL(uri, val); + val = buf.ReadUint32L(); + buf.ReadL(luid, val); + TMapping m( uri, luid ) ; + TInt err( iMappingTable.Append( m ) ); + if ( err == KErrNone ) + { + iLog->Log( _L8( "Loaded mapping: '%S' : '%S'"), &m.iURI, &m.iLuid ); + } + else + { + iLog->Log( _L8( "FAILED TO Load mapping: '%d' "), err ); + } + } + CleanupStack::PopAndDestroy( &buf); // buf + CleanupStack::PopAndDestroy( data ); // data + } + + + +void Cdmatest::SaveMappingsL() + { + TInt c( iMappingTable.Count() ); + if ( c > 0 ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFileWriteStream buf; + User::LeaveIfError( buf.Replace( fs, KMappingTableFile, EFileWrite ) ); + CleanupClosePushL( buf ); + + TInt i( 0 ) ; + do + { + buf.WriteUint32L( iMappingTable[i].iURI.Length() ); + buf.WriteL( iMappingTable[i].iURI ); + buf.WriteUint32L( iMappingTable[i].iLuid.Length() ); + buf.WriteL( iMappingTable[i].iLuid ); + } + while ( ++i < c ) ; + buf.CommitL(); + buf.Close(); + + CleanupStack::PopAndDestroy(); // buf + CleanupStack::PopAndDestroy(); // fs + } + } + + +// Destructor +Cdmatest::~Cdmatest() + { + // Delete resources allocated from test methods + TRAPD(err, SaveMappingsL() ); + if ( err != KErrNone ) + { + if(iLog) + iLog->Log( _L8( "Failed to save mappings!: %d"), err ); + } + Delete(); + + // Delete logger + delete iLog; + delete iEmptyMappingInfoArray; + delete iAdapter; + delete iURI; + iMappingTable.Reset(); + REComSession::FinalClose(); + } + + +// ----------------------------------------------------------------------------- +// Camatest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cdmatest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cdmatest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + + + +HBufC8 *Cdmatest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) + { + TPtrC nodename( KNullDesC ); + + TInt i( aItem.GetNextString ( nodename ) ); + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); + } + else + { + iLog->Log( _L("%S: %S"), &aName, &nodename); + } + + HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; + buf->Des().Copy( nodename ); + return buf; + } + +TInt Cdmatest::FetchNodeL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("FetchNodeL") ); + + iResultsFunction = FetchNodeResultsL; + + TPtrC8 nodename( GetNextStringLC( aItem, _L(" nodename" ) )->Des() ) ; + + SetURIL(nodename) ;// + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + Adapter()->ChildURIListL( *iURI, *luid, *iEmptyMappingInfoArray, 4, 5) ; + + if ( iStatus == MSmlDmAdapter::EOk ) + { + } + else + { + iLog->Log( _L("FetchNodeL: ChildUriList Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ) ; + CleanupStack::PopAndDestroy() ; // nodename + iLog->Log( _L("FetchNodeL: Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::StartAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->StartAtomicL() ) ; + iLog->Log( _L("StartAtomicL: Atomic started resulting error %d" ), err ); + return err; + } + +TInt Cdmatest::RollbackAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->RollbackAtomicL() ) ; + iLog->Log( _L("RollbackAtomicL: Atomic rolled back resulting error %d" ), err ); + return err; + } + +TInt Cdmatest::CommitAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->CommitAtomicL() ) ; + iLog->Log( _L("RollbackAtomicL: Atomic commited resulting error %d" ), err ); + return err; + } + + +TInt Cdmatest::DDFStructureL( CStifItemParser& /*aItem*/ ) + { + CTestDmDDFObject* ddfRoot = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); + + TRAPD( err, iAdapter->DDFStructureL( *ddfRoot ) ) ; + CleanupStack::PopAndDestroy( ddfRoot ); + iLog->Log( _L("DDFStructureL: method called resulting error %d" ), err ); + return err; + } + + +TInt Cdmatest::AddNodeL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("AddNodeL") ); + + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("nodename" ) )->Des() ) ; + SetURIL( nodename ); + + Adapter()->AddNodeObjectL( *iURI, KEmptyType, 8 ) ; + + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("AddNodeL: AddNodeObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("AddNodeL: AddNodeObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy() ; // nodename + iLog->Log( _L("AddNodeL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 data (GetNextStringLC( aItem, _L("datafile"))->Des() ); + + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + TDataType type; + + TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() ); + + /** + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + + Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); + + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy(); // loadfile + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // nodename + + iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret ); + + return ret; + } + + +TInt Cdmatest::UpdateLeafDataURLL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafDataL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 http (GetNextStringLC( aItem, _L("http"))->Des() ); + TPtrC8 url (GetNextStringLC( aItem, _L("rest of url"))->Des() ); + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + _LIT8( KTag, "://" ); + + HBufC8 *fullurl = HBufC8::NewLC( http.Length() + KTag().Length() + url.Length() ); + TPtr8 pfullurl( fullurl->Des() ); + pfullurl.Copy( http ) ; + pfullurl.Append( KTag ); + pfullurl.Append( url ); + TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + /** + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + Adapter()->UpdateLeafObjectL( *iURI , *luid, pfullurl, mimePtr, 3); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // + CleanupStack::PopAndDestroy( mime ); // mime + CleanupStack::PopAndDestroy(); // url + CleanupStack::PopAndDestroy(); // http + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::UpdateLeafDataL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("UpdateLeafDataL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 data (GetNextStringLC( aItem, _L("data"))->Des() ); + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + + SetURIL( nodename ); + + + TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + +// +// virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, +// const TDesC8& aObject, const TDesC8& aType, +// TInt aStatusRef ) = 0; +// + Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::FetchLeafL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("FetchLeafL") ); + + iResultsFunction = NULL; + + TInt i( 0 ); + TPtrC8 nodename ( GetNextStringLC( aItem, _L( "nodename" ) )->Des() ) ; + + //TPtrC datafile; + TPtrC datafile( KNullDesC ); + i = aItem.GetNextString ( datafile ) ; + if ( i != KErrNone ) + { + iLog->Log(_L("FetchLeafL: ERROR Reading outfile argument: 0x%X"), i ); + //return i; + } + else + { + iSaveFileName = datafile; + iLog->Log( _L( " Save file nameis '%S'" ), &iSaveFileName ); + iResultsFunction = SaveDataL; + } + + SetURIL(nodename) ; + + /* + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + */ + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->FetchLeafObjectL( *iURI, *luid, KEmptyType, 7, 8 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("FetchLeafL: FetchLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("FetchLeafL: FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); + CleanupStack::PopAndDestroy( ); // nodename + iLog->Log( _L("FetchLeafL Test Complete with status %d" ), ret ); + return ret; + } + + +TInt Cdmatest::ExecuteLeafL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + TPtrC8 data( GetNextStringLC ( aItem, _L("Input file") )->Des() ) ; + + SetURIL(nodename) ; + + /* + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + TDataType type; + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("ExecuteLeafL: ExecuteCommandL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("ExecuteLeafL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + + iLog->Log( _L("ExecuteLeafL: Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::CompleteCommandsL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->CompleteOutstandingCmdsL() ); + delete iAdapter; + iAdapter = NULL; + return err; + } +TInt Cdmatest::DeleteObjectL( CStifItemParser& aItem ) +{ + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("DeleteObjectL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + + SetURIL(nodename) ; + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + Adapter()->DeleteObjectL( *iURI, *luid, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("DeleteNode: DeleteObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("DeleteNode: DeleteObjectL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); + + return ret; +} + +TInt Cdmatest::ExecuteLeafDataL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + TPtrC8 data( GetNextStringLC ( aItem, _L("Input data") )->Des() ) ; + + SetURIL(nodename) ; + + /* + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + HBufC8 *luid = GetLuidAllocLC( *iURI ); + Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + + +HBufC8 *Cdmatest::LoadFileLC( const TDesC &aFileName, TDataType &aType ) + { + RFs fs ; + LEAVE_IF_ERROR( fs.Connect(), _L( "Could not connect fileserver: %d" ) ); + + CleanupClosePushL( fs ); + RFile file ; + LEAVE_IF_ERROR( file.Open(fs,aFileName,EFileRead), _L( "Could not open file: %d" ) ); + + + + CleanupClosePushL( file ); + TInt dataSize ; + LEAVE_IF_ERROR( file.Size( dataSize ), _L( "Could not get file size: %d" ) ); + HBufC8 *nodedata = HBufC8::NewL ( dataSize ); + CleanupStack::PushL( nodedata ); + TPtr8 nodedataptr( nodedata->Des() ); + LEAVE_IF_ERROR( file.Read( nodedataptr ), _L( "Could not read file: %d" ) ); + TDataRecognitionResult aDataType; + RApaLsSession ls ; + TInt err( ls.Connect() ); + if ( err == KErrNone ) + { + CleanupClosePushL( ls ); + err = ls.RecognizeData(aFileName, nodedataptr, aDataType) ; + if ( err == KErrNone ) + { + aType = aDataType.iDataType; + } + else + { + iLog->Log( _L("LoadFileLC: WARNING Failed to get type: %d" ), err ); + aType = TDataType( KDefaultType ); + } + CleanupStack::PopAndDestroy( &ls ); + } + else + { + iLog->Log( _L("LoadFileLC: WARNING Failed to connect rapalssession: %d" ), err ); + } + CleanupStack::Pop( nodedata ); + CleanupStack::PopAndDestroy( &file ); + CleanupStack::PopAndDestroy( &fs ); + CleanupStack::PushL( nodedata ); + return nodedata ; + } + +HBufC8 *Cdmatest::LoadFileLC( const TDesC8 &aFileName, TDataType &aType ) + { + TFileName fn ; + fn.Copy( aFileName ); + return LoadFileLC( fn, aType ); + } + + +void Cdmatest::SaveDataL( TInt /*aResultsRef*/, CBufBase& aObject, + const TDesC8& aType ) + { + iLog->Log( _L8( "Saving data of type: '%S'" ), &aType ); + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFile file; + User::LeaveIfError( file.Replace ( fs, iSaveFileName, EFileWrite ) ); + CleanupClosePushL( file ); + TPtrC8 p( aObject.Ptr( 0 ) ); + User::LeaveIfError( file.Write( p ) ); + CleanupStack::PopAndDestroy( 2 ); // file, fs + } + + + +void Cdmatest::FetchNodeResultsL( TInt /*aResultsRef*/, CBufBase& aObject, + const TDesC8& /*aType*/ ) + { + TPtrC8 ptr( aObject.Ptr( 0 ) ); + iLog->Log( _L8("FetchNodeResultsL for '%S': '%S'" ), iURI, &ptr ); + + if ( ptr.Length() > 0 ) + { + TPtrC8 last( LastURISeg( ptr ) ); + HBufC8 *oldUri = HBufC8::NewL( iURI->Length() ); + (*oldUri) = *iURI; + do + { + iLog->Log ( _L8( " Node: '%S' "), &last ); + HBufC8 *nUri = HBufC8::NewLC( oldUri->Length() + 1 + last.Length() ); + nUri->Des().Copy( *oldUri ) ; + nUri->Des().Append( '/' ); + nUri->Des().Append( last ); + + SetURIL( nUri ); + //iResultsFunction = FetchNodeResultsL; + + //TPtrC8 parentURI(RemoveLastSeg(*nUri)); + //HBufC8 *luid = GetLuidAllocLC( parentURI ); + CleanupStack::Pop( nUri ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + Adapter()->ChildURIListL( *nUri, KNullDesC8, *iEmptyMappingInfoArray, 4, 5 );//Dipak + + CleanupStack::PopAndDestroy( luid ); + + ptr.Set( RemoveLastURISeg( ptr ) ); + last.Set( LastURISeg( ptr ) ); + + } + while (last != KNullDesC8); + } + + } + + + +TPtrC8 Cdmatest::LastURISeg( const TDesC8& aURI ) + { + TInt i; + for( i = aURI.Length() - 1; i >= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + if( i == 0 ) + { + return aURI; + } + else + { + return aURI.Mid( i+1 ); + } + } +TPtrC8 Cdmatest::RemoveLastSeg(const TDesC8& aURI) + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMUriSeparator) + { + break; + } + } + + if(i>0) + { + return aURI.Left(i); + } + else + { + return KNullDesC8(); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 Cdmatest::RemoveLastURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 Cdmatest::RemoveLastURISeg( const TDesC8& aURI ) + { + TInt i; + for ( i = aURI.Length() - 1; i >= 0 ; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if ( i > -1 ) + { + return aURI.Left( i ); + } + else + { + return KNullDesC8(); + } + } + +TPtrC Cdmatest::RemoveLastURISeg( const TDesC& aURI ) + { + TInt i; + for ( i = aURI.Length() - 1; i >= 0 ; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if ( i > -1 ) + { + return aURI.Left( i ); + } + else + + { + return KNullDesC(); + } + } + +void Cdmatest::SetURIL( const TDesC& aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = HBufC8::NewL( aURI.Length() ) ; + iURI->Des().Copy( aURI ); + } + +void Cdmatest::SetURIL( const TDesC8& aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = HBufC8::NewL( aURI.Length() ) ; + iURI->Des().Copy( aURI ); + } + +void Cdmatest::SetURIL( HBufC8* aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = aURI ; + } + + + +void Cdmatest::SetResultsL( + TInt aResultsRef, + CBufBase& aObject, + const TDesC8& aType ) + { + TPtrC8 ptr( aObject.Ptr(0) ); + iLog->Log( _L8( "SetResults, ref=%d, object='%S', type='%S'" ), aResultsRef, &ptr, &aType ); + if ( iResultsFunction ) + { + (this->*iResultsFunction)( aResultsRef, aObject, aType ); + iResultsFunction = NULL ; + } + + } + + +void Cdmatest::SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) + { + iStatus = aErrorCode ; + iLog->Log( _L( "SetStatusL, ref=%d, code=%d" ), aStatusRef, aErrorCode ); + + + } + +void Cdmatest::SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ) + { + iLog->Log( _L8( "SetMappingL, aURI='%s', aLUID='%s'" ), aURI.Ptr(), aLUID.Ptr() ); + + iMappingTable.Append(TMapping( aURI, aLUID ) ) ; + } + +HBufC8* Cdmatest::GetLuidAllocL( const TDesC8& aURI ) + { + iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); + HBufC8 *res = NULL; + for( TInt i(0); i < iMappingTable.Count(); i++ ) + { + if ( aURI == iMappingTable[i].iURI ) + { + res = iMappingTable[i].iLuid.AllocL(); + } + } + if ( res == NULL ) + { + res = HBufC8::NewL( 0 ); + } + iLog->Log( _L8( "GetLuidAllocL, response='%S'" ), res ); + return res; + } + +HBufC8* Cdmatest::GetLuidAllocLC( const TDesC8& aURI ) + { + iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); + HBufC8 *res = NULL; + for( TInt i(0); i < iMappingTable.Count(); i++ ) + { + if ( aURI == iMappingTable[i].iURI ) + { + res = iMappingTable[i].iLuid.AllocLC(); + break; + } + } + if ( res == NULL ) + { + res = HBufC8::NewLC( 0 ); + } + iLog->Log( _L8( "GetLuidAllocLC, response='%S'" ), res ); + return res ; + } + +#ifdef __TARM_SYMBIAN_CONVERGENCY + +void Cdmatest::GetMappingInfoListL( const TDesC8& /*aURI*/, + CArrayFix& /*aSegmentList*/ ) + { + // do nothing + } + +#else +// nothing +#endif +//*************************************************************************** +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/src/syncmldm12test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/src/syncmldm12test.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include "syncmldm12Test.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Csyncmldm12Test::Csyncmldm12Test +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +/*Csyncmldm12Test::Csyncmldm12Test( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + }*/ +Csyncmldm12Test::Csyncmldm12Test( CTestModuleIf& aTestModuleIf ) + : Cdmatest( aTestModuleIf, KAdapterUid ) + { + } +// ----------------------------------------------------------------------------- +// Csyncmldm12Test::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Csyncmldm12Test::ConstructL() + { +/* iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse );*///Commented the Part for syncmldm12Test Dipak + iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile ); + + iLog->Log( _L( "Loading Adapter" ) ); + + Cdmatest::ConstructL(); + + } + +// ----------------------------------------------------------------------------- +// Csyncmldm12Test::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Csyncmldm12Test* Csyncmldm12Test::NewL( + CTestModuleIf& aTestModuleIf ) + { + Csyncmldm12Test* self = new (ELeave) Csyncmldm12Test( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Csyncmldm12Test::~Csyncmldm12Test() + { + + // Delete resources allocated from test methods +// Delete(); + + // Delete logger +// delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) Csyncmldm12Test::NewL( aTestModuleIf ); + + } + + + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmldm12/tsrc/src/syncmldm12testBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmldm12/tsrc/src/syncmldm12testBlocks.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include +#include +#include "syncmldm12Test.h" +#include +#include +#include + + +//using namespace NApplicationManagement;//Dipak + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Csyncmldm12Test::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Csyncmldm12Test::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Csyncmldm12Test::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Csyncmldm12Test::RunMethodL( + CStifItemParser& aItem ) + { + + TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "DDFStructure", Csyncmldm12Test::DDFStructureL), + ENTRY( "FetchNode", Csyncmldm12Test::FetchNodeL ), + ENTRY( "FetchLeaf", Csyncmldm12Test::FetchLeafL ), + ENTRY( "AddNode", Csyncmldm12Test::AddNodeL ), + ENTRY( "UpdateLeaf", Csyncmldm12Test::UpdateLeafL ), + ENTRY( "UpdateLeafData", Csyncmldm12Test::UpdateLeafDataL ), + ENTRY( "Execute", Csyncmldm12Test::ExecuteLeafL ), + ENTRY( "ExecuteData", Csyncmldm12Test::ExecuteLeafDataL ), + ENTRY( "DeleteNode", Csyncmldm12Test::DeleteObjectL ), + ENTRY( "StartAtomic", Csyncmldm12Test::StartAtomicL), + ENTRY( "CommitAtomic", Csyncmldm12Test::CommitAtomicL), + ENTRY( "RollbackAtomic", Csyncmldm12Test::RollbackAtomicL), + ENTRY( "CompleteCommands", Csyncmldm12Test::CompleteCommandsL), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + + +HBufC8 *Csyncmldm12Test::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) + { + TPtrC nodename; + nodename.Set( KNullDesC ); + + TInt i( aItem.GetNextString ( nodename ) ); + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); + } + else + { + iLog->Log( _L("%S: %S"), &aName, &nodename); + } + + HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; + buf->Des().Copy( nodename ); + + return buf; + } + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/bld/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: build info file for SyncML DS settings adapter +* +*/ + + + + +PRJ_MMPFILES +./nsmldssettingsadapter.mmp + + + + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/bld/nsmldssettingsadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/bld/nsmldssettingsadapter.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DS-settings +* +*/ + + + + +#include "defaultcaps.hrh" +#include + + +TARGET nsmldssettingsadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F6DE7 +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc ../../inc + +SOURCE NSmlDsSettingsAdapter.cpp + + +START RESOURCE nsmldssettingsadapter.rss +LANGUAGE_IDS +END + + +LIBRARY euser.lib ecom.lib charconv.lib commdb.lib nsmldebug.lib +LIBRARY nsmldmiapmatcher.lib +LIBRARY bafl.lib +LIBRARY syncmlclientapi.lib +LIBRARY nsmltransporthandler.lib + + +SMPSAFE +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/inc/NSmlDSSettingsAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/inc/NSmlDSSettingsAdapter.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,974 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Device Management DS Settings adapter header file +* +*/ + + + + +#ifndef __NSMLDSSETTINGSADAPTER_H__ +#define __NSMLDSSETTINGSADAPTER_H__ + +// INCLUDES +#include //adapter interface +#include //DS Client API + +// CONSTANTS +const TInt KNSmlDSGranularity = 4; +const TUint8 KNSmlDMColon = ':'; +const TUint8 KNSmlDMUriSeparator = '/'; + +//DDF accepted DS-fieldnames for DS-profile +_LIT8( KNSmlDdfRoot, "SyncML"); +_LIT8( KNSmlDdfAddr, "Addr" ); +_LIT8( KNSmlDdfAddrType, "AddrType" ); +_LIT8( KNSmlDdfPortNbr, "PortNbr" ); +_LIT8( KNSmlDdfName, "Name" ); + +_LIT8( KNSmlDdfDB, "DB" ); +_LIT8( KNSmlDdfCTType, "CTType" ); +_LIT( KNSmlDdfCTVer, "CTVer" ); +_LIT8( KNSmlDdfCTVerL, "CTVerL" ); + +_LIT8( KNSmlDdfRDBURI, "RDBURI" ); +_LIT8( KNSmlDdfLDBURI, "LDBURI" ); + +_LIT8( KNSmlDdfClientUserName, "ClientUserName" ); +_LIT8( KNSmlDdfClientPW, "ClientPW" ); +_LIT( KNSmlDdfClientNonce, "ClientNonce" ); +_LIT8( KNSmlDdfServerId, "ServerId" ); +_LIT8( KNSmlDdfHidden, "Hidden" ); + + +_LIT( KNSmlADdfAdapterId, "AdapterId" ); + +_LIT8( KNSmlDdfToNAPID, "ToNapID" ); +_LIT( KNSmlDdfAdapterType, "/DB/" ); + +//DDF DS-field descriptions +_LIT8( KNSmlDdfRootDescription, "DS-Settings DDF description"); +_LIT8( KNSmlDdfAddrDescription, "DS server address" ); +_LIT8( KNSmlDdfAddrTypeDescription, "Type of used DS server address" ); +_LIT8( KNSmlDdfPortNbrDescription, "DS Server port number" ); +_LIT8( KNSmlDdfNameDescription, "Displayable name for the management account" ); + +_LIT8( KNSmlDdfDBDescription, "DB node is parent to all Database objects" ); +_LIT( KNSmlDdfCTDescription, "CT node is parent to all Content objects" ); +_LIT8( KNSmlDdfCTTypeDescription, "CTType define supported media content of database" ); +_LIT( KNSmlDdfCTVerDescription, "CTVer node is a parent to all Content Version objects" ); +_LIT( KNSmlDdfCTVerLDescription, "CTVerL define version of supported contenttype" ); + +_LIT8( KNSmlDdfRDBURIDescription, "The relative or absolute URI of remote database" ); +_LIT8( KNSmlDdfLDBURIDescription, "The relative or absolute URI of local database" ); + +_LIT8( KNSmlDdfClientUserNameDescription, "DS username" ); +_LIT8( KNSmlDdfServerIdDescription, "Server identifier" ); +_LIT8( KNSmlDdfClientPWDescription, "A password or secret to authenticate to the server" ); +_LIT8( KNSmlDdfToNAPIDDescription, "Logical reference to connectivity information" ); +_LIT8( KNSmlDdfHiddenDescription, "Hidden profile (not shown on UI)" ); + +_LIT8( KNSmlBufExe, "BufExe" ); + +//Default data values +_LIT( KNSmlDefName, "DSAdapterIns" ); +_LIT8( KNSmlDefDSAcc, "DSAcc" ); +_LIT8( KNSmlDSStart, "SyncML/DSAcc/DSId" ); +_LIT( KNSmlDSStartDB, "/DB/" ); +_LIT( KNSmlDefDSIAP, "AP" ); +_LIT8( KNSmlIAPId, "NSmlIapId" ); +_LIT8( KSegmDSAcc2, "CTType/RDBURI/LDBURI" ); + +_LIT8( KNSmlDSSettingsHTTP, "http://" ); +_LIT8( KNSmlDSSettingsHTTPS, "https://" ); +const TInt KNSmlDSSettingsHTTPPort = 80; +const TInt KNSmlDSSettingsHTTPSPort = 443; +_LIT8( KNSmlDSUriDotSlash, "./"); +_LIT8( KNSmlDSSlash, "/"); +_LIT8(KVersion, "1.1"); +_LIT8( KMimeType, "text/plain" ); +_LIT8( KDSSettingsTitle, "DS-settings title" ); + +_LIT8( KDBUri1, "SyncML/DSAcc/*/DB/*" ); +_LIT8( KDSAccMatch, "SyncML/DSAcc/*" ); +_LIT8( KDSAccMatch2, "SyncML/DSAcc/*/*" ); +_LIT8( KDSDBMatch, "SyncML/DSAcc/*/DB/*" ); +_LIT8( KDSDBMatch2, "SyncML/DSAcc/*/DB" ); +_LIT8( KSegmDSAcc,"Addr/AddrType/PortNbr/Name/DB/ClientUserName/ClientPW/ToNapID/ServerId" ); +_LIT8( KDSDBAddMatch, "*DSAcc/*/DB/*" ); +_LIT8( KDSDBAddMatch2, "*DSAcc/*/DB/*/*" ); +_LIT8( KDSDBAddMatch3, "*DSAcc/*/DB" ); + +_LIT8( KCTTypeMatch, "*/CTType*" ); +_LIT8( KRDBUriMatch, "*/RDBURI*" ); +_LIT8( KLDBUriMatch, "*/LDBURI*" ); + +_LIT8( KDummyTxt, "/Dummy" ); +_LIT8( KFormat, "%d" ); +_LIT8( KDSAcc1, "SyncML/DSAcc" ); +_LIT8( Kprev,"CTId" ); +_LIT8( Kprev2, "/CTId" ); +_LIT8( KDSprev,"DSId" ); + + +// DATA TYPES +enum TNSmlDSFieldType + { + EStr, + EInt, + EParam, + EWrong + }; + +enum TNSmlDSLeafType + { + EDSDelete, + EDSUnset + }; + +enum TNSmlDSProfileDataID + { + EProfileName, + EProfileIAPId, + EProfileMediumType, + EProfileSyncServerUsername, + EProfileSyncServerPassword, + EProfileURL, + EProfilePort, + EProfileServerId, + EHiddenProfile, + ESyncAccepted + }; + +enum TNSmlDSMediumType + { + ENone, + EHttp, + EWsp, + EObex + }; + +struct TNSmlDSAddElement + { + HBufC8 *iUri; + HBufC8 *iData; + TInt iStatusRef; + TBool iLeaf; + TBool iDone; + }; + +struct TNSmlDSBufferElement + { + CArrayFixFlat *iNodeBuf; + HBufC8* iMappingName; + HBufC8* iName; + TBool iExecuted; + TInt iLuid; + }; + +// FORWARD DECLARATIONS +class CNSmlDSSettingsAdapter; + +/** +* CNSmlDSSettingsAdapter class +* Contains the whole implementation of the Device Management DS settings adapter. +* +* @lib nsmldssettingsadapter.dll +*/ +class CNSmlDSSettingsAdapter : public CSmlDmAdapter + { + public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CNSmlDSSettingsAdapter* NewL(MSmlDmCallback* aDmCallback ); + static CNSmlDSSettingsAdapter* NewLC(MSmlDmCallback* aDmCallback ); + + void ConstructL(); + + /** + * Destructor. + */ + virtual ~CNSmlDSSettingsAdapter(); + + public: // Functions from base classes + + /** + * From CSmlDmAdapter DDFVersionL returns current version of the DDF. + * @since Series60_3.0 + * @param aVersion DDF version of the adapter. + * @return none + */ + void DDFVersionL( CBufBase& aVersion ); + + /** + * From CSmlDmAdapter DDFStructureL for filling the DDF structure of the adapter. + * @since Series60_3.0 + * @param aDDF Reference to root object. + * @return none + */ + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + /** + * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces + * data in existing leaf objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aObject Data of the object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter DeleteObjectL deletes an object and its child objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter FetchLeafObjectL fetches data of a leaf object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter ChildURIListL fetches URI list. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aPreviousURISegmentList URI list with mapping LUID information + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef ); + + /** + * From CSmlDmAdapter AddNodeObjectL adds node object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aParentLUID LUID of the parent object + * @param aStatusRef Reference to correct command + * @return none + */ + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces + * data in existing leaf objects. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream Data of the object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter FetchLeafObjectSizeL fetches the size of a leaf object. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aType MIME type of the object + * @param aResultsRef Reference to correct results + * @param aStatusRef Reference to correct command + * @return none + */ + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aArgument Argument for the command + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aStream Argument for the command + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function implements execute command. + * @since Series60_3.0 + * @param aTargetURI Target URI for the command + * @param aTargetLUID LUID of the target object + * @param aSourceURI Source URI for the command + * @param aSourceLUID LUID of the source object + * @param aType MIME type of the object + * @param aStatusRef Reference to correct command + * @return none + */ + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + + /** + * From CSmlDmAdapter The function indicates start of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void StartAtomicL(); + + /** + * From CSmlDmAdapter The function indicates successful end of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void CommitAtomicL(); + + /** + * From CSmlDmAdapter The function indicates unsuccessful end of Atomic command. + * @since Series60_3.0 + * @param none + * @return none + */ + void RollbackAtomicL(); + + /** + * From CSmlDmAdapter Returns ETrue if adapter supports streaming otherwise EFalse. + * @since Series60_3.0 + * @param aItemSize Size limit for stream usage. + * @return ETrue or EFalse + */ + TBool StreamingSupport( TInt& aItemSize ); + + /** + * From CSmlDmAdapter Called when stream returned from UpdateLeafObjectL or + * ExecuteCommandL has been written to and committed. + * @since Series60_3.0 + * @param none + * @return none + */ + void StreamCommittedL(); + + /** + * From CSmlDmAdapter The function tells the adapter that all the commands of the message that + * can be passed to the adapter have now been passed. + * @since Series60_3.0 + * @param none + * @return none + */ + void CompleteOutstandingCmdsL(); + + private: + + /** + * C++ default constructor. + */ + CNSmlDSSettingsAdapter(); + CNSmlDSSettingsAdapter( TAny* aEcomArguments ); + + /** + * The function checks if field to be handled is valid. + * @param none + * @return ETrue if valid field otherwise EFalse. + */ + TBool AcceptDSField(); + + /** + * The function returns enum value for a field to be handled. + * @param none + * @return enum value for a field to be handled. + */ + TInt GetDSField() const; + + /** + * The function checks if field type to be handled is valid. + * @param none + * @return enum value for a field type. + */ + TInt GetDSFieldTypeL() const; + + /** + * The function converts LUID to integer. + * @param aLUID LUID data to be converted. + * @return Integer value for a LUID. + */ + TInt IntLUID(const TDesC8& aLUID); + + /** + * The function converts data to integer and returns it. + * @param aObject Data object to be converted. + * @return Integer value for an object. + */ + TInt GetIntObject( const TDesC8& aObject ); + + /** + * The function converts data to integer and returns it. + * @param aObject Data object to be converted. + * @return 16-bit integer value for an object. + */ + TInt GetIntObject16( const TDesC& aObject ); + + /** + * The function stores integer value to buffer and returns reference to it. + * @param aObject data to be stored to buffer. + * @return reference to data buffer. + */ + TDesC8& SetIntObjectLC( const TInt& aObject ); + + /** + * The function checks if data length is valid. + * @param aProfileItem Field / Leaf ID to be handled. + * @param aSource Data to be handled. + * @return ETrue if data length is not valid otherwise EFalse. + */ + TBool NotValidStrLenght( const TInt& aProfileItem, const TDesC8& aSource ); + + /** + * The function finds out the last element of the uri. + * @param aSource Uri object that contains all elements. + * @return KErrNone if successful. + */ + TInt SetField( const TDesC8& aSource ); + + /** + * The function converts 16-bit data to 8-bit and returns reference to it. + * @param aSource Reference data to be converted. + * @return Reference to 8-bit data buffer. + */ + TDesC8& ConvertTo8LC( const TDesC& aSource ); + + /** + * The function converts 8-bit data to 16-bit and returns reference to it. + * @param aSource Reference data to be converted. + * @return Reference to 16-bit data buffer. + */ + TDesC16& ConvertTo16LC( const TDesC8& aSource ); + + /** + * The function adds new dataprovider for a profile. + * @param aIntLUID Profile integer LUID. + * @param aMIMEType Requested MIME type of the data provider. + * @param aDataProviderId Reference to object where new data provider id to be saved. + * @return KErrNone if successful otherwise error code. + */ + TInt AddNewDataProviderL( TInt aIntLUID, const TDesC8& aMIMEType, TInt& aDataProviderId ); + + /** + * The function gets the uri for profile IAP ID. + * @param aLUID Profile integer LUID. + * @param aObject Reference to object where URI to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetToNAPIDL( const TInt aLUID, CBufBase& aObject ); + + /** + * The function sets the profile IAP id based on URI. + * @param aLUID Profile integer LUID. + * @param aObject Access point URI. + * @return KErrNone if successful otherwise error code. + */ + TInt SetToNAPIDL( const TInt aLUID, const TDesC8& aObject ); + + /** + * The function sets the new node to buffer (in case of content type). + * @param aURI URI of the node. + * @param aParentLUID LUID for the parent object. + * @param aStatusRef Command status reply reference. + * @return none + */ + void AddNodeBufferL( const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef ); + + /** + * The function sets new leaf object to buffer (in case DB level object). + * @param aURI URI of the node. + * @param aParentLUID LUID for the parent object. + * @param aStatusRef Command status reply reference. + * @return none + */ + void AddLeafBufferL( const TDesC8& aURI,const TDesC8& aParentLUID, + const TDesC8& aObject, const TInt aStatusRef ); + + /** + * The function finds out the last segment of the URI. + * @param aURI URI to be handled. + * @return Pointer to last URI segment. + */ + TPtrC8 LastURISeg( const TDesC8& aURI ); + + /** + * The function removes the last segment of the URI. + * @param aURI URI to be handled. + * @return Pointer to recontructed URI. + */ + TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); + + /** + * The function executes command from the buffer based on URI. + * @param aURI URI to be handled first. + * @return none + */ + void ExecuteBufferL( const TDesC8& aURI ); + + /** + * The function gets the profile Id (LUID) for given URI. + * @param aURI URI which LUID to be fetched. + * @return LUID for the URI. + */ + TInt GetProfileIdFromURIL( const TDesC8& aURI ); + + /** + * The function gets the MIME type for given data provider. + * @param aDataProviderId Data provider ID. + * @param aProfileLUID Profile LUID. + * @param aObject Reference where fetched MIME type to be stored. + * @return KErrNone if successful otherwise error cose. + */ + TInt GetContentTypeL( const TInt aDataProviderId, const TInt aProfileLUID, + CBufBase*& aObject ); + + /** + * The function find out the buffer index for given URI. + * @param aURI URI which position in the buffer to be solved. + * @return Buffer position for given URI. If not found value is -1. + */ + TInt GetBufferIndex( const TDesC8& aURI ); + + /** + * The function sets the LUID to buffer for given URI. + * @param aURI URI which position in the buffer to be solved. + * @param aLUID LUID for an URI. + * @return Value > 0 if URI found, otherwise value is 0. + */ + TInt SetBufferLUID( const TDesC8& aURI, const TInt aLUID ); + + /** + * The function find out the port number from URL and stores it to aPort. + * @param aRealURI Reference data to be containing the whole URI. + * @param aPort Reference variable where port number will be stored. + * @return KErrNone if successful otherwise KErrNotFound. + */ + TInt ParseUri( const TDesC8& aRealURI, TInt& aPort ); + + /** + * The function checks if requested profile ID exits. + * @param aIntLUID Integer value for a LUID of the profile. + * @return ETrue if profile exits otherwise EFalse. + */ + TBool FindProfileIdL( const TInt aIntLUID ); + + /** + * The function gets the profile ID from Client API. + * @param aIntLUID Integer value for a LUID of the profile. + * @param aProfileID Reference to object where profile ID to be stored. + * @return KErrNone if successful otherwise KErrNotFound. + */ + TInt GetProfileIdentifierL( const TInt aIntLUID, TInt& aProfileID ); + + /** + * The function gets the profile data acording to URI leaf. + * @param aIntLUID Profile ID. + * @param aObject Reference where fetched data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetDSFieldDataL( const TInt aIntLUID, CBufBase*& aObject ); + + /** + * The function gets the profile medium type value. + * @param aIntLUID Reference where data to be stored. + * @return Medium type for profile connection. + */ + TInt GetProfileConnectiontypeL( const TInt aIntLUID ); + + /** + * The function gets the profile Addr leaf value. + * @param aIntLUID Profile ID. + * @param aURL Reference where fetched data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileServerURLL( const TInt aIntLUID, CBufBase*& aURL ); + + /** + * The function gets the profile user name value. + * @param aIntLUID Profile ID. + * @param aUserName Reference where fetched data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileUserNameL( const TInt aIntLUID, CBufBase*& aUserName ); + + /** + * The function gets the profile user name value. + * @param aIntLUID Profile ID. + * @param aServerId Reference where fetched data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileServerIdL( const TInt aIntLUID, CBufBase*& aServerId ); + + /** + * The function gets the profile IAP Id (ToNAPID) value. + * @param aIntLUID Profile ID. + * @param aIAPid Reference where fetched data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileIAPIdL( const TInt aIntLUID, TInt& aIAPid ); + + /** + * The function gets the profile Name value. + * @param aIntLUID Profile ID. + * @param aDisplayName Reference where fetched data to be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt GetProfileDisplayNameL( const TInt aIntLUID, CBufBase*& aDisplayName ); + + /** + * The function creates new DM profile. + * @param aPID Reference to variable where new profile Id will be stored. + * @return KErrNone if successful otherwise error code. + */ + TInt CreateNewProfileL( TInt& aPID ); + + /** + * The function sets the profile Addr leaf value. + * @param aPID Profile ID. + * @param aObj Data to be stored for a profile. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileServerURIL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function sets the profile Name leaf value. + * @param aPID Profile ID. + * @param aObj Data to be stored for a profile. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileDisplayNameL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function sets the profile UserName leaf value. + * @param aPID Profile ID. + * @param aObj Data to be stored for a profile. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileUserNameL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function sets the profile UserName leaf value. + * @param aPID Profile ID. + * @param aObj Data to be stored for a profile. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileServerIdL( const TInt aPID, const TDesC8& aObj ); + + /** + * The function sets the profile password leaf value. + * @param aPID Profile ID. + * @param aObj Data to be stored for a profile. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfilePasswordL( const TInt aPID, const TDesC8& aObj ); + + /** + * General function that checks which leaf to be handled based on field id. + * @param aPID Profile ID. + * @param aObj Data to be stored for a profile. + * @param aFieldID Internal value for a leaf to be handled. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileStrValueL( const TInt aPID, const TDesC8& aObj, + const TInt aFieldID ); + + /** + * The function deletes the profile data. + * @param aPID Profile ID. + * @return KErrNone if successful otherwise error code. + */ + TInt DeleteProfileL( const TInt aPID ); + + /** + * The function creates list of the content types that profile supports. + * @param aURI URI that contains content types. + * @param aPID Profile ID. + * @param aCurrentURISegmentList Reference to list to be filled. + * @param aPreviousURISegmentList Previous, existing list for content types. + * @return KErrNone if successful otherwise error code. + */ + TInt CreateURITaskSegmentListL( const TDesC8& aURI, const TInt aPID, + CBufBase*& aCurrentURISegmentList, + const CArrayFix& aPreviousURISegmentList ); + + /** + * The function creates list of the existing profiles. + * @param aCurrentURISegmentList Reference to list to be filled. + * @param aPreviousURISegmentList Previous, existing list for profiles. + * @return KErrNone if successful otherwise error code. + */ + TInt CreateURIProfileSegmentListL( CBufBase*& aCurrentURISegmentList, + const CArrayFix& aPreviousURISegmentList ); + + /** + * The function opens the server session and profile via client API. + * @param aIntLUID Integer value for a LUID of the profile. + * @param aMode Read or Read and Write mode for a profile data. + * @return KErrNone if successful otherwise KErrNotFound. + */ + TInt OpenSyncSessionAndDSProfileL( const TInt aIntLUID, TSmlOpenMode aMode ); + + /** + * The function closes the DS profile session. + * @param none. + * @return none. + */ + void CloseDSProfile(); + + /** + * The function checks if profile has the requested task id. + * @param aProfLUID Integer value for a LUID of the profile. + * @param aDataProviderId DataProvider id to be searched. + * @return ETrue if task found otherwise EFalse. + */ + TBool FindTaskIDL( const TInt aProfLUID, const TInt aDataProviderId ); + + /** + * The function deletes task for given profile. + * @param aLUID Integer value for a LUID of the profile. + * @param aDataProviderId DataProvider id to be searched. + * @return KErrNone if successful otherwise error code. + */ + TInt DeleteTaskByIDL( const TInt aLUID, const TInt aDataProviderId ); + + /** + * The function gets the LDBURI (local datastore) for given profile. + * @param aDataProviderId DataProvider id to be searched. + * @param aProfileLUID Profile Id. + * @param aObject Reference to object where fetched value to be saved. + * @return KErrNone if successful otherwise error code. + */ + TInt GetClientDataSourceL( const TInt aDataProviderId, const TInt aProfileLUID, + CBufBase*& aObject ); + /** + * The function gets the RDBURI (remote datastore) for given profile. + * @param aDataProviderId DataProvider id to be searched. + * @param aProfileLUID Profile Id. + * @param aObject Reference to object where fetched value to be saved. + * @return KErrNone if successful otherwise error code. + */ + TInt GetServerDataSourceL( const TInt aDataProviderId, const TInt aProfileLUID, + CBufBase*& aObject ); + + /** + * The function replaces the LDBURI or RDBURI values for given profile. + * @param aProfileLUID Profile Id. + * @param aDataProviderId DataProvider id to be searched. + * @param aObject Data to be stored. + * @param aField Field Id to be handled. + * @return KErrNone if successful otherwise error code. + */ + TInt UpdateDataSourceL( const TInt aProfileLUID, const TInt aDataProviderId, + const TDesC8& aObject, const HBufC8& aField ); + + /** + * The function fetches the object (leaf) data based on given URI. + * @param aURI URI of the object + * @param aLUID LUID of the object + * @param aObj Reference to object where fetched data to be saved. + * @param aStatusRef Reference to correct command + * @return none + */ + TInt FetchObjectL( const TDesC8& aURI, const TDesC8& aLUID, CBufBase*& aObj, + const TInt aStatusRef ); + + /** + * The function fills the node info. + * @param aNode Reference to node or leaf which info to be filled. + * @param aAccTypes Access rights for a leaf / node. + * @param aOccurrence Occurance of the node / leaf. + * @param aScope Scope (dynamic / permanent) of the leaf / node. + * @param aFormat Data format of the leaf / node. + * @param aDescription Description of the node / leaf. + * @param aDefaultValue Default value for a leaf or node. + * @param aMimeType MIME type for a leaf / node. + * @return none + */ + void FillNodeInfoL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription, + const TDesC8& aDefaultValue, const TDesC8& aMimeType ); + + /** + * The function set's the address type / medium type value for a profile. + * @param aLUID LUID for a profile. + * @param aIntObj Address type value. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileAddrTypeL( const TInt aLUID, const TInt aIntObj ); + + /** + * The function adds port number to address URL. + * @param aLUID Profile ID. + * @param aPort Reference to port number data. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileConnectionPortNrL( const TInt aLUID, const TDesC8& aPort ); + + /** + * The function adds port number to address URL. + * @param aSrvURI Original address URI. + * @param aNewURI New URI when port number has been added or deleted. + * @param aPort Reference to port number data. + * @return KErrNone if successful otherwise error code. + */ + void SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, + const TDesC8& aPort ); + + /** + * The function checks if MIME type allready exits. + * @param aLuid Profile LUID. + * @param aMimeType MIME type to be searched. + * @return ETrue if MIME type found else EFalse. + */ + TBool MimeTypeAllreadyExitsL( const TInt aLuid, const TDesC8& aMimeType ); + + /** + * The function sets the RDBURI (remote datastore) to memeber variable. + * @param aStore Value for a RDBURI. + * @return none. + */ + void SetRDBDataStore( const TDesC8& aStore ); + + /** + * The function sets the IAP Id value to profile connection data. + * @param aLuid Profile LUID. + * @param aIAPid Id for an IAP. + * @return KErrNone if successful otherwise error code. + */ + TInt SetProfileIAPIdL( const TInt aLUID, const TInt aIAPid ); + + /** + * The function gets UID for the profile medium type. + * @param aIntObj Profile LUID. + * @param aMediumType Requested medium type. + * @return none. + */ + void GetMediumTypeL(const TInt aIntObj, TSmlTransportId& aMediumType); + + /** + * The function checks if the URI is of format ./SyncML/DMAcc/DMId + * Example ./SyncML/DMAcc/DMId000 + * @param aURI aURI. + * @return true/false + */ + TBool IsDSAccUriFormatMatchPredefined(const TDesC8 & aURI); + + /** + * The function constructs ./SyncML/DMAcc/x nodes and + * returns the profile ID matching the aURI. + * @param aURI aURI. + * @return KErrNotFound/ProfileID + */ + + TInt ConstructTreeL(const TDesC8& aURI); + + /** + * The function extracts Syncml/DSAcc/x node from aURI + * @param aURI Syncml/DSAcc aURI. + * @return Syncml/DSAcc/x node. + */ + TPtrC8 GetDynamicDSNodeUri(const TDesC8& aURI); + + private: // Data + + // Callback interface for returning result or status + MSmlDmCallback* iCallBack; + // Client API session class + RSyncMLSession iSyncSession; + // Client API DS profile handling + RSyncMLDataSyncProfile iDSProfile; + + // Buffer for URI leaf element + HBufC8* iField; + // Pointer to buffer structure + CArrayFixFlat *iBuffer; + + // Buffer for URI leaf element + HBufC8* iPrevURI; + // Buffer for profile port number handling + HBufC8* iPortNbr; + // Buffer for profile remote data store handling + HBufC16* iRdbDataStore; + // Information about leaf command + TNSmlDSLeafType iLeafType; + + // LUID to be handled + TInt iLUID; + // Parent LUID + TInt iParentLUID; + // For handling profile medium type + TInt iObject; + // Previously handled LUID + TInt iPrevLUID; + + // Status information if session allready opened + TBool iSyncSessionOpen; + // Status of command was inside the module from buffer execution + TBool iBufferExecution; + + // buffered data for updating port number + HBufC8* iPortBuf; + TInt iPortBufLUID; + TInt iPortBufStatusRef; + }; + +#endif // __NSmlDSSETTINGSADAPTER_H__ + +// End of File \ No newline at end of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/src/NSmlDsSettingsAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/src/NSmlDsSettingsAdapter.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,3850 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DS-settings adapter +* +*/ + + + + +// INCLUDE FILES +#include "NSmlDSSettingsAdapter.h" +#include "nsmldebug.h" +#include "nsmlconstants.h" +#include "nsmldmconstants.h" +#include "nsmldmimpluids.h" +#include "nsmldmiapmatcher.h" + +#include +#include +#include +#include + +#ifndef __WINS__ +// This lowers the unnecessary compiler warning (armv5) to remark. +// "Warning: #174-D: expression has no effect..." is caused by +// DBG_ARGS8 macro in no-debug builds. +#pragma diag_remark 174 +#endif + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CNSmlDSSettingsAdapter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CNSmlDSSettingsAdapter* CNSmlDSSettingsAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::NewL(): begin"); + + CNSmlDSSettingsAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop(); + + _DBG_FILE("CNSmlDSSettingsAdapter::NewL(): end"); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDSSettingsAdapter::NewLC +// ----------------------------------------------------------------------------- +CNSmlDSSettingsAdapter* CNSmlDSSettingsAdapter::NewLC(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::NewLC(): begin"); + CNSmlDSSettingsAdapter* self = new ( ELeave ) CNSmlDSSettingsAdapter( aDmCallback ); + CleanupStack::PushL( self ); + self->iCallBack = aDmCallback; + + self->ConstructL(); + self->iLeafType = EDSUnset; + + _DBG_FILE("CNSmlDSSettingsAdapter::NewLC(): end"); + return self; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::CNSmlDSSettingsAdapter +//------------------------------------------------------------------------------ +CNSmlDSSettingsAdapter::CNSmlDSSettingsAdapter(TAny* aEcomArguments) : CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CNSmlDSSettingsAdapter::CNSmlDSSettingsAdapter(): begin"); + _DBG_FILE("CNSmlDSSettingsAdapter::CNSmlDSSettingsAdapter(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::~CNSmlDSSettingsAdapter() +// Class destructor. +//------------------------------------------------------------------------------ +CNSmlDSSettingsAdapter::~CNSmlDSSettingsAdapter() + { + _DBG_FILE("CNSmlDSSettingsAdapter::~CNSmlDSSettingsAdapter(): begin"); + delete iPrevURI; + delete iField; + + // Command buffer cleaning + if ( iBuffer ) + { + + for( TInt i=0; iCount(); i++ ) + { + delete iBuffer->At(i).iMappingName; + delete iBuffer->At(i).iName; + + for( TInt j=0; jAt(i).iNodeBuf->Count(); j++ ) + { + delete iBuffer->At(i).iNodeBuf->At(j).iUri; + if( iBuffer->At(i).iNodeBuf->At(j).iData ) + { + delete iBuffer->At(i).iNodeBuf->At(j).iData; + } + } + iBuffer->At(i).iNodeBuf->Reset(); + delete iBuffer->At(i).iNodeBuf; + } + + iBuffer->Reset(); + delete iBuffer; + } + + iDSProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + + delete iPortNbr; + delete iPortBuf; + delete iRdbDataStore; + + iBufferExecution = EFalse; + + iCallBack = 0; + + _DBG_FILE("CNSmlDSSettingsAdapter::~CNSmlDSSettingsAdapter(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::ConstructL +// Second phase constructor. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::ConstructL() + { + iField = HBufC8::NewL( KNSmlMaxURLLength ); + iPrevURI = HBufC8::NewL( KNSmlMaxURLLength ); + iRdbDataStore = HBufC16::NewL( KNSmlMaxRemoteNameLength ); +// +// Command buffering used for AddNode + AddLeaf +// + iBuffer = new ( ELeave ) CArrayFixFlat ( KNSmlDSGranularity ); + + iSyncSessionOpen = EFalse; + + iPortNbr = 0; + iBufferExecution = EFalse; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::DDFVersionL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::DDFVersionL(CBufBase& aVersion) + { + aVersion.InsertL( 0, KVersion ); + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::DDFStructureL +// Fills the DDF structure of the adapter. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::DDFStructureL(): begin"); + + TSmlDmAccessTypes *aclTypes = new ( ELeave ) TSmlDmAccessTypes(); + CleanupStack::PushL( aclTypes ); + + // Set Get as acceptable operations + aclTypes->SetGet(); + + MSmlDmDDFObject* ddfRoot = &aDDF; + MSmlDmDDFObject& ddf = ddfRoot->AddChildObjectL( KNSmlDdfRoot ); + FillNodeInfoL( ddf, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KNSmlDdfRootDescription, KNullDesC8, KMimeType ); + + ddf.SetDFTitleL( KDSSettingsTitle ); + + + MSmlDmDDFObject& nDSAcc = ddf.AddChildObjectL( KNSmlDefDSAcc ); + nDSAcc.SetOccurenceL( MSmlDmDDFObject::EOne ); + nDSAcc.SetDefaultValueL( KNullDesC8 ); + nDSAcc.SetScopeL( MSmlDmDDFObject::EPermanent ); + nDSAcc.SetAccessTypesL( *aclTypes ); + nDSAcc.SetDFFormatL( MSmlDmDDFObject::ENode ); +// +// Set rest acceptable operations for data itself +// + aclTypes->SetAdd(); + aclTypes->SetReplace(); + aclTypes->SetDelete(); + + TSmlDmAccessTypes aclTypesLimit; + aclTypesLimit.SetGet(); + aclTypesLimit.SetAdd(); + + TSmlDmAccessTypes aclTypesGet; + aclTypesGet.SetGet(); + + TSmlDmAccessTypes aclTypesNoGet; + aclTypesNoGet.SetReplace(); + aclTypesNoGet.SetAdd(); + aclTypesNoGet.SetDelete(); + + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetAdd(); + aclTypesNoDelete.SetReplace(); + + MSmlDmDDFObject& nProDDF = nDSAcc.AddChildObjectGroupL(); + FillNodeInfoL( nProDDF, *aclTypes, MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNullDesC8, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nAddrDDF = nProDDF.AddChildObjectL(KNSmlDdfAddr); // Addr + FillNodeInfoL( nAddrDDF, *aclTypes, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAddrDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nAddrTypeDDF = nProDDF.AddChildObjectL(KNSmlDdfAddrType); // AddrType + FillNodeInfoL( nAddrTypeDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nPortNbrDDF = nProDDF.AddChildObjectL(KNSmlDdfPortNbr);// PortNbr + FillNodeInfoL( nPortNbrDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, + KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nNameDDF = nProDDF.AddChildObjectL(KNSmlDdfName); // Name + FillNodeInfoL( nNameDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfNameDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nDBrootDDF = nProDDF.AddChildObjectL(KNSmlDdfDB); // DB + FillNodeInfoL( nDBrootDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNSmlDdfDBDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nDBDDF = nDBrootDDF.AddChildObjectGroupL(); // DB/ + FillNodeInfoL( nDBDDF, *aclTypes, MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNullDesC8, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nCTTypeDDF = nDBDDF.AddChildObjectL(KNSmlDdfCTType); // CTType + FillNodeInfoL( nCTTypeDDF, aclTypesLimit, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfCTTypeDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nRDBURIDDF = nDBDDF.AddChildObjectL(KNSmlDdfRDBURI); // RDBURI + FillNodeInfoL( nRDBURIDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfRDBURIDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nLDBURIDDF = nDBDDF.AddChildObjectL(KNSmlDdfLDBURI); // LDBURI + FillNodeInfoL( nLDBURIDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfLDBURIDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nClientUserNameDDF = nProDDF.AddChildObjectL(KNSmlDdfClientUserName); + FillNodeInfoL( nClientUserNameDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfClientUserNameDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nServerIdDDF = nProDDF.AddChildObjectL(KNSmlDdfServerId); + FillNodeInfoL( nServerIdDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nClientPWDDF = nProDDF.AddChildObjectL(KNSmlDdfClientPW);// ClientPW + FillNodeInfoL( nClientPWDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfClientPWDescription, KNullDesC8, KMimeType ); + + MSmlDmDDFObject& nToNAPIDDDF = nProDDF.AddChildObjectL(KNSmlDdfToNAPID);// ToNAPID + FillNodeInfoL( nToNAPIDDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfToNAPIDDescription, KNullDesC8, KMimeType ); + + CleanupStack::PopAndDestroy(); //aclTypes + _DBG_FILE("CNSmlDSSettingsAdapter::DDFStructureL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::UpdateLeafObjectL +// The function updates the leaf object data. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::UpdateLeafObjectL(): begin"); +// +// Check which field going to be handled +// + // Static node feature start + TInt profileLUID = -1; + if(aParentLUID.Length() == 0 ) + { + iLUID = -1; + if( IsDSAccUriFormatMatchPredefined(aURI) ) + { + iLUID = ConstructTreeL(aURI); + profileLUID = GetProfileIdFromURIL( aURI ); + } + if ((iLUID == 0 ) && (aURI.Match(_L8("SyncML/DSAcc/DSId*/DB/CTId*")) == KErrNone)) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + // Static node feature end + SetField( aURI ); + TInt fieldID = GetDSField(); + TInt fieldType = GetDSFieldTypeL(); + if ( fieldType == EWrong || fieldID < 0 ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::UpdateLeafObjectL(): EError end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + if(profileLUID == -1) + profileLUID = GetIntObject( aParentLUID ); + + if( profileLUID == -1 && fieldType != EParam ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::UpdateLeafObjectL( ): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + if ( fieldType == EParam ) + { + if( GetBufferIndex( aURI ) >= 0 && iBufferExecution == EFalse ) + { + AddLeafBufferL( aURI, aParentLUID, aObject, aStatusRef ); + return; + } + profileLUID = GetProfileIdFromURIL( aURI ); + if( FindProfileIdL( profileLUID ) == EFalse ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + if( iField->Compare( KNSmlDdfCTType ) == 0 ) + { + if( MimeTypeAllreadyExitsL( profileLUID, aObject ) ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + return; + } + if( aObject.Length() == 0 ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + } + } + + if( profileLUID != iParentLUID && fieldType != EParam ) + { + if( FindProfileIdL( profileLUID ) ) + { + iParentLUID = profileLUID; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + } + if ( fieldType == EStr || fieldType == EInt ) + { +// +// Check if Object length id valid +// + if( NotValidStrLenght( fieldID, aObject ) ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddLeafObjectL(): KErr length end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + return; + } + } + + TInt ret = 0; + if ( fieldType == EStr || fieldType == EInt ) + { + if( fieldID == EProfileURL ) + { + TInt num=0; + ret = ParseUri( aObject, num ); + if( ret == KErrNone ) + { + ret = SetProfileServerURIL( iParentLUID, aObject ); + if( ret != 0 ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddLeafObjectL(): URI set failed"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + } + else //if port number not included in URL + { + ret = SetProfileServerURIL( iParentLUID, aObject ); + if( ret != 0 ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddLeafObjectL(): URI set failed"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + } + + } + else if( fieldID == EProfileURL ) + { + ret = SetProfileServerURIL( iParentLUID, aObject ); + } + else if( fieldID == EProfileMediumType )//AddrType + { + if ( iLeafType == EDSDelete ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + iObject = GetIntObject( aObject ); + ret = SetProfileAddrTypeL( iParentLUID, iObject ); + } + else + { + ret = SetProfileStrValueL( iParentLUID, aObject, fieldID ); + } + } + else if ( fieldType == EParam ) + { + TInt sRet = KErrGeneral; + if( iField->Compare( KNSmlDdfCTType ) == 0 ) //Task Mime Type + { +// DBG_ARGS8(_S8("NEW: Object <%S>"), &aObject); + TInt dataProviderId(-1); + if(aParentLUID.Length() == 0 ) + { + dataProviderId = iLUID ; + } + else + { + dataProviderId = GetIntObject( aParentLUID ); + } + if( FindTaskIDL( profileLUID, dataProviderId ) == EFalse ) + { + sRet = AddNewDataProviderL( profileLUID, aObject, dataProviderId ); + } + else + { + sRet = KErrAlreadyExists; + } + if( sRet == KErrDiskFull ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EDiskFull ); + } + else if( sRet == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else if( sRet == KErrAlreadyExists ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + } + else if( sRet != KErrNone ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + else + { + TPtrC8 addDBURI = RemoveLastURISeg( aURI ); + TBuf8<16> dataProvider; + dataProvider.Num( dataProviderId ); + iCallBack->SetMappingL( addDBURI, dataProvider ); + SetBufferLUID( aURI,dataProviderId ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + + + } + return; + } + // + // Only database values handled + // +/* if( iField->Compare( KNSmlDdfLDBURI ) == 0 ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } +*/ + if( !(iField->Compare( KNSmlDdfLDBURI ) == 0) && + !(iField->Compare( KNSmlDdfRDBURI ) == 0) ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddLeafObjectL(): Param header end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + + + TInt dataProviderId(-1); + if(aParentLUID.Length() == 0 ) + { + dataProviderId = iLUID ; + } + else + { + dataProviderId = GetIntObject( aParentLUID ); + } + if( FindTaskIDL( profileLUID, dataProviderId ) ) + { + ret = UpdateDataSourceL( profileLUID, dataProviderId, aObject, *iField); + if( ret != KErrNone ) + { + ret = KErrGeneral; + } + TPtrC8 dbURI = RemoveLastURISeg( aURI ); + TBuf8<16> dataProvider; + dataProvider.Num( dataProviderId ); + iCallBack->SetMappingL( dbURI, dataProvider ); + } + else + { + ret = KErrNone; + //ret = KErrNotFound; + } + } + + if ( ret != KErrNone ) + { + if( ret == KErrDiskFull) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EDiskFull ); + } + else if( ret == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else if( ret == KErrArgument ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + } + else if( ret == KErrOverflow) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + else if ( fieldID == EProfilePort ) + { + // in case port is updated, save status ref to be used in + // CompleteOutstandingCmdsL (i.e. status not set yet) + iPortBufStatusRef = aStatusRef; + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + + _DBG_FILE("CNSmlDSSettingsAdapter::AddLeafObjectL(): end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::DeleteObjectL +// The function Deletes leaf object data or node data content. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): begin"); + iLUID = IntLUID( aLUID ); + if( aLUID.Length() == 0 ) + { + _DBG_FILE("CNSmlDSSettingsAdapter DELETE::DeleteObjectL( ): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + +// +// Check which field going to be handled +// + SetField( aURI ); + if ( iField->Compare( KNSmlDdfCTType ) == 0 + || iField->Compare( KNSmlDdfRDBURI ) == 0 + || iField->Compare( KNSmlDdfLDBURI ) == 0 + || iField->Compare( KNSmlDdfToNAPID ) == 0 ) + { + _DBG_FILE("CNSmlDSSettingsAdapter DELETE::DeleteObjectL( ): EError end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + TInt last = aURI.LocateReverse( KNSmlDMUriSeparator ); + TInt pos = aURI.Find( KNSmlDefDSAcc ); + + if(last - 5 == pos ) + { + iLUID = IntLUID( aLUID ); + if( !FindProfileIdL( iLUID ) ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): notfound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + else + { + TInt sRet = DeleteProfileL( iLUID ); + if( sRet!=KErrNone ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): ENotCommitted end"); + if( sRet == KErrNotFound ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else if( sRet == KErrInUse ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + return; + } + else + { + iPrevURI->Des().Format( KNullDesC8 ); + iPrevLUID = 0; + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): EOk end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + return; + } + } + } + else if( aURI.Match( KDBUri1 ) != KErrNotFound ) + { + iLUID = GetProfileIdFromURIL( aURI ); // Get profile Id for DB-level + if (iLUID < 0) + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): EError end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + + if( !FindProfileIdL( iLUID ) ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + TInt adapterId = GetIntObject( aLUID );//Get task ID + TInt retval = DeleteTaskByIDL( iLUID, adapterId ); + if( retval != KErrNone ) + { + if( retval == KErrNotFound ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): EError end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + else + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): EOk end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + return; + } + + iLUID = IntLUID( aLUID ); + + if ( iLUID != iParentLUID ) + { + if( !FindProfileIdL( iLUID ) ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + iParentLUID = iLUID; + } + + HBufC8* lObject = HBufC8::NewLC( 15 ); + lObject->Des().Format( KNullDesC8 ); + + iLeafType = EDSDelete; + UpdateLeafObjectL( aURI, aLUID, *lObject, KMimeType, aStatusRef ); + iLeafType = EDSUnset; + + _DBG_FILE("CNSmlDSSettingsAdapter::DeleteObjectL( ): end"); + CleanupStack::PopAndDestroy(); //lObject + return; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::FetchLeafObjectL +// The function fetches the leaf object data. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchLeafObjectL(): begin"); + DBG_ARGS(_S16("DS:Fetch aURI - %S - %S"), &aURI, &aLUID); + + CBufBase *lObject = CBufFlat::NewL( 128 ); + CleanupStack::PushL( lObject ); + lObject->Reset(); + if( FetchObjectL( aURI, aLUID, lObject, aStatusRef ) != KErrNone ) + { + CleanupStack::PopAndDestroy(); //lObject + _DBG_FILE("CNSmlDSSettingsAdapter::FetchLeafObjectL() : Error end"); + return; + }; + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *lObject, aType ); + CleanupStack::PopAndDestroy(); //object + _DBG_FILE("CNSmlDSSettingsAdapter::FetchLeafObjectL() : end"); + return; + } + +//------------------------------------------------------------------------------ +// CSmlDSSettingsAdapter::ChildURIListL +// Function returns the list of profiles or leafs of the profile +// acording to aURI. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): begin"); +// DBG_ARGS(_S16("ChildURIListL URI - <%S>"), &aURI); + + CBufBase *currentURISegmentList = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentURISegmentList ); + + if( aURI.Match( KDSAccMatch ) != KErrNotFound && + aURI.Match( KDSAccMatch2 ) == KErrNotFound ) + { + // + // Check if Profile exists + // + TInt checkLUID = GetIntObject( aLUID ); + if( FindProfileIdL( checkLUID ) ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDSAcc ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + else + { + checkLUID = -1; + if( IsDSAccUriFormatMatchPredefined(aURI) ) + { + checkLUID = ConstructTreeL(aURI); + } + if (checkLUID == -1 ) + { + _DBG_FILE( "CNSmlDMSettingsAdapter::childURI(): ENotFound end" ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( ); // currentURISegmentList + _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): end" ); + return; + } + else + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDSAcc ); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + } + + // Static node feature start end + + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): end"); + CleanupStack::PopAndDestroy(); //currentURISegmentList + return; + } + } + else if( aURI.Match( KDSDBMatch ) != KErrNotFound ) + { + // + // Check if ContenType exists (profileId from adapters) + // + TInt profileLUID = GetProfileIdFromURIL( aURI ); // ProfileId for DB-level + if( OpenSyncSessionAndDSProfileL( profileLUID, ESmlOpenRead ) == KErrNone ) + { + RArray taskIdArray; + CleanupClosePushL( taskIdArray ); + iDSProfile.ListTasksL( taskIdArray ); + if( taskIdArray.Count() == 0 ) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNullDesC8 ); + } + else + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDSAcc2 ); + } + CloseDSProfile(); + CleanupStack::PopAndDestroy();//taskIdArray + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): CT-NOTFOUND end"); + CleanupStack::PopAndDestroy();//currentURISegmentList + return; + } + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): end"); + CleanupStack::PopAndDestroy(); //currentURISegmentList + return; + } +// +// Handle ContentType (DB) request -> TASKS of the profile +// + if( aURI.Match( KDSDBMatch2 ) != KErrNotFound ) + { + TInt lProfileId = GetIntObject( aLUID ); + + if( ! FindProfileIdL( lProfileId ) ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): NOTFOUND CTTYPE end"); + CleanupStack::PopAndDestroy();// currentURISegmentList + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + TInt ret = CreateURITaskSegmentListL( aURI, lProfileId, currentURISegmentList, + aPreviousURISegmentList ); + if( ret != KErrNone && ret != KErrNotFound ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): ContentType error end"); + CleanupStack::PopAndDestroy();// currentURISegmentList + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): CTTYPE-OK end"); + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + CleanupStack::PopAndDestroy();// currentURISegmentList + return; + } + + + TInt ret = CreateURIProfileSegmentListL( currentURISegmentList, aPreviousURISegmentList ); + + if( ret != KErrNone ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): Profile not found end"); + CleanupStack::PopAndDestroy();// currentURISegmentList + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return; + } + + iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + CleanupStack::PopAndDestroy(); // currentURISegmentList + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + _DBG_FILE("CNSmlDSSettingsAdapter::ChildURIListL(): end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::AddNodeObjectL +// The function adds the new node object. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddNodeObjectL(): begin"); +// +// Check if ContentType-add and insert to Buffer +// + iParentLUID = GetIntObject( aParentLUID ); + + if( aURI.Match( KDSDBAddMatch )!= KErrNotFound && + aURI.Match( KDSDBAddMatch2 )== KErrNotFound ) + { + if( aParentLUID.Length() > 0 && iParentLUID >= 0 && iBufferExecution == EFalse ) + { + AddNodeBufferL( aURI, aParentLUID, aStatusRef ); + } + else if( iParentLUID < 0 ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + _DBG_FILE("CNSmlDSSettingsAdapter::AddNodeObjectL(): end"); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDSSettingsAdapter::AddNodeObjectL(): end"); + } + return; + } + + if( aURI.Match(KDSDBAddMatch3) != KErrNotFound ) + { + if( FindProfileIdL( iParentLUID ) ) // Profile on database + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + _DBG_FILE("CNSmlDSSettingsAdapter::AddNodeObjectL(): end"); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDSSettingsAdapter::AddNodeObjectL(): end"); + } + return; + } + + if( FindProfileIdL( iParentLUID ) ) + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); + _DBG_FILE("CNSmlDSSettingsAdapter::AddNodeObjectL(): EAlreadyExists end"); + return; + } + else + { + if( aParentLUID.Length() > 0 ) + { + TInt ret = iCallBack->RemoveMappingL(KNSmlDSSettingsAdapterImplUid, + GetDynamicDSNodeUri( aURI ), ETrue ); + if(ret) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + } + // + // Create new profile + // + TInt newPID = -1; + TInt sRet = CreateNewProfileL( newPID ); + if( sRet != KErrNone || newPID < 0 ) + { + if( sRet == KErrDiskFull ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EDiskFull ); + } + else if( sRet == KErrInUse ) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); + } + else + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + return; + } + // + // Get new ProfileId from database + // + iLUID = newPID; + // + TBuf8<8> newLUID; + newLUID.Num( iLUID ); + iCallBack->SetMappingL( aURI, newLUID ); + newLUID.Delete( 0, newLUID.Size() ); + } + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + _DBG_FILE("CNSmlDSSettingsAdapter::AddNodeObjectL(): end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::UpdateLeafObjectL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt /*aStatusRef*/ ) + { + //Not supported since streaming is not supported by the adapter. + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::FetchLeafObjectSizeL +// The function fetches the size of the leaf object data. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchLeafObjectSizeL() : begin"); + CBufBase *lObject = CBufFlat::NewL( 128 ); + CleanupStack::PushL( lObject ); + lObject->Reset(); + if( FetchObjectL( aURI, aLUID, lObject, aStatusRef ) != KErrNone ) + { + CleanupStack::PopAndDestroy(); //lObject + _DBG_FILE("CNSmlDSSettingsAdapter::FetchLeafObjectSizeL() : Error end"); + return; + }; + TInt objSizeInBytes = lObject->Size(); + TBuf8<16> stringObjSizeInBytes; + stringObjSizeInBytes.Num( objSizeInBytes ); + lObject->Reset(); + lObject->InsertL( 0, stringObjSizeInBytes ); + + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + iCallBack->SetResultsL( aResultsRef, *lObject, aType ); + CleanupStack::PopAndDestroy(); //object + _DBG_FILE("CNSmlDSSettingsAdapter::FetchLeafObjectSizeL() : end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::ExecuteCommandL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + const TInt /*aStatusRef*/ ) + { + // Not supported + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::ExecuteCommandL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt /*aStatusRef*/ ) + { + // Not supported by the adapter. + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::CopyCommandL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt /*aStatusRef*/ ) + { + // Not supported by the adapter. + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::StartAtomicL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::StartAtomicL() + { + // Atomic commands not supported by the adapter. + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::CommitAtomicL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::CommitAtomicL() + { + // Atomic commands not supported by the adapter. + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::RollbackAtomicL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::RollbackAtomicL() + { + // Atomic commands not supported by the adapter. + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::StreamingSupport() +// Indicates if streaming is supported. +//------------------------------------------------------------------------------ +TBool CNSmlDSSettingsAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + return EFalse; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::StreamCommittedL +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::StreamCommittedL() + { + // Not supported since streaming not supported by the adapter. + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::CompleteOutstandingCmdsL +// The function completes all buffered command from the buffer. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::CompleteOutstandingCmdsL() + { + +// +// Handle unhandled nodes if any +// + TInt count = iBuffer->Count(); + for( TInt h = 0; h < count ; h++ ) + { + TBuf8<150> commandURI; + commandURI.Append( iBuffer->At(0).iMappingName->Des() ); + commandURI.Append( KDummyTxt ); + TRAP_IGNORE( ExecuteBufferL( commandURI ) ); + } + iBuffer->Reset(); + CloseDSProfile(); + + // if port was updated, set it + if ( iPortBuf ) + { + TInt err = SetProfileConnectionPortNrL( iPortBufLUID, *iPortBuf ); + + // set status + if ( err != KErrNone ) + { + iCallBack->SetStatusL( iPortBufStatusRef, CSmlDmAdapter::EError ); + } + else + { + iCallBack->SetStatusL( iPortBufStatusRef, CSmlDmAdapter::EOk ); + } + + delete iPortBuf; + iPortBuf = NULL; + } + } + +//------------------------------------------------------------------------------ +// TBool CNSmlDSSettingsAdapter::AcceptDSField +// The function checks if leaf to be handled is valid for the adapter. +//------------------------------------------------------------------------------ +TBool CNSmlDSSettingsAdapter::AcceptDSField() + { + _DBG_FILE("CNSmlDSSettingsAdapter::AcceptDSField(): begin"); + + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfCTType ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfRDBURI ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfLDBURI ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfToNAPID ) == 0 ) + { + return ETrue; + } + else if ( iField->Compare( KNSmlDdfHidden ) == 0 ) + { + return EFalse; + } + + _DBG_FILE("CNSmlDSSettingsAdapter::AcceptDSField(): end"); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetDSField +// The function checks what leaf to handled and returns enum value for the leaf. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetDSField() const + { + _DBG_FILE("CNSmlDSSettingsAdapter::GetDSField(): begin"); + + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + return EProfileMediumType; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) + { + return EProfileURL; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + return EProfilePort; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + return EProfileSyncServerUsername; + } + else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) + { + return EProfileServerId; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) + { + return EProfileSyncServerPassword; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + return EProfileName; + } + else if ( iField->Compare( KNSmlDdfToNAPID ) == 0 ) + { + return EProfileIAPId; + } + else if ( iField->Compare( KNSmlDdfHidden ) == 0 ) + { + return EHiddenProfile; + } + else if ( iField->Compare( KNSmlDdfDB ) == 0 || + iField->Compare( KNSmlDdfCTType ) == 0 || + iField->Compare( KNSmlDdfCTVerL ) == 0 || + iField->Compare( KNSmlDdfRDBURI ) == 0 || + iField->Compare( KNSmlDdfLDBURI ) == 0 ) + { + return ESyncAccepted; + } + + _DBG_FILE("CNSmlDSSettingsAdapter::GetDSField(): end"); + return KErrNotFound; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetDSFieldTypeL +// The function return the data type for the leaf. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetDSFieldTypeL() const + { + _DBG_FILE("CNSmlDSSettingsAdapter::GetDSFieldTypeL(): begin"); + + if ( iField->Compare( KNSmlDdfAddrType ) == 0 || + iField->Compare( KNSmlDdfPortNbr ) == 0 || + iField->Compare( KNSmlDdfToNAPID ) == 0 || + iField->Compare( KNSmlDdfHidden ) == 0 ) + { + return EInt; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 || + iField->Compare( KNSmlDdfClientUserName ) == 0 || + iField->Compare( KNSmlDdfServerId ) == 0 || + iField->Compare( KNSmlDdfClientPW ) == 0 || + iField->Compare( KNSmlDdfName ) == 0 ) + { + return EStr; + } + else if ( iField->Compare( KNSmlDdfDB ) == 0 || + iField->Compare( KNSmlDdfCTType ) == 0 || + iField->Compare( KNSmlDdfCTVerL ) == 0 || + iField->Compare( KNSmlDdfRDBURI ) == 0 || + iField->Compare( KNSmlDdfLDBURI ) == 0 ) + { + return EParam; + } + + _DBG_FILE("CNSmlDSSettingsAdapter::GetDSFieldTypeL(): end"); + return EWrong; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::IntLUID +// Returns IntValue for aLUID. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::IntLUID( const TDesC8& aLUID ) + { + + TLex8 lLex( aLUID ); + + if ( lLex.Val( iLUID ) == KErrNone ) + { + return iLUID; + } + else + { + return 0; + } + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetIntObject +// Returns IntValue for a aObject +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetIntObject( const TDesC8& aObject ) + { + TLex8 lLex( aObject ); + + TInt value = 0; + + if ( lLex.Val( value ) == KErrNone ) + { + return value; + } + else + { + return KErrGeneral; + } + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetIntObject16() +// Returns IntValue for a 16-bit aObject +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetIntObject16( const TDesC& aObject ) + { + TLex lLex( aObject ); + + TInt value = 0; + + if ( lLex.Val( value ) == KErrNone ) + { + return value; + } + else + { + return KErrGeneral; + } + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetIntObjectLC +// Converts integer to HBufC8 type buffer and returns reference to it. +//------------------------------------------------------------------------------ +TDesC8& CNSmlDSSettingsAdapter::SetIntObjectLC( const TInt& aObject ) + { + HBufC8* buf = HBufC8::NewLC( 8 ); + TPtr8 ptrBuf = buf->Des(); + + ptrBuf.Num( aObject ); + + return *buf; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::NotValidStrLenght +// The function checks if data length for a leaf is valid. +//------------------------------------------------------------------------------ + +TBool CNSmlDSSettingsAdapter::NotValidStrLenght( const TInt& aProfileItem, + const TDesC8& aSource ) + { + TInt lLen = aSource.Length(); + TBool lBool = EFalse; + + switch ( aProfileItem ) + { + case ( EProfileName ) : + { + if( lLen > KNSmlMaxProfileNameLength ) + lBool = ETrue; + } + break; + + case ( EProfileSyncServerUsername ) : + { + if( lLen > KNSmlMaxUsernameLength ) + lBool = ETrue; + } + break; + + case ( EProfileSyncServerPassword ) : + { + if( lLen > KNSmlMaxPasswordLength ) + lBool = ETrue; + } + break; + + case ( EProfileURL ) : + { + if( lLen > KNSmlMaxURLLength ) + lBool = ETrue; + } + break; + + case ( EProfileIAPId ) : + { + if( lLen > KNSmlMaxURLLength )// Value from InternetAdapter for + lBool = ETrue; // given URI ./AP/xxx + } + break; + + case ( EProfilePort ) : + case ( EHiddenProfile ) : + case ( EProfileMediumType ) : + { + if( lLen > 8 ) + lBool = ETrue; + } + break; + + case ( EProfileServerId ) : + { + if( lLen > KNSmlMaxUsernameLength ) + lBool = ETrue; + } + break; + + default: + { + return ETrue; + } + } + + return lBool; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetField +// The function finds out the last element of the URI. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetField( const TDesC8& aSource ) + { + if ( aSource.LocateReverse( KNSmlDMUriSeparator ) == KErrNotFound ) + { + iField->Des().Format( aSource ); + } + else + { + iField->Des().Format( aSource.Mid( aSource.LocateReverse( KNSmlDMUriSeparator ) + 1 ) ); + } + + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::ConvertTo8LC +// Converts 16-bit string value to 8-bit. +//------------------------------------------------------------------------------ +TDesC8& CNSmlDSSettingsAdapter::ConvertTo8LC( const TDesC& aSource ) + { + HBufC8* buf = HBufC8::NewLC( aSource.Length() * 2 ); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); + return *buf; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::ConvertTo16LC +// Converts 8-bit string value to 16-bit. +//------------------------------------------------------------------------------ +TDesC16& CNSmlDSSettingsAdapter::ConvertTo16LC( const TDesC8& aSource ) + { + HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); + TPtr16 bufPtr16 = buf16->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aSource ); + return *buf16; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::AddNewDataProviderL +// Check if data provider exits and required MIME type is supported by the +// data provider. If supported new task will be created. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::AddNewDataProviderL( TInt aIntLUID, + const TDesC8& aMIMEType, + TInt& aDataProviderId ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddNewDataProviderL(): begin"); + + TInt retVal = OpenSyncSessionAndDSProfileL( aIntLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return KErrGeneral; + } + if( iRdbDataStore->Size() <= 0 ) + { + CloseDSProfile(); + return KErrGeneral; + } + RArray dataProviderArray; + CleanupClosePushL( dataProviderArray ); + iSyncSession.ListDataProvidersL( dataProviderArray ); + TInt dataProviderCount = dataProviderArray.Count(); + if( dataProviderCount == 0 ) + { + CloseDSProfile(); + CleanupStack::PopAndDestroy(); // dataProviderIdArray + _DBG_FILE("CNSmlDSSettingsAdapter::AddNewDataProviderL(): dataprovirdercount == 0 End"); + return KErrNotFound; + } + HBufC8* object = aMIMEType.AllocLC(); + TPtr8 objectPtr = object->Des(); + objectPtr.LowerCase(); + RSyncMLDataProvider dataProvider; + + for ( TInt i= 0; i < dataProviderCount; i++ ) + { + dataProvider.OpenL( iSyncSession, dataProviderArray[i] ); + CleanupClosePushL( dataProvider ); + for ( TInt n = 0; n < dataProvider.MimeTypeCount(); n++ ) + { + HBufC* mimeType = dataProvider.MimeType(n).AllocLC(); + if( objectPtr.CompareF( ConvertTo8LC( *mimeType ) ) == 0 ) //if MIME match + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddNewDataProviderL(): Mimetype found"); + + aDataProviderId = dataProvider.Identifier(); + RSyncMLTask task; + CleanupClosePushL( task ); + if( dataProvider.AllowsMultipleDataStores() ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddNewDataProviderL(): AllowsMultipleDataStores"); + CDesCArray* dataStoreName = new ( ELeave ) CDesCArrayFlat( 1 ); + CleanupStack::PushL( dataStoreName ); + dataProvider.GetDataStoreNamesL( *dataStoreName ); + if ( dataStoreName->Count() == 0 ) + { + // Get default if there are no databases + _DBG_FILE("CNSmlDSSettingsAdapter::AddNewDataProviderL(): no databases -> get default"); + HBufC* localDataStoreName = dataProvider.DefaultDataStoreName().AllocLC(); + task.CreateL( iDSProfile, aDataProviderId, *iRdbDataStore, + *localDataStoreName ); + task.UpdateL(); + CleanupStack::PopAndDestroy(); //localDataStoreName + } + else + { + TPtrC16 ptrDataStoreName = dataStoreName->MdcaPoint(0); + task.CreateL( iDSProfile, aDataProviderId, *iRdbDataStore, + ptrDataStoreName ); + task.UpdateL(); + } + CleanupStack::PopAndDestroy();//dataStoreName + } + else + { + _DBG_FILE("CNSmlDSSettingsAdapter::AddNewDataProviderL(): MultipleDataStores not allowed"); + HBufC* localDataStoreName = dataProvider.DefaultDataStoreName().AllocLC(); + task.CreateL( iDSProfile, aDataProviderId, *iRdbDataStore, + *localDataStoreName ); + task.UpdateL(); + CleanupStack::PopAndDestroy(); //localDataStoreName + } + iDSProfile.UpdateL(); + CleanupStack::PopAndDestroy( 6 ); //dataProviderArray, dataProvider, + //object, mimeType, ConvertTo8LC, + //task + CloseDSProfile(); + _DBG_FILE("CNSmlDSSettingsAdapter::AddNewDataProviderL(): end KErrNone"); + return KErrNone; + } + CleanupStack::PopAndDestroy( 2 ); //mimeType, ConvertTo8LC + } + CleanupStack::PopAndDestroy( ); //dataProvider + } + + CleanupStack::PopAndDestroy( 2 ); //dataProviderArray, object + CloseDSProfile(); + _DBG_FILE("CNSmlDSSettingsAdapter::AddNewDataProviderL(): end KErrNotFound"); + return KErrNotFound; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetToNAPIDL +// The function gets URI for given aObject. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetToNAPIDL( const TInt aLUID, CBufBase& aObject ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::GetToNAPIDL() : begin"); + + TInt profIAPid = -1; + TInt apIdResponse = GetProfileIAPIdL(aLUID, profIAPid); + if( profIAPid < 0 || apIdResponse != KErrNone ) + { + return KErrNotFound; + } + CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); + CleanupStack::PushL( apmatch ); + HBufC8* uri8 = apmatch->URIFromIAPIdL( profIAPid ); + if( uri8 ) + { + CleanupStack::PushL( uri8 ); + aObject.InsertL(aObject.Size(),uri8->Des()); + CleanupStack::PopAndDestroy(); // uri8 + } + else + { + CleanupStack::PopAndDestroy(); // apMatch + return KErrGeneral; + } + CleanupStack::PopAndDestroy(); // apMatch + _DBG_FILE("CNSmlDSSettingsAdapter::GetToNAPIDL() : end"); + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetToNAPIDL +// The function sets NAPId value according given URI. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetToNAPIDL( const TInt aLUID, const TDesC8& aObject ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::SetToNAPIDL() : begin"); + CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); + CleanupStack::PushL( apmatch ); + TInt lIAPid = apmatch->IAPIdFromURIL( aObject ); + TInt apIdResponse = SetProfileIAPIdL( aLUID, lIAPid ); + CleanupStack::PopAndDestroy(); // apmatch + _DBG_FILE("CNSmlDSSettingsAdapter::SetToNAPIDL() : end"); + return apIdResponse; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::AddNodeBufferL +// The function sets the new node to buffer. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::AddNodeBufferL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + TNSmlDSBufferElement newNode; + newNode.iMappingName = aURI.AllocLC(); + newNode.iName = LastURISeg(aURI).AllocLC(); + newNode.iNodeBuf = new (ELeave) CArrayFixFlat ( KNSmlDSGranularity ); + newNode.iExecuted = EFalse; + newNode.iLuid = GetIntObject( aParentLUID ); + iBuffer->AppendL( newNode ); + CleanupStack::Pop( 2 ); //newNode.iMappingName,newNode.iName + + TNSmlDSAddElement newCommand; + + newCommand.iUri = aURI.AllocLC(); + newCommand.iData = 0; + newCommand.iStatusRef = aStatusRef; + newCommand.iLeaf = EFalse; + newCommand.iDone = EFalse; + + TInt index = iBuffer->Count() - 1; + iBuffer->At(index).iNodeBuf->AppendL( newCommand ); + CleanupStack::Pop(); //newCommand.iUri + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::AddLeafBufferL +// The function sets the new leaf to buffer. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::AddLeafBufferL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TDesC8& aObject, + const TInt aStatusRef ) + { + TInt index = GetBufferIndex( aURI ); + if(index<0) + { + DBG_ARGS(_S16("DS-adapter:AddLeafBufferL URI - <%S> <%S> NOTFOUND"), &aURI, &aParentLUID ); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + + TNSmlDSAddElement newCommand; + newCommand.iUri = aURI.AllocLC(); + newCommand.iData = aObject.AllocLC(); + newCommand.iStatusRef = aStatusRef; + newCommand.iLeaf = ETrue; + newCommand.iDone = EFalse; + iBuffer->At(index).iNodeBuf->AppendL( newCommand ); + CleanupStack::Pop( 2 ); //newCommand.iUri, newCommand.iData + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::LastURISeg +// The function returns only the last uri segment. +//------------------------------------------------------------------------------ +TPtrC8 CNSmlDSSettingsAdapter::LastURISeg(const TDesC8& aURI) + { + TInt i; + for( i=aURI.Length() - 1; i >= 0; i-- ) + { + if( aURI[i] == KNSmlDMUriSeparator ) + { + break; + } + } + if( i == 0 ) + { + return aURI; + } + else + { + return aURI.Mid( i + 1 ); + } + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::RemoveLastURISeg +// The function removes the last URI segment. +//------------------------------------------------------------------------------ +TPtrC8 CNSmlDSSettingsAdapter::RemoveLastURISeg( const TDesC8& aURI ) + { + TInt i; + for( i = aURI.Length() - 1; i >= 0; i-- ) + { + if( aURI[i] == KNSmlDMUriSeparator ) + { + break; + } + } + if( i == 0 ) + { + return aURI; + } + else + { + return aURI.Left( i ); + } + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::ExecuteBufferL +// Executes commands which have not been executed. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::ExecuteBufferL( const TDesC8& aURI ) + { + TInt index = GetBufferIndex( aURI ); + if( index < 0 ) + { + return; + } + // + // Execute all commands for Profiles new ContentType + // + TBool rdburinotfound = ETrue; + TInt newcmd = 1; + + TNSmlDSBufferElement& bufElem = iBuffer->At(index); + + for( TInt cmd = bufElem.iNodeBuf->Count() - 1; cmd >= 0; cmd-- ) + { + TBuf8<16> addLUID; + + TNSmlDSAddElement& addElem = bufElem.iNodeBuf->At(cmd); + + if( cmd == 0 ) + { + if( bufElem.iLuid > 0 ) + { + addLUID.Format( KFormat, -1 ); // Set status for addnode command + } + else + { + addLUID.Format( KFormat, 0 ); + } + iBufferExecution = ETrue; + AddNodeObjectL( addElem.iUri->Des(), + addLUID, addElem.iStatusRef ); + + bufElem.iExecuted = ETrue; + iBufferExecution = EFalse; + } + else + { + //First RDBURI leaf must be stored + while( rdburinotfound && newcmd < iBuffer->At(index).iNodeBuf->Count() ) + { + if( bufElem.iNodeBuf->At(newcmd).iUri->Des().Find( KNSmlDdfRDBURI ) >= 0 ) + { + SetRDBDataStore( bufElem.iNodeBuf->At(newcmd).iData->Des() ); + rdburinotfound = EFalse; + break; + } + newcmd++; + }//while + addLUID.Format( KFormat, bufElem.iLuid ); + iBufferExecution = ETrue; + UpdateLeafObjectL( addElem.iUri->Des(), + addLUID, + addElem.iData->Des(), + KNullDesC8, + addElem.iStatusRef ); + iBufferExecution = EFalse; + } + + addElem.iDone = ETrue; + + delete addElem.iUri; + addElem.iUri=NULL; + if( addElem.iData ) + { + delete addElem.iData; + addElem.iData=NULL; + } + bufElem.iNodeBuf->Delete(cmd); + } +// +// Remove data from handled ContentType-commands +// + bufElem.iNodeBuf->Reset(); + delete bufElem.iNodeBuf; + + if( bufElem.iMappingName ) + { + delete bufElem.iMappingName; + bufElem.iMappingName=NULL; + } + + if( bufElem.iName ) + { + delete bufElem.iName; + bufElem.iName=NULL; + } + + iBuffer->Delete( index ); + iBuffer->Compress(); + } + + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetProfileIdFromURIL +// The function gets the Profile Id for given aURI. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetProfileIdFromURIL( const TDesC8& aURI ) + { + HBufC8* apURI = HBufC8::NewLC( aURI.Size() ); +// +// Second slash after SyncML/DSAcc/XXXX/ +// + TInt i = 0; + + for( i = aURI.Find( KDSAcc1 ) + 13; i < aURI.Length(); i++ ) + { + if( aURI[i] == KNSmlDMUriSeparator ) + { + break; + } + } + if( i > 0 ) + { + apURI->Des().Format( aURI.Left(i) ); + } +// +// Same profile as previous +// + if( iPrevURI->Match( *apURI ) != KErrNotFound ) + { + CleanupStack::PopAndDestroy(); // apURI + return iPrevLUID; + } +// +// Fetch Profile-id for URI +// + + HBufC8* apLUID = iCallBack->GetLuidAllocL( *apURI ); + CleanupStack::PushL( apLUID ); + if( apLUID->Length() == 0 ) + { + CleanupStack::PopAndDestroy( 2 );//apURI, apLUID + return KErrGeneral; + } + TInt resLUID = GetIntObject( *apLUID ); + iPrevURI->Des().Format( *apURI ); + iPrevLUID = resLUID; + CleanupStack::PopAndDestroy(2); //apURI,apLUID + + return resLUID; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetContentTypeL +// Get CTType (MimeType) for given adapter. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetContentTypeL( const TInt aDataProviderId, + const TInt aProfileLUID, + CBufBase*& aObject ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::GetContentTypeL(): begin"); + TInt retVal = OpenSyncSessionAndDSProfileL( aProfileLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + + RArray dataProviderIdArray; + CleanupClosePushL( dataProviderIdArray ); + iSyncSession.ListDataProvidersL( dataProviderIdArray ); + + TInt dpIndex = dataProviderIdArray.Find( aDataProviderId ); + if( dpIndex == KErrNotFound ) + { + CloseDSProfile(); + CleanupStack::PopAndDestroy( 1 ); // dataProviderIdArray + return KErrNotFound; + } + RSyncMLDataProvider dataProvider; + CleanupClosePushL( dataProvider ); + dataProvider.OpenL( iSyncSession, dataProviderIdArray[dpIndex] ); + for( TInt i = 0; i < dataProvider.MimeTypeCount(); i++ ) + { + //first mime type will be returned now + HBufC* mimeType = dataProvider.MimeType(i).AllocLC(); + aObject->InsertL( aObject->Size(), ConvertTo8LC( *mimeType ) ); + CleanupStack::PopAndDestroy( 2 ); //mimeType, ConvertTo8LC + break; + } + CleanupStack::PopAndDestroy( 2 ); // dataProviderIdArray, dataProvider + CloseDSProfile(); + _DBG_FILE("CNSmlDSSettingsAdapter::GetContentTypeL(): end"); + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetBufferIndex +// The function resolves buffer index for given URI. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetBufferIndex( const TDesC8& aURI ) + { + TInt index = -1; + for( TInt i = 0; iCount(); i++ ) + { + TPtrC8 parentUri = RemoveLastURISeg( aURI ); + if( iBuffer->At(i).iMappingName->Compare( parentUri ) == 0 ) + { + index = i; + break; + } + } + return index; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetBufferLUID +// The function sets the LUID to buffer for given URI. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetBufferLUID( const TDesC8& aURI, const TInt aLUID ) + { + TInt index = GetBufferIndex( aURI ); + if( index < 0 ) + { + return 0; + } + iBuffer->At(index).iLuid = aLUID; + return 1; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::ParseUri +// Resolves portnbr (separated with ':') as integer from URI. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::ParseUri( const TDesC8& aRealURI, TInt& aPort ) + { + TInt offset=0; + //http: + if( aRealURI.Find( KNSmlDSSettingsHTTP )==0 )//http: + { + offset = KNSmlDSSettingsHTTP().Length(); + } + else if( aRealURI.Find( KNSmlDSSettingsHTTPS )==0 )//https: + { + offset = KNSmlDSSettingsHTTPS().Length(); + } + + TBool portFound=EFalse; + TBool portExtracted = EFalse; + ////123.234.345.456:80/syncml + for( TInt i = offset; i < aRealURI.Length() && !portExtracted; i++ ) + { + if( aRealURI[i] == KNSmlDMColon )// ':' + { + portFound = ETrue; + offset=i; + } + if( portFound && aRealURI[i] == KNSmlDMUriSeparator )// '/' + { + aPort = GetIntObject( aRealURI.Mid( (offset + 1), (i - offset-1) ) ); + portExtracted = ETrue; + } + else if ( portFound && i == aRealURI.Length() - 1 ) // last char + { + // port is from offset to the end + aPort = GetIntObject( aRealURI.Right( aRealURI.Length() - offset - 1 ) ); + portExtracted = ETrue; + } + } + + if( aPort != 0 ) + { + return KErrNone; + } + else + { + return KErrNotFound; + } + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::FindProfileIdL +// The function checkd if profile can be found. +//------------------------------------------------------------------------------ +TBool CNSmlDSSettingsAdapter::FindProfileIdL( const TInt aIntLUID ) + { + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + RArray profileList; + CleanupClosePushL( profileList ); + TSmlUsageType usageType = ESmlDataSync; + iSyncSession.ListProfilesL( profileList, usageType ); + if( profileList.Count() == 0 ) + { + CleanupStack::PopAndDestroy(); //profileList + return EFalse; + } + TInt item = profileList.Find( aIntLUID ); + CleanupStack::PopAndDestroy(); //profileList + if( item != KErrNotFound ) + { + return ETrue; + } + return EFalse; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetProfileIdentifierL +// The function gets profile Id from Client API. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetProfileIdentifierL( const TInt aIntLUID, + TInt& aProfileID ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aIntLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + aProfileID = iDSProfile.Identifier(); + CloseDSProfile(); + return retVal; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetDSFieldDataL +// The function checks what leaf to be handled and fetches the data for a leaf. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetDSFieldDataL( const TInt aIntLUID, + CBufBase*& aObject ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::GetDSFieldData(): begin"); + + if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) + { + TSmlTransportId connType = -1; + connType = GetProfileConnectiontypeL( aIntLUID ); + if ( connType <= 0 ) + { + return KErrNotFound; + } + aObject->InsertL( aObject->Size(), SetIntObjectLC( connType ) ); + CleanupStack::PopAndDestroy();//SetIntObjectLC + return KErrNone; + } + else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) //Server URL + { + TInt retValue1 = GetProfileServerURLL( aIntLUID, aObject ); + TInt port(0); + if(ParseUri(aObject->Ptr(0),port)==KErrNone) + { + HBufC8* addr = aObject->Ptr(0).AllocLC(); + aObject->Reset(); + TInt portStart = addr->LocateReverse(KNSmlDMColon); + aObject->InsertL(aObject->Size(),addr->Left(portStart)); + + TInt portLen=addr->Mid(portStart).Locate(KNSmlDMUriSeparator); + if(portLen!=KErrNotFound) + { + aObject->InsertL(aObject->Size(),addr->Mid(portStart+portLen)); + } + + CleanupStack::PopAndDestroy(); //addr + } + + if( retValue1 != KErrNone ) + { + return KErrNotFound; + } + return KErrNone; + } + else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) + { + TInt retValue2 = GetProfileServerURLL( aIntLUID, aObject ); + if( retValue2 != KErrNone ) + { + return KErrNotFound; + } + if ( aObject->Size() == 0 ) + { + return KErrNone; + } + TInt bSize = aObject->Size(); + HBufC8* buf = HBufC8::NewLC( bSize ); + TPtr8 bufPtr = buf->Des(); + aObject->Read( 0, bufPtr, aObject->Size() ); + aObject->Reset(); + + TInt pnum = 0; + //find out the port number + ParseUri( *buf, pnum ); + if(pnum) + { + aObject->InsertL( aObject->Size(), SetIntObjectLC( pnum ) ); + CleanupStack::PopAndDestroy( ); //SetIntObjectLC( pnum ) + } + CleanupStack::PopAndDestroy( ); //buf + return KErrNone; + } + else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) + { + if( GetProfileUserNameL( aIntLUID, aObject ) != KErrNone ) + { + return KErrGeneral; + } + return KErrNone; + } + else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) + { + if( GetProfileServerIdL( aIntLUID, aObject ) != KErrNone ) + { + return KErrGeneral; + } + return KErrNone; + } + else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) //Not allowed + { + return KErrGeneral; + } + else if ( iField->Compare( KNSmlDdfName ) == 0 ) + { + TInt retValue = GetProfileDisplayNameL( aIntLUID, aObject ); + if( retValue != KErrNone ) + { + return KErrGeneral; + } + return KErrNone; + } + else if ( iField->Compare( KNSmlDdfToNAPID ) == 0 ) + { + TInt retToNaPID = GetToNAPIDL( aIntLUID, *aObject ); + if ( retToNaPID == KErrNone || retToNaPID == KErrNotFound ) + { + return retToNaPID; + } + return KErrGeneral; + } + else if ( iField->Compare( KNSmlDdfHidden ) == 0 ) + { + //Hidden profile not supported + return KErrGeneral; + } + _DBG_FILE("CNSmlDSSettingsAdapter::GetDSFieldData(): end"); + return KErrGeneral; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetProfileConnectiontypeL() +// The function what medium type is supported and returns it. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetProfileConnectiontypeL( const TInt aIntLUID ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aIntLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iDSProfile.ListConnectionsL( transportIdArray ); + TInt transportItems = transportIdArray.Count(); + if( transportItems == 0 ) + { + //No matching items + CleanupStack::PopAndDestroy(); //transportIdArray + CloseDSProfile(); + return KErrGeneral; + } + else if( transportItems > 1 ) + { + //Error case : against specification + CleanupStack::PopAndDestroy(); //transportIdArray + CloseDSProfile(); + return KErrGeneral; + } + + TInt mediumType = ENone; + if ( transportIdArray[0] == KUidNSmlMediumTypeInternet.iUid ) + { + mediumType = EHttp; + } + else if ( transportIdArray[0] == KUidNSmlMediumTypeBluetooth.iUid || + transportIdArray[0] == KUidNSmlMediumTypeUSB.iUid || + transportIdArray[0] == KUidNSmlMediumTypeIrDA.iUid ) + { + mediumType = EObex; + } + + CleanupStack::PopAndDestroy(); //transportIdArray + CloseDSProfile(); + return mediumType; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetProfileServerURLL +// The function gets the profile Addr leaf value. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetProfileServerURLL( const TInt aIntLUID, + CBufBase*& aURL ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aIntLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iDSProfile.ListConnectionsL( transportIdArray ); + if( transportIdArray.Count() > 0 ) + { + RSyncMLConnection profConn; + CleanupClosePushL( profConn ); + profConn.OpenL( iDSProfile, transportIdArray[0] ); + + HBufC8* sURI = profConn.ServerURI().AllocL(); + CleanupStack::PushL( sURI ); + TPtr8 uriPtr = sURI->Des(); + if( uriPtr.Length() > 0 ) + { + aURL->InsertL( aURL->Size(),uriPtr ); + } + else + { + aURL->InsertL( aURL->Size(), KNullDesC8 ); + } + CleanupStack::PopAndDestroy( 2 );//profConn, sURI + retVal = KErrNone; + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy(); //transportIdArray + CloseDSProfile(); + return retVal; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetProfileUserNameL +// The function gets the ClientUserName leaf value. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetProfileUserNameL( const TInt aIntLUID, + CBufBase*& aUserName ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aIntLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + HBufC8* userName = iDSProfile.UserName().AllocL(); + CleanupStack::PushL( userName ); + TPtr8 ptrUserName = userName->Des(); + CloseDSProfile(); + aUserName->InsertL( aUserName->Size(), ptrUserName ); + CleanupStack::PopAndDestroy(); //userName + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetProfileServerIdL +// The function gets the ClientUserName leaf value. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetProfileServerIdL( const TInt aIntLUID, + CBufBase*& aUserName ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aIntLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + aUserName->InsertL( aUserName->Size(), iDSProfile.ServerId() ); + CloseDSProfile(); + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetProfileIAPIdL +// The function gets the IAP id value from Client API. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetProfileIAPIdL( const TInt aIntLUID, TInt& aIAPid ) + { + aIAPid = -1; + TInt retVal = OpenSyncSessionAndDSProfileL( aIntLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iDSProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + RSyncMLTransport transport; + CleanupClosePushL( transport ); + transport.OpenL( iSyncSession, connIdArray[0] ); + const CSyncMLTransportPropertiesArray& props = transport.Properties(); + TInt index = props.Find( KNSmlIAPId ); + if( index > 0 ) + { + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iDSProfile, connIdArray[0] ); + HBufC8* iapId = conn.GetPropertyL( KNSmlIAPId ).AllocLC(); + aIAPid = GetIntObject( *iapId ); + CleanupStack::PopAndDestroy( 2 ); //conn, iapId + retVal = KErrNone; + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy(); //transport + CloseDSProfile(); + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy(); //connIdArray + return retVal; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetProfileDisplayNameL +// The function gets the Name leaf value for a profile. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetProfileDisplayNameL( const TInt aIntLUID, + CBufBase*& aDisplayName ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aIntLUID, ESmlOpenRead ); + if(retVal != KErrNone) + { + CloseDSProfile(); + return retVal; + } + HBufC* dataBuf = iDSProfile.DisplayName().AllocL(); + CleanupStack::PushL( dataBuf ); + TPtr16 ptrDisplayName = dataBuf->Des(); + aDisplayName->InsertL( aDisplayName->Size(), ConvertTo8LC( ptrDisplayName ) ); + CleanupStack::PopAndDestroy( 2 );//dataBuf, ConvertTo8LC + CloseDSProfile(); + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::CreateNewProfileL +// The function creates new profile through Client API. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::CreateNewProfileL( TInt& aPID ) + { + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + TRAPD( trapValue1, iDSProfile.CreateL( iSyncSession ) ); + if( trapValue1 != KErrNone ) + { + return trapValue1; + } + //iDSProfile.SetProtocolVersionL(ESmlVersion1_1_2); + TRAPD( trapValue2, iDSProfile.UpdateL() ); + if( trapValue2 != KErrNone ) + { + return trapValue2; + } + aPID = iDSProfile.Identifier(); + + + CloseDSProfile(); + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfileServerURIL +// The function sets the Addr leaf value. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfileServerURIL( const TInt aPID, + const TDesC8& aObj ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aPID, ESmlOpenReadWrite ); + if(retVal != KErrNone) + { + CloseDSProfile(); + return retVal; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iDSProfile.ListConnectionsL( transportIdArray ); + if( transportIdArray.Count() == 0 ) + { + CleanupStack::PopAndDestroy();//transportIdArray + CloseDSProfile(); + return KErrGeneral; + } + + TInt newPort(0); + + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iDSProfile, transportIdArray[0] ); + + if( transportIdArray[0] == KUidNSmlMediumTypeInternet.iUid ) + { + if(ParseUri(aObj,newPort)==KErrNotFound) + { + TInt port(0); + ParseUri(conn.ServerURI(),port); + if(port==0) + { + // set default port + if( aObj.Find( KNSmlDSSettingsHTTPS ) == 0 ) //https:// + { + port = KNSmlDSSettingsHTTPSPort; + } + else //http:// + { + port = KNSmlDSSettingsHTTPPort; + } + } + + TBuf8<5> buf; + buf.Num( port ); + + TInt totalSize = aObj.Length() + buf.Length() + 1; + HBufC8* newServerURI = HBufC8::NewLC( totalSize ); + SetPortNrToAddrStr( aObj, newServerURI, buf ); + + conn.SetServerURIL( *newServerURI ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( newServerURI ); + + } + else + { + conn.SetServerURIL( aObj ); + conn.UpdateL(); + } + } + else // medium type not internet, no port allowed + { + if(ParseUri(aObj,newPort)==KErrNotFound) + { + conn.SetServerURIL( aObj ); + conn.UpdateL(); + } + else + { + // remove port from uri + HBufC8* newServerURI = HBufC8::NewL( aObj.Length() ); + CleanupStack::PushL( newServerURI ); + TBuf8<5> buf; + buf.Num( 0 ); + // change iLeafType to EDSDelete -> deleting port + TNSmlDSLeafType tmpType(iLeafType); // store current value + iLeafType = EDSDelete; + SetPortNrToAddrStr( aObj, newServerURI, buf ); + iLeafType = tmpType; // restore original value + + conn.SetServerURIL( *newServerURI ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( newServerURI ); + } + } + + + iDSProfile.UpdateL(); + CleanupStack::PopAndDestroy( 2 ); //transportIdArray, conn + CloseDSProfile(); + return retVal; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfileDisplayNameL +// The function sets the Name leaf value for a profile. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfileDisplayNameL( const TInt aPID, + const TDesC8& aObj ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + iDSProfile.SetDisplayNameL( ConvertTo16LC( aObj ) ); + iDSProfile.UpdateL(); + CleanupStack::PopAndDestroy();//ConvertTo16LC + CloseDSProfile(); + return retVal; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfileUserNameL +// The function sets the ClientUserName leaf value for a profile. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfileUserNameL( const TInt aPID, + const TDesC8& aObj ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + iDSProfile.SetUserNameL( aObj ); + iDSProfile.UpdateL(); + CloseDSProfile(); + return retVal; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfileServerIdL +// The function sets the ClientUserName leaf value for a profile. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfileServerIdL( const TInt aPID, + const TDesC8& aObj ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + iDSProfile.SetServerIdL( aObj ); + if(aObj.Length()) + { + iDSProfile.SetProtocolVersionL(ESmlVersion1_2); + } + else + { + iDSProfile.SetProtocolVersionL(ESmlVersion1_1_2); + } + iDSProfile.UpdateL(); + CloseDSProfile(); + return retVal; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfilePasswordL +// The function sets the ClientPW leaf value for a profile. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfilePasswordL( const TInt aPID, + const TDesC8& aObj ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + iDSProfile.SetPasswordL( aObj ); + iDSProfile.UpdateL(); + CloseDSProfile(); + return retVal; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfileStrValueL +// The function checks what leaf to be handles and calls the proper function to +// set leaf data. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfileStrValueL( const TInt aPID, + const TDesC8& aObj, + const TInt aFieldID ) + { + TInt ret = 0; + switch ( aFieldID ) + { + case ( EProfileName ) : + { + ret = SetProfileDisplayNameL( aPID, aObj ); + } + break; + + case ( EProfileSyncServerUsername ) : + { + ret = SetProfileUserNameL( aPID, aObj ); + } + break; + + case ( EProfileServerId ) : + { + ret = SetProfileServerIdL( aPID, aObj ); + } + break; + + + case ( EProfileSyncServerPassword ) : + { + ret = SetProfilePasswordL( aPID, aObj ); + } + break; + case ( EProfileIAPId ) : + { + ret = SetToNAPIDL( aPID, aObj ); + } + break; + case ( EProfilePort ) : + { + delete iPortBuf; + iPortBuf = NULL; + + // check that port is a valid integer + TLex8 lex( aObj ); + TInt port = KErrNotFound; + TInt err = lex.Val( port ); + + if ( err != KErrNone || !lex.Eos() ) + { + ret = KErrArgument; + } + else + { + TInt portval = GetIntObject(aObj); + if(portval<0) + { + ret=KErrArgument; + } + else if(portval>65535) + { + ret=KErrOverflow; + } + + else + { + // save information of the port + iPortBuf = aObj.AllocL(); + iPortBufLUID = aPID; + SetProfileConnectionPortNrL( iPortBufLUID, *iPortBuf ); + } + } + } + break; + case ( EProfileURL ) : + case ( EHiddenProfile ) : + case ( EProfileMediumType ) : + default: + { + User::Panic( KNSmlIndexOutOfBoundStr, KNSmlPanicIndexOutOfBound ); + } + } + return ret; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::DeleteProfileL +// The function deletes profile data content. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::DeleteProfileL( const TInt aPID ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aPID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return KErrGeneral; + } + RArray taskIdArray; + CleanupClosePushL( taskIdArray ); + iDSProfile.ListTasksL( taskIdArray ); + if( taskIdArray.Count() > 0 ) + { + for ( TInt i = 0; i < taskIdArray.Count(); i++ ) + { + iDSProfile.DeleteTaskL( taskIdArray[i] ); + iDSProfile.UpdateL(); + } + } + CloseDSProfile(); + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDataSync; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + TInt index = profileIdArray.Find( aPID ); + iSyncSession.DeleteProfileL( profileIdArray[index] ); + CleanupStack::PopAndDestroy( 2 ); //profileIdArray, taskIdArray + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::CreateURITaskSegmentListL +// The function creates list of the content types that profile supports. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::CreateURITaskSegmentListL( const TDesC8& aURI, + const TInt aPID, + CBufBase*& aCurrentURISegmentList, + const CArrayFix& aPreviousURISegmentList ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aPID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return KErrGeneral; + } + RArray taskIdArray; + CleanupClosePushL( taskIdArray ); + iDSProfile.ListTasksL( taskIdArray ); + if( taskIdArray.Count() == 0 ) + { + CloseDSProfile(); + CleanupStack::PopAndDestroy();//taskIdArray + return KErrNotFound; + } + + RSyncMLTask task; + CleanupClosePushL( task ); + + for ( TInt i = 0; i < taskIdArray.Count(); i++ ) + { + // + // Check if ContentType -> Task ID on list + // + TBool notInList( ETrue ); + TInt newline( 0 ); + TInt ddId( 0 ); + task.OpenL( iDSProfile, taskIdArray[i] ); + ddId = task.DataProvider(); + task.Close(); + while( notInList && newline addNAME( Kprev ); + //Get Task ID + addNAME.AppendNumFixedWidth( taskIdArray[i], EDecimal,3 ); + aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), addNAME ); + aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), KNSmlDSSlash ); + + TBuf8<80> addURI; + + addURI.Append( aURI ); + addURI.Append( Kprev2 ); + addURI.AppendNumFixedWidth( taskIdArray[i], EDecimal, 3 ); + + TBuf8<16> addLUID; + addLUID.Num( ddId ); + + iCallBack->SetMappingL( addURI, addLUID ); + } + else //not a new object + { + aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), + aPreviousURISegmentList.At(newline).iURISeg ); + + aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), KNSmlDSSlash ); + +// DBG_ARGS8(_S8("InList: Id = %d Name %S"), newline, +// aPreviousURISegmentList.At(newline).iURISeg); + } + } //For + CloseDSProfile(); + CleanupStack::PopAndDestroy(2);// task, taskIdArray + return KErrNone; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::CreateURIProfileSegmentListL +// The function creates list of the profiles. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::CreateURIProfileSegmentListL( CBufBase*& aCurrentURISegmentList, + const CArrayFix& aPreviousURISegmentList ) + { + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDataSync; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + + if(profileIdArray.Count() == 0) + { + CleanupStack::PopAndDestroy();//profileIdArray + return KErrNotFound; + } + + for(TInt p = 0; p < profileIdArray.Count(); p++ ) + { + TBool notInList = ETrue; + TInt newline = 0; + while( notInList && newline < aPreviousURISegmentList.Count() ) + { + TInt ddId = profileIdArray[p]; + TInt ppId = GetIntObject( aPreviousURISegmentList.At(newline).iURISegLUID ); + if( ppId == ddId ) + { + notInList = EFalse; + break; + } + newline++; + } + + if( notInList ) + { // Those which not have mapping data + + TBuf8<9> addNAME( KDSprev ); + addNAME.AppendNumFixedWidth( profileIdArray[p], EDecimal, 3 ); + + aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), addNAME ); + aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), KNSmlDSSlash ); + + // KNSmlDSStart includes start text for URISeg + TBuf8<20> addURI; // SyncML/DSAcc/DSIdnnn , nnn = profileid + addURI.Append( KNSmlDSStart ); + addURI.AppendNumFixedWidth( profileIdArray[p], EDecimal, 3 ); + + TBuf8<16> addLUID; + addLUID.Num( profileIdArray[p] ); + + iCallBack->SetMappingL( addURI,addLUID ); + } + else + { // Add those in PreviousList which are on database + aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), + aPreviousURISegmentList.At(newline).iURISeg ); + + aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), KNSmlDSSlash ); +// DBG_ARGS8(_S8("InList: Id = %d Name %S"), newline, +// aPreviousURISegmentList.At(newline).iURISeg); + } + } + CleanupStack::PopAndDestroy();//profileIdArray + return KErrNone; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::OpenSyncSessionAndDSProfileL +// The function opens the server session and DS profile. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::OpenSyncSessionAndDSProfileL( const TInt aIntLUID, + TSmlOpenMode aMode ) + { + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDataSync; + iSyncSession.ListProfilesL( profileIdArray, usageType ); + TInt index = profileIdArray.Find( aIntLUID ); + CleanupStack::PopAndDestroy(); //profileIdArray + if( index == KErrNotFound ) + { + return KErrNotFound; + } + TRAPD( rValue, iDSProfile.OpenL( iSyncSession, aIntLUID, aMode ) ); + if( rValue != KErrNone ) + { + iDSProfile.Close(); + iSyncSession.Close(); + iSyncSessionOpen = EFalse; + } + return rValue; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::CloseDSProfile +// The function closes the DS profile connection. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::CloseDSProfile() + { + iDSProfile.Close(); + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::FindTaskIDL +// The function searches if task can be found from the profile task list. +//------------------------------------------------------------------------------ +TBool CNSmlDSSettingsAdapter::FindTaskIDL( const TInt aProfLUID, const TInt aDataProviderId ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aProfLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return EFalse; + } + RArray taskIdArray; + CleanupClosePushL( taskIdArray );//taskIdArray + iDSProfile.ListTasksL( taskIdArray ); + + RSyncMLTask task; + CleanupClosePushL( task ); + // find task + for (TInt i=0; i taskIdArray; + CleanupClosePushL( taskIdArray ); + iDSProfile.ListTasksL( taskIdArray ); + + RSyncMLTask task; + CleanupClosePushL( task ); + // find task + for (TInt i=0; i taskArray; + CleanupClosePushL( taskArray ); + iDSProfile.ListTasksL( taskArray ); + + RSyncMLTask task; + CleanupClosePushL( task ); + // find task + for (TInt i=0; iInsertL( aObject->Size(), ConvertTo8LC( *localDataStore ) ); + CloseDSProfile(); + CleanupStack::PopAndDestroy(4); //taskIdArray, task, localDataStore, ConvertTo8LC + + return KErrNone; + } + task.Close(); + } + // task not found + CleanupStack::PopAndDestroy(2); //taskArray, task + CloseDSProfile(); + return KErrNotFound; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetServerDataSourceL +// The function gets the remote data store (RDBURI). +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::GetServerDataSourceL( const TInt aDataProviderId, + const TInt aProfileLUID, + CBufBase*& aObject ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aProfileLUID, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + RArray taskArray; + CleanupClosePushL( taskArray ); + iDSProfile.ListTasksL( taskArray ); + + RSyncMLTask task; + CleanupClosePushL( task ); + // find task + for (TInt i=0; iInsertL( aObject->Size(), ConvertTo8LC( *serverDataStore ) ); + CloseDSProfile(); + CleanupStack::PopAndDestroy(4); //taskIdArray, task, serverDataStore, ConvertTo8LC + + return KErrNone; + } + task.Close(); + } + // task not found + CleanupStack::PopAndDestroy(2); //taskIdArray, task + CloseDSProfile(); + return KErrNotFound; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::UpdateDataSourceL +// The function updates the LDBURI or RDBURI leaf value. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::UpdateDataSourceL( const TInt aProfileLUID, + const TInt aDataProviderId, + const TDesC8& aObject, + const HBufC8& aField) + { + // check that aField is RemoteDB or LocalDB + if( aField.Compare( KNSmlDdfRDBURI ) != 0 && aField.Compare( KNSmlDdfLDBURI ) != 0) + { + return KErrGeneral; + } + + TInt retVal = OpenSyncSessionAndDSProfileL( aProfileLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + RArray taskArray; + CleanupClosePushL( taskArray ); + iDSProfile.ListTasksL( taskArray ); + + RSyncMLTask task; + CleanupClosePushL( task ); + // find correct task + for (TInt i=0; iDes(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( ptrDataObject, aObject ); + iDSProfile.DeleteTaskL( taskArray[i] ); + iDSProfile.UpdateL(); + + // create new task with new values + RSyncMLTask newTask; + CleanupClosePushL( newTask ); + if( aField.Compare( KNSmlDdfRDBURI ) == 0 ) //Remote DB, Mandatory + { + newTask.CreateL( iDSProfile, aDataProviderId, ptrDataObject, *localDataStore ); + } + else if( aField.Compare( KNSmlDdfLDBURI ) == 0 ) + { + newTask.CreateL( iDSProfile, aDataProviderId, *remoteDataStore, ptrDataObject ); + } + newTask.UpdateL(); + + CloseDSProfile(); + CleanupStack::PopAndDestroy( 6 ); //taskArray, task, localDataStore, + //remoteDataStore, objectBuffer, newTask + return retVal; + } + task.Close(); + } + // task not found + CleanupStack::PopAndDestroy(2);//taskArray, task + CloseDSProfile(); + return KErrNotFound; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::FetchObjectL +// The function fetches the requested leaf object data. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::FetchObjectL( const TDesC8& aURI, const TDesC8& aLUID, + CBufBase*& aObj, const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): begin"); +// + DBG_ARGS(_S16("DS:Fetch aURI - %S - %S"), &aURI, &aLUID); + + TInt retVal = KErrNone; + TInt profileLUID = -1; + + iLUID = IntLUID( aLUID ); + + if ( aLUID.Length() > 0 && + ( aURI.Match( KCTTypeMatch ) != KErrNotFound || + aURI.Match( KRDBUriMatch ) != KErrNotFound || + aURI.Match( KLDBUriMatch ) != KErrNotFound ) ) + { + profileLUID = GetProfileIdFromURIL( aURI ); // ProfileId for DB-level + if( FindTaskIDL( profileLUID, iLUID ) == EFalse ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return KErrNotFound; + } + } + else if ( aLUID.Length() > 0 ) //Profile + { + TInt profileID = -1; + TInt retValue = GetProfileIdentifierL( iLUID, profileID ); + if( retValue != KErrNone || profileID < 0 ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return KErrNotFound; + } + iLUID = profileID; + } + else + { + // Static node feature start + iLUID = -1; + if( IsDSAccUriFormatMatchPredefined(aURI) ) + { + iLUID = ConstructTreeL(aURI); + profileLUID = GetProfileIdFromURIL( aURI ); + } + + if ((iLUID == 0 ) && (aURI.Match(_L8("SyncML/DSAcc/DSId*/DB/CTId*")) == KErrNone)) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return KErrNotFound; + } + // Static node feature end + } + + SetField( aURI ); +// +// Check if valid field +// +/* if( !AcceptDSField() ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): EInvalidObject end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return KErrGeneral; + } +*/ +// +// Check which field going to be handled +// + TInt fType = GetDSFieldTypeL(); + if ( fType == EInt || fType == EStr ) + { + retVal = GetDSFieldDataL( iLUID, aObj ); + } + else if ( fType == EParam ) + { // DB and CTType (dataprovider info / MIME type) + // RDBURI + LDBURI (dataprovider data paths) + if( iField->Compare( KNSmlDdfCTType ) == 0 ) + { + retVal = GetContentTypeL( iLUID, profileLUID, aObj ); + } + else if( iField->Compare( KNSmlDdfLDBURI ) == 0 ) // Local database (optional) + { + //ClientDataSource + retVal = GetClientDataSourceL( iLUID, profileLUID, aObj ); + } + else if( iField->Compare( KNSmlDdfRDBURI ) == 0 ) // Remote database + { + //ServerDataSource + retVal = GetServerDataSourceL( iLUID, profileLUID, aObj ); + } + } + else + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): Unknown type end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + return KErrNotFound; + } + if( retVal != KErrNone ) + { + if ( retVal == KErrNotFound ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): ENotFound end"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + else + { + _DBG_FILE("CNSmlDSSettingsAdapter::FetchObjectL(): retVal != KErrNone"); + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + return retVal; + + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::FillNodeInfoL +// The function fills the node or leaf information. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription, + const TDesC8& aDefaultValue, + const TDesC8& aMimeType ) + { + aNode.AddDFTypeMimeTypeL( aMimeType ); + aNode.SetAccessTypesL( aAccTypes ); + aNode.SetDescriptionL( aDescription ); + aNode.SetOccurenceL( aOccurrence ); + aNode.SetDefaultValueL( aDefaultValue ); + aNode.SetScopeL( aScope ); + aNode.SetDFFormatL( aFormat ); + return; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfileAddrTypeL +// The function sets the medium type for a profile. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfileAddrTypeL( const TInt aLUID, + const TInt aIntObj ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::SetProfileAddrTypeL(): begin"); + TInt retVal = OpenSyncSessionAndDSProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + _DBG_FILE("CNSmlDSSettingsAdapter::SetProfileAddrTypeL(): end"); + return retVal; + } + TSmlTransportId mediumType = ENone; + GetMediumTypeL( aIntObj, mediumType ); + if( mediumType == ENone ) + { + return KErrGeneral; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iDSProfile.ListConnectionsL( transportIdArray ); + + RSyncMLConnection conn; + conn.OpenL( iDSProfile, transportIdArray[0] ); + CleanupClosePushL( conn ); + + HBufC8* sURI = conn.ServerURI().AllocLC(); + if(mediumType!=transportIdArray[0]) + { + conn.CreateL( iDSProfile, mediumType ); //changes medium type and clears the buffer + } + + if(mediumType!=KUidNSmlMediumTypeInternet.iUid && sURI->Length() > 0) + { + // remove port + HBufC8* newServerURI = HBufC8::NewL( sURI->Size() ); + CleanupStack::PushL( newServerURI ); + TBuf8<5> buf; + buf.Num( 0 ); + // change iLeafType to EDSDelete -> deleting port + TNSmlDSLeafType tmpType(iLeafType); // store old value + iLeafType = EDSDelete; + SetPortNrToAddrStr( *sURI, newServerURI, buf ); + iLeafType = tmpType; // restore original value + + conn.SetServerURIL( *newServerURI ); + conn.UpdateL(); + + CleanupStack::PopAndDestroy( newServerURI ); + } + else + { + conn.SetServerURIL( *sURI ); + conn.UpdateL(); + } + + CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI + CloseDSProfile(); + _DBG_FILE("CNSmlDSSettingsAdapter::SetProfileAddrTypeL(): end"); + return KErrNone; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfileConnectionPortNrL +// The function sets the port number (PortNbr) for a profile. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfileConnectionPortNrL( const TInt aLUID, + const TDesC8& aPort ) + { + _DBG_FILE("CNSmlDSSettingsAdapter::SetProfileConnectionPortNrL(): begin"); + TInt retVal = KErrNone; + + if( iPortNbr ) + { + delete iPortNbr; + iPortNbr = NULL; + } + iPortNbr = HBufC8::NewL( aPort.Length() ); + TPtr8 newPortNbr = iPortNbr->Des(); + newPortNbr.Append( aPort ); + + retVal = OpenSyncSessionAndDSProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + _DBG_FILE("CNSmlDSSettingsAdapter::SetProfileConnectionPortNrL(): end"); + return retVal; + } + + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iDSProfile.ListConnectionsL( transportIdArray ); + + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iDSProfile, transportIdArray[0] ); + + // if medium type is not internet -> do not add port + if( transportIdArray[0] != KUidNSmlMediumTypeInternet.iUid ) + { + CloseDSProfile(); + CleanupStack::PopAndDestroy( 2 ); //transportIdArray, conn + _DBG_FILE("CNSmlDSSettingsAdapter::SetProfileConnectionPortNrL(): end"); + return retVal; + } + + HBufC8* serverURI = conn.ServerURI().AllocLC(); + if( serverURI->Length() == 0 ) + { + CloseDSProfile(); + CleanupStack::PopAndDestroy( 3 ); //transportIdArray, conn, serverURI + _DBG_FILE("CNSmlDSSettingsAdapter::SetProfileConnectionPortNrL(): end"); + return retVal; + } + TInt totalSize = serverURI->Size() + newPortNbr.Size() + 1; + HBufC8* newServerURI = HBufC8::NewL( totalSize ); + CleanupStack::PushL( newServerURI ); + SetPortNrToAddrStr( *serverURI, newServerURI, newPortNbr ); + + conn.SetServerURIL( *newServerURI ); + conn.UpdateL(); + + CleanupStack::PopAndDestroy( 4 ); //transportIdArray, conn, serverURI, newServerURI + CloseDSProfile(); + _DBG_FILE("CNSmlDSSettingsAdapter::SetProfileConnectionPortNrL(): end"); + return KErrNone; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetPortNrToAddrStr +// The function sets or replaces a portnbr (separated with ':') to Addr Uri. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::SetPortNrToAddrStr( const TDesC8& aSrvURI, + HBufC8* aNewURI, + const TDesC8& aPort ) + { + TInt offset=0; + if( aSrvURI.Find( KNSmlDSSettingsHTTP ) == 0 )//http:// + { + offset = KNSmlDSSettingsHTTP().Length(); + } + else if( aSrvURI.Find( KNSmlDSSettingsHTTPS ) == 0 )//https:// + { + offset = KNSmlDSSettingsHTTPS().Length(); + } + + TInt portStart = -1; + TInt separatorPos = aSrvURI.Length(); + + TInt i = 0; + for( i = offset; i < aSrvURI.Length(); i++ ) + { + if( aSrvURI[i] == KNSmlDMColon )// ':' + { + portStart = i; + } + if( aSrvURI[i] == KNSmlDMUriSeparator )// '/' + { + separatorPos = i; + break; + } + } + + TPtr8 ptrNewSrvURI = aNewURI->Des(); + if( portStart < 0 && separatorPos > 0 && iLeafType != EDSDelete ) + { + ptrNewSrvURI.Append( aSrvURI.Left( separatorPos ) );//http://123.234.345.456 + ptrNewSrvURI.Append( KNSmlDMColon ); + ptrNewSrvURI.Append( aPort ); + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) );//123.234.345.456:xx(x)/syncml + } + else if ( portStart > 0 && separatorPos > 0 && iLeafType != EDSDelete ) + { + ptrNewSrvURI.Append( aSrvURI.Left( portStart + 1 ) );//123.234.345.456: + ptrNewSrvURI.Append( aPort );//123.234.345.456:xx(x) + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) );//123.234.345.456:xx(x)/syncml + } + else if ( portStart > 0 && iLeafType == EDSDelete ) //delete port number from uri + { + ptrNewSrvURI.Append( aSrvURI.Left( portStart ) );//123.234.345.456 + ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) );//123.234.345.456:xx(x)/syncml + } + else + { + ptrNewSrvURI.Append( aSrvURI ); + } + return; + } +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::MimeTypeAllreadyExitsL +// The function checks if mime type allready exits in this profile. +//------------------------------------------------------------------------------ +TBool CNSmlDSSettingsAdapter::MimeTypeAllreadyExitsL( const TInt aLuid, + const TDesC8& aMimeType ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aLuid, ESmlOpenRead ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return EFalse; + } + RArray dataProviderArray; + CleanupClosePushL( dataProviderArray ); + iSyncSession.ListDataProvidersL( dataProviderArray ); + TInt dataProviderCount = dataProviderArray.Count(); + if( dataProviderCount == 0 ) + {//error case, data provider not found + CloseDSProfile(); + CleanupStack::PopAndDestroy();//dataProviderIdArray + return EFalse; + } + + RSyncMLTask task; + RSyncMLDataProvider dataProvider; + RArray taskIdArray; + iDSProfile.ListTasksL( taskIdArray ); + CleanupClosePushL(taskIdArray); + + HBufC8* object = aMimeType.AllocLC(); + TPtr8 objectPtr = object->Des(); + objectPtr.LowerCase(); + + for( TInt i = 0; iDes(); + bufPtr16.Delete(0, bufPtr16.Size()); + CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aStore ); + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::SetProfileIAPIdL +// The function sets the IAPId value to profile connection properties. +//------------------------------------------------------------------------------ +TInt CNSmlDSSettingsAdapter::SetProfileIAPIdL( const TInt aLUID, const TInt aIAPid ) + { + TInt retVal = OpenSyncSessionAndDSProfileL( aLUID, ESmlOpenReadWrite ); + if( retVal != KErrNone ) + { + CloseDSProfile(); + return retVal; + } + RArray connIdArray; + CleanupClosePushL( connIdArray ); + iDSProfile.ListConnectionsL( connIdArray ); + if( connIdArray.Count() == 1 ) + { + RSyncMLTransport transport; + CleanupClosePushL( transport ); + transport.OpenL( iSyncSession, connIdArray[0] ); + const CSyncMLTransportPropertiesArray& props = transport.Properties(); + TInt index = props.Find( KNSmlIAPId ); + if( index > 0 ) + { + RSyncMLConnection conn; + CleanupClosePushL( conn ); + conn.OpenL( iDSProfile, connIdArray[0] ); + HBufC8* apIdBuffer = HBufC8::NewLC( 4 ); + TPtr8 ptrIapIdBuf = apIdBuffer->Des(); + ptrIapIdBuf.Num( aIAPid ); + conn.SetPropertyL( KNSmlIAPId, ptrIapIdBuf ); + conn.UpdateL(); + CleanupStack::PopAndDestroy( 2 ); //conn, apIdBuffer + retVal = KErrNone; + } + else + { + retVal = KErrNotFound; + } + CleanupStack::PopAndDestroy(); //transport + } + else + { + retVal = KErrNotFound; + } + CloseDSProfile(); + CleanupStack::PopAndDestroy(); //connIdArray + return retVal; + } + +//------------------------------------------------------------------------------ +// CNSmlDSSettingsAdapter::GetMediumTypeL +// The function checks the requested medium type and gets it UID. +//------------------------------------------------------------------------------ +void CNSmlDSSettingsAdapter::GetMediumTypeL( const TInt aIntObj, + TSmlTransportId& aMediumType ) + { + if( aIntObj == EHttp|| aIntObj == ENone || aIntObj == EWsp) + { + aMediumType = KUidNSmlMediumTypeInternet.iUid; + return; + } + RArray transportIdArray; + CleanupClosePushL( transportIdArray ); + iSyncSession.ListTransportsL( transportIdArray ); + if ( transportIdArray.Find( KUidNSmlMediumTypeBluetooth.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeBluetooth.iUid; + } + else if ( transportIdArray.Find( KUidNSmlMediumTypeUSB.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeUSB.iUid; + } + else if ( transportIdArray.Find( KUidNSmlMediumTypeIrDA.iUid ) != KErrNotFound ) + { + aMediumType = KUidNSmlMediumTypeIrDA.iUid; + } + CleanupStack::PopAndDestroy(); //transportIdArray + return; + } + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +//------------------------------------------------------------------------------ +// TImplementationProxy ImplementationTable[] +//------------------------------------------------------------------------------ + +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KNSmlDSSettingsAdapterImplUid, CNSmlDSSettingsAdapter::NewL ) + }; + +//------------------------------------------------------------------------------ +// TImplementationProxy* ImplementationGroupProxy() +//------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlDSSettingsAdapter: begin"); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + _DBG_FILE("ImplementationGroupProxy() for CNSmlDSSettingsAdapter: end"); + return ImplementationTable; + } + + +//-------------------------------------------------------------------- +//TInt CNSmlDMSettingsAdapter::IsDSAccUriFormatMatchPredefined(const TDesC8 & aURI) +// +//------------------------------------------------------------------- + +TBool CNSmlDSSettingsAdapter::IsDSAccUriFormatMatchPredefined(const TDesC8 & aURI) +{ + + // include strings for tree for Bearer , DNS related Dynamic nodes . + + if(aURI.Match(_L8("SyncML/DSAcc/DSId*")) != KErrNotFound || + aURI.Match(_L8("SyncML/DSAcc/DSId*/DB/CTId*")) != KErrNotFound) + { + return ETrue; + } + else + { + return EFalse; + } + + +} + +//-------------------------------------------------------------------- +//TInt CNSmlDMSettingsAdapter::ConstructTreeL(const TDesC8& aURI) +// +//------------------------------------------------------------------- + +TInt CNSmlDSSettingsAdapter::ConstructTreeL(const TDesC8& aURI) +{ + TInt profileID = KErrNotFound; +RDebug::Print( _L("jshong FOTA : ConstructTreeL 1 ")) ; + TBool notDBSet(EFalse); + if( iSyncSessionOpen == EFalse ) + { + iSyncSession.OpenL(); + iSyncSessionOpen = ETrue; + } + RArray profileIdArray; + CleanupClosePushL( profileIdArray ); + TSmlUsageType usageType = ESmlDataSync; + iSyncSession.ListProfilesL( profileIdArray, usageType ); +RDebug::Print( _L("jshong FOTA : ConstructTreeL 1-2 ") ); + + for( TInt p = 0; p < profileIdArray.Count(); p++ ) + { + TInt ddId = profileIdArray[p] ; // update remove KMAxDatasyncID - KMaxDataSyncID; +RDebug::Print( _L("jshong FOTA : ConstructTreeL 1-3 ") ); + + _LIT8( Kprev, "DSId" );// update changed from DMId to DSId + TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid + TInt fixedProfId = profileIdArray[p] ; // update remove KMAxDatasyncID // - KMaxDataSyncID; //fit to 3 decimal + addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); + DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME ); + RDebug::Print( _L("notInList: Id = %d Name %S"), p, &addNAME ); + // KNSmlDMStart includes start text for URISeg + TBuf8<20> addURI; // SyncML/DMAcc/DMIdnnn , nnn = profileid + addURI.Append( KNSmlDSStart ); + addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); + TBuf8<3> addLUID; + addLUID.Num( fixedProfId ); + + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI); +RDebug::Print( _L("jshong FOTA : ConstructTreeL 1-4 addURI = %S"), &addURI ); + + if (mapInfo->Length() == 0) + { + iCallBack->SetMappingL(addURI,addLUID); + +RDebug::Print( _L("jshong FOTA : ConstructTreeL 1-5 ") ); + + if(( aURI.Find(addURI) >= 0 ) && !notDBSet) + { + profileID = fixedProfId; + } + + // update , Update ../DB/CTId also + TInt retVal = OpenSyncSessionAndDSProfileL( fixedProfId, ESmlOpenRead ); + if( retVal == KErrNone ) + { + +RDebug::Print( _L("jshong FOTA : ConstructTreeL 2 ") ); + + + RArray taskIdArray; + CleanupClosePushL( taskIdArray ); + iDSProfile.ListTasksL( taskIdArray ); + if( taskIdArray.Count() == 0 ) + { +RDebug::Print( _L("jshong FOTA : ConstructTreeL 3 ")) ; + CloseDSProfile(); + CleanupStack::PopAndDestroy();//taskIdArray + // return KErrNotFound; + } + else + { + RSyncMLTask task; +RDebug::Print( _L("jshong FOTA : ConstructTreeL 4 ")) ; + + CleanupClosePushL( task ); + + for ( TInt i = 0; i < taskIdArray.Count(); i++ ) + { + // + // Check if ContentType -> Task ID on list + // + TInt ddId( 0 ); +RDebug::Print( _L("jshong FOTA : ConstructTreeL 5 ")) ; + + task.OpenL( iDSProfile, taskIdArray[i] ); + ddId = task.DataProvider(); + task.Close(); + + //Get Task ID + // addNAME.AppendNumFixedWidth( taskIdArray[i], EDecimal,3 ); +RDebug::Print( _L("jshong FOTA : ConstructTreeL 6 ") ); + + TBuf8<80> addDBURI; + + addDBURI.Append( addURI ); + _LIT8( KDB, "/DB" );// addDb also + addDBURI.Append( KDB ); + addDBURI.Append( Kprev2 ); + addDBURI.AppendNumFixedWidth( taskIdArray[i], EDecimal, 3 ); +RDebug::Print( _L("jshong FOTA : ConstructTreeL 7 ")) ; + + TBuf8<16> addDBLUID; + addDBLUID.Num( ddId ); + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addDBURI); + if (mapInfo->Length() == 0) + { + iCallBack->SetMappingL(addDBURI,addDBLUID); + + if( aURI.Find(addDBURI) >= 0 ) + { + profileID = ddId; + notDBSet = ETrue; + } + } + + } //For + CloseDSProfile(); + CleanupStack::PopAndDestroy(2);// task, taskIdArray + } + + //return KErrGeneral; + } + else + { + CloseDSProfile(); + } + + } + else + { +RDebug::Print( _L("jshong FOTA : ConstructTreeL 1-5 ") ); + + delete mapInfo; + } + + + } + + CleanupStack::PopAndDestroy( 1 );//profileIdArray + return profileID; +} + +//------------------------------------------------------------------------------ +// TPtrC8 CUtils::GetDynamicDSNodeUri( const TDesC8& aURI ) +// returns Syncml/DSAcc/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CNSmlDSSettingsAdapter::GetDynamicDSNodeUri(const TDesC8& aURI) + { + TInt i= 0; + TBuf8<50> DsAccRoot(KDSAcc1); + for ( i = aURI.Find( KDSAcc1 ) + DsAccRoot.Length() + 1 ; i < aURI.Length(); i++ ) + { + if( aURI[i] == '/' ) + { break; + } + } + + return aURI.Left( i ); + } + +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/src/nsmldssettingsadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/src/nsmldssettingsadapter.rss Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,48 @@ +CHARACTER_SET UTF8/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource data for Device Management DS Settings Adapter +* +*/ + + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F6DE7; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F6DED; // DM interface implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/bwins/syncmldstestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/bwins/syncmldstestu.def Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/conf/syncmldstest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/conf/syncmldstest.cfg Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,168 @@ +[Test] +title DDF +create syncmldstest foobar jee +foobar DDFStructure +delete foobar +[Endtest] + +[Test] +title StartAtomic +create syncmldstest foobar +foobar StartAtomic +delete foobar +[Endtest] + +[Test] +title CommitAtomic +create syncmldstest foobar +foobar CommitAtomic +delete foobar +[Endtest] + +[Test] +title RollbackAtomic +create syncmldstest foobar +foobar RollbackAtomic +delete foobar +[Endtest] + +[Test] +title AddDSAcc099 +create syncmldstest foobar +foobar AddNode SyncML/DSAcc/DSId099 +foobar UpdateLeaf SyncML/DSAcc/DSId099/Name name99 +foobar UpdateLeaf SyncML/DSAcc/DSId099/ServerId server99 +foobar UpdateLeaf SyncML/DSAcc/DSId099/Addr Test +foobar UpdateLeaf SyncML/DSAcc/DSId099/ClientUserName user99 +foobar CompleteCommands +delete foobar +[Endtest] + +[Test] +title UpdateName +create syncmldstest foobar +foobar UpdateLeaf SyncML/DSAcc/DSId099/Name newname99 +delete foobar +[Endtest] + +[Test] +title UpdateAddr +create syncmldstest foobar +foobar UpdateLeaf SyncML/DSAcc/DSId099/Addr Dummy +delete foobar +[Endtest] + +[Test] +title UpdateClientUserName +create syncmldstest foobar +foobar UpdateLeaf SyncML/DSAcc/DSId099/ClientUserName dummy99 +delete foobar +[Endtest] + +[Test] +title FetchNodeDSAcc +create syncmldstest foobar +foobar FetchNode SyncML/DSAcc +delete foobar +[Endtest] + +[Test] +title FetchLeafDSAccName +create syncmldstest foobar +foobar FetchLeaf SyncML/DSAcc/DSId099/Name +delete foobar +[Endtest] + +[Test] +title FetchLeafDSAccServerId +create syncmldstest foobar +foobar FetchLeaf SyncML/DSAcc/DSId099/ServerId +delete foobar +[Endtest] + +[Test] +title FetchLeafDSAccAddr +create syncmldstest foobar +foobar FetchLeaf SyncML/DSAcc/DSId099/Addr +delete foobar +[Endtest] + +[Test] +title FetchLeafDSAccClientUserName +create syncmldstest foobar +foobar FetchLeaf SyncML/DSAcc/DSId099/ClientUserName +delete foobar +[Endtest] + +[Test] +title DeleteDSAcc +create syncmldstest foobar +foobar DeleteNode SyncML/DSAcc/DSId099 +delete foobar +[Endtest] + +[Test] +title AddDSAcc090 +create syncmldstest foobar +foobar AddNode SyncML/DSAcc/DSId090 +foobar UpdateLeaf SyncML/DSAcc/DSId090/Addr NewAcc +foobar UpdateLeaf SyncML/DSAcc/DSId090/AddrType 3 +foobar UpdateLeaf SyncML/DSAcc/DSId090/ClientPW passwd +foobar UpdateLeaf SyncML/DSAcc/DSId090/ClientUserName uname +foobar AddNode SyncML/DSAcc/DSId090/DB +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId090 +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId090/CTType text/x-vcalendar +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId090/LDBURI C:\calender +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId090/RDBURI Calendar +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId091 +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId091/CTType text/x-vcard +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId091/LDBURI C:\contacts +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId091/RDBURI Contacts +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId092 +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId092/CTType application/vnd.omads-email+xml +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId092/LDBURI C:\email +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId092/RDBURI Email +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId093 +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId093/CTType text/plain +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId093/LDBURI C:\notes +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId093/RDBURI Notes +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId094 +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId094/CTType text/x-vBookmark +foobar AddNode SyncML/DSAcc/DSId090/DB/CTId094/LDBURI C:\bookmarks +foobar UpdateLeaf SyncML/DSAcc/DSId090/DB/CTId094/RDBURI Bookmarks +foobar UpdateLeaf SyncML/DSAcc/DSId090/Name TestDummy +foobar UpdateLeaf SyncML/DSAcc/DSId090/ServerId TestDummy +foobar UpdateLeaf SyncML/DSAcc/DSId090/ToNapID AP/APId000 +foobar CompleteCommands +delete foobar +[Endtest] + +[Test] +title FetchAllLeafDsAcc +create syncmldstest foobar +foobar FetchLeaf SyncML/DSAcc/DSId090/Addr +foobar FetchLeaf SyncML/DSAcc/DSId090/AddrType +foobar FetchLeaf SyncML/DSAcc/DSId090/ClientPW +foobar FetchLeaf SyncML/DSAcc/DSId090/ClientUserName +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId090/CTType +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId090/RDBURI +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId091/CTType +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId091/RDBURI +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId092/CTType +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId092/RDBURI +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId093/CTType +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId093/RDBURI +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId094/CTType +foobar FetchLeaf SyncML/DSAcc/DSId090/DB/CTId094/RDBURI +foobar FetchLeaf SyncML/DSAcc/DSId090/Name +foobar FetchLeaf SyncML/DSAcc/DSId090/ServerId +foobar FetchLeaf SyncML/DSAcc/DSId090/ToNapID +delete foobar +[Endtest] + +[Test] +title DeleteDSAcc90 +create syncmldstest foobar +foobar DeleteNode SyncML/DSAcc/DSId090 +delete foobar +[Endtest] diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/eabi/syncmldstestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/eabi/syncmldstestu.def Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,9 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI13CsyncmldsTest @ 2 NONAME ; ## + _ZTI16CTestDmDDFObject @ 3 NONAME ; ## + _ZTI8Cdmatest @ 4 NONAME ; ## + _ZTV13CsyncmldsTest @ 5 NONAME ; ## + _ZTV16CTestDmDDFObject @ 6 NONAME ; ## + _ZTV8Cdmatest @ 7 NONAME ; ## + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/group/bld.inf Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: + + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +syncmldstest.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/group/syncmldstest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/group/syncmldstest.mmp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + +#include + +TARGET syncmldstest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE syncmldstest.def + +SOURCEPATH ../src +SOURCE dmatest.cpp +SOURCE TestDmDDFObject.cpp +SOURCE syncmldstest.cpp +SOURCE syncmldstestBlocks.cpp + + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +SYSTEMINCLUDE /epoc32/include/ecom +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY apgrfx.lib apmime.lib +LIBRARY euser.lib ecom.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY SWInstCli.lib + +LANG SC + + + +SMPSAFE +// End of File + diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/group/syncmldstest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/group/syncmldstest.pkg Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,38 @@ +; +; Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Implementation of DM adapter test component +; This is part of omadmextensions/adapter test application. +; + +;*Languages +&EN +; +;*Standard SIS file header. This section specifies the package name, +;application UID, and version/build numbers. Add the package TYPE here if needed. +#{"syncmldstest"},(0x101FB3E8),1,0,1; +; + +;*Unique (Non-Localised) Vendor name +;This is used in combination with signing to prevent the unauthroized +;upgrade ofa a package by someone other than the rightful vendor. +:"Nokia" + +;*Localized Vendor Name +;This specifies the localised vendor name(s) correspodning to language(s). +%{"Nokia Test EN"} + +;*Files To Copy... +"\epoc32\release\armv5\urel\syncmldstest.dll" -"C:\sys\bin\syncmldstest.dll" +"..\conf\syncmldstest.cfg"-"C:\TestFramework\syncmldstest.cfg" +"..\init\syncmldstest.ini"-"C:\TestFramework\syncmldstest.ini" diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/inc/TestDmDDFObject.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef __TESTDMDDFOBJECT_H +#define __TESTDMDDFOBJECT_H + +// INCLUDES +//#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +class CStifLogger; + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class CTestDmDDFObject : public CBase, public MSmlDmDDFObject + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CTestDmDDFObject* NewL( CStifLogger *aLog ); + static CTestDmDDFObject* NewLC( CStifLogger *aLog ); + + /** + * Destructor. + */ + virtual ~CTestDmDDFObject(); + + public: // New functions + + /** + * ?member_description. + * @since Series ?XX ?SeriesXX_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + virtual void SetNameL( const TDesC8& aName ); + + void DumpL( const TDesC8& aParentName, TBool aFullDump = ETrue ); + void ExternalizeL(RWriteStream& aStream) const; + + + + public: // Functions from base classes + +//sf- ********************************* + + void SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ); + void SetDefaultValueL( const TDesC8& aDefaultValue ); + void SetDescriptionL( const TDesC8& aDescription ); + void SetDFFormatL( TDFFormat aFormat ); + void SetOccurenceL( TOccurence aOccurence ); + void SetScopeL( TScope aScope ); + void SetDFTitleL( const TDesC8& aTitle ); + void AddDFTypeMimeTypeL( const TDesC8& aMimeType ); + void SetAsObjectGroup(); + MSmlDmDDFObject& AddChildObjectL(const TDesC8& aNodeName); + MSmlDmDDFObject& AddChildObjectGroupL(); + +//sf- ############################# + + const TDesC8& Name(); + TSmlDmAccessTypes AccessTypes(); + const TDesC8& DefaultValue(); + const TDesC8& Description(); + TDFFormat DFFormat(); + TOccurence Occurence(); + TScope Scope(); + const TDesC8& DFTitle(); + const TDesC8& DFTypeMimeType(); + TBool ObjectGroup(); + + TInt ChildObjectCount(); + CTestDmDDFObject& ChildObject( TInt aIndex ); + + CTestDmDDFObject* FindChildObject( const TDesC8& aName ); + TInt SubObjectsCount(); + + + protected: // New functions + + /** + * ?member_description. + * @since Series ?XX ?SeriesXX_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CTestDmDDFObject( CStifLogger *aLog ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // CTestDmDDFObject( const CTestDmDDFObject& ); + // Prohibit assigment operator if not deriving from CBase. + // CTestDmDDFObject& operator=( const CTestDmDDFObject& ); + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + // ?one_line_short_description_of_data + //?data_declaration; + HBufC8* iName; + + TSmlDmAccessTypes iAccessTypes; + HBufC8* iDefaultValue; + HBufC8* iDescription; + TDFFormat iFormat; + TOccurence iOccurence; + TScope iScope; + HBufC8* iTitle; + HBufC8* iMimeType; + TBool iObjectGroup; + + RPointerArray iChildren; + + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + /** + * Logger. + */ + CStifLogger* iLog; + + }; + +#endif // __TESTDMDDFOBJECT_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/inc/dmatest.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef __DMA_TEST_H__ +#define __DMA_TEST_H__ + +// INCLUDES +#include +#include +#include +#include +#include + +#include "NSmlDSSettingsAdapter.h" + +class Cdmatest; + + +struct TMapping + { + TBuf8<256> iURI; + TBuf8<64> iLuid; + TMapping( const TDesC8 &aURI, const TDesC8 &aLuid ) : iURI( aURI ), iLuid( aLuid ) + { + + } + }; + +typedef RArray RMappingArray; + +typedef void (Cdmatest::* ResultsFunction)( TInt , CBufBase& , const TDesC8& ) ; + + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +* +* @lib ?library +* @since Series ?XX ?SeriesXX_version +*/ +class Cdmatest : public CScriptBase, public MSmlDmCallback + { + + public: // Constructors and destructor + + /** + * Destructor. + */ + virtual ~Cdmatest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ) = 0; + + + public: + /** + The function is used to return the data in case of FetchLeafObjectL(), + FetchLeafObjectSizeL() and ChildURIListL() functions. It should not be + called where the DM command has failed, i.e. the error code returned in + SetStatusL is something other than EOk. + @param aResultsRef Reference to correct command + @param aObject The data which should be returned + @param aType MIME type of the object + @publishedPartner + @prototype + */ + void SetResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); + + /** + The function is used to return the data in case of FetchLeafObjectL() and + ChildURIListL() functions, where the size of the data being returned is + large enough for the Adapter to stream it. This function should not be + called when command was failed, i.e. the error code returned in SetStatusL + is something other than EOk. + @param aResultsRef Reference to correct command + @param aStream Large data which should be returned, DM engine + closes stream when it has read all the data + @param aType MIME type of the object + @publishedPartner + @prototype + */ + void SetResultsL( TInt /*aResultsRef*/, RReadStream*& /*aStream*/, + const TDesC8& /*aType*/ ) + { + + } + + /** + The function returns information about the Add,Update,Delete and Fetch + commands success to DM engine. The reference to correct command must be + used when calling the SetStatusL function, the reference is got from the + argument of the command functions. The SetStatusL function must be called + separately for every single command. + @param aStatusRef Reference to correct command + @param aErrorCode Information about the command success + @publishedPartner + @prototype + */ + void SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) ; + + /** + The function passes map information to DM Module. This function is called + for a new management object, both for node objects and for leaf objects. + In addition if ChildURIListL() function has returned new objects a mapping + information of the new objects must be passed. A mapping is treated as + inheritable. If the mapping is not set with this function, the mapping + LUID of the parent object is passed in following commands to the object. + @param aURI URI of the object. + @param aLUID LUID of the object. LUID must contain the all information, + which is needed for retrieve the invidual object from the + database. Typically it is ID for the database table. In + more complicated structures it can be combination of IDs, + which represent path to the object. + @publishedPartner + @prototype + */ + void SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ); + + /** + The function is used to make a fetch to other adapters. The most common + use is to make a fetch to the AP adapter, because when managing the access + points, the data comes as URI. For example, there are ToNAPId field in + some adapters, and data to it can be something like AP/IAPidx, and then + the link to AP adapter is needed. + Using FetchLinkL causes the DM Framework to make a Get request to the + appropriate DM adapter. The receiving adapter MUST complete the Get + request synchronously. + @param aURI URI of the object. + @param aData Reference to data, i.e. data is returned here + @param aStatus The status of fetch command is returned here + @publishedPartner + @prototype + */ + void FetchLinkL( const TDesC8& /*aURI*/, CBufBase& /*aData*/, + MSmlDmAdapter::TError& /*aStatus*/ ) + { + + } + + /** + The function returns the LUID which is mapped to aURI. If LUID is not + found, the function allocates a null length string, i.e. the function + allocates memory in every case. + @param aURI URI of the object. + @publishedPartner + @prototype + */ + HBufC8* GetLuidAllocL( const TDesC8& aURI ) ; + +#ifdef __TARM_SYMBIAN_CONVERGENCY + + void GetMappingInfoListL( const TDesC8& aURI, + CArrayFix& aSegmentList ); + +#else +// nothing +#endif + + protected: // New functions + + + void FetchNodeResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); + void SaveDataL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ) ; + + TPtrC8 LastURISeg( const TDesC8& aURI ); + TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); + TPtrC RemoveLastURISeg( const TDesC& aURI ); + void SetURIL( const TDesC& aURI ); + void SetURIL( const TDesC8& aURI ); + void SetURIL( HBufC8* aURI ); + HBufC8 *LoadFileLC( const TDesC &aFileName, TDataType &aType ); + HBufC8 *LoadFileLC( const TDesC8 &aFileName, TDataType &aType ); + HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); + HBufC8* GetLuidAllocLC( const TDesC8& aURI ) ; + TPtrC8 RemoveLastSeg(const TDesC8& aURI); + + TInt FetchNodeL( CStifItemParser& aItem ) ; + TInt FetchLeafL( CStifItemParser& aItem ) ; + TInt AddNodeL( CStifItemParser& aItem ); + TInt DeleteObjectL( CStifItemParser& aItem ); + TInt UpdateLeafL( CStifItemParser& aItem ) ; + TInt UpdateLeafDataL( CStifItemParser& aItem ) ; + TInt UpdateLeafDataURLL( CStifItemParser& aItem ) ; + + TInt ExecuteLeafL ( CStifItemParser& aItem ) ; + TInt ExecuteLeafDataL ( CStifItemParser& aItem ) ; + TInt StartAtomicL( CStifItemParser& aItem ) ; + TInt CommitAtomicL( CStifItemParser& aItem ) ; + TInt RollbackAtomicL( CStifItemParser& aItem ) ; + TInt CompleteCommandsL( CStifItemParser& aItem ); + TInt DDFStructureL( CStifItemParser& aItem ) ; +// TInt DeliverL( CStifItemParser& aItem ) ; +// TInt DetailsL( CStifItemParser& aItem ) ; +// TInt InstallL( CStifItemParser& aItem ) ; +// TInt BareInstallL( CStifItemParser& aItem ) ; + + protected: + + /** + * C++ default constructor. + */ + Cdmatest( CTestModuleIf& aTestModuleIf, TUid aUid ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // Cdmatest( const Cdmatest& ); + // Prohibit assigment operator if not deriving from CBase. + // Cdmatest& operator=( const Cdmatest& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + virtual void Delete(); + void LoadMappingsL(); + void SaveMappingsL(); + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + MSmlDmAdapter::TError iStatus ; + ResultsFunction iResultsFunction; + //CSmlDmAdapter *iAdapter ; + CNSmlDSSettingsAdapter *iAdapter ; + HBufC8 *iURI; + CArrayFix *iEmptyMappingInfoArray; + TFileName iSaveFileName; + RMappingArray iMappingTable; + TUid iUid; + TInt iCounter; + //class CNSmlDmMgmtTree* iMgmtTree; + class CNSmlDmMgmtTree* iMgmtTree; + CNSmlDSSettingsAdapter *Adapter() ; + }; + +#endif // __DMA_TEST_H__ + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/inc/syncmldstest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/inc/syncmldstest.h Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +#ifndef TCTEST_H +#define TCTEST_H + +// INCLUDES +#include +#include +#include +#include +#include "dmatest.h" + +const TUint KNSmlDSSettingsAdapterImplUid = 0x101F6DED; + + +const TUid KAdapterUid = + { + KNSmlDSSettingsAdapterImplUid + }; +// Logging path +_LIT( KamtestLogPath, "\\logs\\testframework\\tctest\\" ); +// Log file +_LIT( KamtestLogFile, "tctest.txt" ); + + +// FORWARD DECLARATIONS +class CsyncmldsTest; + + +// CLASS DECLARATION + +/** +* CsyncmldsTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +class CsyncmldsTest : public Cdmatest + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CsyncmldsTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CsyncmldsTest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + + private: + + /** + * C++ default constructor. + */ + CsyncmldsTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + virtual void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ +/* virtual TInt ExampleL( CStifItemParser& aItem ) ; + virtual TInt DeliverL( CStifItemParser& aItem ) ; + virtual TInt DetailsL( CStifItemParser& aItem ) ; + virtual TInt InstallL( CStifItemParser& aItem ) ; + virtual TInt BareInstallL( CStifItemParser& aItem ) ;*/ + + + private: // Data + HBufC8 *GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ); + + + }; + +#endif // TCTEST_H + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/init/syncmldstest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/init/syncmldstest.ini Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,204 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +[New_Module] +ModuleName= testscripter +#DM +TestCaseFile= c:\testframework\syncmldstest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/src/TestDmDDFObject.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,516 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES + +#include "TestDmDDFObject.h" +#include "StifLogger.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::CTestDmDDFObject +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CTestDmDDFObject::CTestDmDDFObject( CStifLogger *aLog ) + : iName( 0 ) + , iAccessTypes() + , iDefaultValue( 0 ) + , iDescription( 0 ) + , iFormat( (TDFFormat)0 ) + , iOccurence( (TOccurence)0 ) + , iScope( (TScope)0 ) + , iTitle ( 0 ) + , iMimeType( 0 ) + , iObjectGroup( EFalse ) + , iLog( aLog ) +// RPointerArray iChildren; + { + } + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CTestDmDDFObject::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTestDmDDFObject* CTestDmDDFObject::NewL( CStifLogger *aLog ) + { + CTestDmDDFObject* self = CTestDmDDFObject::NewLC( aLog ); + CleanupStack::Pop( self ); + + return self; + } + +CTestDmDDFObject* CTestDmDDFObject::NewLC( CStifLogger *aLog ) + { + CTestDmDDFObject* self = new( ELeave ) CTestDmDDFObject( aLog ); + + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + + +// Destructor +CTestDmDDFObject::~CTestDmDDFObject() + { + delete iName; + delete iDefaultValue; + delete iDescription; + delete iTitle; + delete iMimeType; + iChildren.ResetAndDestroy(); + } + + +// ----------------------------------------------------------------------------- +// CTestDmDDFObject::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/*?type CTestDmDDFObject::?member_function( + ?arg_type arg, + ?arg_type arg ) + { + + ?code + + } +*/ + +void CTestDmDDFObject::SetAccessTypesL( TSmlDmAccessTypes aAccessTypes ) + { + iLog->Log( _L8( "SetAccessTypesL, aAccessTypes=%d" ), aAccessTypes.GetACL() ); + iAccessTypes = aAccessTypes; + } + +void CTestDmDDFObject::SetDefaultValueL( const TDesC8& aDefaultValue ) + { + iLog->Log( _L8( "SetDefaultValueL, aDefaultValue='%S'" ), &aDefaultValue ); + delete iDefaultValue; + iDefaultValue = 0; + iDefaultValue = aDefaultValue.AllocL(); + } + +void CTestDmDDFObject::SetDescriptionL( const TDesC8& aDescription ) + { + iLog->Log( _L8( "SetDescriptionL, aDescription='%S'" ), &aDescription ); + delete iDescription; + iDescription = 0; + iDescription = aDescription.AllocL(); + } + +void CTestDmDDFObject::SetDFFormatL( TDFFormat aFormat ) + { + iLog->Log( _L8( "SetDFFormatL, aFormat=%d" ), aFormat ); + iFormat = aFormat; + } + +void CTestDmDDFObject::SetOccurenceL( TOccurence aOccurence ) + { + iLog->Log( _L8( "SetOccurenceL, aOccurence=%d" ), aOccurence ); + iOccurence = aOccurence; + } + +void CTestDmDDFObject::SetScopeL( TScope aScope ) + { + iLog->Log( _L8( "SetScopeL, aScope=%d" ), aScope ); + iScope = aScope; + } + +void CTestDmDDFObject::SetDFTitleL( const TDesC8& aTitle ) + { + iLog->Log( _L8( "SetDFTitleL, aTitle='%S'" ), &aTitle ); + delete iTitle; + iTitle = 0; + iTitle = aTitle.AllocL(); + } + +void CTestDmDDFObject::AddDFTypeMimeTypeL( const TDesC8& aMimeType ) + { + iLog->Log( _L8( "AddDFTypeMimeTypeL, aMimeType='%S'" ), &aMimeType ); + delete iMimeType; + iMimeType = 0; + iMimeType = aMimeType.AllocL(); + } + +void CTestDmDDFObject::SetAsObjectGroup() + { + iLog->Log( _L8( "SetAsObjectGroup, true" ) ); + iObjectGroup = ETrue; + } + +MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectL(const TDesC8& aNodeName) + { + iLog->Log( _L8( "AddChildObjectL, aNodeName='%S'" ), &aNodeName ); + CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); + child->SetNameL( aNodeName ); + iChildren.AppendL( child ); + CleanupStack::Pop( child ); // Don't destroy + return *child; + } + +MSmlDmDDFObject& CTestDmDDFObject::AddChildObjectGroupL() + { + iLog->Log( _L8( "AddChildObjectGroupL, ''" ) ); + CTestDmDDFObject* child = CTestDmDDFObject::NewLC( iLog ); //, KNullDesC ); + child->SetAsObjectGroup(); + iChildren.AppendL( child ); + CleanupStack::Pop( child ); // Don't destroy + return *child; + } + +// Own functions + +void CTestDmDDFObject::SetNameL( const TDesC8& aName ) + { + delete iName; + iName = 0; + iName = aName.AllocL(); + } + +void CTestDmDDFObject::DumpL( const TDesC8& aParentName, TBool aFullDump ) + { + TPtrC8 name( _L8("") ); + if (iName && iName->Length() > 0) + { + name.Set( *iName ); + } + + HBufC8* fullName = HBufC8::NewLC( aParentName.Length() + name.Length() + 1 ); + *fullName = aParentName; + if (aParentName.Length() > 0 && aParentName[ aParentName.Length() - 1 ] != '/') + { + fullName->Des().Append( _L8("/")); + } + fullName->Des().Append( name ); + + /* Translate some members to text for dumping */ + TBuf8<20> strAccessTypes; + TUint8 accessTypes = iAccessTypes.GetACL(); + if ((accessTypes & iAccessTypes.EAccessType_Add) != 0) + { + strAccessTypes.Append( _L8("A") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Copy) != 0) + { + strAccessTypes.Append( _L8("C") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Delete) != 0) + { + strAccessTypes.Append( _L8("D") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Exec) != 0) + { + strAccessTypes.Append( _L8("E") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Get) != 0) + { + strAccessTypes.Append( _L8("G") ); + } + if ((accessTypes & iAccessTypes.EAccessType_Replace) != 0) + { + strAccessTypes.Append( _L8("R") ); + } + + TBuf8<20> strFormat; + switch( iFormat ) + { + case EB64: + strFormat = _L8("Base64"); + break; + case EBool: + strFormat = _L8("Bool"); + break; + case EChr: + strFormat = _L8("Chr"); + break; + case EInt: + strFormat = _L8("Int"); + break; + case ENode: + strFormat = _L8("Node"); + break; + case ENull: + strFormat = _L8("Null"); + break; + case EXml: + strFormat = _L8("Xml"); + break; + case EBin: + strFormat = _L8("Bin"); + break; + default: + break; + } + + + TBuf8<20> strOccurence; + switch( iOccurence ) + { + case EOne: + /** The node appears exactly once */ + strOccurence = _L8("M:1"); + break; + case EZeroOrOne: + /** The node is optional and may appear zero or once */ + strOccurence = _L8("O:0-1"); + break; + case EZeroOrMore: + /** The node is optional and may appear zero or more times */ + strOccurence = _L8("O:0-*"); + break; + case EOneOrMore: + /** The node is mandatory and may appear once or more times */ + strOccurence = _L8("M:1-*"); + break; + case EZeroOrN: + /** The node is optional and may appear between once and 'N' times */ + strOccurence = _L8("O:1-N"); + break; + case EOneOrN: + /** The node is mandatory and may appear between once and 'N' times */ + strOccurence = _L8("M:1-N"); + break; + default: + break; + } + + + TBuf8<20> strScope; + switch( iScope) + { + case EPermanent: + /** The node appears exactly once */ + strScope = _L8("Permanent"); + break; + case EDynamic: + /** The node is optional and may appear zero or once */ + strScope = _L8("O:Dynamic"); + break; + default: + break; + } + + + /* Dump main data */ + if (aFullDump) + { + iLog->Log( _L8( "DDFObject: '%S'" ), fullName ); + } + else + { + iLog->Log( _L8( "DDFObject: '%S' (%S), %S, %S, %S" ), + fullName, &strAccessTypes, &strFormat, &strOccurence, &strScope ); + } + + /* Dump members */ + if (aFullDump) + { + TPtrC8 empty( _L8( "" ) ); + #define CHK_NULL(a) ((a)==0?(TDesC8*)(&empty):(TDesC8*)(a)) + + iLog->Log( _L8( " iName=='%S'" ), iName ); + iLog->Log( _L8( " iAccessTypes=%d (%S)" ), iAccessTypes.GetACL(), &strAccessTypes ); + iLog->Log( _L8( " iDefaultValue='%S'" ), CHK_NULL(iDefaultValue)); + iLog->Log( _L8( " iDescription='%S'" ), CHK_NULL(iDescription )); + iLog->Log( _L8( " iFormat=%d (%S)" ), iFormat, &strFormat ); + iLog->Log( _L8( " iOccurence=%d (%S)" ), iOccurence, &strOccurence ); + iLog->Log( _L8( " iScope=%d (%S)" ), iScope, &strScope ); + iLog->Log( _L8( " iTitle='%S'" ), CHK_NULL(iTitle )); + iLog->Log( _L8( " iMimeType='%S'" ), CHK_NULL(iMimeType )); + iLog->Log( _L8( "----------------------------------" ) ); + } + + /* Dump children */ + for (TInt i = 0 ; i < iChildren.Count() ; i++) + { + iChildren[i]->DumpL( *fullName, aFullDump ); + } + + CleanupStack::PopAndDestroy( fullName ); + } + +/* +void CTestDmDDFObject::ExternalizeL(RWriteStream& aStream) const + { + X; + aStream << *iName << eol; + } +*/ + +const TDesC8& CTestDmDDFObject::Name() + { + return (iName != 0) ? *iName : KNullDesC8(); + } + +TSmlDmAccessTypes CTestDmDDFObject::AccessTypes() + { + return iAccessTypes; + } + +const TDesC8& CTestDmDDFObject::DefaultValue() + { + return (iDefaultValue != 0) ? *iDefaultValue : KNullDesC8(); + } + +const TDesC8& CTestDmDDFObject::Description() + { + return (iDescription != 0) ? *iDescription : KNullDesC8(); + } + +CTestDmDDFObject::TDFFormat CTestDmDDFObject::DFFormat() + { + return iFormat; + } + +CTestDmDDFObject::TOccurence CTestDmDDFObject::Occurence() + { + return iOccurence; + } + +CTestDmDDFObject::TScope CTestDmDDFObject::Scope() + { + return iScope; + } + +const TDesC8& CTestDmDDFObject::DFTitle() + { + return (iTitle != 0) ? *iTitle : KNullDesC8(); + } + +const TDesC8& CTestDmDDFObject::DFTypeMimeType() + { + return (iMimeType != 0) ? *iMimeType : KNullDesC8(); + } + +TBool CTestDmDDFObject::ObjectGroup() + { + return iObjectGroup; + } + +TInt CTestDmDDFObject::ChildObjectCount() + { + return iChildren.Count(); + } + +CTestDmDDFObject& CTestDmDDFObject::ChildObject( TInt aIndex ) + { + return *iChildren[aIndex]; + } + +CTestDmDDFObject* CTestDmDDFObject::FindChildObject( const TDesC8& aName ) + { + CTestDmDDFObject* foundObject = 0; + + for (TInt i = 0 ; i < iChildren.Count() ; i++) + { + if ( aName.CompareC( iChildren[i]->Name() ) == 0 ) + { + foundObject = iChildren[i]; + break; + } + } + + return foundObject; + } + +TInt CTestDmDDFObject::SubObjectsCount() + { + TInt count = 0; + + TInt i; + for (i = 0 ; i < iChildren.Count() ; i++) + { + count += iChildren[i]->SubObjectsCount(); + } + count += i; + + return count; + } + +/* +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ?function_name implements... +// ?implementation_description. +// Returns: ?value_1: ?description +// ?value_n: ?description +// ?description +// ----------------------------------------------------------------------------- +// +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg ) // ?description + { + + ?code + + } +*/ +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/src/dmatest.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,954 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include "dmatest.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "TestDmDDFObject.h" + +_LIT8( KEmptyType, "" ); +_LIT8( KDefaultType, "text/plain" ); +_LIT( KMappingTableFile, "\\dmtestmappings.txt" ); +//_LIT8( KNSmlDMSeparator8, "/" ); +//const TUint8 KNSmlDMUriSeparator = 0x2f; //forward slash + +#define LEAVE_IF_ERROR(x,msg) \ + { TInt __xres = (x); if ( __xres < 0 ) { if ( iLog ) iLog->Log( (msg), __xres ); User::Leave( __xres ); } } + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cdmatest::Cdmatest +// C++ default constructor can NOT contain any code, that +// leave. +// ----------------------------------------------------------------------------- +// +Cdmatest::Cdmatest(CTestModuleIf& aTestModuleIf, TUid aUid ): + CScriptBase( aTestModuleIf ), iMappingTable(2), iUid( aUid ) + { + + } + +// ----------------------------------------------------------------------------- +// Cdmatest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cdmatest::ConstructL() + { + Adapter(); + iEmptyMappingInfoArray = new ( ELeave ) CArrayFixFlat(1); + + TRAPD( err, LoadMappingsL() ); + if (err != KErrEof && err != KErrNone && err != KErrNotFound) + { + User::Leave( err ); + } + } + +CNSmlDSSettingsAdapter *Cdmatest::Adapter() + { + if ( iAdapter == NULL ) + { + if ( iLog ) + { + iLog->Log( _L( "Loading Adapter" ) ); + } + + TRAPD( err, iAdapter = (CNSmlDSSettingsAdapter*) CSmlDmAdapter::NewL( iUid,*this ) ); + if ( err == KErrNone ) + { + if (iLog ) + { + iLog->Log( _L( "Loaded" ) ); + } + } + else + { + if (iLog) + { + iLog->Log( _L( "Failed to load adapter: %d" ), err ); + } + } + } + return iAdapter; + } + + +void Cdmatest::LoadMappingsL() + { + TDataType type; + HBufC8 *data = LoadFileLC( KMappingTableFile, type ); + RDesReadStream buf( *data ); + CleanupClosePushL( buf ); + + TInt len( data->Length() ); + while (buf.Source()->TellL( MStreamBuf::ERead ).Offset() < len) + { + TUint32 val = buf.ReadUint32L(); + TBuf8<256> uri; + TBuf8<64> luid; + buf.ReadL(uri, val); + val = buf.ReadUint32L(); + buf.ReadL(luid, val); + TMapping m( uri, luid ) ; + TInt err( iMappingTable.Append( m ) ); + if ( err == KErrNone ) + { + iLog->Log( _L8( "Loaded mapping: '%S' : '%S'"), &m.iURI, &m.iLuid ); + } + else + { + iLog->Log( _L8( "FAILED TO Load mapping: '%d' "), err ); + } + } + CleanupStack::PopAndDestroy( &buf); // buf + CleanupStack::PopAndDestroy( data ); // data + } + + + +void Cdmatest::SaveMappingsL() + { + TInt c( iMappingTable.Count() ); + if ( c > 0 ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFileWriteStream buf; + User::LeaveIfError( buf.Replace( fs, KMappingTableFile, EFileWrite ) ); + CleanupClosePushL( buf ); + + TInt i( 0 ) ; + do + { + buf.WriteUint32L( iMappingTable[i].iURI.Length() ); + buf.WriteL( iMappingTable[i].iURI ); + buf.WriteUint32L( iMappingTable[i].iLuid.Length() ); + buf.WriteL( iMappingTable[i].iLuid ); + } + while ( ++i < c ) ; + buf.CommitL(); + buf.Close(); + + CleanupStack::PopAndDestroy(); // buf + CleanupStack::PopAndDestroy(); // fs + } + } + + +// Destructor +Cdmatest::~Cdmatest() + { + // Delete resources allocated from test methods + TRAPD(err, SaveMappingsL() ); + if ( err != KErrNone ) + { + if(iLog) + iLog->Log( _L8( "Failed to save mappings!: %d"), err ); + } + Delete(); + + // Delete logger + delete iLog; + delete iEmptyMappingInfoArray; + delete iAdapter; + delete iURI; + iMappingTable.Reset(); + REComSession::FinalClose(); + } + + +// ----------------------------------------------------------------------------- +// Camatest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cdmatest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cdmatest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + + + +HBufC8 *Cdmatest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) + { + TPtrC nodename( KNullDesC ); + + TInt i( aItem.GetNextString ( nodename ) ); + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); + } + else + { + iLog->Log( _L("%S: %S"), &aName, &nodename); + } + + HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; + buf->Des().Copy( nodename ); + return buf; + } + +TInt Cdmatest::FetchNodeL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("FetchNodeL") ); + + iResultsFunction = FetchNodeResultsL; + + TPtrC8 nodename( GetNextStringLC( aItem, _L(" nodename" ) )->Des() ) ; + + SetURIL(nodename) ;// + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + Adapter()->ChildURIListL( *iURI, *luid, *iEmptyMappingInfoArray, 4, 5) ; + + if ( iStatus == MSmlDmAdapter::EOk ) + { + } + else + { + iLog->Log( _L("FetchNodeL: ChildUriList Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ) ; + CleanupStack::PopAndDestroy() ; // nodename + iLog->Log( _L("FetchNodeL: Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::StartAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->StartAtomicL() ) ; + iLog->Log( _L("StartAtomicL: Atomic started resulting error %d" ), err ); + return err; + } + +TInt Cdmatest::RollbackAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->RollbackAtomicL() ) ; + iLog->Log( _L("RollbackAtomicL: Atomic rolled back resulting error %d" ), err ); + return err; + } + +TInt Cdmatest::CommitAtomicL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->CommitAtomicL() ) ; + iLog->Log( _L("RollbackAtomicL: Atomic commited resulting error %d" ), err ); + return err; + } + + +TInt Cdmatest::DDFStructureL( CStifItemParser& /*aItem*/ ) + { + CTestDmDDFObject* ddfRoot = CTestDmDDFObject::NewLC( iLog ); //, aNodeName ); + + TRAPD( err, iAdapter->DDFStructureL( *ddfRoot ) ) ; + CleanupStack::PopAndDestroy( ddfRoot ); + iLog->Log( _L("DDFStructureL: method called resulting error %d" ), err ); + return err; + } + + +TInt Cdmatest::AddNodeL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("AddNodeL") ); + + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("nodename" ) )->Des() ) ; + SetURIL( nodename ); + + Adapter()->AddNodeObjectL( *iURI, KEmptyType, 8 ) ; + + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("AddNodeL: AddNodeObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("AddNodeL: AddNodeObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy() ; // nodename + iLog->Log( _L("AddNodeL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::UpdateLeafL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 data (GetNextStringLC( aItem, _L("datafile"))->Des() ); + + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + TDataType type; + + TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() ); + + /** + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + + Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); + + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy(); // loadfile + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // nodename + + iLog->Log( _L("UpdateLeafL Test Complete with status %d" ), ret ); + + return ret; + } + + +TInt Cdmatest::UpdateLeafDataURLL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Cdmatest"), _L("UpdateLeafDataL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 http (GetNextStringLC( aItem, _L("http"))->Des() ); + TPtrC8 url (GetNextStringLC( aItem, _L("rest of url"))->Des() ); + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + _LIT8( KTag, "://" ); + + HBufC8 *fullurl = HBufC8::NewLC( http.Length() + KTag().Length() + url.Length() ); + TPtr8 pfullurl( fullurl->Des() ); + pfullurl.Copy( http ) ; + pfullurl.Append( KTag ); + pfullurl.Append( url ); + TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + /** + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + Adapter()->UpdateLeafObjectL( *iURI , *luid, pfullurl, mimePtr, 3); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // + CleanupStack::PopAndDestroy( mime ); // mime + CleanupStack::PopAndDestroy(); // url + CleanupStack::PopAndDestroy(); // http + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::UpdateLeafDataL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("UpdateLeafDataL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + TPtrC8 data (GetNextStringLC( aItem, _L("data"))->Des() ); + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + + SetURIL( nodename ); + + + TPtrC8 mimePtr( *mime == KNullDesC8 ? KDefaultType() : mime->Des() ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + +// +// virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, +// const TDesC8& aObject, const TDesC8& aType, +// TInt aStatusRef ) = 0; +// + Adapter()->UpdateLeafObjectL( *iURI , *luid, data, mimePtr, 3); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("UpdateLeafDataL: UpdateLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("UpdateLeafDataL UpdateLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::FetchLeafL( CStifItemParser& aItem ) + { + + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("FetchLeafL") ); + + iResultsFunction = NULL; + + TInt i( 0 ); + TPtrC8 nodename ( GetNextStringLC( aItem, _L( "nodename" ) )->Des() ) ; + + //TPtrC datafile; + TPtrC datafile( KNullDesC ); + i = aItem.GetNextString ( datafile ) ; + if ( i != KErrNone ) + { + iLog->Log(_L("FetchLeafL: ERROR Reading outfile argument: 0x%X"), i ); + //return i; + } + else + { + iSaveFileName = datafile; + iLog->Log( _L( " Save file nameis '%S'" ), &iSaveFileName ); + iResultsFunction = SaveDataL; + } + + SetURIL(nodename) ; + + /* + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ); + */ + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->FetchLeafObjectL( *iURI, *luid, KEmptyType, 7, 8 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("FetchLeafL: FetchLeafObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("FetchLeafL: FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); + CleanupStack::PopAndDestroy( ); // nodename + iLog->Log( _L("FetchLeafL Test Complete with status %d" ), ret ); + return ret; + } + + +TInt Cdmatest::ExecuteLeafL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + TPtrC8 data( GetNextStringLC ( aItem, _L("Input file") )->Des() ) ; + + SetURIL(nodename) ; + + /* + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + TDataType type; + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("ExecuteLeafL: ExecuteCommandL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("ExecuteLeafL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + + iLog->Log( _L("ExecuteLeafL: Test Complete with status %d" ), ret ); + + return ret; + } + +TInt Cdmatest::CompleteCommandsL( CStifItemParser& /*aItem*/ ) + { + TRAPD( err, Adapter()->CompleteOutstandingCmdsL() ); + delete iAdapter; + iAdapter = NULL; + return err; + } +TInt Cdmatest::DeleteObjectL( CStifItemParser& aItem ) +{ + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("DeleteObjectL") ); + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + + SetURIL(nodename) ; + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + Adapter()->DeleteObjectL( *iURI, *luid, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("DeleteNode: DeleteObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("DeleteNode: DeleteObjectL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); + + return ret; +} + +TInt Cdmatest::ExecuteLeafDataL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + TPtrC8 data( GetNextStringLC ( aItem, _L("Input data") )->Des() ) ; + + SetURIL(nodename) ; + + /* + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ) = 0; + */ + HBufC8 *luid = GetLuidAllocLC( *iURI ); + Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("ExecuteLeafDataL: ExecuteCommandL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // data + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("ExecuteLeafDataL Test Complete with status %d" ), ret ); + + return ret; + } + + +HBufC8 *Cdmatest::LoadFileLC( const TDesC &aFileName, TDataType &aType ) + { + RFs fs ; + LEAVE_IF_ERROR( fs.Connect(), _L( "Could not connect fileserver: %d" ) ); + + CleanupClosePushL( fs ); + RFile file ; + LEAVE_IF_ERROR( file.Open(fs,aFileName,EFileRead), _L( "Could not open file: %d" ) ); + + + + CleanupClosePushL( file ); + TInt dataSize ; + LEAVE_IF_ERROR( file.Size( dataSize ), _L( "Could not get file size: %d" ) ); + HBufC8 *nodedata = HBufC8::NewL ( dataSize ); + CleanupStack::PushL( nodedata ); + TPtr8 nodedataptr( nodedata->Des() ); + LEAVE_IF_ERROR( file.Read( nodedataptr ), _L( "Could not read file: %d" ) ); + TDataRecognitionResult aDataType; + RApaLsSession ls ; + TInt err( ls.Connect() ); + if ( err == KErrNone ) + { + CleanupClosePushL( ls ); + err = ls.RecognizeData(aFileName, nodedataptr, aDataType) ; + if ( err == KErrNone ) + { + aType = aDataType.iDataType; + } + else + { + iLog->Log( _L("LoadFileLC: WARNING Failed to get type: %d" ), err ); + aType = TDataType( KDefaultType ); + } + CleanupStack::PopAndDestroy( &ls ); + } + else + { + iLog->Log( _L("LoadFileLC: WARNING Failed to connect rapalssession: %d" ), err ); + } + CleanupStack::Pop( nodedata ); + CleanupStack::PopAndDestroy( &file ); + CleanupStack::PopAndDestroy( &fs ); + CleanupStack::PushL( nodedata ); + return nodedata ; + } + +HBufC8 *Cdmatest::LoadFileLC( const TDesC8 &aFileName, TDataType &aType ) + { + TFileName fn ; + fn.Copy( aFileName ); + return LoadFileLC( fn, aType ); + } + + +void Cdmatest::SaveDataL( TInt /*aResultsRef*/, CBufBase& aObject, + const TDesC8& aType ) + { + iLog->Log( _L8( "Saving data of type: '%S'" ), &aType ); + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + RFile file; + User::LeaveIfError( file.Replace ( fs, iSaveFileName, EFileWrite ) ); + CleanupClosePushL( file ); + TPtrC8 p( aObject.Ptr( 0 ) ); + User::LeaveIfError( file.Write( p ) ); + CleanupStack::PopAndDestroy( 2 ); // file, fs + } + + + +void Cdmatest::FetchNodeResultsL( TInt /*aResultsRef*/, CBufBase& aObject, + const TDesC8& /*aType*/ ) + { + TPtrC8 ptr( aObject.Ptr( 0 ) ); + iLog->Log( _L8("FetchNodeResultsL for '%S': '%S'" ), iURI, &ptr ); + + if ( ptr.Length() > 0 ) + { + TPtrC8 last( LastURISeg( ptr ) ); + HBufC8 *oldUri = HBufC8::NewL( iURI->Length() ); + (*oldUri) = *iURI; + do + { + iLog->Log ( _L8( " Node: '%S' "), &last ); + HBufC8 *nUri = HBufC8::NewLC( oldUri->Length() + 1 + last.Length() ); + nUri->Des().Copy( *oldUri ) ; + nUri->Des().Append( '/' ); + nUri->Des().Append( last ); + + SetURIL( nUri ); + //iResultsFunction = FetchNodeResultsL; + + //TPtrC8 parentURI(RemoveLastSeg(*nUri)); + //HBufC8 *luid = GetLuidAllocLC( parentURI ); + CleanupStack::Pop( nUri ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + Adapter()->ChildURIListL( *nUri, KNullDesC8, *iEmptyMappingInfoArray, 4, 5 );//Dipak + + CleanupStack::PopAndDestroy( luid ); + + ptr.Set( RemoveLastURISeg( ptr ) ); + last.Set( LastURISeg( ptr ) ); + + } + while (last != KNullDesC8); + } + + } + + + +TPtrC8 Cdmatest::LastURISeg( const TDesC8& aURI ) + { + TInt i; + for( i = aURI.Length() - 1; i >= 0; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + + if( i == 0 ) + { + return aURI; + } + else + { + return aURI.Mid( i+1 ); + } + } +TPtrC8 Cdmatest::RemoveLastSeg(const TDesC8& aURI) + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMUriSeparator) + { + break; + } + } + + if(i>0) + { + return aURI.Left(i); + } + else + { + return KNullDesC8(); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 Cdmatest::RemoveLastURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 Cdmatest::RemoveLastURISeg( const TDesC8& aURI ) + { + TInt i; + for ( i = aURI.Length() - 1; i >= 0 ; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if ( i > -1 ) + { + return aURI.Left( i ); + } + else + { + return KNullDesC8(); + } + } + +TPtrC Cdmatest::RemoveLastURISeg( const TDesC& aURI ) + { + TInt i; + for ( i = aURI.Length() - 1; i >= 0 ; i-- ) + { + if( aURI[i] == '/' ) + { + break; + } + } + if ( i > -1 ) + { + return aURI.Left( i ); + } + else + + { + return KNullDesC(); + } + } + +void Cdmatest::SetURIL( const TDesC& aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = HBufC8::NewL( aURI.Length() ) ; + iURI->Des().Copy( aURI ); + } + +void Cdmatest::SetURIL( const TDesC8& aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = HBufC8::NewL( aURI.Length() ) ; + iURI->Des().Copy( aURI ); + } + +void Cdmatest::SetURIL( HBufC8* aURI ) + { + if ( iURI != NULL ) + { + delete iURI ; + iURI = NULL; + } + iURI = aURI ; + } + + + +void Cdmatest::SetResultsL( + TInt aResultsRef, + CBufBase& aObject, + const TDesC8& aType ) + { + TPtrC8 ptr( aObject.Ptr(0) ); + iLog->Log( _L8( "SetResults, ref=%d, object='%S', type='%S'" ), aResultsRef, &ptr, &aType ); + if ( iResultsFunction ) + { + (this->*iResultsFunction)( aResultsRef, aObject, aType ); + iResultsFunction = NULL ; + } + + } + + +void Cdmatest::SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) + { + iStatus = aErrorCode ; + iLog->Log( _L( "SetStatusL, ref=%d, code=%d" ), aStatusRef, aErrorCode ); + + + } + +void Cdmatest::SetMappingL( const TDesC8& aURI, const TDesC8& aLUID ) + { + iLog->Log( _L8( "SetMappingL, aURI='%s', aLUID='%s'" ), aURI.Ptr(), aLUID.Ptr() ); + + iMappingTable.Append(TMapping( aURI, aLUID ) ) ; + } + +HBufC8* Cdmatest::GetLuidAllocL( const TDesC8& aURI ) + { + iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); + HBufC8 *res = NULL; + for( TInt i(0); i < iMappingTable.Count(); i++ ) + { + if ( aURI == iMappingTable[i].iURI ) + { + res = iMappingTable[i].iLuid.AllocL(); + } + } + if ( res == NULL ) + { + res = HBufC8::NewL( 0 ); + } + iLog->Log( _L8( "GetLuidAllocL, response='%S'" ), res ); + return res; + } + +HBufC8* Cdmatest::GetLuidAllocLC( const TDesC8& aURI ) + { + iLog->Log( _L8( "GetLuidAllocL, aURI='%S'" ), &aURI ); + HBufC8 *res = NULL; + for( TInt i(0); i < iMappingTable.Count(); i++ ) + { + if ( aURI == iMappingTable[i].iURI ) + { + res = iMappingTable[i].iLuid.AllocLC(); + break; + } + } + if ( res == NULL ) + { + res = HBufC8::NewLC( 0 ); + } + iLog->Log( _L8( "GetLuidAllocLC, response='%S'" ), res ); + return res ; + } + +#ifdef __TARM_SYMBIAN_CONVERGENCY + +void Cdmatest::GetMappingInfoListL( const TDesC8& /*aURI*/, + CArrayFix& /*aSegmentList*/ ) + { + // do nothing + } + +#else +// nothing +#endif +//*************************************************************************** +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/src/syncmldstest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/src/syncmldstest.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include "syncmldsTest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CsyncmldsTest::CsyncmldsTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +/*CsyncmldsTest::CsyncmldsTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + }*/ +CsyncmldsTest::CsyncmldsTest( CTestModuleIf& aTestModuleIf ) + : Cdmatest( aTestModuleIf, KAdapterUid ) + { + } +// ----------------------------------------------------------------------------- +// CsyncmldsTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CsyncmldsTest::ConstructL() + { +/* iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse );*///Commented the Part for syncmldsTest Dipak + iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile ); + + iLog->Log( _L( "Loading Adapter" ) ); + + Cdmatest::ConstructL(); + + } + +// ----------------------------------------------------------------------------- +// CsyncmldsTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CsyncmldsTest* CsyncmldsTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CsyncmldsTest* self = new (ELeave) CsyncmldsTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CsyncmldsTest::~CsyncmldsTest() + { + + // Delete resources allocated from test methods +// Delete(); + + // Delete logger +// delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CsyncmldsTest::NewL( aTestModuleIf ); + + } + + + +// End of File diff -r 88e14c3d4c4f -r 137912d1a556 deviceupdatesui/omadmadapters/syncmlds/tsrc/src/syncmldstestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/omadmadapters/syncmlds/tsrc/src/syncmldstestBlocks.cpp Tue Jul 13 03:44:34 2010 +0530 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of DM adapter test component +* This is part of omadmextensions/adapter test application. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include +#include +#include "syncmldsTest.h" +#include +#include +#include + + +//using namespace NApplicationManagement;//Dipak + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CsyncmldsTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CsyncmldsTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CsyncmldsTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CsyncmldsTest::RunMethodL( + CStifItemParser& aItem ) + { + + TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "DDFStructure", CsyncmldsTest::DDFStructureL), + ENTRY( "FetchNode", CsyncmldsTest::FetchNodeL ), + ENTRY( "FetchLeaf", CsyncmldsTest::FetchLeafL ), + ENTRY( "AddNode", CsyncmldsTest::AddNodeL ), + ENTRY( "UpdateLeaf", CsyncmldsTest::UpdateLeafL ), + ENTRY( "UpdateLeafData", CsyncmldsTest::UpdateLeafDataL ), + ENTRY( "Execute", CsyncmldsTest::ExecuteLeafL ), + ENTRY( "ExecuteData", CsyncmldsTest::ExecuteLeafDataL ), + ENTRY( "DeleteNode", CsyncmldsTest::DeleteObjectL ), + ENTRY( "StartAtomic", CsyncmldsTest::StartAtomicL), + ENTRY( "CommitAtomic", CsyncmldsTest::CommitAtomicL), + ENTRY( "RollbackAtomic", CsyncmldsTest::RollbackAtomicL), + ENTRY( "CompleteCommands", CsyncmldsTest::CompleteCommandsL), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + + +HBufC8 *CsyncmldsTest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName ) + { + TPtrC nodename; + nodename.Set( KNullDesC ); + + TInt i( aItem.GetNextString ( nodename ) ); + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i ); + } + else + { + iLog->Log( _L("%S: %S"), &aName, &nodename); + } + + HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ; + buf->Des().Copy( nodename ); + + return buf; + } + +// End of File