# HG changeset patch # User William Roberts # Date 1279812653 -3600 # Node ID 751cd8585b8282272102ecf16180b1953d4f4e18 # Parent 7d88c1eb7da309d5e5778fd214516b5d48f00fcf# Parent aa33c2cb9a503bd933ba1172b2285b138fd19d34 Catchup to latest Symbian^4 diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/BWINS/ApplicationManagementu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/BWINS/ApplicationManagementu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ +EXPORTS + ?ActivateL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 1 NONAME ; void NApplicationManagement::RApplicationManagement::ActivateL(unsigned long) const + ?Close@RAppMgmtRfs@@QAEXXZ @ 2 NONAME ; void RAppMgmtRfs::Close(void) + ?Close@RApplicationManagement@NApplicationManagement@@QAEXXZ @ 3 NONAME ; void NApplicationManagement::RApplicationManagement::Close(void) + ?Connect@RAppMgmtRfs@@QAEHXZ @ 4 NONAME ; int RAppMgmtRfs::Connect(void) + ?Connect@RApplicationManagement@NApplicationManagement@@QAEHABVTCertInfo@@@Z @ 5 NONAME ; int NApplicationManagement::RApplicationManagement::Connect(class TCertInfo const &) + ?Connect@RApplicationManagement@NApplicationManagement@@QAEHXZ @ 6 NONAME ; int NApplicationManagement::RApplicationManagement::Connect(void) + ?DeactivateL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 7 NONAME ; void NApplicationManagement::RApplicationManagement::DeactivateL(unsigned long) const + ?DeliverL@RApplicationManagement@NApplicationManagement@@QBEKABV?$TBuf8@$0BAA@@@@Z @ 8 NONAME ; unsigned long NApplicationManagement::RApplicationManagement::DeliverL(class TBuf8<256> const &) const + ?DeploymentComponent@RApplicationManagement@NApplicationManagement@@QBEHKAAUTDeploymentComponent@2@@Z @ 9 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponent(unsigned long, struct NApplicationManagement::TDeploymentComponent &) const + ?DeploymentComponentDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@AAVCBufBase@@@Z @ 10 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class CBufBase &) const + ?DeploymentComponentDataSizeL@RApplicationManagement@NApplicationManagement@@QBEHKABW4TDeplCompAttrType@2@@Z @ 11 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponentDataSizeL(unsigned long, enum NApplicationManagement::TDeplCompAttrType const &) const + ?DeploymentComponentIdsL@RApplicationManagement@NApplicationManagement@@QBEHAAV?$RArray@K@@W4TDeploymentComponentState@2@@Z @ 12 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponentIdsL(class RArray &, enum NApplicationManagement::TDeploymentComponentState) const + ?DeploymentComponentUserIdL@RApplicationManagement@NApplicationManagement@@QBEXKAAV?$TBuf8@$0BAA@@@@Z @ 13 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentUserIdL(unsigned long, class TBuf8<256> &) const + ?DownloadL@RApplicationManagement@NApplicationManagement@@QBEKABV?$TBuf8@$0BAA@@@@Z @ 14 NONAME ; unsigned long NApplicationManagement::RApplicationManagement::DownloadL(class TBuf8<256> const &) const + ?InstallL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeploymentComponentState@2@@Z @ 15 NONAME ; void NApplicationManagement::RApplicationManagement::InstallL(unsigned long, enum NApplicationManagement::TDeploymentComponentState) const + ?PerformRfsL@RAppMgmtRfs@@QBEXXZ @ 16 NONAME ; void RAppMgmtRfs::PerformRfsL(void) const + ?RemoveL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 17 NONAME ; void NApplicationManagement::RApplicationManagement::RemoveL(unsigned long) const + ?StartDownloadL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDownloadTarget@2@@Z @ 18 NONAME ; void NApplicationManagement::RApplicationManagement::StartDownloadL(unsigned long, enum NApplicationManagement::TDownloadTarget) const + ?StateChangeComplete@RApplicationManagement@NApplicationManagement@@QBEHK@Z @ 19 NONAME ; int NApplicationManagement::RApplicationManagement::StateChangeComplete(unsigned long) const + ?StateChangingDCIdsL@RApplicationManagement@NApplicationManagement@@QBEHAAV?$RArray@K@@@Z @ 20 NONAME ; int NApplicationManagement::RApplicationManagement::StateChangingDCIdsL(class RArray &) const + ?UpdateDeploymentComponentDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@1@Z @ 21 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &, class TDesC8 const &) const + ?UpdateDeploymentComponentL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@@Z @ 22 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &) const + ?UpdateL@RApplicationManagement@NApplicationManagement@@QBEXKK@Z @ 23 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateL(unsigned long, unsigned long) const + ?DeploymentComponentTempInstFile@RApplicationManagement@NApplicationManagement@@QBEXKAAVRFile@@ABW4TDeplCompAttrType@2@@Z @ 24 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentTempInstFile(unsigned long, class RFile &, enum NApplicationManagement::TDeplCompAttrType const &) const + ?UpdateDeploymentComponentStreamedDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@@Z @ 25 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentStreamedDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &) const + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/RfsPlugin/group/RfsAppMgmtPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/RfsPlugin/group/RfsAppMgmtPlugin.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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: Implementation of applicationmanagement components +* +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include + +TARGET rfsappmgmtplugin.dll +TARGETTYPE PLUGIN +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT +UID 0x10009D8D 0x102073BF + +SOURCEPATH ../src +SOURCE RfsAppMgmtPlugin.cpp +SOURCE Proxy.cpp + +START RESOURCE 102073BF.rss +TARGET rfsappmgmtplugin.rsc +LANGUAGE_IDS +END + + + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib // Base library +LIBRARY ecom.lib // ECom library +LIBRARY applicationmanagement.lib +LIBRARY flogger.lib + +SMPSAFE diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/RfsPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/RfsPlugin/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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 provides the information required for building RFS AppMgmt +* plugin +* +*/ + + +PRJ_PLATFORMS + +PRJ_MMPFILES +../group/RfsAppMgmtPlugin.mmp + + +PRJ_TESTMMPFILES + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/RfsPlugin/inc/RfsAppMgmtPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/RfsPlugin/inc/RfsAppMgmtPlugin.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,86 @@ +/* +* 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: Implementation of applicationmanagement components +* +* +*/ + + + +#ifndef RFSAPPMGMTPLUGIN_H +#define RFSAPPMGMTPLUGIN_H + +// INCLUDES +#include + +#include "rfsPlugin.h" + +// CLASS DECLARATION + +class CRfsAppMgmtPlugin: public CRFSPlugin + { +public: + + /** + * Two-phased constructor. + * @param aInitParams initial parameters + */ + static CRfsAppMgmtPlugin* NewL(TAny* aInitParams); + + /** + * Destructor. + */ + virtual ~CRfsAppMgmtPlugin(); + + /** + * + * @param + */ + void RestoreFactorySettingsL( const TRfsReason aType ); + + /** + * + * @param + */ + void GetScriptL( const TRfsReason aType, TDes& aPath ); + + /** + * + * @param + */ + void ExecuteCustomCommandL( const TRfsReason aType, TDesC& aCommand ); +private: + + /** + * C++ default constructor. + */ + CRfsAppMgmtPlugin(); + + /** + * Constructor. + * @param aInitParams initial parameters + */ + CRfsAppMgmtPlugin(TAny* aInitParams); + + /** + * Constructor + */ + void ConstructL(); + }; + + + +#endif // RFSAPPMGMTPLUGIN_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/RfsPlugin/src/102073BF.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/RfsPlugin/src/102073BF.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 1020 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 applicationmanagement components +* +* +*/ + + +#include "registryinfo.rh" + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x102073BF; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x102073BB; + implementations = + { + // Info for CSrcsBTConnection + IMPLEMENTATION_INFO + { + implementation_uid = 0x102073C0; + version_no = 1; + display_name = "RFS AppMgmt Plugin"; + default_data = "N"; // N = Normal RFS, D = Deep RFS, I = Init RFS (FirstBoot RFS) + opaque_data = ""; + } + }; + } + }; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/RfsPlugin/src/Proxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/RfsPlugin/src/Proxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,38 @@ +/* +* 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 class export ECom interface implementations. +* +*/ + + +#include +#include + +#include "RfsAppMgmtPlugin.h" + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x102073C0, CRfsAppMgmtPlugin::NewL) + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/RfsPlugin/src/RfsAppMgmtPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/RfsPlugin/src/RfsAppMgmtPlugin.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,95 @@ +/* +* 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: Implementation of applicationmanagement components +* +* +*/ + + +// INCLUDE FILES +#include "ApplicationManagementRfs.h" +#include "RfsAppMgmtPlugin.h" +#include "debug.h" + +_LIT(KScriptPath, ""); + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CRfsAppMgmtPlugin::CRfsAppMgmtPlugin() + { + } + +CRfsAppMgmtPlugin::CRfsAppMgmtPlugin(TAny* /*aInitParams*/) + { + } + +// Destructor +CRfsAppMgmtPlugin::~CRfsAppMgmtPlugin() + { + } + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CRfsAppMgmtPlugin* CRfsAppMgmtPlugin::NewL(TAny* aInitParams) + { + RDEBUG("CRfsAppMgmtPlugin::NewL()"); + CRfsAppMgmtPlugin* self = new (ELeave) CRfsAppMgmtPlugin(aInitParams); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// --------------------------------------------------------- +// ConstructL +// --------------------------------------------------------- +// +void CRfsAppMgmtPlugin::ConstructL() + { + RDEBUG("CRfsAppMgmtPlugin::ConstructL()"); + } + +void CRfsAppMgmtPlugin::RestoreFactorySettingsL( const TRfsReason /*aType*/ ) + { + RDEBUG("CRfsAppMgmtPlugin::RestoreFactorySettingsL()"); + RAppMgmtRfs appManagement; + if( appManagement.Connect() == KErrNone ) + { + RDEBUG("CRfsAppMgmtPlugin::RestoreFactorySettingsL(): Connected to AppMgmt "); + appManagement.PerformRfsL(); + appManagement.Close(); + } + else + { + RDEBUG("CStartupAppUi::RTCStatus(): Unable to connect to AppMgmt "); + } + } + +void CRfsAppMgmtPlugin::GetScriptL( const TRfsReason /*aType*/, TDes& aPath ) + { + aPath.Copy( KScriptPath); + } + +void CRfsAppMgmtPlugin::ExecuteCustomCommandL( const TRfsReason /*aType*/, + TDesC& /*aCommand*/ ) + { + } + +// End of file diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/group/amadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/group/amadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,80 @@ +/* +* 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: Implementation of applicationmanagement components +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include "defaultcaps.hrh" + +TARGET amadapter2.dll + +CAPABILITY CAP_ECOM_PLUGIN + +TARGETTYPE PLUGIN +UID 0x10009D8D 0x10207844 +VENDORID VID_DEFAULT + +MACRO __AM_LASTERROR_NODE // uncomment to enable /SCM/Ext/LastError node + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +#ifdef __TARM_SYMBIAN_CONVERGENCY +SYSTEMINCLUDE /epoc32/include/devman +#else +// nothing +#endif + +SOURCEPATH ../src +SOURCE amadapter.cpp +SOURCE nsmldmiapmatcher.cpp +SOURCE nsmldmuri.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../options/inc // install options + + +START RESOURCE amadapter.rss +TARGET amadapter2.rsc +END + + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY applicationmanagementclient.lib +LIBRARY centralrepository.lib +LIBRARY aminstalloptions.lib +LIBRARY featmgr.lib +LIBRARY flogger.lib + +#ifdef __TARM_SYMBIAN_CONVERGENCY +LIBRARY devmancmdmgr.lib +LIBRARY dmtreeclient.lib +#else +LIBRARY nsmldmtreedbclient.lib +LIBRARY nsmldmclientserverutils.lib +LIBRARY nsmldmiapmatcher.lib +#endif + + + +SMPSAFE +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,38 @@ +/* +* 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: build info file for application management adapter +* +*/ + + +#include + +PRJ_EXPORTS +../rom/amadapter.iby CORE_APP_LAYER_IBY_EXPORT_PATH(amadapter.iby) + +PRJ_TESTEXPORTS +/* Commenting the internal folder exports +../internal/AmadapterTestScript.cfg /epoc32/winscw/c/testframework/AmadapterTestScript.cfg +../internal/verysilent_c_en.xml /epoc32/winscw/c/TestFramework/amadapter/verysilent_c_en.xml +../internal/barew_locserv.sisx /epoc32/winscw/c/TestFramework/amadapter/barew_locserv.sisx +../internal/barew_locserv2.sisx /epoc32/winscw/c/TestFramework/amadapter/barew_locserv2.sisx +*/ + + +PRJ_MMPFILES +./amadapter.mmp + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/inc/amadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/inc/amadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,797 @@ +/* +* 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: Application Management DM Adapter +* +*/ + + + +#ifndef __AMADAPTER_H__ +#define __AMADAPTER_H__ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include + +#ifdef __TARM_SYMBIAN_CONVERGENCY +#include +#else +#include "nsmldmtreedbclient.h" +#endif + +#include "ApplicationManagementClient.h" + +namespace NApplicationManagement + { + +const TUint KAMAdapterImplUid = 0x10207845; + +// the DDF version must be changed if any changes in DDF structure ( built in DDFStructureL() function ) +_LIT8( KAMDDFVersion, "1.0" ); + +_LIT8( KAMTextPlain, "text/plain" ); + +#ifdef __TARM_SYMBIAN_CONVERGENCY +_LIT8( KAMNodeName, "./SCM" ); +#else +_LIT8( KAMNodeName, "SCM" ); +#endif +_LIT8( KAMNodeDescription, "This node is the root node for all application management functionality" ); + +_LIT8( KAMInventoryNodeName, "Inventory" ); +_LIT8( KAMInventoryNodeDescription, "This node is start node of application inventory" ); + +_LIT8( KAMDeliveredNodeName, "Delivered" ); +_LIT8( KAMDeliveredNodeDescription, "This is node under which applications that are delivered but not installed are found." ); + +_LIT8( KAMDeployedNodeName, "Deployed" ); +_LIT8( KAMDeployedNodeDescription, "This is a node under which deployed applications are found" ); + +_LIT8( KAMDeliveredDynaNodeDescription, "This dynamic node is placeholder applications that are in Delivered state" ); + +_LIT8( KAMIDNodeName, "ID" ); +_LIT8( KAMIDNodeDescription, "This leaf node holds an identifier for an application" ); + +_LIT8( KAMNameNodeName, "Name" ); +_LIT8( KAMNameNodeDescription, "This leaf node holds name of an application" ); + +_LIT8( KAMVersionNodeName, "Version" ); +_LIT8( KAMVersionNodeDescription, "This leaf node holds the version of an application" ); + +_LIT8( KAMStateValueNodeName, "StateValue" ); +_LIT8( KAMStateValueNodeDescription, "This leaf node holds the state value of an application (active/inactive)" ); + +_LIT8( KAMDataNodeName, "Data" ); +_LIT8( KAMDataNodeDescription, "This leaf node holds the data of an application" ); + +_LIT8( KAMDescriptorNodeName, "Descriptor" ); +_LIT8( KAMDescriptorNodeDescription, "This leaf node holds the possible metadata of an application" ); + +_LIT8( KAMOperationsNodeName, "Operations" ); +_LIT8( KAMOperationsNodeDescription, "This is a node under which operations are found" ); + +_LIT8( KAMInstallOptsNodeName, "InstallOpts" ); +_LIT8( KAMInstallOptsNodeDescription, "This is a node that holds the installation options of an application" ); + +_LIT8( KAMDeployedDynaNodeDescription, "This dynamic node is placeholder applications that are in Inactive state" ); + + +_LIT8( KAMDownloadOperationNodeName, "Download" ); +_LIT8( KAMDownloadOperationNodeDescription, "Starts the download" ); + +_LIT8( KAMConRefNodeName, "ConRef" ); +_LIT8( KAMConRefNodeDescription, "Holds reference to IAP" ); + + +_LIT8( KAMLocalOperationsNodeDescription, "This is the root node for local operations" ); + +_LIT8( KAMActivateNodeName, "Activate" ); +_LIT8( KAMActivateNodeDescription, "Exec command causes device to activate an inactive application" ); + +_LIT8( KAMDeActivateNodeName, "Deactivate" ); +_LIT8( KAMDeActivateNodeDescription, "Exec command causes device to stop and deactivate an active application" ); + +_LIT8( KAMInstallNodeName, "Install" ); +_LIT8( KAMInstallNodeDescription, "Exec command causes device to install a delivered application" ); + +_LIT8( KAMInstallAndActivateNodeName, "InstallAndActivate" ); +_LIT8( KAMInstallAndActivateNodeDescription, "Exec command causes device to install a delivered application and activate it" ); + +_LIT8( KAMUpdateNodeName, "Update" ); +_LIT8( KAMUpdateNodeDescription, "Exec command causes device to update an application" ); + +_LIT8( KAMUpdateAndActivateNodeName, "UpdateAndActivate" ); +_LIT8( KAMUpdateAndActivateNodeDescription, "Exec command causes device to update an application and activate it" ); + +_LIT8( KAMRemoveNodeName, "Remove" ); +_LIT8( KAMRemoveNodeDescription, "Exec command causes device to remove an application" ); + + +_LIT8( KAMDownloadNodeName, "Download" ); +_LIT8( KAMDownloadNodeDescription, "This node is a root node for application download functionality" ); + +_LIT8( KAMDownloadAndInstallNodeName, "DownloadAndInstall" ); +_LIT8( KAMDownloadAndInstallOperationNodeDescription, "Starts the download and installs component when complete" ); + +_LIT8( KAMDownloadAndInstallAndActivateNodeName, "DownloadAndInstallAndActivate" ); +_LIT8( KAMDownloadAndInstallAndActivateNodeDescription, "Starts the download and installs and activates component when complete" ); + +_LIT8( KAMDownloadAndUpdateNodeName, "DownloadAndUpdate" ); +_LIT8( KAMDownloadAndUpdateNodeDescription, "Starts the download and installs component when complete" ); + +_LIT8( KAMDownloadAndUpdateAndActivateNodeName, "DownloadAndUpdateAndActivate" ); +_LIT8( KAMDownloadAndUpdateAndActivateNodeDescription, "Starts the download and updates and activates component when complete" ); + +_LIT8( KAMDownloadDynaNodeDescription, "This node is a placeholder for identifier of an application that is to be downloaded" ); + +_LIT8( KAMURINodeName, "URI" ); +_LIT8( KAMURINodeDescription, "This leaf node holds the URL from which the application should be downloaded" ); + +_LIT8( KAMStatusNodeName, "Status" ); +_LIT8( KAMStatusNodeDescription, "This leaf node holds the status of the download" ); + +#ifdef __AM_LASTERROR_NODE +_LIT8( KAMExtNodeName, "Ext" ); +_LIT8( KAMExtNodeDescription, "Non std extentions are found under this leaf" ); +_LIT8( KAMLastErrorNodeName, "LastError" ); +_LIT8( KAMLastErrorDescription, "This leaf node may hold the error" ); +#endif + +_LIT8( KAMDynamicNodeName, "" ); +_LIT( KAMSeparator16, "/" ); + +_LIT8( KAMSeparator8, "/" ); + +_LIT8( KAMRootChilds, "Inventory/Download" ); +_LIT8( KAMInventoryChilds, "Delivered/Deployed" ); +//_LIT8( KAMLocalOperationsChilds, "Activate/DeActivate/Install/Update/Remove" ); + +_LIT8( KAMDownloadDynaChilds, "ID/Name/Version/URI/Status/Operations" ); +_LIT8( KAMInventoryDynaChilds, "ID/Name/Version/StateValue/Operations" ); +_LIT8( KAMDownloadOperationChilds, "Download/DownloadAndInstall/DownloadAndInstallAndActivate/DownloadAndUpdate/DownloadAndUpdateAndActivate" ); +_LIT8( KAMDeployedOperationChilds, "Activate/Deactivate/Remove" ); +_LIT8( KAMDeliveredOperationChilds, "Install/Update/InstallAndActivate/UpdateAndActivate/Remove" ); +_LIT8( KAMInventoryDeliveredDynaChilds, "ID/Name/Version/Descriptor/Data/InstallOpts/Operations" ); + + +struct TAMCommandBufferElement + { + TInt iStatusRef; + TBuf8<256> iURI; + TAMCommandBufferElement( TInt aRef, const TDesC8 &aURI ) + : iStatusRef( aRef ), iURI( aURI ) + { + } + }; + +typedef RArray TAMCommandBuffer; + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter +// ------------------------------------------------------------------------------------------------ +class CAmAdapter : public CSmlDmAdapter + { +public: + static CAmAdapter* NewL( MSmlDmCallback* aDmCallback ); + static CAmAdapter* NewLC( MSmlDmCallback* aDmCallback ); + + virtual ~CAmAdapter(); + + +/** + The function returns current version of the DDF. + By asking current DDF versions from adapters DM Module can control + possible changes in the data structure and send the changed DDF + description to a management server. + This function is always called after DDFStructureL. + @param aVersion DDF version of the adapter. (filled by the adapter) + @publishedPartner + @prototype + */ + virtual void DDFVersionL( CBufBase& aVersion ); + + /** + The function for filling the DDF structure of the adapter + This function is only called once, immediately after the adapter is created. + @param aDDFObject Reference to root object. A DM adapter starts filling + the data structure by calling AddChildObjectL to the root object and + so describes the DDF of the adapter. + @publishedPartner + @prototype + */ + virtual 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 should be + returned by calling SetStatusL function of MSmlDmCallback callback + interface. This makes it possible to buffer the commands. However, all + the status codes for buffered commands must be returned at the latest when + the adapter's CompleteOutstandingCmdsL() is called. + @param aURI URI of the object + @param aLUID LUID of the object (if the adapter has earlier returned a + LUID to the DM Module). For new objects, this is the LUID + inherited through the parent node. + @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 + @publishedPartner + @prototype + */ + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef ); + + /** + The function creates new leaf objects, or replaces data in existing leaf + objects, in the case where data is large enough to be streamed. The + information about the success of the command should be returned by calling + SetStatusL function of MSmlDmCallback callback interface. This makes it + possible to buffer the commands. However, all the status codes for buffered + commands must be returned at the latest when the CompleteOutstandingCmdsL() + of adapter is called. + @param aURI URI of the object + @param aLUID LUID of the object (if the adapter has earlier returned a + LUID to the DM Module). For new objects, this is the LUID + inherited through the parent node. + @param aStream Data of the object. Adapter should create write stream + and return, when data is written to stream by DM agent, + StreamCommittedL() is called by DM engine + @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. + @publishedPartner + @prototype + */ + virtual void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ); + + /** + The function deletes an object and its child objects. The SetStatusL + should be used as described in UpdateLeafObjectL() + @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. + @publishedPartner + @prototype + */ + virtual void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, + TInt aStatusRef ); + + /** + The function fetches data of a leaf object. The SetStatusL should be used + as described in UpdateLeafObjectL(). The data is returned by using the + SetResultsL function of MSmlCallback callback interface, and may be streamed. + @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. + @publishedPartner + @prototype + */ + virtual 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. The SetStatusL should be used + as described in FetchLeafObjectL(). The size value is returned by using + the SetResultsL function of MSmlCallback callback interface, and must be + a decimal integer expressed as a string, eg. "1234". + Results from this call MUST NOT be streamed. + @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. + @publishedPartner + @prototype + */ + virtual 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. Results from this call MUST NOT be streamed. + @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. An adapter + can use this information when verifying + if old objects still exists. An adapter + also knows what objects are new to DM + engine and can provide LUID mapping for + them. aPreviousURISegmentList parameter + (see above) helps to recognise new + objects. + @param aResultsRef Reference to correct results, i.e. this + reference must be used when returning + the result by calling the SetResultsL. + @param aStatusRef Reference to correct command, i.e. this + reference must be used when calling the + SetStatusL of this command. + @publishedPartner + @prototype + */ + virtual void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef ); + + /** + The function adds node object. In some cases an implementation of the + function may be empty function, if the node object does not need concrete + database update. Still this function may be helpful to an adapter, i.e. in + passing mapping LUID of the node to DM Module. The SetStatusL should be + used as described in UpdateLeafObjectL() + @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. + @publishedPartner + @prototype + */ + virtual void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + TInt aStatusRef ); + + /** + The function implements execute command. The information about the success + of the command should be returned by calling SetStatusL function of + MSmlDmCallback callback interface. This makes it possible to buffer the + commands. + However, all the status codes for buffered commands must be returned at + the latest when the CompleteOutstandingCmdsL() of adapter is called. + @param aURI URI of the command + @param aLUID LUID of the object (if the adapter have earlier + returned LUID to the DM Module). + @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. + @publishedPartner + @prototype + */ + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef ); + + /** + The function implements execute command. The information about the + success of the command should be returned by calling SetStatusL function + of MSmlDmCallback callback interface. This makes it possible to buffer the + commands. + However, all the status codes for buffered commands must be returned at + the latest when the CompleteOutstandingCmdsL() of adapter is called. + @param aURI URI of the command + @param aLUID LUID of the object (if the adapter have earlier + returned LUID to the DM Module). + @param aStream Argument for the command. Adapter should create + write stream and return, when data is written to + stream by DM agent, StreamCommittedL() is called by + DM engine + @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. + @publishedPartner + @prototype + */ + virtual void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ); + + /** + The function implements copy command. The information about the success of + the command should be returned by calling SetStatusL function of + MSmlDmCallback callback interface. This makes it possible to buffer the + commands. + However, all the status codes for buffered commands must be returned at + the latest when the CompleteOutstandingCmdsL() of adapter is called. + @param aTargetURI Target URI for the command + @param aSourceLUID LUID of the target object (if one exists, and if the adapter + has earlier returned a LUID to the DM Module). + @param aSourceURI Source URI for the command + @param aSourceLUID LUID of the source object (if the adapter has + earlier returned a LUID to the DM Module). + @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. + @publishedPartner + @prototype + */ + virtual void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + + /** + The function indicates start of Atomic command. + @publishedPartner + @prototype + */ + virtual void StartAtomicL(); + + /** + The function indicates successful end of Atomic command. The adapter + should commit all changes issued between StartAtomicL() and + CommitAtomicL() + @publishedPartner + @prototype + */ + virtual void CommitAtomicL(); + + /** + The function indicates unsuccessful end of Atomic command. The adapter + should rollback all changes issued between StartAtomicL() and + RollbackAtomicL(). If rollback fails for a command, adapter should use + SetStatusL() to indicate it. + @publishedPartner + @prototype + */ + virtual void RollbackAtomicL(); + + /** + Returns ETrue if adapter supports streaming otherwise EFalse. + @param aItemSize size limit for stream usage + @return TBool ETrue for streaming support + @publishedPartner + @prototype + */ + virtual TBool StreamingSupport( TInt& aItemSize ) ; + + /** + Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has + been written to and committed. Not called when fetching item. + @publishedPartner + @prototype + */ +#ifdef __TARM_SYMBIAN_CONVERGENCY + virtual void StreamCommittedL( RWriteStream& aStream ); +#else + virtual void StreamCommittedL(); +#endif + /** + 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. In the case of Atomic processing, the function will be + followed by a call to CommitAtomicL or RollbackAtomicL. + @publishedPartner + @prototype + */ + virtual void CompleteOutstandingCmdsL(); + +private: + CAmAdapter( TAny* aDmCallback ); + void ConstructL(); + TInt DesToIntL( const TDesC8& aLuid ); + HBufC8* IntToDes8LC( const TInt aLuid ); + + TBool CheckStateL( const TDeploymentComponent &aComp, const TDesC8& aURI ); + TBool CheckStateL( const TDesC8& aURI,const TDesC8& aLUID ); + /** + * UpdateFlagFromMapping Maps a node name to internal attribute flag that + * is used by server to identify to data + * @param aMapping The SyncML node name + * @return TDeplCompAttrType the attribute type + */ + TDeplCompAttrType UpdateFlagFromMapping( const TDesC8& aMapping ); + + /** + * IdListL Looks up the given state user ids of deployment components, + * and places them to currentList in the format specified by SyncML spec + * @param aState The deployment component state in which we are interested + * @param aCurrentList The buffer where the results are placed + * @param aAppend Does the list possibly contain some items already + * @return TError EOk if successful + */ + TError IdListL( TDeploymentComponentState aState, + CBufBase &aCurrentList, TBool aAppend = EFalse ); + + /** + * DeliverOrDownloadL Depending on aURI, creates new delivery or download component + * + * @param aUserId The name of dynamic node. + * @param aURI The full URI + * @param aCnt Count of URI segments + * @param aParentMapping The parent data + * @param aStatus A reference to the error which will be set the status of the operation + * @return TError EOk if successful + */ + void DeliverOrDownloadL( const TDesC8 &aUserId, const TDesC8 &aURI, + TInt aCnt, const TDesC8 &aParentMapping, + MSmlDmAdapter::TError &aStatus ); + + + /** + * Fills the node info in ddf structure + */ + void FillNodeInfoL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription); + + /** + * Fills the node info in ddf structure, without default mime type + */ + void FillNodeInfoNoDefaultMimeL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription); + + TBool IsImage(const TDesC8& aMime) ; + /** + Calls Callback().SetResultsL() + */ + void SetResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ); +/** + Calls Callback().SetStatusL() + */ + void SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ); +// TInt FindBuffered( const TDesC8 &aURI ) ; + RApplicationManagement &SessionL(); + TDeploymentComponentState StateL( const TDesC8& aURI ); + + void CheckStateChangesL(); + void CheckStateChangesInternalL(); + + + TPtrC8 URISegsUpTo(const TDesC8& aURI, TInt aUpTo, TBool aInclKeno=EFalse); + + /** + * Helper method to move acl. Copies acl of node aFrom to acl of aTo, + * and removes acl from aFrom. + * + * @param aFrom The source uri + * @param aTo The target uri + */ + void MoveAclL( const TDesC8 &aFrom, const TDesC8 &aTo ); + + /** + * Helper method to move nodes in SCM tree + * + * 1. Sets mapping of aOriginal to null. + * 2. If aNewURI is null, constructs new uri depending on aTargetstate. + * 3. Sets mapping of aNewURI to aLUID + * 4. Moves acls of aOriginal to aNewURI (using MoveAclL) + * + * @param aOriginal The uri of original node to be moved + * @param aTargetstate The target state the node is moving to + * @param aLUID The luid of the original node + * @param aNewUri The new uri of the node (will be constructed and left to stack if null) + */ + void SetMappingLC( const TDesC8 &aOriginal, + const TDeploymentComponentState aTargetstate, const TDesC8 &aLUID, + HBufC8 *&aNewUri ); + + /** + * Helper method to move nodes in SCM tree + * + * 1. Sets mapping of aOriginal to null. + * 2. Sets mapping of a uri constructed using aTargetState to aLUID + * 2. Moves acls of aOriginal to a uri constructed using aTargetState (using MoveAclL) + * + * @param aOriginal The uri of original node to be moved + * @param aTargetstate The target state the node is moving to + * @param aLUID The luid of the original node + */ + void SetMappingL( const TDesC8 &aOriginalURI, + const TDeploymentComponentState aTargetState, const TDesC8 &aLUID ) ; + + /** + * Helper method to set DM LUID mappings directly database. + * + * @param aURI The uri of node whose mapping is to be set + * @param aLUID The new mapping value + * @return Possible database error - KErrNone if successful + */ + TInt DirectSetMappingL( const TDesC8 &aURI, const TDesC8 &aLUID ); + + TInt DirectRemoveMappingL(const TDesC8 &aURI); + /** + * Helper method to get DM LUID mappings directly from database. + * + * @param aURI The uri of node whose mapping is to be found + * @return The luid mapping - Empty string if not found. + */ + HBufC8 *DirectGetLuidAllocLC( const TDesC8 &aURI ); + + + /** + * Helper method to perform install + * + * @param aLuidi The mapping value of component as integer + * @param aURI The uri of node that is to be installed + * @param aLUID The mapping value of component as text + * @param aTargetstate The target state the node is moving to (EDCSActive or EDCSInactive) + * @param aRet The SyncML Error code - value will be updated according to success + */ + void InstallL( const TUint aLuidi, const TDesC8& aURI, const TDesC8& aLUID, + const TDeploymentComponentState aTargetState, TError &aRet ); + + /** + * Helper method to perform update + * + * @param aLuidi The mapping value of component as integer + * @param aURI The uri of node that is to be installed + * @param aLUID The mapping value of component as text + * @param aTargetstate The target state the node is moving to (EDCSActive or EDCSInactive) + * @param aRet The SyncML Error code - value will be updated according to success + */ + void UpdateL( const TUint aLuidi, const TDesC8& aURI, const TDesC8& aSourceLUID, + const TDeploymentComponentState aTargetState, TError &aRet ); + /** + maps symbian error code to DM error code as follows: + Kerrnone-> EOk + Kerrnotfound ->Enotfound + all oether -> EError + */ + void DefaultMapError( const TInt aErr, TError &aRet, const TDesC8& aDes = KNullDesC8 ); + + /** + * Deactivates given component if given state is inactive + */ + void DeactivateIfInactive( const TUint aLuidi, const TDeploymentComponentState aTargetState ); + + /** + * Finds luid from app mgmt server to given userid + */ + TUint32 GetLuidForUserIdL( const TDesC8 &aUserId, const TDeploymentComponentState aState ); + + TUint32 GetLuidL( const TDesC8 &aDMLuid, const TDesC8 &aUserId, + const TDeploymentComponentState aState ); + + /** + * places result in current + * @param aParent The deployment component identifying uri + * @param aMapping The user id part of the deployment component uri + * @param aLuid Internal id of the deployment compoennt + * @param aCurrentList The list that will get the data + * @param aStatus The syncml status + */ + void GetComponentDataL( const TDesC8& aParent, const TDesC8& aMapping, const TUint32 aLuid, + CBufBase &aCurrentList, CBufBase ¤tMime, TError &aStatus ); + /** + * returns luid of leaf node, or 0 + */ + TInt GetLeafLuidL( const TDesC8 &aURI, const TDesC8 & aParentMapping ) ; + /** + * returns length of result + */ + TInt GetSizeL( const TDeplCompAttrType aDataType, const TInt aLuid, TError &aRet ); + + /** + * places installoptions of given aLuid to aBuf + */ + void InstallOptionsDataL(const TUint32 aLuid, const TDeplCompAttrType& aDataType, + CBufBase &aBuf, CBufBase *aRaw = NULL); + + /** + * Gets the luid using GetLuidL, and updates aStatus to ENotFound if not found... + */ + TUint32 GetLuid2L( const TDesC8 &aDMLuid, const TDesC8 &aUserId, + const TDeploymentComponentState aState, TError &aStatus ); + + /** + * Finds out correct download target based on download operation + */ + TDownloadTarget DownloadTargetL( const TDesC8& aOperation ); + + TPtrC8 LastURISeg(const TDesC8& aURI); + TInt DesToInt(const TDesC8& aLuid); + +#ifdef __AM_LASTERROR_NODE + void SetLastErrorL( const TDesC8& aLastError, const TInt aErr ); + const TDesC8& LastError(); + void SetErrorL( const TDesC8& aDes, const TInt aErr ); +#endif + + + + /** + The function creates new leaf objects, or replaces data in existing leaf + objects. The information about the success of the command should be + returned by calling SetStatusL function of MSmlDmCallback callback + interface. This makes it possible to buffer the commands. However, all + the status codes for buffered commands must be returned at the latest when + the adapter's CompleteOutstandingCmdsL() is called. + @param aURI URI of the object + @param aLUID LUID of the object (if the adapter has earlier returned a + LUID to the DM Module). For new objects, this is the LUID + inherited through the parent node. + @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 + @publishedPartner + @prototype + */ + void _UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef, MSmlDmAdapter::TError& aStatus ); + /** + * The function creates new leaf objects, or replaces data in existing leaf + */ + void CloseStreaming(); + TInt GetAdapterValue(); + void SetAdapterValue(TInt aAdapterValue); + +private: + +#ifdef __TARM_SYMBIAN_CONVERGENCY + RDmTree iDbSession; +#else + RNSmlDMCallbackSession iDbSession; // to change acl location +#endif + + RApplicationManagement iManagement ; + TBool iSessionOpened ; + TAMCommandBuffer iBuffer; + TBool iInAtomic ; + TBool iUpdated; // have we checked changed state DCs? + // Streaming API support + TBool iStreamOpen; + RFileWriteStream iStream; + TInt iStatusRef; + RFs iStreamRFs; + RFile iStreamFile; + TBool iIsStreamedContent; + HBufC8* iStreamedURI; + HBufC8* iStreamedLuid; + HBufC8* iStreamedType; + TBool iCertRequired; + TBool iTrustAdded; + +#ifdef __AM_LASTERROR_NODE + HBufC8 *iLastError; +#endif + + HBufC8 *iUriDel; +}; + + } // namespace +#endif // __AMDMADAPTER_H__ + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/inc/nsmldmiapmatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/inc/nsmldmiapmatcher.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,129 @@ +/* +* 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 Tree module +* +*/ + + +#ifndef __NSMLDMIAPMATCHER_H__ +#define __NSMLDMIAPMATCHER_H__ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include "nsmldmuri.h" + +//CLASS FORWARDS +class MSmlDmCallback; + +_LIT8( KNSmlDMIAPUri, "AP" ); +_LIT8( KNSmlDMSeparator8, "/" ); +_LIT8( KNSmlDMIAPUriDotSlash, "./" ); +_LIT8( KNSmlDMConnMOIAPUri, "NAP" ); + +const TUint8 KNSmlDMSlash = 0x2f; //forward slash +/** +* CNSmlDMIAPMatcher contains services for generating URI from IAPId and +* vice versa in DM plug-in adapters. The class needs the working +* MSmlDmCallback callback interface for operating, so ths can be used only +* by DM plug-in adapters +* +* @since +*/ +class CNSmlDMIAPMatcher : public CBase + { + public: + /** + * Destructor + */ + ~CNSmlDMIAPMatcher(); + + /** + * Two-phased constructor + * @param aDmCallback Pointer to callback interface + * @return Pointer to newly created module instance + */ + static CNSmlDMIAPMatcher* NewL( MSmlDmCallback* aDmCallback); + + /** + * Two-phased constructor, pushes pointer to cleanup stack. + * @param aDmCallback Pointer to callback interface + * @return Pointer to newly created module instance + */ + static CNSmlDMIAPMatcher* NewLC( MSmlDmCallback* aDmCallback); + + /** + * Gets the IAP id which corresponds to given URI + * @param aURI Accespoint URI + * @return Accespoint id in AP database + */ + TInt IAPIdFromURIL( const TDesC8& aURI ); + + /** + * Generates the URI which corresponds to given IAP Id + * @param aIAPId Accespoint Id + * @return Accesspoint URI in DM + */ + HBufC8* URIFromIAPIdL( TInt aIAPId ); + + private: + /** + * Second phase constructor + * @param aDmCallback Pointer to callback interface + */ + void ConstructL(MSmlDmCallback* aDmCallback); + + /** + * Changes the given descriptor to Integer + * @param aLuid Luid in descriptor format + * @return Luid in TInt type + */ + TInt DesToInt(const TDesC8& aLuid) const; + + /** + * Return the URI without ./ at the beginning, if those exist + * @param aURI Uri + * @return Uri without ./ + */ + TPtrC8 RemoveDotSlash(const TDesC8& aURI) const; + + /** + * Return the last uri segment of the aURI + * @param aURI Uri + * @return The last uri segment + */ + TPtrC8 LastURISeg(const TDesC8& aURI) const; + + /** + * Return the last uri segment of the aURI + * @return The AccessPoint Reference + */ + const TDesC8& GetConRef() ; + + private: + + /** + * Pointer to callback interface + */ + MSmlDmCallback* iCallback; + + /** + * Boolean to check FeatMgr Initialization + */ + TBool iFeatMgrInitialized; + + }; + +#endif // __NSMLDMIAPMATCHER_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/inc/nsmldmuri.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/inc/nsmldmuri.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,95 @@ +/* +* 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 Utilities +* +*/ + + +#ifndef __NSMLDMURI_H +#define __NSMLDMURI_H + +#include +#include +#include + + +const TUint8 KNSmlDMUriSeparator = 0x2f; //forward slash + +_LIT8(KNSmlDmRootUri, "."); +_LIT8(KNSmlDmUriDotSlash, "./"); +_LIT8( KNSmlDmQuestionMark, "?" ); + +// =========================================================================== +// NSmlDmURI +// =========================================================================== +/** +* NSmlDmURI contains just static methods for parsing URIs +* +* @since +*/ +class NSmlDmURI + { + public: + /** + * Return the parent URI of given URI + * @param aURI Uri + * @return Parent URI + */ + static TPtrC8 ParentURI(const TDesC8& aURI); + + /** + * Return the last URI segment of given URI + * @param aURI Uri + * @return Last URI segment + */ + static TPtrC8 LastURISeg(const TDesC8& aURI); + + /** + * Return the URI without ./ at the beginning, if those exist + * @param aURI Uri + * @return Uri without ./ + */ + static TPtrC8 RemoveDotSlash(const TDesC8& aURI); + + /** + * Return the URI without property info at the end (?prop=...) + * @param aURI Uri + * @return Uri without property info + */ + static TPtrC8 RemoveProp(const TDesC8& aURI); + + /** + * Return the URI without last segment + * @param aURI Uri + * @return URI without last uri segment + */ + static TPtrC8 RemoveLastSeg(const TDesC8& aURI); + + /** + * Return the aLocationth URI segment. + * @param aURI Uri + * @param aLocation The wanted segment number + * @return The aLocationth URI segment + */ + static TPtrC8 URISeg(const TDesC8& aURI,TInt aLocation); + + /** + * Return the number of URI segments of given URI + * @param aURI Uri + * @return Number of segments + */ + static TInt NumOfURISegs(const TDesC8& aURI); + }; + +#endif // __NSMLDMURI_H diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/rom/amadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/rom/amadapter.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,25 @@ +/* +* 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 applicationmanagement components +* +*/ +#ifndef __AMDMADAPTER_IBY__ +#define __AMDMADAPTER_IBY__ + +//#if defined(__SYNCML_DM) && defined(__SAP_APPLICATION_MANAGEMENT) +#if defined(__SYNCML_DM) +ECOM_PLUGIN(amadapter2.dll, amadapter2.rsc) +#endif + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/src/amadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/src/amadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,3897 @@ +/* +* 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: Application Management DM Adapter +* +*/ + + +/** + +1. Remember the applications managed by Corporate Admin Role certificate + 1.1 They must be removed during rfs + 1.2 Others must be left as is (applications at least must be left) + +*/ + +/* + +./SCM -+-> Inventory -+--> Deployed ---> * ---+--> ID + | | | + | | |--> Name ? + | | | + | | |--> Version ? + | | | + | | |--> StateValue ? + | | | + | | |--> EnvType ? X + | | | + | | |--> Operations ---+-> Activate ? + | | | | + | | | |-> Deactivate ? + | | | | + | | | |-> Remove ? + | | | | + | | | |-> Ext ? X + | | | + | | |--> Ext ? X + | | + | +--> Delivered ---> * --+--> ID + | | + | |--> Data + | | + | |--> Name ? + | | + | |--> Version ? + | | + | |--> InstallOpts ? + | | + | |--> Descriptor ? + | | + | |--> EnvType ? X + | | + | |--> ContentType ? X + | | + | |--> Operations ---+-> Install ? + | | | + | | |-> Update ? + | | | + | | |-> InstallAndActivate ? + | | | + | | |-> UpdateAndActivate ? + | | | + | | |-> Remove ? + | | | + | | |-> Ext ? + | | + | |--> Ext ? + | + | + +-> Download --> * ---+-> ID + | | + | |-> URI + | | + | |-> Name ? + | | + | |-> Version ? + | | + | |-> InstallOpts ? X + | | + | |-> ConRef ? X + | | + | |-> Status ? + | | + | |-> EnvType ? X + | | + | |-> ContentType ? X + | | + | |--> Operations ----+-> Download ? + | | | + | | |-> DownloadAndInstall ? X + | | | + | | |-> DownloadAndInstallAndActivate ? X + | | | + | | |-> DownloadAndUpdate ? X + | | | + | | |-> DownloadAndUpdateAndActivate ? X + | | | + | | |-> Ext ? + | | + | |--> Ext ? + | + |--> Ext -> LastError (Debug Only) ? + +*/ + +#define __AM_CHECKSTATE_CHANGES // uncomment to enable dynamic acl +#include +#include +#include +#include "amadapter.h" +#include // For TImplementationProxy definition +#include +#include "nsmldmuri.h" +#include "nsmldmiapmatcher.h" +#include "debug.h" + +#include +#include "aminstalloptions.h" +#include +#include "amprivateCRKeys.h" +#ifdef __TARM_SYMBIAN_CONVERGENCY +#include +#include +#include "nsmldmuri.h" + +// Constants +_LIT8( KDeployedURI, "./SCM/Inventory/Deployed/" ); +_LIT8( KDeliveredURI, "./SCM/Inventory/Delivered/" ); +_LIT8( KDownloadURI, "./SCM/Download/" ); +#else +#include + +// Constants +_LIT8( KDeployedURI, "SCM/Inventory/Deployed/" ); +_LIT8( KDeliveredURI, "SCM/Inventory/Delivered/" ); +_LIT8( KDownloadURI, "SCM/Download/" ); +#endif + +#ifdef __NSML_DEBUG__ +#pragma message("NSml Debugging is ON!") +#else +#endif + + +using namespace NApplicationManagement; + + + +_LIT8( KAMStateValueActive, "Active" ); +_LIT8( KAMStateValueInactive, "Inactive" ); + + +_LIT8( KSisxMimeType, "x-epoc/x-sisx-app" ); +_LIT8( KSisMimeType, "application/vnd.symbian.install" ); +_LIT8( KPipMimeType, "application/x-pip" ); +_LIT8( KJadMIMEType, "text/vnd.sun.j2me.app-descriptor" ); +_LIT8( KJarMIMEType, "application/java-archive" ); +_LIT8( KJavaMIMEType, "application/java" ); + +_LIT8( KInstallOptsMimeType, "text/xml" ); + + + +const TUint8 KNSmlDMAMSeparatorDef = 0x2f; //forward slash +#ifdef __AM_LASTERROR_NODE + +#ifdef __TARM_SYMBIAN_CONVERGENCY +_LIT8( KAMLastErrorURI, "./SCM/Ext/LastError" ); +#else +_LIT8( KAMLastErrorURI, "SCM/Ext/LastError" ); +#endif +_LIT8( KStdError, "Error %d" ); + +#define MAPERROR(x,y,z) DefaultMapError(x,y,z) +#else + +#define MAPERROR(x,y,z) DefaultMapError(x,y) +#endif + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter* CAmAdapter::NewL( ) +// ------------------------------------------------------------------------------------------------ +CAmAdapter* CAmAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + RDEBUG("CAmAdapter::NewL(): begin"); + + CAmAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop(); + return self; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter* CAmAdapter::NewLC( ) +// ------------------------------------------------------------------------------------------------ +CAmAdapter* CAmAdapter::NewLC( MSmlDmCallback* aDmCallback ) + { + CAmAdapter* self = new( ELeave ) CAmAdapter( aDmCallback ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::CAmAdapter() +// ------------------------------------------------------------------------------------------------ +CAmAdapter::CAmAdapter( TAny* aEcomArguments ) + : CSmlDmAdapter( aEcomArguments ), iSessionOpened ( EFalse ), iBuffer( 8 ), + iInAtomic( EFalse ), iUpdated( EFalse ), iIsStreamedContent( EFalse ) + { + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::~CAmAdapter() +// ------------------------------------------------------------------------------------------------ +CAmAdapter::~CAmAdapter() + { + RDEBUG( "CAmAdapter::~CAmAdapter" ); + iDbSession.Close(); + iManagement.Close(); // make sure we're closed + iSessionOpened = EFalse ; + iBuffer.Close(); + + CloseStreaming(); // Ensures that no streams are left open and that the temporary file is removed + + delete iStreamedURI; + delete iStreamedLuid; + delete iStreamedType; + +#ifdef __AM_LASTERROR_NODE + delete iLastError; +#endif + + + if(iUriDel) + delete iUriDel; + RDEBUG( "CAmAdapter::~CAmAdapter end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::DDFVersionL() +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + aDDFVersion.InsertL( 0, KAMDDFVersion ); + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::DDFStructureL() +// +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + RDEBUG( "CAmAdapter::DDFStructureL(): begin" ); + + TSmlDmAccessTypes accessTypesGet; + accessTypesGet.SetGet(); + + TSmlDmAccessTypes accessTypesExec; + accessTypesExec.SetExec(); + + TSmlDmAccessTypes accessTypesExecReplace = accessTypesExec; + accessTypesExecReplace.SetReplace(); + + TSmlDmAccessTypes accessTypesGetAdd = accessTypesGet; + accessTypesGetAdd.SetAdd(); + + TSmlDmAccessTypes accessTypesGetReplace = accessTypesGet; + accessTypesGetReplace.SetGet(); + + TSmlDmAccessTypes accessTypesGetAddReplace = accessTypesGetAdd; + accessTypesGetAddReplace.SetReplace(); + + TSmlDmAccessTypes accessTypesGetAddReplaceDelete = accessTypesGetAddReplace; + accessTypesGetAddReplaceDelete.SetDelete(); + + + + + /* + Node: ./SCM + AM node is the common parent to all application management functionality nodes. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get + Values: N/A + */ + //MSmlDmDDFObject& root = aDDF.AddChildObjectGroupL(); + MSmlDmDDFObject& am = aDDF.AddChildObjectL( KAMNodeName ); + FillNodeInfoL( am, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMNodeDescription ); + + /* + Node: ./SCM/Inventory + This node is start node to application inventory. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& inv = am.AddChildObjectL( KAMInventoryNodeName ); + FillNodeInfoL( inv, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMInventoryNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered + This is node under which applications that are delivered but not installed are found. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get, Add + Values: N/A + */ + MSmlDmDDFObject& del = inv.AddChildObjectL( KAMDeliveredNodeName ); + FillNodeInfoL( del, accessTypesGetAdd, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDeliveredNodeDescription ); + + + /* + Node: ./SCM/Inventory/Deployed + This is a node under which active applications are found. + The child node descriptions are same as Delivered sibling node, except that cannot be created, data node does not exist and there's no InstallOpts leaf. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get + Values: N/A + */ + + MSmlDmDDFObject& ac = inv.AddChildObjectL( KAMDeployedNodeName ); + FillNodeInfoL( ac, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDeployedNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered/ + This dynamic node is placeholder applications that are in Delivered state. + Support: Mandatory + Occurs: ZeroOrMore + Format: Node + Access Types: Get, Add, Replace, Delete + Values: N/A + */ + MSmlDmDDFObject& deldyna = del.AddChildObjectGroupL(); + FillNodeInfoL( deldyna, accessTypesGetAddReplaceDelete, MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KAMDeliveredDynaNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//ID + This leaf node holds an identifier for an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& delid = deldyna.AddChildObjectL( KAMIDNodeName ); + FillNodeInfoL( delid, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMIDNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//Name + This leaf node holds name of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get ( + Add, Replace access within Delivered node only) + Values: N/A + */ + MSmlDmDDFObject& delname = deldyna.AddChildObjectL( KAMNameNodeName ); + FillNodeInfoL( delname, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMNameNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//Version + This leaf node holds the version of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get ( + Add, Replace access within Delivered node only) + Values: N/A + */ + MSmlDmDDFObject& delver = deldyna.AddChildObjectL( KAMVersionNodeName ); + FillNodeInfoL( delver, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMVersionNodeDescription ); + + + /* + Node: ./SCM/Inventory/Delivered//Data + This leaf node holds the data of an application. + Support: Mandatory + Occurs: One + Format: Bin + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& delda = deldyna.AddChildObjectL( KAMDataNodeName ); + FillNodeInfoNoDefaultMimeL( delda, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EBin, KAMDataNodeDescription ); + + delda.AddDFTypeMimeTypeL( KSisxMimeType ); + delda.AddDFTypeMimeTypeL( KSisMimeType ); + delda.AddDFTypeMimeTypeL( KPipMimeType ); + + FeatureManager::InitializeLibL(); + if( FeatureManager::FeatureSupported(KFeatureIdJavaMIDP20) ) + { + delda.AddDFTypeMimeTypeL( KJadMIMEType ); + delda.AddDFTypeMimeTypeL( KJarMIMEType ); + delda.AddDFTypeMimeTypeL( KJavaMIMEType); + } + + FeatureManager::UnInitializeLib(); + + + + /* + Node: ./SCM/Inventory/Delivered//Descriptor + This leaf node holds the possible metadata of an application. Descriptor can be for example such a data that is required by the actual data in the Data leaf, but for some reason they cannot be bundled into same package. An example is Java JAR and JAD file combination, in which JAD file could be placed in MetaData and JAR in Data leaf. + Support: Optional + Occurs: One + Format: Bin + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& delmd = deldyna.AddChildObjectL( KAMDescriptorNodeName ); + FillNodeInfoL( delmd, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EBin, KAMDescriptorNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//InstallOpts + This is a node that holds the installation options of an application. + + Support: Optional + Occurs: ZeroOrOne + Format: Xml + Access Types: Get, Replace + Values: N/A + */ + MSmlDmDDFObject& delio = deldyna.AddChildObjectL( KAMInstallOptsNodeName ); + FillNodeInfoNoDefaultMimeL( delio, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EXml, KAMInstallOptsNodeDescription ); + delio.AddDFTypeMimeTypeL( KInstallOptsMimeType ); + + /* + Node: ./SCM/Inventory/Delivered//Operations + This is a node that allows vendors to extend functionality. + Support: Optional + Occurs: One + Format: Node + Access Types: Get, Replace, Add, Delete + Values: N/A + */ + MSmlDmDDFObject& delop = deldyna.AddChildObjectL( KAMOperationsNodeName ); + FillNodeInfoL( delop, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMOperationsNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//Operations/Install + Exec command causes device to install a delivered application. The data inside + exec command refers to the application to be installed. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& loinst = delop.AddChildObjectL( KAMInstallNodeName ); + FillNodeInfoL( loinst, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMInstallNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//Operations/InstallAndActivate + Exec command causes device to install a delivered application. The data inside + exec command refers to the application to be installed. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& loinstact = delop.AddChildObjectL( KAMInstallAndActivateNodeName ); + FillNodeInfoL( loinstact, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMInstallAndActivateNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//Operations/Update + Exec command causes device to update an application. The data inside exec command + refers to the application to be updated. + In practice the flow is so that: + 1. Admin puts a new data with same ID in inventory/delivered or inventory/download. + 2. Admin deactivates existing component with same ID. + 3. Server executes update with item data targeting to the ID. + So actually update needs at least three "high level" commands; add data for update, + deactivate old, do the update. + + Support: Optional + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + + */ + MSmlDmDDFObject& loupd = delop.AddChildObjectL( KAMUpdateNodeName ); + FillNodeInfoL( loupd, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMUpdateNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//Operations/UpdateAndActivate + Exec command causes device to update an application and activate it. The data inside exec command refers to the application to be updated. + In practice the flow is so that: + 1. Admin puts a new data with same ID in inventory/delivered or inventory/download. + 2. Admin deactivates existing component with same ID. + 3. Server executes update with item data targeting to the ID. + So actually update needs at least three "high level" commands; add data for update, deactivate old, do the update. + + Support: Optional + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& loupda = delop.AddChildObjectL( KAMUpdateAndActivateNodeName ); + FillNodeInfoL( loupda, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMUpdateAndActivateNodeDescription ); + + /* + Node: ./SCM/Inventory/Delivered//Operations/Remove + Exec command causes device to remove an application. The data inside exec command refers to the application to be removed. The application must be in Inactive state in order for remove to be successful. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& lorem = delop.AddChildObjectL( KAMRemoveNodeName ); + FillNodeInfoL( lorem, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMRemoveNodeDescription ); + + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + DEPLOYED +*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + + + /* + Node: ./SCM/Inventory/Deployed/ + This dynamic node is placeholder applications that are in Inactive state. + Support: Mandatory + Occurs: ZeroOrMore + Format: Node + Access Types: Get, Replace + Values: N/A + */ + MSmlDmDDFObject& depldyna = ac.AddChildObjectGroupL(); + FillNodeInfoL( depldyna, accessTypesGetReplace, MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KAMDeployedDynaNodeDescription ); + + /* + Node: ./SCM/Inventory/Deployed//ID + This leaf node holds an identifier for an application. This cannot be changed. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& deplid = depldyna.AddChildObjectL( KAMIDNodeName ); + FillNodeInfoL( deplid, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMIDNodeDescription ); + + /* + Node: ./SCM/Inventory/Deployed//Name + This leaf node holds name of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get, Add, Replace + Values: N/A + */ + MSmlDmDDFObject& deplname = depldyna.AddChildObjectL( KAMNameNodeName ); + FillNodeInfoL( deplname, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMNameNodeDescription ); + + /* + Node: ./SCM/Inventory/Deployed//Version + This leaf node holds the version of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get, Add, Replace + Values: N/A + */ + MSmlDmDDFObject& deplver = depldyna.AddChildObjectL( KAMVersionNodeName ); + FillNodeInfoL( deplver, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMVersionNodeDescription ); + + /* + Node: ./SCM/Inventory/Deployed//StateValue + This leaf node holds state value of an application. + Support: ? + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& deplstate = depldyna.AddChildObjectL( KAMStateValueNodeName ); + FillNodeInfoL( deplstate, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMStateValueNodeDescription ); + + + + /* + Node: ./SCM/Inventory/Deployed//Operations + This is a node that allows vendors to extend functionality. + Support: Optional + Occurs: One + Format: Node + Access Types: Get, Replace, Add, Delete + Values: N/A + + */ + MSmlDmDDFObject& deplop = depldyna.AddChildObjectL( KAMOperationsNodeName ); + FillNodeInfoL( deplop, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMOperationsNodeDescription ); + + + + /* + Node: ./SCM/Inventory/Deployed//Operations/Remove + Exec command causes device to remove an application. The data inside exec command + refers to the application to be removed. The application must be in Inactive state + in order for remove to be successful. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& deplrem = deplop.AddChildObjectL( KAMRemoveNodeName ); + FillNodeInfoL( deplrem, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMRemoveNodeDescription ); + + /* + Node: ./SCM/Inventory/Deployed//Operations/Activate + Exec command causes device to activate an application. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& deplac = deplop.AddChildObjectL( KAMActivateNodeName ); + FillNodeInfoL( deplac, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMActivateNodeDescription ); + + /* + Node: ./SCM/Inventory/Deployed//Operations/Deactivate + Exec command causes device to deactivate an application. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& depldeac = deplop.AddChildObjectL( KAMDeActivateNodeName ); + FillNodeInfoL( depldeac, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDeActivateNodeDescription ); + +/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + DOWNLOAD +*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + + /* + Node: ./SCM/Download + This node is a root node for application download functionality. In practice download + works so that admin adds nodes under this node, and they are automatically moved to + Inventory/Delivered when the download has been finished. Running get command targeting + to this node returns a list of pending downloads. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get, Add, Replace + Values: N/A + */ + MSmlDmDDFObject& dow = am.AddChildObjectL( KAMDownloadNodeName ); + FillNodeInfoL( dow, accessTypesGetAddReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDownloadNodeDescription ); + + + /* + Node: ./SCM/Download/ + This node is a placeholder for identifier of an application that is to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get, Add, Replace, Delete + Values: N/A + */ + MSmlDmDDFObject& dowdyna = dow.AddChildObjectGroupL(); + FillNodeInfoL( dowdyna, accessTypesGetAddReplaceDelete, MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KAMDownloadDynaNodeDescription ); + + + /* + Node: ./SCM/Download//ID + This leaf node holds an identifier for an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& dowid = dowdyna.AddChildObjectL( KAMIDNodeName ); + FillNodeInfoL( dowid, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMIDNodeDescription ); + + /* + Node: ./SCM/Download//Name + This leaf node holds name of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& downame = dowdyna.AddChildObjectL( KAMNameNodeName ); + FillNodeInfoL( downame, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMNameNodeDescription ); + + /* + Node: ./SCM/Download//Version + This leaf node holds the version of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& dowver = dowdyna.AddChildObjectL( KAMVersionNodeName ); + FillNodeInfoL( dowver, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMVersionNodeDescription ); + + /* + Node: ./SCM/Download//URI + This leaf node holds the URL from which the application should be downloaded. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& dowuri = dowdyna.AddChildObjectL( KAMURINodeName ); + FillNodeInfoL( dowuri, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMURINodeDescription ); + + /* + Node: ./SCM/Download//Status + This leaf node holds the status of the download. The client updates the node value. The values are typically error codes of download protocol. Initially after the URI leaf is filled, this will get value 100, and will be replaced by one. + Support: Optional + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& dowstat = dowdyna.AddChildObjectL( KAMStatusNodeName ); + FillNodeInfoL( dowstat, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMStatusNodeDescription ); + + /* + Node: ./SCM/Download//InstallOpts + This is a node that holds the installation options of an application. + + Support: Optional + Occurs: ZeroOrOne + Format: Xml + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& dowio = dowdyna.AddChildObjectL( KAMInstallOptsNodeName ); + FillNodeInfoNoDefaultMimeL( dowio, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EXml, KAMInstallOptsNodeDescription ); + dowio.AddDFTypeMimeTypeL( KInstallOptsMimeType ); + + /* + Node: ./SCM/Download//ConRef + This is a node that holds the installation options of an application. + + Support: Optional + Occurs: ZeroOrOne + Format: Xml + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& dowcr = dowdyna.AddChildObjectL( KAMConRefNodeName ); + FillNodeInfoL( dowcr, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMConRefNodeDescription ); + + /* + Node: ./SCM/Download//Operations + This is a node that holds the operation nodes. + Support: Optional + Occurs: One + Format: Node + Access Types: Get, Replace, Add, Delete + Values: N/A + + */ + MSmlDmDDFObject& dowop = dowdyna.AddChildObjectL( KAMOperationsNodeName ); + FillNodeInfoL( dowop, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMOperationsNodeDescription ); + + /* + Node: ./SCM/Download//Operations/Download + Exec command causes device to download an application. The dynamic node specifies the application to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec + Values: N/A + */ + MSmlDmDDFObject& dowdown = dowop.AddChildObjectL( KAMDownloadOperationNodeName ); + FillNodeInfoL( dowdown, accessTypesExecReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDownloadOperationNodeDescription ); + + /* + Node: ./SCM/Download//Operations/DownloadAndInstall + Exec command causes device to download and install an application. The dynamic node specifies the application to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec + Values: N/A + */ + MSmlDmDDFObject& dowdowni = dowop.AddChildObjectL( KAMDownloadAndInstallNodeName ); + FillNodeInfoL( dowdowni, accessTypesExec, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDownloadAndInstallOperationNodeDescription ); + + /* + Node: ./SCM/Download//Operations/DownloadAndInstallAndActivate + Exec command causes device to download and install and activate an application. The dynamic node specifies the application to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec + Values: N/A + */ + MSmlDmDDFObject& dowdownia = dowop.AddChildObjectL( KAMDownloadAndInstallAndActivateNodeName ); + FillNodeInfoL( dowdownia, accessTypesExec, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDownloadAndInstallAndActivateNodeDescription ); + + /* + Node: ./SCM/Download//Operations/DownloadAndUpdate + Exec command causes device to download and update an application. The dynamic node specifies the application to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec + Values: N/A + */ + MSmlDmDDFObject& dowdownu = dowop.AddChildObjectL( KAMDownloadAndUpdateNodeName ); + FillNodeInfoL( dowdownu, accessTypesExec, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDownloadAndUpdateNodeDescription ); + + /* + Node: ./SCM/Download//Operations/DownloadAndUpdateAndActivate + Exec command causes device to download and install and activate an application. The dynamic node specifies the application to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec + Values: N/A + */ + MSmlDmDDFObject& dowdownua = dowop.AddChildObjectL( KAMDownloadAndUpdateAndActivateNodeName ); + FillNodeInfoL( dowdownua, accessTypesExec, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMDownloadAndUpdateAndActivateNodeName ); + + +#ifdef __AM_LASTERROR_NODE + MSmlDmDDFObject& amext = am.AddChildObjectL( KAMExtNodeName ); + FillNodeInfoL( amext, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, KAMExtNodeDescription ); + + MSmlDmDDFObject& amerr = amext.AddChildObjectL( KAMLastErrorNodeName ); + FillNodeInfoL( amerr, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMLastErrorDescription ); +#endif + + if (GetAdapterValue() == KAMSCMAdapter) + { + CheckStateChangesL(); + SetAdapterValue(KAMDefaultValue); + } + RDEBUG( "CAmAdapter::DDFStructureL(): end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::SessionL() +// ------------------------------------------------------------------------------------------------ +RApplicationManagement &CAmAdapter::SessionL() + { + if ( !iSessionOpened ) + { + TCertInfo info ; + + const TUid KCentralRepositoryUid = + { + 0x10207843 + }; + const TInt KCertKey = 0x01; + CRepository *re = NULL; + TRAPD( errx, re = CRepository::NewL ( KCentralRepositoryUid ) ); + if (errx == KErrNone && re) + { + TPckg pcert( info ); + errx = re->Get( KCertKey, pcert ) ; + + RDEBUG_2("aCertInfo.iFingerprint.Length() is %u",info.iFingerprint.Length() ); + if ( errx == KErrNone ) + { + RDEBUG("CAmAdapter::SessionL() errx == KErrNone"); + } + else + { + if ( errx != KErrNotFound ) + { + RDEBUG("CAmAdapter::SessionL() errx != KErrNotFound"); + } + else + { + RDEBUG("CAmAdapter::SessionL() errx == KErrNotFound"); + } + + } + delete re ; + } + + if ( errx == KErrNotFound || !iCertRequired) + { + RDEBUG("CAmAdapter::SessionL() calling iManagement.Connect()"); + User::LeaveIfError( iManagement.Connect() ); + iSessionOpened = ETrue; + iTrustAdded = EFalse; + } + else + { + RDEBUG("CAmAdapter::SessionL() calling iManagement.Connect( info )"); + User::LeaveIfError( iManagement.Connect( info ) ); + iSessionOpened = ETrue; + iTrustAdded = ETrue; + } + } + return iManagement; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::UpdateLeafObjectL() +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::UpdateLeafObjectL( + const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ) + { + RDEBUG8_4("CAmAdapter::UpdateLeafObjectL(): begin, '%S', '%S' '%S'", &aURI, &aLUID, &aType ); + + MSmlDmAdapter::TError status = EOk; + SetAdapterValue(KAMSCMAdapter); + _UpdateLeafObjectL( aURI, aLUID, aObject, aType, aStatusRef, status); + + SetStatusL( aStatusRef, status ); + if ( status == EOk ) + { + if ( iInAtomic ) + { + iBuffer.Append( TAMCommandBufferElement( aStatusRef, aURI ) ); + } + } + RDEBUG_2("CAmAdapter::UpdateLeafObjectL(): end (%d)", status); + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::UpdateLeafObjectL() +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::_UpdateLeafObjectL( + const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt /*aStatusRef*/, + MSmlDmAdapter::TError& aStatus ) + { + RDEBUG("CAmAdapter::_UpdateLeafObjectL(): begin"); + + CheckStateChangesL(); + + TError status( EError ); + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); + TInt numSeqs( NSmlDmURI::NumOfURISegs( uriPtrc ) ); + TPtrC8 mapping( NSmlDmURI::LastURISeg( uriPtrc ) ); + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( uriPtrc ) ); +#else + TInt numSeqs( NSmlDmURI::NumOfURISegs( aURI ) ); + TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); +#endif + + if (mapping == KAMNameNodeName) + { + if (aObject.Size() > KDeploymentComponentNameMaxLength) + { + aStatus = ETooLargeObject; + return ; + } + } + else if (mapping == KAMVersionNodeName) + { + if (aObject.Size() > KDeploymentComponentVersionMaxLength) + { + aStatus = ETooLargeObject; + return ; + } + } + else if(mapping == KAMConRefNodeName) + { + if (aObject.Size() > KMaxConRef) + { + aStatus = ETooLargeObject; + return ; + } + } + + TPtrC8 grandParent( NSmlDmURI::RemoveLastSeg( parent ) ); + TPtrC8 grandParentMapping( NSmlDmURI::LastURISeg( grandParent ) ); + RApplicationManagement &session = SessionL(); + TDeploymentComponentState state( EDCSNone ) ; + if ( numSeqs == 4 || numSeqs == 5 ) + { + if ( numSeqs == 4 ) + { + state = EDCSDownload; + } + else + { + if ( grandParentMapping == KAMDeliveredNodeName ) + { + state = EDCSDelivered; + } + else if ( grandParentMapping == KAMDeployedNodeName ) + { + state = EDCSActive; + } + else + { + RDEBUG8_3( "CAmAdapter::UpdateLeafObjectL(): ILLEGAL LEVEL %d NODE %S", numSeqs, &aURI ); + User::Leave( KErrArgument ); + } + } + } + else + { + RDEBUG8_3("CAmAdapter::UpdateLeafObjectL(): ILLEGAL LEVEL %d NODE %S", numSeqs, &aURI ); + } + if ( state == EDCSDelivered || state == EDCSDownload ||state == EDCSActive ||state == EDCSInactive ) + { + if ( aLUID != KNullDesC8 ) + { + TInt iluid ( DesToIntL( aLUID ) ); + TDeploymentComponent comp ; + TInt err( session.DeploymentComponent( iluid, comp ) ); + if ( err == KErrNone ) + { + TDeplCompAttrType fl( UpdateFlagFromMapping( mapping ) ); + + if ( mapping == KAMDataNodeName || mapping == KAMDescriptorNodeName ) + { + TInt erx(KErrNone); + + if ( iIsStreamedContent ) + { + CloseStreaming(); + TRAP( erx, session.UpdateDeploymentComponentStreamedDataL( iluid, fl, aType ) ); + } + else + { + // + TRAP( erx, session.UpdateDeploymentComponentDataL( iluid, fl, aObject, aType ) ); + } + MAPERROR( erx, status, _L8("Update Delivered Data or metadata %d") ); + } + else + { + if ( fl != EDCNone ) + { + TPtrC8 obj; + TAMInstallOptions opts; + TAMInstallOptionsPckg optsb( opts ); + TPckgBuf iap; + if ( fl == EDCInstallOptions ) + { + InstallOptionsParser::ParseOptionsL( aObject, opts ); + if ( opts.iIAP == -1 && opts.iConRef != KNullDesC8() ) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + + //CNSmlDMIAPMatcher* iapfinder = CNSmlDMIAPMatcher::NewLC( &Callback() ); + //opts.iIAP = iapfinder->IAPIdFromURIL( opts.iConRef ); + //CleanupStack::PopAndDestroy( iapfinder ); + CArrayFix* mapArray = new CArrayFixFlat(4); + CleanupStack::PushL(mapArray); + + Callback().GetMappingInfoListL( KNSmlDMMMSSlashIAPUri,*mapArray ); + + TInt iap = KErrNotFound; + TSmlDmMappingInfo mapInfo; + + for(TInt i = 0;iCount();i++) + { + if(LastURISeg(opts.iConRef)==mapArray->At(i).iURISeg) + { + iap=DesToInt(mapArray->At(i).iURISegLUID); + break; + } + } + opts.iIAP = iap; + mapArray->Reset(); + CleanupStack::PopAndDestroy(); //mapArray + +#else + CNSmlDMIAPMatcher* iapfinder = CNSmlDMIAPMatcher::NewLC( &Callback() ); + opts.iIAP = iapfinder->IAPIdFromURIL( opts.iConRef ); + CleanupStack::PopAndDestroy( iapfinder ); +#endif + } + obj.Set( optsb ); + } + else if ( fl == EDCConRef ) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + + //CNSmlDMIAPMatcher* iapfinder = CNSmlDMIAPMatcher::NewLC( &Callback() ); + //TInt i( iapfinder->IAPIdFromURIL( aObject ) ); + //CleanupStack::PopAndDestroy( iapfinder ); + //iap() = i; + CArrayFix* mapArray = new CArrayFixFlat(4); + CleanupStack::PushL(mapArray); + + Callback().GetMappingInfoListL( KNSmlDMMMSSlashIAPUri,*mapArray ); + + TInt iapValue = KErrNotFound; + TSmlDmMappingInfo mapInfo; + + for(TInt i = 0;iCount();i++) + { + if(LastURISeg(opts.iConRef)==mapArray->At(i).iURISeg) + { + iapValue=DesToInt(mapArray->At(i).iURISegLUID); + break; + } + } + iap() = iapValue; + mapArray->Reset(); + CleanupStack::PopAndDestroy(); //mapArray + +#else + CNSmlDMIAPMatcher* iapfinder = CNSmlDMIAPMatcher::NewLC( &Callback() ); + TInt i( iapfinder->IAPIdFromURIL( aObject ) ); + CleanupStack::PopAndDestroy( iapfinder ); + iap() = i; +#endif + obj.Set( iap ); + } + else + { + obj.Set( aObject ); + } + TRAPD( erx, session.UpdateDeploymentComponentL( iluid, fl, obj ) ); + MAPERROR( erx, status, _L8("Update some attribute %d") ); + } + else + { + status = ENotFound; + RDEBUG( "CAmAdapter::UpdateLeafObjectL(): Unknown Target leaf" ); + } + } + } + else + { + RDEBUG_3( "CAmAdapter::UpdateLeafObjectL(): FAILED TO GET COMPONENT OF ID %d: %d" , iluid, err ); + status = ENotFound; + } + } + else + { + RDEBUG8_2( "CAmAdapter::UpdateLeafObjectL(): Faild to get luid allocation and find buffered for '%S'", &parent ); + status = ENotFound; + } + } + else + { + RDEBUG8_2( "CAmAdapter::UpdateLeafObjectL(): WARNING Tried to update illegal state leaf! '%S'", &grandParentMapping ); + } + + aStatus = status; + + RDEBUG("CAmAdapter::_UpdateLeafObjectL(): end"); + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::UpdateLeafObjectL +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef ) +{ + RDEBUG8_4("CAmAdapter::UpdateLeafObjectL() aStream: begin, '%S', '%S' '%S'", &aURI, &aLUID, &aType ); + + TError status( CSmlDmAdapter::EOk ); + + if(iStreamedURI) + { + delete iStreamedURI; + iStreamedURI = NULL; + } + iStreamedURI = aURI.AllocL(); + + if(iStreamedLuid) + { + delete iStreamedLuid; + iStreamedLuid = NULL; + } + iStreamedLuid = aLUID.AllocL(); + + if(iStreamedType) + { + delete iStreamedType; + iStreamedType = NULL; + } + iStreamedType = aType.AllocL(); + + if(!iStreamOpen) + { + RApplicationManagement &session = SessionL(); + TDeplCompAttrType attrType; + TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); + TDeplCompAttrType fl( UpdateFlagFromMapping( mapping ) ); + if ( mapping == KAMDataNodeName ) + { + attrType = EDCData; + } + else if( mapping == KAMDescriptorNodeName ) + { + attrType = EDCMetaData; + } + else + { + RDEBUG8_2("CAmAdapter::UpdateLeafObjectL(): Unknown mapping: (%S)", &mapping); + status = CSmlDmAdapter::EError; + } + + if( status == CSmlDmAdapter::EOk ) + { + TInt iluid ( DesToIntL( aLUID ) ); + session.DeploymentComponentTempInstFileL( iluid, iStreamFile, attrType ); + iStream.Attach( iStreamFile ); + aStream = &iStream; + iStreamOpen = ETrue; + iIsStreamedContent = ETrue; + } + } + if ( !iInAtomic ) + { + iStatusRef = aStatusRef; + Callback().SetStatusL( aStatusRef, status ); + } + else + { + iBuffer.Append( TAMCommandBufferElement( aStatusRef, aURI ) ); + } + + RDEBUG("CAmAdapter::UpdateLeafObjectL() aStream : end"); +} + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::UpdateFlagFromMapping( const TDesC8& aMapping ) +// ------------------------------------------------------------------------------------------------ +TDeplCompAttrType CAmAdapter::UpdateFlagFromMapping( const TDesC8& aMapping ) + { + + TDeplCompAttrType res ; + if ( aMapping == KAMIDNodeName ) + { + res = EDCId; + } + else if ( aMapping == KAMNameNodeName ) + { + res = EDCName; + } + else if ( aMapping == KAMVersionNodeName ) + { + res = EDCVersion; + } + else if ( aMapping == KAMStateValueNodeName ) + { + res = EDCStateValue; + } + else if ( aMapping == KAMInstallOptsNodeName ) + { + res = EDCInstallOptions; + } + else if ( aMapping == KAMDescriptorNodeName ) + { + res = EDCMetaData; + } + else if ( aMapping == KAMDataNodeName ) + { + res = EDCData; + } + else if( aMapping == KAMURINodeName ) + { + res = EDCDownloadURI; + } + else if ( aMapping == KAMStatusNodeName ) + { + res = EDCStatus; + } + else if ( aMapping == KAMConRefNodeName ) + { + res = EDCConRef; + } + else + { + //User::Leave( KErrArgument ); + res = EDCNone; + } + return res; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::GetLuidForUserIdL( const TDesC8 &aUserId, +// const TDeploymentComponentState aState ) +// ------------------------------------------------------------------------------------------------ +TUint32 CAmAdapter::GetLuidForUserIdL( const TDesC8 &aUserId, const TDeploymentComponentState aState ) + { + TUint32 ret( 0 ); + if ( aState != EDCSNone ) + { + RElementIdArray array; + TInt err( SessionL().DeploymentComponentIdsL( array, aState ) ); + if ( err == KErrNone ) + { + CleanupClosePushL( array ); + TInt count( array.Count() ); + for( TInt i( 0 ); i < count && ret == 0; i++ ) + { + TUint32 el = array[i]; + TDCUserId dc; + SessionL().DeploymentComponentUserIdL( el, dc ); + if ( dc == aUserId ) + { + ret = el; + } + } + CleanupStack::PopAndDestroy( &array ); + } + else + { + } + } + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::GetLuid2L( const TDesC8 &aDMLuid, const TDesC8 &aUserId, +// const TDeploymentComponentState aState, TError &aStatus ) +// ------------------------------------------------------------------------------------------------ +TUint32 CAmAdapter::GetLuid2L( const TDesC8 &aDMLuid, const TDesC8 &aUserId, + const TDeploymentComponentState aState, TError &aStatus ) + { + TUint32 ret( GetLuidL(aDMLuid, aUserId, aState ) ); + if ( (TInt32)ret <= 0 ) + { + aStatus = ENotFound; + } + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::GetLuidL( const TDesC8 &aDMLuid, const TDesC8 &aUserId, +// const TDeploymentComponentState aState ) +// ------------------------------------------------------------------------------------------------ +TUint32 CAmAdapter::GetLuidL( const TDesC8 &aDMLuid, const TDesC8 &aUserId, + const TDeploymentComponentState aState ) + { + TUint32 ret( 0 ); + if ( aDMLuid == KNullDesC8 ) + { + ret = GetLuidForUserIdL( aUserId, aState ); + } + else + { + ret = DesToIntL( aDMLuid ) ; + } + + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TInt aStatusRef ) + { + + RDEBUG8_4("CAmAdapter::DeleteObjectL(): begin (%S, %S, %d)" , &aURI, &aLUID, aStatusRef ); + SetAdapterValue(KAMSCMAdapter); + CheckStateChangesL(); + + TError ret( EError ); + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ); + TPtrC8 mapping( NSmlDmURI::LastURISeg( uriPtrc ) ); +#else + TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ); + TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); +#endif + + switch ( cnt ) + { + case 3: + case 4: + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 which( NSmlDmURI::URISeg( uriPtrc, cnt == 4 ? 3 : 2 ) ); +#else + TPtrC8 which( NSmlDmURI::URISeg( aURI, cnt == 4 ? 3 : 2 ) ); +#endif + if ( which == KAMDeliveredNodeName || which == KAMDownloadNodeName ) + { + TUint32 luid( GetLuidL( aLUID, mapping, (which == KAMDeliveredNodeName ? EDCSDelivered : EDCSDownload) ) ); + if ( luid > 0 ) + { + TRAPD( err, SessionL().RemoveL( luid ) ); + if ( err == KErrNone || err == KErrNotFound ) + { + ret = EOk; + Callback().SetMappingL( aURI, KNullDesC8 ); + if ( err == KErrNone && iInAtomic ) + { + iBuffer.Append( TAMCommandBufferElement( aStatusRef, aURI ) ); + } + } + else + { + MAPERROR( err, ret, _L8("Delete %d") ); + } + } + else + { + RDEBUG( "CAmAdapter::DeleteObjectL(): WARNING Object not found" ); + ret = ENotFound; + } + } + else + { + RDEBUG8_2( "CAmAdapter::DeleteObjectL(): ERROR Removing node %S is not supported", &aURI ); + } + break; + } + default: + { + RDEBUG8_3( "CAmAdapter::DeleteObjectL(): ILLEGAL LEVEL %d NODE %S", cnt, &aURI ); + break; + } + } + SetStatusL( aStatusRef, ret ); + RDEBUG( "CAmAdapter::DeleteObjectL(): end" ); + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::DeactivateIfInactive( const TUint aLuidi, const TDeploymentComponentState aTargetState ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::DeactivateIfInactive( const TUint aLuidi, const TDeploymentComponentState aTargetState ) + { + if ( aTargetState == EDCSInactive ) + { + RDEBUG( "CAmAdapter::DeactivateIfInactive(): deactivating!" ); + TRAPD( derr, iManagement.DeactivateL( aLuidi ) ); + if ( derr != KErrNone ) + { + RDEBUG_2("CAmAdapter::DeactivateIfInactive(): ERROR deactivating failed %d", derr ); + } + } + } + +void CAmAdapter::InstallL( + TUint aLuidi, + const TDesC8& aURI, + const TDesC8& aLUID, + const TDeploymentComponentState aTargetState, + TError &aRet + ) + { + + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + #else + //nothing + #endif + + TRAPD( err, SessionL().InstallL( aLuidi, aTargetState ) ); + if ( err == KErrNone ) + { + // Dont Update the mappings in client to reflect new + // position in the management tree ( Inactive or Active..) + RDEBUG( "CAmAdapter::InstallL(): Install success!" ); + + //TPtrC8 aclmapping( URISegsUpTo( aURI, 4) ); + //SetMappingL( aclmapping, aTargetState, aLUID); + //iManagement.StateChangeComplete( aLuidi ); + + + + DeactivateIfInactive( aLuidi, aTargetState ); + aRet = EOk; + } + else + { + RDEBUG_2( "CAmAdapter::InstallL(): INSTALL FAILED '%d'" , err); + MAPERROR( err, aRet, _L8("Install %d") ); + } + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::DefaultMapError( const TInt aErr, TError &aRet ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::DefaultMapError( const TInt aErr, TError &aRet, const TDesC8& + #ifdef __AM_LASTERROR_NODE + aDes + #endif + ) + { + if ( aErr == KErrNone ) + { + aRet = EOk; + } + else if ( aErr == KErrNotFound ) + { + aRet = ENotFound; + } + else if ( aErr == KErrArgument ) + { + aRet = EInvalidObject ; + } + else if( aErr == KErrAlreadyExists ) + { + aRet = EAlreadyExists; + } + else + { + aRet = EError; + } + #ifdef __AM_LASTERROR_NODE + TInt err = KErrNone; + TRAP( err, SetErrorL( aDes, aErr ) ); + #endif + } + +#ifdef __AM_LASTERROR_NODE +void CAmAdapter::SetErrorL( const TDesC8& aDes, const TInt aErr ) + { + if ( aDes != KNullDesC8 ) + { + SetLastErrorL( aDes, aErr ); + } + else + { + SetLastErrorL(KStdError, aErr); + } + } +#endif + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, +// const TDesC8& aType, +// TInt aStatusRef ) +// ------------------------------------------------------------------------------------------------ +TDownloadTarget CAmAdapter::DownloadTargetL( const TDesC8& aCommand ) + { + if ( aCommand == KAMDownloadOperationNodeName ) + { + return EDeliver; + } + else if ( aCommand == KAMDownloadAndInstallNodeName ) + { + return EInstall; + } + else if ( aCommand == KAMDownloadAndInstallAndActivateNodeName ) + { + return EInstallAndActivate; + } + else if ( aCommand == KAMDownloadAndUpdateNodeName ) + { + return EUpdate; + } + else if ( aCommand == KAMDownloadAndUpdateAndActivateNodeName ) + { + return EUpdateAndActivate; + } + + RDEBUG8_2( "CAmAdapter::DownloadTargetL(): ASKED OPERATION NOT SUPPORTED Download '%S'", &aCommand ); + User::Leave( KErrArgument ); + // NOTE! will not ever come here! Only to get rid of compiler warning !! + return EDeliver; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, +// const TDesC8& aType, +// TInt aStatusRef ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + #else + //nothing + #endif + + RDEBUG8_3("CAmAdapter::ExecuteCommandL(): begin, '%S', '%S'", &aURI, &aLUID ); + SetAdapterValue(KAMSCMAdapter); + CheckStateChangesL(); + TError ret( EError ); + + if( aLUID == KNullDesC8 ) + { + RDEBUG("CAmAdapter::ExecuteCommandL(): WARNING no valid luid provided" ); + } + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ); + #else + TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ); + #endif + + TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); + + const TInt KDownloadMappingURILoc = 3; + switch ( cnt ) + { + case 5: + { + TUint32 iluid( GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KDownloadMappingURILoc), EDCSDownload ) ) ; + + // Track the Newly added delivered node to make sure that this reference + // of delivered node is removed from Tree DB. + // This delivered node is removed only if Execute command is successful + // by either adding Install, Install& activate etc. + // This Fix would be applicable in case of DM 1.2. + + + + TPtrC8 urival(URISegsUpTo(aURI, KDownloadMappingURILoc)); + + if(iUriDel) + { + delete iUriDel; + iUriDel = NULL; + } + + + + iUriDel = urival.AllocL(); + + RDEBUG_2("CAmAdapter::ExecuteCommandL(): luid is %d", iluid ); + if ( iluid > 0 ) + { + TDownloadTarget target = DownloadTargetL( mapping ); + + TRAPD( errx, SessionL().StartDownloadL( iluid, target ) ); + + + /*if(target == EInstall || target == EInstallAndActivate || target == EUpdate || target == EUpdateAndActivate) + { + TInt err( iDbSession.RemoveMappingInfoL( KAMAdapterImplUid, *iUriDel, ETrue ) ); + }*/ + if ( errx == KErrNone ) + { + RDEBUG( "CAmAdapter::ExecuteCommandL(): StartDownloadL Successful " ); + ret = EOk; + } + else + { + RDEBUG_2( "CAmAdapter::ExecuteCommandL(): StartDownloadL FAILED '%d'", errx ); + if ( errx == KErrNotFound ) + { + ret = ENotFound; + } + else if ( errx == KErrArgument ) + { + ret = EInvalidObject ; + } + else + { + ret = EError; + } + } + + } + else + { + ret = ENotFound; + RDEBUG( "CAmAdapter::ExecuteCommandL(): case 5 Not found node" ); + } + break; + } + case 6: + { + const TInt KInventoryMappingURILoc = 4 ; + + + // Track the Newly added delivered node to make sure that this reference + // of delivered node is removed from Tree DB. + // This delivered node is removed only if Execute command is successful + // by either adding Install, Install& activate etc. + // This Fix would be applicable in case of DM 1.2. + + + TPtrC8 urival(URISegsUpTo(aURI, KInventoryMappingURILoc)); + + if(iUriDel) + { + delete iUriDel; + iUriDel = NULL; + } + + + + iUriDel = urival.AllocL(); + + if ( mapping == KAMInstallNodeName || mapping == KAMInstallAndActivateNodeName ) + { + TUint32 iluid( GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSDelivered ) ) ; + if( iluid > 0 ) + { + TDeploymentComponentState targetstate = ((mapping == KAMInstallNodeName) ? EDCSInactive : EDCSActive); + InstallL( iluid, aURI, aLUID, targetstate, ret ); + + //TInt err( iDbSession.RemoveMappingInfoL( KAMAdapterImplUid, *iUriDel, iluid ) ); + } + else + { + ret = ENotFound; + RDEBUG( "CAmAdapter::ExecuteCommandL(): case 6 install Not found node" ); + } + } + else if ( mapping == KAMRemoveNodeName ) + { + TUint32 iluid( GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSDelivered ) ) ; + if ( (TInt32)iluid <= 0 ) + { + iluid = GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSActive ) ; + if ( (TInt32)iluid <= 0 ) + { + iluid = GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSInactive ) ; + } + } + if( iluid > 0 ) + { + TRAPD( err, SessionL().RemoveL( iluid ) ); + if ( err == KErrNone ) + { + RDEBUG( "CAmAdapter::ExecuteCommandL(): Remove success!" ); + TPtrC8 aclmapping( URISegsUpTo( aURI, 4) ); + + // "Nullify" the mapping for argument + DirectSetMappingL( aclmapping, KNullDesC8 ); + ret = EOk; + if ( iInAtomic ) + { + iBuffer.Append( TAMCommandBufferElement( aStatusRef, aURI ) ); + } + } + else + { + RDEBUG_2( "CAmAdapter::ExecuteCommandL(): Remove FAILED '%d'", err); + + MAPERROR( err, ret, _L8("Execute Remove %d") ); + } + } + else + { + ret = ENotFound; + RDEBUG( "CAmAdapter::ExecuteCommandL(): case 6 remove Not found node" ); + } + } + else if ( mapping == KAMUpdateNodeName ) + { + RDEBUG8_2( "CAmAdapter::ExecuteCommandL(): Update: '%S'", &mapping ); + TUint32 iluid( GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSDelivered ) ) ; + if( iluid > 0 ) + { + UpdateL( iluid, aURI, aLUID, EDCSInactive, ret ); + //TInt err( iDbSession.RemoveMappingInfoL( KAMAdapterImplUid, *iUriDel, iluid ) ); + } + else + { + ret = ENotFound; + RDEBUG( "CAmAdapter::ExecuteCommandL(): case 6 Update Not found node" ); + } + } + else if ( mapping == KAMUpdateAndActivateNodeName ) + { + RDEBUG8_2( "CAmAdapter::ExecuteCommandL(): UpdateAndActivate: '%S'", &mapping ); + TUint32 iluid( GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSDelivered ) ) ; + if( iluid > 0 ) + { + UpdateL( iluid, aURI, aLUID, EDCSActive, ret ); + //TInt err( iDbSession.RemoveMappingInfoL( KAMAdapterImplUid, *iUriDel, iluid ) ); + } + else + { + ret = ENotFound; + RDEBUG( "CAmAdapter::ExecuteCommandL(): case 6 UpdateAndActivate Not found node" ); + } + } + else if ( mapping == KAMActivateNodeName ) + { + //DBG_ARGS8( "CAmAdapter::ExecuteCommandL(): Activating " ); + TUint32 iluid( GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSActive ) ); + if ( (TInt32)iluid <= 0 ) + { + iluid = GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSInactive ) ; + } + if( iluid > 0 ) + { + TRAPD( erx, SessionL().ActivateL( iluid ) ); + + MAPERROR( erx, ret, _L8("Activate %d") ); + } + else + { + ret = ENotFound; + RDEBUG( "CAmAdapter::ExecuteCommandL(): case 6 Activate Not found node" ); + } + } + else if ( mapping == KAMDeActivateNodeName ) + { + //DBG_ARGS8( "CAmAdapter::ExecuteCommandL(): Inactivating " ); + TUint32 iluid( GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSActive ) ); + if ( (TInt32)iluid <= 0 ) + { + iluid = GetLuidL( aLUID, NSmlDmURI::URISeg(aURI, KInventoryMappingURILoc), EDCSInactive ) ; + } + if( iluid > 0 ) + { + TRAPD( erx, SessionL().DeactivateL( iluid ) ); + + MAPERROR( erx, ret,_L8("Dectivate %d") ); + } + else + { + ret = ENotFound; + RDEBUG( "CAmAdapter::ExecuteCommandL(): case 6 DeActivate Not found node" ); + } + } + else + { + RDEBUG8_2( "CAmAdapter::ExecuteCommandL(): ASKED NOT SUPPORTED OPERATION '%S'", &mapping ); + User::Leave( KErrArgument ); + } + break; + } + + default: + { + RDEBUG8_3( "CAmAdapter::ExecuteCommandL(): ILLEGAL LEVEL %d NODE %S", cnt, &aURI ); + User::Leave( KErrArgument ); + break; + } + } + SetStatusL( aStatusRef, ret ) ; + } + + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::UpdateL( +// const TUint aLuidi, +// const TDesC8& aURI, +// const TDesC8& aSourceLUID, +// const TDeploymentComponentState aTargetState, +// TError &aRet +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::UpdateL( + const TUint aLuidi, + const TDesC8& aURI, + const TDesC8& aSourceLUID, + const TDeploymentComponentState aTargetState, + TError &aRet + ) + { + + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + #else + //nothing + #endif + + CBufBase *delivered = CBufFlat::NewL( 128 ); + CleanupStack::PushL( delivered ); + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 aclmapping( NSmlDmURI::URISeg( uriPtrc, 4 ) ); + #else + TPtrC8 aclmapping( NSmlDmURI::URISeg( aURI, 4 ) ); + #endif + + + HBufC8 *targetURI = HBufC8::NewLC( KDeployedURI().Length() + aclmapping.Length() ); + + TPtr8 targetPtr( targetURI->Des() ); + targetPtr.Copy( KDeployedURI ); + targetPtr.Append( aclmapping ); + + HBufC8 *deployed = Callback().GetLuidAllocL( targetPtr ) ; + CleanupStack::PushL( deployed ); + + //DBG_ARGS8( "CAmAdapter::UpdateL(): Updating '%S' luid: '%S'" ), &targetPtr, &(*deployed)); + if ( *deployed == KNullDesC8 ) + { + //DBG_ARGS8( "CAmAdapter::UpdateL(): Failed to find to update target '%S'" ), &targetPtr ); + aRet = EError; + } + else + { + // Found delivered & active or inactive components! Do update! + TInt depluid( DesToIntL( *deployed ) ); + TRAPD( erx, SessionL().UpdateL( aLuidi, depluid ) ); + MAPERROR( erx, aRet,_L8("Update %d") ); + if ( erx == KErrNone ) + { + //SetMappingLC( aclmapping, aTargetState, aSourceLUID, targetURI ); + DeactivateIfInactive( aLuidi, aTargetState ); + } + } + CleanupStack::PopAndDestroy( deployed ) ; + CleanupStack::PopAndDestroy( targetURI ) ; + CleanupStack::PopAndDestroy( delivered ) ; + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::CheckStateL( const TDeploymentComponent &aComp, const TDesC8& aURI +// ------------------------------------------------------------------------------------------------ +TBool CAmAdapter::CheckStateL( const TDeploymentComponent &aComp, const TDesC8& aURI ) + { + // Scenarios like "./SCM/Download/Node1/Operations/Install" NumOfURISegs won't work. + + TBool ret; + if ((aComp.iState == EDCSDelivered) || (aComp.iState == EDCSActive) || ( aComp.iState == EDCSInactive) || (aComp.iState == EDCSDownload)) + { + // Check for map & __TARM_SYMBIAN_CONVERGENCY also ? + ret = ETrue; + } + else + ret = EFalse; + return ret; +#if 0 + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ) ; + #else + TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ) ; + #endif + + TBool ret( EFalse ); + //TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ) ; + if ( cnt == 4 ) + { + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + TPtrC8 map( NSmlDmURI::URISeg( uriPtrc, 3 ) ); + #else + TPtrC8 map( NSmlDmURI::URISeg( aURI, 3 ) ); + #endif + switch ( aComp.iState ) + { + case EDCSDelivered: + ret = (map == KAMDeliveredNodeName); + break; + case EDCSActive: + case EDCSInactive: + ret = (map == KAMDeployedNodeName); + break; + default: + ret = EFalse; + break; + } + } + else if ( cnt == 3 ) + { + if ( NSmlDmURI::URISeg( aURI, 2 ) == KAMDownloadNodeName && aComp.iState == EDCSDownload) + { + ret = ETrue; + } + } + return ret; +#endif + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::StateL( const TDeploymentComponent &aComp, const TDesC8& aURI +// ------------------------------------------------------------------------------------------------ +TDeploymentComponentState CAmAdapter::StateL( const TDesC8& aURI ) + { + + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + #else + //nothing + #endif + + TDeploymentComponentState ret( EDCSNone ); + #ifdef __TARM_SYMBIAN_CONVERGENCY + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ) ; + #else + TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ) ; + #endif + if ( cnt > 2) + { + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 map( NSmlDmURI::URISeg( uriPtrc, 2 ) ); + #else + TPtrC8 map( NSmlDmURI::URISeg( aURI, 2 ) ); + #endif + if ( map == KAMInventoryNodeName ) + { + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 map( NSmlDmURI::URISeg( uriPtrc, 2 ) ); + #else + TPtrC8 map( NSmlDmURI::URISeg( aURI, 2 ) ); + #endif + map.Set( NSmlDmURI::URISeg( aURI, 3 ) ); + if ( map == KAMDeployedNodeName ) + { + + } + else if ( map == KAMDeliveredNodeName ) + { + ret = EDCSDelivered; + } + else + { + User::Leave( KErrArgument ); + } + } + else if( map == KAMDownloadNodeName ) + { + ret = EDCSDownload; + } + else + { + User::Leave( KErrArgument ); + } + } + return ret; + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::CheckStateL( const TDesC8& aURI, const TDesC8& aLUID ) +// ------------------------------------------------------------------------------------------------ +TBool CAmAdapter::CheckStateL( const TDesC8& aURI, const TDesC8& aLUID ) + { + + + TUint32 iluid( DesToIntL( aLUID ) ); + TDeploymentComponent comp ; + TInt err( SessionL().DeploymentComponent( iluid, comp ) ); + TBool ret( EFalse ); + if ( err == KErrNone ) + { + ret = CheckStateL( comp, aURI ); + } + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::InstallOptionsDataL(const TUint32 iluid, const TDeplCompAttrType& aDataType, +// CBufBase &aBuf, CBufBase *aRaw/*= NULL*/) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::InstallOptionsDataL(const TUint32 iluid, const TDeplCompAttrType& aDataType, + CBufBase &aBuf, CBufBase *aRaw/*= NULL*/) + { + TAMInstallOptionsPckgBuf iop; + TBool pushed( EFalse ); + if ( !aRaw ) + { + aRaw = CBufFlat::NewL(32); + CleanupStack::PushL( aRaw ); + pushed = ETrue; + SessionL().DeploymentComponentDataL( iluid, aDataType, *aRaw ); + } + + iop.Copy( aRaw->Ptr( 0 ) ); + if ( pushed ) + { + CleanupStack::PopAndDestroy( aRaw ); + } + InstallOptionsParser::SerializeOptionsL( iop(), aBuf); + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::GetComponentDataL( const TDesC8& parent, const TDesC8& mapping, +// const TUint32 iluid, CBufBase *currentList, CBufBase *currentMime, TError &status ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::GetComponentDataL( const TDesC8& parent, const TDesC8& mapping, + const TUint32 iluid, CBufBase ¤tList, CBufBase ¤tMime, TError &status ) + { + TDeploymentComponent comp ; + TInt err( SessionL().DeploymentComponent( iluid, comp ) ); + if ( err == KErrNone ) + { + RDEBUG_3( "CAmAdapter::GetComponentDataL(): DeploymentComponent response: %d, state: %d", err, comp.iState ); + if ( CheckStateL( comp, parent ) ) + { + if ( mapping == KAMIDNodeName ) + { + currentList.InsertL( 0, comp.iId ); + status = EOk; + } + else if ( mapping == KAMNameNodeName ) + { + currentList.InsertL( 0, comp.iName ); + status = EOk; + } + else if ( mapping == KAMVersionNodeName ) + { + currentList.InsertL( 0, comp.iVersion ); + status = EOk; + } + else + { + TDeplCompAttrType dataType( UpdateFlagFromMapping( mapping ) ); + if ( comp.iState == EDCSDownload ) + { + if ( dataType == EDCDownloadURI || dataType == EDCStatus) + { + SessionL().DeploymentComponentDataL( iluid, dataType, currentList ); + status = EOk ; + } + else if ( dataType == EDCInstallOptions ) + { + InstallOptionsDataL( iluid, dataType, currentList ); + status = EOk; + } + else if ( dataType == EDCConRef ) + { + CBufBase *b = CBufFlat::NewL(4); + CleanupStack::PushL( b ); + SessionL().DeploymentComponentDataL( iluid, dataType, *b); + TPckgBuf iap; + iap.Copy( b->Ptr( 0 ) ); + CleanupStack::PopAndDestroy( b ); +#ifdef __TARM_SYMBIAN_CONVERGENCY + + CArrayFix* mapArray = new CArrayFixFlat(4); + CleanupStack::PushL(mapArray); + + Callback().GetMappingInfoListL( KNSmlDMMMSSlashIAPUri,*mapArray ); + + //TInt iap = KErrNotFound; + TSmlDmMappingInfo mapInfo; + HBufC8 * uri = NULL; + TPtr8 tempURI(uri->Des()); + + for(TInt i = 0;iCount();i++) + { + if(iap()==DesToInt(mapArray->At(i).iURISegLUID)) + { + tempURI=mapArray->At(i).iURISeg; + } + + } + mapArray->Reset(); + CleanupStack::PopAndDestroy(); //mapArray + if ( uri != NULL ) + { + CleanupStack::PushL( uri ) ; + currentList.InsertL( 0, *uri ); + CleanupStack::PopAndDestroy( uri ) ; + } + +#else + + CNSmlDMIAPMatcher* iapfinder = CNSmlDMIAPMatcher::NewLC( &Callback() ); + HBufC8 * uri = iapfinder->URIFromIAPIdL( iap() ) ; + CleanupStack::PopAndDestroy( iapfinder ); + if ( uri != NULL ) + { + CleanupStack::PushL( uri ) ; + currentList.InsertL( 0, *uri ); + CleanupStack::PopAndDestroy( uri ) ; + } + +#endif + status = EOk; + } + else + { + RDEBUG8_2( "CAmAdapter::GetComponentDataL(): ASKED NOT SUPPORTED LEAF '%S'", &mapping ); + } + } + else if ( comp.iState == EDCSDelivered ) + { + if ( dataType == EDCData || dataType == EDCMetaData || dataType == EDCInstallOptions) + { + CBufBase *raw = CBufFlat::NewL( 128 ); + CleanupStack::PushL( raw ); + SessionL().DeploymentComponentDataL( iluid, dataType, *raw ); + TPtrC8 source( raw->Ptr(0) ); + if ( source.Length() > 0 ) + { + if ( dataType == EDCData ) + { + currentList.InsertL( 0, source ); + SessionL().DeploymentComponentDataL( iluid, EDCDataMime, currentMime ); + + } + else if ( dataType == EDCInstallOptions ) + { + InstallOptionsDataL( iluid, dataType, currentList, raw ); + } + else + { + currentList.InsertL( 0, source ); + SessionL().DeploymentComponentDataL( iluid, EDCMetaDataMime, currentMime ); + } + } + else + { + // 0 data length... + } + status = EOk; + CleanupStack::PopAndDestroy( raw ); + RDEBUG8_2( "CAmAdapter::GetComponentDataL(): DeploymentComponentDataL called '%S'", &mapping ); + } + } + else if ( dataType == EDCStateValue ) + { + if ( comp.iState == EDCSActive ) + { + currentList.InsertL( 0, KAMStateValueActive() ); + } + else + { + currentList.InsertL( 0, KAMStateValueInactive() ); + } + status = EOk; + } + else + { + RDEBUG8_2( "CAmAdapter::GetComponentDataL(): ERROR ASKED NOT SUPPORTED LEAF '%S'", &mapping ); + } + } + } + else + { + RDEBUG8_3( "CAmAdapter::GetComponentDataL(): WARNING Asked illegal state leaf '%S', %d", &mapping, comp.iState ); + status = ENotFound; + } + } + else + { + RDEBUG_3( "CAmAdapter::GetComponentDataL(): ERROR FAILED TO GET COMPOMENT OF ID %d: %d", iluid, err ); + MAPERROR( err, status,_L8("Get Component %d") ); + } + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::GetLeafLuidL(const TDesC8 &aURI, const TDesC8 & aParentMapping ) +// ------------------------------------------------------------------------------------------------ +TInt CAmAdapter::GetLeafLuidL(const TDesC8 &aURI, const TDesC8 & aParentMapping ) + { + + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + TInt numSeqs( NSmlDmURI::NumOfURISegs( uriPtrc ) ); + #else + TInt numSeqs( NSmlDmURI::NumOfURISegs( aURI ) ); + #endif + + TUint32 iluid( 0 ); + //TInt numSeqs( NSmlDmURI::NumOfURISegs( aURI ) ); + + switch ( numSeqs ) + { + case 4: // must be a download leaf + { + iluid = GetLuidForUserIdL( aParentMapping, EDCSDownload ) ; + break; + } + case 5: // download operation or delivered or deployed leaf + { + if ( URISegsUpTo( aURI, 2, ETrue ) == KDownloadURI ) + { + RDEBUG8_2( "CAmAdapter::GetLeafLuidL(): WARNING download operation leaf '%S'", &aURI ); + //status = EOk; + } + else + { + TPtrC8 start( URISegsUpTo( aURI, 3, ETrue ) ); + if ( start == KDeliveredURI ) + { + iluid = GetLuidForUserIdL( aParentMapping, EDCSDelivered ) ; + } + else if ( start == KDeployedURI ) + { + iluid = GetLuidForUserIdL( aParentMapping, EDCSActive ) ; + if( (TInt32)iluid <= 0 ) + { + iluid = GetLuidForUserIdL( aParentMapping, EDCSInactive ) ; + } + } + else + { + RDEBUG8_2( "CAmAdapter::GetLeafLuidL(): WARNING strange uri '%S'", &aURI ); + } + } + break; + } + case 6: // delivered or deployed operation leaf + { + //iluid = GetLuidForUserIdL( parentMapping, EDCSDownload ) ; + //status = EOk; + RDEBUG8_2( "CAmAdapter::GetLeafLuidL(): WARNING delivered or deployed operation leaf '%S'", &aURI ); + break; + } + default: // illegal uri + { + RDEBUG8_2( "CAmAdapter::GetLeafLuidL(): ERROR requested luid of illegal URI '%S'", &aURI ); + break; + } + } + return iluid; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, +// CBufBase& aObject ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, + const TInt aResultsRef, TInt aStatusRef ) + { + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + #else + //Nothing + #endif + + + RDEBUG8_4("CAmAdapter::FetchLeafObjectL('%S', '%S', '%S'): begin", &aURI, &aLUID, &aType ); + SetAdapterValue(KAMSCMAdapter); + CheckStateChangesL(); + TError status( EError ); + + CBufBase *currentList = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentList ); + + CBufBase *currentMime = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentMime ); + + TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); + TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + + HBufC8 *luid = NULL; + if ( aLUID != KNullDesC8 ) + { + luid = aLUID.AllocLC(); + } + else + { // try if we find it from download path + TBuf8<256> down; + down = KDownloadURI; + down.Append ( parentMapping ); + luid = Callback().GetLuidAllocL( down ); + CleanupStack::PushL( luid ); + if ( *luid != KNullDesC8 ) + { + // make it to found next time + DirectSetMappingL( parent, *luid ); + MoveAclL( down, parent ); + + // remove old + DirectSetMappingL( down, KNullDesC8 ); + } + } + if ( *luid != KNullDesC8 ) + { + TUint32 iluid ( DesToIntL( *luid ) ); + RDEBUG8_2( "CAmAdapter::FetchLeafObjectL(): Luid is : %d", iluid ); + GetComponentDataL( parent, mapping, iluid, *currentList, *currentMime, status ); + } + else + { + TUint32 iluid( GetLeafLuidL( aURI, parentMapping ) ); + if ( iluid > 0 ) + { + HBufC8 *l = IntToDes8LC( iluid ); + DirectSetMappingL( parent, *l ); + CleanupStack::PopAndDestroy( l ); + GetComponentDataL( parent, mapping, iluid, *currentList, *currentMime, status ); + } + else + { + RDEBUG8_2( "CAmAdapter::FetchLeafObjectL(): WARNING Faild to get luid allocation for '%S'", &parent ); + if ( aLUID == KNullDesC8 ) + { +#ifdef __AM_LASTERROR_NODE + if ( aURI == KAMLastErrorURI ) + { + const TDesC8& error= LastError(); + RDEBUG8_2( "CAmAdapter::FetchLeafObjectL(): Returning last error '%S'", &error ); + currentList->InsertL(0, error ); + status = EOk; + } + else + { + status = ENotFound; + } +#else + status = ENotFound ; +#endif + } + } + } + + SetStatusL( aStatusRef, status ); + if( status == EOk ) + { + if ( iInAtomic ) + { + iBuffer.Append( TAMCommandBufferElement( aStatusRef, aURI ) ); + } + Callback().SetResultsL( aResultsRef, *currentList, + ( (currentMime->Size() > 0) ? currentMime->Ptr(0) : aType ) ); + } + CleanupStack::PopAndDestroy( luid ); + CleanupStack::PopAndDestroy( currentMime ); //currentMime + CleanupStack::PopAndDestroy( currentList ); //currentList + RDEBUG("CAmAdapter::FetchLeafObjectL: end" ); + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::IdListL( TDeploymentComponentState aState, +// CBufBase *aCurrentList, TBool aAppend /* = EFalse */) +// ------------------------------------------------------------------------------------------------ +CAmAdapter::TError CAmAdapter::IdListL( + TDeploymentComponentState aState, + CBufBase &aCurrentList, TBool aAppend /* = EFalse */) + { + CAmAdapter::TError ret( CAmAdapter::EError ); + RElementIdArray array; + TPtrC8 uriStart; + TBuf8<256> uri; + switch ( aState ) + { + case EDCSDelivered: + uriStart.Set( KDeliveredURI ); + break; + case EDCSActive: + case EDCSInactive: + uriStart.Set( KDeployedURI ) ; + break; + case EDCSDownload: + uriStart.Set( KDownloadURI ) ; + break; + default: + break; + + } + TInt err( SessionL().DeploymentComponentIdsL( array, aState ) ); + if ( err == KErrNone ) + { + TInt count( array.Count() ); + if ( count && aAppend && aCurrentList.Size() ) + { + aCurrentList.InsertL( aCurrentList.Size(), KAMSeparator8 ); + } + for( TInt i( 0 ); i < count; i++ ) + { + TUint32 el = array[i]; + TDCUserId dc; + SessionL().DeploymentComponentUserIdL( el, dc ); + + if ( uriStart == KNullDesC8() ) + { + TDeploymentComponent comp ; + err = SessionL().DeploymentComponent( el, comp ) ; + if ( err == KErrNone ) + { + switch ( comp.iState ) + { + case EDCSDelivered: + uriStart.Set( KDeliveredURI ); + break; + case EDCSActive: + case EDCSInactive: + uriStart.Set( KDeployedURI ) ; + break; + case EDCSDownload: + uriStart.Set( KDownloadURI ) ; + break; + default: + break; + } + } + } + if ( uriStart != KNullDesC8() ) + { + uri.Copy( uriStart ); + uri.Append( dc ); + HBufC8 *luid = DirectGetLuidAllocLC( uri ); //Callback().GetLuidAllocL( uri ); + if ( KNullDesC8() == *luid ) + { + RDEBUG8_3( "CAmAdapter::IdListL(): WARNING updating lost luid of '%S' %d", &uri, el ); + HBufC8 *l = IntToDes8LC( el ); + if ( *luid == *l ) + { + RDEBUG( "CAmAdapter::IdListL(): WARNING CANCEL (not really updating, they're the same already" ); + } + else + { + DirectSetMappingL( uri, *l ); + } + CleanupStack::PopAndDestroy( l ); + } + CleanupStack::PopAndDestroy( luid ); + + } + else + { + RDEBUG_2( "CAmAdapter::IdListL(): WARNING failed to get component state of id %d, cannot check mappings ", el ); + } + aCurrentList.InsertL( aCurrentList.Size(), dc); + if ( i + 1 < count ) + { + aCurrentList.InsertL( aCurrentList.Size(), KAMSeparator8 ); + } + } + ret = EOk; + } + else + { + RDEBUG_2( "CAmAdapter::IdListL(): Error %d", err ); + } + array.Reset(); + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::ChildURIListL( const TDesC8& aURI, const TDesC8& aParentLUID, +// const CArrayFix& /*aPreviousURISegmentList*/, const TInt aResultsRef, +// TInt aStatusRef ); +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::ChildURIListL( const TDesC8& aURI, const TDesC8& aParentLUID, + const CArrayFix& /*aPreviousURISegmentList*/, const TInt aResultsRef, + TInt aStatusRef ) + { + + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + #else + //Nothing + #endif + + RDEBUG8_3 ( "CAmAdapter::ChildURIListL(): begin ('%S', '%S')" , &aURI, &aParentLUID ); + CheckStateChangesL(); + + TError ret( EError ); + + CBufBase *currentList = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentList ); + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TInt numSeqs( NSmlDmURI::NumOfURISegs( uriPtrc ) ); + #else + TInt numSeqs( NSmlDmURI::NumOfURISegs( aURI ) ); + #endif + + TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); + if ( numSeqs == 1 ) + { + currentList->InsertL( 0, KAMRootChilds ); + ret = EOk; + } + else if ( numSeqs == 2 ) + { + if ( mapping == KAMInventoryNodeName) + { + currentList->InsertL( 0, KAMInventoryChilds ); + ret = EOk; + } + else if ( mapping == KAMDownloadNodeName ) + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): Level 2 NODE %S", &aURI ); + TDeploymentComponentState state ( EDCSDownload ); + ret = IdListL( state, *currentList ); + } + else + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): ILLEGAL LEVEL 2 NODE %S", &aURI ); + User::Leave( KErrArgument ); + } + } + else if ( numSeqs == 3 ) + { + if ( mapping == KAMDeliveredNodeName ) + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): Level 3 NODE %S", &aURI ); + TDeploymentComponentState state ( EDCSDelivered ); + ret = IdListL( state, *currentList ); + } + else if ( mapping == KAMDeployedNodeName ) + { + TDeploymentComponentState state ( EDCSActive ); + ret = IdListL( state, *currentList ); + if ( ret == EOk ) + { + state = EDCSInactive ; + ret = IdListL( state, *currentList, ETrue ); + } + } + else + { + if ( aParentLUID != KNullDesC8 ) + { + if ( CheckStateL( aURI, aParentLUID ) ) + { + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); + TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + if ( parentMapping == KAMDownloadNodeName ) + { + currentList->InsertL( 0, KAMDownloadDynaChilds ); + ret = EOk; + } + else + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): ILLEGAL LEVEL 3 NODE %S", &aURI ); + User::Leave( KErrArgument ); + } + } + else + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): DC has changed state %S", &aURI ); + ret = ENotFound; + } + } + else + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): Level3 Node not found %S", &aURI ); + ret = ENotFound; + } + } + } + else if ( numSeqs == 4 ) + { + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); + TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + if ( aParentLUID == KNullDesC8 ) + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): WARNING possibly a illegal level 4 node %S", &aURI ); + ret = ENotFound; + } + + if ( parentMapping == KAMDeliveredNodeName ) + { + if ( GetLuid2L( aParentLUID, mapping, EDCSDelivered, ret ) > 0 ) + { + currentList->InsertL( 0, KAMInventoryDeliveredDynaChilds ); + ret = EOk; + } + } + else if ( parentMapping == KAMDeployedNodeName ) + { + if ( GetLuid2L( aParentLUID, mapping, EDCSActive, ret ) > 0 ) + { + currentList->InsertL( 0, KAMInventoryDynaChilds ); + ret = EOk; + } + else if ( GetLuid2L( aParentLUID, mapping, EDCSInactive, ret ) > 0 ) + { + currentList->InsertL( 0, KAMInventoryDynaChilds ); + ret = EOk; + } + } + else if ( mapping == KAMOperationsNodeName ) + { + if ( GetLuid2L( aParentLUID, parentMapping, EDCSDownload, ret ) > 0 ) + { + if ( CheckStateL( aURI, aParentLUID ) ) + { + currentList->InsertL( 0, KAMDownloadOperationChilds ); + ret = EOk; + } + else + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): Level3 operations DC changed state '%S'", &aURI ); + ret = ENotFound; + } + } + } + else + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): Level4 Node not found '%S'", &aURI ); + ret = ENotFound; + } + } + else if ( numSeqs == 5 ) + { + if ( aParentLUID == KNullDesC8 ) + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): WARNING possibly a illegal level 5 node %S", &aURI ); + ret = ENotFound; + } + if ( mapping == KAMOperationsNodeName ) + { + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); + TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + TPtrC8 gparent( NSmlDmURI::RemoveLastSeg( parent ) ); + TPtrC8 gparentMapping( NSmlDmURI::LastURISeg( gparent ) ); + if ( gparentMapping == KAMDeliveredNodeName ) + { + if ( GetLuid2L( aParentLUID, parentMapping, EDCSDelivered, ret ) > 0 ) + { + currentList->InsertL( 0, KAMDeliveredOperationChilds ); + ret = EOk; + } + } + else if ( gparentMapping == KAMDeployedNodeName ) + { + if ( GetLuid2L( aParentLUID, parentMapping, EDCSActive, ret ) > 0 ) + { + currentList->InsertL( 0, KAMDeployedOperationChilds ); + ret = EOk; + } + else if ( GetLuid2L( aParentLUID, parentMapping, EDCSInactive, ret ) > 0 ) + { + currentList->InsertL( 0, KAMDeployedOperationChilds ); + ret = EOk; + } + } + else + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): Level5 Node not found wrong parent '%S'", &aURI ); + ret = ENotFound; + } + } + else + { + RDEBUG8_2( "CAmAdapter::ChildURIListL(): Level5 Node not found '%S'", &aURI ); + ret = ENotFound; + } + } + else + { + RDEBUG8_3( "CAmAdapter::ChildURIListL(): ILLEGAL LEVEL %d NODE %S", numSeqs, &aURI ); + ret = EError; + } + + SetStatusL( aStatusRef, ret ); + + if( ret == EOk ) + { + if ( iInAtomic ) + { + iBuffer.Append( TAMCommandBufferElement( aStatusRef, aURI ) ); + } + Callback().SetResultsL( aResultsRef, *currentList, KNullDesC8 ); + } + CleanupStack::PopAndDestroy(); //currentList + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::DeliverOrDownloadL( const TDesC8 &aUserId, const TDesC8 &aURI, TInt aCnt, +// const TDesC8 &aParentMapping, MSmlDmAdapter::TError &aStatus ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::DeliverOrDownloadL( const TDesC8 &aUserId, const TDesC8 &aURI, TInt aCnt, + const TDesC8 &aParentMapping, MSmlDmAdapter::TError &aStatus ) + { + + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + #else + //Nothing + #endif + + switch ( aCnt ) + { + case 3: + { + if ( aParentMapping == KAMDownloadNodeName ) + { + TUint32 luid( SessionL().DownloadL( aUserId ) ); + Callback().SetMappingL( aURI, *IntToDes8LC( luid ) ); + CleanupStack::PopAndDestroy(); + aStatus = EOk; + } + else + { + RDEBUG( "CAmAdapter::DeliverOrDownloadL(): ERROR Illegal parent"); + } + break; + } + case 4: + { + if ( aParentMapping == KAMDeliveredNodeName ) + { + TUint32 luid( SessionL().DeliverL( aUserId ) ); + Callback().SetMappingL( aURI, *IntToDes8LC( luid ) ); + CleanupStack::PopAndDestroy(); + aStatus = EOk; + } + else + { + RDEBUG( "CAmAdapter::DeliverOrDownloadL(): ERROR Illegal parent"); + } + break; + } + default: + { + RDEBUG( "CAmAdapter::DeliverOrDownloadL(): ERROR Illegal URI"); + break; + } + } + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::AddNodeObjectL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, TInt aStatusRef ) + { + + + #ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + TPtrC8 mapping( NSmlDmURI::LastURISeg( uriPtrc ) ); + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( uriPtrc ) ); + TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ); + #else + TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); + TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ); + #endif + + RDEBUG8_3( "CAmAdapter::AddNodeObjectL(): begin '%S', '%S'", &aURI, &aParentLUID ); + SetAdapterValue(KAMSCMAdapter); + CheckStateChangesL(); + TError status ( EError ); +// TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); +// TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); +// TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); +// TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ); + TUint32 iluid( GetLuidL( aParentLUID, mapping, (parentMapping == KAMDeliveredNodeName ? EDCSDelivered : ( parentMapping == KAMDownloadNodeName ? EDCSDownload : EDCSNone ) ) ) ) ; + if( !iluid && parentMapping == KAMDownloadNodeName ) + { + // This is added for avoiding duplicate node creation in Delivered/Download only. + iluid = GetLuidL( aParentLUID, mapping, EDCSDelivered ); + } + if ( iluid == 0 ) + { + // Not found, add it ... + DeliverOrDownloadL( mapping, aURI, cnt, parentMapping, status ); + } + else + { + RDEBUG_2( "CAmAdapter::AddNodeObjectL(): WARNING May Already exists '%d'", iluid ); + TDeploymentComponent comp ; + TInt err( SessionL().DeploymentComponent( iluid, comp ) ); + if ( err == KErrNone ) + { + RDEBUG_2( "CAmAdapter::AddNodeObjectL(): ERROR Already exists '%d'", iluid ); + if ( comp.iState == StateL( aURI ) ) + { + RDEBUG( "CAmAdapter::AddNodeObjectL(): (state is ok) " ); + } + else + { + RDEBUG( "CAmAdapter::AddNodeObjectL(): (state is NOK) " ); + } + status = EAlreadyExists; + } + else + { + if ( err == KErrNotFound ) + { + RDEBUG_2( "CAmAdapter::AddNodeObjectL(): WARNING Already exists but not found '%d'", iluid ); + DeliverOrDownloadL( mapping, aURI, cnt, parentMapping, status ); + } + else + { + + RDEBUG_2( "CAmAdapter::AddNodeObjectL(): ERROR May exists, but failed to fetch get one? '%d'", err ); + } + } + } + if ( status == EOk ) + { + if ( iInAtomic ) + { + iBuffer.Append( TAMCommandBufferElement( aStatusRef, aURI ) ); + } + } + + + + SetStatusL( aStatusRef, status ); + RDEBUG( "CAmAdapter::AddNodeObject(): end" ); + } + + + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::GetSizeL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +TInt CAmAdapter::GetSizeL( const TDeplCompAttrType aDataType, const TInt aLuid, TError &aRet ) + { + TInt size( 0 ); + if ( aDataType == EDCStateValue ) + { + TDeploymentComponent comp; + TInt err( SessionL().DeploymentComponent( aLuid, comp ) ); + if ( err == KErrNone ) + { + if ( comp.iState == EDCSActive ) + { + size = KAMStateValueActive().Length(); + } + else + { + size = KAMStateValueInactive().Length() ; + } + aRet = EOk; + } + } + else + { + size = SessionL().DeploymentComponentDataSizeL( aLuid, aDataType ); + aRet = EOk; + } + return size; + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef ) + { + + + + RDEBUG8_4("CAmAdapter::FetchLeafObjectSizeL('%S', '%S', '%S'): begin", &aURI, &aLUID, &aType ); + CheckStateChangesL(); + TError status( EError ); + CBufBase *currentList = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentList ); + + TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) ); + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); + TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + TInt size( 0 ); + HBufC8 *luid = NULL; + if ( aLUID != KNullDesC8 ) + { + luid = aLUID.AllocLC(); + } + else + { // try if we find it from download path + TBuf8<256> down; + down = KDownloadURI; + down.Append ( parentMapping ); + luid = Callback().GetLuidAllocL( down ); + CleanupStack::PushL( luid ); + if ( *luid != KNullDesC8 ) + { + // make it to found next time + DirectSetMappingL( parent, *luid ); + MoveAclL( down, parent ); + + // remove old + DirectSetMappingL( down, KNullDesC8 ); + } + } + TDeplCompAttrType dataType( UpdateFlagFromMapping( mapping ) ); + if ( *luid != KNullDesC8 ) + { + TUint32 iluid ( DesToIntL( *luid ) ); + RDEBUG_2( "CAmAdapter::FetchLeafObjectSizeL(): Luid is : %d", iluid ); + size = GetSizeL( dataType, iluid, status ); + } + else + { + TUint32 iluid( GetLeafLuidL( aURI, parentMapping ) ); + if ( iluid > 0 ) + { + HBufC8 *l = IntToDes8LC( iluid ); + DirectSetMappingL( parent, *l ); + CleanupStack::PopAndDestroy( l ); + size = GetSizeL( dataType, iluid, status ); + } + else + { + RDEBUG8_2( "CAmAdapter::FetchLeafObjectSizeL(): WARNING Faild to get luid allocation for '%S'", &parent ); + if ( aLUID == KNullDesC8 ) + { + status = ENotFound ; + } + } + } + SetStatusL( aStatusRef, status ); + if( status == EOk && size > 0 ) + { + HBufC8 *hsize = IntToDes8LC( size ); + currentList->InsertL( 0, *hsize ); + if ( iInAtomic ) + { + iBuffer.Append( TAMCommandBufferElement( aStatusRef, aURI ) ); + } + Callback().SetResultsL( aResultsRef, *currentList, aType ); + CleanupStack::PopAndDestroy( hsize ); + } + CleanupStack::PopAndDestroy( luid ); + CleanupStack::PopAndDestroy( currentList ); //currentList + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, + TInt /*aStatusRef*/ ) + { + RDEBUG("CAmAdapter::ExecuteCommandL(stream): begin (NOT SUPPORTED)"); + User::Leave( KErrNotSupported ); + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::CopyCommandL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, TInt aStatusRef ) + { + RDEBUG("CAmAdapter::CopyCommandL(): begin (NOT SUPPORTED)"); + SetStatusL( aStatusRef, EError ); + + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::StartAtomicL( ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::StartAtomicL() + { + RDEBUG("CAmAdapter::StartAtomicL(): begin (NOT properly SUPPORTED)"); + iInAtomic = ETrue ; + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::CommitAtomicL( ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::CommitAtomicL() + { + RDEBUG("CAmAdapter::CommitAtomicL(): begin (NOT SUPPORTED)"); + iInAtomic = EFalse ; // the initial statuses are already set + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::RollbackAtomicL( ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::RollbackAtomicL() + { + RDEBUG("CAmAdapter::RollbackAtomicL(): begin (NOT properly SUPPORTED)"); + TInt count( iBuffer.Count() ); + for ( TInt i( 0 ); i < count; i++ ) + { + TAMCommandBufferElement &pm( iBuffer[i] ); + SetStatusL( pm.iStatusRef, ERollbackFailed ); + } + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::StreamingSupport( ) +// ------------------------------------------------------------------------------------------------ +TBool CAmAdapter::StreamingSupport( TInt& aItemSize ) + { + RDEBUG("CAmAdapter::StreamingSupport(): begin"); + aItemSize = 1024; + RDEBUG("CAmAdapter::StreamingSupport(): end"); + return ETrue; + } + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::StreamCommittedL( ) +// ------------------------------------------------------------------------------------------------ +#ifdef __TARM_SYMBIAN_CONVERGENCY +void CAmAdapter::StreamCommittedL( RWriteStream& /*aStream*/ ) +#else +void CAmAdapter::StreamCommittedL() +#endif + { + RDEBUG("CAmAdapter::StreamCommittedL(): begin"); + + if(iStreamOpen) + { + iStream.CommitL(); + } + + MSmlDmAdapter::TError status = EOk; + + TRAPD( err, _UpdateLeafObjectL( *iStreamedURI, *iStreamedLuid, KNullDesC8(), *iStreamedType, iStatusRef, status ) ); + + if(err != KErrNone) + { + RDEBUG_2("CAmAdapter::StreamCommittedL(): _UpdateLeafObjectL returned error (%d)", err); + } + + iIsStreamedContent = EFalse; + iStreamOpen = EFalse; + + Callback().SetStatusL( iStatusRef, status ); + + RDEBUG("CAmAdapter::StreamCommittedL(): end"); + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::CloseStreaming( ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::CloseStreaming() +{ + if( iStreamOpen ) + { + RDEBUG("CAmAdapter::CloseStreaming(): closing"); + iStreamFile.Close(); // !!! Closing this will also close the iStreamRFs because it is adopted from server + iStreamOpen = EFalse; + } +} + + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::CompleteOutstandingCmdsL() +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::CompleteOutstandingCmdsL() + { + RDEBUG("CAmAdapter::CompleteOutstandingCmdsL(): begin"); +/* iManagement.Close(); + iSessionOpened = EFalse ;*/ + iBuffer.Reset(); + RDEBUG("CAmAdapter::CompleteOutstandingCmdsL(): Management session closed"); + } + + + +// ------------------ +// +// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +const TImplementationProxy ImplementationTable[] = + { + // + IMPLEMENTATION_PROXY_ENTRY( KAMAdapterImplUid, CAmAdapter::NewL ) + }; + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ +TInt CAmAdapter::DesToIntL( const TDesC8& aLuid ) + { + TLex8 lex( aLuid ); + TInt value = 0; + User::LeaveIfError( lex.Val( value ) ); + return value; + } + + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ +HBufC8* CAmAdapter::IntToDes8LC( const TInt aLuid ) + { + HBufC8* buf = HBufC8::NewLC( 10 ); //10 = max length of 32bit integer + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num( aLuid ); + return buf; + } + + + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::ConstructL() + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.ConnectL(); +#else + User::LeaveIfError( iDbSession.Connect()); +#endif + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::SetStatusL( TInt aStatusRef, MSmlDmAdapter::TError aErrorCode ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::SetStatusL( TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode ) + { + RDEBUG_3("CAmAdapter::SetStatusL( %d, %d )", aStatusRef, aErrorCode ); + Callback().SetStatusL( aStatusRef, aErrorCode ); + } + +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::SetResultsL( TInt aResultsRef, CBufBase& aObject, const TDesC8& aType ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::SetResultsL( TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType ) + { + Callback().SetResultsL( aResultsRef, aObject, aType ); + + } + +// ------------------------------------------------------------------------------------- +// CAmAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CAmAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat,const TDesC8& aDescription) + { + FillNodeInfoNoDefaultMimeL( aNode, aAccTypes, aOccurrence, aScope, aFormat, aDescription ); + if(aFormat!=MSmlDmDDFObject::ENode) + { + aNode.AddDFTypeMimeTypeL(KAMTextPlain); + } + + } + + +// ------------------------------------------------------------------------------------- +// CAmAdapter::FillNodeInfoNoDefaultMimeL() +// Fills the node info in ddf structure, without default mime type +// ------------------------------------------------------------------------------------- +void CAmAdapter::FillNodeInfoNoDefaultMimeL( 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); + + aNode.SetDescriptionL(aDescription); + } + +// ------------------------------------------------------------------------------------- +// CAmAdapter::CheckStateChangesInternalL() +// Updates the changed DC states to DM client mappings and ACLs +// ------------------------------------------------------------------------------------- +void CAmAdapter::CheckStateChangesInternalL() + { + + +#ifdef __AM_CHECKSTATE_CHANGES + RDEBUG( "CAmAdapter::CheckStateChangesLInternal(): begin" ); + if ( !iUpdated ) + { + RDEBUG( "CAmAdapter::CheckStateChangesLInternal(): !iUpdated" ); + RElementIdArray arr; + CleanupClosePushL( arr ); + TInt err( SessionL().StateChangingDCIdsL( arr ) ); + if ( err == KErrNone ) + { + TInt c( arr.Count() ); + for( TInt i( 0 ); i < c; i++ ) + { + TDeploymentComponent comp ; + err = iManagement.DeploymentComponent( arr[i], comp ); + if ( err == KErrNone ) + { + TDCUserId dc; + SessionL().DeploymentComponentUserIdL( arr[i], dc ); + const TInt KNSmlDmMaxUriLength = 256; + HBufC8 *uri = HBufC8::NewLC( KNSmlDmMaxUriLength ); + TPtr8 puri( uri->Des() ); +#ifdef __TARM_SYMBIAN_CONVERGENCY + RDmTreeNode uriNode; + CleanupClosePushL(uriNode); + + RBuf8 acl; + acl.CreateL(128); + CleanupClosePushL(acl); + + HBufC8 *newUri = HBufC8::NewLC( KNSmlDmMaxUriLength ); + TPtr8 pnewUri( newUri->Des() ); + + RDmTreeNode newUriNode; + CleanupClosePushL(newUriNode); +#else + CBufBase* acl = CBufFlat::NewL( 128 ); + CleanupStack::PushL( acl ); + + HBufC8 *newUri = HBufC8::NewLC( KNSmlDmMaxUriLength ); + TPtr8 pnewUri( newUri->Des() ); + +#endif + + switch ( comp.iOldState ) + { + case EDCSDelivered: + { + RDEBUG( "CAmAdapter::CheckStateChangesLInternal(): Old State = EDCSDelivered" ); + puri.Copy( KDeliveredURI() ); + puri.Append( dc ); + + HBufC8 *luid = DirectGetLuidAllocLC( puri ); + + if ( *luid == KNullDesC8 ) + { + // try if we find it from download path + puri.Zero(); + puri.Copy( KDownloadURI() ); + puri.Append( dc ); + luid = DirectGetLuidAllocLC( puri ); + } + + // check if the luid is still null + + if ( *luid != KNullDesC8 ) + { + // "Nullify" the old mapping + //DirectSetMappingL( puri, KNullDesC8 ); + DirectRemoveMappingL(puri); +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(puri, uriNode, RDmTree::EReadOnly); + uriNode.DmPropertyL( DevMan::EACL, acl ); +#else + err = iDbSession.GetAclL(puri, *acl, EFalse ); // no need for inherited +#endif + // Determine new uri + switch( comp.iState ) + { + case EDCSActive: + case EDCSInactive: // both have same node + { + pnewUri.Copy( KDeployedURI() ); + pnewUri.Append( dc ); + DirectSetMappingL( pnewUri, *luid ); + if ( err == KErrNone ) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(pnewUri, newUriNode, RDmTree::EReadOnly); + uriNode.RemoveDmPropertyL( DevMan::EACL ); + newUriNode.SetDmPropertyL( DevMan::EACL, acl ); +#else + err = iDbSession.DeleteAclL( puri ); + + err = iDbSession.UpdateAclL( pnewUri, acl->Ptr( 0 ) ); +#endif + } + else + { + RDEBUG_2("CAmAdapter::CheckStateChangesL: ERROR Failed to get acl from %d ", err ); + } + iManagement.StateChangeComplete( arr[i] ); + break; + } + default: + { + + RDEBUG_2("CAmAdapter::CheckStateChangesL: WARNING Illegal state change from delivered to %d ", comp.iState ); + + break; + } + } + } + else + { + // probably moved already + iManagement.StateChangeComplete( arr[i] ); + } + + CleanupStack::PopAndDestroy( luid ); + break; + } + case EDCSDownload: + { + RDEBUG( "CAmAdapter::CheckStateChangesLInternal(): Old State = EDCSDownload" ); + puri.Copy( KDownloadURI() ); + puri.Append( dc ); + HBufC8 *luid = DirectGetLuidAllocLC( puri ); //Callback().GetLuidAllocL( puri ); + //CleanupStack::PushL( luid ); + if ( *luid == KNullDesC8 ) + { // probably moved already + CleanupStack::PopAndDestroy( luid ); + puri.Copy( KDeliveredURI() ); + puri.Append( dc ); + luid = DirectGetLuidAllocLC( puri ); //Callback().GetLuidAllocL( puri ); + if ( *luid == KNullDesC8 ) + { // probably moved already + + iManagement.StateChangeComplete( arr[i] ); + + } + } + else + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(puri, uriNode, RDmTree::EReadOnly); + uriNode.DmPropertyL( DevMan::EACL, acl ); +#else + err = iDbSession.GetAclL(puri, *acl, EFalse ); // no need for inherited +#endif + // "Nullify" the old mapping + //DirectSetMappingL( puri, KNullDesC8 ); + DirectRemoveMappingL(puri); + switch( comp.iState ) + { + case EDCSActive: + case EDCSInactive: // both have same node + { + pnewUri.Copy( KDeployedURI() ); + pnewUri.Append( dc ); + DirectSetMappingL( pnewUri, *luid ); + if ( err == KErrNone ) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(pnewUri, newUriNode, RDmTree::EReadOnly); + uriNode.RemoveDmPropertyL( DevMan::EACL ); + newUriNode.SetDmPropertyL( DevMan::EACL, acl ); +#else + err = iDbSession.DeleteAclL( puri ); + err = iDbSession.UpdateAclL( pnewUri, acl->Ptr( 0 ) ); +#endif + } + else + { + RDEBUG_2("CAmAdapter::CheckStateChangesL: ERROR Failed to get acl from %d ", err ); + } + iManagement.StateChangeComplete( arr[i] ); + break; + } + case EDCSDelivered: + { + RDEBUG( "CAmAdapter::CheckStateChangesLInternal(): Current State = EDCSDelivered" ); + pnewUri.Copy( KDeliveredURI() ); + pnewUri.Append( dc ); + DirectSetMappingL( pnewUri, *luid ); + if ( err == KErrNone ) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(pnewUri, newUriNode, RDmTree::EReadOnly); + uriNode.RemoveDmPropertyL( DevMan::EACL ); + newUriNode.SetDmPropertyL( DevMan::EACL, acl ); +#else + + err = iDbSession.DeleteAclL( puri ); + err = iDbSession.UpdateAclL( pnewUri, acl->Ptr( 0 ) ); +#endif + } + else + { + RDEBUG_2("CAmAdapter::CheckStateChangesL: ERROR Failed to get acl from %d ", err ); + } + iManagement.StateChangeComplete( arr[i] ); + break; + } + default: + { + + RDEBUG_2("CAmAdapter::CheckStateChangesL: WARNING Illegal state change from delivered to %d ", comp.iState ); + break; + } + } + + } + CleanupStack::PopAndDestroy( luid ); + break; + } + case EDCSActive: + case EDCSInactive: // these both are in same node + { + if (comp.iState == EDCSDelete) + { + puri.Copy( KDeployedURI()); + puri.Append( dc ); + HBufC8 *bufLuid = DirectGetLuidAllocLC( puri ); + TUint32 luid = DesToIntL( *bufLuid ) ; + TRAPD(err,SessionL().RemoveL( luid )); + if ( err == KErrNone || err == KErrNotFound ) + {} + DirectRemoveMappingL(puri); + iManagement.StateChangeComplete( arr[i] ); + CleanupStack::PopAndDestroy(bufLuid); + RDEBUG("CAmAdapter::CheckStateChangesL:DirectRemoveMappingL for comp with istate EDCSDelete " ); + break; + } + RDEBUG_3("CAmAdapter::CheckStateChangesL: No need to move anything in change from %d to %d ", comp.iOldState, comp.iState ); + iManagement.StateChangeComplete( arr[i] ); + break; + } + } +#ifdef __TARM_SYMBIAN_CONVERGENCY + CleanupStack::PopAndDestroy( &newUriNode ); + CleanupStack::PopAndDestroy( newUri ); + CleanupStack::PopAndDestroy( &uriNode ); + CleanupStack::PopAndDestroy( &acl ); + CleanupStack::PopAndDestroy( uri ); +#else + CleanupStack::PopAndDestroy( newUri ); + CleanupStack::PopAndDestroy( acl ); + CleanupStack::PopAndDestroy( uri ); +#endif + } + else + { + RDEBUG_2("CAmAdapter::CheckStateChangesL: ERROR Failed to get component: %d ", err ); + } + } + iUpdated = ETrue; + } + else + { + RDEBUG_2("CAmAdapter::CheckStateChangesL: ERROR Failed to get state change dcs: %d ", err ); + } + CleanupStack::PopAndDestroy( &arr ); + } + else + { + RDEBUG("CAmAdapter::CheckStateChangesL: Already updated! "); + } + RDEBUG( "CAmAdapter::CheckStateChangesL(): end" ); +#else + DBG_ARGS8( "CAmAdapter::CheckStateChangesL(): disabled" ); +#endif + } + + +// ------------------------------------------------------------------------------------- +// CAmAdapter::CheckStateChangesL() +// Updates acl and mapping trees to match state changes +// ------------------------------------------------------------------------------------- +void CAmAdapter::CheckStateChangesL() + { + iCertRequired = EFalse ; + RDEBUG( "CAmAdapter::CheckStateChangesL(): iCertRequired = EFalse" ); + TRAPD( err, CheckStateChangesInternalL() ); + if ( err != KErrNone ) + { + RDEBUG_2("CAmAdapter::CheckStateChangesL(): warning failed to check state changes %d", err ); + } + iCertRequired = ETrue ; + RDEBUG( "CAmAdapter::CheckStateChangesL(): iCertRequired = ETrue" ); + if ( !iTrustAdded ) + { + RDEBUG( "CAmAdapter::CheckStateChangesL(): Adding Trust Closing Session" ); + iManagement.Close(); + iSessionOpened = EFalse; + RApplicationManagement &session = SessionL(); + RDEBUG( "CAmAdapter::CheckStateChangesL(): Adding Trust new session started" ); + } + } + + +// ------------------------------------------------------------------------------------- +// CAmAdapter::URISegsUpTo(const TDesC8& aURI, TInt aUpTo) +// ------------------------------------------------------------------------------------- +TPtrC8 CAmAdapter::URISegsUpTo( const TDesC8& aURI, TInt aUpTo, TBool aInclKeno/*=EFalse*/) + { + + + + TPtrC8 ret; + TInt numOfURISegs( 0 ); + for( TInt i( 0 ); i < aURI.Length() && ret.Ptr() == NULL; i++ ) + { + if( aURI[i] == KNSmlDMUriSeparator ) + { + numOfURISegs++; + if( aUpTo == numOfURISegs ) + { + if( aInclKeno && aURI.Length() > i+1) + { + ret.Set( aURI.Left( i + 1 ) ); + } + else + { + ret.Set( aURI.Left( i ) ); + } + } + } + } + return ret; + } + + +// ------------------------------------------------------------------------------------- +// CAmAdapter::DirectGetLuidAllocLC( const TDesC8 &aURI ) +// ------------------------------------------------------------------------------------- +HBufC8 *CAmAdapter::DirectGetLuidAllocLC( const TDesC8 &aURI ) + { + + +#ifdef __TARM_SYMBIAN_CONVERGENCY + HBufC8 *ret = Callback().GetLuidAllocL( aURI ); +#else + HBufC8* ret = iDbSession.GetLuidAllocL( KAMAdapterImplUid, aURI ); +#endif + + CleanupStack::PushL( ret ); + return ret; + } + + +// ------------------------------------------------------------------------------------- +// CAmAdapter::DirectSetMappingL( const TDesC8 &aURI, const TDesC8 &aLUID ) +// ------------------------------------------------------------------------------------- +TInt CAmAdapter::DirectSetMappingL( const TDesC8 &aURI, const TDesC8 &aLUID ) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TRAPD( err, Callback().SetMappingL( aURI, aLUID ) ); +#else + TInt err( iDbSession.AddMappingInfoL( KAMAdapterImplUid, aURI, aLUID ) ); +#endif + return err; + } + +// ------------------------------------------------------------------------------------- +// CAmAdapter::DirectRemoveMappingL( const TDesC8 &aURI ) +// ------------------------------------------------------------------------------------- +TInt CAmAdapter::DirectRemoveMappingL( const TDesC8 &aURI ) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TRAPD( err, Callback().SetMappingL( aURI, aLUID ) ); +#else + TInt err( iDbSession.RemoveMappingInfoL( KAMAdapterImplUid, aURI, ETrue ) ); +#endif + return err; + } + +// ------------------------------------------------------------------------------------- +// CAmAdapter::MoveAclL( const TDesC8 &aFrom, const TDesC8 &aTo ) +// ------------------------------------------------------------------------------------- +void CAmAdapter::MoveAclL( const TDesC8 &aFrom, const TDesC8 &aTo ) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + RDmTreeNode from; + CleanupClosePushL(from); + + RDmTreeNode to; + CleanupClosePushL(to); + + RBuf8 acl; + acl.CreateL(128); + CleanupClosePushL(acl); + + iDbSession.OpenNodeL(aFrom, from, RDmTree::EReadOnly); + TRAPD( err, from.DmPropertyL( DevMan::EACL, acl ) ); + if ( err == KErrNone ) + { + iDbSession.OpenNodeL(aTo, to, RDmTree::EReadOnly); + from.RemoveDmPropertyL( DevMan::EACL ); + to.SetDmPropertyL( DevMan::EACL, acl ); + } + CleanupStack::PopAndDestroy( 3, &from ); +#else + CBufBase *acl = CBufFlat::NewL( 128 ); + CleanupStack::PushL( acl ); + TInt err (iDbSession.GetAclL(aFrom, *acl, EFalse ) ); // no need for inherited + if ( err == KErrNone ) + { + err = iDbSession.DeleteAclL( aFrom ); + err = iDbSession.UpdateAclL( aTo, acl->Ptr( 0 ) ); + } + CleanupStack::PopAndDestroy( acl ); +#endif + } + + +// ------------------------------------------------------------------------------------- +// CAmAdapter::SetMappingL( const TDesC8 &aOriginalURI, +// const TDeploymentComponentState aTargetState, const TDesC8 &aLUID ) +// ------------------------------------------------------------------------------------- +void CAmAdapter::SetMappingL( const TDesC8 &aOriginalURI, + const TDeploymentComponentState aTargetState, const TDesC8 &aLUID ) + { + + + HBufC8 * targeturi = NULL; + SetMappingLC( aOriginalURI, aTargetState, aLUID, targeturi ); + CleanupStack::PopAndDestroy( targeturi ); + } + + +// ------------------------------------------------------------------------------------- +// CAmAdapter::SetMappingLC( const TDesC8 &aOriginalURI, +// const TDeploymentComponentState aTargetState, const TDesC8 &aLUID, +// HBufC8 *&aNewUri ) +// ------------------------------------------------------------------------------------- +void CAmAdapter::SetMappingLC( const TDesC8 &aOriginalURI, + const TDeploymentComponentState aTargetState, const TDesC8 &aLUID, HBufC8 *&aNewUri ) + { + + + // "Nullify" the mapping for argument + DirectSetMappingL( aOriginalURI, KNullDesC8 ); + + // Determine new uri for aArgument + TPtrC8 puri; + if ( aNewUri == NULL ) + { + TPtrC8 argMapping( NSmlDmURI::LastURISeg( aOriginalURI ) ); + TPtrC8 target; + if ( aTargetState == EDCSInactive || aTargetState == EDCSActive ) + { + target.Set( KDeployedURI() ); + } + else if ( aTargetState == EDCSDelivered ) + { + target.Set( KDeliveredURI() ); + } + else + { + + User::Leave( KErrArgument ); + } + + aNewUri = HBufC8::NewLC( target.Length() + argMapping.Length() ); + TPtr8 p( aNewUri->Des() ); + p.Copy( target ); + p.Append( argMapping ); + puri.Set( p ); + } + else + { + puri.Set( *aNewUri ); + } + DirectSetMappingL( puri, aLUID ); + MoveAclL( aOriginalURI, puri ); + } + + +#ifdef __AM_LASTERROR_NODE +// ------------------------------------------------------------------------------------------------ +// CAmAdapter::SetLastErrorL( const TDesC8& aLastError, const TInt aError ) +// ------------------------------------------------------------------------------------------------ +void CAmAdapter::SetLastErrorL( const TDesC8& aLastError, const TInt aError ) + { + if ( iLastError ) + { + TPtrC8 p(*iLastError); + RDEBUG8_2( "CAmAdapter::SetLastErrorL: clearing last error %S", &p); + delete iLastError; + iLastError = NULL; + } + iLastError = HBufC8::NewL( aLastError.Length() + 10); + iLastError->Des().Format( aLastError, aError ); + } + +const TDesC8& CAmAdapter::LastError() + { + return iLastError == NULL ? KNullDesC8() : *iLastError; + } + +#endif + +TPtrC8 CAmAdapter::LastURISeg(const TDesC8& aURI) + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMAMSeparatorDef) + { + break; + } + } + if(i==0) + { + return aURI; + } + else + { + return aURI.Mid(i+1); + } + } + +TInt CAmAdapter::DesToInt(const TDesC8& aLuid) + { + TLex8 lex(aLuid); + TInt value = 0; + lex.Val(value); + return value; + } +TInt CAmAdapter::GetAdapterValue() + { + TInt adapterValue; + CRepository *repository = NULL; + TRAPD( err, repository = CRepository::NewL ( KCRUidPrivateApplicationManagementKeys ) ); + if (err == KErrNone) + { + err = repository->Get(KAMAdapterValue, adapterValue); + } + delete repository; + repository = NULL; + return adapterValue; + } + +void CAmAdapter::SetAdapterValue(TInt aAdapterValue) + { + + CRepository *repository = NULL; + TRAPD( err, repository = CRepository::NewL ( KCRUidPrivateApplicationManagementKeys ) ); + if (err == KErrNone) + { + err = repository->Set(KAMAdapterValue, aAdapterValue); + } + delete repository; + repository = NULL; + } + +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/src/amadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/src/amadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,50 @@ +/* +* 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: +* Registery info for Application Management DM Adapter. +* +*/ + + +#include +#define KSmlDMInterfaceUid 0x102018B4 + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x10207844; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10207845; // SCM DM Adapter implementation UID + version_no = 1; + display_name = "Application Management DM Adapter"; + default_data = ""; +#ifdef __TARM_SYMBIAN_CONVERGENCY + opaque_data = "host=0x101F9A02"; +#else + opaque_data = ""; +#endif + } + }; + } + }; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/src/nsmldmiapmatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/src/nsmldmiapmatcher.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,235 @@ +/* +* 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 Tree module +* +*/ + + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ + +#include +#include "nsmldmiapmatcher.h" +#include +#include + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewL( MSmlDmCallback* aDmCallback ) +// ------------------------------------------------------------------------------------------------ +CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewL( + MSmlDmCallback* aDmCallback ) + { + CNSmlDMIAPMatcher* self = CNSmlDMIAPMatcher::NewLC( aDmCallback ); + CleanupStack::Pop(); + return self; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewLC( MSmlDmCallback* aDmCallback ) +// ------------------------------------------------------------------------------------------------ +CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewLC( + MSmlDmCallback* aDmCallback ) + { + CNSmlDMIAPMatcher* self = new( ELeave ) CNSmlDMIAPMatcher; + CleanupStack::PushL( self ); + self->ConstructL( aDmCallback ); + return self; + } + +// ------------------------------------------------------------------------------------------------ +// void CNSmlDMIAPMatcher::ConstructL( MSmlDmCallback* aDmCallback ) +// ------------------------------------------------------------------------------------------------ +void CNSmlDMIAPMatcher::ConstructL( MSmlDmCallback* aDmCallback ) + { + iCallback = aDmCallback; + FeatureManager::InitializeLibL(); + iFeatMgrInitialized = ETrue; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher::~CNSmlDMIAPMatcher() +// ------------------------------------------------------------------------------------------------ +CNSmlDMIAPMatcher::~CNSmlDMIAPMatcher() + { + if(iFeatMgrInitialized) + { + FeatureManager::UnInitializeLib(); + } + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlDMIAPMatcher::IAPIdFromURIL( const TDesC8& aURI ) +// ------------------------------------------------------------------------------------------------ +TInt CNSmlDMIAPMatcher::IAPIdFromURIL( const TDesC8& aURI ) + { + TInt iapId(KErrNotFound); + + MSmlDmAdapter::TError status; + CBufBase* allIAPs = CBufFlat::NewL(16); + CleanupStack::PushL(allIAPs); + iCallback->FetchLinkL( GetConRef(), *allIAPs, status ); + TPtrC8 uri = RemoveDotSlash(aURI); + + if( status == MSmlDmAdapter::EOk && + uri.Find(GetConRef()) == 0 && + allIAPs->Ptr(0).Find(LastURISeg(uri))>=0) + { + HBufC8* luid = iCallback->GetLuidAllocL( uri ); + + if ( luid->Length() ) + { + iapId = DesToInt(*luid); + } + delete luid; + } + + CleanupStack::PopAndDestroy(allIAPs); + + return iapId; + } + +// ------------------------------------------------------------------------------------------------ +// HBufC8* CNSmlDMIAPMatcher::URIFromIAPIdL( TInt aIAPId ) +// ------------------------------------------------------------------------------------------------ +HBufC8* CNSmlDMIAPMatcher::URIFromIAPIdL( TInt aIAPId ) + { + CBufBase *allIAPs = CBufFlat::NewL(16); + CleanupStack::PushL(allIAPs); + MSmlDmAdapter::TError status; + + iCallback->FetchLinkL( GetConRef(), *allIAPs, status ); + + if ( status == MSmlDmAdapter::EOk ) + { + TInt index(0); + TInt segStart(0); + + while ( index != KErrNotFound) + { + TPtrC8 allIAPsptr = allIAPs->Ptr(segStart).Mid(0); + index = allIAPsptr.Locate('/'); + HBufC8* uriSeg = 0; + + if ( index == KErrNotFound ) + { + TPtrC8 uriSeg8Ptr = allIAPs->Ptr(segStart); + uriSeg = uriSeg8Ptr.AllocLC(); + } + else + { + TPtrC8 uriSeg8Ptr = allIAPs->Ptr(segStart).Mid( 0, index ); + uriSeg = uriSeg8Ptr.AllocLC(); + } + + HBufC8* uri = HBufC8::NewLC( GetConRef().Length() + 1 + + uriSeg->Length() ); + + TPtr8 uriPtr = uri->Des(); + uriPtr.Format( GetConRef()); + uriPtr.Append( KNSmlDMSeparator8 ); + uriPtr.Append( *uriSeg ); + HBufC8* luid = iCallback->GetLuidAllocL( uriPtr ); + CleanupStack::PushL(luid); + + if ( luid->Length() > 0 ) + { + TInt iapId = DesToInt(luid->Des()); + if ( iapId == aIAPId ) + { + CleanupStack::PopAndDestroy(); //luid + CleanupStack::Pop(); //uri + CleanupStack::PopAndDestroy(2); //uriSeg, allIAPs + return uri; + } + } + CleanupStack::PopAndDestroy(3); // luid, uri, uriSeg + + segStart += index + 1; + } + } + + CleanupStack::PopAndDestroy(); // allIAPs + + return 0; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlDMIAPMatcher::DesToInt(const TDesC& aLuid) +// ------------------------------------------------------------------------------------------------ +TInt CNSmlDMIAPMatcher::DesToInt(const TDesC8& aLuid) const + { + TLex8 lex(aLuid); + TInt value = 0; + lex.Val(value); + return value; + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 CNSmlDMIAPMatcher::RemoveDotSlash(const TDesC8& aURI) const +// ------------------------------------------------------------------------------------------------ +TPtrC8 CNSmlDMIAPMatcher::RemoveDotSlash(const TDesC8& aURI) const + { + if(aURI.Find(KNSmlDMIAPUriDotSlash)==0) + { + return aURI.Right( aURI.Length()-KNSmlDMIAPUriDotSlash().Length() ); + } + else + { + return aURI; + } + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher::TPtrC8 LastURISeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ------------------------------------------------------------------------------------------------ +TPtrC8 CNSmlDMIAPMatcher::LastURISeg(const TDesC8& aURI) const + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMSlash) + { + break; + } + } + if(i==0) + { + return aURI; + } + else + { + return aURI.Mid(i+1); + } + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher::const TDesC8& GetConRef() +// Returns the connection reference +// ------------------------------------------------------------------------------------------------ +const TDesC8& CNSmlDMIAPMatcher::GetConRef() + { + if(FeatureManager::FeatureSupported(KFeatureIdFfDmConnmoAdapter)) + { + return KNSmlDMConnMOIAPUri(); + } + else + { + return KNSmlDMIAPUri(); + } + } + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/amadapter2/src/nsmldmuri.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/amadapter2/src/nsmldmuri.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,208 @@ +/* +* 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 Utilities +* +*/ + + +#include "nsmldmuri.h" + +// =========================================================================== +// NSmlDmURI +// =========================================================================== + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::ParentURI(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::ParentURI(const TDesC8& aURI) + { + TBool onlyOneSeg = ETrue; + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMUriSeparator) + { + onlyOneSeg = EFalse; + break; + } + } + if(onlyOneSeg) + { + return KNSmlDmRootUri(); + } + else + { + return aURI.Left(i); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::LastURISeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::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); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI) +// return uri without dot and slash in start +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI) + { + + TInt offset = 0; + TInt endSlash = 0; + + if(aURI.Find(KNSmlDmUriDotSlash)==0) + { + offset = 2; + } + else + { + return aURI; + } + + if(aURI.Length()>2&&aURI[aURI.Length()-1]==KNSmlDMUriSeparator) + { + endSlash = 1; + } + + return aURI.Mid(offset,aURI.Length()-endSlash-offset); + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI) +// removes property from the uri +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI) + { + TInt offset = aURI.Find(KNSmlDmQuestionMark); + if(offset!=KErrNotFound) + { + return aURI.Left(offset); + } + return aURI; + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveLastSeg(const TDesC8& aURI) +// Removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::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 NSmlDmURI::URISeg(const TDesC8& aURI,TInt aLocation) +// Returns the aLocation:th URI segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::URISeg(const TDesC8& aURI,TInt aLocation) + { + TInt begin=0; + TInt end; + TInt num=0; + + for(end=0;end const &) const + ?DeploymentComponent@RApplicationManagement@NApplicationManagement@@QBEHKAAUTDeploymentComponent@2@@Z @ 10 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponent(unsigned long, struct NApplicationManagement::TDeploymentComponent &) const + ?DeploymentComponentDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@AAVCBufBase@@@Z @ 11 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class CBufBase &) const + ?DeploymentComponentDataSizeL@RApplicationManagement@NApplicationManagement@@QBEHKABW4TDeplCompAttrType@2@@Z @ 12 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponentDataSizeL(unsigned long, enum NApplicationManagement::TDeplCompAttrType const &) const + ?DeploymentComponentIdsL@RApplicationManagement@NApplicationManagement@@QBEHAAV?$RArray@K@@W4TDeploymentComponentState@2@@Z @ 13 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponentIdsL(class RArray &, enum NApplicationManagement::TDeploymentComponentState) const + ?DeploymentComponentTempInstFileL@RApplicationManagement@NApplicationManagement@@QBEXKAAVRFile@@ABW4TDeplCompAttrType@2@@Z @ 14 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentTempInstFileL(unsigned long, class RFile &, enum NApplicationManagement::TDeplCompAttrType const &) const + ?DeploymentComponentUserIdL@RApplicationManagement@NApplicationManagement@@QBEXKAAV?$TBuf8@$0BAA@@@@Z @ 15 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentUserIdL(unsigned long, class TBuf8<256> &) const + ?DownloadL@RApplicationManagement@NApplicationManagement@@QBEKABV?$TBuf8@$0BAA@@@@Z @ 16 NONAME ; unsigned long NApplicationManagement::RApplicationManagement::DownloadL(class TBuf8<256> const &) const + ?GenericAlertSentL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 17 NONAME ; void NApplicationManagement::RApplicationManagement::GenericAlertSentL(unsigned long) const + ?GetFinalResultsForGAL@RApplicationManagement@NApplicationManagement@@QBEXKAAHAAVTDes8@@@Z @ 18 NONAME ; void NApplicationManagement::RApplicationManagement::GetFinalResultsForGAL(unsigned long, int &, class TDes8 &) const + ?InstallL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeploymentComponentState@2@@Z @ 19 NONAME ; void NApplicationManagement::RApplicationManagement::InstallL(unsigned long, enum NApplicationManagement::TDeploymentComponentState) const + ?PerformRfsL@RAppMgmtRfs@@QBEXXZ @ 20 NONAME ; void RAppMgmtRfs::PerformRfsL(void) const + ?RemoveL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 21 NONAME ; void NApplicationManagement::RApplicationManagement::RemoveL(unsigned long) const + ?StartDownloadL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDownloadTarget@2@@Z @ 22 NONAME ; void NApplicationManagement::RApplicationManagement::StartDownloadL(unsigned long, enum NApplicationManagement::TDownloadTarget) const + ?StateChangeComplete@RApplicationManagement@NApplicationManagement@@QBEHK@Z @ 23 NONAME ; int NApplicationManagement::RApplicationManagement::StateChangeComplete(unsigned long) const + ?StateChangingDCIdsL@RApplicationManagement@NApplicationManagement@@QBEHAAV?$RArray@K@@@Z @ 24 NONAME ; int NApplicationManagement::RApplicationManagement::StateChangingDCIdsL(class RArray &) const + ?UpdateDeploymentComponentDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@1@Z @ 25 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &, class TDesC8 const &) const + ?UpdateDeploymentComponentL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@@Z @ 26 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &) const + ?UpdateDeploymentComponentStreamedDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@@Z @ 27 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentStreamedDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &) const + ?UpdateL@RApplicationManagement@NApplicationManagement@@QBEXKK@Z @ 28 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateL(unsigned long, unsigned long) const + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/client/BWINS/applicationmanagementu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/client/BWINS/applicationmanagementu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,30 @@ +EXPORTS + ?ActivateL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 1 NONAME ; void NApplicationManagement::RApplicationManagement::ActivateL(unsigned long) const + ?RemoveL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 2 NONAME ; void NApplicationManagement::RApplicationManagement::RemoveL(unsigned long) const + ?DeploymentComponent@RApplicationManagement@NApplicationManagement@@QBEHKAAUTDeploymentComponent@2@@Z @ 3 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponent(unsigned long, struct NApplicationManagement::TDeploymentComponent &) const + ?DeploymentComponentTempInstFileL@RApplicationManagement@NApplicationManagement@@QBEXKAAVRFile@@ABW4TDeplCompAttrType@2@@Z @ 4 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentTempInstFileL(unsigned long, class RFile &, enum NApplicationManagement::TDeplCompAttrType const &) const + ?Close@RApplicationManagement@NApplicationManagement@@QAEXXZ @ 5 NONAME ; void NApplicationManagement::RApplicationManagement::Close(void) + ?DeploymentComponentUserIdL@RApplicationManagement@NApplicationManagement@@QBEXKAAV?$TBuf8@$0BAA@@@@Z @ 6 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentUserIdL(unsigned long, class TBuf8<256> &) const + ?DeploymentComponentDataSizeL@RApplicationManagement@NApplicationManagement@@QBEHKABW4TDeplCompAttrType@2@@Z @ 7 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponentDataSizeL(unsigned long, enum NApplicationManagement::TDeplCompAttrType const &) const + ?DeliverL@RApplicationManagement@NApplicationManagement@@QBEKABV?$TBuf8@$0BAA@@@@Z @ 8 NONAME ; unsigned long NApplicationManagement::RApplicationManagement::DeliverL(class TBuf8<256> const &) const + ?InstallL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeploymentComponentState@2@@Z @ 9 NONAME ; void NApplicationManagement::RApplicationManagement::InstallL(unsigned long, enum NApplicationManagement::TDeploymentComponentState) const + ?UpdateDeploymentComponentStreamedDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@@Z @ 10 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentStreamedDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &) const + ?Close@RAppMgmtRfs@@QAEXXZ @ 11 NONAME ; void RAppMgmtRfs::Close(void) + ?PerformRfsL@RAppMgmtRfs@@QBEXXZ @ 12 NONAME ; void RAppMgmtRfs::PerformRfsL(void) const + ?DeactivateL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 13 NONAME ; void NApplicationManagement::RApplicationManagement::DeactivateL(unsigned long) const + ?DeploymentComponentIdsL@RApplicationManagement@NApplicationManagement@@QBEHAAV?$RArray@K@@W4TDeploymentComponentState@2@@Z @ 14 NONAME ; int NApplicationManagement::RApplicationManagement::DeploymentComponentIdsL(class RArray &, enum NApplicationManagement::TDeploymentComponentState) const + ?DownloadL@RApplicationManagement@NApplicationManagement@@QBEKABV?$TBuf8@$0BAA@@@@Z @ 15 NONAME ; unsigned long NApplicationManagement::RApplicationManagement::DownloadL(class TBuf8<256> const &) const + ?Connect@RAppMgmtRfs@@QAEHXZ @ 16 NONAME ; int RAppMgmtRfs::Connect(void) + ?Connect@RApplicationManagement@NApplicationManagement@@QAEHXZ @ 17 NONAME ; int NApplicationManagement::RApplicationManagement::Connect(void) + ?DeploymentComponentDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@AAVCBufBase@@@Z @ 18 NONAME ; void NApplicationManagement::RApplicationManagement::DeploymentComponentDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class CBufBase &) const + ?StartDownloadL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDownloadTarget@2@@Z @ 19 NONAME ; void NApplicationManagement::RApplicationManagement::StartDownloadL(unsigned long, enum NApplicationManagement::TDownloadTarget) const + ?UpdateDeploymentComponentDataL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@1@Z @ 20 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentDataL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &, class TDesC8 const &) const + ?StateChangeComplete@RApplicationManagement@NApplicationManagement@@QBEHK@Z @ 21 NONAME ; int NApplicationManagement::RApplicationManagement::StateChangeComplete(unsigned long) const + ?Connect@RApplicationManagement@NApplicationManagement@@QAEHABVTCertInfo@@@Z @ 22 NONAME ; int NApplicationManagement::RApplicationManagement::Connect(class TCertInfo const &) + ?GenericAlertSentL@RApplicationManagement@NApplicationManagement@@QBEXK@Z @ 23 NONAME ; void NApplicationManagement::RApplicationManagement::GenericAlertSentL(unsigned long) const + ?CheckStatusNodesL@RApplicationManagement@NApplicationManagement@@QBEXXZ @ 24 NONAME ; void NApplicationManagement::RApplicationManagement::CheckStatusNodesL(void) const + ?GetFinalResultsForGAL@RApplicationManagement@NApplicationManagement@@QBEXKAAHAAVTDes8@@@Z @ 25 NONAME ; void NApplicationManagement::RApplicationManagement::GetFinalResultsForGAL(unsigned long, int &, class TDes8 &) const + ?UpdateDeploymentComponentL@RApplicationManagement@NApplicationManagement@@QBEXKW4TDeplCompAttrType@2@ABVTDesC8@@@Z @ 26 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateDeploymentComponentL(unsigned long, enum NApplicationManagement::TDeplCompAttrType, class TDesC8 const &) const + ?StateChangingDCIdsL@RApplicationManagement@NApplicationManagement@@QBEHAAV?$RArray@K@@@Z @ 27 NONAME ; int NApplicationManagement::RApplicationManagement::StateChangingDCIdsL(class RArray &) const + ?UpdateL@RApplicationManagement@NApplicationManagement@@QBEXKK@Z @ 28 NONAME ; void NApplicationManagement::RApplicationManagement::UpdateL(unsigned long, unsigned long) const + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/client/eabi/applicationmanagementclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/client/eabi/applicationmanagementclientu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,30 @@ +EXPORTS + _ZN11RAppMgmtRfs5CloseEv @ 1 NONAME + _ZN11RAppMgmtRfs7ConnectEv @ 2 NONAME + _ZN22NApplicationManagement22RApplicationManagement5CloseEv @ 3 NONAME + _ZN22NApplicationManagement22RApplicationManagement7ConnectERK9TCertInfo @ 4 NONAME + _ZN22NApplicationManagement22RApplicationManagement7ConnectEv @ 5 NONAME + _ZNK11RAppMgmtRfs11PerformRfsLEv @ 6 NONAME + _ZNK22NApplicationManagement22RApplicationManagement11DeactivateLEm @ 7 NONAME + _ZNK22NApplicationManagement22RApplicationManagement14StartDownloadLEmNS_15TDownloadTargetE @ 8 NONAME + _ZNK22NApplicationManagement22RApplicationManagement17CheckStatusNodesLEv @ 9 NONAME + _ZNK22NApplicationManagement22RApplicationManagement17GenericAlertSentLEm @ 10 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19DeploymentComponentEmRNS_20TDeploymentComponentE @ 11 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19StateChangeCompleteEm @ 12 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19StateChangingDCIdsLER6RArrayImE @ 13 NONAME + _ZNK22NApplicationManagement22RApplicationManagement21GetFinalResultsForGALEmRiR5TDes8 @ 14 NONAME + _ZNK22NApplicationManagement22RApplicationManagement23DeploymentComponentIdsLER6RArrayImENS_25TDeploymentComponentStateE @ 15 NONAME + _ZNK22NApplicationManagement22RApplicationManagement24DeploymentComponentDataLEmNS_17TDeplCompAttrTypeER8CBufBase @ 16 NONAME + _ZNK22NApplicationManagement22RApplicationManagement26DeploymentComponentUserIdLEmR5TBuf8ILi256EE @ 17 NONAME + _ZNK22NApplicationManagement22RApplicationManagement26UpdateDeploymentComponentLEmNS_17TDeplCompAttrTypeERK6TDesC8 @ 18 NONAME + _ZNK22NApplicationManagement22RApplicationManagement28DeploymentComponentDataSizeLEmRKNS_17TDeplCompAttrTypeE @ 19 NONAME + _ZNK22NApplicationManagement22RApplicationManagement30UpdateDeploymentComponentDataLEmNS_17TDeplCompAttrTypeERK6TDesC8S4_ @ 20 NONAME + _ZNK22NApplicationManagement22RApplicationManagement32DeploymentComponentTempInstFileLEmR5RFileRKNS_17TDeplCompAttrTypeE @ 21 NONAME + _ZNK22NApplicationManagement22RApplicationManagement38UpdateDeploymentComponentStreamedDataLEmNS_17TDeplCompAttrTypeERK6TDesC8 @ 22 NONAME + _ZNK22NApplicationManagement22RApplicationManagement7RemoveLEm @ 23 NONAME + _ZNK22NApplicationManagement22RApplicationManagement7UpdateLEmm @ 24 NONAME + _ZNK22NApplicationManagement22RApplicationManagement8DeliverLERK5TBuf8ILi256EE @ 25 NONAME + _ZNK22NApplicationManagement22RApplicationManagement8InstallLEmNS_25TDeploymentComponentStateE @ 26 NONAME + _ZNK22NApplicationManagement22RApplicationManagement9ActivateLEm @ 27 NONAME + _ZNK22NApplicationManagement22RApplicationManagement9DownloadLERK5TBuf8ILi256EE @ 28 NONAME + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/client/eabi/applicationmanagementu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/client/eabi/applicationmanagementu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,30 @@ +EXPORTS + _ZN11RAppMgmtRfs5CloseEv @ 1 NONAME + _ZN11RAppMgmtRfs7ConnectEv @ 2 NONAME + _ZN22NApplicationManagement22RApplicationManagement5CloseEv @ 3 NONAME + _ZN22NApplicationManagement22RApplicationManagement7ConnectERK9TCertInfo @ 4 NONAME + _ZN22NApplicationManagement22RApplicationManagement7ConnectEv @ 5 NONAME + _ZNK11RAppMgmtRfs11PerformRfsLEv @ 6 NONAME + _ZNK22NApplicationManagement22RApplicationManagement11DeactivateLEm @ 7 NONAME + _ZNK22NApplicationManagement22RApplicationManagement14StartDownloadLEmNS_15TDownloadTargetE @ 8 NONAME + _ZNK22NApplicationManagement22RApplicationManagement17CheckStatusNodesLEv @ 9 NONAME + _ZNK22NApplicationManagement22RApplicationManagement17GenericAlertSentLEm @ 10 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19DeploymentComponentEmRNS_20TDeploymentComponentE @ 11 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19StateChangeCompleteEm @ 12 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19StateChangingDCIdsLER6RArrayImE @ 13 NONAME + _ZNK22NApplicationManagement22RApplicationManagement21GetFinalResultsForGALEmRiR5TDes8 @ 14 NONAME + _ZNK22NApplicationManagement22RApplicationManagement23DeploymentComponentIdsLER6RArrayImENS_25TDeploymentComponentStateE @ 15 NONAME + _ZNK22NApplicationManagement22RApplicationManagement24DeploymentComponentDataLEmNS_17TDeplCompAttrTypeER8CBufBase @ 16 NONAME + _ZNK22NApplicationManagement22RApplicationManagement26DeploymentComponentUserIdLEmR5TBuf8ILi256EE @ 17 NONAME + _ZNK22NApplicationManagement22RApplicationManagement26UpdateDeploymentComponentLEmNS_17TDeplCompAttrTypeERK6TDesC8 @ 18 NONAME + _ZNK22NApplicationManagement22RApplicationManagement28DeploymentComponentDataSizeLEmRKNS_17TDeplCompAttrTypeE @ 19 NONAME + _ZNK22NApplicationManagement22RApplicationManagement30UpdateDeploymentComponentDataLEmNS_17TDeplCompAttrTypeERK6TDesC8S4_ @ 20 NONAME + _ZNK22NApplicationManagement22RApplicationManagement32DeploymentComponentTempInstFileLEmR5RFileRKNS_17TDeplCompAttrTypeE @ 21 NONAME + _ZNK22NApplicationManagement22RApplicationManagement38UpdateDeploymentComponentStreamedDataLEmNS_17TDeplCompAttrTypeERK6TDesC8 @ 22 NONAME + _ZNK22NApplicationManagement22RApplicationManagement7RemoveLEm @ 23 NONAME + _ZNK22NApplicationManagement22RApplicationManagement7UpdateLEmm @ 24 NONAME + _ZNK22NApplicationManagement22RApplicationManagement8DeliverLERK5TBuf8ILi256EE @ 25 NONAME + _ZNK22NApplicationManagement22RApplicationManagement8InstallLEmNS_25TDeploymentComponentStateE @ 26 NONAME + _ZNK22NApplicationManagement22RApplicationManagement9ActivateLEm @ 27 NONAME + _ZNK22NApplicationManagement22RApplicationManagement9DownloadLERK5TBuf8ILi256EE @ 28 NONAME + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/client/group/ApplicationManagementClient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/client/group/ApplicationManagementClient.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,50 @@ +/* +* 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: Implementation of applicationmanagement components +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include "defaultcaps.hrh" + +TARGET applicationmanagementclient.dll +TARGETTYPE dll +UID 0x1000008d 0x2001247C +#if 0 +CAPABILITY CAP_CLIENT_DLL -TCB -DRM WriteDeviceData +#endif +CAPABILITY CAP_CLIENT_DLL + +SOURCEPATH ../src +SOURCE ApplicationManagementClient.cpp + +USERINCLUDE . ../../inc +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY flogger.lib +LIBRARY efsrv.lib +LIBRARY apparc.lib +LIBRARY apgrfx.lib +LIBRARY avkon.lib +LIBRARY estor.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY centralrepository.lib + + +//SMPSAFE diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/client/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/client/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,21 @@ +/* +* 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 application management client & server +* +*/ + + +PRJ_MMPFILES + +ApplicationManagementClient.mmp diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/client/src/ApplicationManagementClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/client/src/ApplicationManagementClient.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,809 @@ +/* +* Copyright (c) 2000 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 Application Management Components +* +*/ + + + + +#include +#include "ApplicationManagementClientServer.h" +#include "ApplicationManagementClient.h" +#include "ApplicationManagementRfs.h" +#include "debug.h" +#include +#include +#include + +#include + +#include + +using namespace NApplicationManagement; + +// ---------------------------------------------------------------------------------------- +// Server startup code +// ---------------------------------------------------------------------------------------- + +static TInt StartServer() + { + RDEBUG("RApplicationManagement: Starting server..."); + + const TUidType serverUid(KNullUid, KNullUid, + KApplicationManagementServerUid); + + // EPOC and EKA 2 is easy, we just create a new server process. Simultaneous + // launching of two such processes should be detected when the second one + // attempts to create the server object, failing with KErrAlreadyExists. + RProcess server; + //TInt r=server.Create(KHelloWorldServerImg,KNullDesC,serverUid); + TInt r = server.Create(KApplicationManagementServerImg, KNullDesC); + if (r != KErrNone) + { + RDEBUG_2("ApplicationManagementClient: server start failed %d",r); + return r; + } + TRequestStatus stat; + server.Rendezvous(stat); + if (stat != KRequestPending) + server.Kill(0); // abort startup + else + server.Resume(); // logon OK - start the server + RDEBUG("ApplicationManagementClient: Started"); + User::WaitForRequest(stat); + TInt err = RProperty::Define(KProperty, KInteger, RProperty::EInt); + RProperty ServerLaunch; + ServerLaunch.Attach(KProperty, KInteger, EOwnerThread); + TRequestStatus status; + + ServerLaunch.Subscribe(status); + //server.Resume(); + User::WaitForRequest(status); + + ServerLaunch.Close(); + RProperty::Delete(KProperty, KInteger); + + //User::WaitForRequest(stat); // wait for start or death + // we can't use the 'exit reason' if the server panicked as this + // is the panic 'reason' and may be '0' which cannot be distinguished + // from KErrNone + r = (server.ExitType() == EExitPanic) ? KErrGeneral : stat.Int(); + // _LIT_SECURITY_POLICY_S0(KWritePolicy,KApplicationManagementServerUid.iUid); + // _LIT_SECURITY_POLICY_C1( KReadPolicy, ECapabilityReadDeviceData ); + + server.Close(); + return r; + } + + +EXPORT_C TInt RAppMgmtRfs::Connect() + { + TInt retry=2; + TVersion ver( KAMVerMajor, KAMVerMinor, KAMVerBuild ); + for (;;) + { + + TInt r=CreateSession(KApplicationManagementServerName,ver,1); + if (r!=KErrNotFound && r!=KErrServerTerminated) + return r; + if (--retry==0) + return r; + r=StartServer(); + if (r!=KErrNone && r!=KErrAlreadyExists) + { + return r; + } + } + } + + +EXPORT_C void RAppMgmtRfs::Close() + { + RSessionBase::Close(); //basecall + } + +// New methods +EXPORT_C void RAppMgmtRfs::PerformRfsL() const + { + User::LeaveIfError( SendReceive( EPerformRfs, TIpcArgs() ) ); + } + + + +// This is the standard retry pattern for server connection +EXPORT_C TInt RApplicationManagement::Connect( ) + { + TInt retry=2; + TVersion ver( KAMVerMajor, KAMVerMinor, KAMVerBuild ); + for (;;) + { + + TInt r=CreateSession(KApplicationManagementServerName,ver,1); + if (r!=KErrNotFound && r!=KErrServerTerminated) + return r; + if (--retry==0) + return r; + r=StartServer(); + if (r!=KErrNone && r!=KErrAlreadyExists) + { + return r; + } + } + } + +EXPORT_C TInt RApplicationManagement::Connect( const TCertInfo &aCertInfo ) + { + TInt r( Connect() ); + if ( r == KErrNone || r == KErrAlreadyExists ) + { + TPckg pkg( aCertInfo ); + r = SendReceive( EAddTrust, TIpcArgs( &pkg ) ); + } + return r; + } + + +EXPORT_C void RApplicationManagement::Close() + { + RSessionBase::Close(); //basecall + } + + + +EXPORT_C TUint32 RApplicationManagement::DeliverL( const TDCUserId &aUserId ) const + { + TDeploymentComponent aInfo( KNullDesC8(), KNullDesC8(), KNullDesC8(), EDCSNone ); + TDeploymentComponentIPC pkg( aInfo, KNullDesC8(), aUserId ); + + TPckg pinfo(pkg); + TUint32 id = 0; + TPckg< TUint32 > pid( id ); + const TDesC8& empty = KNullDesC8(); + + TInt err( SendReceive( EDeplCompDeliverStartOperation2, TIpcArgs( &pinfo, &empty, &pid) ) ); + if ( err == KErrNone ) + { + RDEBUG_2( "ApplicationManagementServer: DeliverL start SUCCESS id: %d", id ); + //TPckg pinfo2(aInfo); + + err = SendReceive( EDeplCompDeliverCompleteOperation, TIpcArgs( &pid, &empty, &empty )); + + if ( err == KErrNone ) + { + RDEBUG_2( "ApplicationManagementServer: DeliverL complete SUCCESS id: %d", id ); + err = id; + } + else + { + RDEBUG_2( "ApplicationManagementServer: DeliverL failed2... %d", err); + } + } + else + { + RDEBUG_2("ApplicationManagementServer: DeliverL failed1... %d", err); + } + User::LeaveIfError( err ); + return err; + } + + + +EXPORT_C TInt RApplicationManagement::DeploymentComponent( + TUint32 aInternalId, TDeploymentComponent &aReturnValue ) const + { + TPckg pinfo(aReturnValue); + TPckg< TUint32 > pid( aInternalId ); + TInt err( SendReceive( EDeplCompGetOperation, TIpcArgs( &pid, &pinfo) ) ); + if ( err == KErrNone ) + { + RDEBUG_2( "RApplicationManagement: DeploymentComponent start SUCCESS id: %d", aInternalId ); + } + else + { + RDEBUG_2("RApplicationManagement: DeploymentComponent failed... %d", err); + } + + return err; + } + + +EXPORT_C void RApplicationManagement::DeploymentComponentUserIdL( + TUint32 aInternalId, TDCUserId &aResponse ) const + { + + TPckgC< TUint32 > pid( aInternalId ); + TInt err( SendReceive( EDeplCompGetUserIdOperation, TIpcArgs( &pid, &aResponse) ) ); + if ( err == KErrNone ) + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentUserIdL SUCCESS id: %d", aInternalId ); + } + else + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentUserIdL failed... %d", err); + } + + User::LeaveIfError( err ); + } + + +/** +* @param aInternalId Id of the component to be found +* @param aBuffer a buffer to store results +* @return KErrNone Symbian error code +*/ +EXPORT_C void RApplicationManagement::DeploymentComponentDataL( + TUint32 aInternalId, TDeplCompAttrType aDataType, CBufBase &aBuffer ) const + { + //aBuffer.ResizeL( + TPckg< TUint32 > pid( aInternalId ); + TPckg< TDeplCompAttrType > pdt( aDataType ); + TInt length( 0 ); + TPckg< TInt > plen( length ); + aBuffer.Reset(); + TInt err( KErrNone) ; + if ( aDataType == EDCInstallOptions + || aDataType == EDCMetaData + || aDataType == EDCData + || aDataType == EDCDataMime + || aDataType == EDCMetaDataMime + || aDataType == EDCDownloadURI ) + { + err = SendReceive( EDeplCompGetDataLengthOperation, TIpcArgs( &pid, &pdt, &plen) ) ; + if ( err == KErrNone ) + { + + } + else + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentDataL EDeplCompGetDataLengthOperation ERROR failed to get length... %d", err ); + } + } + else if ( aDataType == EDCStatus) + { + length = 0; // to make sure we don't fetch it twice + TPckgBuf ptr; + err = SendReceive( EDeplCompGetDataOperation, TIpcArgs( &pid, &pdt, &ptr ) ); + if ( err == KErrNone ) + { + TBuf8<10> b; + b.AppendNum( ptr() ); + aBuffer.InsertL( 0, b ); + RDEBUG( "RApplicationManagement: DeploymentComponentDataL EDCDownloadStatus SUCCESS!" ); + } + else + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentDataL EDCDownloadStatus ERROR failed... %d", err ); + } + } + else if ( aDataType == EDCConRef ) + { + length = 0; // to make sure we don't fetch it twice + TPckgBuf ptr; + err = SendReceive( EDeplCompGetDataOperation, TIpcArgs( &pid, &pdt, &ptr ) ); + if ( err == KErrNone ) + { + aBuffer.InsertL( 0, ptr ); + RDEBUG( "RApplicationManagement: DeploymentComponentDataL EDCConRef SUCCESS!" ); + } + else + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentDataL EDCConRefERROR failed... %d" , err ); + } + } + else + { + User::Leave( KErrArgument ); + } + if ( length > 0 ) + { + HBufC8 *buf = HBufC8::NewLC( length ); + TPtr8 ptr( buf->Des() ); + err = SendReceive( EDeplCompGetDataOperation, TIpcArgs( &pid, &pdt, &ptr ) ); + if ( err == KErrNone ) + { + aBuffer.InsertL( 0, ptr ); + RDEBUG( "RApplicationManagement: DeploymentComponentDataL EDeplCompGetDataOperation SUCCESS!" ); + } + else + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentDataL EDeplCompGetDataOperationERROR failed... %d", err ); + } + CleanupStack::PopAndDestroy( buf ); + } + else + { + RDEBUG( "RApplicationManagement: DeploymentComponentDataL: Length is zero" ); + } + User::LeaveIfError( err ); + } + + +EXPORT_C TInt RApplicationManagement::DeploymentComponentIdsL( + RElementIdArray &aArray, const TDeploymentComponentState aState ) const + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentIds aState=%d!", aState ); + TInt count = 0; + TPckg cnt(count); + TPckg pk(aState); + TInt err( SendReceive( EDeplCompCountOperation, TIpcArgs( &cnt, &pk ) ) ); + RDEBUG_2( "RApplicationManagement: DeploymentComponentIds : Count is %d", count ); + if ( err == KErrNone ) + { + if ( count > 0 ) + { + aArray.Reset(); + for ( TInt i( 0 ); i != count; ++i ) + { + aArray.AppendL( 0 ); + } + TPtr8 p( reinterpret_cast< TUint8* >( &aArray[0] ), 0, count * sizeof( TUint32 ) ); + err = SendReceive( EDeplCompIdsOperation, TIpcArgs( &p, &pk ) ) ; + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: DeploymentComponentIds SUCCESS!" ); + } + else + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentIds failed... %d", err ); + } + } + } + else + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentIds failed to get count... %d", err); + } + return err; + } + +/** +* InstallL Installs given deployment component. +* @param aDeploymentComponent The deployment component to be installed +* @param aTargetState Will the installed component be actibve or inactive (default active) +* @return KErrNone Symbian error code +*/ +EXPORT_C void RApplicationManagement::InstallL( TUint32 aInternalId, + TDeploymentComponentState aTargetState ) const + { + TPckg id(aInternalId); + if ( aTargetState != EDCSActive && aTargetState != EDCSInactive ) + { + // install only to either of above states + User::Leave( KErrArgument ); + } + TPckg pk( aTargetState ); + + TInt err( SendReceive( EInstallOperation, TIpcArgs( &id, &pk ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: InstallL SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: InstallL failed... %d", err); + if( err == KErrNotFound ) + { + err = KErrArgument ; // indicates that data was not filled... + } + } + User::LeaveIfError( err ) ; + } + +EXPORT_C void RApplicationManagement::UpdateDeploymentComponentDataL( + TUint32 aInternalId, TDeplCompAttrType aItem, const TDesC8 &aItemData, const TDesC8 &aDataMime ) const + { + TDeplCompDataIPC ipc ; + ipc.iDataMime = aDataMime; + ipc.iInternalId = aInternalId ; + ipc.iAttrType = aItem ; + TPckg pipc( ipc ); + + TInt err( SendReceive( EDeplCompUpdateDataOperation, TIpcArgs( &pipc, &aItemData ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: UpdateDeploymentComponentDataL SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: UpdateDeploymentComponentDataL failed... %d", err); + } + User::LeaveIfError( err ); + } + +EXPORT_C void RApplicationManagement::UpdateDeploymentComponentStreamedDataL( + TUint32 aInternalId, TDeplCompAttrType aItem, const TDesC8 &aDataMime ) const + { + TDeplCompDataIPC ipc ; + ipc.iDataMime = aDataMime; + ipc.iInternalId = aInternalId ; + ipc.iAttrType = aItem ; + TPckg pipc( ipc ); + + TInt err( SendReceive( EDeplCompUpdateStreamedDataOperation, TIpcArgs( &pipc ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: UpdateDeploymentComponentStreamedDataL SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: UpdateDeploymentComponentStreamedDataL failed... %d", err); + } + User::LeaveIfError( err ); + } + + +EXPORT_C void RApplicationManagement::UpdateDeploymentComponentL( + TUint32 aInternalId, TDeplCompAttrType aItem, const TDesC8 &aItemData ) const + { + TPckg id(aInternalId); + TPckg itemid(aItem); + + TInt err( SendReceive( EDeplCompAttrUpdateOperation, TIpcArgs( &id, &itemid, &aItemData ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: UpdateDeploymentComponentL SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: UpdateDeploymentComponentL failed... %d", err); + } + User::LeaveIfError( err ); + } + + +/** +* RemoveL Removes given deployment component. +* @param aInternalId Id of the component to be removed +* @return KErrNone Symbian error code +*/ +EXPORT_C void RApplicationManagement::RemoveL( TUint32 aInternalId ) const + { + TPckg< TUint32 > id( aInternalId ); + RDEBUG_2( "RApplicationManagement: RemoveL %d!" , aInternalId ); + + TInt err( SendReceive( EDeplCompRemoveOperation, TIpcArgs( &id ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: RemoveL SUCCESS!" ); + } + else if ( err == KErrNotFound ) + { + RDEBUG( "RApplicationManagement: RemoveL WARNING Component already missing!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: RemoveL failed... %d", err); + User::LeaveIfError( err ); + } + } + + +/** + * StartDownloadL Starts download of deployment component. + * @param aInternalId The id of the component to be downloaded + * @return + */ +EXPORT_C void RApplicationManagement::StartDownloadL( TUint32 aInternalId, + const TDownloadTarget aTarget ) const + { + TPckg< TUint32 > id( aInternalId ); + RDEBUG_2( "RApplicationManagement: StartDownloadL %d!", aInternalId ); + TPckg< TDownloadTarget > trg( aTarget ); + TInt err( SendReceive( EDeplCompStartDownloadOperation, TIpcArgs( &id, &trg ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: StartDownloadL SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: StartDownloadL failed... %d", err); + } + User::LeaveIfError( err ); + } + + +EXPORT_C TUint32 RApplicationManagement::DownloadL( const TDCUserId &aUserId ) const + { + TUint32 id( 0 ) ; + TPckg< TUint32 > pid( id ); + + TInt err( SendReceive( EDeplCompDownloadOperation, TIpcArgs( &pid, &aUserId ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: DownloadL SUCCESS!" ); + err = pid() ; + } + else + { + RDEBUG_2("ApplicationManagementServer: DownloadL failed... %d", err); + } + return err ; + } + +EXPORT_C void RApplicationManagement::UpdateL( TUint32 aSourceInternalId, TUint32 aTargetInternalId ) const + { + TPckg< TUint32 > sid( aSourceInternalId ); + TPckg< TUint32 > tid( aTargetInternalId ); + + TInt err( SendReceive( EDeplCompUpdateOperation, TIpcArgs( &sid, &tid ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: UpdateL SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: UpdateL failed... %d", err); + } + User::LeaveIfError( err ); + } + + + +EXPORT_C TInt RApplicationManagement::StateChangingDCIdsL( RElementIdArray &aArray ) const + { + RDEBUG( "RApplicationManagement: StateChangingDCIds " ); + TInt count( 0 ) ; + TPckg cnt(count); + TInt err( SendReceive( EGetStateChangingIdsCountOperation, TIpcArgs( &cnt ) ) ); + if ( err == KErrNone ) + { + aArray.Reset(); + if ( count > 0 ) + { + for ( TInt i( 0 ); i != count; ++i ) + { + aArray.AppendL( 0 ); + } + TPtr8 p( reinterpret_cast< TUint8* >( &aArray[0] ), 0, count * sizeof( TUint32 ) ); + err = SendReceive( EGetStateChangingIdsOperation, TIpcArgs( &p ) ) ; + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: StateChangingDCIds SUCCESS!" ); + } + else + { + RDEBUG_2( "RApplicationManagement: StateChangingDCIds failed... %d" , err ); + } + } + else + { + RDEBUG_2("RApplicationManagement: StateChangingDCIds SUCCESS zero dcs... %d", count); + } + } + else + { + RDEBUG_2("RApplicationManagement: StateChangingDCIds failed... %d", err); + } + return err; + } + + +EXPORT_C TInt RApplicationManagement::StateChangeComplete( TUint32 aInternalId ) const + { + TPckg id(aInternalId); + + TInt err( SendReceive( ECompleteStateChangeOperation, TIpcArgs( &id ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: StateChangeComplete SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: StateChangeComplete failed... %d", err); + if( err == KErrNotFound ) + { + err = KErrArgument ; // indicates that data was not filled... + } + } + return ( err ) ; + } + + +/** +* ActivateL Tries to activate given deployment component +* +* @param aInternalId The id of the component to be activated +*/ +EXPORT_C void RApplicationManagement::ActivateL( TUint32 aInternalId ) const + { + TPckg< TUint32 > id( aInternalId ); + RDEBUG_2( "RApplicationManagement: ActivateL %d!" , aInternalId ); + + TInt err( SendReceive( EDeplCompActivateOperation, TIpcArgs( &id ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: ActivateL SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: ActivateL failed... %d", err); + } + User::LeaveIfError( err ); + } + +/** +* DeactivateL Tries to deactivate given deployment component +* +* @param aInternalId The id of the component to be deactivated +*/ +EXPORT_C void RApplicationManagement::DeactivateL( TUint32 aInternalId ) const + { + TPckg< TUint32 > id( aInternalId ); + RDEBUG_2( "RApplicationManagement: DeactivateL %d!", aInternalId ); + + TInt err( SendReceive( EDeplCompDeactivateOperation, TIpcArgs( &id ) ) ); + if ( err == KErrNone ) + { + RDEBUG( "RApplicationManagement: DeactivateL SUCCESS!" ); + } + else + { + RDEBUG_2("ApplicationManagementServer: DeactivateL failed... %d", err); + } + User::LeaveIfError( err ); + } + + +/** +* DeploymentComponentDataSizeL Get deployment component attribute size +* +* @param aInternalId The id of the component +* @param aItem The type of attribute whose size is to be got +* @return The size +*/ +EXPORT_C TInt RApplicationManagement::DeploymentComponentDataSizeL( TUint32 aInternalId, const TDeplCompAttrType &aDataType ) const + { + TPckg< TUint32 > pid( aInternalId ); + TPckg< TDeplCompAttrType > pdt( aDataType ); + TInt length( 0 ); + TPckg< TInt > plen( length ); + TInt err( KErrNone) ; + if ( aDataType == EDCInstallOptions + || aDataType == EDCMetaData + || aDataType == EDCData + || aDataType == EDCDownloadURI ) + { + err = SendReceive( EDeplCompGetDataLengthOperation, TIpcArgs( &pid, &pdt, &plen) ) ; + if ( err == KErrNone ) + { + + } + } + else if ( aDataType == EDCStatus ) + { + length = 0; + TPckgBuf ptr; + err = SendReceive( EDeplCompGetDataOperation, TIpcArgs( &pid, &pdt, &ptr ) ); + if ( err == KErrNone ) + { + TBuf8<10> b; + b.AppendNum( ptr() ); + length = b.Length(); + RDEBUG( "RApplicationManagement: DeploymentComponentDataSizeL elseif SUCCESS!" ); + } + else + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentDataSizeL ERROR failed... %d", err ); + } + } + else + { + TPckgBuf pinfo; + TPckg< TUint32 > pid( aInternalId ); + err = SendReceive( EDeplCompGetOperation, TIpcArgs( &pid, &pinfo) ); + if ( err == KErrNone ) + { + RDEBUG_2( "RApplicationManagement: DeploymentComponentDataSizeL else SUCCESS id: %d", aInternalId ); + switch ( aDataType ) + { + case EDCId: + { + length = pinfo().iId.Length(); + break; + } + case EDCName: + { + length = pinfo().iName.Length(); + break; + } + case EDCVersion: + { + length = pinfo().iVersion.Length(); + break; + } + default: + { + break; + } + } + } + else + { + RDEBUG_2("RApplicationManagement: DeploymentComponentDataSizeL failed... %d", err); + } + } + + RDEBUG_2("RApplicationManagement: DeploymentComponentDataSizeL returning... %d", length); + + return length; + } + +/** +* DeploymentComponentTempInstFileL ask file handle from server to be used +* +* @param aInternalId The id of the component +* @param aTempFile temporary file handle +* @param aItem The type of attribute whose type of temporary file to get +* @return KErrNone Symbian error code +*/ +EXPORT_C void RApplicationManagement::DeploymentComponentTempInstFileL( TUint32 aInternalId, RFile& aTempFile, const TDeplCompAttrType &aItem ) const + { + RDEBUG_3( "RApplicationManagement: DeploymentComponentTempInstFileL: Id (%d) AttrType (%d)", aInternalId, aItem ); + TPckg id(aInternalId); + TPckg itemid(aItem); + TPckgBuf filehandle; + + TInt fshandle = SendReceive(EDeplCompGetTemporaryInstFile, TIpcArgs( &id, &itemid, &filehandle ) ); + TInt err = aTempFile.AdoptFromServer( fshandle, filehandle() ) ; + User::LeaveIfError( err ); + RDEBUG_2( "RApplicationManagement: DeploymentComponentTempInstFileL fshandle (%d)", fshandle ); + } + +/** +* GetFinalResultsForGAL ask results from AM Server. In response AM +* server returns final result and target URI of node +* +* @param aInternalId The id of the component +* @param aFinalResult Final result of deployment component +* @param aTargetURI Target URI of deployment component +* @return void +*/ + +EXPORT_C void RApplicationManagement::GetFinalResultsForGAL(TUint32 aInternalId, TInt& aFinalResult, TDes8& aTargetURI) const +{ + TPckg internalid(aInternalId); + TPckg finalresult(aFinalResult); + TPckg targeturi(aTargetURI); + + TInt err = SendReceive(EDeplCompGetFinalResultForGA, TIpcArgs( &internalid, &finalresult, &aTargetURI) ); +} + +EXPORT_C void RApplicationManagement::GenericAlertSentL(TUint32 aInternalId) const +{ + + TPckg internalid(aInternalId); + + + TInt err = SendReceive(EDeplCompGenericAlertSent, TIpcArgs( &internalid) ); +} + +/** +* Implementation of Service UID() from base class. Returns AM service UID +* to framework +* +* @return uid of AM service UID +*/ +EXPORT_C void RApplicationManagement::CheckStatusNodesL( ) const + { + User::LeaveIfError( SendReceive( ECheckStatusNodes, TIpcArgs() ) ); + } + +TUid RApplicationManagement::ServiceUid() const + { + + + return TUid::Uid( KAMServiceUid); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/conf/application_management.confml Binary file applicationmanagement/conf/application_management.confml has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/conf/application_management_200267FB.crml Binary file applicationmanagement/conf/application_management_200267FB.crml has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/eabi/ApplicationManagementu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/eabi/ApplicationManagementu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ +EXPORTS + _ZN11RAppMgmtRfs5CloseEv @ 1 NONAME + _ZN11RAppMgmtRfs7ConnectEv @ 2 NONAME + _ZN22NApplicationManagement22RApplicationManagement5CloseEv @ 3 NONAME + _ZN22NApplicationManagement22RApplicationManagement7ConnectERK9TCertInfo @ 4 NONAME + _ZN22NApplicationManagement22RApplicationManagement7ConnectEv @ 5 NONAME + _ZNK11RAppMgmtRfs11PerformRfsLEv @ 6 NONAME + _ZNK22NApplicationManagement22RApplicationManagement11DeactivateLEm @ 7 NONAME + _ZNK22NApplicationManagement22RApplicationManagement14StartDownloadLEmNS_15TDownloadTargetE @ 8 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19DeploymentComponentEmRNS_20TDeploymentComponentE @ 9 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19StateChangeCompleteEm @ 10 NONAME + _ZNK22NApplicationManagement22RApplicationManagement19StateChangingDCIdsLER6RArrayImE @ 11 NONAME + _ZNK22NApplicationManagement22RApplicationManagement23DeploymentComponentIdsLER6RArrayImENS_25TDeploymentComponentStateE @ 12 NONAME + _ZNK22NApplicationManagement22RApplicationManagement24DeploymentComponentDataLEmNS_17TDeplCompAttrTypeER8CBufBase @ 13 NONAME + _ZNK22NApplicationManagement22RApplicationManagement26DeploymentComponentUserIdLEmR5TBuf8ILi256EE @ 14 NONAME + _ZNK22NApplicationManagement22RApplicationManagement26UpdateDeploymentComponentLEmNS_17TDeplCompAttrTypeERK6TDesC8 @ 15 NONAME + _ZNK22NApplicationManagement22RApplicationManagement28DeploymentComponentDataSizeLEmRKNS_17TDeplCompAttrTypeE @ 16 NONAME + _ZNK22NApplicationManagement22RApplicationManagement30UpdateDeploymentComponentDataLEmNS_17TDeplCompAttrTypeERK6TDesC8S4_ @ 17 NONAME + _ZNK22NApplicationManagement22RApplicationManagement7RemoveLEm @ 18 NONAME + _ZNK22NApplicationManagement22RApplicationManagement7UpdateLEmm @ 19 NONAME + _ZNK22NApplicationManagement22RApplicationManagement8DeliverLERK5TBuf8ILi256EE @ 20 NONAME + _ZNK22NApplicationManagement22RApplicationManagement8InstallLEmNS_25TDeploymentComponentStateE @ 21 NONAME + _ZNK22NApplicationManagement22RApplicationManagement9ActivateLEm @ 22 NONAME + _ZNK22NApplicationManagement22RApplicationManagement9DownloadLERK5TBuf8ILi256EE @ 23 NONAME + _ZNK22NApplicationManagement22RApplicationManagement31DeploymentComponentTempInstFileEmR5RFileRKNS_17TDeplCompAttrTypeE @ 24 NONAME + _ZNK22NApplicationManagement22RApplicationManagement38UpdateDeploymentComponentStreamedDataLEmNS_17TDeplCompAttrTypeERK6TDesC8 @ 25 NONAME + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,39 @@ +/* +* 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 application management client & server +* +*/ + + + +#include + +PRJ_EXPORTS +//../rom/1020781c.txt /epoc32/data/Z/private/10202be9/1020781c.txt +//../rom/1020781c.txt /epoc32/RELEASE/winscw/UDEB/z/private/10202be9/1020781c.txt +//../rom/1020781c.txt /epoc32/RELEASE/winscw/UREL/z/private/10202be9/1020781c.txt + +../rom/appmgmt.iby CORE_APP_LAYER_IBY_EXPORT_PATH(appmgmt.iby) +// Generic configuration interface for component cenrep settings +../conf/application_management.confml APP_LAYER_CONFML(application_management.confml) +../conf/application_management_200267FB.crml APP_LAYER_CRML(application_management_200267FB.crml) + +PRJ_MMPFILES + +#include "../options/group/bld.inf" +#include "../client/group/bld.inf" +//#include "../server/bld.inf" +//#include "../RfsPlugin/group/bld.inf" +#include "../amadapter2/group/bld.inf" +#include "../omascomoadapter/group/bld.inf" diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/inc/ApplicationManagementClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/inc/ApplicationManagementClient.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,304 @@ +/* +* Copyright (c) 2000 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 applicationmanagement components +* +*/ + + +#ifndef __APPLICATIONMANAGEMENTCLIENT_H__ +#define __APPLICATIONMANAGEMENTCLIENT_H__ + +// INCLUDES + +#include +#include "ApplicationManagementCommon.h" +#include "ApplicationManagementClientServer.h" +#include "ApplicationManagementConst.h" +#include +#include +//#include +typedef RArray RElementIdArray; + +namespace NApplicationManagement + { + +// CLASS DECLARATION + +/** +* RApplicationManagement class to establish ApplicationManagement server connection +*/ +class RAMTC : public RSessionBase + { + public: + /** + * Connect Connects client side to application management server + * @return KErrNone Symbian error code + */ + IMPORT_C TInt Connect(); + + + /** + * Close Close server connection + */ + IMPORT_C void Close(); + + /** + * GetApplicationUidL finds uid for given deployment component. + * @param aInternalId Id of the deployment component, whose uid is wished + * @param aUid After successful call, will hold the uid + */ + IMPORT_C void GetApplicationUidL( TInt aInternalId, TUid &aUid ); + }; + + + +class RApplicationManagement : public RSessionBase + { + public: + /** + * Connect Connects client side to application management server + * @return KErrNone Symbian error code + */ + IMPORT_C TInt Connect( const TCertInfo &aCertInfo ); + IMPORT_C TInt Connect( ); + + /** + * Close Close server connection + */ + IMPORT_C void Close(); + + +//Session management + /** + * DeliverL Add deployment component to the system. At least some parameter + * (in the aInfo or aData) must not be empty. + * + * @param aInfo TDeploymentComponentInfo containing the essentials of component + * @param aData The Delivery deployment component Data + * @param aInstallOpts Optional install options + * @param aMetaData Optional meta data for install operation + * @return Created Internal Id for the deployment component + */ + + /** + * DownloadL Adds deployment component with EDCSDownload to the system. + * @param aUserId The user id of the component + * @return Created Internal Id for the deployment component + */ + IMPORT_C TUint32 DownloadL( const TDCUserId &aUserId ) const; + + IMPORT_C TUint32 DeliverL( const TDCUserId &aUserId ) const; + /** + * DeploymentComponent Returns the deployment component having the given Id. + * If there's no such deployment component, method returns + * KErrNotFound. + + * @param aId Id of the component to be found + * @return KErrNone Symbian error code (KErrNotFound if not found) + */ + IMPORT_C TInt DeploymentComponent( + TUint32 aInternalId, TDeploymentComponent &aReturnValue ) const; + + /** + * DeploymentComponentUserId Returns the user id of deployment component + * having the given internal Id. + * @param aId Id of the component to be found + * @param aResponse The buffer in which the user id will be placed + * @return KErrNone Symbian error code (KErrNotFound if not found) + */ + IMPORT_C void DeploymentComponentUserIdL( + TUint32 aInternalId, TDCUserId &aResponse ) const; + + /** + * DeploymentComponentDataL Fetches data for component that's in EDCSDelivered state. + * @param aInternalId Id of the component to be found + * @param aDataType Type of the data to be found. Must be one of EDCInstallOptions + * EDCMetaData, EDCData, + * @param aBuffer The buffer that will be filled with the data + * @return + */ + IMPORT_C void DeploymentComponentDataL( + TUint32 aInternalId, TDeplCompAttrType aDataType, CBufBase &aBuffer ) const; + + + /** + * UpdateDeploymentComponentL Updates deployment component. + * @param aInternalId Id of the component to be updated + * @param aItem Type of the data to be updated. + * @param aItemData The data + * @leave The deployment component, or NULL if there's not one + */ + IMPORT_C void UpdateDeploymentComponentL( TUint32 aInternalId, + TDeplCompAttrType aItem, const TDesC8 &aItemData ) const; + + /** + * UpdateDeploymentComponentL Updates deployment component with mime type too. + * @param aInternalId Id of the component to be updated + * @param aItem Type of the data to be updated. This must be + * EDCMetaData or EDCData for call to be successful + * @param aItemData The data + * @param aDataMime The data mime type + * @leave The deployment component, or NULL if there's not one + */ + IMPORT_C void UpdateDeploymentComponentDataL( + TUint32 aInternalId, TDeplCompAttrType aItem, + const TDesC8 &aItemData, const TDesC8 &aDataMime ) const; + + /** + * UpdateDeploymentComponentStreamedDataL Updates deployment component with mime type too. + * @param aInternalId Id of the component to be updated + * @param aItem Type of the data to be updated. This must be + * EDCMetaData or EDCData for call to be successful + * @param aDataMime The data mime type + * @leave The deployment component, or NULL if there's not one + */ + IMPORT_C void UpdateDeploymentComponentStreamedDataL( + TUint32 aInternalId, TDeplCompAttrType aItem, const TDesC8 &aDataMime ) const; + + /** + * DeploymentComponentIds Returns array of the deployment component Ids, that exist in the + * system. Optionally one can give a TDeploymentComponentState flag to restrict + * resulted ids to those components that has the given state. + * @param aArray Will hold the response + * @param aState Optional state of the wished deployment components + * @return KErrNone Symbian error code + */ + IMPORT_C TInt DeploymentComponentIdsL( + RElementIdArray &aArray, + const TDeploymentComponentState aState = EDCSNone ) const; + + /** + * InstallL Installs given deployment component. + * @param aInternalId The id of deployment component to be installed + * @param aTargetState Will the installed component be actibve or inactive (default active) + * @return KErrNone Symbian error code + */ + IMPORT_C void InstallL( TUint32 aInternalId , + TDeploymentComponentState aTargetState = EDCSActive) const; + + /** + * RemoveL Removes given deployment component. + * @param aInternalId The id of the component to be removed + * @return + */ + IMPORT_C void RemoveL( TUint32 aInternalId ) const; + + /** + * UpdateL Updates the given deployment + * @param aSourceInternalId The id of the component that is source of update + * @param aTargetInternalId The id of the component that is target of update + * @leave + */ + IMPORT_C void UpdateL( TUint32 aSourceInternalId, TUint32 aTargetInternalId ) const; + + /** + * StartDownloadL Starts download of deployment component. + * @param aInternalId The id of the component to be downloaded + * @param aTargetState The target state of download ( + * @return + */ + IMPORT_C void StartDownloadL( TUint32 aInternalId, + const TDownloadTarget aTarget= EDeliver ) const; + + + /** + * StateChangingDCIds Returns array of the deployment component Ids, that are + * in the state changing list. Currently they are those that are being downloaded. + * @param aArray Will hold the response + + * @return KErrNone Symbian error code + */ + IMPORT_C TInt StateChangingDCIdsL( RElementIdArray &aArray ) const; + + /** + * StateChangeComplete Informs server that the state of component is updated in the + * adapter, and that it thus can be removed from the list of state changing objects. + * @param aInternalId The id of the component to be removed from list + * + * @return KErrNone Symbian error code + */ + IMPORT_C TInt StateChangeComplete( TUint32 aInternalId ) const; + + /** + * ActivateL Tries to activate given deployment component + * + * @param aInternalId The id of the component to be activated + */ + IMPORT_C void ActivateL( TUint32 aInternalId ) const; + + /** + * DeactivateL Tries to deactivate given deployment component + * + * @param aInternalId The id of the component to be deactivated + */ + IMPORT_C void DeactivateL( TUint32 aInternalId ) const; + + /** + * DeploymentComponentDataSizeL Get deployment component attribute size + * + * @param aInternalId The id of the component + * @param aItem The type of attribute whose size is to be got + * @return The size + */ + IMPORT_C TInt DeploymentComponentDataSizeL( TUint32 aInternalId, + const TDeplCompAttrType &aItem ) const; + + /** + * DeploymentComponentTempInstFile ask file handle from server to be used + * + * @param aTempFile temporary file handle + * @param aItem The type of attribute whose type of temporary file to get + * @return KErrNone Symbian error code + */ + IMPORT_C void DeploymentComponentTempInstFileL( TUint32 aInternalId, RFile& aTempFile, const TDeplCompAttrType &aItem ) const; + + /** + * GetFinalResultsForGAL ask results from AM Server. In response AM + * server returns final result and target URI of node + * + * @param aInternalId The id of the component + * @param aFinalResult Final result of deployment component + * @param aTargetURI Target URI of deployment component + * @return void + */ + IMPORT_C void GetFinalResultsForGAL(TUint32 aInternalId, TInt& aFinalResult, TDes8& aTargetURI) const; + + IMPORT_C void GenericAlertSentL(TUint32 aInternalId) const; + + /** + * Implementation of Service UID() from base class. Returns AM service UID + * to framework + * + * @return uid of AM service UID + */ + TUid ServiceUid() const; + /** + * CheckStatusNodes Checks all deployed,delivered and download component's status node values + * and set the state accordingly. For ex, on first SCOMO session if status node = Download progress + * which means that download operation is failed in previous sessiona and hence we need to set the + * value of status node to Download failed. + * + */ + IMPORT_C void CheckStatusNodesL( ) const; + + private: + }; + + + } + +#endif //__APPLICATIONMANAGEMENTCLIENT_H__ + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/inc/ApplicationManagementClientServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/inc/ApplicationManagementClientServer.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2000 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 applicationmanagement components +* +*/ + + +#ifndef __APPLICATIONMANAGEMENTCLIENTSERVER_H__ +#define __APPLICATIONMANAGEMENTCLIENTSERVER_H__ + +#include + +_LIT(KApplicationManagementServerName,"applicationmanagementserver"); +_LIT(KApplicationManagementServerImg,"\\applicationmanagementserver.exe"); // DLL/EXE name + +const TUid KApplicationManagementServerUid={0x200267FB}; + +namespace NApplicationManagement + { + +//const TInt KMaxReturnMessageLength = 100; +//const TInt KElementIdMaxLength = 100; + +const TUint KMessageDelimiterChar = '|' ; + + +const TInt KAMVerMajor = 1; +const TInt KAMVerMinor = 0; +const TInt KAMVerBuild = 0; + + +enum TApplicationManagementMessages + { + EAddTrust, + EDeplCompCountOperation, + EDeplCompIdsOperation, +// EDeplCompDeliverStartOperation, + EDeplCompDeliverCompleteOperation, + EDeplCompGetOperation, + EDeplCompGetDataOperation, + EDeplCompGetDataLengthOperation, + EDeplCompAttrUpdateOperation, // updates "simple" common attribute + EDeplCompUpdateDataOperation, // updates "larger" attrbute, such as data + EDeplCompUpdateStreamedDataOperation,// 10 + EInstallOperation, + EUpdateOperation, + EDeplCompRemoveOperation, + EDeplCompDownloadOperation, + EDeplCompActivateOperation, + EDeplCompDeactivateOperation, + EDeplCompDeliverStartOperation2, + EDeplCompUpdateOperation, // updates whole component + EDeplCompGetUserIdOperation, // returns the user id + EDeplCompStartDownloadOperation, // 20 + EGetStateChangingIdsCountOperation, + EGetStateChangingIdsOperation, // gets list of ids that are potentially changing state + ECompleteStateChangeOperation, // completes change of state + EDeplCompGetTemporaryInstFile, + EDeplCompGetTargetURI, + EDeplCompGetFinalResultForGA, + EDeplCompGenericAlertSent, + ECheckStatusNodes, + EPerformRfs, + ELast + + }; + + + } +#endif// __ApplicationManagementCLIENTSERVER_H__ + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/inc/ApplicationManagementCommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/inc/ApplicationManagementCommon.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2000 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 applicationmanagement components +* +*/ + + +#ifndef __APPLICATIONMANAGEMENTCOMMON_H__ +#define __APPLICATIONMANAGEMENTCOMMON_H__ + +#include +#include +#include "ApplicationManagementConst.h" + +namespace NApplicationManagement + { + +const TUint32 KAppMgmtServerUid = {0x200267FB}; + +const TUint32 KAMServiceUid = {0x1020781B}; + +const TUid KProperty = {0x101F9A02}; + +const TUint32 KInteger = 0x00000001; + +//const TUint32 KOmaDMAppUid = {0x200267FB}; +const TInt KVersionLength= 7; // 3 for Major, 1 for '.' and 3 for Minor +_LIT( KLiteralPeriod, "."); + +const TInt KAMDefaultValue = 0; +const TInt KAMSCMAdapter = 1; +const TInt KAMSCOMOAdapter = 2; + +const int KDCIdMaxLength = 128 ; +typedef TBuf8 TDeploymentComponentId; + +const int KDeploymentComponentNameMaxLength = 128 ; +typedef TBuf8 TDeploymentComponentName; + +const int KDeploymentComponentVersionMaxLength = 32; +typedef TBuf8 TDeploymentComponentVersion; + +const int KDeploymentComponentDescriptionMaxLength = 512; +typedef TBuf8 TDeploymentComponentDescription; + +const int KDeploymentComponentPkgIdMaxLength = 256; +typedef TBuf8 TDeploymentComponentPkgId; + +const int KDeploymentComponentPkgIdRefMaxLength = 256; +typedef TBuf8 TDeploymentComponentPkgIdRef; + +const int KDeploymentComponentPkgTypeRefMaxLength = 256; +typedef TBuf8 TDeploymentComponentPkgType; + +typedef TBuf8 TMidletnameName; + +typedef TBuf8 TMidletVendorName; +typedef TBuf8 TMidletVersion; + +typedef TBuf8 TPreInstalledAppName; +typedef TBuf8 TPreInstalledAppVendorName; +typedef TBuf8 TPreInstalledVersion; + +const int KDeploymentComponentURLMaxLength = 32; + +const int KMaxMimeLength = 256 ; +typedef TBuf8 TMimeType; + +const int KMaxDCUserIdLength = 256; +typedef TBuf8 TDCUserId; + +enum TDeploymentComponentState + { + EDCSError = -1, + EDCSNone = 0, + EDCSDelivered = 1, + EDCSInactive = 2, + EDCSActive = 3, + EDCSDownload = 4, + EDCSDeployed =5, + EDCSDelete = 6 + }; + +enum TDeplCompAttrType + { + EDCNone = 0, + EDCId = 1, + EDCName = 2, + EDCVersion = 4, + EDCInstallOptions = 8, + EDCMetaData = 16, + EDCMetaDataMime = 24, + EDCData = 32, + EDCDataMime = 48, + EDCStatus = 64, + EDCDownloadURI = 128, + EDCStateValue = 256, + EDCConRef = 512, + EDCDescriptionRef = 1024, + EDCPkgID = 2048, + EDCPkgType = 4096 + }; + +enum TDownloadTarget + { + EDeliver, + EInstall, + EInstallAndActivate, + EUpdate, + EUpdateAndActivate + }; +enum TSCOMOStatusNodeStates + { + //Download Status Values + EIdle = 10, + EDownload_DownloadFailed = 20, + EDownload_DownloadProgress = 30, + EDownload_DownloadComplete = 40, + EDownload_InstallProgress = 50, + EDownload_InstalledFailedWithData = 60, + EDownload_InstalledFailedWithOutData = 70, + //Delivered Status Values + EDelivered_RemoveFailed = 20, + EDelivered_RemoveProgress = 30, + EDelivered_InstallProgress = 40, + EDelivered_InstalledFailedWithData = 50, + EDelivered_InstallFailedwithOutData = 60, + //Deployed Status Values + EDeployed_RemoveFailed = 20, + EDeployed_RemoveProgress = 30, + EDeployed_ActivateFailed = 40, + EDeployed_ActivateProgress = 50, + EDeployed_DeactivateFailed = 60, + EDeployed_DeactivateProgress = 70 + }; +/** +* CAMDeliveryDeploymentComponent class to represent delivery items +*/ + +struct TDeploymentComponent + { + // Data + TDeploymentComponentId iId ; + TDeploymentComponentName iName; + TDeploymentComponentVersion iVersion ; + TDeploymentComponentDescription iDescription; + TDeploymentComponentPkgId iPkgID; + TDeploymentComponentPkgIdRef iPkgIDRef; + TDeploymentComponentPkgType iPkgType; + TDeploymentComponentState iState ; + TDeploymentComponentState iOldState ; + TDeploymentComponent() : iId( KNullDesC8() ), + iName( KNullDesC8() ), + iVersion( KNullDesC8() ), + iDescription (KNullDesC8), + iState( EDCSNone ), + iOldState ( EDCSNone ) + + { + + } + TDeploymentComponent( const TDesC8 &aId, + const TDesC8 &aName, + const TDesC8 &aVersion, + TDeploymentComponentState aState ) + : iId( aId ), + iName( aName ), + iVersion ( aVersion ), + iState ( aState ), + iOldState( EDCSNone ) + { + } + }; + +struct TDeploymentComponentIPC + { + TDeploymentComponent iComponent; + TBuf8<256> iMimeType; + TDCUserId iUserId; + TDeploymentComponentIPC() : iComponent(), + iMimeType( KNullDesC8() ), + iUserId( KNullDesC8()) + + { + + } + TDeploymentComponentIPC( const TDeploymentComponent &aComponent, + const TDesC8 &aMimeType, + const TDCUserId &aUserId) + : iComponent( aComponent ), + iMimeType( aMimeType ), + iUserId( aUserId ) + { + + } + }; + +struct TDeplCompDataIPC + { + TUint32 iInternalId; + TDeplCompAttrType iAttrType; + TBuf8<256> iDataMime; + }; + + } +#endif + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/inc/ApplicationManagementConst.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/inc/ApplicationManagementConst.h Thu Jul 22 16:30:53 2010 +0100 @@ -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: Implementation of applicationmanagement components + * +*/ + + +#ifndef __AMC_H__ +#define __AMC_H__ + + +// Successful - The Request has Succeeded + +const TInt KStatusSuccess = 1200; + +//User chose not to accept the operation when prompted + +const TInt KStatusUserCancelled = 1401; + +//The Software Component download failed + +const TInt KStatusDownloadFailed = 1402; + +//The download failed due to insufficient memory in the Device +//to save the Delivery Package. + +const TInt KStatusDowloadFailedOOM = 1404; + +//Software Component installation failed in the Device + +const TInt KStatusInstallFailed = 1405; + +//The install failed because there wasn't sufficient memory to install +//the Software Component in the Device. + +const TInt KStatusInstallFailedOOM = 1406; + +//Failure to positively validate digital signature of the Delivery Package + +const TInt KStatusPkgValidationFailed = 1407; + +//The Software Component Remove operation failed + +const TInt KStatusRemoveFailed = 1408; + +//The Software Component Activate operation failed + +const TInt KStatusActivationFailed = 1409; + +//The Software Component Deactivate operation failed + +const TInt KStatusDeactivationFailed = 1410; + +//The Operation has been rejected because the device does not support the target environment type + +const TInt KStatusUnSupportedEnvironment = 1413; + +//Alternate Download Server Error Encountered + +const TInt KStatusAltDowldError = 1500; + +//The Alternate Download Server is unavailable or does not respond + +const TInt KStatusAltDowldUnavailable = 1501; + +//Authentication was Required but Authentication Failure was encountered when downloading Software Component + +const TInt KStatusAlternateDownldAuthFail = 1403; + + + + + + +#endif +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/inc/ApplicationManagementRfs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/inc/ApplicationManagementRfs.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2000 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 applicationmanagement components +* +*/ + + +#ifndef __AMRFS_H__ +#define __AMRFS_H__ + +#include + +class RAppMgmtRfs : public RSessionBase + { + public: + + /** + * Connect Connects to ApplicationManagmeent server (starts it if it's not + * running + * @return KErrNone or Symbian error code + */ + IMPORT_C TInt Connect(); + + + /** + * Close Closes connection to ApplicationManagement server + * @return KErrNone or Symbian error code + */ + IMPORT_C void Close(); + + // New methods + + /** + * PerformRfsL Causes ApplicationManagement to prepare for RFS. That means + * uninstall of serveral applications, etc. + * @return KErrNone or Symbian error code + */ + IMPORT_C void PerformRfsL() const; + + /** + * Implementation of Service UID() from base class. Returns AM service UID + * to framework + * + * @return uid of AM service UID + */ + TUid ServiceUid() const; + }; + +#endif + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/inc/amprivateCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/inc/amprivateCRKeys.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,190 @@ +/* +* 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 applicationmanagement components + * +*/ + +#ifndef __AMPRIVATECRKEYS_H__ +#define __AMPRIVATECRKEYS_H__ + +/** +* Application Management Internal Keys UID +*/ +const TUid KCRUidPrivateApplicationManagementKeys = { 0x200267FB }; + +/** +* CenRep key that holds smallest supported Internal Component Id +* +* Possible integer values: +* positive integer values +* +* Default value: -1 (not defined) +* +* Note: Only for Application Management private use +* +*/ + +const TInt KMinIdValue = 0x20; + +/** +* CenRep key for Next free ID: +* Holds the next free if for deployment component +* +* Possible integer values: +* positive integer values +* +* Default value: -1 (not defined) +* +* Note: Only for Application Management private use +* +*/ +const TInt KNextIdKey = 0x01; + +/** +* Holds the lenght of deployment component id list +* +* Possible integer values: +* positive integer values +* +* Default value: 0 +* +* Note: Only for Application Management private use +* +*/ +const TInt KIdListLengthKey = 0x02; + +/** +* Holds the deployment component id list +* +* Possible string values: Application Management defined +* +* Default value: (empty) +* +* Note: Only for Application Management private use +* +*/ +const TInt KIdListKey = 0x03 ; + +/** +* Holds the value which determines whether SYnc or Async operation +* is enabled +* +* Possible string values: Application Management defined +* +* Default value: 1 ( ASync is enabled) +* +* Note: Only for Application Management private use +* +*/ +const TInt KAsyncEnabled = 0x04; + +/** +* This value is static node name and cenrep configurable +* +* Possible string values: Application Management defined +* +* Note: Only for Application Management private use +* +*/ + +const TInt KAMDownloadPredefinedNode= 0x05 ; + +/** +* This value is retry count and determines the maximum +* allowable retry count +* +* Possible string values: Application Management defined +* +* Note: Only for Application Management private use +* +*/ +const TInt KMaxRetryCount = 0x06; + +/** +* This value stores the status of Sync reporting +* +* Possible string values: Application Management defined +* +* Note: Only for Application Management private use +* +*/ +const TInt KAMSyncStatus = 0x07; + +/** +* This value tells which adapter(SCM/SCOMO) did DM operations (ADD/DELETE/GET/UPDATE/EXEC) in previous DM session. +* Based on this we will call CheckStateChangesL() in DDFStructurel() API +* +* Possible string values: default - 0 +* SCM adapter - 1 +* SCOMO adapter -2 +* +* Note: Only for Application Management private use +* +*/ +const TInt KAMAdapterValue = 0x08; + +/** +* This value checks if Static node feature is enabled +* if value is 1 then CMCCSCM static node is visible under +* download node otherwise it is not visible +* +* default value from platform side this feature is disabled. +* +* Note: Only for Application Management private use +*/ +const TInt KAMStaticNodeEnabled = 0x09; + +/** +* This value indicate SCOMO MetaType used in generic alert and this +* is configurable +* +* Note: Only for Application Management private use +* +* +*/ +const TInt KSCOMOMetaTypeKey = 0x0A; + +/** +* This value indicate SCOMO MetaFormat used in generic alert and this +* is configurable +* +* Note: Only for Application Management private use +* +* +*/ +const TInt KSCOMOMetaFormatKey = 0x0B; + +/** +* This value indicate SCOMO Mark used in generic alert and this +* is configurable +* +* Note: Only for Application Management private use +* +* +*/ +const TInt KSCOMOMark = 0x0C; + +/** +* This default value is used to get drive from cenrep and this is +* applicable in case of silent mode of SCOMO operation +* +* Note: Only for Application Management private use +* +* +*/ +const TInt KDefaultDriveForInstall = 0x0D; + +#endif // __AMPRIVATECRKEYS_H__ + +// End of file diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/inc/ampskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/inc/ampskeys.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,60 @@ +/* +* 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 applicationmanagement components + * +*/ + + +#ifndef __AMPSKEYS_H__ +#define __AMPSKEYS_H__ + +// Application Management Server UID for Publish and Subscribe key + +const TUid KUidPSApplicationManagementKeys = { 0x200267FB }; + +// P&S key to check whether AM UI Server is enabled or disabled + +const TUint KAMServerUIEnabled = 0x00001; + +// P&S key to check whether device management session is silent +// or interactive(can be information or nonspecified as well) + +const TUint KAMOperationNonSilent = 0x00002; + +// P&S key to Notify OMA SCOMO adapter as soon as download is +// complete. This will be applicable in case of Sync operation + +const TUint KSyncNotifier = 0x000004; + +// Set this P&S key so that DM UI will not be closed in case of server initiated session +// applicable only for Interactive, Informative or Non specified + +const TUint KDMUINotClosed = 0x00005; + + +// DM UI application ID + +const TUid KPSUidNSmlDMSyncApp = {0x101f6de5}; + +// Key defined in DM UI Fw to know application management server +// whether session started in silent mode or non-silent + +const TUint32 KSilentSession = 0x0000000D; + + + + +#endif + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/inc/debug.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,85 @@ +/* +* 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: Application Management Debug macro definitions +* +*/ + + +#ifndef DEBUG_HEADER_ +#define DEBUG_HEADER_ + +// INCLUDES + +#include +#include + +// CONSTANTS +_LIT( KTarmLogFolderName, "tarm" ); +_LIT( KTarmLogFileName, "tarm.log" ); +// MACROS +//#define _TARM_FILE_DEBUG +#ifdef _TARM_FILE_DEBUG + #define RDEBUG(X) RFileLogger::Write( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L(X) ) + #define RDEBUG_2(X,Y) RFileLogger::WriteFormat( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L(X),Y ) + #define RDEBUG_3(X,Y,Z) RFileLogger::WriteFormat( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L(X),Y,Z ) + #define RDEBUG_4(X,Y,Z,A) RFileLogger::WriteFormat( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L(X),Y,Z,A ) + #define RDEBUG_5(X,Y,Z,A,B) RFileLogger::WriteFormat( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L(X),Y,Z,A,B ) + + #define RDEBUG8_2(X,Y) RFileLogger::WriteFormat( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L8(X),Y ) + #define RDEBUG8_3(X,Y,Z) RFileLogger::WriteFormat( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L8(X),Y,Z ) + #define RDEBUG8_4(X,Y,Z,A) RFileLogger::WriteFormat( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L8(X),Y,Z,A ) + #define RDEBUG8_5(X,Y,Z,A,B) RFileLogger::WriteFormat( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, _L8(X),Y,Z,A,B ) + #define RDEBUG_HEX8(X,Y) RFileLogger::HexDump( KTarmLogFolderName, KTarmLogFileName, EFileLoggingModeAppend, NULL, NULL, X,Y ) + +#else + + #ifdef _DEBUG + #define RDEBUG(X) RDebug::Print(_L(X)) + #define RDEBUG_2(X,Y) RDebug::Print(_L(X),Y) + #define RDEBUG_3(X,Y,Z) RDebug::Print(_L(X),Y,Z) + #define RDEBUG_4(X,Y,Z,A) RDebug::Print(_L(X),Y,Z,A) + #define RDEBUG_5(X,Y,Z,A,B) RDebug::Print(_L(X),Y,Z,A,B) + + #define RDEBUG8_2(X,Y) RDebug::Printf(X,Y) + #define RDEBUG8_3(X,Y,Z) RDebug::Printf(X,Y,Z) + #define RDEBUG8_4(X,Y,Z,A) RDebug::Printf(X,Y,Z,A) + #define RDEBUG8_5(X,Y,Z,A,B) RDebug::Printf(X,Y,Z,A,B) + + #define RDEBUG_HEX8(X,Y) + + #else + #define RDEBUG(X) + #define RDEBUG_2(X,Y) + #define RDEBUG_3(X,Y,Z) + #define RDEBUG_4(X,Y,Z,A) + #define RDEBUG_5(X,Y,Z,A,B) + + #define RDEBUG8_2(X,Y) + #define RDEBUG8_3(X,Y,Z) + #define RDEBUG8_4(X,Y,Z,A) + #define RDEBUG8_5(X,Y,Z,A,B) + + #define RDEBUG_HEX8(X,Y) + + #endif // _DEBUG + +#endif // _TARM_FILE_DEBUG + + + + +#endif // DEBUG_HEADER_ + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,43 @@ +/* +* 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: build info file for application management adapter +* +*/ + + +#include + +PRJ_EXPORTS + + +// ARMv5 udeb +../src/20021335.SPD /epoc32/release/armv5/udeb/z/private/100012a5/policy/20021335.spd + +// ARMv5 urel +../src/20021335.SPD /epoc32/release/armv5/urel/z/private/100012a5/policy/20021335.spd + +// WINSCW udeb +../src/20021335.SPD /epoc32/release/winscw/udeb/z/private/100012a5/policy/20021335.spd + +// WINSCW urel +../src/20021335.SPD /epoc32/release/winscw/urel/z/private/100012a5/policy/20021335.spd + +../src/20021335.SPD /epoc32/data/z/private/100012a5/policy/20021335.spd + +PRJ_MMPFILES +./omascomoadapter.mmp + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/group/omascomoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/group/omascomoadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,82 @@ +/* +* 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: Implementation of oma scomo adapter +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include "defaultcaps.hrh" + + +TARGET omascomoadapter.dll + +CAPABILITY CAP_GENERAL_DLL -TCB -DRM + +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20021335 +VENDORID VID_DEFAULT + +MACRO __AM_LASTERROR_NODE // uncomment to enable /SCOMO/Ext/LastError node + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +#ifdef __TARM_SYMBIAN_CONVERGENCY +SYSTEMINCLUDE /epoc32/include/devman +#else +// nothing +#endif + +SOURCEPATH ../src +SOURCE omascomoadapter.cpp +SOURCE nsmldmiapmatcher.cpp +SOURCE nsmldmuri.cpp +SOURCE omascomoadapterdb.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../options/inc // install options +USERINCLUDE ../../server/inc //for amprivateCRKeys.h + + +START RESOURCE omascomoadapter.rss +TARGET omascomoadapter.rsc +END + + +LIBRARY euser.lib edbms.lib sysutil.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY applicationmanagementclient.lib +LIBRARY centralrepository.lib +LIBRARY aminstalloptions.lib +LIBRARY featmgr.lib +LIBRARY flogger.lib +LIBRARY syncmlclientapi.lib +LIBRARY nsmlprivateapi.lib + +#ifdef __TARM_SYMBIAN_CONVERGENCY +LIBRARY devmancmdmgr.lib +LIBRARY dmtreeclient.lib +#else +LIBRARY nsmldmtreedbclient.lib +LIBRARY nsmldmclientserverutils.lib +LIBRARY nsmldmiapmatcher.lib apgrfx.lib ws32.lib +#endif + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/inc/nsmldmiapmatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/inc/nsmldmiapmatcher.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,129 @@ +/* +* 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 applicationmanagement components + * +*/ + + +#ifndef __NSMLDMIAPMATCHER_H__ +#define __NSMLDMIAPMATCHER_H__ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include "nsmldmuri.h" + +//CLASS FORWARDS +class MSmlDmCallback; + +_LIT8( KNSmlDMIAPUri, "AP" ); +_LIT8( KNSmlDMSeparator8, "/" ); +_LIT8( KNSmlDMIAPUriDotSlash, "./" ); +_LIT8( KNSmlDMConnMOIAPUri, "NAP" ); + +const TUint8 KNSmlDMSlash = 0x2f; //forward slash +/** +* CNSmlDMIAPMatcher contains services for generating URI from IAPId and +* vice versa in DM plug-in adapters. The class needs the working +* MSmlDmCallback callback interface for operating, so ths can be used only +* by DM plug-in adapters +* +* @since +*/ +class CNSmlDMIAPMatcher : public CBase + { + public: + /** + * Destructor + */ + ~CNSmlDMIAPMatcher(); + + /** + * Two-phased constructor + * @param aDmCallback Pointer to callback interface + * @return Pointer to newly created module instance + */ + static CNSmlDMIAPMatcher* NewL( MSmlDmCallback* aDmCallback); + + /** + * Two-phased constructor, pushes pointer to cleanup stack. + * @param aDmCallback Pointer to callback interface + * @return Pointer to newly created module instance + */ + static CNSmlDMIAPMatcher* NewLC( MSmlDmCallback* aDmCallback); + + /** + * Gets the IAP id which corresponds to given URI + * @param aURI Accespoint URI + * @return Accespoint id in AP database + */ + TInt IAPIdFromURIL( const TDesC8& aURI ); + + /** + * Generates the URI which corresponds to given IAP Id + * @param aIAPId Accespoint Id + * @return Accesspoint URI in DM + */ + HBufC8* URIFromIAPIdL( TInt aIAPId ); + + private: + /** + * Second phase constructor + * @param aDmCallback Pointer to callback interface + */ + void ConstructL(MSmlDmCallback* aDmCallback); + + /** + * Changes the given descriptor to Integer + * @param aLuid Luid in descriptor format + * @return Luid in TInt type + */ + TInt DesToInt(const TDesC8& aLuid) const; + + /** + * Return the URI without ./ at the beginning, if those exist + * @param aURI Uri + * @return Uri without ./ + */ + TPtrC8 RemoveDotSlash(const TDesC8& aURI) const; + + /** + * Return the last uri segment of the aURI + * @param aURI Uri + * @return The last uri segment + */ + TPtrC8 LastURISeg(const TDesC8& aURI) const; + + /** + * Return the last uri segment of the aURI + * @return The AccessPoint Reference + */ + const TDesC8& GetConRef() ; + + private: + + /** + * Pointer to callback interface + */ + MSmlDmCallback* iCallback; + + /** + * Boolean to check FeatMgr Initialization + */ + TBool iFeatMgrInitialized; + + }; + +#endif // __NSMLDMIAPMATCHER_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/inc/nsmldmuri.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/inc/nsmldmuri.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,94 @@ +/* +* 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 applicationmanagement components + * +*/ + +#ifndef __NSMLDMURI_H +#define __NSMLDMURI_H + +#include +#include +#include + + +const TUint8 KNSmlDMUriSeparator = 0x2f; //forward slash + +_LIT8(KNSmlDmRootUri, "."); +_LIT8(KNSmlDmUriDotSlash, "./"); +_LIT8( KNSmlDmQuestionMark, "?" ); + +// =========================================================================== +// NSmlDmURI +// =========================================================================== +/** +* NSmlDmURI contains just static methods for parsing URIs +* +* @since +*/ +class NSmlDmURI + { + public: + /** + * Return the parent URI of given URI + * @param aURI Uri + * @return Parent URI + */ + static TPtrC8 ParentURI(const TDesC8& aURI); + + /** + * Return the last URI segment of given URI + * @param aURI Uri + * @return Last URI segment + */ + static TPtrC8 LastURISeg(const TDesC8& aURI); + + /** + * Return the URI without ./ at the beginning, if those exist + * @param aURI Uri + * @return Uri without ./ + */ + static TPtrC8 RemoveDotSlash(const TDesC8& aURI); + + /** + * Return the URI without property info at the end (?prop=...) + * @param aURI Uri + * @return Uri without property info + */ + static TPtrC8 RemoveProp(const TDesC8& aURI); + + /** + * Return the URI without last segment + * @param aURI Uri + * @return URI without last uri segment + */ + static TPtrC8 RemoveLastSeg(const TDesC8& aURI); + + /** + * Return the aLocationth URI segment. + * @param aURI Uri + * @param aLocation The wanted segment number + * @return The aLocationth URI segment + */ + static TPtrC8 URISeg(const TDesC8& aURI,TInt aLocation); + + /** + * Return the number of URI segments of given URI + * @param aURI Uri + * @return Number of segments + */ + static TInt NumOfURISegs(const TDesC8& aURI); + }; + +#endif // __NSMLDMURI_H diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/inc/omascomoadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/inc/omascomoadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,853 @@ +/* +* 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 applicationmanagement components + * +*/ + + +#ifndef __OMASCOMOADAPTER_H__ +#define __OMASCOMOADAPTER_H__ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include +#include "omascomoadapterdb.h" + +#ifdef __TARM_SYMBIAN_CONVERGENCY +#include +#else +#include "nsmldmtreedbclient.h" +#endif + +#include "ApplicationManagementClient.h" + +const TInt KMaxUrlLength = 2048; + +namespace NApplicationManagement + { + + const TUint KAMAdapterImplUid = 0x20021336; + + const TInt KMaxSizeString = 256; + + // the DDF version must be changed if any changes in DDF structure ( built in DDFStructureL() function ) + _LIT8( KAMDDFVersion, "1.0" ); + + _LIT8( KAMTextPlain, "text/plain" ); + +#ifdef __TARM_SYMBIAN_CONVERGENCY + _LIT8( KAMNodeName, "./SCOMO" ); +#else + _LIT8( KAMNodeName, "SCOMO" ); +#endif + _LIT8( KAMNodeDescription, "This node is the root node for all application management functionality" ); + + _LIT8( KAMInventoryNodeName, "Inventory" ); + _LIT8( KAMInventoryNodeDescription, "This node is start node of application inventory" ); + + _LIT8( KAMDeliveredNodeName, "Delivered" ); + _LIT8( KAMDeliveredNodeDescription, "This is node under which applications that are delivered but not installed are found." ); + + _LIT8( KAMDeployedNodeName, "Deployed" ); + _LIT8( KAMDeployedNodeDescription, "This is a node under which deployed applications are found" ); + + _LIT8( KAMDeliveredDynaNodeDescription, "This dynamic node is placeholder applications that are in Delivered state" ); + + _LIT8( KAMPkgIDNodeName, "PkgID" ); + _LIT8( KAMPkgIDNodeDescription, "This leaf node holds an package identifier for an application" ); + + + _LIT8( KAMIDNodeName, "ID" ); + _LIT8( KAMIDNodeDescription, "This leaf node holds an identifier for an deployment component" ); + + _LIT8( KAMPkgIDRefNodeName, "PkgIDRef" ); + _LIT8( KAMPkgIDRefNodeDescription, "This leaf node holds an identifier for an deployment component" ); + + _LIT8( KAMNameNodeName, "Name" ); + _LIT8( KAMNameNodeDescription, "This leaf node holds name of an application" ); + + _LIT8( KAMVersionNodeName, "Version" ); + _LIT8( KAMVersionNodeDescription, "This leaf node holds the version of an application" ); + + _LIT8( KAMStateValueNodeName, "State" ); + _LIT8( KAMStateValueNodeDescription, "This leaf node holds the state value of an application (active/inactive)" ); + + _LIT8( KAMDataNodeName, "Data" ); + _LIT8( KAMDataNodeDescription, "This leaf node holds the data of an application" ); + + _LIT8( KAMDescriptorNodeName, "Descriptor" ); + _LIT8( KAMDescriptorNodeDescription, "This leaf node holds the possible metadata of an application" ); + + _LIT8( KAMOperationsNodeName, "Operations" ); + _LIT8( KAMOperationsNodeDescription, "This is a node under which operations are found" ); + + _LIT8( KAMInstallOptsNodeName, "InstallOpts" ); + _LIT8( KAMInstallOptsNodeDescription, "This is a node that holds the installation options of an application" ); + + _LIT8( KAMDeployedDynaNodeDescription, "This dynamic node is placeholder applications that are in Inactive state" ); + + _LIT8( KAMDownloadOperationNodeName, "Download" ); + _LIT8( KAMDownloadOperationNodeDescription, "Starts the download" ); + + _LIT8( KAMConRefNodeName, "ConRef" ); + _LIT8( KAMConRefNodeDescription, "Holds reference to IAP" ); + + _LIT8( KAMLocalOperationsNodeDescription, "This is the root node for local operations" ); + + _LIT8( KAMActivateNodeName, "Activate" ); + _LIT8( KAMActivateNodeDescription, "Exec command causes device to activate an inactive application" ); + + _LIT8( KAMDeActivateNodeName, "Deactivate" ); + _LIT8( KAMDeActivateNodeDescription, "Exec command causes device to stop and deactivate an active application" ); + + _LIT8( KAMInstallNodeName, "Install" ); + _LIT8( KAMInstallNodeDescription, "Exec command causes device to install a delivered application" ); + + _LIT8( KAMInstallInactiveNodeName, "InstallInactive" ); + _LIT8( KAMInstallInactivateNodeDescription, "Exec command causes device to install a delivered application and activate it" ); + + _LIT8( KAMUpdateNodeName, "Update" ); + _LIT8( KAMUpdateNodeDescription, "Exec command causes device to update an application" ); + + _LIT8( KAMUpdateAndActivateNodeName, "UpdateAndActivate" ); + _LIT8( KAMUpdateAndActivateNodeDescription, "Exec command causes device to update an application and activate it" ); + + _LIT8( KAMRemoveNodeName, "Remove" ); + _LIT8( KAMRemoveNodeDescription, "Exec command causes device to remove an application" ); + + _LIT8( KAMDownloadNodeName, "Download" ); + _LIT8( KAMDownloadNodeDescription, "This node is a root node for application download functionality" ); + + _LIT8( KAMDownloadAndInstallNodeName, "DownloadInstall" ); + _LIT8( KAMDownloadAndInstallOperationNodeDescription, "Starts the download and installs component when complete" ); + + _LIT8( KAMDownloadAndInstallAndInActivateNodeName, "DownloadInstallInactive" ); + _LIT8( KAMDownloadAndInstallAndInActivateNodeDescription, "Starts the download and installs and activates component when complete" ); + + _LIT8( KAMDownloadAndUpdateNodeName, "DownloadAndUpdate" ); + _LIT8( KAMDownloadAndUpdateNodeDescription, "Starts the download and installs component when complete" ); + + _LIT8( KAMDownloadAndUpdateAndActivateNodeName, "DownloadAndUpdateAndActivate" ); + _LIT8( KAMDownloadAndUpdateAndActivateNodeDescription, "Starts the download and updates and activates component when complete" ); + + _LIT8( KAMDownloadDynaNodeDescription, "This node is a placeholder for identifier of an application that is to be downloaded" ); + + _LIT8( KAMURINodeName, "PkgURL" ); + _LIT8( KAMURINodeDescription, "This leaf node holds the URL from which the application should be downloaded" ); + + _LIT8( KAMStatusNodeName, "Status" ); + _LIT8( KAMStatusNodeDescription, "This leaf node holds the status of the download" ); + + _LIT8( KAMDescriptionNodeName, "Description" ); + _LIT8( KAMDescriptionNodeDescription, "This leaf node holds the description of the download" ); + + _LIT8( KAMPkgTypeNodeName, "PkgType" ); + _LIT8( KAMPkgTypeNodeDescription, "This leaf node holds the PkgType of the download or delivered" ); + +#ifdef __AM_LASTERROR_NODE + _LIT8( KAMExtNodeName, "Ext" ); + _LIT8( KAMExtNodeDescription, "Non std extentions are found under this leaf" ); + _LIT8( KAMLastErrorNodeName, "LastError" ); + _LIT8( KAMLastErrorDescription, "This leaf node may hold the error" ); +#endif + + _LIT8( KAMDynamicNodeName, "" ); + _LIT( KAMSeparator16, "/" ); + + _LIT8( KAMSeparator8, "/" ); + + _LIT8( KAMRootChilds, "Inventory/Download" ); + _LIT8( KAMInventoryChilds, "Delivered/Deployed" ); + //_LIT8( KAMLocalOperationsChilds, "Activate/DeActivate/Install/Update/Remove" ); + + _LIT8( KAMDownloadDynaChilds, "PkgID/Name/PkgURL/Description/Status/PkgType/Operations" ); +_LIT8( KAMInventoryDynaChilds, "ID/PkgIDRef/Name/Description/Version/State/Operations" ); +_LIT8( KAMDownloadOperationChilds, "Download/DownloadInstall/DownloadInstallInactivate" ); +_LIT8( KAMDeployedOperationChilds, "Activate/Deactivate/Remove" ); +_LIT8( KAMDeliveredOperationChilds, "Install/InstallInactive/Remove" ); +_LIT8( KAMInventoryDeliveredDynaChilds, "PkgID/Data/Name/Description/Status/State/PkgType/Operations" ); + + _LIT8( KNSmlDMSCOMOMetaType,"org.openmobilealliance.dm.softwarecomponent.OperationComplete" ); + _LIT8( KNSmlDMSCOMOMetaFormat, "text/plain" ); + + _LIT8(KDataStart, ""); + _LIT8(KResultCodeStart, ""); + _LIT8(KResultCodeEnd, ""); + _LIT8(KIdentifierStart, ""); + _LIT8(KIdentifierEnd, ""); + + + _LIT8(KMark, "warning"); + + struct TAMCommandBufferElement + { + TInt iStatusRef; + TBuf8<256> iURI; + TAMCommandBufferElement(TInt aRef, const TDesC8 &aURI) : + iStatusRef(aRef), iURI(aURI) + { + } + }; + + typedef RArray TAMCommandBuffer; + + // ------------------------------------------------------------------------------------------------ + // CSCOMOAdapter + // ------------------------------------------------------------------------------------------------ + class CSCOMOAdapter : public CSmlDmAdapter + { +public: + static CSCOMOAdapter* NewL(MSmlDmCallback* aDmCallback); + static CSCOMOAdapter* NewLC(MSmlDmCallback* aDmCallback); + + virtual ~CSCOMOAdapter(); + + /** + The function returns current version of the DDF. + By asking current DDF versions from adapters DM Module can control + possible changes in the data structure and send the changed DDF + description to a management server. + This function is always called after DDFStructureL. + @param aVersion DDF version of the adapter. (filled by the adapter) + @publishedPartner + @prototype + */ + virtual void DDFVersionL(CBufBase& aVersion); + + /** + The function for filling the DDF structure of the adapter + This function is only called once, immediately after the adapter is created. + @param aDDFObject Reference to root object. A DM adapter starts filling + the data structure by calling AddChildObjectL to the root object and + so describes the DDF of the adapter. + @publishedPartner + @prototype + */ + virtual 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 should be + returned by calling SetStatusL function of MSmlDmCallback callback + interface. This makes it possible to buffer the commands. However, all + the status codes for buffered commands must be returned at the latest when + the adapter's CompleteOutstandingCmdsL() is called. + @param aURI URI of the object + @param aLUID LUID of the object (if the adapter has earlier returned a + LUID to the DM Module). For new objects, this is the LUID + inherited through the parent node. + @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 + @publishedPartner + @prototype + */ + virtual void UpdateLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aObject, + const TDesC8& aType, TInt aStatusRef); + + /** + The function creates new leaf objects, or replaces data in existing leaf + objects, in the case where data is large enough to be streamed. The + information about the success of the command should be returned by calling + SetStatusL function of MSmlDmCallback callback interface. This makes it + possible to buffer the commands. However, all the status codes for buffered + commands must be returned at the latest when the CompleteOutstandingCmdsL() + of adapter is called. + @param aURI URI of the object + @param aLUID LUID of the object (if the adapter has earlier returned a + LUID to the DM Module). For new objects, this is the LUID + inherited through the parent node. + @param aStream Data of the object. Adapter should create write stream + and return, when data is written to stream by DM agent, + StreamCommittedL() is called by DM engine + @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. + @publishedPartner + @prototype + */ + virtual void UpdateLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, RWriteStream*& aStream, + const TDesC8& aType, TInt aStatusRef); + + /** + The function deletes an object and its child objects. The SetStatusL + should be used as described in UpdateLeafObjectL() + @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. + @publishedPartner + @prototype + */ + virtual void DeleteObjectL(const TDesC8& aURI, const TDesC8& aLUID, + TInt aStatusRef); + + /** + The function fetches data of a leaf object. The SetStatusL should be used + as described in UpdateLeafObjectL(). The data is returned by using the + SetResultsL function of MSmlCallback callback interface, and may be streamed. + @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. + @publishedPartner + @prototype + */ + virtual 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. The SetStatusL should be used + as described in FetchLeafObjectL(). The size value is returned by using + the SetResultsL function of MSmlCallback callback interface, and must be + a decimal integer expressed as a string, eg. "1234". + Results from this call MUST NOT be streamed. + @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. + @publishedPartner + @prototype + */ + virtual 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. Results from this call MUST NOT be streamed. + @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. An adapter + can use this information when verifying + if old objects still exists. An adapter + also knows what objects are new to DM + engine and can provide LUID mapping for + them. aPreviousURISegmentList parameter + (see above) helps to recognise new + objects. + @param aResultsRef Reference to correct results, i.e. this + reference must be used when returning + the result by calling the SetResultsL. + @param aStatusRef Reference to correct command, i.e. this + reference must be used when calling the + SetStatusL of this command. + @publishedPartner + @prototype + */ + virtual void ChildURIListL(const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, TInt aStatusRef); + + /** + The function adds node object. In some cases an implementation of the + function may be empty function, if the node object does not need concrete + database update. Still this function may be helpful to an adapter, i.e. in + passing mapping LUID of the node to DM Module. The SetStatusL should be + used as described in UpdateLeafObjectL() + @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. + @publishedPartner + @prototype + */ + virtual void AddNodeObjectL(const TDesC8& aURI, + const TDesC8& aParentLUID, TInt aStatusRef); + + /** + The function implements execute command. The information about the success + of the command should be returned by calling SetStatusL function of + MSmlDmCallback callback interface. This makes it possible to buffer the + commands. + However, all the status codes for buffered commands must be returned at + the latest when the CompleteOutstandingCmdsL() of adapter is called. + @param aURI URI of the command + @param aLUID LUID of the object (if the adapter have earlier + returned LUID to the DM Module). + @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. + @publishedPartner + @prototype + */ + virtual void + ExecuteCommandL(const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + TInt aStatusRef); + + /** + The function implements execute command. The information about the + success of the command should be returned by calling SetStatusL function + of MSmlDmCallback callback interface. This makes it possible to buffer the + commands. + However, all the status codes for buffered commands must be returned at + the latest when the CompleteOutstandingCmdsL() of adapter is called. + @param aURI URI of the command + @param aLUID LUID of the object (if the adapter have earlier + returned LUID to the DM Module). + @param aStream Argument for the command. Adapter should create + write stream and return, when data is written to + stream by DM agent, StreamCommittedL() is called by + DM engine + @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. + @publishedPartner + @prototype + */ + virtual void ExecuteCommandL(const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, TInt aStatusRef); + + /** + The function implements copy command. The information about the success of + the command should be returned by calling SetStatusL function of + MSmlDmCallback callback interface. This makes it possible to buffer the + commands. + However, all the status codes for buffered commands must be returned at + the latest when the CompleteOutstandingCmdsL() of adapter is called. + @param aTargetURI Target URI for the command + @param aSourceLUID LUID of the target object (if one exists, and if the adapter + has earlier returned a LUID to the DM Module). + @param aSourceURI Source URI for the command + @param aSourceLUID LUID of the source object (if the adapter has + earlier returned a LUID to the DM Module). + @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. + @publishedPartner + @prototype + */ + virtual void CopyCommandL(const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, const TDesC8& aType, + TInt aStatusRef); + + /** + The function indicates start of Atomic command. + @publishedPartner + @prototype + */ + virtual void StartAtomicL(); + + /** + The function indicates successful end of Atomic command. The adapter + should commit all changes issued between StartAtomicL() and + CommitAtomicL() + @publishedPartner + @prototype + */ + virtual void CommitAtomicL(); + + /** + The function indicates unsuccessful end of Atomic command. The adapter + should rollback all changes issued between StartAtomicL() and + RollbackAtomicL(). If rollback fails for a command, adapter should use + SetStatusL() to indicate it. + @publishedPartner + @prototype + */ + virtual void RollbackAtomicL(); + + /** + Returns ETrue if adapter supports streaming otherwise EFalse. + @param aItemSize size limit for stream usage + @return TBool ETrue for streaming support + @publishedPartner + @prototype + */ + virtual TBool StreamingSupport(TInt& aItemSize); + + /** + Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has + been written to and committed. Not called when fetching item. + @publishedPartner + @prototype + */ +#ifdef __TARM_SYMBIAN_CONVERGENCY + virtual void StreamCommittedL( RWriteStream& aStream ); +#else + virtual void StreamCommittedL(); +#endif + /** + 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. In the case of Atomic processing, the function will be + followed by a call to CommitAtomicL or RollbackAtomicL. + @publishedPartner + @prototype + */ + virtual void CompleteOutstandingCmdsL(); + +private: + CSCOMOAdapter(TAny* aDmCallback); + void ConstructL(); + TInt DesToIntL(const TDesC8& aLuid); + HBufC8* IntToDes8LC(const TInt aLuid); + + TBool CheckStateL(const TDeploymentComponent &aComp, + const TDesC8& aURI); + TBool CheckStateL(const TDesC8& aURI, const TDesC8& aLUID); + /** + * UpdateFlagFromMapping Maps a node name to internal attribute flag that + * is used by server to identify to data + * @param aMapping The SyncML node name + * @return TDeplCompAttrType the attribute type + */ + TDeplCompAttrType UpdateFlagFromMapping(const TDesC8& aMapping); + + /** + * IdListL Looks up the given state user ids of deployment components, + * and places them to currentList in the format specified by SyncML spec + * @param aState The deployment component state in which we are interested + * @param aCurrentList The buffer where the results are placed + * @param aAppend Does the list possibly contain some items already + * @return TError EOk if successful + */ + TError IdListL(TDeploymentComponentState aState, + CBufBase &aCurrentList, TBool aAppend = EFalse); + + /** + * DeliverOrDownloadL Depending on aURI, creates new delivery or download component + * + * @param aUserId The name of dynamic node. + * @param aURI The full URI + * @param aCnt Count of URI segments + * @param aParentMapping The parent data + * @param aStatus A reference to the error which will be set the status of the operation + * @return TError EOk if successful + */ + void DeliverOrDownloadL(const TDesC8 &aUserId, const TDesC8 &aURI, + TInt aCnt, const TDesC8 &aParentMapping, + MSmlDmAdapter::TError &aStatus); + + /** + * Fills the node info in ddf structure + */ + void + FillNodeInfoL(MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription); + + /** + * Fills the node info in ddf structure, without default mime type + */ + void + FillNodeInfoNoDefaultMimeL(MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription); + + TBool IsImage(const TDesC8& aMime); + /** + Calls Callback().SetResultsL() + */ + void SetResultsL(TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType); + /** + Calls Callback().SetStatusL() + */ + void SetStatusL(TInt aStatusRef, MSmlDmAdapter::TError aErrorCode); + // TInt FindBuffered( const TDesC8 &aURI ) ; + RApplicationManagement &SessionL(); + TDeploymentComponentState StateL(const TDesC8& aURI); + + void CheckStateChangesL(); + void CheckStateChangesInternalL(); + + TPtrC8 URISegsUpTo(const TDesC8& aURI, TInt aUpTo, + TBool aInclKeno=EFalse); + + /** + * Helper method to move acl. Copies acl of node aFrom to acl of aTo, + * and removes acl from aFrom. + * + * @param aFrom The source uri + * @param aTo The target uri + */ + void MoveAclL(const TDesC8 &aFrom, const TDesC8 &aTo); + + /** + * Helper method to move nodes in SCOMO tree + * + * 1. Sets mapping of aOriginal to null. + * 2. If aNewURI is null, constructs new uri depending on aTargetstate. + * 3. Sets mapping of aNewURI to aLUID + * 4. Moves acls of aOriginal to aNewURI (using MoveAclL) + * + * @param aOriginal The uri of original node to be moved + * @param aTargetstate The target state the node is moving to + * @param aLUID The luid of the original node + * @param aNewUri The new uri of the node (will be constructed and left to stack if null) + */ + void SetMappingLC(const TDesC8 &aOriginal, + const TDeploymentComponentState aTargetstate, + const TDesC8 &aLUID, HBufC8 *&aNewUri); + + /** + * Helper method to move nodes in SCOMO tree + * + * 1. Sets mapping of aOriginal to null. + * 2. Sets mapping of a uri constructed using aTargetState to aLUID + * 2. Moves acls of aOriginal to a uri constructed using aTargetState (using MoveAclL) + * + * @param aTargetstate The target state the node is moving to + * @param aLUID The luid of the original node + */ + void SetMappingL(const TDesC8 &aOriginalURI, + const TDeploymentComponentState aTargetState, + const TDesC8 &aLUID); + + /** + * Helper method to set DM LUID mappings directly database. + * + * @param aURI The uri of node whose mapping is to be set + * @param aLUID The new mapping value + * @return Possible database error - KErrNone if successful + */ + TInt DirectSetMappingL(const TDesC8 &aURI, const TDesC8 &aLUID); + + TInt DirectRemoveMappingL(const TDesC8 &aURI); + + /** + * Helper method to get DM LUID mappings directly from database. + * + * @param aURI The uri of node whose mapping is to be found + * @return The luid mapping - Empty string if not found. + */ + HBufC8 *DirectGetLuidAllocLC(const TDesC8 &aURI); + + /** + * Helper method to perform install + * + * @param aLuidi The mapping value of component as integer + * @param aURI The uri of node that is to be installed + * @param aLUID The mapping value of component as text + * @param aTargetstate The target state the node is moving to (EDCSActive or EDCSInactive) + * @param aRet The SyncML Error code - value will be updated according to success + */ + void InstallL(const TUint aLuidi, const TDesC8& aURI, + const TDesC8& aLUID, + const TDeploymentComponentState aTargetState, TError &aRet); + + /** + * Helper method to perform update + * + * @param aLuidi The mapping value of component as integer + * @param aURI The uri of node that is to be installed + * @param aLUID The mapping value of component as text + * @param aTargetstate The target state the node is moving to (EDCSActive or EDCSInactive) + * @param aRet The SyncML Error code - value will be updated according to success + */ + void UpdateL(const TUint aLuidi, const TDesC8& aURI, + const TDesC8& aSourceLUID, + const TDeploymentComponentState aTargetState, TError &aRet); + /** + maps symbian error code to DM error code as follows: + Kerrnone-> EOk + Kerrnotfound ->Enotfound + all oether -> EError + */ + void DefaultMapError(const TInt aErr, TError &aRet, + const TDesC8& aDes = KNullDesC8); + + /** + * Deactivates given component if given state is inactive + */ + void DeactivateIfInactive(const TUint aLuidi, + const TDeploymentComponentState aTargetState); + + /** + * Finds luid from app mgmt server to given userid + */ + TUint32 GetLuidForUserIdL(const TDesC8 &aUserId, + const TDeploymentComponentState aState); + + TUint32 GetLuidL(const TDesC8 &aDMLuid, const TDesC8 &aUserId, + const TDeploymentComponentState aState); + + /** + * places result in current + * @param aParent The deployment component identifying uri + * @param aMapping The user id part of the deployment component uri + * @param aLuid Internal id of the deployment compoennt + * @param aCurrentList The list that will get the data + * @param aStatus The syncml status + */ + void GetComponentDataL(const TDesC8& aParent, const TDesC8& aMapping, + const TUint32 aLuid, CBufBase &aCurrentList, + CBufBase ¤tMime, TError &aStatus); + /** + * returns luid of leaf node, or 0 + */ + TInt GetLeafLuidL(const TDesC8 &aURI, const TDesC8 & aParentMapping); + /** + * returns length of result + */ + TInt GetSizeL(const TDeplCompAttrType aDataType, const TInt aLuid, + TError &aRet); + + /** + * places installoptions of given aLuid to aBuf + */ + void InstallOptionsDataL(const TUint32 aLuid, + const TDeplCompAttrType& aDataType, CBufBase &aBuf, + CBufBase *aRaw = NULL); + + /** + * Gets the luid using GetLuidL, and updates aStatus to ENotFound if not found... + */ + TUint32 GetLuid2L(const TDesC8 &aDMLuid, const TDesC8 &aUserId, + const TDeploymentComponentState aState, TError &aStatus); + + /** + * Finds out correct download target based on download operation + */ + TDownloadTarget DownloadTargetL(const TDesC8& aOperation); + + TPtrC8 LastURISeg(const TDesC8& aURI); + TInt DesToInt(const TDesC8& aLuid); + +#ifdef __AM_LASTERROR_NODE + void SetLastErrorL(const TDesC8& aLastError, const TInt aErr); + const TDesC8& LastError(); + void SetErrorL(const TDesC8& aDes, const TInt aErr); +#endif + + /** + The function creates new leaf objects, or replaces data in existing leaf + objects. The information about the success of the command should be + returned by calling SetStatusL function of MSmlDmCallback callback + interface. This makes it possible to buffer the commands. However, all + the status codes for buffered commands must be returned at the latest when + the adapter's CompleteOutstandingCmdsL() is called. + @param aURI URI of the object + @param aLUID LUID of the object (if the adapter has earlier returned a + LUID to the DM Module). For new objects, this is the LUID + inherited through the parent node. + @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 + @publishedPartner + @prototype + */ + void _UpdateLeafObjectL(const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aObject, const TDesC8& aType, TInt aStatusRef, + MSmlDmAdapter::TError& aStatus); + /** + * The function creates new leaf objects, or replaces data in existing leaf + */ + void CloseStreaming(); + + void GetServerInfoL(TSmlProfileId& aProfId, HBufC8*& aServerId) const; + + void SendPendingGenericAlertL(); + + void ASyncReportL(TUint32 aLuid, const TDesC8& aArgument, + const TDownloadTarget aTarget, const TDesC8& aURI); + + void SyncReportL(TUint32 aLuid, const TDesC8& aArgument, + const TDownloadTarget aTarget, const TDesC8& aURI, TError &aRet); + /** + Checks if predefined node for Download object is in tree if not add to the tree + */ + void CheckAndAddPredefinedNodeL(); + /** + Gets predefined node for Download object from cenrep + */ + void GetPredefinedNodeL(TDes8& aNode); + TInt GetAdapterValue(); + void SetAdapterValue(TInt aAdapterValue); + TBool RecognizeMimeType(const TDesC8& aMimeType); + +private: + +#ifdef __TARM_SYMBIAN_CONVERGENCY + RDmTree iDbSession; +#else + RNSmlDMCallbackSession iDbSession; // to change acl location +#endif + + RApplicationManagement iManagement; + TBool iSessionOpened; + TAMCommandBuffer iBuffer; + TBool iInAtomic; + TBool iUpdated; // have we checked changed state DCs? + // Streaming API support + TBool iStreamOpen; + RFileWriteStream iStream; + TInt iStatusRef; + RFs iStreamRFs; + RFile iStreamFile; + TBool iIsStreamedContent; + HBufC8* iStreamedURI; + HBufC8* iStreamedLuid; + HBufC8* iStreamedType; + TBool iCertRequired; + TBool iTrustAdded; + CSCOMOAdapterDb* iAMdb; + TUint iInternalId; +#ifdef __AM_LASTERROR_NODE + HBufC8 *iLastError; +#endif + + HBufC8 *iUriDel; + }; + + } // namespace +#endif // __AMDMADAPTER_H__ +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/inc/omascomoadapterdb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/inc/omascomoadapterdb.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,193 @@ +/* +* 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 applicationmanagement components + * +*/ + +#ifndef __SCOMOADAPTERDB_H +#define __SCOMOADAPTERDB_H + +// INCLUDE FILES + +#include +#include +#include +#include +#include + +// CONSTANTS + +// null final result value +const TInt KAMNullResult = 0; + +// Database name & location +const TInt KAMAdapterDbDrive = EDriveC; +const TUid KAMPolicyUID = + { + 0x20021335 + }; +const TInt KAMMaxPkgURLLength( 2048); +const TInt KAMMaxPkgNameLength( 80); +const TInt KAMMaxPkgVersionLength( 80); + +_LIT( KDBMSSecureID, "secure[20021335]" ); + +_LIT( KAMAdapterDbName, "c:TARMAppMgmtAdapterDB.db" ); + +// Table and column names +_LIT( KTableAMMgmtObject, "AMMgmtObject" ); +_LIT( KAMMgmtObjectId, "Id" ); +_LIT( KAMMgmtObjectProfileId, "ProfileId" ); +_LIT( KAMMgmtObjectServerId, "ServerId" ); +_LIT( KAMMgmtObjectRetryCount, "RetryCount"); + +// SQL statements +_LIT( KCreateAMMgmtObjectTable, "CREATE TABLE AMMgmtObject ( Id \ +COUNTER NOT NULL, ProfileId INTEGER, ServerId CHAR(%d), RetryCount INTEGER" ); + +_LIT( KGetAMMgmtObject, "SELECT * FROM AMMgmtObject WHERE Id = %d" ); + +_LIT( KGetUnfinishedAMMgmtObjectByServerId, "SELECT * FROM AMMgmtObject \ +WHERE Id = %d AND ServerId = '%S'" ); + +_LIT( KDeleteAMMgmtObject,"DELETE FROM AMMgmtObject WHERE Id = %d"); + +// Max. lengths of string fields in AMMgmtObject +const TInt KMaxMgmtUriLength = 60; +const TInt KMaxServerIdLength = 150; +const TInt KMaxCorrelatorLength = 150; + +// Estimate of url size used in max row size (OOD checks) +const TInt KPkgURLLengthEstimate = 350; + +// space needed for above integers in buffer +const TInt KAMMgmtObjectIntLength = 4; + +// space needed for an integer in buffer +const TInt KAMMgmtObjectIntegerLength = 10; + +// Size of empty AM database in bytes (+ additional treshold) +const TInt KAMAdapterEmptyDbSize = 350; + +// Estimated maximum size of AMMgmtObject table row (+ additional treshold) +const TInt KMaxAMMgmtObjectRowSize = KAMMaxPkgNameLength + + KAMMaxPkgVersionLength + KPkgURLLengthEstimate + KMaxMgmtUriLength + + KMaxServerIdLength + KMaxCorrelatorLength + 115; + +// TYPEDEFS +typedef TInt TDmAMObjectId; +typedef RArray RDmAMObjectArray; + +_LIT(NCol1, "Id"); +_LIT(NCol2, "LUID"); +_LIT(NCol3, "ProfileId"); +_LIT(NCol4, "ServerId"); +_LIT(NCol5, "Correlator"); +_LIT(NCol6, "SourceURI"); +_LIT(NCol7, "RetryCount"); + +class CAMDbItem : public CBase + { +public: + static CAMDbItem* NewL(); + ~CAMDbItem(); + + TInt id; + TUint32 iLUID; + TInt iProfileId; + + HBufC8* iServerID; + HBufC8* iCorrelator; + HBufC8* iSourceURI; + TInt iRetryCount; + + }; + +// CLASS DECLARATION + +/** + * CSCOMOAdapterDb provides an interface for accessing AM database. + * + * @lib SCOMOAdapter.lib + * + */ +class CSCOMOAdapterDb : public CBase + { + +public: + + /** + * Two-phased constructor. + * @return A pointer to the newly created instance. + */ + static CSCOMOAdapterDb* NewL(); + + /** + * Two-phased constructor. Pushes the pointer onto the CleanupStack. + * @return A pointer to the newly created instance. + */ + static CSCOMOAdapterDb* NewLC(); + + /** + * Destructor. + */ + virtual ~CSCOMOAdapterDb(); + + void CreateTableL(RDbDatabase& aDatabase); + + void CreateandOpenL(TParse& name); + + TBool DeleteFromDatabaseL(TUint32 aLuid); + + void SaveToDatabaseL(TInt& aIndex, TUint32 aLuid, TInt aProfileid, + TInt aRetryCount, const TDesC8& aSourceURI, + const TDesC8& aServerid, const TDesC8& aCorrelator); + + void ReadItemsL(RPointerArray& aItemArray, TDesC& aSqlQuery); + + void ReadDbItemsL(RPointerArray& aItemArray); + + void GetEntryForServerIDL(RPointerArray& aItemArray, TDesC8& aValue); + + void UpdateRetryCountForLuidL(TInt aLuid, TInt aRetryCount); + + TInt GetRetryCountForLuidL(TInt aLuid); + + void BeginDatabaseTransaction(); + + void CommitDatabaseTransaction(); + + void PrepareLuidQuery(TInt aLuid, TDes& aSqlQuery); + + +private: + + void ConstructL(); + + CSCOMOAdapterDb(); + +private: + + RDbNamedDatabase iDatabase; + RFs iFsSession; + RDbs iRdbSession; + + RDbTable iAMObjectTable; + CDbColSet* iColSet; + RDbView iView; + + }; + +#endif // __AMADAPTERDB_H +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/src/20021335.SPD Binary file applicationmanagement/omascomoadapter/src/20021335.SPD has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/src/20021335.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/src/20021335.txt Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,10 @@ +[database] +read +capability = ReadDeviceData +write +capability = WriteDeviceData +schema +capability = WriteDeviceData + +[backup] +SID = 101F8597 diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/src/nsmldmiapmatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/src/nsmldmiapmatcher.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,235 @@ +/* +* 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 applicationmanagement components + * +*/ + + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ + +#include +#include "nsmldmiapmatcher.h" +#include +#include + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewL( MSmlDmCallback* aDmCallback ) +// ------------------------------------------------------------------------------------------------ +CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewL( + MSmlDmCallback* aDmCallback ) + { + CNSmlDMIAPMatcher* self = CNSmlDMIAPMatcher::NewLC( aDmCallback ); + CleanupStack::Pop(); + return self; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewLC( MSmlDmCallback* aDmCallback ) +// ------------------------------------------------------------------------------------------------ +CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewLC( + MSmlDmCallback* aDmCallback ) + { + CNSmlDMIAPMatcher* self = new( ELeave ) CNSmlDMIAPMatcher; + CleanupStack::PushL( self ); + self->ConstructL( aDmCallback ); + return self; + } + +// ------------------------------------------------------------------------------------------------ +// void CNSmlDMIAPMatcher::ConstructL( MSmlDmCallback* aDmCallback ) +// ------------------------------------------------------------------------------------------------ +void CNSmlDMIAPMatcher::ConstructL( MSmlDmCallback* aDmCallback ) + { + iCallback = aDmCallback; + FeatureManager::InitializeLibL(); + iFeatMgrInitialized = ETrue; + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher::~CNSmlDMIAPMatcher() +// ------------------------------------------------------------------------------------------------ +CNSmlDMIAPMatcher::~CNSmlDMIAPMatcher() + { + if(iFeatMgrInitialized) + { + FeatureManager::UnInitializeLib(); + } + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlDMIAPMatcher::IAPIdFromURIL( const TDesC8& aURI ) +// ------------------------------------------------------------------------------------------------ +TInt CNSmlDMIAPMatcher::IAPIdFromURIL( const TDesC8& aURI ) + { + TInt iapId(KErrNotFound); + + MSmlDmAdapter::TError status; + CBufBase* allIAPs = CBufFlat::NewL(16); + CleanupStack::PushL(allIAPs); + iCallback->FetchLinkL( GetConRef(), *allIAPs, status ); + TPtrC8 uri = RemoveDotSlash(aURI); + + if( status == MSmlDmAdapter::EOk && + uri.Find(GetConRef()) == 0 && + allIAPs->Ptr(0).Find(LastURISeg(uri))>=0) + { + HBufC8* luid = iCallback->GetLuidAllocL( uri ); + + if ( luid->Length() ) + { + iapId = DesToInt(*luid); + } + delete luid; + } + + CleanupStack::PopAndDestroy(allIAPs); + + return iapId; + } + +// ------------------------------------------------------------------------------------------------ +// HBufC8* CNSmlDMIAPMatcher::URIFromIAPIdL( TInt aIAPId ) +// ------------------------------------------------------------------------------------------------ +HBufC8* CNSmlDMIAPMatcher::URIFromIAPIdL( TInt aIAPId ) + { + CBufBase *allIAPs = CBufFlat::NewL(16); + CleanupStack::PushL(allIAPs); + MSmlDmAdapter::TError status; + + iCallback->FetchLinkL( GetConRef(), *allIAPs, status ); + + if ( status == MSmlDmAdapter::EOk ) + { + TInt index(0); + TInt segStart(0); + + while ( index != KErrNotFound) + { + TPtrC8 allIAPsptr = allIAPs->Ptr(segStart).Mid(0); + index = allIAPsptr.Locate('/'); + HBufC8* uriSeg = 0; + + if ( index == KErrNotFound ) + { + TPtrC8 uriSeg8Ptr = allIAPs->Ptr(segStart); + uriSeg = uriSeg8Ptr.AllocLC(); + } + else + { + TPtrC8 uriSeg8Ptr = allIAPs->Ptr(segStart).Mid( 0, index ); + uriSeg = uriSeg8Ptr.AllocLC(); + } + + HBufC8* uri = HBufC8::NewLC( GetConRef().Length() + 1 + + uriSeg->Length() ); + + TPtr8 uriPtr = uri->Des(); + uriPtr.Format( GetConRef()); + uriPtr.Append( KNSmlDMSeparator8 ); + uriPtr.Append( *uriSeg ); + HBufC8* luid = iCallback->GetLuidAllocL( uriPtr ); + CleanupStack::PushL(luid); + + if ( luid->Length() > 0 ) + { + TInt iapId = DesToInt(luid->Des()); + if ( iapId == aIAPId ) + { + CleanupStack::PopAndDestroy(); //luid + CleanupStack::Pop(); //uri + CleanupStack::PopAndDestroy(2); //uriSeg, allIAPs + return uri; + } + } + CleanupStack::PopAndDestroy(3); // luid, uri, uriSeg + + segStart += index + 1; + } + } + + CleanupStack::PopAndDestroy(); // allIAPs + + return 0; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlDMIAPMatcher::DesToInt(const TDesC& aLuid) +// ------------------------------------------------------------------------------------------------ +TInt CNSmlDMIAPMatcher::DesToInt(const TDesC8& aLuid) const + { + TLex8 lex(aLuid); + TInt value = 0; + lex.Val(value); + return value; + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 CNSmlDMIAPMatcher::RemoveDotSlash(const TDesC8& aURI) const +// ------------------------------------------------------------------------------------------------ +TPtrC8 CNSmlDMIAPMatcher::RemoveDotSlash(const TDesC8& aURI) const + { + if(aURI.Find(KNSmlDMIAPUriDotSlash)==0) + { + return aURI.Right( aURI.Length()-KNSmlDMIAPUriDotSlash().Length() ); + } + else + { + return aURI; + } + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher::TPtrC8 LastURISeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ------------------------------------------------------------------------------------------------ +TPtrC8 CNSmlDMIAPMatcher::LastURISeg(const TDesC8& aURI) const + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMSlash) + { + break; + } + } + if(i==0) + { + return aURI; + } + else + { + return aURI.Mid(i+1); + } + } + +// ------------------------------------------------------------------------------------------------ +// CNSmlDMIAPMatcher::const TDesC8& GetConRef() +// Returns the connection reference +// ------------------------------------------------------------------------------------------------ +const TDesC8& CNSmlDMIAPMatcher::GetConRef() + { + if(FeatureManager::FeatureSupported(KFeatureIdFfDmConnmoAdapter)) + { + return KNSmlDMConnMOIAPUri(); + } + else + { + return KNSmlDMIAPUri(); + } + } + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/src/nsmldmuri.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/src/nsmldmuri.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,208 @@ +/* +* 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 applicationmanagement components + * +*/ + + +#include "nsmldmuri.h" + +// =========================================================================== +// NSmlDmURI +// =========================================================================== + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::ParentURI(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::ParentURI(const TDesC8& aURI) + { + TBool onlyOneSeg = ETrue; + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]==KNSmlDMUriSeparator) + { + onlyOneSeg = EFalse; + break; + } + } + if(onlyOneSeg) + { + return KNSmlDmRootUri(); + } + else + { + return aURI.Left(i); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::LastURISeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::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); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI) +// return uri without dot and slash in start +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI) + { + + TInt offset = 0; + TInt endSlash = 0; + + if(aURI.Find(KNSmlDmUriDotSlash)==0) + { + offset = 2; + } + else + { + return aURI; + } + + if(aURI.Length()>2&&aURI[aURI.Length()-1]==KNSmlDMUriSeparator) + { + endSlash = 1; + } + + return aURI.Mid(offset,aURI.Length()-endSlash-offset); + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI) +// removes property from the uri +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI) + { + TInt offset = aURI.Find(KNSmlDmQuestionMark); + if(offset!=KErrNotFound) + { + return aURI.Left(offset); + } + return aURI; + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveLastSeg(const TDesC8& aURI) +// Removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::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 NSmlDmURI::URISeg(const TDesC8& aURI,TInt aLocation) +// Returns the aLocation:th URI segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::URISeg(const TDesC8& aURI,TInt aLocation) + { + TInt begin=0; + TInt end; + TInt num=0; + + for(end=0;end +#include +#include +#include "omascomoadapter.h" +#include // For TImplementationProxy definition +#include +#include "nsmldmuri.h" +#include "nsmldmiapmatcher.h" +#include "debug.h" +#include "amprivateCRKeys.h" +#include +#include "aminstalloptions.h" +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "NSmlPrivateAPI.h" + +#include "nsmldmconst.h" +#include "ampskeys.h" + +#include "nsmldmtreedbclient.h" +//#include "SyncService.h" +#include "amprivateCRKeys.h" +#include +#include + +#ifdef __TARM_SYMBIAN_CONVERGENCY +#include +#include +#include "nsmldmuri.h" + +// Constants +_LIT8( KDeployedURI, "./SCOMO/Inventory/Deployed/" ); +_LIT8( KDeliveredURI, "./SCOMO/Inventory/Delivered/" ); +_LIT8( KDownloadURI, "./SCOMO/Download/" ); +#else +#include + +// Constants +_LIT8( KDeployedURI, "SCOMO/Inventory/Deployed/" ); +_LIT8( KDeliveredURI, "SCOMO/Inventory/Delivered/" ); +_LIT8( KDownloadURI, "SCOMO/Download/" ); +#endif + +#ifdef __NSML_DEBUG__ +#pragma message("NSml Debugging is ON!") +#else +#endif + +using namespace NApplicationManagement; + +_LIT8( KAMStateValueActive, "20" ); +_LIT8( KAMStateValueInactive, "10" ); +_LIT8( KAMStateValueDelivered, "10" ); + +_LIT8( KSisxMimeType, "x-epoc/x-sisx-app" ); +_LIT8( KSisMimeType, "application/vnd.symbian.install" ); +_LIT8( KPipMimeType, "application/x-pip" ); +_LIT8( KJadMIMEType, "text/vnd.sun.j2me.app-descriptor" ); +_LIT8( KJarMIMEType, "application/java-archive" ); +_LIT8( KJavaMIMEType, "application/java" ); + + + +const TUint8 KNSmlDMAMSeparatorDef = 0x2f; //forward slash +#ifdef __AM_LASTERROR_NODE + +#ifdef __TARM_SYMBIAN_CONVERGENCY +_LIT8( KAMLastErrorURI, "./SCOMO/Ext/LastError" ); +#else +_LIT8( KAMLastErrorURI, "SCOMO/Ext/LastError" ); +#endif +_LIT8( KStdError, "Error %d" ); + +#define MAPERROR(x,y,z) DefaultMapError(x,y,z) +#else + +#define MAPERROR(x,y,z) DefaultMapError(x,y) +#endif + + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter* CSCOMOAdapter::NewL( ) +// ------------------------------------------------------------------------------------------------ +CSCOMOAdapter* CSCOMOAdapter::NewL(MSmlDmCallback* aDmCallback) + { + RDEBUG("CSCOMOAdapter::NewL(): begin"); + + CSCOMOAdapter* self = NewLC(aDmCallback); + CleanupStack::Pop(); + return self; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter* CSCOMOAdapter::NewLC( ) +// ------------------------------------------------------------------------------------------------ +CSCOMOAdapter* CSCOMOAdapter::NewLC(MSmlDmCallback* aDmCallback) + { + CSCOMOAdapter* self = new( ELeave ) CSCOMOAdapter( aDmCallback ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::CSCOMOAdapter() +// ------------------------------------------------------------------------------------------------ +CSCOMOAdapter::CSCOMOAdapter(TAny* aEcomArguments) : + CSmlDmAdapter(aEcomArguments), iSessionOpened(EFalse), iBuffer( 8), + iInAtomic(EFalse), iUpdated(EFalse), iIsStreamedContent(EFalse) + { + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::~CSCOMOAdapter() +// ------------------------------------------------------------------------------------------------ +CSCOMOAdapter::~CSCOMOAdapter() + { + RDEBUG( "CSCOMOAdapter::~CSCOMOAdapter" ); + iDbSession.Close(); + iManagement.Close(); // make sure we're closed + iSessionOpened = EFalse; + iBuffer.Close(); + + CloseStreaming(); // Ensures that no streams are left open and that the temporary file is removed + + delete iStreamedURI; + delete iStreamedLuid; + delete iStreamedType; + +#ifdef __AM_LASTERROR_NODE + delete iLastError; +#endif + + if (iAMdb) + delete iAMdb; + + if (iUriDel) + delete iUriDel; + RDEBUG( "CSCOMOAdapter::~CSCOMOAdapter end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::DDFVersionL() +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + aDDFVersion.InsertL( 0, KAMDDFVersion); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::DDFStructureL() +// +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::DDFStructureL(MSmlDmDDFObject& aDDF) + { + RDEBUG( "CSCOMOAdapter::DDFStructureL(): begin" ); + + TSmlDmAccessTypes accessTypesGet; + accessTypesGet.SetGet(); + + TSmlDmAccessTypes accessTypesExec; + accessTypesExec.SetExec(); + + TSmlDmAccessTypes accessTypesAdd; + accessTypesAdd.SetAdd(); + + TSmlDmAccessTypes accessTypesExecReplace = accessTypesExec; + accessTypesExecReplace.SetReplace(); + + TSmlDmAccessTypes accessTypesGetAdd = accessTypesGet; + accessTypesGetAdd.SetAdd(); + + TSmlDmAccessTypes accessTypesGetReplace = accessTypesGet; + accessTypesGetReplace.SetGet(); + + TSmlDmAccessTypes accessTypesGetAddReplace = accessTypesGetAdd; + accessTypesGetAddReplace.SetReplace(); + + TSmlDmAccessTypes accessTypesGetAddReplaceDelete = + accessTypesGetAddReplace; + accessTypesGetAddReplaceDelete.SetDelete(); + + TSmlDmAccessTypes accessTypesAddReplace = + accessTypesAdd; + accessTypesAddReplace.SetReplace(); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step1" ); + + /* + Node: ./SCOMO + AM node is the common parent to all application management functionality nodes. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get + Values: N/A + */ + //MSmlDmDDFObject& root = aDDF.AddChildObjectGroupL(); + MSmlDmDDFObject& am = aDDF.AddChildObjectL(KAMNodeName); + FillNodeInfoL(am, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMNodeDescription); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 2" ); + + /* + Node: ./SCOMO/Inventory + This node is start node to application inventory. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& inv = am.AddChildObjectL(KAMInventoryNodeName); + FillNodeInfoL(inv, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMInventoryNodeDescription); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 3" ); + + /* + Node: ./SCOMO/Inventory/Delivered + This is node under which applications that are delivered but not installed are found. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get, Add + Values: N/A + */ + MSmlDmDDFObject& del = inv.AddChildObjectL(KAMDeliveredNodeName); + FillNodeInfoL(del, accessTypesGetAdd, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMDeliveredNodeDescription); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 4" ); + + /* + Node: ./SCOMO/Inventory/Deployed + This is a node under which active applications are found. + The child node descriptions are same as Delivered sibling node, except that cannot be created, data node does not exist and there's no InstallOpts leaf. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get + Values: N/A + */ + + MSmlDmDDFObject& ac = inv.AddChildObjectL(KAMDeployedNodeName); + FillNodeInfoL(ac, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMDeployedNodeDescription); + + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 5" ); + /* + Node: ./SCOMO/Inventory/Delivered/ + This dynamic node is placeholder applications that are in Delivered state. + Support: Mandatory + Occurs: ZeroOrMore + Format: Node + Access Types: Get, Add, Replace, Delete + Values: N/A + */ + MSmlDmDDFObject& deldyna = del.AddChildObjectGroupL(); + FillNodeInfoL(deldyna, accessTypesGetAddReplaceDelete, + MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KAMDeliveredDynaNodeDescription); + + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 6" ); + /* + Node: ./SCOMO/Inventory/Delivered//PkgID + This leaf node holds an identifier for an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get, Add, Replace + Values: N/A + */ + MSmlDmDDFObject& delid = deldyna.AddChildObjectL(KAMPkgIDNodeName); + FillNodeInfoL(delid, accessTypesGetAddReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMPkgIDNodeDescription); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 7" ); + /* + Node: ./SCOMO/Inventory/Delivered//Name + This leaf node holds name of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get ( + Add, Replace access within Delivered node only) + Values: N/A + */ + MSmlDmDDFObject& delname = deldyna.AddChildObjectL(KAMNameNodeName); + FillNodeInfoL(delname, accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMNameNodeDescription); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 8" ); + /* + Node: ./SCM/Inventory/Delivered//Status + This leaf node holds the status of the Delivered. The client updates the node value. + The values are typically error codes of Operations done on delivered node + Support: Mandatory + Occurs: One + Format: Int + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& delstatus = deldyna.AddChildObjectL(KAMStatusNodeName); + FillNodeInfoL(delstatus, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EInt, + KAMStatusNodeDescription); + + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 9" ); + /* + Node: ./SCOMO/Inventory/Delivered//PkgType + This leaf node holds an identifier for an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& delpkgtype = deldyna.AddChildObjectL(KAMPkgTypeNodeName); + FillNodeInfoL(delpkgtype, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMPkgTypeNodeDescription); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 10" ); + /* + Node: ./SCOMO/Inventory/Delivered//Data + This leaf node holds the data of an application. + Support: Mandatory + Occurs: One + Format: Bin + Access Types: Add, Replace + Values: N/A + */ + MSmlDmDDFObject& delda = deldyna.AddChildObjectL(KAMDataNodeName); + FillNodeInfoNoDefaultMimeL(delda, accessTypesAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EBin, KAMDataNodeDescription); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 11" ); + + delda.AddDFTypeMimeTypeL(KSisxMimeType); + delda.AddDFTypeMimeTypeL(KSisMimeType); + delda.AddDFTypeMimeTypeL(KPipMimeType); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 12" ); + + FeatureManager::InitializeLibL(); + if (FeatureManager::FeatureSupported(KFeatureIdJavaMIDP20) ) + { + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 13" ); + delda.AddDFTypeMimeTypeL(KJadMIMEType); + delda.AddDFTypeMimeTypeL(KJarMIMEType); + delda.AddDFTypeMimeTypeL(KJavaMIMEType); + } + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 14" ); + FeatureManager::UnInitializeLib(); + + /* + Node: ./SCOMO/Inventory/Delivered//Description + This leaf node holds the possible metadata of an application. Descriptor can be for example such a data that is required by the actual data in the Data leaf, but for some reason they cannot be bundled into same package. An example is Java JAR and JAD file combination, in which JAD file could be placed in MetaData and JAR in Data leaf. + Support: Optional + Occurs: One + Format: Bin + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& delmd = deldyna.AddChildObjectL(KAMDescriptionNodeName); + FillNodeInfoL(delmd, accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EBin, KAMDescriptorNodeDescription); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 15" ); + /* + Node: ./SCOMO/Inventory/Delivered//State + This leaf node holds state value of an application. + Support: ? + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& delstate = + deldyna.AddChildObjectL(KAMStateValueNodeName); + FillNodeInfoL(delstate, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMStateValueNodeDescription); + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 16" ); + /* + Node: ./SCOMO/Inventory/Delivered//Operations + This is a node that allows vendors to extend functionality. + Support: Optional + Occurs: One + Format: Node + Access Types: Get, Replace, Add, Delete + Values: N/A + */ + MSmlDmDDFObject& delop = deldyna.AddChildObjectL(KAMOperationsNodeName); + FillNodeInfoL(delop, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMOperationsNodeDescription); + + /* + Node: ./SCOMO/Inventory/Delivered//Operations/Install + Exec command causes device to install a delivered application. The data inside + exec command refers to the application to be installed. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& loinst = delop.AddChildObjectL(KAMInstallNodeName); + FillNodeInfoL(loinst, accessTypesExecReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMInstallNodeDescription); + + /* + Node: ./SCOMO/Inventory/Delivered//Operations/InstallInactive + Exec command causes device to install a delivered application. The data inside + exec command refers to the application to be installed. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& loinstact = + delop.AddChildObjectL(KAMInstallInactiveNodeName); + FillNodeInfoL(loinstact, accessTypesExecReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMInstallInactivateNodeDescription); + + + /* + Node: ./SCOMO/Inventory/Delivered//Operations/Remove + Exec command causes device to remove an application. The data inside exec command refers to the application to be removed. The application must be in Inactive state in order for remove to be successful. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& lorem = delop.AddChildObjectL(KAMRemoveNodeName); + FillNodeInfoL(lorem, accessTypesExecReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMRemoveNodeDescription); + + /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + DEPLOYED + *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 17" ); + /* + Node: ./SCOMO/Inventory/Deployed/ + This dynamic node is placeholder applications that are in Inactive state. + Support: Mandatory + Occurs: ZeroOrMore + Format: Node + Access Types: Get, Replace + Values: N/A + */ + MSmlDmDDFObject& depldyna = ac.AddChildObjectGroupL(); + FillNodeInfoL(depldyna, accessTypesGetReplace, + MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KAMDeployedDynaNodeDescription); + + /* + Node: ./SCOMO/Inventory/Deployed//ID + This leaf node holds an identifier for an application. This cannot be changed. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& deplid = depldyna.AddChildObjectL(KAMIDNodeName); + FillNodeInfoL(deplid, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMIDNodeDescription); + + /* + Node: ./SCOMO/Inventory/Deployed//Name + This leaf node holds name of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get, Add, Replace + Values: N/A + */ + MSmlDmDDFObject& deplname = depldyna.AddChildObjectL(KAMNameNodeName); + FillNodeInfoL(deplname, accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMNameNodeDescription); + + /* + Node: ./SCOMO/Inventory/Deployed//Version + This leaf node holds the version of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get, Add, Replace + Values: N/A + */ + MSmlDmDDFObject& deplver = depldyna.AddChildObjectL(KAMVersionNodeName); + FillNodeInfoL(deplver, accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMVersionNodeDescription); + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 18" ); + /* + Node: ./SCOMO/Inventory/Deployed//Description + This leaf node holds the version of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get, Add, Replace + Values: N/A + */ + MSmlDmDDFObject& depldesc = depldyna.AddChildObjectL(KAMDescriptionNodeName); + FillNodeInfoL(depldesc, accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMDescriptionNodeDescription); + + /* + Node: ./SCOMO/Inventory/Deployed//PkgIDRef + This leaf node holds an identifier for an application. This cannot be changed. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& deplidref = depldyna.AddChildObjectL(KAMPkgIDRefNodeName); + FillNodeInfoL(deplidref, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMPkgIDRefNodeDescription); + + /* + Node: ./SCOMO/Inventory/Deployed//Status + This leaf node holds the status of the Deployed. The client updates the node value. + The values are typically error codes of Operations done on deployed node + Support: Mandatory + Occurs: One + Format: Int + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& deplstatus = depldyna.AddChildObjectL(KAMStatusNodeName); + FillNodeInfoL(deplstatus, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EInt, + KAMStatusNodeDescription); + + /* + Node: ./SCOMO/Inventory/Deployed//State + This leaf node holds state value of an application. + Support: ? + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& deplstate = + depldyna.AddChildObjectL(KAMStateValueNodeName); + FillNodeInfoL(deplstate, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMStateValueNodeDescription); + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 19" ); + /* + Node: ./SCOMO/Inventory/Deployed//Operations + This is a node that allows vendors to extend functionality. + Support: Optional + Occurs: One + Format: Node + Access Types: Get, Replace, Add, Delete + Values: N/A + + */ + MSmlDmDDFObject& deplop = depldyna.AddChildObjectL(KAMOperationsNodeName); + FillNodeInfoL(deplop, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMOperationsNodeDescription); + + /* + Node: ./SCOMO/Inventory/Deployed//Operations/Remove + Exec command causes device to remove an application. The data inside exec command + refers to the application to be removed. The application must be in Inactive state + in order for remove to be successful. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& deplrem = deplop.AddChildObjectL(KAMRemoveNodeName); + FillNodeInfoL(deplrem, accessTypesExecReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMRemoveNodeDescription); + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 20" ); + /* + Node: ./SCOMO/Inventory/Deployed//Operations/Activate + Exec command causes device to activate an application. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& deplac = deplop.AddChildObjectL(KAMActivateNodeName); + FillNodeInfoL(deplac, accessTypesExecReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMActivateNodeDescription); + + /* + Node: ./SCOMO/Inventory/Deployed//Operations/Deactivate + Exec command causes device to deactivate an application. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec, Replace + Values: N/A + */ + MSmlDmDDFObject& depldeac = deplop.AddChildObjectL(KAMDeActivateNodeName); + FillNodeInfoL(depldeac, accessTypesExecReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMDeActivateNodeDescription); + + /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= + DOWNLOAD + *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ + + /* + Node: ./SCOMO/Download + This node is a root node for application download functionality. In practice download + works so that admin adds nodes under this node, and they are automatically moved to + Inventory/Delivered when the download has been finished. Running get command targeting + to this node returns a list of pending downloads. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get, Add, Replace + Values: N/A + */ + MSmlDmDDFObject& dow = am.AddChildObjectL(KAMDownloadNodeName); + FillNodeInfoL(dow, accessTypesGetAddReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMDownloadNodeDescription); + + /* + Node: ./SCOMO/Download/ + This node is a placeholder for identifier of an application that is to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Get, Add, Replace, Delete + Values: N/A + */ + MSmlDmDDFObject& dowdyna = dow.AddChildObjectGroupL(); + FillNodeInfoL(dowdyna, accessTypesGetAddReplaceDelete, + MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KAMDownloadDynaNodeDescription); + + /* + Node: ./SCOMO/Download//PkgID + This leaf node holds an identifier for an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& dowid = dowdyna.AddChildObjectL(KAMPkgIDNodeName); + FillNodeInfoL(dowid, accessTypesGetAddReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMPkgIDNodeDescription); + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 21" ); + /* + Node: ./SCOMO/Download//Name + This leaf node holds name of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& downame = dowdyna.AddChildObjectL(KAMNameNodeName); + FillNodeInfoL(downame, accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMNameNodeDescription); + + + /* + Node: ./SCOMO/Download//PkgURL + This leaf node holds the URL from which the application should be downloaded. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& dowuri = dowdyna.AddChildObjectL(KAMURINodeName); + FillNodeInfoL(dowuri, accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMURINodeDescription); + + /* + Node: /SCOMO/Download//PkgType + This leaf node holds an identifier for an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& dowpkgtype = dowdyna.AddChildObjectL(KAMPkgTypeNodeName); + FillNodeInfoL(dowpkgtype, accessTypesGetAddReplace, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMPkgTypeNodeDescription); + + /* + Node: ./SCOMO/Download//Status + This leaf node holds the status of the download. The client updates the node value. The values are typically error codes of download protocol. Initially after the URI leaf is filled, this will get value 100, and will be replaced by one. + Support: Optional + Occurs: One + Format: Chr + Access Types: Get + Values: N/A + */ + MSmlDmDDFObject& dowstat = dowdyna.AddChildObjectL(KAMStatusNodeName); + FillNodeInfoL(dowstat, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMStatusNodeDescription); + + /* + Node: ./SCOMO/Download//Description + This leaf node holds the version of an application. + Support: Mandatory + Occurs: One + Format: Chr + Access Types: Add, Get, Replace + Values: N/A + */ + MSmlDmDDFObject& dowver = dowdyna.AddChildObjectL(KAMDescriptionNodeName); + FillNodeInfoL(dowver, accessTypesGetAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, KAMDescriptionNodeDescription); + + + /* + Node: ./SCOMO/Download//Operations + This is a node that holds the operation nodes. + Support: Optional + Occurs: One + Format: Node + Access Types: Get, Replace, Add, Delete + Values: N/A + + */ + MSmlDmDDFObject& dowop = dowdyna.AddChildObjectL(KAMOperationsNodeName); + FillNodeInfoL(dowop, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMOperationsNodeDescription); + + /* + Node: ./SCOMO/Download//Operations/Download + Exec command causes device to download an application. The dynamic node specifies the application to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec + Values: N/A + */ + MSmlDmDDFObject& dowdown = + dowop.AddChildObjectL(KAMDownloadOperationNodeName); + FillNodeInfoL(dowdown, accessTypesExecReplace, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMDownloadOperationNodeDescription); + + /* + Node: ./SCOMO/Download//Operations/DownloadInstall + Exec command causes device to download and install an application. The dynamic node specifies the application to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec + Values: N/A + */ + MSmlDmDDFObject& dowdowni = + dowop.AddChildObjectL(KAMDownloadAndInstallNodeName); + FillNodeInfoL(dowdowni, accessTypesExec, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMDownloadAndInstallOperationNodeDescription); + + /* + Node: ./SCOMO/Download//Operations/DownloadInstallInactive + Exec command causes device to download and install and activate an application. The dynamic node specifies the application to be downloaded. + Support: Mandatory + Occurs: One + Format: Node + Access Types: Exec + Values: N/A + */ + MSmlDmDDFObject& dowdownia = + dowop.AddChildObjectL(KAMDownloadAndInstallAndInActivateNodeName); + FillNodeInfoL(dowdownia, accessTypesExec, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMDownloadAndInstallAndInActivateNodeName); + + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 22" ); +#ifdef __AM_LASTERROR_NODE + MSmlDmDDFObject& amext = am.AddChildObjectL(KAMExtNodeName); + FillNodeInfoL(amext, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, + KAMExtNodeDescription); + + MSmlDmDDFObject& amerr = amext.AddChildObjectL(KAMLastErrorNodeName); + FillNodeInfoL(amerr, accessTypesGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, + KAMLastErrorDescription); +#endif + + // Ignore generic alert error status if any otherwise adapter fails to load + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 23" ); + TRAP_IGNORE(SendPendingGenericAlertL()); + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 24" ); + //if (GetAdapterValue() == KAMSCOMOAdapter) + { + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 25" ); + CheckStateChangesL(); + SetAdapterValue(KAMDefaultValue); + } + RDEBUG( "CSCOMOAdapter::DDFStructureL(): Step 26" ); + CheckAndAddPredefinedNodeL(); + RDEBUG( "CSCOMOAdapter::DDFStructureL(): end" ); + } + +void CSCOMOAdapter::SendPendingGenericAlertL() + { + + // get information of the remote DM server + TSmlProfileId profId = 0; + HBufC8* serverId= NULL; + TBuf8 scomometatype; + TBuf8 scomometaformat; + TBuf8 scomomark; + + TBuf8<512> targetURIGet; + + TUint32 internalid = KErrNone; + TInt finalresult = KErrNone; + TInt i =0; + + // Get all the generic alert parameters from cenrep + // to construct generic alert message + CRepository *repository=CRepository::NewLC ( KCRUidPrivateApplicationManagementKeys ); + repository->Get(KSCOMOMetaTypeKey,scomometatype); + repository->Get(KSCOMOMetaFormatKey,scomometaformat); + repository->Get(KSCOMOMark,scomomark); + CleanupStack::PopAndDestroy(); + + // Retrive server info of current DM Session + + GetServerInfoL(profId, serverId); + CleanupStack::PushL(serverId); + + RPointerArray genericalerts; + + + // Get generic alert entry from Database for particular server ID. + TRAPD(err, iAMdb->GetEntryForServerIDL(genericalerts, *serverId)); + + + // Send Pending generic alerts for server + + for(i=0; iiLUID; + + // Get Target URI and Final Generic Alert result from App. Mgmt. Server + // database. + + TRAPD(err, SessionL().GetFinalResultsForGAL(internalid, finalresult, + targetURIGet)); + + // If data in SCOMO DB is inconsistent with AM Server DB or + // if it exceeds retry count then delete that entry from adapter + // and server database + + if(finalresult <= KErrNone || err!=KErrNone) + { + iAMdb->DeleteFromDatabaseL(internalid); + User::Leave(KErrGeneral); + } + + + TBuf8<6> dataresult; + dataresult.Num(finalresult); + + TPtrC8 mapping(NSmlDmURI::LastURISeg(targetURIGet) ); + + + TInt retryupdate = iAMdb->GetRetryCountForLuidL(internalid); + + // If retryupdate in Zero then delete its entry from + // database. + + if(retryupdate == KErrNone) + { + iAMdb->DeleteFromDatabaseL(internalid); + SessionL().GenericAlertSentL(internalid); + User::Leave(KErrCompletion); + } + + // Decrement the retry count and update in database for + // that internalid. + iAMdb->UpdateRetryCountForLuidL(internalid, --retryupdate); + + + + // open handle to private api + + RNSmlPrivateAPI privateAPI; + privateAPI.OpenL(); + CleanupClosePushL(privateAPI); + + RArray iItemArray; + + + CNSmlDMAlertItem* item = new (ELeave) CNSmlDMAlertItem ; + + HBufC8 *data = HBufC8::NewL(1024); + + TPtr8 ptr = data->Des(); + //ptr.Append(KDataStart); + ptr.Append(KResultCodeStart); + ptr.Append(dataresult); + ptr.Append(KResultCodeEnd); + ptr.Append(KIdentifierStart); + ptr.Append(mapping); + ptr.Append(KIdentifierEnd); + //ptr.Append(KDataEnd); + + HBufC8 *sourceuri = genericalerts[i]->iSourceURI; + + item->iSource = sourceuri; + + HBufC8 *targeturi = targetURIGet.AllocL(); + + item->iTarget = targeturi; + + HBufC8 *metatype = scomometatype.AllocL(); + + item->iMetaType = metatype; + + HBufC8 *metaformat = scomometaformat.AllocL(); + + item->iMetaFormat = metaformat; + + HBufC8 *metamark = scomomark.AllocL(); + + item->iMetaMark = metamark; + + item->iData = data; + + iItemArray.AppendL(*item); + + TRAP_IGNORE(privateAPI.AddDMGenericAlertRequestL( + *genericalerts[i]->iCorrelator,iItemArray )); + + + delete data; + + delete metamark; + + delete metaformat; + + delete metatype; + + delete targeturi; + delete item; + + iItemArray.Reset(); + iItemArray.Close(); + CleanupStack::PopAndDestroy( &privateAPI); + } + } + genericalerts.ResetAndDestroy(); + CleanupStack::PopAndDestroy(); //serverid + + + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::SessionL() +// ------------------------------------------------------------------------------------------------ +RApplicationManagement &CSCOMOAdapter::SessionL() + { + if ( !iSessionOpened) + { + TCertInfo info; + + const TUid KCentralRepositoryUid = + { + 0x10207843 + }; + const TInt KCertKey = 0x01; + CRepository *re= NULL; + TRAPD( errx, re = CRepository::NewL ( KCentralRepositoryUid ) ); + if (errx == KErrNone && re) + { + TPckg pcert(info); + errx = re->Get(KCertKey, pcert) ; + + RDEBUG_2("aCertInfo.iFingerprint.Length() is %u",info.iFingerprint.Length() ); + if (errx == KErrNone) + { + RDEBUG("CSCOMOAdapter::SessionL() errx == KErrNone"); + } + else + { + if (errx != KErrNotFound) + { + RDEBUG("CSCOMOAdapter::SessionL() errx != KErrNotFound"); + } + else + { + RDEBUG("CSCOMOAdapter::SessionL() errx == KErrNotFound"); + } + + } + delete re; + } + + if (errx == KErrNotFound || !iCertRequired) + { + RDEBUG("CSCOMOAdapter::SessionL() calling iManagement.Connect()"); + User::LeaveIfError(iManagement.Connect() ); + iSessionOpened = ETrue; + iTrustAdded = EFalse; + } + else + { + RDEBUG("CSCOMOAdapter::SessionL() calling iManagement.Connect( info )"); + User::LeaveIfError(iManagement.Connect(info) ); + iSessionOpened = ETrue; + iTrustAdded = ETrue; + } + } + return iManagement; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::UpdateLeafObjectL() +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::UpdateLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType, + TInt aStatusRef) + { + RDEBUG8_4("CSCOMOAdapter::UpdateLeafObjectL(): begin, '%S', '%S' '%S'", &aURI, &aLUID, &aType ); + + MSmlDmAdapter::TError status = EOk; + SetAdapterValue(KAMSCOMOAdapter); + _UpdateLeafObjectL(aURI, aLUID, aObject, aType, aStatusRef, status); + + SetStatusL(aStatusRef, status); + if (status == EOk) + { + if (iInAtomic) + { + iBuffer.Append(TAMCommandBufferElement(aStatusRef, aURI) ); + } + } + RDEBUG_2("CSCOMOAdapter::UpdateLeafObjectL(): end (%d)", status); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::UpdateLeafObjectL() +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::_UpdateLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType, + TInt /*aStatusRef*/, MSmlDmAdapter::TError& aStatus) + { + RDEBUG("CSCOMOAdapter::_UpdateLeafObjectL(): begin"); + + CheckStateChangesL(); + + TError status(EError); + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); + TInt numSeqs( NSmlDmURI::NumOfURISegs( uriPtrc ) ); + TPtrC8 mapping( NSmlDmURI::LastURISeg( uriPtrc ) ); + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( uriPtrc ) ); +#else + TInt numSeqs(NSmlDmURI::NumOfURISegs(aURI) ); + TPtrC8 mapping(NSmlDmURI::LastURISeg(aURI) ); + TPtrC8 parent(NSmlDmURI::RemoveLastSeg(aURI) ); +#endif + + if (mapping == KAMNameNodeName) + { + if (aObject.Size() > KDeploymentComponentNameMaxLength) + { + aStatus = ETooLargeObject; + return; + } + } + else + if (mapping == KAMVersionNodeName) + { + if (aObject.Size() > KDeploymentComponentVersionMaxLength) + { + aStatus = ETooLargeObject; + return; + } + } + else + if (mapping == KAMURINodeName) + { + if (aObject.Size() > KMaxUrlLength) + { + aStatus = ETooLargeObject; + return; + } + + } + else + if (mapping == KAMConRefNodeName) + { + if (aObject.Size() > KMaxConRef) + { + aStatus = ETooLargeObject; + return; + } + } + else + if (mapping == KAMDescriptionNodeName) + { + if (aObject.Size() > 512) + { + aStatus = ETooLargeObject; + return; + } + } + else + if(mapping == KAMPkgIDNodeName) + { + if(aObject.Size() > 256) + { + aStatus = ETooLargeObject; + return; + } + } + else + if(mapping == KAMPkgTypeNodeName) + { + // ADD check for PkgType MIME Type if not supported + // error status should be sent and operation should stop + + if(aObject.Size() >100) + { + aStatus = ETooLargeObject; + return; + } + } + + + TPtrC8 grandParent(NSmlDmURI::RemoveLastSeg(parent) ); + TPtrC8 grandParentMapping(NSmlDmURI::LastURISeg(grandParent) ); + RApplicationManagement &session = SessionL(); + TDeploymentComponentState state(EDCSNone); + if (numSeqs == 4 || numSeqs == 5) + { + if (numSeqs == 4) + { + state = EDCSDownload; + } + else + { + if (grandParentMapping == KAMDeliveredNodeName) + { + state = EDCSDelivered; + } + else + if (grandParentMapping == KAMDeployedNodeName) + { + state = EDCSActive; + } + else + { + RDEBUG8_3( "CSCOMOAdapter::UpdateLeafObjectL(): ILLEGAL LEVEL %d NODE %S", numSeqs, &aURI ); + User::Leave(KErrArgument); + } + } + } + else + { + RDEBUG8_3("CSCOMOAdapter::UpdateLeafObjectL(): ILLEGAL LEVEL %d NODE %S", numSeqs, &aURI ); + } + if (state == EDCSDelivered || state == EDCSDownload ||state == EDCSActive + ||state == EDCSInactive) + { + if (aLUID != KNullDesC8) + { + TInt iluid(DesToIntL(aLUID) ); + TDeploymentComponent comp; + TInt err(session.DeploymentComponent(iluid, comp) ); + if (err == KErrNone) + { + + // Set default component install options for particular iluid. + TPtrC8 obj; + TAMInstallOptions opts; + TAMInstallOptionsPckg optsb(opts); + + TBuf drive; + + CRepository *rep = CRepository::NewLC(KCRUidPrivateApplicationManagementKeys ); + rep->Get(KDefaultDriveForInstall,drive); + CleanupStack::PopAndDestroy(); + + //TChar KDefaultDrive = 'c'; + TChar KDefaultDrive = drive[0]; + + opts.iOptions.iUpgrade = SwiUI::EPolicyAllowed; + opts.iOptions.iOptionalItems = SwiUI::EPolicyAllowed; + opts.iOptions.iOCSP = SwiUI::EPolicyAllowed; + opts.iOptions.iIgnoreOCSPWarnings = SwiUI::EPolicyAllowed; + + opts.iOptions.iUntrusted = SwiUI::EPolicyAllowed; + opts.iOptions.iPackageInfo = SwiUI::EPolicyAllowed; + opts.iOptions.iCapabilities = SwiUI::EPolicyAllowed; + opts.iOptions.iKillApp = SwiUI::EPolicyAllowed; + opts.iOptions.iOverwrite = SwiUI::EPolicyAllowed; + opts.iOptions.iDownload = SwiUI::EPolicyAllowed; + opts.iOptions.iDrive = KDefaultDrive; + opts.iOptions.iLang = ELangNone; + opts.iOptions.iUsePhoneLang = EFalse ; + + obj.Set(optsb); + + TRAP_IGNORE( session.UpdateDeploymentComponentL( iluid, EDCInstallOptions, obj ) ); + + + TDeplCompAttrType fl(UpdateFlagFromMapping(mapping) ); + + if (mapping == KAMDataNodeName || mapping + == KAMDescriptorNodeName) + { + TInt erx(KErrNone); + if ((mapping == KAMDataNodeName) &&(RecognizeMimeType(aType)== EFalse)) + { + User::Leave(EInvalidObject); + } + if (iIsStreamedContent) + { + CloseStreaming(); + TRAP( erx, session.UpdateDeploymentComponentStreamedDataL( iluid, fl, aType ) ); + } + else + { + // + TRAP( erx, session.UpdateDeploymentComponentDataL( iluid, fl, aObject, aType ) ); + } + MAPERROR( erx, status, _L8("Update Delivered Data or metadata %d") ); + } + else + { + if (fl != EDCNone) + { + TPtrC8 obj; + TAMInstallOptions opts; + TAMInstallOptionsPckg optsb(opts); + TPckgBuf iap; + if (fl == EDCInstallOptions) + { + } + else + if (fl == EDCConRef) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + + //CNSmlDMIAPMatcher* iapfinder = CNSmlDMIAPMatcher::NewLC( &Callback() ); + //TInt i( iapfinder->IAPIdFromURIL( aObject ) ); + //CleanupStack::PopAndDestroy( iapfinder ); + //iap() = i; + CArrayFix* mapArray = new CArrayFixFlat(4); + CleanupStack::PushL(mapArray); + + Callback().GetMappingInfoListL( KNSmlDMMMSSlashIAPUri,*mapArray ); + + TInt iapValue = KErrNotFound; + TSmlDmMappingInfo mapInfo; + + for(TInt i = 0;iCount();i++) + { + if(LastURISeg(opts.iConRef)==mapArray->At(i).iURISeg) + { + iapValue=DesToInt(mapArray->At(i).iURISegLUID); + break; + } + } + iap() = iapValue; + mapArray->Reset(); + CleanupStack::PopAndDestroy(); //mapArray + +#else + CNSmlDMIAPMatcher + * iapfinder = + CNSmlDMIAPMatcher::NewLC( &Callback() ); + TInt i(iapfinder->IAPIdFromURIL(aObject) ); + CleanupStack::PopAndDestroy(iapfinder); + iap() = i; +#endif + obj.Set(iap); + } + else + { + obj.Set(aObject); + } + TRAPD( erx, session.UpdateDeploymentComponentL( iluid, fl, obj ) ) + ; + MAPERROR( erx, status, _L8("Update some attribute %d") ); + } + else + { + status = ENotFound; + RDEBUG( "CSCOMOAdapter::UpdateLeafObjectL(): Unknown Target leaf" ); + } + } + } + else + { + RDEBUG_3( "CSCOMOAdapter::UpdateLeafObjectL(): FAILED TO GET COMPONENT OF ID %d: %d" , iluid, err ); + status = ENotFound; + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::UpdateLeafObjectL(): Faild to get luid allocation and find buffered for '%S'", &parent ); + status = ENotFound; + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::UpdateLeafObjectL(): WARNING Tried to update illegal state leaf! '%S'", &grandParentMapping ); + } + + aStatus = status; + + RDEBUG("CSCOMOAdapter::_UpdateLeafObjectL(): end"); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::UpdateLeafObjectL +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::UpdateLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, RWriteStream*& aStream, const TDesC8& aType, + TInt aStatusRef) + { + RDEBUG8_4("CSCOMOAdapter::UpdateLeafObjectL() aStream: begin, '%S', '%S' '%S'", &aURI, &aLUID, &aType ); + + TError status(CSmlDmAdapter::EOk); + + if (iStreamedURI) + { + delete iStreamedURI; + iStreamedURI = NULL; + } + iStreamedURI = aURI.AllocL(); + + if (iStreamedLuid) + { + delete iStreamedLuid; + iStreamedLuid = NULL; + } + iStreamedLuid = aLUID.AllocL(); + + if (iStreamedType) + { + delete iStreamedType; + iStreamedType = NULL; + } + iStreamedType = aType.AllocL(); + + if (!iStreamOpen) + { + RApplicationManagement &session = SessionL(); + TDeplCompAttrType attrType; + TPtrC8 mapping(NSmlDmURI::LastURISeg(aURI) ); + TDeplCompAttrType fl(UpdateFlagFromMapping(mapping) ); + if (mapping == KAMDataNodeName) + { + attrType = EDCData; + } + else + if (mapping == KAMDescriptorNodeName) + { + attrType = EDCMetaData; + } + else + { + RDEBUG8_2("CSCOMOAdapter::UpdateLeafObjectL(): Unknown mapping: (%S)", &mapping); + status = CSmlDmAdapter::EError; + } + + if (status == CSmlDmAdapter::EOk) + { + TInt iluid(DesToIntL(aLUID) ); + session.DeploymentComponentTempInstFileL(iluid, iStreamFile, + attrType); + iStream.Attach(iStreamFile); + aStream = &iStream; + iStreamOpen = ETrue; + iIsStreamedContent = ETrue; + } + } + if ( !iInAtomic) + { + iStatusRef = aStatusRef; + Callback().SetStatusL(aStatusRef, status); + } + else + { + iBuffer.Append(TAMCommandBufferElement(aStatusRef, aURI) ); + } + + RDEBUG("CSCOMOAdapter::UpdateLeafObjectL() aStream : end"); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::UpdateFlagFromMapping( const TDesC8& aMapping ) +// ------------------------------------------------------------------------------------------------ +TDeplCompAttrType CSCOMOAdapter::UpdateFlagFromMapping(const TDesC8& aMapping) + { + + TDeplCompAttrType res; + if (aMapping == KAMIDNodeName) + { + res = EDCId; + } + else + if (aMapping == KAMNameNodeName) + { + res = EDCName; + } + else + if (aMapping == KAMVersionNodeName) + { + res = EDCVersion; + } + else + if (aMapping == KAMStateValueNodeName) + { + res = EDCStateValue; + } + else + if (aMapping == KAMInstallOptsNodeName) + { + res = EDCInstallOptions; + } + else + if (aMapping == KAMDescriptorNodeName) + { + res = EDCMetaData; + } + else + if (aMapping == KAMDataNodeName) + { + res = EDCData; + } + else + if (aMapping == KAMURINodeName) + { + res = EDCDownloadURI; + } + else + if (aMapping == KAMStatusNodeName) + { + res = EDCStatus; + } + else + if (aMapping == KAMConRefNodeName) + { + res = EDCConRef; + } + else + if (aMapping + == KAMDescriptionNodeName) + { + res = EDCDescriptionRef; + } + else + if(aMapping == KAMPkgIDNodeName) + { + res = EDCPkgID; + } + else + if(aMapping == KAMPkgTypeNodeName) + { + res = EDCPkgType; + } + + + else + { + //User::Leave( KErrArgument ); + res = EDCNone; + } + return res; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::GetLuidForUserIdL( const TDesC8 &aUserId, +// const TDeploymentComponentState aState ) +// ------------------------------------------------------------------------------------------------ +TUint32 CSCOMOAdapter::GetLuidForUserIdL(const TDesC8 &aUserId, + const TDeploymentComponentState aState) + { + TUint32 ret( 0); + if (aState != EDCSNone) + { + RElementIdArray array; + TInt err(SessionL().DeploymentComponentIdsL(array, aState) ); + if (err == KErrNone) + { + CleanupClosePushL(array); + TInt count(array.Count() ); + for (TInt i( 0); i < count && ret == 0; i++) + { + TUint32 el = array[i]; + TDCUserId dc; + SessionL().DeploymentComponentUserIdL(el, dc); + if (dc == aUserId) + { + ret = el; + } + } + CleanupStack::PopAndDestroy( &array); + } + else + { + } + } + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::GetLuid2L( const TDesC8 &aDMLuid, const TDesC8 &aUserId, +// const TDeploymentComponentState aState, TError &aStatus ) +// ------------------------------------------------------------------------------------------------ +TUint32 CSCOMOAdapter::GetLuid2L(const TDesC8 &aDMLuid, + const TDesC8 &aUserId, const TDeploymentComponentState aState, + TError &aStatus) + { + TUint32 ret(GetLuidL(aDMLuid, aUserId, aState) ); + if ( (TInt32)ret <= 0) + { + aStatus = ENotFound; + } + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::GetLuidL( const TDesC8 &aDMLuid, const TDesC8 &aUserId, +// const TDeploymentComponentState aState ) +// ------------------------------------------------------------------------------------------------ +TUint32 CSCOMOAdapter::GetLuidL(const TDesC8 &aDMLuid, const TDesC8 &aUserId, + const TDeploymentComponentState aState) + { + TUint32 ret( 0); + if (aDMLuid == KNullDesC8) + { + ret = GetLuidForUserIdL(aUserId, aState); + } + else + { + ret = DesToIntL(aDMLuid) ; + } + + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::DeleteObjectL(const TDesC8& aURI, const TDesC8& aLUID, + const TInt aStatusRef) + { + + RDEBUG8_4("CSCOMOAdapter::DeleteObjectL(): begin (%S, %S, %d)" , &aURI, &aLUID, aStatusRef ); + SetAdapterValue(KAMSCOMOAdapter); + CheckStateChangesL(); + + TError ret(EError); + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ); + TPtrC8 mapping( NSmlDmURI::LastURISeg( uriPtrc ) ); +#else + TInt cnt(NSmlDmURI::NumOfURISegs(aURI) ); + TPtrC8 mapping(NSmlDmURI::LastURISeg(aURI) ); +#endif + + TBuf8 temp; + GetPredefinedNodeL(temp); + TInt comp = mapping.Compare( temp ); + if (temp.Length() && mapping.Compare( temp ) == 0) + { + MSmlDmAdapter::TError status = MSmlDmAdapter::ENotAllowed; + Callback().SetStatusL( aStatusRef, status ); + return; + } + switch (cnt) + { + case 3: + case 4: + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 which( NSmlDmURI::URISeg( uriPtrc, cnt == 4 ? 3 : 2 ) ); +#else + TPtrC8 which(NSmlDmURI::URISeg(aURI, cnt == 4 ? 3 : 2) ); +#endif + if (which == KAMDeliveredNodeName || which == KAMDownloadNodeName) + { + TUint32 luid(GetLuidL(aLUID, mapping, (which + == KAMDeliveredNodeName + ? EDCSDelivered + : EDCSDownload)) ); + if (luid > 0) + { + TRAPD( err, SessionL().RemoveL( luid ) ) + ; + if (err == KErrNone || err == KErrNotFound) + { + ret = EOk; + Callback().SetMappingL(aURI, KNullDesC8); + if (err == KErrNone && iInAtomic) + { + iBuffer.Append(TAMCommandBufferElement( + aStatusRef, aURI) ); + } + } + else + { + MAPERROR( err, ret, _L8("Delete %d") ); + } + } + else + { + RDEBUG( "CSCOMOAdapter::DeleteObjectL(): WARNING Object not found" ); + ret = ENotFound; + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::DeleteObjectL(): ERROR Removing node %S is not supported", &aURI ); + } + break; + } + default: + { + RDEBUG8_3( "CSCOMOAdapter::DeleteObjectL(): ILLEGAL LEVEL %d NODE %S", cnt, &aURI ); + break; + } + } + SetStatusL(aStatusRef, ret); + RDEBUG( "CSCOMOAdapter::DeleteObjectL(): end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::DeactivateIfInactive( const TUint aLuidi, const TDeploymentComponentState aTargetState ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::DeactivateIfInactive(const TUint aLuidi, + const TDeploymentComponentState aTargetState) + { + if (aTargetState == EDCSInactive) + { + RDEBUG( "CSCOMOAdapter::DeactivateIfInactive(): deactivating!" ); + TRAPD( derr, iManagement.DeactivateL( aLuidi ) ) + ; + if (derr != KErrNone) + { + RDEBUG_2("CSCOMOAdapter::DeactivateIfInactive(): ERROR deactivating failed %d", derr ); + } + } + } + +void CSCOMOAdapter::InstallL(TUint aLuidi, const TDesC8& aURI, + const TDesC8& aLUID, const TDeploymentComponentState aTargetState, + TError &aRet) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); +#else + //nothing +#endif + + TRAPD( err, SessionL().InstallL( aLuidi, aTargetState ) ) + ; + if (err == KErrNone) + { + // Update the mappings in client to reflect new + // position in the management tree ( Inactive or Active..) + RDEBUG( "CSCOMOAdapter::InstallL(): Install success!" ); + + TPtrC8 aclmapping(URISegsUpTo(aURI, 4) ); + SetMappingL(aclmapping, aTargetState, aLUID); + iManagement.StateChangeComplete(aLuidi); + + DeactivateIfInactive(aLuidi, aTargetState); + aRet = EOk; + } + else + { + RDEBUG_2( "CSCOMOAdapter::InstallL(): INSTALL FAILED '%d'" , err); + MAPERROR( err, aRet, _L8("Install %d") ); + } + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::DefaultMapError( const TInt aErr, TError &aRet ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::DefaultMapError(const TInt aErr, TError &aRet, + const TDesC8& +#ifdef __AM_LASTERROR_NODE + aDes +#endif +) + { + if (aErr == KErrNone) + { + aRet = EOk; + } + else + if (aErr == KErrNotFound) + { + aRet = ENotFound; + } + else + if (aErr == KErrArgument) + { + aRet = EInvalidObject; + } + else + if (aErr == KErrAlreadyExists) + { + aRet = EAlreadyExists; + } + else + { + aRet = EError; + } +#ifdef __AM_LASTERROR_NODE + TInt err = KErrNone; + TRAP( err, SetErrorL( aDes, aErr ) ); +#endif + } + +#ifdef __AM_LASTERROR_NODE +void CSCOMOAdapter::SetErrorL(const TDesC8& aDes, const TInt aErr) + { + if (aDes != KNullDesC8) + { + SetLastErrorL(aDes, aErr); + } + else + { + SetLastErrorL(KStdError, aErr); + } + } +#endif + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, +// const TDesC8& aType, +// TInt aStatusRef ) +// ------------------------------------------------------------------------------------------------ +TDownloadTarget CSCOMOAdapter::DownloadTargetL(const TDesC8& aCommand) + { + if (aCommand == KAMDownloadOperationNodeName) + { + return EDeliver; + } + else + if (aCommand == KAMDownloadAndInstallNodeName) + { + return EInstallAndActivate; + } + else + if (aCommand == KAMDownloadAndInstallAndInActivateNodeName) + { + return EInstall; + } + + RDEBUG8_2( "CSCOMOAdapter::DownloadTargetL(): ASKED OPERATION NOT SUPPORTED Download '%S'", &aCommand ); + User::Leave(KErrArgument); + // NOTE! will not ever come here! Only to get rid of compiler warning !! + return EDeliver; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, +// const TDesC8& aType, +// TInt aStatusRef ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::ExecuteCommandL(const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& /*aType*/, TInt aStatusRef) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); +#else + //nothing +#endif + + RDEBUG8_3("CSCOMOAdapter::ExecuteCommandL(): begin, '%S', '%S'", &aURI, &aLUID ); + SetAdapterValue(KAMSCOMOAdapter); + CheckStateChangesL(); + TError ret(EError); + + if (aLUID == KNullDesC8) + { + RDEBUG("CSCOMOAdapter::ExecuteCommandL(): WARNING no valid luid provided" ); + } + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ); +#else + TInt cnt(NSmlDmURI::NumOfURISegs(aURI) ); +#endif + + TPtrC8 mapping(NSmlDmURI::LastURISeg(aURI) ); + + const TInt KDownloadMappingURILoc = 3; + switch (cnt) + { + case 5: + { + TUint32 iluid(GetLuidL(aLUID, NSmlDmURI::URISeg(aURI, + KDownloadMappingURILoc), EDCSDownload) ); + + // Track the Newly added delivered node to make sure that this reference + // of delivered node is removed from Tree DB. + // This delivered node is removed only if Execute command is successful + // by either adding Install, Install& activate etc. + // This Fix would be applicable in case of DM 1.2. + + + TPtrC8 urival(URISegsUpTo(aURI, KDownloadMappingURILoc)); + + if (iUriDel) + { + delete iUriDel; + iUriDel = NULL; + } + + iUriDel = urival.AllocL(); + + RDEBUG_2("CSCOMOAdapter::ExecuteCommandL(): luid is %d", iluid ); + if (iluid > 0) + { + TDownloadTarget target = DownloadTargetL(mapping); + + TRAPD( errx, SessionL().StartDownloadL( iluid, target ) ); + + + //Check If Sync is supported. Default is ASyncReporting. + //If ASyncSupported is 0 mean Sync reporting is supported. + TInt ASyncSupported = -1; + + CRepository *repository=CRepository::NewLC ( KCRUidPrivateApplicationManagementKeys ); + repository->Get(KAsyncEnabled,ASyncSupported); + CleanupStack::PopAndDestroy(); + + if(errx == KErrNone) + { + if (ASyncSupported) + ASyncReportL(iluid, aArgument, target, aURI); + else + SyncReportL(iluid, aArgument, target, aURI, ret); + } + + if (target == EInstall || target == EInstallAndActivate) + { + TInt err(iDbSession.RemoveMappingInfoL(KAMAdapterImplUid, + *iUriDel, iluid) ); + } + if (errx == KErrNone) + { + RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): StartDownloadL Successful " ); + if (ASyncSupported) + { + + ret = EAcceptedForProcessing; + } + + + } + else + { + RDEBUG_2( "CSCOMOAdapter::ExecuteCommandL(): StartDownloadL FAILED '%d'", errx ); + if (errx == KErrNotFound) + { + ret = ENotFound; + } + else + if (errx == KErrArgument) + { + ret = EInvalidObject ; + } + else + { + ret = EError; + } + } + + } + else + { + ret = ENotFound; + RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): case 5 Not found node" ); + } + break; + } + case 6: + { + const TInt KInventoryMappingURILoc = 4; + + // Track the Newly added delivered node to make sure that this reference + // of delivered node is removed from Tree DB. + // This delivered node is removed only if Execute command is successful + // by either adding Install, Install& activate etc. + // This Fix would be applicable in case of DM 1.2. + + + TPtrC8 urival(URISegsUpTo(aURI, KInventoryMappingURILoc)); + + if (iUriDel) + { + delete iUriDel; + iUriDel = NULL; + } + + iUriDel = urival.AllocL(); + + if (mapping == KAMInstallNodeName || mapping + == KAMInstallInactiveNodeName) + { + TUint32 iluid(GetLuidL(aLUID, NSmlDmURI::URISeg(aURI, + KInventoryMappingURILoc), EDCSDelivered) ); + if (iluid > 0) + { + TDeploymentComponentState targetstate = ((mapping + == KAMInstallNodeName) + ? EDCSActive + : EDCSInactive); + InstallL(iluid, aURI, aLUID, targetstate, ret); + + TInt err(iDbSession.RemoveMappingInfoL(KAMAdapterImplUid, + *iUriDel, iluid) ); + } + else + { + ret = ENotFound; + RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): case 6 install Not found node" ); + } + } + else + if (mapping == KAMRemoveNodeName) + { + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( urival ) ); + TPtrC8 ParentMapping( NSmlDmURI::LastURISeg( parent ) ); + TUint32 iluid(0); + if ( ParentMapping == KAMDeliveredNodeName ) + { + iluid = GetLuidL(aLUID, NSmlDmURI::URISeg(aURI, + KInventoryMappingURILoc), EDCSDelivered) ; + } + + else if ( ParentMapping == KAMDeployedNodeName) + { + iluid = GetLuidL(aLUID, NSmlDmURI::URISeg(aURI, + KInventoryMappingURILoc), EDCSActive) ; + if ( (TInt32)iluid <= 0) + { + iluid = GetLuidL(aLUID, NSmlDmURI::URISeg(aURI, + KInventoryMappingURILoc), EDCSInactive) ; + } + } + if (iluid > 0) + { + TRAPD( err, SessionL().RemoveL( iluid ) ) + ; + if (err == KErrNone) + { + RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): Remove success!" ); + TPtrC8 aclmapping(URISegsUpTo(aURI, 4) ); + + // "Nullify" the mapping for argument + err = iDbSession.RemoveMappingInfoL(KAMAdapterImplUid, aclmapping); + if (err == KErrNone) + { + ret = EOk; + } + if (iInAtomic) + { + iBuffer.Append(TAMCommandBufferElement( + aStatusRef, aURI) ); + } + } + else + { + RDEBUG_2( "CSCOMOAdapter::ExecuteCommandL(): Remove FAILED '%d'", err); + + if (err == SwiUI::KSWInstErrUserCancel) + ret = EError; + else + MAPERROR( err, ret, _L8("Execute Remove %d") ); + } + } + else + { + ret = ENotFound; + RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): case 6 remove Not found node" ); + } + } + else + if (mapping == KAMActivateNodeName) + { + //DBG_ARGS8( "CSCOMOAdapter::ExecuteCommandL(): Activating " ); + TUint32 iluid(GetLuidL(aLUID, + NSmlDmURI::URISeg(aURI, + KInventoryMappingURILoc), + EDCSActive) ); + if ( (TInt32)iluid <= 0) + { + iluid = GetLuidL(aLUID, + NSmlDmURI::URISeg(aURI, + KInventoryMappingURILoc), + EDCSInactive) ; + } + if (iluid > 0) + { + TRAP_IGNORE( SessionL().ActivateL( iluid ) ); + ret = EOk; + + //MAPERROR( erx, ret, _L8("Activate %d") ); + } + else + { + ret = ENotFound; + RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): case 6 Activate Not found node" ); + } + } + else + if (mapping == KAMDeActivateNodeName) + { + //DBG_ARGS8( "CSCOMOAdapter::ExecuteCommandL(): Inactivating " ); + TUint32 iluid(GetLuidL(aLUID, + NSmlDmURI::URISeg(aURI, + KInventoryMappingURILoc), + EDCSActive) ); + if ( (TInt32)iluid <= 0) + { + iluid + = GetLuidL( + aLUID, + NSmlDmURI::URISeg( + aURI, + KInventoryMappingURILoc), + EDCSInactive) ; + } + if (iluid > 0) + { + TRAP_IGNORE(SessionL().DeactivateL( iluid ) ) + ; + ret = EOk; + //MAPERROR( erx, ret,_L8("Dectivate %d") ); + } + else + { + ret = ENotFound; + RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): case 6 DeActivate Not found node" ); + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ExecuteCommandL(): ASKED NOT SUPPORTED OPERATION '%S'", &mapping ); + + ret = EError; + } + break; + } + + default: + { + RDEBUG8_3( "CSCOMOAdapter::ExecuteCommandL(): ILLEGAL LEVEL %d NODE %S", cnt, &aURI ); + + ret = EInvalidObject; + break; + } + } + SetStatusL(aStatusRef, ret) ; + } + +void CSCOMOAdapter::ASyncReportL(TUint32 aLuid, const TDesC8& aArgument, + const TDownloadTarget aTarget,const TDesC8& aURI) + { + // while sending generic alert + // adapter uses entry stored in database and constructs generic alert + // using SyncML framework API. + TInt index = 0; + // Default max retry count is 5. It is also cenep configurable + // Cenrep configuration responsible can change the max retry + // count + TInt retrycount = 5; + + CRepository *repository = CRepository::NewLC ( KCRUidPrivateApplicationManagementKeys ); + repository->Get(KMaxRetryCount,retrycount); + CleanupStack::PopAndDestroy(); //repository + + TSmlProfileId profId = KErrNotFound; + HBufC8* serverId= NULL; + + //Retrive Server Information + + GetServerInfoL(profId, serverId); + + CleanupStack::PushL(serverId); + + //Add Download entry to database + + iAMdb->SaveToDatabaseL(index, aLuid, profId, retrycount, aURI, + *serverId, aArgument); + + CleanupStack::PopAndDestroy(serverId); + + } + +void CSCOMOAdapter::SyncReportL(TUint32 aLuid, const TDesC8& aArgument, + const TDownloadTarget aTarget,const TDesC8& aURI, TError &aRet ) + { + TInt status = KStatusSuccess; + + RProperty counter; + TInt r=counter.Attach(KUidPSApplicationManagementKeys, KSyncNotifier, + EOwnerThread); + User::LeaveIfError(r); + + /*CSyncService *syncService = CSyncService::NewL(NULL, KDevManServiceStart); + if (syncService) + { + syncService->EnableProgressNoteL(EFalse); + } + + delete syncService;*/ + + // wait for the previously attached ‘counter’ property to be updated + TRequestStatus s; + counter.Subscribe(s); + User::WaitForRequest(s); + + CRepository *repository = CRepository::NewLC ( KCRUidPrivateApplicationManagementKeys ); + repository->Get(KAMSyncStatus,status); + CleanupStack::PopAndDestroy(); + + switch(status) + { + case KStatusUserCancelled: + { + aRet = MSmlDmAdapter::EError; + break; + } + + case KStatusDowloadFailedOOM: + { + aRet = MSmlDmAdapter::EError; + break; + } + + case KStatusAlternateDownldAuthFail: + { + aRet = MSmlDmAdapter::EError; + break; + } + + case KStatusDownloadFailed: + { + aRet = MSmlDmAdapter::EError; + break; + } + + case KStatusPkgValidationFailed: + { + aRet = MSmlDmAdapter::EError; + break; + } + + case KStatusInstallFailedOOM: + { + aRet = MSmlDmAdapter::EError; + break; + } + + case KStatusInstallFailed: + { + aRet = MSmlDmAdapter::EError; + break; + } + + case KStatusUnSupportedEnvironment: + { + aRet = MSmlDmAdapter::EError; + break; + } + + case KStatusAltDowldUnavailable: + { + aRet = MSmlDmAdapter::EError; + break; + } + + default: + { + aRet = MSmlDmAdapter::EOk; + break; + } + } + + + } + +void CSCOMOAdapter::GetServerInfoL(TSmlProfileId& aProfId, HBufC8*& aServerId) const + { + // Open session + RSyncMLSession session; + session.OpenL(); + CleanupClosePushL(session); + + // get current job's id (and usage type) + TSmlJobId jobId = KErrNotFound; + TSmlUsageType type = ESmlDevMan; + session.CurrentJobL(jobId, type); + + // open currently running job + RSyncMLDevManJob dmJob; + dmJob.OpenL(session, jobId); + CleanupClosePushL(dmJob); + + // get job's profile id + aProfId = dmJob.Profile(); + + // open profile using id in read-only mode + RSyncMLDevManProfile dmProf; + dmProf.OpenL(session, aProfId, ESmlOpenRead); + CleanupClosePushL(dmProf); + + // get profile's server id + aServerId = dmProf.ServerId().AllocL(); + + // close handles + CleanupStack::PopAndDestroy( &dmProf); + CleanupStack::PopAndDestroy( &dmJob); + CleanupStack::PopAndDestroy( &session); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::UpdateL( +// const TUint aLuidi, +// const TDesC8& aURI, +// const TDesC8& aSourceLUID, +// const TDeploymentComponentState aTargetState, +// TError &aRet +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::UpdateL(const TUint aLuidi, const TDesC8& aURI, + const TDesC8& aSourceLUID, + const TDeploymentComponentState aTargetState, TError &aRet) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); +#else + //nothing +#endif + + CBufBase *delivered = CBufFlat::NewL( 128); + CleanupStack::PushL(delivered); + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 aclmapping( NSmlDmURI::URISeg( uriPtrc, 4 ) ); +#else + TPtrC8 aclmapping(NSmlDmURI::URISeg(aURI, 4) ); +#endif + + HBufC8 *targetURI = HBufC8::NewLC(KDeployedURI().Length() + aclmapping.Length() ); + + TPtr8 targetPtr(targetURI->Des() ); + targetPtr.Copy(KDeployedURI); + targetPtr.Append(aclmapping); + + HBufC8 *deployed = Callback().GetLuidAllocL(targetPtr) ; + CleanupStack::PushL(deployed); + + //DBG_ARGS8( "CSCOMOAdapter::UpdateL(): Updating '%S' luid: '%S'" ), &targetPtr, &(*deployed)); + if ( *deployed == KNullDesC8) + { + //DBG_ARGS8( "CSCOMOAdapter::UpdateL(): Failed to find to update target '%S'" ), &targetPtr ); + aRet = EError; + } + else + { + // Found delivered & active or inactive components! Do update! + TInt depluid(DesToIntL( *deployed )); + TRAPD( erx, SessionL().UpdateL( aLuidi, depluid ) ) + ; + MAPERROR( erx, aRet,_L8("Update %d") ); + if (erx == KErrNone) + { + SetMappingLC(aclmapping, aTargetState, aSourceLUID, targetURI); + DeactivateIfInactive(aLuidi, aTargetState); + } + } + CleanupStack::PopAndDestroy(deployed) ; + CleanupStack::PopAndDestroy(targetURI) ; + CleanupStack::PopAndDestroy(delivered) ; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::CheckStateL( const TDeploymentComponent &aComp, const TDesC8& aURI +// ------------------------------------------------------------------------------------------------ +TBool CSCOMOAdapter::CheckStateL(const TDeploymentComponent &aComp, + const TDesC8& aURI) + { + TBool ret; + if ((aComp.iState == EDCSDelivered) || (aComp.iState == EDCSActive) || ( aComp.iState == EDCSInactive) || (aComp.iState == EDCSDownload)) + { + // Check for map & __TARM_SYMBIAN_CONVERGENCY also ? + ret = ETrue; + } + else + ret = EFalse; + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::StateL( const TDeploymentComponent &aComp, const TDesC8& aURI +// ------------------------------------------------------------------------------------------------ +TDeploymentComponentState CSCOMOAdapter::StateL(const TDesC8& aURI) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); +#else + //nothing +#endif + + TDeploymentComponentState ret(EDCSNone); +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ); +#else + TInt cnt(NSmlDmURI::NumOfURISegs(aURI) ); +#endif + if (cnt > 2) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 map( NSmlDmURI::URISeg( uriPtrc, 2 ) ); +#else + TPtrC8 map(NSmlDmURI::URISeg(aURI, 2) ); +#endif + if (map == KAMInventoryNodeName) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 map( NSmlDmURI::URISeg( uriPtrc, 2 ) ); +#else + TPtrC8 map(NSmlDmURI::URISeg(aURI, 2) ); +#endif + map.Set(NSmlDmURI::URISeg(aURI, 3) ); + if (map == KAMDeployedNodeName) + { + + } + else + if (map == KAMDeliveredNodeName) + { + ret = EDCSDelivered; + } + else + { + User::Leave(KErrArgument); + } + } + else + if (map == KAMDownloadNodeName) + { + ret = EDCSDownload; + } + else + { + User::Leave(KErrArgument); + } + } + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::CheckStateL( const TDesC8& aURI, const TDesC8& aLUID ) +// ------------------------------------------------------------------------------------------------ +TBool CSCOMOAdapter::CheckStateL(const TDesC8& aURI, const TDesC8& aLUID) + { + + TUint32 iluid(DesToIntL(aLUID) ); + TDeploymentComponent comp; + TInt err(SessionL().DeploymentComponent(iluid, comp) ); + TBool ret(EFalse); + if (err == KErrNone) + { + ret = CheckStateL(comp, aURI); + } + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::InstallOptionsDataL(const TUint32 iluid, const TDeplCompAttrType& aDataType, +// CBufBase &aBuf, CBufBase *aRaw/*= NULL*/) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::InstallOptionsDataL(const TUint32 iluid, + const TDeplCompAttrType& aDataType, CBufBase &aBuf, CBufBase *aRaw/*= NULL*/) + { + TAMInstallOptionsPckgBuf iop; + TBool pushed(EFalse); + if ( !aRaw) + { + aRaw = CBufFlat::NewL(32); + CleanupStack::PushL(aRaw); + pushed = ETrue; + SessionL().DeploymentComponentDataL(iluid, aDataType, *aRaw); + } + + iop.Copy(aRaw->Ptr( 0) ); + if (pushed) + { + CleanupStack::PopAndDestroy(aRaw); + } + InstallOptionsParser::SerializeOptionsL(iop(), aBuf); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::GetComponentDataL( const TDesC8& parent, const TDesC8& mapping, +// const TUint32 iluid, CBufBase *currentList, CBufBase *currentMime, TError &status ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::GetComponentDataL(const TDesC8& parent, + const TDesC8& mapping, const TUint32 iluid, CBufBase ¤tList, + CBufBase ¤tMime, TError &status) + { + TDeploymentComponent comp; + TInt err(SessionL().DeploymentComponent(iluid, comp) ); + if (err == KErrNone) + { + RDEBUG_3( "CSCOMOAdapter::GetComponentDataL(): DeploymentComponent response: %d, state: %d", err, comp.iState ); + if (CheckStateL(comp, parent) ) + { + if (mapping == KAMPkgIDNodeName) + { + currentList.InsertL( 0, comp.iPkgID); + status = EOk; + } + else + if (mapping == KAMNameNodeName) + { + currentList.InsertL( 0, comp.iName); + status = EOk; + } + else + if (mapping == KAMVersionNodeName) + { + currentList.InsertL( 0, comp.iVersion); + status = EOk; + } + else + if(mapping == KAMIDNodeName) + { + + currentList.InsertL( 0, comp.iId); + status = EOk; + + } + else + if(mapping == KAMPkgIDRefNodeName) + { + + currentList.InsertL( 0, comp.iPkgIDRef); + status = EOk; + + } + else + if(mapping == KAMPkgIDNodeName) + { + + currentList.InsertL( 0, comp.iPkgID); + status = EOk; + + } + else + if(mapping == KAMPkgTypeNodeName) + { + + currentList.InsertL( 0, comp.iPkgType); + status = EOk; + + } + else + if ( mapping == KAMStatusNodeName ) + { + TDeplCompAttrType dataType( UpdateFlagFromMapping( mapping ) ); + SessionL().DeploymentComponentDataL( iluid, dataType, currentList ); + status = EOk; + } + + else + if (mapping == KAMDescriptionNodeName) + { + currentList.InsertL(0, comp.iDescription); + status = EOk; + } + else + { + TDeplCompAttrType + dataType(UpdateFlagFromMapping(mapping) ); + if (comp.iState == EDCSDownload) + { + if ( dataType == EDCDownloadURI )//|| dataType == EDCDownloadStatus ) + { + SessionL().DeploymentComponentDataL(iluid, + dataType, currentList); + status = EOk; + } + else + if (dataType == EDCInstallOptions) + { + InstallOptionsDataL(iluid, dataType, + currentList); + status = EOk; + } + else + if (dataType == EDCConRef) + { + CBufBase *b = CBufFlat::NewL(4); + CleanupStack::PushL(b); + SessionL().DeploymentComponentDataL( + iluid, dataType, *b); + TPckgBuf iap; + iap.Copy(b->Ptr( 0) ); + CleanupStack::PopAndDestroy(b); +#ifdef __TARM_SYMBIAN_CONVERGENCY + + CArrayFix* mapArray = new CArrayFixFlat(4); + CleanupStack::PushL(mapArray); + + Callback().GetMappingInfoListL( KNSmlDMMMSSlashIAPUri,*mapArray ); + + //TInt iap = KErrNotFound; + TSmlDmMappingInfo mapInfo; + HBufC8 * uri = NULL; + TPtr8 tempURI(uri->Des()); + + for(TInt i = 0;iCount();i++) + { + if(iap()==DesToInt(mapArray->At(i).iURISegLUID)) + { + tempURI=mapArray->At(i).iURISeg; + } + + } + mapArray->Reset(); + CleanupStack::PopAndDestroy(); //mapArray + if ( uri != NULL ) + { + CleanupStack::PushL( uri ); + currentList.InsertL( 0, *uri ); + CleanupStack::PopAndDestroy( uri ); + } + +#else + + CNSmlDMIAPMatcher + * iapfinder = + CNSmlDMIAPMatcher::NewLC( &Callback() ); + HBufC8 + * uri = + iapfinder->URIFromIAPIdL(iap() ) ; + CleanupStack::PopAndDestroy(iapfinder); + if (uri != NULL) + { + CleanupStack::PushL(uri) ; + currentList.InsertL( 0, *uri); + CleanupStack::PopAndDestroy(uri) ; + } + +#endif + status = EOk; + } + else + { + RDEBUG8_2( "CSCOMOAdapter::GetComponentDataL(): ASKED NOT SUPPORTED LEAF '%S'", &mapping ); + } + } + else + if (comp.iState == EDCSDelivered) + { + if(mapping == KAMStateValueNodeName) + { + currentList.InsertL( 0,KAMStateValueDelivered() ); + status = EOk; + } + if (dataType == EDCData || dataType + == EDCMetaData || dataType + == EDCInstallOptions) + { + CBufBase *raw = CBufFlat::NewL( 128); + CleanupStack::PushL(raw); + SessionL().DeploymentComponentDataL( + iluid, dataType, *raw); + TPtrC8 source(raw->Ptr(0) ); + if (source.Length() > 0) + { + if (dataType == EDCData) + { + currentList.InsertL( 0, + source); + SessionL().DeploymentComponentDataL( + iluid, EDCDataMime, + currentMime); + + } + else + if (dataType + == EDCInstallOptions) + { + InstallOptionsDataL( + iluid, dataType, + currentList, raw); + } + else + { + currentList.InsertL( 0, + source); + SessionL().DeploymentComponentDataL( + iluid, + EDCMetaDataMime, + currentMime); + } + } + else + { + // 0 data length... + } + status = EOk; + CleanupStack::PopAndDestroy(raw); + RDEBUG8_2( "CSCOMOAdapter::GetComponentDataL(): DeploymentComponentDataL called '%S'", &mapping ); + } + } + else + if (dataType == EDCStateValue) + { + if (comp.iState == EDCSActive) + { + currentList.InsertL( 0, + KAMStateValueActive() ); + } + else + { + currentList.InsertL( 0, + KAMStateValueInactive() ); + } + status = EOk; + } + else + { + RDEBUG8_2( "CSCOMOAdapter::GetComponentDataL(): ERROR ASKED NOT SUPPORTED LEAF '%S'", &mapping ); + } + } + } + else + { + RDEBUG8_3( "CSCOMOAdapter::GetComponentDataL(): WARNING Asked illegal state leaf '%S', %d", &mapping, comp.iState ); + status = ENotFound; + } + } + else + { + RDEBUG_3( "CSCOMOAdapter::GetComponentDataL(): ERROR FAILED TO GET COMPOMENT OF ID %d: %d", iluid, err ); + MAPERROR( err, status,_L8("Get Component %d") ); + } + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::GetLeafLuidL(const TDesC8 &aURI, const TDesC8 & aParentMapping ) +// ------------------------------------------------------------------------------------------------ +TInt CSCOMOAdapter::GetLeafLuidL(const TDesC8 &aURI, + const TDesC8 & aParentMapping) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + TInt numSeqs( NSmlDmURI::NumOfURISegs( uriPtrc ) ); +#else + TInt numSeqs(NSmlDmURI::NumOfURISegs(aURI) ); +#endif + + TUint32 iluid( 0); + //TInt numSeqs( NSmlDmURI::NumOfURISegs( aURI ) );//Dipak + + switch (numSeqs) + { + case 4: // must be a download leaf + { + iluid = GetLuidForUserIdL(aParentMapping, EDCSDownload) ; + break; + } + case 5: // download operation or delivered or deployed leaf + { + if (URISegsUpTo(aURI, 2, ETrue) == KDownloadURI) + { + RDEBUG8_2( "CSCOMOAdapter::GetLeafLuidL(): WARNING download operation leaf '%S'", &aURI ); + //status = EOk; + } + else + { + TPtrC8 start(URISegsUpTo(aURI, 3, ETrue) ); + if (start == KDeliveredURI) + { + iluid = GetLuidForUserIdL(aParentMapping, EDCSDelivered) ; + } + else + if (start == KDeployedURI) + { + iluid = GetLuidForUserIdL(aParentMapping, EDCSActive) ; + if ( (TInt32)iluid <= 0) + { + iluid = GetLuidForUserIdL(aParentMapping, + EDCSInactive) ; + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::GetLeafLuidL(): WARNING strange uri '%S'", &aURI ); + } + } + break; + } + case 6: // delivered or deployed operation leaf + { + //iluid = GetLuidForUserIdL( parentMapping, EDCSDownload ) ; + //status = EOk; + RDEBUG8_2( "CSCOMOAdapter::GetLeafLuidL(): WARNING delivered or deployed operation leaf '%S'", &aURI ); + break; + } + default: // illegal uri + { + RDEBUG8_2( "CSCOMOAdapter::GetLeafLuidL(): ERROR requested luid of illegal URI '%S'", &aURI ); + break; + } + } + return iluid; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, +// CBufBase& aObject ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::FetchLeafObjectL(const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, TInt aStatusRef) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); +#else + //Nothing +#endif + + RDEBUG8_4("CSCOMOAdapter::FetchLeafObjectL('%S', '%S', '%S'): begin", &aURI, &aLUID, &aType ); + SetAdapterValue(KAMSCOMOAdapter); + CheckStateChangesL(); + TError status(EError); + + CBufBase *currentList = CBufFlat::NewL( 128); + CleanupStack::PushL(currentList); + + CBufBase *currentMime = CBufFlat::NewL( 128); + CleanupStack::PushL(currentMime); + + TPtrC8 mapping(NSmlDmURI::LastURISeg(aURI) ); + TPtrC8 parent(NSmlDmURI::RemoveLastSeg(aURI) ); + TPtrC8 parentMapping(NSmlDmURI::LastURISeg(parent) ); + + HBufC8 *luid= NULL; + if (aLUID != KNullDesC8) + { + luid = aLUID.AllocLC(); + } + else + { // try if we find it from download path + TBuf8<256> down; + down = KDownloadURI; + down.Append(parentMapping); + luid = Callback().GetLuidAllocL(down); + CleanupStack::PushL(luid); + if ( *luid != KNullDesC8) + { + // make it to found next time + DirectSetMappingL(parent, *luid); + MoveAclL(down, parent); + + // remove old + DirectSetMappingL(down, KNullDesC8); + } + } + if ( *luid != KNullDesC8) + { + TUint32 iluid(DesToIntL( *luid )); + RDEBUG8_2( "CSCOMOAdapter::FetchLeafObjectL(): Luid is : %d", iluid ); + GetComponentDataL(parent, mapping, iluid, *currentList, *currentMime, + status); + } + else + { + TUint32 iluid(GetLeafLuidL(aURI, parentMapping) ); + if (iluid > 0) + { + HBufC8 *l = IntToDes8LC(iluid); + DirectSetMappingL(parent, *l); + CleanupStack::PopAndDestroy(l); + GetComponentDataL(parent, mapping, iluid, *currentList, + *currentMime, status); + } + else + { + RDEBUG8_2( "CSCOMOAdapter::FetchLeafObjectL(): WARNING Faild to get luid allocation for '%S'", &parent ); + if (aLUID == KNullDesC8) + { +#ifdef __AM_LASTERROR_NODE + if (aURI == KAMLastErrorURI) + { + const TDesC8& error= LastError(); + RDEBUG8_2( "CSCOMOAdapter::FetchLeafObjectL(): Returning last error '%S'", &error ); + currentList->InsertL(0, error); + status = EOk; + } + else + { + status = ENotFound; + } +#else + status = ENotFound; +#endif + } + } + } + + SetStatusL(aStatusRef, status); + if (status == EOk) + { + if (iInAtomic) + { + iBuffer.Append(TAMCommandBufferElement(aStatusRef, aURI) ); + } + Callback().SetResultsL(aResultsRef, *currentList, + ( (currentMime->Size() > 0) ? currentMime->Ptr(0) : aType )); + } + CleanupStack::PopAndDestroy(luid); + CleanupStack::PopAndDestroy(currentMime); //currentMime + CleanupStack::PopAndDestroy(currentList); //currentList + RDEBUG("CSCOMOAdapter::FetchLeafObjectL: end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::IdListL( TDeploymentComponentState aState, +// CBufBase *aCurrentList, TBool aAppend /* = EFalse */) +// ------------------------------------------------------------------------------------------------ +CSCOMOAdapter::TError CSCOMOAdapter::IdListL( + TDeploymentComponentState aState, CBufBase &aCurrentList, + TBool aAppend /* = EFalse */) + { + RDEBUG_2( "CSCOMOAdapter::IdListL:Begin aState is %d", aState); + CSCOMOAdapter::TError ret(CSCOMOAdapter::EError); + RElementIdArray array; + TPtrC8 uriStart; + TBuf8<256> uri; + + switch (aState) + { + case EDCSDelivered: + uriStart.Set(KDeliveredURI); + break; + case EDCSActive: + case EDCSInactive: + uriStart.Set(KDeployedURI) ; + break; + case EDCSDownload: + uriStart.Set(KDownloadURI) ; + break; + default: + break; + + } + TInt err(SessionL().DeploymentComponentIdsL(array, aState) ); + if (err == KErrNone) + { + TInt count(array.Count() ); + RDEBUG_2( "CSCOMOAdapter::IdListL: count is %d", count); + if (count && aAppend && aCurrentList.Size() ) + { + RDEBUG("CSCOMOAdapter::IdListL: Inserting list size" ); + aCurrentList.InsertL(aCurrentList.Size(), KAMSeparator8); + } + for (TInt i( 0); i < count; i++) + { + TUint32 el = array[i]; + TDCUserId dc; + SessionL().DeploymentComponentUserIdL(el, dc); + RDEBUG_2("CSCOMOAdapter::IdListL: Node name is %S", &dc); + if (uriStart == KNullDesC8() ) + { + RDEBUG("CSCOMOAdapter::IdListL: uriStart == KNullDesC8()" ); + TDeploymentComponent comp; + err = SessionL().DeploymentComponent(el, comp) ; + if (err == KErrNone) + { + switch (comp.iState) + { + case EDCSDelivered: + uriStart.Set(KDeliveredURI); + break; + case EDCSActive: + case EDCSInactive: + uriStart.Set(KDeployedURI) ; + break; + case EDCSDownload: + uriStart.Set(KDownloadURI) ; + break; + default: + break; + } + } + } + if (uriStart != KNullDesC8() ) + { + uri.Copy(uriStart); + uri.Append(dc); + HBufC8 *luid = DirectGetLuidAllocLC(uri); //Callback().GetLuidAllocL( uri ); + RDEBUG_2( "CSCOMOAdapter::IdListL: luid is %S", luid); + if (KNullDesC8() == *luid) + { + RDEBUG8_3( "CSCOMOAdapter::IdListL(): WARNING updating lost luid of '%S' %d", &uri, el ); + HBufC8 *l = IntToDes8LC(el); + if ( *luid == *l) + { + RDEBUG( "CSCOMOAdapter::IdListL(): WARNING CANCEL (not really updating, they're the same already" ); + } + else + { + RDEBUG("CSCOMOAdapter::IdListL: DirectSetMappingL" ); + DirectSetMappingL(uri, *l); + } + CleanupStack::PopAndDestroy(l); + } + CleanupStack::PopAndDestroy(luid); + + } + else + { + RDEBUG_2( "CSCOMOAdapter::IdListL(): WARNING failed to get component state of id %d, cannot check mappings ", el ); + } + aCurrentList.InsertL(aCurrentList.Size(), dc); + if (i + 1 < count) + { + RDEBUG("CSCOMOAdapter::IdListL: Adding Separator" ); + aCurrentList.InsertL(aCurrentList.Size(), KAMSeparator8); + } + } + ret = EOk; + } + else + { + RDEBUG_2( "CSCOMOAdapter::IdListL(): Error %d", err ); + } + array.Reset(); + RDEBUG("CSCOMOAdapter::IdListL: end" ); + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::ChildURIListL( const TDesC8& aURI, const TDesC8& aParentLUID, +// const CArrayFix& /*aPreviousURISegmentList*/, const TInt aResultsRef, +// TInt aStatusRef ); +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::ChildURIListL(const TDesC8& aURI, + const TDesC8& aParentLUID, + const CArrayFix& /*aPreviousURISegmentList*/, + const TInt aResultsRef, TInt aStatusRef) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); +#else + //Nothing +#endif + + RDEBUG8_3 ( "CSCOMOAdapter::ChildURIListL(): begin ('%S', '%S')" , &aURI, &aParentLUID ); + CheckStateChangesL(); + + TError ret(EError); + + CBufBase *currentList = CBufFlat::NewL( 128); + CleanupStack::PushL(currentList); + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TInt numSeqs( NSmlDmURI::NumOfURISegs( uriPtrc ) ); +#else + TInt numSeqs(NSmlDmURI::NumOfURISegs(aURI) ); +#endif + + TPtrC8 mapping(NSmlDmURI::LastURISeg(aURI) ); + if (numSeqs == 1) + { + currentList->InsertL( 0, KAMRootChilds); + ret = EOk; + } + else + if (numSeqs == 2) + { + if (mapping == KAMInventoryNodeName) + { + currentList->InsertL( 0, KAMInventoryChilds); + ret = EOk; + } + else + if (mapping == KAMDownloadNodeName) + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): Level 2 NODE %S", &aURI ); + TDeploymentComponentState state(EDCSDownload); + ret = IdListL(state, *currentList); + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): ILLEGAL LEVEL 2 NODE %S", &aURI ); + User::Leave(KErrArgument); + } + } + else + if (numSeqs == 3) + { + if (mapping == KAMDeliveredNodeName) + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): Level 3 NODE %S", &aURI ); + TDeploymentComponentState state(EDCSDelivered); + ret = IdListL(state, *currentList); + } + else + if (mapping == KAMDeployedNodeName) + { + TDeploymentComponentState state(EDCSActive); + ret = IdListL(state, *currentList); + if (ret == EOk) + { + state = EDCSInactive; + ret = IdListL(state, *currentList, ETrue); + } + } + else + { + if (aParentLUID != KNullDesC8) + { + if (CheckStateL(aURI, aParentLUID) ) + { + TPtrC8 + parent(NSmlDmURI::RemoveLastSeg(aURI) ); + TPtrC8 + parentMapping(NSmlDmURI::LastURISeg(parent) ); + if (parentMapping == KAMDownloadNodeName) + { + currentList->InsertL( 0, + KAMDownloadDynaChilds); + ret = EOk; + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): ILLEGAL LEVEL 3 NODE %S", &aURI ); + User::Leave(KErrArgument); + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): DC has changed state %S", &aURI ); + ret = ENotFound; + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): Level3 Node not found %S", &aURI ); + ret = ENotFound; + } + } + } + else + if (numSeqs == 4) + { + TPtrC8 parent(NSmlDmURI::RemoveLastSeg(aURI) ); + TPtrC8 parentMapping(NSmlDmURI::LastURISeg(parent) ); + if (aParentLUID == KNullDesC8) + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): WARNING possibly a illegal level 4 node %S", &aURI ); + ret = ENotFound; + } + + if (parentMapping == KAMDeliveredNodeName) + { + if (GetLuid2L(aParentLUID, mapping, EDCSDelivered, + ret) > 0) + { + currentList->InsertL( 0, + KAMInventoryDeliveredDynaChilds); + ret = EOk; + } + } + else + if (parentMapping == KAMDeployedNodeName) + { + if (GetLuid2L(aParentLUID, mapping, EDCSActive, + ret) > 0) + { + currentList->InsertL( 0, + KAMInventoryDynaChilds); + ret = EOk; + } + else + if (GetLuid2L(aParentLUID, mapping, + EDCSInactive, ret) > 0) + { + currentList->InsertL( 0, + KAMInventoryDynaChilds); + ret = EOk; + } + } + else + if (mapping == KAMOperationsNodeName) + { + if (GetLuid2L(aParentLUID, parentMapping, + EDCSDownload, ret) > 0) + { + if (CheckStateL(aURI, aParentLUID) ) + { + currentList->InsertL( 0, + KAMDownloadOperationChilds); + ret = EOk; + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): Level3 operations DC changed state '%S'", &aURI ); + ret = ENotFound; + } + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): Level4 Node not found '%S'", &aURI ); + ret = ENotFound; + } + } + else + if (numSeqs == 5) + { + if (aParentLUID == KNullDesC8) + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): WARNING possibly a illegal level 5 node %S", &aURI ); + ret = ENotFound; + } + if (mapping == KAMOperationsNodeName) + { + TPtrC8 parent(NSmlDmURI::RemoveLastSeg(aURI) ); + TPtrC8 + parentMapping(NSmlDmURI::LastURISeg(parent) ); + TPtrC8 gparent(NSmlDmURI::RemoveLastSeg(parent) ); + TPtrC8 + gparentMapping(NSmlDmURI::LastURISeg(gparent) ); + if (gparentMapping == KAMDeliveredNodeName) + { + if (GetLuid2L(aParentLUID, parentMapping, + EDCSDelivered, ret) > 0) + { + currentList->InsertL( 0, + KAMDeliveredOperationChilds); + ret = EOk; + } + } + else + if (gparentMapping == KAMDeployedNodeName) + { + if (GetLuid2L(aParentLUID, parentMapping, + EDCSActive, ret) > 0) + { + currentList->InsertL( 0, + KAMDeployedOperationChilds); + ret = EOk; + } + else + if (GetLuid2L(aParentLUID, + parentMapping, EDCSInactive, + ret) > 0) + { + currentList->InsertL( 0, + KAMDeployedOperationChilds); + ret = EOk; + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): Level5 Node not found wrong parent '%S'", &aURI ); + ret = ENotFound; + } + } + else + { + RDEBUG8_2( "CSCOMOAdapter::ChildURIListL(): Level5 Node not found '%S'", &aURI ); + ret = ENotFound; + } + } + else + { + RDEBUG8_3( "CSCOMOAdapter::ChildURIListL(): ILLEGAL LEVEL %d NODE %S", numSeqs, &aURI ); + ret = EError; + } + + SetStatusL(aStatusRef, ret); + + if (ret == EOk) + { + if (iInAtomic) + { + iBuffer.Append(TAMCommandBufferElement(aStatusRef, aURI) ); + } + Callback().SetResultsL(aResultsRef, *currentList, KNullDesC8); + } + CleanupStack::PopAndDestroy(); //currentList + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::DeliverOrDownloadL( const TDesC8 &aUserId, const TDesC8 &aURI, TInt aCnt, +// const TDesC8 &aParentMapping, MSmlDmAdapter::TError &aStatus ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::DeliverOrDownloadL(const TDesC8 &aUserId, + const TDesC8 &aURI, TInt aCnt, const TDesC8 &aParentMapping, + MSmlDmAdapter::TError &aStatus) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); +#else + //Nothing +#endif + + switch (aCnt) + { + case 3: + { + if (aParentMapping == KAMDownloadNodeName) + { + TUint32 luid(SessionL().DownloadL(aUserId) ); + Callback().SetMappingL(aURI, *IntToDes8LC(luid) ); + CleanupStack::PopAndDestroy(); + aStatus = EOk; + } + else + { + RDEBUG( "CSCOMOAdapter::DeliverOrDownloadL(): ERROR Illegal parent"); + } + break; + } + case 4: + { + if (aParentMapping == KAMDeliveredNodeName) + { + TUint32 luid(SessionL().DeliverL(aUserId) ); + Callback().SetMappingL(aURI, *IntToDes8LC(luid) ); + CleanupStack::PopAndDestroy(); + aStatus = EOk; + } + else + { + RDEBUG( "CSCOMOAdapter::DeliverOrDownloadL(): ERROR Illegal parent"); + } + break; + } + default: + { + RDEBUG( "CSCOMOAdapter::DeliverOrDownloadL(): ERROR Illegal URI"); + break; + } + } + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::AddNodeObjectL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::AddNodeObjectL(const TDesC8& aURI, + const TDesC8& aParentLUID, TInt aStatusRef) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY //Done by Dipak + TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI); + TPtrC8 mapping( NSmlDmURI::LastURISeg( uriPtrc ) ); + TPtrC8 parent( NSmlDmURI::RemoveLastSeg( uriPtrc ) ); + TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ); +#else + TPtrC8 mapping(NSmlDmURI::LastURISeg(aURI) ); + TPtrC8 parent(NSmlDmURI::RemoveLastSeg(aURI) ); + TPtrC8 parentMapping(NSmlDmURI::LastURISeg(parent) ); + TInt cnt(NSmlDmURI::NumOfURISegs(aURI) ); +#endif + + RDEBUG8_3( "CSCOMOAdapter::AddNodeObjectL(): begin '%S', '%S'", &aURI, &aParentLUID ); + SetAdapterValue(KAMSCOMOAdapter); + CheckStateChangesL(); + TError status(EError); + // TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) );//Dipak + // TPtrC8 parent( NSmlDmURI::RemoveLastSeg( aURI ) ); + // TPtrC8 parentMapping( NSmlDmURI::LastURISeg( parent ) ); + // TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ); + TUint32 iluid( GetLuidL( aParentLUID, mapping, (parentMapping == KAMDeliveredNodeName ? EDCSDelivered : ( parentMapping == KAMDownloadNodeName ? EDCSDownload : EDCSNone ) ) ) ) ; + if( !iluid) + { + // This is added for avoiding duplicate node creation in Delivered/Download only. + iluid = GetLuidL( aParentLUID, mapping, (parentMapping == KAMDeliveredNodeName ? EDCSDownload:EDCSDelivered )); + } + if (iluid == 0) + { + // Not found, add it ... + DeliverOrDownloadL(mapping, aURI, cnt, parentMapping, status); + } + else + { + RDEBUG_2( "CSCOMOAdapter::AddNodeObjectL(): WARNING May Already exists '%d'", iluid ); + TDeploymentComponent comp; + TInt err(SessionL().DeploymentComponent(iluid, comp) ); + if (err == KErrNone) + { + RDEBUG_2( "CSCOMOAdapter::AddNodeObjectL(): ERROR Already exists '%d'", iluid ); + if (comp.iState == StateL(aURI) ) + { + RDEBUG( "CSCOMOAdapter::AddNodeObjectL(): (state is ok) " ); + } + else + { + RDEBUG( "CSCOMOAdapter::AddNodeObjectL(): (state is NOK) " ); + } + status = EAlreadyExists; + } + else + { + if (err == KErrNotFound) + { + RDEBUG_2( "CSCOMOAdapter::AddNodeObjectL(): WARNING Already exists but not found '%d'", iluid ); + DeliverOrDownloadL(mapping, aURI, cnt, parentMapping, status); + } + else + { + + RDEBUG_2( "CSCOMOAdapter::AddNodeObjectL(): ERROR May exists, but failed to fetch get one? '%d'", err ); + } + } + } + if (status == EOk) + { + if (iInAtomic) + { + iBuffer.Append(TAMCommandBufferElement(aStatusRef, aURI) ); + } + } + + //status = EAcceptedForProcessing; + //TInt error = 202; + SetStatusL(aStatusRef, status); + RDEBUG( "CSCOMOAdapter::AddNodeObject(): end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::GetSizeL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +TInt CSCOMOAdapter::GetSizeL(const TDeplCompAttrType aDataType, + const TInt aLuid, TError &aRet) + { + TInt size( 0); + if (aDataType == EDCStateValue) + { + TDeploymentComponent comp; + TInt err(SessionL().DeploymentComponent(aLuid, comp) ); + if (err == KErrNone) + { + if (comp.iState == EDCSActive) + { + size = KAMStateValueActive().Length(); + } + else if (comp.iState == EDCSDelivered) + { + size = KAMStateValueDelivered().Length(); + } + else + { + size = KAMStateValueInactive().Length() ; + } + aRet = EOk; + } + } + else + { + size = SessionL().DeploymentComponentDataSizeL(aLuid, aDataType); + aRet = EOk; + } + return size; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::FetchLeafObjectSizeL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef) + { + + RDEBUG8_4("CSCOMOAdapter::FetchLeafObjectSizeL('%S', '%S', '%S'): begin", &aURI, &aLUID, &aType ); + CheckStateChangesL(); + TError status(EError); + CBufBase *currentList = CBufFlat::NewL( 128); + CleanupStack::PushL(currentList); + + TPtrC8 mapping(NSmlDmURI::LastURISeg(aURI) ); + TPtrC8 parent(NSmlDmURI::RemoveLastSeg(aURI) ); + TPtrC8 parentMapping(NSmlDmURI::LastURISeg(parent) ); + TInt size( 0); + HBufC8 *luid= NULL; + if (aLUID != KNullDesC8) + { + luid = aLUID.AllocLC(); + } + else + { // try if we find it from download path + TBuf8<256> down; + down = KDownloadURI; + down.Append(parentMapping); + luid = Callback().GetLuidAllocL(down); + CleanupStack::PushL(luid); + if ( *luid != KNullDesC8) + { + // make it to found next time + DirectSetMappingL(parent, *luid); + MoveAclL(down, parent); + + // remove old + DirectSetMappingL(down, KNullDesC8); + } + } + TDeplCompAttrType dataType(UpdateFlagFromMapping(mapping) ); + if ( *luid != KNullDesC8) + { + TUint32 iluid(DesToIntL( *luid )); + RDEBUG_2( "CSCOMOAdapter::FetchLeafObjectSizeL(): Luid is : %d", iluid ); + size = GetSizeL(dataType, iluid, status); + } + else + { + TUint32 iluid(GetLeafLuidL(aURI, parentMapping) ); + if (iluid > 0) + { + HBufC8 *l = IntToDes8LC(iluid); + DirectSetMappingL(parent, *l); + CleanupStack::PopAndDestroy(l); + size = GetSizeL(dataType, iluid, status); + } + else + { + RDEBUG8_2( "CSCOMOAdapter::FetchLeafObjectSizeL(): WARNING Faild to get luid allocation for '%S'", &parent ); + if (aLUID == KNullDesC8) + { + status = ENotFound; + } + } + } + SetStatusL(aStatusRef, status); + if (status == EOk && size > 0) + { + HBufC8 *hsize = IntToDes8LC(size); + currentList->InsertL( 0, *hsize); + if (iInAtomic) + { + iBuffer.Append(TAMCommandBufferElement(aStatusRef, aURI) ); + } + Callback().SetResultsL(aResultsRef, *currentList, aType); + CleanupStack::PopAndDestroy(hsize); + } + CleanupStack::PopAndDestroy(luid); + CleanupStack::PopAndDestroy(currentList); //currentList + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::ExecuteCommandL(const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, TInt /*aStatusRef*/) + { + RDEBUG("CSCOMOAdapter::ExecuteCommandL(stream): begin (NOT SUPPORTED)"); + User::Leave(KErrNotSupported); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::CopyCommandL( const TDesC8& aURI, const TDesC& aParentLUID ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::CopyCommandL(const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/, + TInt aStatusRef) + { + RDEBUG("CSCOMOAdapter::CopyCommandL(): begin (NOT SUPPORTED)"); + SetStatusL(aStatusRef, EError); + + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::StartAtomicL( ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::StartAtomicL() + { + RDEBUG("CSCOMOAdapter::StartAtomicL(): begin (NOT properly SUPPORTED)"); + iInAtomic = ETrue; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::CommitAtomicL( ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::CommitAtomicL() + { + RDEBUG("CSCOMOAdapter::CommitAtomicL(): begin (NOT SUPPORTED)"); + iInAtomic = EFalse; // the initial statuses are already set + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::RollbackAtomicL( ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::RollbackAtomicL() + { + RDEBUG("CSCOMOAdapter::RollbackAtomicL(): begin (NOT properly SUPPORTED)"); + TInt count(iBuffer.Count() ); + for (TInt i( 0); i < count; i++) + { + TAMCommandBufferElement &pm(iBuffer[i]); + SetStatusL(pm.iStatusRef, ERollbackFailed); + } + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::StreamingSupport( ) +// ------------------------------------------------------------------------------------------------ +TBool CSCOMOAdapter::StreamingSupport(TInt& aItemSize) + { + RDEBUG("CSCOMOAdapter::StreamingSupport(): begin"); + //aItemSize = 1024; + + // After Generic alert is sent delete that entry from database and notify + // AM server to delete the appropriate entry in its database. + + if(aItemSize == KNSmlDMResetGenAlerts) + { + TSmlProfileId profId = 0; + HBufC8* serverId = NULL; + TRAP_IGNORE(GetServerInfoL( profId, serverId )); + + + TUint32 internalid; + RPointerArray genericalerts; + + + // Get generic alert entry from Database for particular server ID. + TRAPD(err, iAMdb->GetEntryForServerIDL(genericalerts, *serverId)); + + if (genericalerts.Count()!= KErrNone && err == KErrNone) + { + for(TInt i=0; iiLUID; + // Delete the all the generic alert details from SCOMO adapeter DB + // Also delete the appropriate entry from AM Server DB as well. + TRAP_IGNORE(iAMdb->DeleteFromDatabaseL(internalid)); + TRAP_IGNORE(SessionL().GenericAlertSentL(internalid)); + } + } + + + genericalerts.ResetAndDestroy(); + delete serverId; + + _LIT(KNull,""); + // No monitoring required after generic alert is sent + TInt err_rep = KErrNone; + CRepository *repository1 = NULL; + + TRAP(err_rep, repository1 =CRepository::NewL ( KCRUidDeviceManagementInternalKeys )); + + if(err_rep == KErrNone) + { + repository1 ->Set(KDevManServerIdKey ,KNull); + repository1 ->Set(KDevManIapIdKey, KErrNone); + repository1 ->Set(KDevManEnableDMNetworkMon, KErrNone); + } + + if(repository1) + delete repository1; + + } + aItemSize = 1024; + RDEBUG("CSCOMOAdapter::StreamingSupport(): end"); + return ETrue; + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::StreamCommittedL( ) +// ------------------------------------------------------------------------------------------------ +#ifdef __TARM_SYMBIAN_CONVERGENCY +void CSCOMOAdapter::StreamCommittedL( RWriteStream& /*aStream*/) +#else +void CSCOMOAdapter::StreamCommittedL() +#endif + { + RDEBUG("CSCOMOAdapter::StreamCommittedL(): begin"); + + if (iStreamOpen) + { + iStream.CommitL(); + } + + MSmlDmAdapter::TError status = EOk; + + TRAPD( err, _UpdateLeafObjectL( *iStreamedURI, *iStreamedLuid, KNullDesC8(), *iStreamedType, iStatusRef, status ) ) + ; + + if (err != KErrNone) + { + RDEBUG_2("CSCOMOAdapter::StreamCommittedL(): _UpdateLeafObjectL returned error (%d)", err); + } + + iIsStreamedContent = EFalse; + iStreamOpen = EFalse; + + Callback().SetStatusL(iStatusRef, status); + + RDEBUG("CSCOMOAdapter::StreamCommittedL(): end"); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::CloseStreaming( ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::CloseStreaming() + { + if (iStreamOpen) + { + RDEBUG("CSCOMOAdapter::CloseStreaming(): closing"); + iStreamFile.Close(); // !!! Closing this will also close the iStreamRFs because it is adopted from server + iStreamOpen = EFalse; + } + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::CompleteOutstandingCmdsL() +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::CompleteOutstandingCmdsL() + { + RDEBUG("CSCOMOAdapter::CompleteOutstandingCmdsL(): begin"); + /* iManagement.Close(); + iSessionOpened = EFalse ;*/ + iBuffer.Reset(); + RDEBUG("CSCOMOAdapter::CompleteOutstandingCmdsL(): Management session closed"); + } + +// ------------------ +// +// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +const TImplementationProxy ImplementationTable[] = + { + // + IMPLEMENTATION_PROXY_ENTRY( KAMAdapterImplUid, CSCOMOAdapter::NewL ) + }; + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ +TInt CSCOMOAdapter::DesToIntL(const TDesC8& aLuid) + { + TLex8 lex(aLuid); + TInt value = 0; + User::LeaveIfError(lex.Val(value) ); + return value; + } + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ +HBufC8* CSCOMOAdapter::IntToDes8LC(const TInt aLuid) + { + HBufC8* buf = HBufC8::NewLC( 10); //10 = max length of 32bit integer + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + return buf; + } + +// ------------------------------------------------------------------------------------------------ +// +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::ConstructL() + { + iAMdb = CSCOMOAdapterDb::NewL(); + +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.ConnectL(); +#else + User::LeaveIfError(iDbSession.Connect()); +#endif + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::SetStatusL( TInt aStatusRef, MSmlDmAdapter::TError aErrorCode ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::SetStatusL(TInt aStatusRef, + MSmlDmAdapter::TError aErrorCode) + { + RDEBUG_3("CSCOMOAdapter::SetStatusL( %d, %d )", aStatusRef, aErrorCode ); + Callback().SetStatusL(aStatusRef, aErrorCode); + } + +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::SetResultsL( TInt aResultsRef, CBufBase& aObject, const TDesC8& aType ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::SetResultsL(TInt aResultsRef, CBufBase& aObject, + const TDesC8& aType) + { + Callback().SetResultsL(aResultsRef, aObject, aType); + + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CSCOMOAdapter::FillNodeInfoL(MSmlDmDDFObject& aNode, + TSmlDmAccessTypes aAccTypes, MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription) + { + FillNodeInfoNoDefaultMimeL(aNode, aAccTypes, aOccurrence, aScope, + aFormat, aDescription); + if (aFormat!=MSmlDmDDFObject::ENode) + { + aNode.AddDFTypeMimeTypeL(KAMTextPlain); + } + + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::FillNodeInfoNoDefaultMimeL() +// Fills the node info in ddf structure, without default mime type +// ------------------------------------------------------------------------------------- +void CSCOMOAdapter::FillNodeInfoNoDefaultMimeL(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); + + aNode.SetDescriptionL(aDescription); + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::CheckStateChangesInternalL() +// Updates the changed DC states to DM client mappings and ACLs +// ------------------------------------------------------------------------------------- +void CSCOMOAdapter::CheckStateChangesInternalL() + { + +#ifdef __AM_CHECKSTATE_CHANGES + RDEBUG( "CSCOMOAdapter::CheckStateChangesLInternal(): begin" ); + if ( !iUpdated) + { + RDEBUG( "CSCOMOAdapter::CheckStateChangesLInternal(): !iUpdated" ); + RElementIdArray arr; + CleanupClosePushL(arr); + SessionL().CheckStatusNodesL(); + RElementIdArray array; + TInt err( SessionL().DeploymentComponentIdsL( array, EDCSActive ) ); //to sync with SIS/Java registry + err = SessionL().DeploymentComponentIdsL( array, EDCSInactive ); //to sync with SIS/Java registry + CleanupClosePushL(array); + err = SessionL().StateChangingDCIdsL(arr); + if (err == KErrNone) + { + TInt c(arr.Count() ); + for (TInt i( 0); i < c; i++) + { + TDeploymentComponent comp; + err = iManagement.DeploymentComponent(arr[i], comp); + if (err == KErrNone) + { + TDCUserId dc; + SessionL().DeploymentComponentUserIdL(arr[i], dc); + const TInt KNSmlDmMaxUriLength = 256; + HBufC8 *uri = HBufC8::NewLC(KNSmlDmMaxUriLength); + TPtr8 puri(uri->Des() ); +#ifdef __TARM_SYMBIAN_CONVERGENCY + RDmTreeNode uriNode; + CleanupClosePushL(uriNode); + + RBuf8 acl; + acl.CreateL(128); + CleanupClosePushL(acl); + + HBufC8 *newUri = HBufC8::NewLC( KNSmlDmMaxUriLength ); + TPtr8 pnewUri( newUri->Des() ); + + RDmTreeNode newUriNode; + CleanupClosePushL(newUriNode); +#else + CBufBase* acl = CBufFlat::NewL( 128); + CleanupStack::PushL(acl); + + HBufC8 *newUri = HBufC8::NewLC(KNSmlDmMaxUriLength); + TPtr8 pnewUri(newUri->Des() ); + +#endif + + switch (comp.iOldState) + { + case EDCSDelivered: + { + RDEBUG( "CSCOMOAdapter::CheckStateChangesLInternal(): Old State = EDCSDelivered" ); + puri.Copy(KDeliveredURI() ); + puri.Append(dc); + + HBufC8 *luid = DirectGetLuidAllocLC(puri); + + if ( *luid == KNullDesC8) + { // probably moved already + iManagement.StateChangeComplete(arr[i]); + } + else + { + // "Nullify" the old mapping + //DirectSetMappingL( puri, KNullDesC8 ); + DirectRemoveMappingL(puri); +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(puri, uriNode, RDmTree::EReadOnly); + uriNode.DmPropertyL( DevMan::EACL, acl ); +#else + err = iDbSession.GetAclL(puri, *acl, EFalse); // no need for inherited +#endif + // Determine new uri + switch (comp.iState) + { + case EDCSActive: + case EDCSInactive: // both have same node + { + pnewUri.Copy(KDeployedURI() ); + pnewUri.Append(dc); + DirectSetMappingL(pnewUri, *luid); + if (err == KErrNone) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(pnewUri, newUriNode, RDmTree::EReadOnly); + uriNode.RemoveDmPropertyL( DevMan::EACL ); + newUriNode.SetDmPropertyL( DevMan::EACL, acl ); +#else + err = iDbSession.DeleteAclL(puri); + + err = iDbSession.UpdateAclL( + pnewUri, acl->Ptr( 0) ); +#endif + } + else + { + RDEBUG_2("CSCOMOAdapter::CheckStateChangesL: ERROR Failed to get acl from %d ", err ); + } + iManagement.StateChangeComplete(arr[i]); + break; + } + default: + { + + RDEBUG_2("CSCOMOAdapter::CheckStateChangesL: WARNING Illegal state change from delivered to %d ", comp.iState ); + + break; + } + } + } + CleanupStack::PopAndDestroy(luid); + break; + } + case EDCSDownload: + { + RDEBUG( "CSCOMOAdapter::CheckStateChangesLInternal(): Old State = EDCSDownload" ); + puri.Copy(KDownloadURI() ); + //check DC contains SCOMODefault. + TBuf8<256> staticnode; + TInt staticnodeenabled = 0; + CRepository* cenrep = CRepository::NewLC( KCRUidPrivateApplicationManagementKeys ); + cenrep->Get( KAMDownloadPredefinedNode, staticnode ); + cenrep->Get( KAMStaticNodeEnabled, staticnodeenabled ); + CleanupStack::PopAndDestroy(); //cenrep + if (dc.Find(staticnode) != KErrNotFound && staticnodeenabled) + { + puri.Append(staticnode); + } + else + { + puri.Append(dc); + } + + + HBufC8 *luid = DirectGetLuidAllocLC(puri); //Callback().GetLuidAllocL( puri ); + //CleanupStack::PushL( luid ); + if ( *luid == KNullDesC8) + { // probably moved already + CleanupStack::PopAndDestroy(luid); + puri.Copy(KDeliveredURI() ); + puri.Append(dc); + luid = DirectGetLuidAllocLC(puri); //Callback().GetLuidAllocL( puri ); + if ( *luid == KNullDesC8) + { // probably moved already + + iManagement.StateChangeComplete(arr[i]); + + } + } + else + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(puri, uriNode, RDmTree::EReadOnly); + uriNode.DmPropertyL( DevMan::EACL, acl ); +#else + err = iDbSession.GetAclL(puri, *acl, EFalse); // no need for inherited +#endif + // "Nullify" the old mapping + //DirectSetMappingL( puri, KNullDesC8 ); + DirectRemoveMappingL(puri); + switch (comp.iState) + { + case EDCSActive: + case EDCSInactive: // both have same node + { + pnewUri.Copy(KDeployedURI() ); + pnewUri.Append(dc); + DirectSetMappingL(pnewUri, *luid); + if (err == KErrNone) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(pnewUri, newUriNode, RDmTree::EReadOnly); + uriNode.RemoveDmPropertyL( DevMan::EACL ); + newUriNode.SetDmPropertyL( DevMan::EACL, acl ); +#else + err = iDbSession.DeleteAclL(puri); + err = iDbSession.UpdateAclL( + pnewUri, acl->Ptr( 0) ); +#endif + } + else + { + RDEBUG_2("CSCOMOAdapter::CheckStateChangesL: ERROR Failed to get acl from %d ", err ); + } + iManagement.StateChangeComplete(arr[i]); + break; + } + case EDCSDelivered: + { + RDEBUG( "CSCOMOAdapter::CheckStateChangesLInternal(): Current State = EDCSDelivered" ); + pnewUri.Copy(KDeliveredURI() ); + pnewUri.Append(dc); + DirectSetMappingL(pnewUri, *luid); + if (err == KErrNone) + { +#ifdef __TARM_SYMBIAN_CONVERGENCY + iDbSession.OpenNodeL(pnewUri, newUriNode, RDmTree::EReadOnly); + uriNode.RemoveDmPropertyL( DevMan::EACL ); + newUriNode.SetDmPropertyL( DevMan::EACL, acl ); +#else + + err = iDbSession.DeleteAclL(puri); + err = iDbSession.UpdateAclL( + pnewUri, acl->Ptr( 0) ); +#endif + } + else + { + RDEBUG_2("CSCOMOAdapter::CheckStateChangesL: ERROR Failed to get acl from %d ", err ); + } + iManagement.StateChangeComplete(arr[i]); + break; + } + default: + { + + RDEBUG_2("CSCOMOAdapter::CheckStateChangesL: WARNING Illegal state change from delivered to %d ", comp.iState ); + break; + } + } + + } + CleanupStack::PopAndDestroy(luid); + break; + } + case EDCSActive: + case EDCSInactive: // these both are in same node + { + + RDEBUG_3("CSCOMOAdapter::CheckStateChangesL: No need to move anything in change from %d to %d ", comp.iOldState, comp.iState ); + iManagement.StateChangeComplete(arr[i]); + break; + } + } +#ifdef __TARM_SYMBIAN_CONVERGENCY + CleanupStack::PopAndDestroy( &newUriNode ); + CleanupStack::PopAndDestroy( newUri ); + CleanupStack::PopAndDestroy( &uriNode ); + CleanupStack::PopAndDestroy( &acl ); + CleanupStack::PopAndDestroy( uri ); +#else + CleanupStack::PopAndDestroy(newUri); + CleanupStack::PopAndDestroy(acl); + CleanupStack::PopAndDestroy(uri); +#endif + } + else + { + RDEBUG_2("CSCOMOAdapter::CheckStateChangesL: ERROR Failed to get component: %d ", err ); + } + } + iUpdated = ETrue; + } + else + { + RDEBUG_2("CSCOMOAdapter::CheckStateChangesL: ERROR Failed to get state change dcs: %d ", err ); + } + CleanupStack::PopAndDestroy( &array); + CleanupStack::PopAndDestroy( &arr); + } + else + { + RDEBUG("CSCOMOAdapter::CheckStateChangesL: Already updated! "); + } + RDEBUG( "CSCOMOAdapter::CheckStateChangesL(): end" ); +#else + DBG_ARGS8( "CSCOMOAdapter::CheckStateChangesL(): disabled" ); +#endif + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::CheckStateChangesL() +// Updates acl and mapping trees to match state changes +// ------------------------------------------------------------------------------------- +void CSCOMOAdapter::CheckStateChangesL() + { + iCertRequired = EFalse; + RDEBUG( "CSCOMOAdapter::CheckStateChangesL(): iCertRequired = EFalse" ); + TRAPD( err, CheckStateChangesInternalL() ) + ; + if (err != KErrNone) + { + RDEBUG_2("CSCOMOAdapter::CheckStateChangesL(): warning failed to check state changes %d", err ); + } + iCertRequired = ETrue; + RDEBUG( "CSCOMOAdapter::CheckStateChangesL(): iCertRequired = ETrue" ); + if ( !iTrustAdded) + { + RDEBUG( "CSCOMOAdapter::CheckStateChangesL(): Adding Trust Closing Session" ); + iManagement.Close(); + iSessionOpened = EFalse; + RApplicationManagement &session = SessionL(); + RDEBUG( "CSCOMOAdapter::CheckStateChangesL(): Adding Trust new session started" ); + } + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::URISegsUpTo(const TDesC8& aURI, TInt aUpTo) +// ------------------------------------------------------------------------------------- +TPtrC8 CSCOMOAdapter::URISegsUpTo(const TDesC8& aURI, TInt aUpTo, + TBool aInclKeno/*=EFalse*/) + { + + TPtrC8 ret; + TInt numOfURISegs( 0); + for (TInt i( 0); i < aURI.Length() && ret.Ptr() == NULL; i++) + { + if (aURI[i] == KNSmlDMUriSeparator) + { + numOfURISegs++; + if (aUpTo == numOfURISegs) + { + if (aInclKeno && aURI.Length() > i+1) + { + ret.Set(aURI.Left(i + 1) ); + } + else + { + ret.Set(aURI.Left(i) ); + } + } + } + } + return ret; + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::DirectGetLuidAllocLC( const TDesC8 &aURI ) +// ------------------------------------------------------------------------------------- +HBufC8 *CSCOMOAdapter::DirectGetLuidAllocLC(const TDesC8 &aURI) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + HBufC8 *ret = Callback().GetLuidAllocL( aURI ); +#else + HBufC8* ret = iDbSession.GetLuidAllocL(KAMAdapterImplUid, aURI); +#endif + + CleanupStack::PushL(ret); + return ret; + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::DirectSetMappingL( const TDesC8 &aURI, const TDesC8 &aLUID ) +// ------------------------------------------------------------------------------------- +TInt CSCOMOAdapter::DirectSetMappingL(const TDesC8 &aURI, const TDesC8 &aLUID) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TRAPD( err, Callback().SetMappingL( aURI, aLUID ) ); +#else + TInt err(iDbSession.AddMappingInfoL(KAMAdapterImplUid, aURI, aLUID) ); +#endif + return err; + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::MoveAclL( const TDesC8 &aFrom, const TDesC8 &aTo ) +// ------------------------------------------------------------------------------------- +void CSCOMOAdapter::MoveAclL(const TDesC8 &aFrom, const TDesC8 &aTo) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + RDmTreeNode from; + CleanupClosePushL(from); + + RDmTreeNode to; + CleanupClosePushL(to); + + RBuf8 acl; + acl.CreateL(128); + CleanupClosePushL(acl); + + iDbSession.OpenNodeL(aFrom, from, RDmTree::EReadOnly); + TRAPD( err, from.DmPropertyL( DevMan::EACL, acl ) ); + if ( err == KErrNone ) + { + iDbSession.OpenNodeL(aTo, to, RDmTree::EReadOnly); + from.RemoveDmPropertyL( DevMan::EACL ); + to.SetDmPropertyL( DevMan::EACL, acl ); + } + CleanupStack::PopAndDestroy( 3, &from ); +#else + CBufBase *acl = CBufFlat::NewL( 128); + CleanupStack::PushL(acl); + TInt err(iDbSession.GetAclL(aFrom, *acl, EFalse) ); // no need for inherited + if (err == KErrNone) + { + err = iDbSession.DeleteAclL(aFrom); + err = iDbSession.UpdateAclL(aTo, acl->Ptr( 0) ); + } + CleanupStack::PopAndDestroy(acl); +#endif + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::SetMappingL( const TDesC8 &aOriginalURI, +// const TDeploymentComponentState aTargetState, const TDesC8 &aLUID ) +// ------------------------------------------------------------------------------------- +void CSCOMOAdapter::SetMappingL(const TDesC8 &aOriginalURI, + const TDeploymentComponentState aTargetState, const TDesC8 &aLUID) + { + + HBufC8 * targeturi= NULL; + SetMappingLC(aOriginalURI, aTargetState, aLUID, targeturi); + CleanupStack::PopAndDestroy(targeturi); + } + +// ------------------------------------------------------------------------------------- +// CSCOMOAdapter::SetMappingLC( const TDesC8 &aOriginalURI, +// const TDeploymentComponentState aTargetState, const TDesC8 &aLUID, +// HBufC8 *&aNewUri ) +// ------------------------------------------------------------------------------------- +void CSCOMOAdapter::SetMappingLC(const TDesC8 &aOriginalURI, + const TDeploymentComponentState aTargetState, const TDesC8 &aLUID, + HBufC8 *&aNewUri) + { + + // "Nullify" the mapping for argument + DirectSetMappingL(aOriginalURI, KNullDesC8); + + // Determine new uri for aArgument + TPtrC8 puri; + if (aNewUri == NULL) + { + TPtrC8 argMapping(NSmlDmURI::LastURISeg(aOriginalURI) ); + TPtrC8 target; + if (aTargetState == EDCSInactive || aTargetState == EDCSActive) + { + target.Set(KDeployedURI() ); + } + else + if (aTargetState == EDCSDelivered) + { + target.Set(KDeliveredURI() ); + } + else + { + + User::Leave(KErrArgument); + } + + aNewUri = HBufC8::NewLC(target.Length() + argMapping.Length() ); + TPtr8 p(aNewUri->Des() ); + p.Copy(target); + p.Append(argMapping); + puri.Set(p); + } + else + { + puri.Set( *aNewUri); + } + DirectSetMappingL(puri, aLUID); + MoveAclL(aOriginalURI, puri); + } + +#ifdef __AM_LASTERROR_NODE +// ------------------------------------------------------------------------------------------------ +// CSCOMOAdapter::SetLastErrorL( const TDesC8& aLastError, const TInt aError ) +// ------------------------------------------------------------------------------------------------ +void CSCOMOAdapter::SetLastErrorL(const TDesC8& aLastError, const TInt aError) + { + if (iLastError) + { + TPtrC8 p(*iLastError); + RDEBUG8_2( "CSCOMOAdapter::SetLastErrorL: clearing last error %S", &p); + delete iLastError; + iLastError = NULL; + } + iLastError = HBufC8::NewL(aLastError.Length() + 10); + iLastError->Des().Format(aLastError, aError); + } + +const TDesC8& CSCOMOAdapter::LastError() + { + return iLastError == NULL ? KNullDesC8() : *iLastError; + } + +#endif + +TPtrC8 CSCOMOAdapter::LastURISeg(const TDesC8& aURI) + { + TInt i; + for (i=aURI.Length()-1; i>=0; i--) + { + if (aURI[i]==KNSmlDMAMSeparatorDef) + { + break; + } + } + if (i==0) + { + return aURI; + } + else + { + return aURI.Mid(i+1); + } + } + +TInt CSCOMOAdapter::DesToInt(const TDesC8& aLuid) + { + TLex8 lex(aLuid); + TInt value = 0; + lex.Val(value); + return value; + } +void CSCOMOAdapter::CheckAndAddPredefinedNodeL() + { + + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): begin"); + + // Check if SCOMODefault node addition is enabled. + TInt staticnodeenabled = 0; + CRepository* cenrep = CRepository::NewLC( KCRUidPrivateApplicationManagementKeys ); + cenrep->Get( KAMStaticNodeEnabled, staticnodeenabled ); + CleanupStack::PopAndDestroy(); //cenrep + + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step1"); + + if(staticnodeenabled) + { + TBuf8 temp; + + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step2"); + GetPredefinedNodeL(temp); + + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step3"); + if (temp.Length()) + { + + + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step4"); + TBuf8 temp1; + temp1.Zero(); + temp1.Copy(KAMNodeName); + temp1.Append(KAMSeparator8); + temp1.Append(KAMDownloadNodeName); + temp1.Append(KAMSeparator8); + temp1.Append(temp); + + HBufC8* luid = DirectGetLuidAllocLC(temp1); + + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step5"); + + if (luid->Length() > 0) + { + CleanupStack::PopAndDestroy(luid); + return; + } + else + { + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step6"); + // Not found, add node and mapping ... + //TError status(EError); + TPtrC8 mapping(NSmlDmURI::LastURISeg(temp1) ); + TPtrC8 parent(NSmlDmURI::RemoveLastSeg(temp1) ); + TPtrC8 parentMapping(NSmlDmURI::LastURISeg(parent) ); + TInt cnt(NSmlDmURI::NumOfURISegs(temp1) ); + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step7"); + TUint32 newLuid(SessionL().DownloadL(mapping)); + //Callback().SetMappingL( temp1, *IntToDes8LC( newLuid ) ); + //CleanupStack::PopAndDestroy(); + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step8"); + DirectSetMappingL(temp1, *IntToDes8LC(newLuid) ); + RDEBUG("CSCOMOAdapter::CheckAndAddPredefinedNodeL(): step9"); + CleanupStack::PopAndDestroy(); // for IntToDes8LC() + CleanupStack::PopAndDestroy(luid); + } + } + } + } +// --------------------------------------------------------------------------- +// CAmAdapter::GetPredefinedNodeL() +// Gets predefined node for Download object from cenrep +// --------------------------------------------------------------------------- +// +void CSCOMOAdapter::GetPredefinedNodeL(TDes8& aNode) + { + CRepository* centrep( NULL); + aNode.Zero(); + centrep = CRepository::NewLC( KCRUidPrivateApplicationManagementKeys ); + + if ( centrep ) + { + TBuf8<256> temp; + TInt err = centrep->Get( KAMDownloadPredefinedNode, temp ); + if (centrep->Get( KAMDownloadPredefinedNode, temp )==KErrNone && temp.Length() ) + { + temp.Trim(); + aNode.Copy(temp); + } + CleanupStack::PopAndDestroy(centrep); + } + } +// ------------------------------------------------------------------------------------- +// CAmAdapter::DirectRemoveMappingL( const TDesC8 &aURI ) +// ------------------------------------------------------------------------------------- +TInt CSCOMOAdapter::DirectRemoveMappingL( const TDesC8 &aURI ) + { + +#ifdef __TARM_SYMBIAN_CONVERGENCY + TRAPD( err, Callback().SetMappingL( aURI, aLUID ) ); +#else + TInt err( iDbSession.RemoveMappingInfoL( KAMAdapterImplUid, aURI, ETrue ) ); +#endif + return err; + } +TInt CSCOMOAdapter::GetAdapterValue() + { + TInt adapterValue; + CRepository *repository = NULL; + TRAPD( err, repository = CRepository::NewL ( KCRUidPrivateApplicationManagementKeys ) ); + + RDEBUG_2("error reading cenrep %d", err); + if (err == KErrNone) + { + err = repository->Get(KAMAdapterValue, adapterValue); + } + delete repository; + repository = NULL; + return adapterValue; + } + +void CSCOMOAdapter::SetAdapterValue(TInt aAdapterValue) + { + CRepository *repository = NULL; + TRAPD( err, repository = CRepository::NewL ( KCRUidPrivateApplicationManagementKeys ) ); + if (err == KErrNone) + { + err = repository->Set(KAMAdapterValue, aAdapterValue); + } + delete repository; + repository = NULL; + } +TBool CSCOMOAdapter::RecognizeMimeType(const TDesC8& aMimeType) + { + TBool isSupportedMimeType = EFalse; + if ((aMimeType == KSisxMimeType )||(aMimeType == KSisMimeType )||(aMimeType == KPipMimeType )|| + (aMimeType == KJadMIMEType )||(aMimeType == KJarMIMEType )||(aMimeType == KJavaMIMEType )) + { + isSupportedMimeType = ETrue; + } + return isSupportedMimeType; + } +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/src/omascomoadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/src/omascomoadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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 applicationmanagement components + * +*/ + + +#include +#define KSmlDMInterfaceUid 0x102018B4 + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x20021335; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x20021336; // SCOMO DM Adapter implementation UID + version_no = 1; + display_name = "Application Management DM Adapter"; + default_data = ""; +#ifdef __TARM_SYMBIAN_CONVERGENCY + opaque_data = "host=0x101F9A02"; +#else + opaque_data = ""; +#endif + } + }; + } + }; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/omascomoadapter/src/omascomoadapterdb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/omascomoadapter/src/omascomoadapterdb.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,447 @@ +/* +* 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 applicationmanagement components + * +*/ + + +// INCLUDE FILES +#include +#include + +#include "omascomoadapterdb.h" +#include "debug.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSCOMOAdapterDb::NewL() +// Creates a new instance of CSCOMOAdapterDb object. +// --------------------------------------------------------------------------- +// +CSCOMOAdapterDb* CSCOMOAdapterDb::NewL() + { + RDEBUG("CSCOMOAdapterDb::NewL(): begin"); + + CSCOMOAdapterDb* self = CSCOMOAdapterDb::NewLC(); + CleanupStack::Pop(self); + + RDEBUG("CSCOMOAdapterDb::NewL(): end"); + + return self; + } + +// --------------------------------------------------------------------------- +// CSCOMOAdapterDb::NewLC() +// Creates a new instance of CSCOMOAdapterDb object. +// Pushes and leaves new instance onto CleanupStack. +// --------------------------------------------------------------------------- +// +CSCOMOAdapterDb* CSCOMOAdapterDb::NewLC() + { + RDEBUG("CSCOMOAdapterDb::NewLC(): begin"); + + CSCOMOAdapterDb* self = new( ELeave ) CSCOMOAdapterDb(); + CleanupStack::PushL(self); + self->ConstructL(); + + RDEBUG("CSCOMOAdapterDb::NewLC(): end"); + + return self; + } + +// --------------------------------------------------------------------------- +// CSCOMOAdapterDb::ConstructL() +// Second phase constructor. +// --------------------------------------------------------------------------- +// +void CSCOMOAdapterDb::ConstructL() + { + RDEBUG("CSCOMOAdapterDb::ConstructL(): begin"); + + TParse name; + TInt err; + + User::LeaveIfError(iFsSession.Connect()); + User::LeaveIfError(iRdbSession.Connect() ); + + iFsSession.SetSessionToPrivate(EDriveC); + +#ifdef SYMBIAN_SECURE_DBMS + name.Set(KAMAdapterDbName, NULL, NULL); + err = iDatabase.Open(iRdbSession, name.FullName(), KDBMSSecureID); +#else + name.Set( KAMAdapterDbName, KNonSecureDbFullName, NULL ); + err = iDatabase.Open(iRdbSession, DBFileName); +#endif + + if (err == KErrNotFound) + { + CreateandOpenL(name); + } + else + { + + if ( (err == KErrEof ) || (err == KErrCorrupt ) || (err + == KErrArgument )) + { + + iRdbSession.DeleteDatabase(name.FullName(), KAMPolicyUID); + CreateandOpenL(name); + } + + } + + RDEBUG("CSCOMOAdapterDb::ConstructL(): end"); + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::CreateandOpenL +// ----------------------------------------------------------------------------- +// +void CSCOMOAdapterDb::CreateandOpenL(TParse& name) + { + + TInt err; + +#ifdef SYMBIAN_SECURE_DBMS + iDatabase.Create(iRdbSession, name.FullName(), KDBMSSecureID); +#else + if( SysUtil::FFSSpaceBelowCriticalLevelL( &iFsSession, KEmptyDbSizeEstimate ) ) + { + User::Leave( KErrDiskFull ); + } + iDatabase.Create(iFsSession, name.FullName()); +#endif + + CreateTableL(iDatabase); + iDatabase.Close(); +#ifdef SYMBIAN_SECURE_DBMS + + err = iDatabase.Open(iRdbSession, name.FullName(), KDBMSSecureID); + +#else + err = iDatabase.Open(iFsSession, DBFileName); +#endif + + //Debug + if (err != KErrNone) + { + + User::LeaveIfError(err); + } + + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::CreateTableL +// ----------------------------------------------------------------------------- +// +void CSCOMOAdapterDb::CreateTableL(RDbDatabase& aDatabase) + { + + // Create a table definition + CDbColSet* columns=CDbColSet::NewLC(); + + // Add Columns + TDbCol id(NCol1, EDbColInt32); + + // automatic indexing for items,it is our key field. + id.iAttributes=id.EAutoIncrement; + columns->AddL(id); + columns->AddL(TDbCol(NCol2, EDbColInt32)); + columns->AddL(TDbCol(NCol3, EDbColInt32)); + columns->AddL(TDbCol(NCol4, EDbColText8, 255)); + columns->AddL(TDbCol(NCol5, EDbColText8, 255)); + columns->AddL(TDbCol(NCol6, EDbColText8, 255)); + columns->AddL(TDbCol(NCol7, EDbColInt32)); + + //possibility of Panic + + // Create a table + TRAPD(err, aDatabase.CreateTable(KTableAMMgmtObject, *columns) ); + + if(err!=KErrNone) + User::Leave(err); + + // cleanup the column set + CleanupStack::PopAndDestroy(columns); + + } + +// --------------------------------------------------------------------------- +// CSCOMOAdapterDb::CSCOMOAdapterDb() +// Constructor. +// --------------------------------------------------------------------------- +// +CSCOMOAdapterDb::CSCOMOAdapterDb() + { + RDEBUG("CSCOMOAdapterDb::CSCOMOAdapterDb(): begin"); + RDEBUG("CSCOMOAdapterDb::CSCOMOAdapterDb(): end"); + } + +// --------------------------------------------------------------------------- +// CSCOMOAdapterDb::~CSCOMOAdapterDb() +// Destructor. +// --------------------------------------------------------------------------- +// +CSCOMOAdapterDb::~CSCOMOAdapterDb() + { + RDEBUG("CSCOMOAdapterDb::~CSCOMOAdapterDb(): begin"); + + iView.Close(); + + delete iColSet; + iAMObjectTable.Close(); + + iDatabase.Close(); + iFsSession.Close(); + iRdbSession.Close(); + + RDEBUG("CSCOMOAdapterDb::~CSCOMOAdapterDb(): ends"); + } + +CAMDbItem::~CAMDbItem() + { + delete iServerID; + delete iCorrelator; + delete iSourceURI; + } + +void CSCOMOAdapterDb::GetEntryForServerIDL(RPointerArray& aItemArray, + TDesC8& aValue) + { + + aItemArray.Reset();// first reset the array + + _LIT(KEqualToString,"='%S'"); + _LIT(KQuery, "SELECT * FROM %S WHERE %S"); + + TBuf<256> serverid; + serverid.Copy(aValue); + + TBuf<100> bufsql; + bufsql.Append(KQuery); + bufsql.Append(KEqualToString); + TBuf<100> bufsql1; + bufsql1.Format(bufsql, &KTableAMMgmtObject, &NCol4, &serverid); + + ReadItemsL(aItemArray, bufsql1); + + } + + + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::ReadItemsL +// ----------------------------------------------------------------------------- +// +void CSCOMOAdapterDb::ReadItemsL(RPointerArray& aItemArray, + TDesC& aSqlQuery) + { + + RDbView view; + view.Prepare(iDatabase, TDbQuery(aSqlQuery)); + CleanupClosePushL(view); + view.EvaluateAll(); + view.FirstL(); + + while (view.AtRow()) + { + view.GetL(); + + CAMDbItem *dbitem = new(ELeave) CAMDbItem; + dbitem->id = view.ColInt(1); + dbitem->iLUID = view.ColInt(2); + dbitem->iProfileId = view.ColInt(3); + + dbitem->iServerID = (view.ColDes8(4)).AllocL(); + dbitem->iCorrelator = (view.ColDes8(5)).AllocL(); + dbitem->iSourceURI = (view.ColDes8(6)).AllocL(); + + dbitem->iRetryCount = view.ColInt(7); + + aItemArray.Append(dbitem); + view.NextL(); + } + + CleanupStack::PopAndDestroy(); // view + + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::SaveToDatabaseL +// ----------------------------------------------------------------------------- +// +void CSCOMOAdapterDb::SaveToDatabaseL(TInt& aIndex, TUint32 aLuid, + TInt aProfileid, TInt aRetryCount, const TDesC8& aSourceURI, + const TDesC8& aServerid, const TDesC8& aCorrelator) + { + + BeginDatabaseTransaction(); + + TFileName sqlQuery; + sqlQuery.Copy(_L("SELECT * FROM ")); + sqlQuery.Append(KTableAMMgmtObject); + + RDbView view; + view.Prepare(iDatabase, TDbQuery(sqlQuery)); + CleanupClosePushL(view); + + view.InsertL(); + + view.SetColL(2, aLuid); + view.SetColL(3, aProfileid); + view.SetColL(4, aServerid); + view.SetColL(5, aCorrelator); + view.SetColL(6, aSourceURI); + view.SetColL(7, aRetryCount); + + view.PutL(); + + aIndex = view.ColInt(1);// autoincrement gives us unique index. + + CleanupStack::PopAndDestroy(1); // view + + CommitDatabaseTransaction(); + + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::DeleteFromDatabaseL +// ----------------------------------------------------------------------------- +// +TBool CSCOMOAdapterDb::DeleteFromDatabaseL(TUint32 aLuid) + { + + TBool rowsdeleted = EFalse; + TFileName sqlQuery; + + PrepareLuidQuery(aLuid, sqlQuery); + + + BeginDatabaseTransaction(); + + RDbView view; + // query buffer with index finds only the selected item row. + view.Prepare(iDatabase, TDbQuery(sqlQuery)); + CleanupClosePushL(view); + + view.EvaluateAll(); + view.FirstL(); + + if (!view.IsEmptyL()) + { + // we have autoincrement in index so it should be unique + // but just to make sure, we use 'while', instead of 'if' + while (view.AtRow()) + { + view.GetL(); + view.DeleteL(); + view.NextL(); + } + + + CommitDatabaseTransaction(); + // compacts the databse, by physically removig deleted data. + iDatabase.Compact(); + rowsdeleted = ETrue; + } + CleanupStack::PopAndDestroy(1); // view + + + return rowsdeleted; + } + +void CSCOMOAdapterDb::UpdateRetryCountForLuidL(TInt aLuid, TInt aRetryCount) +{ + TFileName sqlQuery; + + PrepareLuidQuery(aLuid, sqlQuery); + + BeginDatabaseTransaction(); + + RDbView view; + view.Prepare(iDatabase, TDbQuery(sqlQuery)); + CleanupClosePushL(view); + + view.EvaluateAll(); + view.FirstL(); + + if(view.AtRow()) + { + view.UpdateL(); + view.SetColL(7, aRetryCount); + view.PutL(); + } + + CleanupStack::PopAndDestroy(1); // view + + CommitDatabaseTransaction(); +} + +TInt CSCOMOAdapterDb::GetRetryCountForLuidL(TInt aLuid) +{ + TInt retrycount = KErrNone; + TFileName sqlQuery; + + PrepareLuidQuery(aLuid, sqlQuery); + + BeginDatabaseTransaction(); + + RDbView view; + view.Prepare(iDatabase, TDbQuery(sqlQuery)); + CleanupClosePushL(view); + view.EvaluateAll(); + view.FirstL(); + + if (!view.IsEmptyL()) + { + + if(view.AtRow()) + { + view.GetL(); + } + + retrycount = view.ColInt(7); + + } + + CleanupStack::PopAndDestroy(1); // view + + CommitDatabaseTransaction(); + + return retrycount; + +} + +void CSCOMOAdapterDb::PrepareLuidQuery(TInt aLuid, TDes& aSqlQuery) +{ + aSqlQuery.Copy(_L("SELECT * FROM ")); + aSqlQuery.Append(KTableAMMgmtObject); + aSqlQuery.Append(_L(" WHERE ")); + aSqlQuery.Append(NCol2); + aSqlQuery.Append(_L(" = ")); + aSqlQuery.AppendNum(aLuid); +} + +void CSCOMOAdapterDb::BeginDatabaseTransaction() +{ + iDatabase.Begin(); +} + +void CSCOMOAdapterDb::CommitDatabaseTransaction() +{ + iDatabase.Commit(); +} diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/BWINS/AMInstallOptionsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/BWINS/AMInstallOptionsu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,8 @@ +EXPORTS + ?ParseOptionsL@InstallOptionsParser@@SAXABVTDesC8@@AAUTAMInstallOptions@NApplicationManagement@@@Z @ 1 NONAME ; void InstallOptionsParser::ParseOptionsL(class TDesC8 const &, struct NApplicationManagement::TAMInstallOptions &) + ?ParseOptionsL@InstallOptionsParser@@SAXABVTDesC8@@AAVTInstallOptions@SwiUI@@@Z @ 2 NONAME ; void InstallOptionsParser::ParseOptionsL(class TDesC8 const &, class SwiUI::TInstallOptions &) + ?ParseOptionsL@InstallOptionsParser@@SAXABVTDesC8@@AAVTUninstallOptions@SwiUI@@@Z @ 3 NONAME ; void InstallOptionsParser::ParseOptionsL(class TDesC8 const &, class SwiUI::TUninstallOptions &) + ?SerializeOptionsL@InstallOptionsParser@@SAXABUTAMInstallOptions@NApplicationManagement@@AAVCBufBase@@@Z @ 4 NONAME ; void InstallOptionsParser::SerializeOptionsL(struct NApplicationManagement::TAMInstallOptions const &, class CBufBase &) + ?SerializeOptionsL@InstallOptionsParser@@SAXABVTInstallOptions@SwiUI@@AAVCBufBase@@@Z @ 5 NONAME ; void InstallOptionsParser::SerializeOptionsL(class SwiUI::TInstallOptions const &, class CBufBase &) + ?SerializeOptionsL@InstallOptionsParser@@SAXABVTUninstallOptions@SwiUI@@AAVCBufBase@@@Z @ 6 NONAME ; void InstallOptionsParser::SerializeOptionsL(class SwiUI::TUninstallOptions const &, class CBufBase &) + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/eabi/AMInstallOptionsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/eabi/AMInstallOptionsu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,14 @@ +EXPORTS + _ZN20InstallOptionsParser13ParseOptionsLERK6TDesC8RN22NApplicationManagement17TAMInstallOptionsE @ 1 NONAME + _ZN20InstallOptionsParser13ParseOptionsLERK6TDesC8RN5SwiUI15TInstallOptionsE @ 2 NONAME + _ZN20InstallOptionsParser13ParseOptionsLERK6TDesC8RN5SwiUI17TUninstallOptionsE @ 3 NONAME + _ZN20InstallOptionsParser17SerializeOptionsLERKN22NApplicationManagement17TAMInstallOptionsER8CBufBase @ 4 NONAME + _ZN20InstallOptionsParser17SerializeOptionsLERKN5SwiUI15TInstallOptionsER8CBufBase @ 5 NONAME + _ZN20InstallOptionsParser17SerializeOptionsLERKN5SwiUI17TUninstallOptionsER8CBufBase @ 6 NONAME + _ZTI17CAMInstOptsParser @ 7 NONAME ; ## + _ZTI19CAMUninstOptsParser @ 8 NONAME ; ## + _ZTI21CAMInstOptsParserBase @ 9 NONAME ; ## + _ZTV17CAMInstOptsParser @ 10 NONAME ; ## + _ZTV19CAMUninstOptsParser @ 11 NONAME ; ## + _ZTV21CAMInstOptsParserBase @ 12 NONAME ; ## + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/group/AMInstallOptions.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/group/AMInstallOptions.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,45 @@ +/* +* 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: Implementation of applicationmanagement components +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include "defaultcaps.hrh" + +TARGET aminstalloptions.dll +TARGETTYPE dll +UID 0x10207835 +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE AMInstallOptions.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/xml +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +SYSTEMINCLUDE /epoc32/include/platform/xml +#endif + +LIBRARY xmlframework.lib +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY flogger.lib + + +SMPSAFE diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ +/* +* 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 application management options +* +*/ + + +#include +PRJ_EXPORTS +../inc/aminstalloptions.h |../../../inc/aminstalloptions.h +../rom/aminstalloptions.iby CORE_APP_LAYER_IBY_EXPORT_PATH(aminstalloptions.iby) + +PRJ_MMPFILES +AMInstallOptions.mmp + +//PRJ_TESTMMPFILES diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/group/instopts_def.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/group/instopts_def.xml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/inc/aminstalloptions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/inc/aminstalloptions.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2000 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: The interface +* +*/ + + +#ifndef __AMINSTALLOPTIONSAPI_H__ +#define __AMINSTALLOPTIONSAPI_H__ + +#include +namespace NApplicationManagement + { + const int KMaxConRef = 256; + struct TAMInstallOptions + { + TBuf8 iConRef; + TInt iIAP; + SwiUI::TInstallOptions iOptions; + TAMInstallOptions() : iConRef( KNullDesC8()), + iIAP(-1), iOptions() + { + } + }; + + typedef TPckgBuf TAMInstallOptionsPckgBuf; + typedef TPckg TAMInstallOptionsPckg; + + } + + +class InstallOptionsParser + { +public: + IMPORT_C static void ParseOptionsL( const TDesC8 &aBuffer, SwiUI::TInstallOptions &aResult); + IMPORT_C static void SerializeOptionsL( const SwiUI::TInstallOptions &aOptions, CBufBase &aResult ); + IMPORT_C static void ParseOptionsL( const TDesC8 &aBuffer, SwiUI::TUninstallOptions &aResult); + IMPORT_C static void SerializeOptionsL( const SwiUI::TUninstallOptions &aOptions, CBufBase &aResult ); + + IMPORT_C static void ParseOptionsL( const TDesC8 &aBuffer, NApplicationManagement::TAMInstallOptions &aResult); + IMPORT_C static void SerializeOptionsL( const NApplicationManagement::TAMInstallOptions &aOptions, CBufBase &aResult ); + }; + + +#endif + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/inc/aminstalloptionsint.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/inc/aminstalloptionsint.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2000 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: Internal header for ApplicationManagementOptions +* +*/ + + +#ifndef __AMINSTALLOPTIONSINT_H__ +#define __AMINSTALLOPTIONSINT_H__ + + +#include + +#include +#include +#include + + +class CAMInstOptsParserBase : public CBase, public Xml::MContentHandler + { +public: + virtual ~CAMInstOptsParserBase(); + void ParseL(); +protected: + const TDesC8 &iBuffer; + Xml::CParser *iParser ; + TInt iCustIndex ; + SwiUI::TPolicy iDefaultPolicy; + + CAMInstOptsParserBase( + const TDesC8 &aBuffer, + SwiUI::TPolicy aDefaultPolicy = SwiUI::EPolicyUserConfirm + ) : iBuffer( aBuffer ), iCustIndex(-1), iDefaultPolicy ( aDefaultPolicy ) + { + + } + + void SetPolicyValue( SwiUI::TPolicy &aPolicy, const TDesC8& aValue ) const; + void ConstructL(); + + + virtual void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); + virtual void OnEndDocumentL(TInt aErrorCode); + virtual void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode); + virtual void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); + virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); + virtual void OnError(TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + + }; + +class CAMInstOptsParser : public CAMInstOptsParserBase//, public Xml::MContentHandler + { + //SwiUI::TInstallOptions &iResult; + NApplicationManagement::TAMInstallOptions &iResult; + + //void ParseL(); + public: + + + static CAMInstOptsParser * NewL( const TDesC8 &aBuffer, NApplicationManagement::TAMInstallOptions &aResult ); + static CAMInstOptsParser * NewLC( const TDesC8 &aBuffer, NApplicationManagement::TAMInstallOptions &aResult ); + + CAMInstOptsParser( const TDesC8 &aBuffer, NApplicationManagement::TAMInstallOptions &aResult ) + : CAMInstOptsParserBase ( aBuffer ), iResult( aResult ) + { + + } + + virtual ~CAMInstOptsParser(); + + void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode); + private: + }; + +class CAMUninstOptsParser : public CAMInstOptsParserBase + { + SwiUI::TUninstallOptions &iResult; + public: + static CAMUninstOptsParser * NewL( const TDesC8 &aBuffer, SwiUI::TUninstallOptions &aResult ); + static CAMUninstOptsParser * NewLC( const TDesC8 &aBuffer, SwiUI::TUninstallOptions &aResult ); + + CAMUninstOptsParser( const TDesC8 &aBuffer, SwiUI::TUninstallOptions &aResult ) + : CAMInstOptsParserBase( aBuffer ), iResult( aResult ) + { + + } + virtual ~CAMUninstOptsParser(); + + void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode); + private: + }; + +#endif // __AMINSTALLOPTIONSINT_H__ + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/rom/aminstalloptions.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/rom/aminstalloptions.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,23 @@ +/* +* 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 applicationmanagement components +* +*/ + +#ifndef __AMINSTALLOPTIONS_IBY__ +#define __AMINSTALLOPTIONS_IBY__ + +file=ABI_DIR\BUILD_DIR\AMInstallOptions.dll SHARED_LIB_DIR\AMInstallOptions.dll + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/options/src/AMInstallOptions.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/options/src/AMInstallOptions.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,927 @@ +/* +* Copyright (c) 2000 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: ApplicationManagementOptions implementation +* +*/ + + + +#include +#include +#include "debug.h" +#include "aminstalloptions.h" +#include "aminstalloptionsint.h" + + +namespace AMXml + { + + struct TLangCodeMapping + { + //const TText8 *const iCode ; + const TText8 * iCode ; + TLanguage iLang ; + }; + + // Language options + const TLangCodeMapping KLangOptions[] = + { + {_S8("EN"), ELangEnglish}, + {_S8("FR"), ELangFrench}, + {_S8("GE"), ELangGerman}, + {_S8("SP"), ELangSpanish}, + {_S8("IT"), ELangItalian}, + {_S8("SW"), ELangSwedish}, + {_S8("DA"), ELangDanish}, + {_S8("NO"), ELangNorwegian}, + {_S8("FI"), ELangFinnish}, + {_S8("AM"), ELangAmerican}, + {_S8("SF"), ELangSwissFrench}, + {_S8("SG"), ELangSwissGerman}, + {_S8("PO"), ELangPortuguese}, + {_S8("TU"), ELangTurkish}, + {_S8("IC"), ELangIcelandic}, + {_S8("RU"), ELangRussian}, + {_S8("HU"), ELangHungarian}, + {_S8("DU"), ELangDutch}, + {_S8("BL"), ELangBelgianFlemish}, + {_S8("AU"), ELangAustralian}, + {_S8("BF"), ELangBelgianFrench}, + {_S8("AS"), ELangAustrian}, + {_S8("NZ"), ELangNewZealand}, + {_S8("IF"), ELangInternationalFrench}, + {_S8("CS"), ELangCzech}, + {_S8("SK"), ELangSlovak}, + {_S8("PL"), ELangPolish}, + {_S8("SL"), ELangSlovenian}, + {_S8("TC"), ELangTaiwanChinese}, + {_S8("HK"), ELangHongKongChinese}, + {_S8("ZH"), ELangPrcChinese}, + {_S8("JA"), ELangJapanese}, + {_S8("TH"), ELangThai}, + {_S8("AF"), ELangAfrikaans }, + {_S8("SQ"), ELangAlbanian }, + {_S8("AH"), ELangAmharic }, + {_S8("AR"), ELangArabic }, + {_S8("HY"), ELangArmenian }, + {_S8("TL"), ELangTagalog }, + {_S8("BE"), ELangBelarussian }, + {_S8("BN"), ELangBengali }, + {_S8("BG"), ELangBulgarian }, + {_S8("MY"), ELangBurmese }, + {_S8("CA"), ELangCatalan }, + {_S8("HR"), ELangCroatian }, + {_S8("CE"), ELangCanadianEnglish }, + {_S8("IE"), ELangInternationalEnglish }, + {_S8("SF"), ELangSouthAfricanEnglish }, + {_S8("ET"), ELangEstonian }, + {_S8("FA"), ELangFarsi }, + {_S8("CF"), ELangCanadianFrench }, + {_S8("GD"), ELangScotsGaelic }, + {_S8("KA"), ELangGeorgian }, + {_S8("EL"), ELangGreek }, + {_S8("CG"), ELangCyprusGreek }, + {_S8("GU"), ELangGujarati }, + {_S8("HE"), ELangHebrew }, + {_S8("HI"), ELangHindi }, + {_S8("IN"), ELangIndonesian }, + {_S8("GA"), ELangIrish }, + {_S8("SZ"), ELangSwissItalian }, + {_S8("KN"), ELangKannada }, + {_S8("KK"), ELangKazakh }, + {_S8("KM"), ELangKhmer }, + {_S8("KO"), ELangKorean }, + {_S8("LO"), ELangLao }, + {_S8("LV"), ELangLatvian }, + {_S8("LT"), ELangLithuanian }, + {_S8("MK"), ELangMacedonian }, + {_S8("MS"), ELangMalay }, + {_S8("ML"), ELangMalayalam }, + {_S8("MR"), ELangMarathi }, + {_S8("MO"), ELangMoldavian }, + {_S8("MN"), ELangMongolian }, + {_S8("NN"), ELangNorwegianNynorsk }, + {_S8("BP"), ELangBrazilianPortuguese }, + {_S8("PA"), ELangPunjabi }, + {_S8("RO"), ELangRomanian }, + {_S8("SR"), ELangSerbian }, + {_S8("SI"), ELangSinhalese }, + {_S8("SO"), ELangSomali }, + {_S8("OS"), ELangInternationalSpanish }, + {_S8("LS"), ELangLatinAmericanSpanish }, + {_S8("SH"), ELangSwahili }, + {_S8("FS"), ELangFinlandSwedish }, + //{_S8("??"), ELangReserved1 }, + {_S8("TA"), ELangTamil }, + {_S8("TE"), ELangTelugu }, + {_S8("BO"), ELangTibetan }, + {_S8("TI"), ELangTigrinya }, + {_S8("CT"), ELangCyprusTurkish }, + {_S8("TK"), ELangTurkmen }, + {_S8("UK"), ELangUkrainian }, + {_S8("UR"), ELangUrdu }, + //{_S8("??"), ELangReserved2 }, + {_S8("VI"), ELangVietnamese }, + {_S8("CY"), ELangWelsh }, + {_S8("ZU"), ELangZulu }, + //{_S8("??"), ELangOther }, + //{_S8("??"), ELangNone } + }; + + const TInt KNumLangOptions = (sizeof(KLangOptions)/sizeof(TLangCodeMapping)); + + // boolean "value" attribute values + _LIT8( KIOValueTrue, "yes" ); + _LIT8( KIOValueFalse, "no" ); + // notimp _LIT8( KIOAsk, "askuser" ); + + _LIT8( KIODefaultLanguage, "*"); + + // notimp _LIT8( KIOMissingOptionPolicyValDefault, "usedefault" ); + _LIT8( KIOMissingOptionPolicyValFail, "fail" ); + // notimp _LIT8( KIOMissingOptionPolicyValAsk, "askuser" ); + + // "Name" attribute values + _LIT8( KIODrive, "drive" ); + _LIT8( KIOLanguage, "lang" ); + _LIT8( KIOUpgrade, "upgrade" ); + _LIT8( KIOKill, "kill" ); + + // sym specific + _LIT8( KIOCapabilities, "capabilities" ); + _LIT8( KIOUntrusted, "untrusted" ); + _LIT8( KIOPkginfo, "pkginfo" ); + _LIT8( KIOOptionalItems, "optionals" ); + + _LIT8 ( KIOOCSP, "ocsp" ); + _LIT8 ( KIOOCSPWarning, "ignoreocspwarn" ); + _LIT8 ( KIOOverwrite, "fileoverwrite" ); + + _LIT8 ( KIOUpgradeData, "upgradedata" ); // iUpgradeData + + _LIT8( KUIOBreakDependency, "allowdependencybreak" ); + + _LIT8( KIOAttrNameDefaultPolicy, "missingoptionpolicy" ); + + _LIT8( KIODownload, "download" ); + _LIT8( KIOHttpUsername, "httpusername" ); + _LIT8( KIOHttpPassword, "httppassword" ); + _LIT8( KIOIAP, "conref" ); + + namespace Reader + { + // XML node names + _LIT8( KIOStartElement, "InstOpts") ; + _LIT8( KIOStdOpt, "StdOpt"); + _LIT8( KIOStdSymOpt, "StdSymOpt" ); + _LIT8( KIOCustSymOpts, "CustSymOpts" ); + // notimp _LIT8( KIOOpt, "Opt" ); + + // Xml attribute names + // notimp _LIT8( KIOOptAttrIndex, "index" ); + _LIT8( KIOAttrName, "name" ); + _LIT8( KIOAttrValue, "value" ); + + } + + namespace Writer + { + _LIT8( KIOStartElement, "") ; + _LIT8( KIOStdOptFormat, "" ); + _LIT8( KIOStdSymOptFormat, "" ); + // notimp _LIT8( KIOCustSymOptsStartFormat, "" ); + // notimp _LIT8( KIOCustSymOptsEnd, "" ); + // notimp _LIT8( KIOOptFormat, "" ); + _LIT8( KIOStartElementEnd, "") ; + + _LIT8( KUIOStartElement, "" ); + _LIT8( KUIOStartElementEnd, "" ); + } + } + +/////////////////////////////////////////////////// +// +// CAMInstOptsParserBase +// +/////////////////////////////////////////////////// + + +CAMInstOptsParserBase::~CAMInstOptsParserBase() + { + delete iParser; + iParser = NULL; + } + +void CAMInstOptsParserBase::SetPolicyValue( SwiUI::TPolicy &aPolicy, const TDesC8& aValue ) const + { + using namespace AMXml; + + if ( aValue == KIOValueTrue ) + { + aPolicy = SwiUI::EPolicyAllowed ; + } + else if ( aValue == KIOValueFalse ) + { + aPolicy = SwiUI::EPolicyNotAllowed ; + } + else + { + aPolicy = iDefaultPolicy; + } + } +void CAMInstOptsParserBase::ConstructL() + { + iParser = Xml::CParser::NewL( _L8( "text/xml"), *this ); + + } + +void CAMInstOptsParserBase::ParseL() + { + Xml::ParseL( *iParser, iBuffer ); + } + +void CAMInstOptsParserBase::OnStartElementL(const Xml::RTagInfo& /*aElement*/, + const Xml::RAttributeArray& /*aAttributes*/, TInt aErrorCode) + { + RDEBUG("CAMInstOptsParserBase::OnStartElementL"); + if( aErrorCode != KErrNone ) + { + RDEBUG_2( " ->OnStartElementL (aErrorCode '%d')", aErrorCode ); + } + } + +void CAMInstOptsParserBase::OnEndDocumentL(TInt aErrorCode) + { + RDEBUG("CAMInstOptsParserBase::OnEndDocumentL"); + if( aErrorCode != KErrNone ) + { + RDEBUG_2( " ->OnEndDocumentL (aErrorCode '%d')", aErrorCode ); + } + } + +void CAMInstOptsParserBase::OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode) + { + RDEBUG("CAMInstOptsParserBase::OnStartDocumentL"); + if( aErrorCode != KErrNone ) + { + const TDesC8 &d = aDocParam.CharacterSetName().DesC(); + RDEBUG8_3( " ->OnStartDocumentL (aDocParam '%S', aErrorCode %d)" , + &d,aErrorCode ); + } + } + +void CAMInstOptsParserBase::OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode) + { + RDEBUG("CAMInstOptsParserBase::OnEndElementL"); + if( aErrorCode != KErrNone ) + { + const TDesC8 &d = aElement.LocalName().DesC(); + RDEBUG8_3( " ->OnEndElementL (LocalName '%S', aErrorCode %d)", + &d,aErrorCode ); + } + } + +void CAMInstOptsParserBase::OnContentL( + #ifdef _DEBUG + const TDesC8& aBytes + #else + const TDesC8& /*aBytes*/ + #endif + ,TInt aErrorCode ) + { + RDEBUG("CAMInstOptsParserBase::OnContentL"); + if( aErrorCode != KErrNone ) + { + #ifdef _DEBUG + RDEBUG8_3( " ->OnContentL (abytes '%S', aErrorCode %d)", + &aBytes, aErrorCode ); + #else + RDEBUG8_2( " ->OnContentL (aErrorCode %d)", aErrorCode ); + #endif + } + + } +void CAMInstOptsParserBase::OnStartPrefixMappingL(const RString& /*aPrefix*/, + const RString& /*aUri*/, TInt /*aErrorCode*/) + { + + } +void CAMInstOptsParserBase::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt /*aErrorCode*/) + { + + } +void CAMInstOptsParserBase::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) + { + + } +void CAMInstOptsParserBase::OnSkippedEntityL(const RString& /*aName*/, TInt /*aErrorCode*/) + { + + } +void CAMInstOptsParserBase::OnProcessingInstructionL(const TDesC8& /*aTarget*/, + const TDesC8& /*aData*/, TInt /*aErrorCode*/) + { + + } +void CAMInstOptsParserBase::OnError(TInt aErrorCode) + { + RDEBUG("CAMInstOptsParserBase::OnError"); + if( aErrorCode != KErrNone ) + { + RDEBUG_2( " ->OnError ( aErrorCode %d)",aErrorCode ); + } + } + + + +TAny* CAMInstOptsParserBase::GetExtendedInterface(const TInt32 /*aUid*/) + { + + return NULL; + } + + +/////////////////////////////////////////////////// +// +// CAMInstOptsParser +// +/////////////////////////////////////////////////// + +CAMInstOptsParser * CAMInstOptsParser::NewLC( const TDesC8 &aBuffer, NApplicationManagement::TAMInstallOptions &aResult ) + { + CAMInstOptsParser *self = new ( ELeave ) CAMInstOptsParser( aBuffer, aResult ); + CleanupStack::PushL( self ); + self->ConstructL() ; + return self ; + } + +CAMInstOptsParser *CAMInstOptsParser::NewL( const TDesC8 &aBuffer, + NApplicationManagement::TAMInstallOptions &aResult ) + { + CAMInstOptsParser *self = NewLC ( aBuffer, aResult ); + CleanupStack::Pop( self ); + return self ; + } + +CAMUninstOptsParser * CAMUninstOptsParser::NewLC( const TDesC8 &aBuffer, SwiUI::TUninstallOptions &aResult ) + { + CAMUninstOptsParser *self = new ( ELeave ) CAMUninstOptsParser( aBuffer, aResult ); + CleanupStack::PushL( self ); + self->ConstructL() ; + return self ; + } + +CAMUninstOptsParser *CAMUninstOptsParser::NewL( const TDesC8 &aBuffer, + SwiUI::TUninstallOptions &aResult ) + { + CAMUninstOptsParser *self = NewLC ( aBuffer, aResult ); + CleanupStack::Pop( self ); + return self ; + } + + +CAMInstOptsParser::~CAMInstOptsParser() + { + + } + + +void CAMInstOptsParser::OnStartElementL(const Xml::RTagInfo& aElement, + const Xml::RAttributeArray& aAttributes, + #ifdef _DEBUG + TInt aErrorCode + #else + TInt /*aErrorCode*/ + #endif + ) + { + +#ifdef _DEBUG + RDEBUG8_3( "CAMInstOptsParser::OnStartElementL (LocalName '%S', aErrorCode %d)", + &aElement.LocalName().DesC(),aErrorCode ); + TInt count2( aAttributes.Count() ); + for( TInt i( 0 ); i < count2; i++ ) + { + RDEBUG8_5( " Attribute %d, type=%d, '%S'='%S' ",i,aAttributes[i].Type(), + &aAttributes[i].Value().DesC(), &aAttributes[i].Attribute().LocalName().DesC() ); + + } +#endif + + using namespace AMXml; + + + const TPtrC8 name( aElement.LocalName().DesC() ); + if ( name == Reader::KIOStartElement ) + { + + if ( aAttributes.Count() == 1 ) + { + TPtrC8 attrname( aAttributes[0].Attribute().LocalName().DesC() ); + if ( attrname == KIOAttrNameDefaultPolicy) + { + + using namespace SwiUI; + TPtrC8 attrval( aAttributes[0].Value().DesC() ); + if ( attrval == KIOMissingOptionPolicyValFail) + { + iDefaultPolicy = EPolicyNotAllowed; + } + else + { + iDefaultPolicy = EPolicyUserConfirm; + } + } + } + } + else if ( name != Reader::KIOCustSymOpts ) + { + RDEBUG8_2( " Processing element '%S'", &name ); + TInt c( aAttributes.Count() ); + if ( c == 2 ) + { + TPtrC8 attrname( aAttributes[0].Attribute().LocalName().DesC() ); + TPtrC8 attrnameval( aAttributes[0].Value().DesC() ); + TPtrC8 attrval( aAttributes[1].Attribute().LocalName().DesC() ); + TPtrC8 attrvalval( aAttributes[1].Value().DesC() ); + RDEBUG8_5( " Name '%S'='%S' Val '%S'='%S' ",&attrname, &attrnameval, + &attrval, &attrvalval ); + if ( attrname == Reader::KIOAttrName ) + { + if ( attrval == Reader::KIOAttrValue ) + { + if ( name == Reader::KIOStdOpt ) + { + if ( attrnameval == KIODrive ) + { + TInt len = attrvalval.Length(); + if (len == 0) + { + TChar KDefaultDrive = 'c'; + iResult.iOptions.iDrive = KDefaultDrive; + //RDEBUG8_2( " Set drive to %c ", iResult.iOptions.iDrive ); + } + else + { + RDEBUG8_2( " Setting drive to %c ", attrvalval[0] ); + iResult.iOptions.iDrive = attrvalval[0]; + } + } + else if ( attrnameval == KIOLanguage ) + { + if ( attrvalval == KIODefaultLanguage ) + { + iResult.iOptions.iUsePhoneLang = ETrue; + } + else + { + for( TInt i( 0 ); i < KNumLangOptions; i++ ) + { + if ( attrvalval == TPtrC8( KLangOptions[i].iCode ) ) + { + #ifdef _DEBUG + TPtrC8 code( KLangOptions[i].iCode ); + RDEBUG8_2( " OnStartElementL : Found language %S", &code); + #endif + iResult.iOptions.iLang = KLangOptions[i].iLang; + break; + } + } + } + + } + else if ( attrnameval == KIOUpgrade ) + { + RDEBUG8_2( " Setting Upgrade to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iUpgrade, attrvalval ); + } + else if ( attrnameval == KIOKill ) + { + RDEBUG8_2( " Setting iKillApp to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iKillApp, attrvalval ); + } + else if ( attrnameval == KIOHttpUsername ) + { + RDEBUG8_2( " Setting iLogin to %S ", &attrvalval ); + iResult.iOptions.iLogin.Copy( attrvalval.Left( SwiUI::KSWInstMaxUserNameLength ) ); + } + else if ( attrnameval == KIOHttpPassword ) + { + RDEBUG8_2( " Setting iPassword to %S ", &attrvalval ); + iResult.iOptions.iPassword.Copy( attrvalval.Left( SwiUI::KSWInstMaxPasswordLength ) ); + } + else if ( attrnameval == KIODownload ) + { + RDEBUG8_2( " Setting iDownload to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iDownload, attrvalval ); + } + else if ( attrnameval == KIOIAP ) + { + RDEBUG8_2( " Setting iConRef to %S ", &attrvalval ); + iResult.iConRef = attrvalval; + + + } + /* + _LIT8( KIOIAP, "iap" ); +*/ + + else + { + RDEBUG8_3( " WARNING Unsupported name attribute value: '%S' for '%S' ", &attrnameval, &name ); + } + } + else if ( name == Reader::KIOStdSymOpt ) + { + if ( attrnameval == KIOCapabilities ) + { + RDEBUG8_2( " Setting iCapabilities to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iCapabilities, attrvalval ); + } + else if ( attrnameval == KIOUntrusted ) + { + RDEBUG8_2( " Setting iUntrusted to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iUntrusted, attrvalval ); + } + else if ( attrnameval == KIOPkginfo ) + { + RDEBUG8_2( " Setting iPackageInfo to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iPackageInfo, attrvalval ); + } + else if ( attrnameval == KIOOCSP ) + { + RDEBUG8_2( " Setting iOCSP to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iOCSP, attrvalval ); + } + else if ( attrnameval == KIOOCSPWarning ) + { + RDEBUG8_2( " Setting iIgnoreOCSPWarnings to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iIgnoreOCSPWarnings, attrvalval ); + } + else if ( attrnameval == KIOOptionalItems ) + { + RDEBUG8_2( " Setting iOptionalItems to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iOptionalItems, attrvalval ); + } + else if ( attrnameval == KIOOverwrite ) + { + RDEBUG8_2( " Setting iOverwrite to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iOverwrite, attrvalval ); + } + else if ( attrnameval == KIOUpgradeData ) + { + RDEBUG8_2( " Setting iUpgradeData to %S ", &attrvalval ); + SetPolicyValue( iResult.iOptions.iUpgradeData, attrvalval ); + } + + else + { + RDEBUG8_3( " WARNING Unsupported name sym attribute value: '%S' for '%S' ", &attrnameval, &name ); + } + } + else + { + RDEBUG("WARNING, unsupported name attribute!"); + } + } + else + { + RDEBUG8_3( " ERROR invalid second attribute!: '%S', expteced: '%S' ", &attrval, &Reader::KIOAttrValue() ); + } + } + else + { + RDEBUG8_3( " ERROR invalid first attribute!: '%S', expteced: '%S' ", &attrname, &Reader::KIOAttrName() ); + } + } + else + { + RDEBUG8_3( " ERROR unsupported count of attributes!!: '%d' for '%S' ", c, &name); + } + } + else + { + RDEBUG( " ERROR custom options not implemented!!!!" ); + + } + } + + +/////////////////////////////////////////////////// +// +// CAMUninstOptsParser +// +/////////////////////////////////////////////////// + +CAMUninstOptsParser::~CAMUninstOptsParser() + { + + } + +void CAMUninstOptsParser::OnStartElementL(const Xml::RTagInfo& aElement, + const Xml::RAttributeArray& aAttributes, + #ifdef _DEBUG + TInt aErrorCode + #else + TInt /*aErrorCode*/ + #endif + ) + { + +#ifdef _DEBUG + RDEBUG8_3( "CAMUninstOptsParser::OnStartElementL (LocalName '%S', aErrorCode %d)", + &aElement.LocalName().DesC(),aErrorCode ); + TInt count2( aAttributes.Count() ); + for( TInt i( 0 ); i < count2; i++ ) + { + RDEBUG8_5( " Attribute %d, type=%d, '%S'='%S' ",i,aAttributes[i].Type(), + &aAttributes[i].Value().DesC(), &aAttributes[i].Attribute().LocalName().DesC() ); + + } +#endif + + using namespace AMXml; + + + const TPtrC8 name( aElement.LocalName().DesC() ); + if ( name == Reader::KIOStartElement ) + { + + } + else if ( name != Reader::KIOCustSymOpts ) + { + RDEBUG8_2( " Processing element '%S'", &name ); + TInt c( aAttributes.Count() ); + if ( c == 2 ) + { + TPtrC8 attrname( aAttributes[0].Attribute().LocalName().DesC() ); + TPtrC8 attrnameval( aAttributes[0].Value().DesC() ); + TPtrC8 attrval( aAttributes[1].Attribute().LocalName().DesC() ); + TPtrC8 attrvalval( aAttributes[1].Value().DesC() ); + RDEBUG8_5( " Name '%S'='%S' Val '%S'='%S' ",&attrname, &attrnameval, + &attrval, &attrvalval ); + if ( attrname == Reader::KIOAttrName ) + { + if ( attrval == Reader::KIOAttrValue ) + { + if ( name == Reader::KIOStdOpt ) + { + if ( attrnameval == KIOKill ) + { + RDEBUG8_2( " Setting iKillApp to %S ", &attrvalval ); + SetPolicyValue( iResult.iKillApp, attrvalval ); + } + else + { + RDEBUG8_3( " WARNING Unsupported name attribute value: '%S' for '%S' ", &attrnameval, &name ); + } + } + else if ( name == Reader::KIOStdSymOpt ) + { + if ( attrnameval == KUIOBreakDependency ) + { + RDEBUG8_2( " Setting iDependecyBreak to %S ", &attrvalval ); + SetPolicyValue( iResult.iBreakDependency, attrvalval ); + } + else + { + RDEBUG8_3( " WARNING Unsupported name attribute value: '%S' for '%S' ", &attrnameval, &name ); + } + } + else + { + RDEBUG("WARNING, unsupported name attribute value"); + } + } + else + { + RDEBUG8_3( " ERROR invalid second attribute!: '%S', expteced: '%S' ", &attrval, &Reader::KIOAttrValue() ); + } + } + else + { + RDEBUG8_3( " ERROR invalid first attribute!: '%S', expteced: '%S' ", &attrname, &Reader::KIOAttrName() ); + } + } + else + { + RDEBUG8_3( " ERROR unsupported count of attributes!!: '%d' for '%S' ", c, &name); + } + } + else + { + RDEBUG( " ERROR custom options not implemented!!!!" ); + + } + } + + +/////////////////////////////////////////////////// +// +// InstallOptionsParser +// +/////////////////////////////////////////////////// + +EXPORT_C void InstallOptionsParser::ParseOptionsL( const TDesC8 &aBuffer, SwiUI::TInstallOptions &aResult) + { + NApplicationManagement::TAMInstallOptions opts; + opts.iOptions.iUsePhoneLang = EFalse; + CAMInstOptsParser *parser = CAMInstOptsParser::NewLC( aBuffer, opts ); + parser->ParseL(); + aResult = opts.iOptions; + CleanupStack::PopAndDestroy( parser ); + } + +EXPORT_C void InstallOptionsParser::ParseOptionsL( const TDesC8 &aBuffer, NApplicationManagement::TAMInstallOptions &aResult) + { + aResult.iOptions.iUsePhoneLang = EFalse; + CAMInstOptsParser *parser = CAMInstOptsParser::NewLC( aBuffer, aResult ); + parser->ParseL(); + CleanupStack::PopAndDestroy( parser ); + } + +EXPORT_C void InstallOptionsParser::ParseOptionsL( const TDesC8 &aBuffer, SwiUI::TUninstallOptions &aResult) + { + CAMUninstOptsParser *parser = CAMUninstOptsParser::NewLC( aBuffer, aResult ); + parser->ParseL(); + CleanupStack::PopAndDestroy( parser ); + } + +EXPORT_C void InstallOptionsParser::SerializeOptionsL( const SwiUI::TUninstallOptions &aOptions, CBufBase &aResult ) + { + using namespace AMXml; + using namespace AMXml::Writer; + using namespace SwiUI; + + aResult.InsertL(aResult.Size(), Writer::KUIOStartElement ); + + HBufC8 *tmp = HBufC8::NewLC( 128 ); + TPtr8 ptmp( tmp->Des() ); + + if ( aOptions.iKillApp != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdOptFormat, &KIOKill, ( aOptions.iKillApp == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( aOptions.iBreakDependency != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KUIOBreakDependency, ( aOptions.iKillApp == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + aResult.InsertL(aResult.Size(), Writer::KUIOStartElementEnd ); + + CleanupStack::PopAndDestroy( tmp ); + } + +EXPORT_C void InstallOptionsParser::SerializeOptionsL( const SwiUI::TInstallOptions &aOptions, CBufBase &aResult ) + { + NApplicationManagement::TAMInstallOptions options; + options.iOptions = aOptions; + SerializeOptionsL( options, aResult ); + } + +EXPORT_C void InstallOptionsParser::SerializeOptionsL( const NApplicationManagement::TAMInstallOptions &aOptions, CBufBase &aResult ) + { + + using namespace AMXml; + using namespace AMXml::Writer; + using namespace SwiUI; + + const SwiUI::TInstallOptions &options = aOptions.iOptions; + + aResult.InsertL(aResult.Size(), Writer::KIOStartElement ); + + HBufC8 *tmp = HBufC8::NewLC( 128 ); + TPtr8 ptmp( tmp->Des() ); + TBuf8<1> b ; + b.Append( options.iDrive ); + ptmp.Format( KIOStdOptFormat, &KIODrive, &b ); + aResult.InsertL( aResult.Size(), ptmp ); + + if( options.iUsePhoneLang ) + { + ptmp.Format( KIOStdOptFormat, &KIOLanguage, &KIODefaultLanguage ) ; + } + else + { + if( options.iLang != ELangNone ) + { + TBool found( EFalse ); + for( TInt i( 0 ); !found && i < KNumLangOptions; i++ ) + { + if ( KLangOptions[i].iLang == options.iLang ) + { + #ifdef _DEBUG + TPtrC8 code( KLangOptions[i].iCode ); + RDEBUG8_2( " InstallOptionsParser::SerializeOptionsL : Found language %S", &code ); + #endif + TPtrC8 p( KLangOptions[i].iCode ); + ptmp.Format( KIOStdOptFormat, &KIOLanguage, &p ) ; + + found = ETrue; + } + } + if ( !found ) + { + ptmp.Format( KNullDesC8() ); + } + } + else + { + ptmp.Format( KNullDesC8() ); + } + } + aResult.InsertL( aResult.Size(), ptmp ); + + if ( options.iUpgrade != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdOptFormat, &KIOUpgrade, ( options.iUpgrade == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + + } + if ( options.iKillApp != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdOptFormat, &KIOKill, ( options.iKillApp == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iPackageInfo != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KIOPkginfo, ( options.iPackageInfo == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iCapabilities != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KIOCapabilities, ( options.iCapabilities == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iUntrusted != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KIOUntrusted, ( options.iUntrusted == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iOCSP != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KIOOCSP, ( options.iOCSP == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iIgnoreOCSPWarnings != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KIOOCSPWarning, ( options.iIgnoreOCSPWarnings == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iOptionalItems != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KIOOptionalItems, ( options.iOptionalItems == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iOverwrite != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KIOOverwrite, ( options.iOverwrite == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iUpgradeData != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdSymOptFormat, &KIOUpgradeData, ( options.iUpgradeData == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iDownload != EPolicyUserConfirm ) + { + ptmp.Format( KIOStdOptFormat, &KIODownload, ( options.iDownload == EPolicyAllowed ? &KIOValueTrue : &KIOValueFalse ) ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iPassword != KNullDesC() ) + { + TBuf8 password; + password.Copy( options.iPassword ); + ptmp.Format( KIOStdOptFormat, &KIOHttpPassword, &password ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( options.iLogin != KNullDesC() ) + { + TBuf8 login; + login.Copy( options.iLogin ); + ptmp.Format( KIOStdOptFormat, &KIOHttpUsername, &login ); + aResult.InsertL( aResult.Size(), ptmp ); + } + if ( aOptions.iConRef != KNullDesC8() ) + { + ptmp.Format( KIOStdOptFormat, &KIOIAP, &aOptions.iConRef); + aResult.InsertL( aResult.Size(), ptmp ); + } + aResult.InsertL( aResult.Size(), KIOStartElementEnd ); + + CleanupStack::PopAndDestroy( tmp ); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/rom/1020781C.txt Binary file applicationmanagement/rom/1020781C.txt has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/rom/appmgmt.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/rom/appmgmt.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,41 @@ +/* +* 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 applicationmanagement components +* +*/ + +#ifndef __APPLICATIONMANAGEMENT_IBY__ +#define __APPLICATIONMANAGEMENT_IBY__ + +//#if defined(__SAP_APPLICATION_MANAGEMENT) + + S60_APP_EXE(ApplicationManagementServer) + + S60_APP_RESOURCE( ApplicationManagementServer ) + + // _reg.rsc has to be in "import" folder to allow updating application exe with a SISX-file + data=\EPOC32\DATA\Z\private\10003a3f\import\apps\ApplicationManagementServer_reg.RSC \private\10003a3f\import\apps\ApplicationManagementServer_reg.RSC + + file=ABI_DIR\BUILD_DIR\ApplicationManagementClient.dll SHARED_LIB_DIR\ApplicationManagementClient.dll + + ECOM_PLUGIN(RfsAppMgmtPlugin.dll,102073BF.rsc) + ECOM_PLUGIN(omascomoadapter.dll, omascomoadapter.rsc) + + data=ZPRIVATE\100012a5\policy\20021335.spd PRIVATE\100012a5\policy\20021335.spd + data=ZPRIVATE\100012a5\policy\200267FB.spd PRIVATE\100012a5\policy\200267FB.spd + + +//#endif // #ifdef __SAP_APPLICATION_MANAGEMENT + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/conf/applicationmanagement.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/conf/applicationmanagement.qrc Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,11 @@ + + + downloaddialog.docml + installdialog.docml + sample.docml + error_notes.docml + + + qgn_prop_sml_http.svg + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/conf/downloaddialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/conf/downloaddialog.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/conf/error_notes.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/conf/error_notes.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/conf/installdialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/conf/installdialog.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/conf/qgn_prop_sml_http.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/conf/qgn_prop_sml_http.svg Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/conf/sample.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/conf/sample.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/group/200267FB.txt Binary file applicationmanagement/server/group/200267FB.txt has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/AMAppHideUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/AMAppHideUtil.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,103 @@ +/* + * 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: Implementation of applicationmanagement components + * + */ + + +#ifndef __AMAPPHIDEUTIL_H__ +#define __AMAPPHIDEUTIL_H__ + +#include + +namespace NApplicationManagement + { + + typedef RArray RUidArray; + + class CAMAppHideUtil : public CBase + { + RUidArray iHiddenUids; // The hidden uid list + TBool iChanged; + /** + * Constructor + */ + CAMAppHideUtil(); + + + /** + * Second phase constructor. Loads the uid list from centrep. + */ + void ConstructL(); + + + + void ParseUids( RUidArray &aUid, const TDesC8& aUidList ); + + /** + * Loads uids from centrep + */ + void LoadUidsL(); + + /** + * Parses uid, returning KErrNone if successful + */ + TInt ParseUid( TLex &aLex, TUid &aUid ) const; + + /** + * Skips delimiter, returning ETrue if delimiter is expected one. + */ + TBool SkipDelim( TLex &aLex ) const; + + /** + * Puts aUid to aBuf and if aHasMore also adds delimiter + */ + void PersistUid( const TUid &aUid, TDes &aBuf, TBool aHasMore ) const; + public: + /** + * Destructor + */ + virtual ~CAMAppHideUtil(); + + /** + * Creates new CAMAppHideUtil instance + */ + static CAMAppHideUtil* CAMAppHideUtil::NewL(); + + /** + * Adds uid to list, and updates the repository if needed + */ + void AddUidL(const TUid& aUid, TBool aPersist = EFalse ); + + /** + * Removed uid from list, and updates the repository if needed + */ + void RemoveUidL( const TUid& aUid, TBool aPersist = EFalse ); + + /** + * Writes uids to centrep + */ + void PersistUidsL(); + + /** + * Resets the hidden uid array + */ + void Reset(); + }; + + } + +#endif // #ifdef __AMAPPHIDEUTIL_H__ + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/AMDeploymentComponent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/AMDeploymentComponent.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + + +#ifndef __CAMDEPLOYMENTCOMPONENT__ +#define __CAMDEPLOYMENTCOMPONENT__ + +#include +#include +#include +#include +#include "ApplicationManagementCommon.h" +#include "aminstalloptions.h" +#include "amdeploymentcomponentdata.h" + + +namespace NApplicationManagement + { + _LIT8( KAMDCDelimiter, "|" ); + + // FORWARD DECLARATIONS + class CDeploymentComponent; + class CAMDownload; + + class MAMDownloadStateObserver + { +public: + /** + * StatusUpdateL Sets the current download status. This is + * currently HTTP status code + * (200 is success, 400+ failure, 100-199 in progress) + * @param aNewStatus The new download status + */ + virtual void StatusUpdateL(TInt aNewStatus) = 0; + virtual void SuccessStatusUpdateL(const TDesC &aDlFileName, + const TDesC8& aDlMimeType) = 0; + }; + + + class MDownloadCallback + { + public: + virtual void DownloadComplete( class CDeploymentComponent *aComponent, TInt aStatus ) = 0; + virtual TBool UidExistsL( const TUid &aUid, CDeploymentComponent *& aCompo, CDeploymentComponent *aIgnored ) = 0; + }; + + class CDeploymentComponent : public CBase, public MAMDownloadStateObserver + { + + public: // From MAMDownloadStateObserver + void StatusUpdateL( TInt aNewStatus ); + void SuccessStatusUpdateL( const TDesC &aDlFileName, const TDesC8& aDlMimeType ); + + void SetStatusNode(const TSCOMOStatusNodeStates &aStatus) const; + private: + // Data + TDeploymentComponentId iId; + TDeploymentComponentName iName; + TDeploymentComponentVersion iVersion; + TDeploymentComponentState iState; + TDeploymentComponentDescription iDescription; + TDeploymentComponentPkgId iPkgID; + TDeploymentComponentPkgIdRef iPkgIDRef; + TDeploymentComponentPkgType iPkgType; + TDeploymentComponentName iMidletName; + TDeploymentComponentName iMideltVendorName; + TDeploymentComponentVersion iMidletVersion; + TUint32 iInternalId; + TUid iUid; + TDCUserId iUserId; + + CDeploymentComponentData *iMetaData; + CDeploymentComponentData *iData; + TAMInstallOptions iInstallOpts; + TBool iInstallOptsSet; + TUint32 iPkgVersion; + TBool iRemovableApp; + TBool iDriveSelection; + TInt iComponentId; + TInt iDownloadStatus; + mutable TInt iStatus; + TBuf8 iDownloadURI; + TDownloadTarget iDownloadTarget; + SwiUI::TUninstallOptions iUninstallOpts; + + TInt iOwner; // TCertInfo index in CAMStorage::iCertificates + TDeploymentComponentState iOldState; + MDownloadCallback *iCallback; // not owned + + TSmlProfileId iOwnerProfile; // profile stored only runtime until download has completed + CRepository *iRepository; + + // Constructors + CDeploymentComponent( TInt iInternalId ); + static CDeploymentComponent* NewL( TInt iInternalId, const TDCUserId &aUserId); + static CDeploymentComponent* NewLC( TInt iInternalId, const TDCUserId &aUserId ); + static CDeploymentComponent* LoadL( TInt iInternalId, const TDesC8 &aBuffer ); + static CDeploymentComponent* LoadLC( TInt iInternalId, const TDesC8 &aBuffer ); + + void ConstructL( const TDCUserId &aUserId ); + void ConstructLoadL( const TDesC8 &aBuffer ); + + void SetAttr( TDes8 &aAttr, const TDesC8 &aNewVal ) const; + + /** + * @param aState The new state + * @return TInt KErrNone if all ok, system error code if visiblity change failed + */ + + TInt SetState( const TDeploymentComponentState &aState ) ; + /** + Returns number of bytes written to aBuffer + */ + virtual TInt SerializedFormL( RWriteStream &aBuffer ) const; + /** + Returns length of serizlied form + */ + virtual TInt SerializedFormLength() const; + HBufC8* IntToDes8LC( const TInt aLuid ); + public: + virtual ~CDeploymentComponent(); + TInt DownloadStatus() const; + inline const TDeploymentComponentId &ComponentId() const; + + inline const TDeploymentComponentName &ComponentName() const; + + inline const TDeploymentComponentVersion &ComponentVersion() const; + + inline TDeploymentComponentState State() const; + + inline TUint32 InternalId() const; + + inline const TUid & Uid() const; + + //inline const TInt DownloadStatus() const; + + inline const TDesC8 &DownloadURI() const ; + + inline const TDeploymentComponentPkgId& PkgId() const ; + + inline const TDeploymentComponentDescription& Description() const; + + inline const TDeploymentComponentPkgIdRef& PkgIDRef() const; + + inline const TDeploymentComponentPkgType& PkgType() const; + + inline const TMidletnameName& MidletName() const; + inline const TMidletVendorName& MidletVendor() const; + inline const TMidletVersion& MidletVersion() const; + + + + virtual void PersistL( CRepository &aRepository ) const; + + virtual void DestroyL( CRepository &aRepository ) ; + /** + Copies current state to argument + */ + void CopyStateTo( TDeploymentComponent &aInfo ) const; + + void SetUid( const TUid aUid ); + + void Set( const TDeploymentComponent &aInfo ); + + void SetDownloadURIL( const TDesC8 &aURI ); + + void SetDownloadTarget( const TDownloadTarget& aDownloadTarget ); + + void SetDescriptionL( const TDesC8 &aVersion ); + + void SetPkgIDL( const TDesC8 &aPkgID ); + + void SetPkgTypeL( const TDesC8 &aPkgType ); + + void SetMidletNameL( const TDesC8 &aMidletName ); + + void SetMidletVendorL( const TDesC8 &aMidletVendor ); + + void SetMidletVersionL( const TDesC8 &aMidletVersion ); + + void SetAppRemovableStatus(const TBool &aRemovable); + + void SetDriveSelectionStatus(const TBool &aDriveSelection); + + void SetComponentId(const TInt &aComponentId); + + void SetCallback( MDownloadCallback *aListener ) + { + iCallback = aListener; + } + + + /** + UserId returns the id specified by user + */ + inline const TDesC8& UserId() const; + /* + * Returns the status Node value of the Component ID. + * */ + inline TInt Status() const; + + CDeploymentComponent &operator=( const CDeploymentComponent &aData ); + + + + /** + * SetIAPL Sets the iap + * @param The new iap id + */ + void SetIAPL( const TInt aIap ); + + + /** + * @return The iap id + */ + TInt GetIAP() const; + + /** + * IsJavaMimeL + * @return ETrue if mime is recognised Java mime + */ + static TBool IsJavaMimeL( const TDesC8& aMime ); + /** + * IsSisMimeL + * @return ETrue if mime is recognised Sis mime + */ + static TBool IsSisMimeL( const TDesC8& aMime ); + + /** + * DownloadFailed + * @return ETrue if download status is such that it indicates failure, EFalse otherwise + */ + TBool DownloadFailed() const; + + /** + * OwnerProfile returns the owner profile - -1 if there's no such + */ + const TSmlProfileId& OwnerProfile() const; + + /** + * OwnerProfile + */ + void SetOwnerProfile( TSmlProfileId aOwnerProfile); + + + /** + * MimeType + * @return Component mimetype. This can be mimetype from data or metadata. Usually metadata mimetype is returned in Java case. + * In case of Java if both Jad and Jar exist, then it is Jad mimetype. + * In case of Java if only Jar exist, then it is Jar mimetype. + * In case of Java if only Jad exist, the it is Jad mimetype. + */ + const TDesC8& MimeType() const; + + + protected: + + static CDeploymentComponent *LoadComponentL ( TInt aInternalId, const TDesC8 &aBuffer ) ; + public: + CDeploymentComponentData &Data(); + const CDeploymentComponentData &Data() const; + CDeploymentComponentData &MetaData(); + const CDeploymentComponentData &MetaData() const; + const TAMInstallOptions &InstallOpts() const; + const SwiUI::TUninstallOptions &UninstallOpts() const; + TBool InstallOptsSet() const; + TBool AppRemovable() const; + TBool DriveSelected() const; + TInt GetComponentId() const; + void SetDataL( const TDesC8 &aMimeType ); + void SetMetaDataL( const TDesC8 &aMimeType ); + void SetDataL( const TDesC8 &aData, const TDesC8 &aMimeType ); + void SetDataL( const TDesC &aFileName, const TDesC8 &aMimeType ); + void SetMetaDataL( const TDesC8 &aMetaData, const TDesC8 &aMimeType ); + void SetInstallOptsL( const TDesC8 &aInstallOptions ); + void ResetDataL( RFs &aFs ); + + void SetIdL( const TDesC8 &aId ); + void SetNameL( const TDesC8 &aName ); + void SetVersionL( const TDesC8 &aVersion ); + void SetMimeTypeL( const TDesC8 &aMimeType ); + void SetOwner( const TInt &aCertInfoId ); + TInt Owner( ) const + { + return iOwner; + } + TDownloadTarget DownloadTarget() const + { + return iDownloadTarget; + } + + inline const TDeploymentComponentState& OldState() const; + + inline void StateChangeComplete(); + + + friend class CDeliveryComponentStorage; + }; + +#include "amdeploymentcomponent.inl" + + } + + +#endif + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/AMDownloadStore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/AMDownloadStore.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2002-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: Implementation of applicationmanagement components + * + */ + +#ifndef __CAMDOWNLOADSTORE_H__ +#define __CAMDOWNLOADSTORE_H__ + +#include +#include +#include "AMDeploymentComponent.h" +#include "appmgmtdownloadmgr.h" + + +namespace NApplicationManagement + { + + + // FORWARD DECLARATIONS + class CDeploymentComponent; + class CAMDwnldQTWrap; + + + class MDownloadMngrObserver + { + public: + virtual void ComponentDownloadComplete( + class CDeploymentComponent *aComponent, TInt iapid, + HBufC8* aServerId) = 0; + virtual TBool HasUidL(const TUid &aUid, + CDeploymentComponent *& aCompo, + CDeploymentComponent *aIgnored) = 0; + }; + + + + class CAMDownloadStore : public CActive + { + + private: + /** + * C++ default constructor. + */ + CAMDownloadStore(MDownloadMngrObserver& aObserver); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + public: + // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CAMDownloadStore* NewL(MDownloadMngrObserver& aObserver); + /** + * Destructor. + */ + virtual ~CAMDownloadStore(); + + public: + + void AddDownloadL(CDeploymentComponent *aComponent); + + void RunL(); + + void DoCancel(); + + void StartDownload(); + + TInt DownloadCount(); + + RPointerArray iDwnldStore; + MDownloadMngrObserver& iObserver; + + }; + + class CAMDwnldQTWrap : public CBase, public MDownloadCallback, public MDownloadMgrQTCallback + { + private: + /** + * C++ default constructor. + */ + CAMDwnldQTWrap(MDownloadMngrObserver& aObserver, CDeploymentComponent *aComponent); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + public: + // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CAMDwnldQTWrap* NewL(MDownloadMngrObserver& aObserver, CDeploymentComponent *aComponent); + /** + * Destructor. + */ + virtual ~CAMDwnldQTWrap(); + + public: + void StartDownload(CDeploymentComponent *aComponent, TRequestStatus& aStatus); + + TInt getPendingDownloads(); + + + public: + void DownloadCompleteL(CDeploymentComponent *aComponent); + void DownloadCompleted(); + void DownloadFailed(TInt aDownloaderr); + void SetStatus(TInt aStatus); + + + public: + void DownloadComplete(class CDeploymentComponent *aComponent, + TInt aStatus); + TBool UidExistsL(const TUid &aUid, CDeploymentComponent *& aCompo, + CDeploymentComponent *aIgnored); + + public: + appmgmtdownloadmgr* appdwnld; + MDownloadMngrObserver& iObserver; + CDeploymentComponent *iComponent; + HBufC8* serverid; + TInt iap; + }; + + } + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/AMDownloaddb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/AMDownloaddb.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,142 @@ +/* +* 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 applicationmanagement components + * +*/ + + +#ifndef __AMDownloaddb_H +#define __AMDownloaddb_H + +// INCLUDE FILES + +#include +#include +#include +#include +#include + +// CONSTANTS + +// null final result value +const TInt KAMNullResult = 0; + +// Database name & location +const TInt KAMDownloaddbDrive = EDriveC; +const TUid KAMPolicyUID = + { + 0x200267FB + }; +const TInt KAMMaxPkgURLLength( 2048); +const TInt KAMMaxPkgNameLength( 80); +const TInt KAMMaxPkgVersionLength( 80); + +_LIT( KDBMSSecureID, "secure[200267FB]" ); + +_LIT( KAMDownloaddbName, "c:TARMAppMgmtDownloadDB.db" ); + +// Table and column names +_LIT( KTableAMMgmtObject, "AMMgmtObject" ); + +_LIT(NCol1, "Id"); +_LIT(NCol2, "LUID"); +_LIT(NCol3, "Result"); +_LIT(NCol4, "TargetURI"); +_LIT(NCol5, "IAPId"); + +class CAMDbItem : public CBase + { +public: + static CAMDbItem* NewL(); + ~CAMDbItem(); + + TInt id; + TUint32 iLUID; + TInt iResult; + + HBufC8* iTargetURI; + + TUint32 iapid; + + }; + +// CLASS DECLARATION + +/** + * CAMDownloaddb provides an interface for accessing AM database. + * + * @lib AMadapter.lib + * + */ +class CAMDownloaddb : public CBase + { + +public: + + /** + * Two-phased constructor. + * @return A pointer to the newly created instance. + */ + static CAMDownloaddb* NewL(); + + /** + * Two-phased constructor. Pushes the pointer onto the CleanupStack. + * @return A pointer to the newly created instance. + */ + static CAMDownloaddb* NewLC(); + + /** + * Destructor. + */ + virtual ~CAMDownloaddb(); + + void CreateTableL(RDbDatabase& aDatabase); + + void CreateandOpenL(TParse& name); + + TBool DeleteFromDatabaseL(TUint32 aLUID); + + void SaveToDatabaseL(TInt& aIndex, TUint32 aLuid, TInt aResult, + const TDesC8& aTargetURI, TUint32 aIapid); + + void ReadItemsL(RPointerArray& aItemArray, TDesC& aQueryBuffer); + + void ReadDbItemsL(RPointerArray& aItemArray); + + void GetEntryForLUIDL(RPointerArray& aItemArray, TDesC& aValue); + + /** + * Second phase construction. + */ + void ConstructL(); + + /** + * Constructor. + */ + CAMDownloaddb(); + +private: + + RDbNamedDatabase iDatabase; + RFs iFsSession; + RDbs iRdbSession; + + RDbTable iAMObjectTable; + CDbColSet* iColSet; + RDbView iView; + + }; + +#endif // __AMDownloaddb_H +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/AMPreInstallApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/AMPreInstallApp.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef AMPREINSTALLAPP_H_ +#define AMPREINSTALLAPP_H_ + +#include +#include +#include +#include "ApplicationManagementCommon.h" +#include "amstorage.h" + + +_LIT(KPreInstallPath, "\\private\\10202dce\\"); + +namespace NApplicationManagement + { + + class TPreInstalledAppParams + { +public: + TUid iPreInstalledAppUid; +#if 1 + TPreInstalledAppName iPreInstalledAppame; + TPreInstalledAppVendorName iPreInstalledAppVendorName; + TPreInstalledVersion iVersion; + TMimeType iMimeType; +#endif + //TPreInstalledVersion bufVersion; +#if 0 + HBufC* iPreInstalledAppame; + HBufC* iPreInstalledAppVendorName; +#endif + }; + + class CAMPreInstallApp : public CBase + { + +public: + ~CAMPreInstallApp(); + static CAMPreInstallApp* NewL(); + static CAMPreInstallApp* NewLC(); + void ListPreInstalledAppL(const TDesC& installDocPath); + void ListPreInstalledAppL(); + TBool RecognizeL(TDesC& aPathAndName, HBufC* aMimeType); + void MakeAllInstallPathsL(); + void GetPreInstalledAppsL(RPointerArray &aPreInstalledAppParams); + void Listallapps(); +private: + CAMPreInstallApp(); + + void ConstructL(); + +private: + + TFileName iPreInstallPath; // Path where to scan for pre-install files +#ifdef RD_MULTIPLE_DRIVE + CDesCArray* iInstallDocPathArray; +#else + TFileName iPreInstallDocumentPath; // Path where to scan for pre-install files +#endif // RD_MULTIPLE_DRIVE + + RFs iFs; + CDeliveryComponentStorage *iStorage; + RPointerArray iPreInstalledAppParams; + + }; + + + + } + +#endif /*AMPREINSTALLAPP_H_*/ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/ApplicationManagementJavaUtility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/ApplicationManagementJavaUtility.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,76 @@ +/* +* 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 applicationmanagement components + * +*/ + + +#ifndef __APPLICATIONMANAGEMENTJAVAUTILITY_H__ +#define __APPLICATIONMANAGEMENTJAVAUTILITY_H__ + +// EXTERNAL INCLUDES +#include +#include +using namespace Java; +// INTERNAL INCLUDES +#include "ApplicationManagementUtility.h" + +namespace NApplicationManagement + { + + // CLASS DEFINITION + /** + * + * + * + */ + class CApplicationManagementJavaUtility : + public CApplicationManagementUtility + { + +public: + // Constructors and destructors + + static CApplicationManagementJavaUtility* NewL(); // Static constructor + static CApplicationManagementJavaUtility* NewLC(); // Static constructor + ~CApplicationManagementJavaUtility(); // Destructor + +private: + // Constructors and destructors + + CApplicationManagementJavaUtility(); // Default constructor + void ConstructL(); // Second phase construct + +public: + // New methods + + TBool FindInstalledJavaUidL(const TUid &aUid) const; + + void InstalledSuiteUidsL(RArray &); + + void JavaUidsL(RArray &aUids); + + void RefreshJavaRegistryL(); + void GetInstalledMidletParametersL( + TMidletParameters& aMidletParameters); + +private: + // Data + + CJavaRegistry* iJavaRegistry; + }; + + } + +#endif // __ApplicationManagementJavaUtility_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/ApplicationManagementServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/ApplicationManagementServer.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,461 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef __APPLICATIONMANAGEMENTSERVER_H__ +#define __APPLICATIONMANAGEMENTSERVER_H__ + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ApplicationManagementClientServer.h" +#include "PlatformSecurityPolicies.h" +#include "AMDeploymentComponent.h" +#include "amstorage.h" +#include "ApplicationManagementUtility.h" +#include "AMDownloaddb.h" +#include "amwaitprogdialog.h" +#include "AMDownloadStore.h" + +// CONSTANTS +const TUid NProperty = {0x200267FB}; +const TUint32 NInteger = 0x00000001; +const TInt KBase64BufSize = 131072; +const QString path = "z:/resource/qt/translations/"; +class CAppMgmtSrvApp; +_LIT(KIndicatorParamDownloading, "Downloading"); +namespace NApplicationManagement + { + + // ----------------------------------------------------------- + // ApplicationManagement server panic codes + // ----------------------------------------------------------- + enum TApplicationManagementPanic + { + EPanicGeneral, + EBadSubsessionHandle, + EPanicIllegalFunction, + EBadDescriptor + }; + // ----------------------------------------------------------- + // Wait dialog types + // ----------------------------------------------------------- + enum TDialogType + { + EInstallWaitDlg, + EUninstallWaitDlg + }; + // FUNCTION PROTOTYPES + + void PanicClient(const RMessagePtr2& aMessage, + TApplicationManagementPanic aPanic); + + // CLASS DECLARATION + class CShutdown : public CTimer + { + enum + { + KApplicationManagementShutdownDelay = 0x3000000 // approx 30s + }; +public: + inline CShutdown(); + inline void ConstructL(); + inline void Start(); + inline void Stop(); +private: + void RunL(); + }; + + /** + * CApplicationManagementServer + * Description. + */ + + class CApplicationManagementServer : public CPolicyServer, + public MDownloadMngrObserver,public MInstallerCallBack + { +public: + static CServer2* NewL(HbMainWindow *mainWindow); + ~CApplicationManagementServer(); + + void Panic(TInt aPanicCode); + void AddSession(); + void DropSession(); + + CPolicyServer::TCustomResult CreateServiceSecurityCheckL( + TUid aServiceType, const RMessage2& aMsg, TInt& aAction, + TSecurityInfo& aMissing); +private: + + CApplicationManagementServer(); + virtual void ConstructL(HbMainWindow *mainWindow); + CSession2* NewSessionL(const TVersion& aVersion, + const RMessage2& aMessage) const; + + //From CPolicyServer + CPolicyServer::TCustomResult + CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, + TSecurityInfo& aMissing); + + // browses sis registry + void LookupSisRegistryL(); + + //New methods + void DownloadCompleteL(CDeploymentComponent *aComponent, TInt iapid, + HBufC8* aServerId); + + void InstallCompleteL(const CDeploymentComponent &aCompo, + const TBool &aInstallSuccess=ETrue); + + TInt GetErrorStatus(TInt aErrorDownload, TInt aErrorInstall); + + void EnableDMNetworkMonL(TInt iapid, HBufC8 *aServerId); + +public: + + /** + * Storage Returns the storage + * @return The storage pointer + */ + inline CDeliveryComponentStorage *Storage() + { + return iStorage; + } + + /** + * UninstallL Uninstalls the given deployment component. + * @param aComponent The component to be uninstalled + * @param aStatus TRequestStatus of the call + */ + void UninstallL(const CDeploymentComponent &aComponent, + TRequestStatus &aStatus); + + void AddDownloadL(CDeploymentComponent *aComponent); + + void PerformRFSL(); + void RemoveInternalL(const CDeploymentComponent &aCompo, + TBool aDoUninstall = ETrue); + + TBool CheckCertL(const TCertInfo &aInfo) const; + void DoTheInstallL(CDeploymentComponent &aCompo); + + void GetAMServerDownloadDBL(TUint32 internalid, TInt& finalresult, + TDes8& atargetURI); + + TBool IsOMASCOMOEnabledL(); + + /** + * JavaUidsL Returns java uids. + * @param aUids the array to hold uids + */ + void JavaUidsL(RArray &aUids) const; + + /** + * FullUpdateL updates target with source + * @param sid Source deployment component id + * @param tid Target deployment component id + */ + void FullUpdateL(const TUint32 sid, const TUint32 tid); + + /** + * SetDataL sets data to deployment component and checks possible uid overlaps + * @param aCompo deployment component where data is set + * @param aData new data to be set + * @param aMime mimetype of the new data to be set + */ + void SetDataL(CDeploymentComponent &aCompo, const TDesC8 &aData, + const TDesC8 &aMime); + /** + * Checks of data in file is Base64 decoded. + * @param aFile file to be checked if data is encoded + * @param aLength data length in file + * @return ETrue if given data in file is Base64 encoded + */ + TBool IsDataFileB64EncodedL(RFile &aFile, TInt& aLength); + + /** + * Checks of data is Base64 decoded. + * @param aData data to be checked for encoding + * @return ETrue if given data is Base64 encoded + */ + TBool CheckB64Encode(const TDesC8& aData); + + /** + * B64 Decodes data in aData and return decoded data + * @param aSourceFile file containing decoded data + * @param aDestinationFile file where to decode data + */ + void DecodeB64DataFileL(RFile& aSourceFile, RFile& aDestinationFile); + + /** + * B64 Decodes data in aData and return decoded data + * @param aData decoded data + * @return Decoded data + */ + HBufC8* DecodeB64DataLC(const TDesC8 &aData); + + /** + * B64 Encodes data in aData to aTarget + * @param aData data which is encoded + * @param aTarget encoded data buffer + */ + void EncodeDataL(const TDesC8& aData, CBufBase &aTarget); + void HandleAllClientsClosed(); + + void DeleteGenericAlertForIDL(TUint32 internalid); + void CheckforDuplicateMidletsL(TMidletParameters& amidletParameters); + +public: + // from MDownloadMngrObserver + + /** + * + * @param aComponent + * @param aStatus + */ + void ComponentDownloadComplete(CDeploymentComponent *aComponent, + TInt iapid, HBufC8 *aServerId); + + /** + * Looks all deployments components and sis & java registries + * to find out whether given uid is already used... + * @param aUid The uid to be looked for + * @return ETrue if uid is found, EFalse otherwise + */ + TBool HasUidL(const TUid &aUid, CDeploymentComponent *& aCompo, + CDeploymentComponent *aIgnored); + + void ComponentDownloadFailed(CDeploymentComponent *aComponent, + TInt aReason); + + void StartShutDownTimerL(); + + TBool IsInstalledAppRemovableL(TDriveNumber &iDrive); + + void InstallationCancelled(); +private: + + /** + * FullUpdateL updates target with source + * @param sid Source deployment component + * @param tid Target deployment component + */ + void FullUpdateL(CDeploymentComponent &scompo, + const CDeploymentComponent &tcompo); + + /** + * InstallL Installs the given deployment component. Async version. + * @param aComponent The component to be installed + * @param aStatus TRequestStatus of the call + */ + void InstallL(const CDeploymentComponent &aComponent, + TRequestStatus &aStatus); + /** + * InstallL Installs the given deployment component. Syncronized version. + * @param aComponent The component to be installed + */ + void InstallL(const CDeploymentComponent &aComponent); + + /** + * PrepareInstallL Prepares install of given component. + * @param aComponent The component to be installed + * @param aFileName If call is successful, will contain + * the name of file ready to be installed + * @return ETrue if preparation is successful, EFalse otherwise + */ + TBool PrepareInstallL(const CDeploymentComponent &aComponent, + TFileName &aFileName); + + /** + * Finds whether the given uid is found in sis or java registry. + * Searches first sis registry and uses FindJavaUidL if not found + */ + TBool FindInstalledSisUidL(const TUid &aUid) const; + + /** + * Finds whether the given uid is found in java registry + */ + TBool FindInstalledJavaUidL(const TUid &aUid) const; + void SetSisAppVersionAndDriveL(CDeploymentComponent &aCompo); + void JavaInstallL(CDeploymentComponent &aCompo); + void SisInstallL(const CDeploymentComponent &aCompo); + TUid FindNewUid(const RArray &aUidsOrig, + const RArray &aUidsNew) const; + + /** + * Reads Jar file name from Jad file + * @param aFile file handle for Jad file where to find Jar filename + * @return aFileName If call is successful, will contain the name of file ready to be installed + */ + TFileName ReadJarFileNameL(RFile& aFile) const; + + /** + * Reads line of data from file. + * @param aStream stream handle where to read data + * @param aLineBuffer buffer where function appends read data for line. Return a full line at time. + */ + void ReadLineL(RReadStream& aStream, TDes8& aLineBuffer) const; + + /** + * DoDataUpdateCheck checks whether there's dc having same data uid + * @return The conflicting DC or NULL + */ + CDeploymentComponent * DoDataUpdateCheckL( + CDeploymentComponent &aCompo); + + // Functions used to generate temporary files Java installation use case + // where both Jad and Jar files are delivered to phone and Jad file is used to install + // the Java application from local Jar file. + void GenerateTempJarFileNameL(RFs &aFs, const TDesC& aMetaSource, + TFileName &aFileName) const; + + void GenerateTempFileNameL(const RFs &aFs, const TDesC& aSource, + TFileName &aFileName) const; + + void GenerateTempFileNameL(RFs &aFs, + const CDeploymentComponent& aCompo, TFileName& aSource, + TFileName &aMetaSource, TFileName &aFileName, + TFileName &aMetaFileName) const; + + void GenerateTempFileNameL(RFs &aFs, + const CDeploymentComponent& aCompo, TFileName &aFileName, + TFileName &aMetaFileName) const; + + CApaAppServiceBase* CreateServiceL(TUid aServiceType) const; +public: + CAppMgmtSrvApp* iParentApp; +private: + TInt iSessionCount; + CShutdown iShutdown; + CApplicationManagementUtility* iUtility; + CDeliveryComponentStorage *iStorage; + TBool iInstallInProgress; + + Usif::RSoftwareInstall iInstaller; + Usif::COpaqueNamedParams *iArgu; + Usif::COpaqueNamedParams *iResults; + SwiUI::TInstallOptionsPckg iInstallOptions; + SwiUI::TUninstallOptionsPckg iUninstallOptions; + SwiUI::TInstallReqPckg iInstallReq; + TFileName iAppname; + RFs iInstallRFs; + RFile iInstallFile; + CAMDownloadStore* iDownloadMngr; + CAMDownloaddb* iAMServerDB; + TBool iOMASCOMOEnabled; + + appmgmtdownloadmgr* m_DownloadMngr; + QString m_appName; + AMWaitProgDialog* m_Dlg; + CDeploymentComponent* iComp; + HbMainWindow* m_Window; + int mUserCancelled; + }; + + namespace NPolicyConstants + { + + // "CSF" + CA + SerialNumber + Fingerprint) ; + //_LIT( KSubjectFormat, "CSF%S%S%S" ); + namespace NActions + { + _LIT8( KUse, "Use" ); + } + _LIT8( KResourceValue, "ApplicationManagement" ); + } + + class CApplicationManagementSession : public CSession2 + { +public: + inline CApplicationManagementSession(); + inline CApplicationManagementSession(const TCertInfo &aInfo); + void CreateL(); +private: + ~CApplicationManagementSession(); + inline CApplicationManagementServer& Server() const; + + void ServiceL(const RMessage2& aMessage); + TBool PreDispatchMessageL(const RMessage2 &aMessage); + void DispatchMessageL(const RMessage2& aMessage); + void ServiceError(const RMessage2& aMessage, TInt aError); + + void ComponentCountL(const RMessage2& aMessage); + void ComponentIdsL(const RMessage2& aMessage) const; + void Deliver2L(const RMessage2& aMessage) const; + void DeliverCompleteL(const RMessage2& aMessage) const; + void GetComponentL(const RMessage2& aMessage) const; + void InstallL(const RMessage2 &aMessage) const; + void UpdateL(const RMessage2 &aMessage) const; + void GetDataL(const RMessage2 &aMessage) const; + void GetDataLengthL(const RMessage2 &aMessage) const; + void RemoveL(const RMessage2 &aMessage) const; + void UpdateDataL(const RMessage2 &aMessage) const; + void UpdateStreamedDataL(const RMessage2& aMessage) const; + void DownloadL(const RMessage2 &aMessage) const; + void AddTrustL(const RMessage2 &aMessage); + void FullUpdateL(const RMessage2 &aMessage) const; + void GetUserIdL(const RMessage2 &aMessage) const; + void StartDownloadL(const RMessage2& aMessage) const; + void StateChangeComponentIdsL(const RMessage2& aMessage) const; + void StateChangeComponentIdsCountL(const RMessage2& aMessage) const; + void StateChangeCompleteL(const RMessage2& aMessage) const; + void ActivateL(const RMessage2& aMessage) const; + void DeactivateL(const RMessage2& aMessage) const; + void GetTemporaryInstFileL(const RMessage2 &aMessage) const; + void GetFinalResultForGAL(const RMessage2 &aMessage); + + TInt PackageSizeL(Swi::RSisRegistrySession& aSession, + Swi::RSisRegistryEntry& aEntry); + TInt AugmentationSizeL(Swi::RSisRegistrySession& aSession, + const Swi::CSisRegistryPackage& aPackage); + + void RemoveInternalL(const TUint32 &aId) const; + + /** + * Collects active components in aArrt and places them in aArr + */ + void ActiveComponentsL(const RComponentIdArray &aArrt, + RComponentIdArray &aArr,TDeploymentComponentState &aState) const; + + void GenericAlertSentForIdL(const RMessage2& aMessage) const; + + void CheckStatusNodesValuesL(); + +private: + void LookupSisRegistryL(); + + TCertInfo iCertInfo; + TBool iTrustAdded; + + }; + + } +#endif //__APPLICATIONMANAGEMENTSERVER_H__ +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/ApplicationManagementUtility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/ApplicationManagementUtility.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,94 @@ +/* + * 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 applicationmanagement components + * + */ + +#ifndef __CApplicationManagementUtility_H__ +#define __CApplicationManagementUtility_H__ + +// EXTERNAL INCLUDES +#include +#include +#include "ApplicationManagementCommon.h" +#include "javaregistryentry.h" + + +namespace NApplicationManagement + { + + // CLASS DEFINITION + /** + * + * + * + */ + + class TMidletParameters + { +public: + TUid iMidletUid; + TMidletnameName iMidletName; + TMidletVendorName iMidletVenorName; + TMidletVersion bufVersion; + TDriveNumber iDrive; + + }; + class CApplicationManagementUtility : public CBase + { + +public: + // Constructors and destructors + + static CApplicationManagementUtility* NewL(); // Static constructor + static CApplicationManagementUtility* NewLC(); // Static constructor + ~CApplicationManagementUtility(); // Destructor + +protected: + + CApplicationManagementUtility(); // Default constructor + +private: + // Constructors and destructors + + void ConstructL(); // Second phase construct + + +public: + // New methods + + virtual TBool FindInstalledJavaUidL(const TUid &aUid) const; + + virtual void InstalledSuiteUidsL(RArray ); + + virtual void JavaUidsL(RArray &aUids); + + virtual void RefreshJavaRegistryL(); + virtual void GetInstalledMidletParametersL( + TMidletParameters& aMidletParameters); + + static void SetFileName(const TFileName& aFileName); + static void GetFileName(TFileName& aFileName); + +public: + static TInt mHidden; + static HbDialog* mCurrDlg; + static TInt iSilentSession; + static TFileName iFileName; + + }; + + } + +#endif // __CApplicationManagementUtility_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/ApplicationManagementUtilityFactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/ApplicationManagementUtilityFactory.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,50 @@ +/* + * 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 applicationmanagement components + * + */ +#ifndef __APPLICATIONMANAGEMENTUTILITYFACTORY_H__ +#define __APPLICATIONMANAGEMENTUTILITYFACTORY_H__ + +// INTERNAL INCLUDES +#include "ApplicationManagementUtility.h" + +namespace NApplicationManagement + { + + // CLASS DEFINITION + /** + * + * + * + */ + class ApplicationManagementUtilityFactory + //: public CBase + { + +public: + // New methods + + /** + * + * @param + * @return + */ + static CApplicationManagementUtility* CreateManagementUtilityL(); + + }; + + } + +#endif // __APPLICATIONMANAGEMENTUTILITYFACTORY_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/PlatformSecurityPolicies.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/PlatformSecurityPolicies.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef __PLATFORM_SECURITY_POLICIES__ +#define __PLATFORM_SECURITY_POLICIES__ + +// INCLUDES + +#include +#include "ApplicationManagementClientServer.h" + +// CONSTANTS + +const TUint KApplicationManagementRangeCount = 3; + +const TInt KApplicationManagementRanges[KApplicationManagementRangeCount] = + { + + NApplicationManagement::EAddTrust, //For Management + NApplicationManagement::EPerformRfs, + NApplicationManagement::ELast +,//ENotSupported +}; + +const TUint8 + KApplicationManagementSecurityElementsIndex[KApplicationManagementRangeCount] = + { + 0, //applies to 1st range + 1, + CPolicyServer::ENotSupported + }; + +//capability checks +const CPolicyServer::TPolicyElement KApplicationManagementSecurityElements[] = + { + { + _INIT_SECURITY_POLICY_C1(ECapabilityTrustedUI), CPolicyServer::EFailClient + }, + { + _INIT_SECURITY_POLICY_S1(0x101f9a02, ECapabilityDiskAdmin), CPolicyServer::EFailClient + } + }; + +//Package all the above together into a policy +//CPolicyServer::TPolicy KApplicationManagementSecurityPolicy; + +#endif + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/ServicePluginLogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/ServicePluginLogger.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,152 @@ +/* +* 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 interface macros +* +*/ + + +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +// Set logging on only for debug builds as Paos filter is a critical component +// when considering browser performance +#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( KLogFolder, "PnP" ); +_LIT( KLogFile, "ServicePlugin.TXT" ); + +#endif + +// CONSTANTS +// None. + +// MACROS +/* +----------------------------------------------------------------------------- + + INTERNAL MACROs. + + DO NOT USE THESE DIRECTLY !!! + SEE EXTERNAL MACROS + +----------------------------------------------------------------------------- +*/ + +#ifdef LOGGER_LOGGING + + +#define INTRLOGTEXT( AAA ) \ + { \ + RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, AAA ); \ + } +#define INTRLOGSTRING( AAA ) \ + { \ + _LIT( tempLogDes, AAA ); \ + RFileLogger::Write( KLogFolder(), KLogFile(), EFileLoggingModeAppend, tempLogDes() ); \ + } +#define INTRLOGSTRING2( AAA, BBB ) \ + { \ + _LIT( tempLogDes, AAA ); \ + RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, TRefByValue( tempLogDes()), BBB ); \ + } +#define INTRLOGSTRING3( AAA, BBB, CCC ) \ + { \ + _LIT( tempLogDes, AAA ); \ + RFileLogger::WriteFormat( KLogFolder(), KLogFile(), EFileLoggingModeAppend, TRefByValue( tempLogDes()), BBB, CCC ); \ + } + +#define INTRLOGRSTRING( AAA, BBB ) \ + { \ + TPtrC8 string8 = BBB.DesC(); \ + HBufC* buf = HBufC::NewLC( string8.Length() ); \ + buf->Des().Copy( string8 ); \ + LOGSTRING2( AAA, buf ); \ + CleanupStack::PopAndDestroy( buf ); \ + } + +#else +#define INTRLOGTEXT( AAA ) +#define INTRLOGSTRING( AAA ) +#define INTRLOGSTRING2( AAA, BBB ) +#define INTRLOGSTRING3( AAA, BBB, CCC ) +#define INTRLOGRSTRING( AAA, BBB ) +#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 ); + +#define LOGRSTRING( AAA, BBB ) { \ + INTRLOGRSTRING( AAA, BBB ); \ + } // Example: LOGRSTRING( "Test %i", RString1 ); + +#else // LOGGING_ENABLED + +#define LOGTEXT( AAA ) +#define LOGSTRING( AAA ) +#define LOGSTRING2( AAA, BBB ) +#define LOGSTRING3( AAA, BBB, CCC ) +#define LOGRSTRING( AAA, BBB ) + +#endif // LOGGING_ENABLED + +// DATA TYPES +// None. + +// FUNCTION PROTOTYPES +// None. + +// FORWARD DECLARATIONS +// None. + +// CLASS DECLARATION +// None. + +#endif // __LOGGER_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/amdeploymentcomponent.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/amdeploymentcomponent.inl Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,100 @@ +/* + * 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 applicationmanagement components + * + */ +#include "amdeploymentcomponentdata.h" + +inline const TDesC8 &CDeploymentComponent::DownloadURI() const + { + return iDownloadURI; + } + +inline const TUid & CDeploymentComponent::Uid() const + { + return iUid; + } + +inline const TDeploymentComponentId &CDeploymentComponent::ComponentId() const + { + return iId; + } + +inline const TDeploymentComponentName &CDeploymentComponent::ComponentName() const + { + return iName; + } + +inline const TDeploymentComponentVersion &CDeploymentComponent::ComponentVersion() const + { + return iVersion; + } + +inline TDeploymentComponentState CDeploymentComponent::State() const + { + return iState; + } + +inline TUint32 CDeploymentComponent::InternalId() const + { + return iInternalId; + } + +inline const TDesC8& CDeploymentComponent::UserId() const + { + return iUserId; + } + +inline const TDeploymentComponentState& CDeploymentComponent::OldState() const + { + return iOldState; + } + +inline void CDeploymentComponent::StateChangeComplete() + { + iOldState = EDCSNone; + } +inline TInt CDeploymentComponent::Status() const + { + return iStatus; + } +inline const TDeploymentComponentPkgId& CDeploymentComponent::PkgId() const + { + return iPkgID; + } +inline const TDeploymentComponentDescription& CDeploymentComponent::Description() const + { + return iDescription; + } +inline const TDeploymentComponentPkgIdRef& CDeploymentComponent::PkgIDRef() const + { + return iPkgIDRef; + } +inline const TDeploymentComponentPkgType& CDeploymentComponent::PkgType() const + { + return iPkgType; + } + +inline const TMidletnameName& CDeploymentComponent::MidletName() const + { + return iMidletName; + } +inline const TMidletVendorName& CDeploymentComponent::MidletVendor() const + { + return iMideltVendorName; + } +inline const TMidletVersion& CDeploymentComponent::MidletVersion() const + { + return iMidletVersion; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/amdeploymentcomponentdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/amdeploymentcomponentdata.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef __AMDEPLOYMENTCOMPONENTDATA_H__ +#define __AMDEPLOYMENTCOMPONENTDATA_H__ + +#include +#include +#include +#include "ApplicationManagementCommon.h" +const TInt KMaxUrlLength = 2048; +namespace NApplicationManagement + { + + /** + * Data class to Data access + */ + class CDeploymentComponentData : public CBase + { +public: + enum TType + { + EData, + EInstallOptions, + EMetaData + }; +private: + CDeploymentComponentData(TType aType, const TDesC8 &aDataFile); + CDeploymentComponentData(); + + void ConstructL(const TDesC8 &aData, const TDesC8 &aMime); + void ConstructLoadL(RReadStream &aStream); + /** + Possibly changes mutable iData + */ + void LoadDataL() const; + + TBool IsSISInstallFile(const TDesC8 &aMimeType); + +public: + static CDeploymentComponentData* NewL(TType aType, + const TDesC8 &aData, const TDesC8 &aMime, + const TDesC8 &aDataFile); + + static CDeploymentComponentData* NewLC(TType aType, + const TDesC8 &aData, const TDesC8 &aMime, + const TDesC8 &aDataFile); + + static CDeploymentComponentData* LoadL(RReadStream &aStream); + + static CDeploymentComponentData* LoadLC(RReadStream &aStream); + + virtual ~CDeploymentComponentData(); + + void SerializedFormL(RWriteStream &aBuffer) const; + TInt SerializedFormLength() const; + + const TDesC8 &Data() const; + const TDesC8 &DataFileName() const; + void ResetData(RFs &aFs); + TInt DataLengthL() const; + inline TType Type() const; + + TUid SetDataL(const TDesC8& aMimeType); + TUid SetDataL(const TDesC8 &aData, const TDesC8& aMimeType); + TUid SetDataL(const TFileName &aData, const TDesC8& aMimeType); + void SetDataFileNameL(const TDesC8 &aNewFileName); + void SetMimeTypeL(const TDesC8 &aMimeType); + inline const TDesC8 &MimeType() const; + + void PersistL(RFs &aFs); + void DestroyL(RFs &aFs) const; + + CDeploymentComponentData &operator=( + const CDeploymentComponentData &aData); + + TUid ResolveUidL(RFs &aFs); + + TUid ParseUidFromSisFileL(RFile& aHandleToFile); + +private: + mutable HBufC8 *iData; + TBuf8 iDataFileName; + TMimeType iMimeType; + TType iType; + TBuf<15> iExtn; + }; + + inline CDeploymentComponentData::TType CDeploymentComponentData::Type() const + { + return iType; + } + + inline const TDesC8 &CDeploymentComponentData::MimeType() const + { + return iMimeType; + } + } + +#endif + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/amsmlhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/amsmlhelper.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef __AMSMLHELPER_H__ +#define __AMSMLHELPER_H__ + +#include +#include +#include +#include + +namespace NApplicationManagement + { + + /** + * Utility class that wraps access to DM client functionality + */ + class SmlHelper + { +public: + + // 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 + }; + + /** + * GetCurrentProfileIdL Finds out the current syncml DM session profile id. + * @param aProfile Will contain the current profile id if call is successfull + * @return Success status (KErrNone if successful) + */ + static TInt GetCurrentProfileIdL(TSmlProfileId &aProfile); + /** + * LaunchSessionL Launches SyncML DM session using given profile id. + * @param aProfile The id of profile which is to be used to start DM session + * @return Success status (KErrNone if successful) + */ + static TInt LaunchSessionL(TSmlProfileId &aProfile); + + /** + * Fetch the default IAP used by the currently active DM profile + * @param aDefaultIAP on successfull return contains the default IAP number + */ + + static void GetDefaultIAPFromDMProfileL(TInt& aDefaultIAP); + + static void GetConnectionPropertyNameL(RSyncMLSession& aSyncSession, + TDes8& aText, TInt aPropertyPos); + + static TInt StrToInt(const TDesC& aText, TInt& aNum); + + static HBufC8* GetCurrentServerIDL(); + + }; + + } + + +#endif + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/amstorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/amstorage.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef __AMDSTORAGE_H__ +#define __AMDSTORAGE_H__ + +#include +#include +#include +#include "ApplicationManagementCommon.h" + +class CRepository; + +namespace NApplicationManagement + { + + class CDeploymentComponent; + class CAMAppHideUtil; + + class RComponentIdArray : public RArray + { +public: + void SetListL(const TDesC8& aChilds); + void GetListLC(HBufC8 *& aChilds, TInt &aLength); + void RemoveByValue(TUint32 aValue); + }; + + typedef TPckgBuf TCertInfoPckg; + + class RCertArray : public RPointerArray + { +public: + void ExternalizeL(RWriteStream& aStream) const; + void InternalizeL(RReadStream& aStream); + TInt FindByValue(const TCertInfoPckg &aPckg); + }; + /** + * Factory class to Data component creation + */ + class CDeliveryComponentStorage : public CBase + { + /** + * Constructor + */ + CDeliveryComponentStorage(); + + /** + * 2nd phase constructor. Loads compontns + */ + void ConstructL(); + + /** + * Saves the state to disk + */ + void PersistStateL(); + + /** + * Loads components from disk + */ + void LoadComponentsL(); + + /** + * Creates and returns next free deployment component id + */ + TInt NextKey(); + + /** + * Loads certificate array + */ + void LoadCertsL(); + + /** + * Saves and closes certificate array + */ + void CloseCertificatesL(); + +public: + + /** + * Creates new storage object and constructs it + */ + static CDeliveryComponentStorage* NewL(); + + /** + * Creates new storage object and constructs it, leaving it + * on the cleanup stack + */ + static CDeliveryComponentStorage* NewLC(); + + /** + * Destructor + */ + virtual ~CDeliveryComponentStorage(); + + /** + * GetComponentIds Returns the const id array of component ids. + */ + const RComponentIdArray &GetComponentIds() const; + + /** + * Places all those component's ids in array who have possibly changed + * state and no StateChangedL for that id called afterwards. + * @param aArray array to hold the ids + */ + void GetStateChangeComponentIdsL(RComponentIdArray &aArray); + + /** + * StateChangedL Confirms that state change has been acknowledged by user + * @param aInternalId The id whose state change is confirmed. + */ + void StateChangedL(TUint32 aInternalId); + + /** + * Creates new deployment component object having given state and user id + * and constructs it. Optionally component may have owning certificate. + * @param aState the state of to-be-created component + * @param aUserId the user id of to-be-created component + * @param aCertInfo the certificate of the owner of to-be-created component + */ + CDeploymentComponent *NewComponentL( + const TDeploymentComponentState &aState, + const TDCUserId &aUserId, const TCertInfo *aCertInfo = NULL); + + /** + * DeliverL makes the given component ot delivered state + * @param aComponent the component that'll be delivered + */ + void DeliverL(CDeploymentComponent &aComponent); + + /** + * UpdateL updates the given component permanently + * @param aComponent the component that'll be persisted + */ + void UpdateL(const CDeploymentComponent &aComponent); + + /** + * RemoveL Removes the deployment component having given id. The related object + * will be invalid after call. + * @param aInternalId the to-be-removed component's id + */ + void RemoveL(TUint32 aInternalId); + + /** + * InstalledL updates the given component state + * @param aComponent the component that'll be persisted + */ + void InstalledL(CDeploymentComponent &aComponent); + + //Update Deplyoment Components State variable + void SetDeploymentComponentState(CDeploymentComponent &aComponent,TDeploymentComponentState aState); + CDeploymentComponent &ComponentL(TUint32 aInternalId); + void ActivateL(CDeploymentComponent &aComponent); + void DeactivateL(CDeploymentComponent &aComponent); + + void CheckForDuplicateNodesInDeployedL( + CDeploymentComponent &aComponent); + HBufC8* IntToDes8LC(const TInt aLuid); + + const RCertArray &Certificates() const + { + return iCertificates; + } +protected: + + CDeploymentComponent *LoadComponentL(TInt aInternalId, + const TDesC8 &aBuffer) const; +private: + CRepository *iRepository; + RPointerArray iComponents; + RComponentIdArray iComponentIds; + TInt iNextId; + RCertArray iCertificates; + CAMAppHideUtil *iHidder; + }; + + } + +#endif __AMDELIVERYCOMPSTORAGE_H__ + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/amview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/amview.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef AMVIEW_H_ +#define AMVIEW_H_ + +#include +#include +#include "ApplicationManagementUtility.h" + +class AMView : public HbView + { + Q_OBJECT + +public: + AMView(); + ~AMView(); + + //Handles the incoming events + bool eventFilter(QObject *object, QEvent *event); + }; +#endif /* AMVIEW_H_ */ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/amwaitprogdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/amwaitprogdialog.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef AMWAITPROGDIALOG_H_ +#define AMWAITPROGDIALOG_H_ + +#include +#include +#include +#include +#include "ApplicationManagementUtility.h" + +class MInstallerCallBack + { + public: + virtual void InstallationCancelled()=0; + }; +class AMWaitProgDialog : public QObject + { + Q_OBJECT + +public: + AMWaitProgDialog(QString aAppName,MInstallerCallBack& aCallback ); + ~AMWaitProgDialog(); + + void createWaitDialog(TInt aType); + void closeAMWaitDialog(); + void startIndicator(); + void registerInstallRequest(TRequestStatus &aStat); +public slots: + void hideAMWaitDialog(); + void cancelWaitDialog(); + +private: + HbProgressDialog* mDlg; + HbIndicator* mIndi; + TRequestStatus* m_Stat; + QString m_appname; + TInt mType; + int mIndicatorDeactive; + MInstallerCallBack& m_callback; + }; + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/appmgmtdownloadmgr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/appmgmtdownloadmgr.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "appmgmtprogdialog.h" +#include "AMDeploymentComponent.h" +#include "appmgmtnotifier.h" +#define KOmaDMAppUid 0x101F6DE5 +const TReal KSizeDivisor = 1024.0; + +const TUint32 KDownloadActive = 0x0000008; +enum TDriveSize + { + EKb = -1, + EMb = 0, + EGb = 1 + }; + +using namespace WRT; + +namespace NApplicationManagement + { + + class MDownloadMgrQTCallback + { + public: + virtual void DownloadCompleted()=0; + virtual void DownloadFailed(TInt aDownloaderr)=0; + virtual void SetStatus(TInt aStatus)=0; + }; + + class CDialogWait : public CActive + { + public: + static CDialogWait* NewL(); + CDialogWait(); + void ConstructL(); + ~CDialogWait(); + void StartWait(); + void Stop(); + protected: + void DoCancel(); + void RunL(); + TInt RunError(TInt aError); + private: + CActiveSchedulerWait* iWait; + }; + + class appmgmtdownloadmgr : public QWidget + { + + Q_OBJECT + + public: + appmgmtdownloadmgr(QWidget* parent, MDownloadMgrQTCallback& wrapper, TRequestStatus& aStatus); + ~appmgmtdownloadmgr(); + + void startDownload(CDeploymentComponent *aComponent); + void showDialog(CDeploymentComponent *aComponent); + void showUninstallDialog(const CDeploymentComponent &aCompo, TRequestStatus &s); + void updateProgress(TInt32 aDownloadedSize, TInt32 aContentSize); + void closeProgress(); + void setUri(); + void getUri(); + void setState(); + void getState(); + void MimeType(QString& aMimeType); + void FileName(QString& afilename); + void SetMimeType(); + void sendSrvToBg(); + QString convertSize(); + int currDwnldStatForGenericAlert(int dwnldstatus); + + public slots: + bool downloadMgrEventRecieved(DownloadManagerEvent *event); + bool downloadEventRecieved(DownloadEvent *event); + void dialogSlot(HbAction*); + void defaultDriveChanged(int); + private: + void getAvailableDrives(); + void showInstalltoDialog(); + void showDownloadDialog(); + private: + QStringList m_drivList; + QString m_appName; + HbAction* mOkButton; + HbAction* mCancel; + QString mSize; + QString mSizeFormat; + QString mNotifierdata, mDialogData; + QString m_sizeStr; + QString m_mimetype; + HbComboBox* mDriveBox; + HbDialog* mDialog; + public: + // Functions from base classes + TBuf<256> drilist; + DownloadManager* iDownloadManager; + Download* iDl; + int m_inProgress; + int m_currentDownloadedSize; + int m_totalSize; + CDialogWait* iWait; + TUint32 iProgStarted; + TUint32 iSetFinalValue; + int m_downloadStatus; + AppMgmtProgDialog *iProgressNote; + TDownloadTarget iOperationType; + private: + // Data + MDownloadMgrQTCallback& m_callback; + CDeploymentComponent* iComp; + HBufC *iFileName; + HBufC8 *iContentType; + HBufC8 *iURI; + TBool iProgressCancelled; + TBool iDialogAccepted; + TRequestStatus& iStatus; + AppMgmtNotifier* mNote; + int mEndReported; + int mNetworkLoss; + }; + + } diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/appmgmtnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/appmgmtnotifier.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef APPMGMTNOTIFIERS_H_ +#define APPMGMTNOTIFIERS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include "AMDeploymentComponent.h" + +using namespace NApplicationManagement; + +class AppMgmtNotifier : public QWidget + { + Q_OBJECT + +public: + AppMgmtNotifier(QString aAppName = 0); + ~AppMgmtNotifier(); + + void getAvailableDrives(); + void showInstallSuccessNote(); + void showInstallFailedNote(); + void showUninstallDialog(const CDeploymentComponent &aCompo, TRequestStatus &s); + void showInstallDialog(CDeploymentComponent *aCompo, TRequestStatus &s); + void showUnInstallSuccessNote(); + void showUnInstallFailedNote(); + bool showDownloadFailedNote(QString aNotifierdata); + void showDownloadSuccessNote(); + void sendServerToBackground(); + void bringServerToForeground(); + void registerStatus(TRequestStatus &stat); +public slots: + void dlgSlot(HbAction* action); + void dialogUnSlot(HbAction* action); + void successSlot(HbAction* reaction); + void defaultDriveChanged(int i); +private: + CDeploymentComponent* iComp; + TRequestStatus *iStat; + + QString m_appname; + HbAction* m_OkButton; + HbAction* m_Cancel; + HbDialog* m_Dialog; + TBuf<256> m_Drilist; + TRequestStatus* m_Stat; + HbComboBox* m_DriveBox; + }; +//} +#endif /* APPMGMTNOTIFIERS_H_ */ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/appmgmtprogdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/appmgmtprogdialog.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#include +#include +#include +#include +#include + +using namespace WRT; +class AppMgmtProgDialog : public QObject + { + Q_OBJECT + +public: + AppMgmtProgDialog(QString aAppData, Download &mdl,int &aUserCancelled); + ~AppMgmtProgDialog(); + void startDialog(int aContentSize,int aDownloaded); + void closeAMProgDialog(); + void updateProgress(int aProgress); +public slots: + void hideAMProgDialog(); + void cancelDialog(); +private: + void sendServerToBackground(); +private: + int iContentSize; + int mUsrCancel; + Download* iDl; + QString m_Data; + HbProgressDialog* m_Dlg; + QString m_Name; + QString m_SizeStr; + HbIndicator* m_Indi; + }; diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/nsmldmiapmatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/nsmldmiapmatcher.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,116 @@ +/* + * 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 Tree module + * + */ + +#ifndef __NSMLDMIAPMATCHER_H__ +#define __NSMLDMIAPMATCHER_H__ + +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include "nsmldmuri.h" + +//CLASS FORWARDS +class MSmlDmCallback; + +_LIT8( KNSmlDMIAPUri, "AP" ); +_LIT8( KNSmlDMSeparator8, "/" ); +_LIT8( KNSmlDMIAPUriDotSlash, "./" ); + +const TUint8 KNSmlDMSlash = 0x2f; //forward slash +/** + * CNSmlDMIAPMatcher contains services for generating URI from IAPId and + * vice versa in DM plug-in adapters. The class needs the working + * MSmlDmCallback callback interface for operating, so ths can be used only + * by DM plug-in adapters + * + * @since + */ +class CNSmlDMIAPMatcher : public CBase + { +public: + /** + * Destructor + */ + ~CNSmlDMIAPMatcher(); + + /** + * Two-phased constructor + * @param aDmCallback Pointer to callback interface + * @return Pointer to newly created module instance + */ + static CNSmlDMIAPMatcher* NewL(MSmlDmCallback* aDmCallback); + + /** + * Two-phased constructor, pushes pointer to cleanup stack. + * @param aDmCallback Pointer to callback interface + * @return Pointer to newly created module instance + */ + static CNSmlDMIAPMatcher* NewLC(MSmlDmCallback* aDmCallback); + + /** + * Gets the IAP id which corresponds to given URI + * @param aURI Accespoint URI + * @return Accespoint id in AP database + */ + TInt IAPIdFromURIL(const TDesC8& aURI); + + /** + * Generates the URI which corresponds to given IAP Id + * @param aIAPId Accespoint Id + * @return Accesspoint URI in DM + */ + HBufC8* URIFromIAPIdL(TInt aIAPId); + +private: + /** + * Second phase constructor + * @param aDmCallback Pointer to callback interface + */ + void ConstructL(MSmlDmCallback* aDmCallback); + + /** + * Changes the given descriptor to Integer + * @param aLuid Luid in descriptor format + * @return Luid in TInt type + */ + TInt DesToInt(const TDesC8& aLuid); + + /** + * Return the URI without ./ at the beginning, if those exist + * @param aURI Uri + * @return Uri without ./ + */ + TPtrC8 RemoveDotSlash(const TDesC8& aURI) const; + + /** + * Return the last uri segment of the aURI + * @param aURI Uri + * @return The last uri segment + */ + TPtrC8 LastURISeg(const TDesC8& aURI) const; + +private: + + /** + * Pointer to callback interface + */ + MSmlDmCallback* iCallback; + + }; + +#endif // __NSMLDMIAPMATCHER_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/inc/nsmldmuri.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/inc/nsmldmuri.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,45 @@ +/* + * 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 __NSMLDMURI_H +#define __NSMLDMURI_H + +#include +#include + +#define KNSmlDMUriSeparator '/' +_LIT8(KNSmlDmRootUri, "."); +_LIT8(KNSmlDmUriDotSlash, "./"); +_LIT8( KNSmlDmQuestionMark, "?" ); + +// =========================================================================== +// NSmlDmURI +// =========================================================================== +class NSmlDmURI + { +public: + static TPtrC8 ParentURI(const TDesC8& aURI); + static TPtrC8 LastURISeg(const TDesC8& aURI); + static TPtrC8 RemoveDotSlash(const TDesC8& aURI); + static TPtrC8 RemoveProp(const TDesC8& aURI); + static TPtrC8 RemoveLastSeg(const TDesC8& aURI); + static TPtrC8 + URISeg(const TDesC8& aURI, TInt aLocation, TInt aSegCount=1); + static TInt NumOfURISegs(const TDesC8& aURI); + }; + +#endif // __NSMLDMURI_H diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/server.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/server.pro Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,141 @@ +# +# 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: Implementation of applicationmanagement components + # + # + +symbian: { + SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + :BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + :BLD_INF_RULES.prj_exports += "./src/200267FB.SPD /epoc32/release/armv5/udeb/z/private/100012a5/policy/200267FB.SPD" + :BLD_INF_RULES.prj_exports += "./src/200267FB.SPD /epoc32/release/armv5/urel/z/private/100012a5/policy/200267FB.SPD" + :BLD_INF_RULES.prj_exports += "./src/200267FB.SPD /epoc32/release/winscw/udeb/z/private/100012a5/policy/200267FB.SPD" + :BLD_INF_RULES.prj_exports += "./src/200267FB.SPD /epoc32/release/winscw/urel/z/private/100012a5/policy/200267FB.SPD" + :BLD_INF_RULES.prj_exports += "./src/200267FB.SPD /epoc32/data/z/private/100012a5/policy/200267FB.SPD" + :BLD_INF_RULES.prj_exports += "./group/200267FB.txt /epoc32/data/z/private/10202be9/200267FB.txt" + TARGET.UID2 = 0x100039CE + TARGET.UID3 = 0x200267FB + TARGET.CAPABILITY = CAP_SERVER \ + TrustedUI \ + AllFiles \ + NetworkControl + LIBS += -lWrtDownloadMgr \ + -lwrtserviceipcclient \ + -leuser \ + -ldrmhelper \ + -ldrmlicensemanager \ + -ledbms \ + -lsysutil \ + -lefsrv \ + -lesock \ + -lbafl \ + -lcentralrepository \ + -lestor \ + -lsisregistryclient \ + -laminstalloptions \ + -limut \ + -lswinstcli \ + -lezip \ + -lplatformenv \ + -lecom \ + -lcaf \ + -lnsmldmtreedbhandler \ + -lsyncmlclientapi \ + -lnsmldmmodule \ + -lnsmldmtreedbclient \ + -lconnmon \ + -lcommonengine \ + -lnsmltransporthandler \ + -lnsmltransport \ + -lcone \ + -ljavaregistryclient \ + -lapparc \ + -lfeatmgr \ + -lpolicyengine \ + -lflogger \ + -lapengine \ + -lcommdb \ + -lapgrfx \ + -lws32 \ + -lapmime \ + -lsif +} +TEMPLATE = app +TARGET = applicationmanagementserver +DEPENDPATH += ./inc +INCLUDEPATH += . \ + ../inc \ + ../options/inc \ + ../installer/inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE \ + /epoc32/include/mw/cwrt \ + /epoc32/include/devman \ + /epoc32/include/platform/mw/swi \ + /epoc32/include/swi \ + /epoc32/include/ecom \ + /epoc32/include/mw/usif \ + /epoc32/include/platform/mw/cwrt +CONFIG += hb +RESOURCES += ./conf/applicationmanagement.qrc + +SERVICE.OPTIONS = embeddable +SERVICE.OPTIONS += hidden + +# Input +HEADERS +=./inc/amview.h \ + ./inc/amwaitprogdialog.h \ + ./inc/ServicePluginLogger.h \ + ./inc/AMDownloadStore.h \ + ./inc/ServicePluginLogger.h \ + ./inc/AMAppHideUtil.h \ + ./inc/AMDeploymentComponent.h \ + ./inc/amdeploymentcomponent.inl \ + ./inc/amdeploymentcomponentdata.h \ + ./inc/AMDownloaddb.h \ + ./inc/AMPreInstallApp.h \ + ./inc/amsmlhelper.h \ + ./inc/amstorage.h \ + ./inc/ApplicationManagementJavaUtility.h \ + ./inc/ApplicationManagementServer.h \ + ./inc/ApplicationManagementUtility.h \ + ./inc/ApplicationManagementUtilityFactory.h \ + ./inc/nsmldmiapmatcher.h \ + ./inc/appmgmtdownloadmgr.h \ + ./inc/nsmldmuri.h \ + ./inc/ServicePluginLogger.h \ + ./inc/appmgmtprogdialog.h \ + ./inc/PlatformSecurityPolicies.h \ + ./inc/AMDownloadStore.h \ + ./inc/appmgmtnotifier.h +SOURCES += ./src/amview.cpp \ + ./src/amwaitprogdialog.cpp \ + ./src/AMAppHideUtil.cpp \ + ./src/AMDeploymentComponent.cpp \ + ./src/amdeploymentcomponentdata.cpp \ + ./src/AMDownloaddb.cpp \ + ./src/AMPreInstallApp.cpp \ + ./src/amsmlhelper.cpp \ + ./src/amstorage.cpp \ + ./src/ApplicationManagementJavaUtility.cpp \ + ./src/ApplicationManagementServer.cpp \ + ./src/ApplicationManagementUtility.cpp \ + ./src/ApplicationManagementUtilityFactory.cpp \ + ./src/nsmldmiapmatcher.cpp \ + ./src/appmgmtdownloadmgr.cpp \ + ./src/nsmldmuri.cpp \ + ./src/appmgmtprogdialog.cpp \ + ./src/AMDownloadStore.cpp \ + ./src/main.cpp \ + ./src/appmgmtnotifier.cpp diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/1020781C.SPD Binary file applicationmanagement/server/src/1020781C.SPD has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/1020781C.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/1020781C.txt Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,10 @@ +[database] +read +capability = ReadDeviceData +write +capability = WriteDeviceData +schema +capability = WriteDeviceData + +[backup] +SID = 101F8597 diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/200267FB.SPD Binary file applicationmanagement/server/src/200267FB.SPD has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/AMAppHideUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/AMAppHideUtil.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,214 @@ +/* + * 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: Implementation of applicationmanagement components + * + */ + +#include +#include "AMAppHideUtil.h" +#include "debug.h" + +using namespace NApplicationManagement; + +// The uid list delimiter +static const TChar KUidDelimiter = ','; + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::CAMAppHideUtil() +// ----------------------------------------------------------------------------- +CAMAppHideUtil::CAMAppHideUtil() : + iChanged(EFalse) + { + + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::ConstructL() +// ----------------------------------------------------------------------------- +void CAMAppHideUtil::ConstructL() + { + LoadUidsL(); + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::~CAMAppHideUtil() +// ----------------------------------------------------------------------------- +CAMAppHideUtil::~CAMAppHideUtil() + { + iHiddenUids.Close(); + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::NewL() +// ----------------------------------------------------------------------------- +CAMAppHideUtil* CAMAppHideUtil::NewL() + { + CAMAppHideUtil *me = new ( ELeave ) CAMAppHideUtil(); + CleanupStack::PushL(me); + me->ConstructL(); + CleanupStack::Pop(me); + return me; + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::AddUidL(const TUid& aUid ) +// ----------------------------------------------------------------------------- +void CAMAppHideUtil::AddUidL(const TUid& aUid, TBool aPersist /*= EFalse */) + { + TInt idx(iHiddenUids.Find(aUid)); + if (idx == KErrNotFound) + { + TInt err(iHiddenUids.Append(aUid) ); + if (err == KErrNone) + { + iChanged = ETrue; + if (aPersist) + { + PersistUidsL(); + } + } + else + { + RDEBUG_2( "Failed to append uid to hidden list: %d", err ); + } + } + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::RemoveUidL( const TUid& aUid ) +// ----------------------------------------------------------------------------- +void CAMAppHideUtil::RemoveUidL(const TUid& aUid, TBool aPersist /*= EFalse */) + { + TInt idx(iHiddenUids.Find(aUid)); + if (idx != KErrNotFound) + { + iHiddenUids.Remove(idx); + iChanged = ETrue; + if (aPersist) + { + PersistUidsL(); + } + } + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::PersistUid( const TUid &aUid, TDes &aBuf, TBool aHasMore ) +// ----------------------------------------------------------------------------- +void CAMAppHideUtil::PersistUid(const TUid &aUid, TDes &aBuf, TBool aHasMore) const + { + aBuf.AppendNumFixedWidth(aUid.iUid, EHex, 8); + if (aHasMore) + { + aBuf.Append(KUidDelimiter); + } + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::PersistUidsL() +// ----------------------------------------------------------------------------- +void CAMAppHideUtil::PersistUidsL() + { + TInt err = KErrNone; + if (iChanged) + { + TBuf buf; + RDEBUG_2( "PersistUids: count %d", iHiddenUids.Count() ); + for (TInt i(iHiddenUids.Count() - 1); i >= 0; --i) + { + RDEBUG_3( "PersistUids: cur %d %x", i,iHiddenUids[i].iUid ); + PersistUid(iHiddenUids[i], buf, i > 0) ; + } + /*CRepository *rep = CRepository::NewLC(KCRUidMenu); + TInt err(rep->Set(KMenuHideApplication, buf) ); + CleanupStack::PopAndDestroy(rep);*/ + if (err != KErrNone) + { + RDEBUG_2( "PersistUids: ERROR failed to set key: %d", err ); + User::Leave(err); + } + RDEBUG_2( "CAMAppHideUtil::PersistUidsL - Saved '%S'", &buf); + iChanged = EFalse; + } + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::ParseUid( TLex &, TUid &aUid ) +// ----------------------------------------------------------------------------- +TInt CAMAppHideUtil::ParseUid(TLex &aLex, TUid &aUid) const + { + aUid = TUid::Null(); + aLex.Mark(); + while (aLex.Peek().IsHexDigit() ) + { + aLex.Inc(); + } + TPtrC uidToken = aLex.MarkedToken(); + TLex uidLex(uidToken); + TInt err(uidLex.Val( (TUint32& )aUid.iUid, EHex) ); + return err; + } + +// ------------------------------------------------------------------------------ +// CAMAppHideUtil::SkipDelim( TLex & ) +// ----------------------------------------------------------------------------- +TBool CAMAppHideUtil::SkipDelim(TLex &aLex) const + { + TBool ret(EFalse); + if (aLex.Peek() == KUidDelimiter) + { + aLex.Inc(); + ret = ETrue; + } + return (ret ); + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::LoadUidsL() +// ----------------------------------------------------------------------------- +void CAMAppHideUtil::LoadUidsL() + { + TInt err = KErrNone; + TBuf buf; + /*CRepository *rep = CRepository::NewLC(KCRUidMenu); + TBuf buf; + TInt err(rep->Get(KMenuHideApplication, buf) ); + CleanupStack::PopAndDestroy(rep);*/ + if (err == KErrNone) + { + RDEBUG_2( "CAMAppHideUtil::LoadUidsL - Loading '%S'", &buf); + TLex lex(buf); + TUid aUid(TUid::Null()); + do + { + err = ParseUid(lex, aUid) ; + } + while (err == KErrNone && iHiddenUids.Append(aUid) == KErrNone + && !lex.Eos() && SkipDelim(lex) ); + } + RDEBUG_2( "CAMAppHideUtil::LoadUidsL-Loaded (last parsing status: %d)", err); + } + +// ----------------------------------------------------------------------------- +// CAMAppHideUtil::Reset() +// ----------------------------------------------------------------------------- +void CAMAppHideUtil::Reset() + { + if (iHiddenUids.Count() > 0) + { + iChanged = ETrue; + } + iHiddenUids.Reset(); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/AMDeploymentComponent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/AMDeploymentComponent.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,885 @@ +/* + * 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: Implementation of applicationmanagement components + * + */ + +#include +#include +#include +#include +#include +#include +#include +#ifdef __SERIES60_30__ +#include +#endif +#include "amsmlhelper.h" +#include "amprivateCRKeys.h" +#include "AMDeploymentComponent.h" +#include "debug.h" + + +using namespace NApplicationManagement; + +_LIT8( KAMDCDataSuffix, "_D.txt"); +_LIT8( KAMDCMetaDataSuffix, "_M.txt"); + + +/*************************************************** + // CDeploymentComponent + ***************************************************/ + +CDeploymentComponent* CDeploymentComponent::NewLC(TInt aInternalId, + const TDCUserId &aUserId) + { + CDeploymentComponent *self = new ( ELeave ) CDeploymentComponent( aInternalId ); + CleanupStack::PushL(self) ; + self->ConstructL(aUserId) ; + return self; + } + +CDeploymentComponent* CDeploymentComponent::NewL(TInt aInternalId, + const TDCUserId &aUserId) + { + CDeploymentComponent *self = NewLC(aInternalId, aUserId); + CleanupStack::Pop(self) ; + return self; + } + +CDeploymentComponent* CDeploymentComponent::LoadLC(TInt aInternalId, + const TDesC8 &aBuffer) + { + CDeploymentComponent *self = new ( ELeave ) CDeploymentComponent(aInternalId); + CleanupStack::PushL(self) ; + self->ConstructLoadL(aBuffer) ; + return self; + } + +CDeploymentComponent* CDeploymentComponent::LoadL(TInt aInternalId, + const TDesC8 &aBuffer) + { + CDeploymentComponent *self = LoadLC(aInternalId, aBuffer); + CleanupStack::Pop(self) ; + return self; + } + +CDeploymentComponent::CDeploymentComponent(TInt aInternalId) : +iInternalId(aInternalId), iPkgVersion( 3), iOwner( -1), +iOwnerProfile( -1) + { + iUninstallOpts.iKillApp = SwiUI::EPolicyAllowed; + SwiUI::TInstallOptions &opts = iInstallOpts.iOptions; + opts.iUpgrade = SwiUI::EPolicyNotAllowed; + opts.iOptionalItems = SwiUI::EPolicyNotAllowed; + opts.iOCSP = SwiUI::EPolicyNotAllowed; + opts.iIgnoreOCSPWarnings = SwiUI::EPolicyNotAllowed; + // iIgnoreOtherWarnings = SwiUI::EPolicyNotAllowed; + opts.iUntrusted = SwiUI::EPolicyNotAllowed; + opts.iPackageInfo = SwiUI::EPolicyNotAllowed; + opts.iCapabilities = SwiUI::EPolicyNotAllowed; + opts.iKillApp = SwiUI::EPolicyNotAllowed; + opts.iOverwrite = SwiUI::EPolicyNotAllowed; + opts.iDownload = SwiUI::EPolicyNotAllowed; + opts.iDrive = SwiUI::EPolicyNotAllowed; + opts.iLang = ELangNone; + opts.iUsePhoneLang = EFalse; + } + +CDeploymentComponent::~CDeploymentComponent() + { + RDEBUG8_3( "CDeploymentComponent::~CDeploymentComponent 0x%X - 0x%X", + reinterpret_cast(this), reinterpret_cast(this)+sizeof( CDeploymentComponent ) ); + delete iData; + iData = NULL; + + delete iMetaData; + iMetaData = NULL; + } + +CDeploymentComponent &CDeploymentComponent::operator=( const CDeploymentComponent &aData ) + { + if( &aData != this ) + { + *iData = aData.Data(); + *iMetaData = aData.MetaData(); + iId = aData.ComponentId(); + iName = aData.ComponentName(); + iVersion = aData.iVersion; + iState = aData.State(); + iInternalId = aData.InternalId(); + iUid = aData.Uid(); + iUserId = aData.iUserId; + iOwner = aData.iOwner; + iInstallOpts = aData.InstallOpts(); + iPkgID = aData.PkgId(); + iDescription = aData.Description(); + iPkgIDRef = aData.PkgIDRef(); + iPkgType = aData.PkgType(); + iRemovableApp = aData.AppRemovable(); + iDriveSelection = aData.DriveSelected(); + iComponentId = aData.iComponentId; + iInstallOptsSet = aData.InstallOptsSet(); + iPkgVersion = aData.iPkgVersion; + iDownloadStatus = aData.iDownloadStatus; + iDownloadURI = aData.iDownloadURI; + iUninstallOpts = aData.UninstallOpts(); + iOwnerProfile = aData.OwnerProfile(); + } + return *this; + } + +void CDeploymentComponent::PersistL(CRepository &aRepository) const + { + CBufBase *buf = CBufFlat::NewL( 32); + CleanupStack::PushL(buf); + TInt length(SerializedFormLength() ); + buf->ExpandL(0, length+1); + TPtr8 p3(buf->Ptr(0) ); + RDesWriteStream stream(p3); + TInt len(SerializedFormL(stream) ); + TBuf8< NCentralRepositoryConstants::KMaxBinaryLength> tbuf; + + TInt err(aRepository.Get(iInternalId, tbuf) ); + if (err == KErrNotFound) + { + err = aRepository.Create(iInternalId, buf->Ptr(0) ); + RDEBUG_3( "CDeploymentComponent::PersistL: Created %d to centrep with status %d", iInternalId, err ); + } + else + { + User::LeaveIfError(err) ; + err = aRepository.Set(iInternalId, buf->Ptr(0) ); + RDEBUG_3( "CDeploymentComponent::PersistL: Persisted %d to centrep with status %d", iInternalId, err ); + } + User::LeaveIfError(err) ; + CleanupStack::PopAndDestroy(buf); + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); + iData->PersistL(fs); + iMetaData->PersistL(fs); + CleanupStack::PopAndDestroy( &fs) ; + } + +void CDeploymentComponent::CopyStateTo(TDeploymentComponent &aInfo) const + { + aInfo.iId = iId; + aInfo.iName = iName; + aInfo.iVersion = iVersion; + aInfo.iDescription = iDescription; + aInfo.iPkgID = iPkgID; + aInfo.iPkgIDRef = iPkgIDRef; + aInfo.iPkgType = iPkgType; + aInfo.iState = iState; + aInfo.iOldState = iOldState; + } + +TBool CDeploymentComponent::IsJavaMimeL(const TDesC8& aMime) + { + + FeatureManager::InitializeLibL(); + TBool supported = EFalse; + + if (FeatureManager::FeatureSupported(KFeatureIdJavaMIDP20) ) + { + supported = ((aMime == SwiUI::KJarMIMEType || aMime + == SwiUI::KJadMIMEType || aMime == SwiUI::KJarxMIMEType + || aMime == SwiUI::KJavaMIMEType) ? ETrue : EFalse ); + } + FeatureManager::UnInitializeLib(); + + return supported; + } + +TBool CDeploymentComponent::IsSisMimeL(const TDesC8& aMime) + { + + + TBool supported = EFalse; + + supported = ((aMime == SwiUI::KSisxMimeType || aMime + == SwiUI::KSisMimeType || aMime == SwiUI::KPipMimeType) ? ETrue : EFalse ); + + return supported; + } + +void CDeploymentComponent::ConstructL(const TDCUserId &aUserId) + { + iUserId = aUserId; + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); + TInt e(fs.CreatePrivatePath(KDefaultDrive) ); + User::LeaveIfError(e); + TBuf<30> privatePath; + fs.PrivatePath(privatePath); + CleanupStack::PopAndDestroy( &fs); + + TInt privPathLength(privatePath.Length() ); + TBuf8<10> buf; + buf.NumFixedWidth(iInternalId, EHex, 10); + + TBuf8 <30> path; + path.Copy(privatePath); + HBufC8 *afilename = HBufC8::NewLC(privPathLength + 10 + KAMDCDataSuffix().Length()); + *afilename = path; + TPtr8 afn(afilename->Des() ); + afn.Append(buf); + afn.Append(KAMDCDataSuffix) ; + iData = CDeploymentComponentData::NewL(CDeploymentComponentData::EData, + KNullDesC8, KNullDesC8, afn); + + afn.Replace(privPathLength + 10, KAMDCMetaDataSuffix().Length(), KAMDCMetaDataSuffix); + iMetaData = CDeploymentComponentData::NewL( + CDeploymentComponentData::EMetaData, KNullDesC8, KNullDesC8, afn); + + CleanupStack::PopAndDestroy(afilename); + } + +TInt CDeploymentComponent::SerializedFormLength() const + { + // 0 1 2 3 4 5 6 7 8 9 10 11 + // iUserId , iState, iPkgVer, iUid, iIdLen, iNameLen, iVersLen, iDownState, iOwner, iOldState ,iDownUriLen, iInstallOptsset + return (20*4)+iUserId.Length() + iId.Length() + iName.Length() + + iVersion.Length() + + + iMidletName.Length() + iMideltVendorName.Length() + + iMidletVersion.Length()+ iDownloadURI.Length() + + iDescription.Length()+ iPkgID.Length()+iPkgIDRef.Length() + +iPkgType.Length()+ sizeof(iRemovableApp)+sizeof(iDriveSelection)+sizeof(iComponentId) + iData->SerializedFormLength() + + iMetaData->SerializedFormLength() + sizeof(TAMInstallOptions); + } + +TInt CDeploymentComponent::SerializedFormL(RWriteStream &aBuffer) const + { +#ifdef _DEBUG + RDEBUG_2( "Offset before uint: %d", aBuffer.Sink()->TellL( MStreamBuf::EWrite ).Offset() ); +#endif + + aBuffer.WriteUint32L(iPkgVersion); + +#ifdef _DEBUG + RDEBUG_2( "Offset after uint: %d" , aBuffer.Sink()->TellL( MStreamBuf::EWrite ).Offset() ); +#endif + + aBuffer.WriteUint32L(iState); + aBuffer.WriteUint32L(iStatus); + aBuffer.WriteUint32L(iUid.iUid); + aBuffer.WriteUint32L(iUserId.Length() ); + aBuffer.WriteL(iUserId); + aBuffer.WriteUint32L(iId.Length() ); + aBuffer.WriteL(iId); + aBuffer.WriteUint32L(iName.Length() ); + aBuffer.WriteL(iName); + aBuffer.WriteUint32L(iVersion.Length() ); + aBuffer.WriteL(iVersion); + aBuffer.WriteUint32L(iMidletName.Length() ); + aBuffer.WriteL(iMidletName); + aBuffer.WriteUint32L(iMideltVendorName.Length() ); + aBuffer.WriteL(iMideltVendorName); + aBuffer.WriteUint32L(iMidletVersion.Length() ); + aBuffer.WriteL(iMidletVersion); + aBuffer.WriteInt32L(iDownloadStatus); + aBuffer.WriteInt32L(iOwner); + aBuffer.WriteUint32L(iOldState); + aBuffer.WriteUint32L(iDownloadURI.Length() ); + aBuffer.WriteL(iDownloadURI); + aBuffer.WriteUint32L(iDescription.Length() ); + aBuffer.WriteL(iDescription); + aBuffer.WriteUint32L(iPkgID.Length() ); + aBuffer.WriteL(iPkgID); + aBuffer.WriteUint32L(iPkgIDRef.Length() ); + aBuffer.WriteL(iPkgIDRef); + aBuffer.WriteUint32L(iPkgType.Length() ); + aBuffer.WriteL(iPkgType); + aBuffer.WriteUint32L(iRemovableApp); + aBuffer.WriteUint32L(iDriveSelection); + aBuffer.WriteInt32L(iComponentId); + iData->SerializedFormL(aBuffer); + iMetaData->SerializedFormL(aBuffer); + aBuffer.WriteUint32L(iInstallOptsSet); + TPckg opts(iInstallOpts); + aBuffer.WriteL(opts); + return aBuffer.Sink()->TellL( MStreamBuf::EWrite ).Offset(); + } + +void CDeploymentComponent::ConstructLoadL(const TDesC8 &aBuffer) + { + RDEBUG( "CDeploymentComponent::ConstructLoadL "); + TDeploymentComponent aRes; + TMimeType aType; + + RDesReadStream stream(aBuffer); + iPkgVersion = stream.ReadUint32L(); + + iState = static_cast(stream.ReadUint32L() ); + iStatus = static_cast(stream.ReadUint32L() ); + iUid.iUid = stream.ReadUint32L(); + + TUint32 len(stream.ReadUint32L() ); + stream.ReadL(iUserId, len); + + len = stream.ReadUint32L(); + stream.ReadL(iId, len); + + len = stream.ReadUint32L(); + stream.ReadL(iName, len); + + len = stream.ReadUint32L(); + stream.ReadL(iVersion, len); + + len = stream.ReadUint32L(); + stream.ReadL(iMidletName, len); + + len = stream.ReadUint32L(); + stream.ReadL(iMideltVendorName, len); + + len = stream.ReadUint32L(); + stream.ReadL(iMidletVersion, len); + + iDownloadStatus = stream.ReadInt32L(); + + if (iPkgVersion > 1) + { + iOwner = stream.ReadInt32L(); + } + if (iPkgVersion > 2) + { + iOldState = TDeploymentComponentState(stream.ReadUint32L() ); + } + + len = stream.ReadUint32L() ; + stream.ReadL(iDownloadURI, len); + + len = stream.ReadUint32L(); + stream.ReadL(iDescription, len); + + len = stream.ReadUint32L(); + stream.ReadL(iPkgID, len); + + len = stream.ReadUint32L(); + stream.ReadL(iPkgIDRef, len); + + len = stream.ReadUint32L(); + stream.ReadL(iPkgType, len); + + iRemovableApp = stream.ReadUint32L(); + iDriveSelection = stream.ReadUint32L(); + iComponentId = stream.ReadInt32L(); + iData = CDeploymentComponentData::LoadL(stream); + iMetaData = CDeploymentComponentData::LoadL(stream); + + //using namespace SwiUI; + iInstallOptsSet = stream.ReadUint32L(); + TAMInstallOptionsPckg opts(iInstallOpts); + stream.ReadL(opts, opts.Length() ); + RDEBUG( "CDeploymentComponent::ConstructLoadL end"); + } + +CDeploymentComponentData &CDeploymentComponent::Data() + { + return *iData; + } + +const CDeploymentComponentData &CDeploymentComponent::Data() const + { + return *iData; + } + +CDeploymentComponentData &CDeploymentComponent::MetaData() + { + return *iMetaData; + } + +const CDeploymentComponentData &CDeploymentComponent::MetaData() const + { + return *iMetaData; + } + +const TAMInstallOptions &CDeploymentComponent::InstallOpts() const + { + return iInstallOpts; + } + +const SwiUI::TUninstallOptions &CDeploymentComponent::UninstallOpts() const + { + return iUninstallOpts; + } + +TBool CDeploymentComponent::InstallOptsSet() const + { + return iInstallOptsSet; + } + +TBool CDeploymentComponent::AppRemovable() const + { + return iRemovableApp; + } + +TBool CDeploymentComponent::DriveSelected() const + { + return iDriveSelection; + } + +TInt CDeploymentComponent::GetComponentId() const + { + return iComponentId; + } +void CDeploymentComponent::SetMetaDataL(const TDesC8 &aMimeType) + { + iMetaData->DataFileName(); + iMetaData->SetDataL(aMimeType); + } + +void CDeploymentComponent::SetMetaDataL(const TDesC8 &aMetaData, + const TDesC8 &aMimeType) + { + iMetaData->SetDataL(aMetaData, aMimeType); + } + +void CDeploymentComponent::SetAppRemovableStatus(const TBool &aRemovable) + { + iRemovableApp = aRemovable; + } + +void CDeploymentComponent::SetDriveSelectionStatus(const TBool &aDriveSelection) + { + iDriveSelection = aDriveSelection; + } + +void CDeploymentComponent::SetInstallOptsL(const TDesC8 &aInstallOpts) + { + using namespace SwiUI; + if (aInstallOpts != KNullDesC8) + { + RDEBUG8_2( "CDeploymentComponent::SetInstallOptsL: '%S'", &aInstallOpts ); + TInt tmpIAP(iInstallOpts.iIAP); + TAMInstallOptionsPckg pckg(iInstallOpts); + pckg.Copy(aInstallOpts); + iInstallOptsSet= ETrue; + + if (iInstallOpts.iIAP == -1 && tmpIAP > -1) + { + RDEBUG8_2( "CDeploymentComponent::SetInstallOptsL: using IAPid %d", tmpIAP ); + iInstallOpts.iIAP = tmpIAP; + } + } + + } + +void CDeploymentComponent::ResetDataL(RFs &aFs) + { + iData->ResetData(aFs); + iMetaData->ResetData(aFs); + } + +void CDeploymentComponent::SetAttr(TDes8 &aAttr, const TDesC8 &aNewVal) const + { + if (aNewVal.Length() > aAttr.MaxLength() ) + { + aAttr = aNewVal.Left(aAttr.MaxLength() ); + } + else + { + aAttr = aNewVal; + } + } + +void CDeploymentComponent::SetIdL(const TDesC8 &aId) + { + SetAttr(iId, aId); + } + +void CDeploymentComponent::SetNameL(const TDesC8 &aName) + { + if (iName != aName) + { + SetAttr(iName, aName); + } + } + +void CDeploymentComponent::SetVersionL(const TDesC8 &aVersion) + { + SetAttr(iVersion, aVersion); + } +void CDeploymentComponent::SetMimeTypeL( const TDesC8 &aMimeType ) +{ + iData->SetMimeTypeL(aMimeType); +} + +void CDeploymentComponent::SetDescriptionL(const TDesC8 &aDescription) + { + SetAttr(iDescription, aDescription); + } + +void CDeploymentComponent::SetPkgIDL(const TDesC8 &aPkgID) + { + // PkgID and PkgIDRef should be same and Get done on PkgID + // when state is in Download or Delivered and PkgIDRef is + // returned when state is in Deployed state + SetAttr(iPkgID, aPkgID); + SetAttr(iPkgIDRef, aPkgID); + } + +void CDeploymentComponent::SetPkgTypeL(const TDesC8 &aPkgType) + { + + SetAttr(iPkgType, aPkgType); + + } +void CDeploymentComponent::SetMidletNameL(const TDesC8 &aMidletName) + { + SetAttr(iMidletName, aMidletName); + } + +void CDeploymentComponent::SetMidletVendorL(const TDesC8 &aMidletVendor) + { + SetAttr(iMideltVendorName, aMidletVendor); + } + +void CDeploymentComponent::SetMidletVersionL(const TDesC8 &aMidletVersion) + { + SetAttr(iMidletVersion, aMidletVersion); + } + +void CDeploymentComponent::SetUid(const TUid aUid) + { + RDEBUG8_2("CDeploymentComponent::SetUid 0x%x", aUid.iUid ); + iUid = aUid; + iId.Zero(); + if (iUid != TUid::Null() ) + { + iId.AppendNumFixedWidth(iUid.iUid, EHex, 8); + } + } + +void CDeploymentComponent::SetOwnerProfile(TSmlProfileId aOwnerProfile) + { + iOwnerProfile = aOwnerProfile; + } + +TInt CDeploymentComponent::SetState(const TDeploymentComponentState &aState) + { + RDEBUG_2( "CDeploymentComponent::SetState - set to state (%d)", aState ); + + TInt ret(KErrNone); + iOldState = iState; + iState = aState; +#ifdef __SERIES60_30__ + if( iState != iOldState && iState != EDCSDownload && iState != EDCSDelivered ) + { + if ( iUid != TUid::Null() ) + { + RMenuServSession ses; + TBool visible( EFalse ); + if ( iState == EDCSActive ) + { + visible = ETrue; + } + TRAP( ret, ses.SetApplicationVisibilityL( iUid.iUid, visible ) ); + if (ret != KErrNone ) + { + RDEBUG_2( "CDeploymentComponent::SetState - failed to set visiblity %d", ret ); + } + else + { + RDEBUG_2( "CDeploymentComponent::SetState - Set visiblity to %d", visible ); + } + } + else + { + RDEBUG( "CDeploymentComponent::SetState - No need to set visibility to null uid" ); + } + + } + else + { + RDEBUG( "CDeploymentComponent::SetState - No need to change visibility " ); + } +#endif + return ret; + } + +void CDeploymentComponent::SetStatusNode( + const TSCOMOStatusNodeStates &aStatus) const + { + iStatus = aStatus; + CRepository *repository=NULL; + + TRAPD( erx, repository = CRepository::NewL ( KCRUidPrivateApplicationManagementKeys ) ) + ; + if (erx!=KErrNone) + return; + + TRAPD(err, PersistL(*repository)) + ; + + delete repository; + + if (err!=KErrNone) + return; + + } + +void CDeploymentComponent::Set(const TDeploymentComponent &aInfo) + { + iId = aInfo.iId; + iName = aInfo.iId; + iVersion = aInfo.iVersion; + iDescription = aInfo.iDescription; + iPkgID = aInfo.iPkgID; + iPkgIDRef = aInfo.iPkgIDRef; + iPkgType = aInfo.iPkgType; + } + +void CDeploymentComponent::SetDownloadURIL(const TDesC8 &aURI) + { + if (iState == EDCSDownload) + { + iDownloadURI = aURI; + } + else + { + RDEBUG_2( "CDeploymentComponent::SetDownloadURIL: ERROR Illegal state: %d", iState ); + User::Leave(KErrNotSupported) ; + } + } + +void CDeploymentComponent::SetDownloadTarget( + const TDownloadTarget& aDownloadTarget) + { + RDEBUG_2("CDeploymentComponent::SetDownloadTarget: (%d)", aDownloadTarget); + iDownloadTarget = aDownloadTarget; + } + +void CDeploymentComponent::SetDataL(const TDesC8 &aData, + const TDesC8 &aMimeType) + { + iUid = iData->SetDataL(aData, aMimeType); + iId.Zero(); + if (iUid != TUid::Null() ) + { + iId.AppendNumFixedWidth(iUid.iUid, EHex, 8); + } + } + +void CDeploymentComponent::SetDataL(const TDesC &aFileName, + const TDesC8 &aMimeType) + { + SetUid(iData->SetDataL(aFileName, aMimeType) ); + } + +void CDeploymentComponent::SetDataL(const TDesC8 &aMimeType) + { + SetUid(iData->SetDataL(aMimeType) ); + } + +// ---------------------------------------------------------------------------------------- +// CDeploymentComponent::StatusUpdateL +// ---------------------------------------------------------------------------------------- +void CDeploymentComponent::StatusUpdateL(TInt aNewStatus) + { + RDEBUG( "CDeploymentComponent::StatusUpdateL : begin"); + RDEBUG_2( "CDeploymentComponent::StatusUpdateL %d", aNewStatus ); + + if (State() == EDCSDownload) + { + iDownloadStatus = aNewStatus; + RDEBUG_2( "CDeploymentComponent::StatusUpdate: Set status to: %d", iDownloadStatus ); + + if (DownloadFailed() ) + { + SetStatusNode(EDownload_DownloadFailed); + RDEBUG8_2( "CDeploymentComponent::StatusUpdate: ERROR Failed to download URI: '%S' ", &iDownloadURI ); + } + + if (iCallback) + { + iCallback->DownloadComplete( this, iDownloadStatus); + } + } + else + { + RDEBUG_2( "CDeploymentComponent::StatusUpdate: ERROR Illegal state: %d", State() ); + } + RDEBUG( "CDeploymentComponent::StatusUpdateL : end"); + } + +// ---------------------------------------------------------------------------------------- +// CDeploymentComponent::SuccessStatusUpdateL +// ---------------------------------------------------------------------------------------- +void CDeploymentComponent::SuccessStatusUpdateL(const TDesC &aDlFileName, + const TDesC8& aDlMimeType) + { + RDEBUG( "CDeploymentComponent::SuccessStatusUpdateL : start"); + + + + TBuf<256> FileType; + TBuf8<256> FileType8; + + RApaLsSession RSession; + if(RSession.Connect() == KErrNone) + { + TUid uid; + TDataType datatype; + RSession.AppForDocument(aDlFileName,uid, datatype ); + + FileType.Copy(datatype.Des()); + RDEBUG_2( "CDeploymentComponent::Pkg Id: %d ", uid.iUid); + RDEBUG_2( "CDeploymentComponent::Pkg MIME: '%S' ", &FileType); + } + RSession.Close(); + + FileType8.Copy(FileType); + + SetDataL(aDlFileName, FileType8); + + + + //SetDataL(FileType8); + + RDEBUG8_2( "CDeploymentComponent::Pkg MIME: '%S' ", &FileType8); + + + // Set PkgID same as MiME type of downloaded content + SetPkgTypeL(FileType8); + + CDeploymentComponent* conflict( NULL); + TBool dlOk(ETrue); + if (iUid != TUid::Null() ) + { + __ASSERT_DEBUG( iCallback, User::Invariant() ); + if (iCallback->UidExistsL(iUid, conflict, this) ) + { + } + } + else + { + RDEBUG( "CDeploymentComponent::StatusUpdateL - WARNING cannot detect uid" ); + if (IsJavaMimeL(FileType8) ||IsSisMimeL(FileType8) ) + { + RDEBUG( "CDeploymentComponent::StatusUpdateL - Ignoring prev warning because it's java" ); + } + else + { + dlOk = EFalse; + //The Operation has been rejected because the device does not support this MIME type. + iDownloadStatus = KStatusUnSupportedEnvironment; + } + } + + if (dlOk) + { + /*for Predefined static node, append static node name with Internal ID before + * moving to delivered state to avoid duplicates + */ + TBuf8<256> staticnode; + TInt staticnodeenabled = 0; + CRepository* cenrep = CRepository::NewLC( KCRUidPrivateApplicationManagementKeys ); + cenrep->Get( KAMDownloadPredefinedNode, staticnode ); + cenrep->Get( KAMStaticNodeEnabled, staticnodeenabled ); + CleanupStack::PopAndDestroy(); //cenrep + if (iUserId.Compare(staticnode) == 0 && staticnodeenabled) + { + iUserId.Append(*IntToDes8LC(iInternalId)); + CleanupStack::PopAndDestroy(); // for IntToDes8LC() + } + + //Reset the value of DownloadStatus for success update + iDownloadStatus = 0; + + SetState(EDCSDelivered); + SetStatusNode(EIdle); + } + + if (iCallback) + { + iCallback->DownloadComplete( this, iDownloadStatus); + } + + RDEBUG( "CDeploymentComponent::SuccessStatusUpdateL : end"); + } + +const TSmlProfileId& CDeploymentComponent::OwnerProfile() const + { + return iOwnerProfile; + } + +const TDesC8& CDeploymentComponent::MimeType() const + { + if (iMetaData->MimeType().Length() ) + { + return iMetaData->MimeType(); + } + return iData->MimeType(); + } + +TBool CDeploymentComponent::DownloadFailed() const // http or symbian error + { + return (iDownloadStatus >= 400 || iDownloadStatus < 0) ? ETrue : EFalse; + } + +TInt CDeploymentComponent::DownloadStatus() const + { + return iDownloadStatus; + } + +void CDeploymentComponent::DestroyL(CRepository &aRepository) + { + TDeploymentComponentState st(State() ); + if ( !(st == EDCSActive || st == EDCSInactive)) + { + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); + iMetaData->DestroyL(fs); + iData->DestroyL(fs); + CleanupStack::PopAndDestroy( &fs) ;// fs + } + + TInt err(aRepository.Delete(iInternalId) ); + RDEBUG_3( "CDeploymentComponent::DestroyL: Deleting %d in centrep resulted with status %d", iInternalId, err ); + } + +void CDeploymentComponent::SetOwner(const TInt &aInfo) + { + iOwner = aInfo; + } + +void CDeploymentComponent::SetComponentId(const TInt &aComponentId) + { + iComponentId = aComponentId; + } + +void CDeploymentComponent::SetIAPL(const TInt aIap) + { + RDEBUG8_2( "CDeploymentComponent::SetIAPL: %d ", aIap ); + iInstallOpts.iIAP = aIap; + } + +TInt CDeploymentComponent::GetIAP() const + { + return iInstallOpts.iIAP; + } +HBufC8* CDeploymentComponent::IntToDes8LC(const TInt aLuid) + { + HBufC8* buf = HBufC8::NewLC( 10); //10 = max length of 32bit integer + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + return buf; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/AMDeploymentComponentData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/AMDeploymentComponentData.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,567 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#include +#include +#include +#include +#include "amdeploymentcomponentdata.h" +#include "debug.h" + +_LIT8( KSisxMimeType, "x-epoc/x-sisx-app" ); +_LIT( KTempDir, "piptemp\\" ); +_LIT8( KPipMimeType, "application/x-pip" ); +_LIT8( KDrmMessageMimeType, "application/vnd.oma.drm.message" ); +_LIT8( KDrmContentMimeType, "application/vnd.oma.drm.content" ); +_LIT8( KSisMimeType, "application/vnd.symbian.install"); +_LIT8( KJadMIMEType, "text/vnd.sun.j2me.app-descriptor" ); +_LIT8( KJarMIMEType, "application/java-archive" ); +_LIT8( KJavaMIMEType, "application/java" ); + +using namespace NApplicationManagement; + +/** + * Data class to Data access + */ +CDeploymentComponentData::CDeploymentComponentData() + { + } + +CDeploymentComponentData::CDeploymentComponentData(TType aType, + const TDesC8 &aDataFile) : + iDataFileName(aDataFile), iType(aType) + { + } + +void CDeploymentComponentData::ConstructL(const TDesC8 &aData, + const TDesC8 &aMime) + { + SetDataL(aData, aMime); + } + +CDeploymentComponentData &CDeploymentComponentData::operator=( + const CDeploymentComponentData &aData ) + { + if( &aData != this ) + { + SetDataL( aData.Data(), aData.MimeType() ); + iType = aData.iType; + iDataFileName = aData.iDataFileName; + } + return *this; + } + +void CDeploymentComponentData::ConstructLoadL(RReadStream &aStream) + { + TUint32 len(aStream.ReadUint32L() ); + aStream.ReadL(iDataFileName, len); + + len = aStream.ReadUint32L(); + aStream.ReadL(iMimeType, len); + } + +CDeploymentComponentData* CDeploymentComponentData::NewL(TType aType, + const TDesC8 &aData, const TDesC8 &aMime, const TDesC8 &aDataFile) + { + CDeploymentComponentData *self = CDeploymentComponentData::NewLC(aType, + aData, aMime, aDataFile); + CleanupStack::Pop(); + return self; + } + +CDeploymentComponentData* CDeploymentComponentData::NewLC(TType aType, + const TDesC8 &aData, const TDesC8 &aMime, const TDesC8 &aDataFile) + { + CDeploymentComponentData *self = new ( ELeave ) CDeploymentComponentData( aType, aDataFile); + CleanupStack::PushL(self) ; + self->ConstructL(aData, aMime); + return self; + } + +CDeploymentComponentData* CDeploymentComponentData::LoadL( + RReadStream &aBuffer) + { + CDeploymentComponentData *self = + CDeploymentComponentData::LoadLC(aBuffer); + CleanupStack::Pop(); + return self; + } + +CDeploymentComponentData* CDeploymentComponentData::LoadLC( + RReadStream &aBuffer) + { + CDeploymentComponentData *self = new ( ELeave ) CDeploymentComponentData(); + CleanupStack::PushL(self) ; + self->ConstructLoadL(aBuffer); + return self; + } + +CDeploymentComponentData::~CDeploymentComponentData() + { + RDEBUG8_3("CDeploymentComponentData::~CDeploymentComponentData 0x%X - 0x%X", reinterpret_cast(this), + reinterpret_cast(this)+sizeof( CDeploymentComponentData ) ); + + delete iData; + iData = NULL; + } + +TInt CDeploymentComponentData::DataLengthL() const + { + TInt ret( 0); + if (iData == NULL) + { + if (iDataFileName.Length() > 0) + { + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); // 1 + TEntry entry; + TFileName fileName; + fileName.Copy(iDataFileName); + User::LeaveIfError(fs.Entry(fileName, entry) ); + ret = entry.iSize; + CleanupStack::PopAndDestroy( &fs); + } + } + else + { + ret = iData->Length(); + } + return ret; + } + +const TDesC8 &CDeploymentComponentData::Data() const + { + if (iData == NULL) + { + TRAPD( err, LoadDataL() ) + ; + if (err != KErrNone) + { + return KNullDesC8(); + } + } + if (iData != NULL) + { + return *iData; + } + else + { + return KNullDesC8(); + } + } + +void CDeploymentComponentData::LoadDataL() const + { + + if (iDataFileName.Length() > 0) + { + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); // 1 + RFile file; + TFileName fileName; + fileName.Copy(iDataFileName); + TInt err(file.Open(fs, fileName, EFileRead) ); + if (err == KErrNone) + { + CleanupClosePushL(file); // 2 + TInt fsize; + User::LeaveIfError(file.Size(fsize) ); + iData = HBufC8::NewL(fsize); + TPtr8 ptr(iData->Des() ); + User::LeaveIfError(file.Read(ptr) ); + CleanupStack::PopAndDestroy( &file); + } + else + { + RDEBUG_3( "ERROR Leaving CDeploymentComponentData::Data - SEVERE Could not open data file '%S': %d!", + &fileName, err ); + User::Leave(KErrNotFound) ; + } + CleanupStack::PopAndDestroy( &fs); + } + else + { + RDEBUG( "ERROR Leaving CDeploymentComponentData::LoadDataL() - No file to load!" ); + User::Leave(KErrNotFound) ; + } + } + +TUid CDeploymentComponentData::SetDataL(const TDesC8& aMimeType) + { + RDEBUG8_2("CDeploymentComponentData::SetDataL() aMimeType: (%S)", &aMimeType); + + TUid ret(TUid::Null()); + iMimeType = aMimeType.Left(KMaxMimeLength); + + if (aMimeType.Length()!=NULL) + { + TUid ret(TUid::Null()); + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + CFileMan *fm = CFileMan::NewL(fs); + CleanupStack::PushL(fm); + TFileName oldfilepath; + oldfilepath.Copy(iDataFileName); + + + RDEBUG("App Mgmt before copy start"); + TInt maxLength = iDataFileName.Length(); + TChar charvaldot = '.'; + TChar charvalslash = '\\'; + //TFileName oldfilepath; + TInt pos = iDataFileName.LocateReverse(charvaldot); + + TInt lengthDeleted = maxLength - pos; + + iDataFileName.Delete(pos, lengthDeleted); + + if (iMimeType == KSisxMimeType) + { + _LIT16(KExt,".sisx"); + iExtn.Append(KExt); + } + if(iMimeType==KSisMimeType) + { + _LIT16(KExt,".sis"); + iExtn.Append(KExt); + } + if(iMimeType==KPipMimeType) + { + _LIT16(KExt,".pip"); + iExtn.Append(KExt); + } + if(iMimeType==KJadMIMEType) + { + _LIT16(KExt,".jad"); + iExtn.Append(KExt); + } + if(iMimeType==KJarMIMEType) + { + _LIT16(KExt,".jar"); + iExtn.Append(KExt); + } + if(iMimeType==KJavaMIMEType) + { + _LIT16(KExt,".jar"); + iExtn.Append(KExt); + } + iDataFileName.Append(iExtn);//file name with sisx extension + TFileName newfilepath; + newfilepath.Copy(iDataFileName); + User::LeaveIfError(fm->Rename(oldfilepath, newfilepath)); + CleanupStack::PopAndDestroy(fm); + CleanupStack::PopAndDestroy( &fs); + //RDEBUG_2(" filename: %S", iDataFileName ); + } + if (IsSISInstallFile(aMimeType) ) + { + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); + ret = ResolveUidL(fs); + CleanupStack::PopAndDestroy( &fs); + } + RDEBUG8_2("CDeploymentComponentData::SetDataL() UID: (0x%x)", ret.iUid); + return ret; + } + +TUid CDeploymentComponentData::SetDataL(const TFileName &aData, + const TDesC8& aMimeType) + { + RDEBUG_2("CDeploymentComponentData::SetDataL() TFileName: (%S)", &aData); + + _LIT(KNewPath, "c:\\private\\200267FB\\"); + + TUid ret(TUid::Null()); + iMimeType = aMimeType.Left(KMaxMimeLength) ; + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); + CFileMan *fm = CFileMan::NewL(fs); + CleanupStack::PushL(fm); + TFileName fn; + fn.Copy(iDataFileName); + + RDEBUG("App Mgmt before copy start"); + + + TInt maxLength = iDataFileName.Length(); + TChar charvaldot = '.'; + TChar charvalslash = '\\'; + + TInt pos = iDataFileName.LocateReverse(charvaldot); + + TInt lengthDeleted = maxLength-pos; + + iDataFileName.Delete(pos, lengthDeleted); + + TInt srcpos = aData.LocateReverse(charvaldot); + + TBuf<15> extn(aData.Mid(srcpos)); + + iDataFileName.Append(extn); + + TFileName newfilepath; + newfilepath.Copy(iDataFileName); + + User::LeaveIfError(fm->Move(aData,KNewPath())); + + TFileName oldfilepath(KNewPath()); + oldfilepath.Append(aData.Mid(aData.LocateReverse(charvalslash))); + + User::LeaveIfError(fm->Rename(oldfilepath, newfilepath)); + + + //User::LeaveIfError(fm->Copy(aData, fn) ); + + RDEBUG("App Mgmt before copy End"); + + + if (IsSISInstallFile(aMimeType) ) + { + ret = ResolveUidL(fs); + } + + CleanupStack::PopAndDestroy(fm); + CleanupStack::PopAndDestroy( &fs); + RDEBUG_2("CDeploymentComponentData::SetDataL() (%d)", ret.iUid); + + return ret; + } + +TUid CDeploymentComponentData::SetDataL(const TDesC8 &aData, + const TDesC8 &aMimeType) + { + TUid ret(TUid::Null()); + if (iData) + { + delete iData; + iData = NULL; + } + iData = aData.AllocL(); + ret = SetDataL(aMimeType); + return ret; + } + +TBool CDeploymentComponentData::IsSISInstallFile(const TDesC8 &aMimeType) + { + TBool isSIS(EFalse); + + if (aMimeType == KSisxMimeType || aMimeType == KPipMimeType || aMimeType + == KDrmMessageMimeType || aMimeType == KDrmContentMimeType || aMimeType == KSisMimeType) + { + isSIS = ETrue; + } + + return isSIS; + } + +TUid CDeploymentComponentData::ResolveUidL(RFs& aFs) + { + RDEBUG("CDeploymentComponentData::ResolveUidL()"); + + TUid ret(TUid::Null() ); + HBufC* buf = HBufC::NewLC(KMaxFileName); + TPtr16 ptr = buf->Des(); + ptr.Copy(iDataFileName); + + // if PIP/DRM package, we need to use license manager to extract the sis file + if (iMimeType == KPipMimeType || iMimeType == KDrmMessageMimeType + || iMimeType == KDrmContentMimeType) + { + RDEBUG8_2(" -> mime: %S", &iMimeType ); + + RFile originalFile; + RFile decryptedFile; + TFileName decryptedTempFileName; + + RDEBUG_2(" -> opening original file: %S", &ptr ); + // leave if can not open the original file + User::LeaveIfError(originalFile.Open(aFs, ptr, EFileWrite) ); + RDEBUG(" -> done"); + + // First construct the temp path + User::LeaveIfError(aFs.PrivatePath(decryptedTempFileName) ); + // set drive letter into the path + decryptedTempFileName.Insert( 0, TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() ); + // append "piptemp\\" + decryptedTempFileName.Append(KTempDir); + // create the folder + aFs.MkDir(decryptedTempFileName); + + // Use license manager to extract files from the pip package + CDRMLicenseManager* licenseMgr = CDRMLicenseManager::NewL(); + CleanupStack::PushL(licenseMgr); + // decryp from the original file into the temp file + RDEBUG_2(" -> extracting SIS file into: %S", &decryptedTempFileName); + User::LeaveIfError(licenseMgr->ExtractSISFileL(originalFile, + decryptedTempFileName) ); + RDEBUG(" -> done"); + + // Get the sis file name + decryptedTempFileName.Append( *(licenseMgr->GetSISMemberL()->Name() )); + // open temporary handle to it. + RDEBUG_2(" -> opening decrypted file: %S", &decryptedTempFileName ); + User::LeaveIfError(decryptedFile.Open(aFs, decryptedTempFileName, + EFileShareAny) ); + RDEBUG(" -> done"); + // parse the uid from the file + ret = ParseUidFromSisFileL(decryptedFile); + + // no use anymore for the decrypted file + decryptedFile.Close(); + // delete the temp file + TInt err = aFs.Delete(decryptedTempFileName); + if (err != KErrNone) + { + RDEBUG_2("**** ERROR, unable to delete temporary file: %S", &decryptedTempFileName ); + } + + CleanupStack::PopAndDestroy(licenseMgr); + decryptedFile.Close(); + originalFile.Close(); + } + else + if (iMimeType == KSisxMimeType || iMimeType == KSisMimeType ) + { + RDEBUG(" -> mime: x-epoc/x-sisx-app"); + RFile originalFile; + RDEBUG_2(" -> opening file: %S", &ptr ); + User::LeaveIfError(originalFile.Open(aFs, ptr, EFileRead) ); + RDEBUG(" -> opened ok"); + ret = ParseUidFromSisFileL(originalFile); + originalFile.Close(); + } + + else + { + RDEBUG8_2( "**** ERROR - CDeploymentComponentData::ResolveUidL( ) - cannot get uid from mime type: %S", &iMimeType ); + } + + CleanupStack::PopAndDestroy(buf); + return ret; + } + +void CDeploymentComponentData::SerializedFormL(RWriteStream &aBuffer) const + { + aBuffer.WriteUint32L(iDataFileName.Length() ); + aBuffer.WriteL(iDataFileName); + + aBuffer.WriteUint32L(iMimeType.Length() ); + aBuffer.WriteL(iMimeType); + + } + +void CDeploymentComponentData::DestroyL(RFs &aFs) const + { + TFileName fn; + fn.Copy(iDataFileName); + aFs.Delete(fn) ; + } + +const TDesC8 &CDeploymentComponentData::DataFileName() const + { + return iDataFileName; + } + +void CDeploymentComponentData::PersistL(RFs &aFs) + { + if (iData) + { + RFile file; + TFileName aFile; + aFile.Copy(iDataFileName) ; + RDEBUG_3( "CDeploymentComponentData::PersistL() - Saving '%S', dataLenght %d", &aFile, (iData ? iData->Length() : 0) ); + User::LeaveIfError(file.Replace(aFs, aFile, EFileWrite) ); + CleanupClosePushL(file) ; + + file.Write( *iData) ; + file.Flush(); + delete iData; + iData = NULL; + CleanupStack::PopAndDestroy( &file) ; // file + } + else + { + RDEBUG( "CDeploymentComponentData::PersistL() - Already persisted" ); + } + RDEBUG( "CDeploymentComponentData::PersistL() - Done" ); + } + +TInt CDeploymentComponentData::SerializedFormLength() const + { + return iDataFileName.Length() + (2 * 4) + iMimeType.Length(); + } + +void CDeploymentComponentData::SetDataFileNameL(const TDesC8 &aNewFileName) + { + if (aNewFileName.Length() > 0) + { + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); + TFileName newfile; + newfile.Copy(aNewFileName); + TFileName oldfile; + oldfile.Copy(iDataFileName); + User::LeaveIfError(BaflUtils::RenameFile(fs, oldfile, newfile) ); + CleanupStack::PopAndDestroy( &fs); + iDataFileName = aNewFileName; + } + else + { + RDEBUG( "CDeploymentComponentData::SetDataFileNameL - ERROR Cannot set empty filename!" ); + User::Leave(KErrArgument); + } + } +void CDeploymentComponentData::SetMimeTypeL(const TDesC8 &aMimeType) +{ + iMimeType = aMimeType.Left(KMaxMimeLength) ; +} +void CDeploymentComponentData::ResetData(RFs &aFs) + { + TRAP_IGNORE(DestroyL( aFs )); + iDataFileName = KNullDesC8(); + delete iData; + iData = NULL; + } + +TUid CDeploymentComponentData::ParseUidFromSisFileL(RFile& aHandleToFile) + { + RDEBUG("CDeploymentComponentData::ParseUidFromSisFileL"); + + TUid appUid; + TInt uidLen = sizeof(TInt32); + TInt seekLen = sizeof(TInt32) + sizeof(TInt32); + User::LeaveIfError(aHandleToFile.Seek(ESeekStart, seekLen)); + TPckg uid1(appUid.iUid); + User::LeaveIfError(aHandleToFile.Read(uid1, uidLen)); + + if (uid1.Length() != uidLen) + { + RDEBUG("**** ERROR - uid length inconsistency - underflow"); + User::Leave(KErrUnderflow); + } + + RDEBUG_2(" -> returning SIS UID: %d", appUid.iUid ); + return appUid; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/AMDownloadStore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/AMDownloadStore.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2002-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: Implementation of applicationmanagement components + * + */ + +#include "AMDownloadStore.h" +#include "debug.h" +#include "ApplicationManagementUtility.h" +#include "amsmlhelper.h" + +using namespace NApplicationManagement; + +CAMDownloadStore::CAMDownloadStore(MDownloadMngrObserver& aObserver) : + CActive(CActive::EPriorityStandard),iObserver(aObserver) + { + + } + +void CAMDownloadStore::ConstructL() + { + CActiveScheduler::Add(this); + } + +CAMDownloadStore* CAMDownloadStore::NewL(MDownloadMngrObserver& aObserver) + { + CAMDownloadStore* self = new (ELeave) CAMDownloadStore(aObserver); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +CAMDownloadStore::~CAMDownloadStore() + { + iDwnldStore.ResetAndDestroy(); + } + +void CAMDownloadStore::AddDownloadL(CDeploymentComponent *aComponent) + { + CAMDwnldQTWrap *download = CAMDwnldQTWrap::NewL(iObserver, aComponent); + iDwnldStore.Append(download); + StartDownload(); + } + +void CAMDownloadStore::StartDownload() + { + if (!IsActive()) + { + + iStatus = KRequestPending; + + TInt downldcount = iDwnldStore.Count(); + CAMDwnldQTWrap *download = iDwnldStore[downldcount - 1]; + + download->StartDownload(download->iComponent, iStatus); + + SetActive(); + } + } + +TInt CAMDownloadStore::DownloadCount() + { + return iDwnldStore.Count(); + } + +void CAMDownloadStore::RunL() + { + TInt downldcount = iDwnldStore.Count(); + + iDwnldStore.Remove(downldcount - 1); + + if (iDwnldStore.Count() > 0) + StartDownload(); + } + +void CAMDownloadStore::DoCancel() + { + + } + +CAMDwnldQTWrap::CAMDwnldQTWrap(MDownloadMngrObserver& aObserver, + CDeploymentComponent *aComponent) : + iObserver(aObserver), iComponent(aComponent) + { + + } + +void CAMDwnldQTWrap::ConstructL() + { + + serverid = SmlHelper::GetCurrentServerIDL(); + + iap = -1; + TRAPD( err, SmlHelper::GetDefaultIAPFromDMProfileL( iap ) ); + if (err != KErrNone) + { + iap = -1; + RDEBUG_2("CAMDwnldQTWrap::ConstructL iapid to : %d", err ); + } + + } + +CAMDwnldQTWrap* CAMDwnldQTWrap::NewL(MDownloadMngrObserver& aObserver, + CDeploymentComponent *aComponent) + { + RDEBUG( "CAMDwnldQTWrap::NewL Start" ); + + CAMDwnldQTWrap* self = new (ELeave) CAMDwnldQTWrap(aObserver, aComponent); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + RDEBUG( "CAMDwnldQTWrap::NewL End" ); + + return self; + } + +CAMDwnldQTWrap::~CAMDwnldQTWrap() + { + if (serverid) + delete serverid; + } + +void CAMDwnldQTWrap::StartDownload(CDeploymentComponent *aComponent, + TRequestStatus& aStatus) + { + RDEBUG( "CAMDwnldQTWrap::StartDownload Start" ); + + aComponent->SetCallback(this); + appdwnld = new appmgmtdownloadmgr(0, *this, aStatus); + appdwnld->startDownload(aComponent); + + RDEBUG( "CAMDwnldQTWrap::StartDownload End" ); + + } + +void CAMDwnldQTWrap::DownloadComplete(CDeploymentComponent *aComponent, + TInt aStatus) + { + + TInt err(KErrNone); + TRAP( err, DownloadCompleteL( aComponent )); + + } + +// ---------------------------------------------------------------------------------------- +// CAMDownloadManager::DownloadCompleteL +// ---------------------------------------------------------------------------------------- +void CAMDwnldQTWrap::DownloadCompleteL(CDeploymentComponent *aComponent) + { + iObserver.ComponentDownloadComplete(aComponent, iap, serverid); + } + +// ---------------------------------------------------------------------------------------- +// CAMDownloadManager::UidExistsL +// ---------------------------------------------------------------------------------------- +TBool CAMDwnldQTWrap::UidExistsL(const TUid &aUid, + CDeploymentComponent *& aCompo, CDeploymentComponent *aIgnored) + { + TBool uidExist(EFalse); + uidExist = iObserver.HasUidL(aUid, aCompo, aIgnored); + return uidExist; + } + +// --------------------------------------------------------------------------- +// DownloadCompleted +// --------------------------------------------------------------------------- +void CAMDwnldQTWrap::DownloadCompleted() + { + + TInt err(KErrNone); + QString filename; + QString mimetype; + + QString path("c:\\system\\appmgr\\"); + + QString filefullpath(path); + + appdwnld->FileName(filename); + appdwnld->MimeType(mimetype); + + filefullpath.append(filename); + + TPtrC filenamefullpathptr( + reinterpret_cast (filefullpath.utf16())); + TPtrC8 mimetypeptr( + reinterpret_cast (mimetype.toUtf8().constData())); + + CApplicationManagementUtility::SetFileName(filenamefullpathptr); + + TRAP( err, iComponent->SuccessStatusUpdateL( filenamefullpathptr, mimetypeptr) ); + + if (err != KErrNone) + { + RDEBUG_2(" ->iComponent::StatusUpdateL: %d", err ); + } + RDEBUG_2( "CAMDownload::DownloadCompleted: end Download delete ERROR (%d)", err ); + } + +void CAMDwnldQTWrap::DownloadFailed(TInt aDwnldStatus) + { + RDEBUG( "CAMDownload::DownloadFailed: start"); + //TInt err(KErrNone); + //TInt32 errorCode = iDownloader->DownloadStatusCodeL(aDownloadState); + TRAPD( err, iComponent->StatusUpdateL( aDwnldStatus ) ); + + if (err != KErrNone) + { + RDEBUG_2(" ->iComponent::StatusUpdateL: %d", err ); + } + RDEBUG_2( "CAMDownload::DownloadFailed: end Download delete ERROR (%d)", err ); + } + +void CAMDwnldQTWrap::SetStatus(TInt aStatus) + { + TRAPD( err, iComponent->StatusUpdateL( aStatus ) ); + if (err != KErrNone) + { + RDEBUG_2(" ->iComponent::StatusUpdateL: %d", err ); + } + RDEBUG_2( "CAMDownload::DownloadFailed: end Download delete ERROR (%d)", err ); + } diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/AMDownloaddb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/AMDownloaddb.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,388 @@ +/* +* 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 applicationmanagement components + * +*/ + +// INCLUDE FILES +#include +#include + +#include "AMDownloaddb.h" +#include "debug.h" + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CAMDownloaddb::NewL() +// Creates a new instance of CAMDownloaddb object. +// --------------------------------------------------------------------------- +// +CAMDownloaddb* CAMDownloaddb::NewL() + { + RDEBUG("CAMDownloaddb::NewL(): begin"); + + CAMDownloaddb* self = CAMDownloaddb::NewLC(); + CleanupStack::Pop(self); + + RDEBUG("CAMDownloaddb::NewL(): end"); + + return self; + } + +// --------------------------------------------------------------------------- +// CAMDownloaddb::NewLC() +// Creates a new instance of CAMDownloaddb object. +// Pushes and leaves new instance onto CleanupStack. +// --------------------------------------------------------------------------- +// +CAMDownloaddb* CAMDownloaddb::NewLC() + { + RDEBUG("CAMDownloaddb::NewLC(): begin"); + + CAMDownloaddb* self = new( ELeave ) CAMDownloaddb(); + CleanupStack::PushL(self); + self->ConstructL(); + + RDEBUG("CAMDownloaddb::NewLC(): end"); + + return self; + } + +// --------------------------------------------------------------------------- +// CAMDownloaddb::ConstructL() +// Second phase constructor. +// --------------------------------------------------------------------------- +// +void CAMDownloaddb::ConstructL() + { + RDEBUG("CAMDownloaddb::ConstructL(): begin"); + + TParse name; + TInt err; + + User::LeaveIfError(iFsSession.Connect()); + User::LeaveIfError(iRdbSession.Connect() ); + + iFsSession.SetSessionToPrivate(EDriveC); + +#ifdef SYMBIAN_SECURE_DBMS + name.Set(KAMDownloaddbName, NULL, NULL); + err = iDatabase.Open(iRdbSession, name.FullName(), KDBMSSecureID); +#else + name.Set( KAMDownloaddbName, KNonSecureDbFullName, NULL ); + err = iDatabase.Open(iRdbSession, DBFileName); +#endif + + if (err == KErrNotFound) + { + CreateandOpenL(name); + } + else + { + + if ( (err == KErrEof ) || (err == KErrCorrupt ) || (err + == KErrArgument )) + { + // something seriously wrong with the db, delete it and try + // to create new + iRdbSession.DeleteDatabase(name.FullName(), KAMPolicyUID); + CreateandOpenL(name); + } + + } + + RDEBUG("CAMDownloaddb::ConstructL(): end"); + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::CreateandOpenL +// ----------------------------------------------------------------------------- +// +void CAMDownloaddb::CreateandOpenL(TParse& name) + { + + TInt err; + +#ifdef SYMBIAN_SECURE_DBMS + iDatabase.Create(iRdbSession, name.FullName(), KDBMSSecureID); +#else + if( SysUtil::FFSSpaceBelowCriticalLevelL( &iFsSession, KEmptyDbSizeEstimate ) ) + { + User::Leave( KErrDiskFull ); + } + iDatabase.Create(iFsSession, name.FullName()); +#endif + + CreateTableL(iDatabase); + iDatabase.Close(); +#ifdef SYMBIAN_SECURE_DBMS + + err = iDatabase.Open(iRdbSession, name.FullName(), KDBMSSecureID); + +#else + err = iDatabase.Open(iFsSession, DBFileName); +#endif + + //Debug + if (err != KErrNone) + { + + User::LeaveIfError(err); + } + + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::CreateTableL +// ----------------------------------------------------------------------------- +// +void CAMDownloaddb::CreateTableL(RDbDatabase& aDatabase) + { + + // Create a table definition + CDbColSet* columns=CDbColSet::NewLC(); + + // Add Columns + TDbCol id(NCol1, EDbColInt32); + + // automatic indexing for items,it is our key field. + id.iAttributes=id.EAutoIncrement; + columns->AddL(id); + columns->AddL(TDbCol(NCol2, EDbColInt32)); + columns->AddL(TDbCol(NCol3, EDbColInt32)); + columns->AddL(TDbCol(NCol4, EDbColText8, 255)); + columns->AddL(TDbCol(NCol5, EDbColInt32)); + + // Create a table + TRAPD(err, aDatabase.CreateTable(KTableAMMgmtObject, *columns) ) + ; + + if (err!=KErrNone) + User::Leave(err); + + // cleanup the column set + CleanupStack::PopAndDestroy(columns); + + } + +// --------------------------------------------------------------------------- +// CAMDownloaddb::CAMDownloaddb() +// Constructor. +// --------------------------------------------------------------------------- +// +CAMDownloaddb::CAMDownloaddb() + { + RDEBUG("CAMDownloaddb::CAMDownloaddb(): begin"); + RDEBUG("CAMDownloaddb::CAMDownloaddb(): end"); + } + +// --------------------------------------------------------------------------- +// CAMDownloaddb::~CAMDownloaddb() +// Destructor. +// --------------------------------------------------------------------------- +// +CAMDownloaddb::~CAMDownloaddb() + { + RDEBUG("CAMDownloaddb::~CAMDownloaddb(): begin"); + + iView.Close(); + + delete iColSet; + iAMObjectTable.Close(); + + iDatabase.Close(); + iFsSession.Close(); + iRdbSession.Close(); + + RDEBUG("CAMDownloaddb::~CAMDownloaddb(): ends"); + } + +CAMDbItem::~CAMDbItem() + { + delete iTargetURI; + + } + +void CAMDownloaddb::GetEntryForLUIDL(RPointerArray& aItemArray, + TDesC& aValue) + { + RDEBUG( "CAMDownloaddb::GetEntryForLUIDL: Step1" ); + aItemArray.Reset();// first reset the array + + _LIT(KEqualToString,"=%d"); + _LIT(KQuery, "SELECT * FROM %S WHERE %S"); + + RDEBUG( "CAMDownloaddb::GetEntryForLUIDL: Step2" ); + + TBuf<100> bufsql; + bufsql.Append(KQuery); + bufsql.Append(KEqualToString); + TLex lex(aValue); + + RDEBUG( "CAMDownloaddb::GetEntryForLUIDL: Step3" ); + + TInt value; + lex.Val(value); + + TBuf<100> bufsql1; + bufsql1.Format(bufsql, &KTableAMMgmtObject, &NCol2, value); + + RDEBUG( "CAMDownloaddb::GetEntryForLUIDL: Step4" ); + + ReadItemsL(aItemArray, bufsql1); + + RDEBUG( "CAMDownloaddb::GetEntryForLUIDL: Step5" ); + + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::ReadDbItemsL +// ----------------------------------------------------------------------------- +// +void CAMDownloaddb::ReadDbItemsL(RPointerArray& aItemArray) + { + + aItemArray.Reset();// first reset the array + + TFileName sqlQuery; + + // just get all columns & rows of same originator + sqlQuery.Copy(_L("SELECT * FROM ")); + sqlQuery.Append(KTableAMMgmtObject); + + ReadItemsL(aItemArray, sqlQuery); + + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::ReadItemsL +// ----------------------------------------------------------------------------- +// +void CAMDownloaddb::ReadItemsL(RPointerArray& aItemArray, + TDesC& asqlQuery) + { + + RDEBUG( "CAMDownloaddb::ReadItemsL: Step1" ); + + RDbView view; + view.Prepare(iDatabase, TDbQuery(asqlQuery)); + CleanupClosePushL(view); + view.EvaluateAll(); + view.FirstL(); + + while (view.AtRow()) + { + view.GetL(); + + CAMDbItem *dbitem = new(ELeave) CAMDbItem; + CleanupStack::PushL(dbitem); + dbitem->id = view.ColInt(1); + dbitem->iLUID = view.ColInt(2); + dbitem->iResult = view.ColInt(3); + + dbitem->iTargetURI= (view.ColDes8(4)).AllocL(); + + dbitem->iapid = view.ColInt(5); + aItemArray.Append(dbitem); + CleanupStack::Pop(dbitem); + view.NextL(); + } + + CleanupStack::PopAndDestroy(); // view + + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::SaveToDatabaseL +// ----------------------------------------------------------------------------- +// +void CAMDownloaddb::SaveToDatabaseL(TInt& aIndex, TUint32 aLuid, + TInt aResult, const TDesC8& aTargetURI, TUint32 aIapid) + { + + iDatabase.Begin(); + + TFileName sqlQuery; + sqlQuery.Copy(_L("SELECT * FROM ")); + sqlQuery.Append(KTableAMMgmtObject); + + RDbView view; + view.Prepare(iDatabase, TDbQuery(sqlQuery)); + CleanupClosePushL(view); + + view.InsertL(); + + view.SetColL(2, aLuid); + view.SetColL(3, aResult); + view.SetColL(4, aTargetURI); + view.SetColL(5, aIapid); + + view.PutL(); + + aIndex = view.ColInt(1);// autoincrement gives us unique index. + + CleanupStack::PopAndDestroy(1); // view + iDatabase.Commit(); + + } + +// ----------------------------------------------------------------------------- +// CWPInternetAPDB::DeleteFromDatabaseL +// ----------------------------------------------------------------------------- +// +TBool CAMDownloaddb::DeleteFromDatabaseL(TUint32 aLUID) + { + + TBool rowsdeleted = EFalse; + TFileName sqlQuery; + sqlQuery.Copy(_L("SELECT * FROM ")); + sqlQuery.Append(KTableAMMgmtObject); + sqlQuery.Append(_L(" WHERE ")); + sqlQuery.Append(NCol2); + sqlQuery.Append(_L(" = ")); + sqlQuery.AppendNum(aLUID); + + iDatabase.Begin(); + + RDbView view; + // query buffer with index finds only the selected item row. + view.Prepare(iDatabase, TDbQuery(sqlQuery)); + CleanupClosePushL(view); + + view.EvaluateAll(); + view.FirstL(); + + if (!view.IsEmptyL()) + { + // we have autoincrement in index so it should be unique + // but just to make sure, we use 'while', instead of 'if' + while (view.AtRow()) + { + view.GetL(); + view.DeleteL(); + view.NextL(); + } + + iDatabase.Commit(); + // compacts the databse, by physically removig deleted data. + iDatabase.Compact(); + rowsdeleted = ETrue; + } + CleanupStack::PopAndDestroy(1); // view + + + return rowsdeleted; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/AMPreInstallApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/AMPreInstallApp.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,301 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + + +#include +#include +#include //for KMaxDataTypeLength +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AMPreInstallApp.h" +#include "debug.h" + +using namespace NApplicationManagement; +CAMPreInstallApp* CAMPreInstallApp::NewL() + { + CAMPreInstallApp* self = CAMPreInstallApp::NewLC(); + CleanupStack::Pop(self); + return self; + + } + + +CAMPreInstallApp* CAMPreInstallApp::NewLC() + { + CAMPreInstallApp *self = new (ELeave) CAMPreInstallApp(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + + } +CAMPreInstallApp::CAMPreInstallApp() + { + } +CAMPreInstallApp::~CAMPreInstallApp() + { + delete iStorage; + iFs.Close(); + #ifdef RD_MULTIPLE_DRIVE + delete iInstallDocPathArray; + #endif + iPreInstalledAppParams.ResetAndDestroy(); + } +void CAMPreInstallApp::ConstructL() + { + iStorage = CDeliveryComponentStorage::NewL(); + User::LeaveIfError(iFs.Connect() ); + TPtrC mmcDrive(TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive()); + iPreInstallPath.Append(mmcDrive); + iPreInstallPath.Append(KPreInstallPath); + } +void CAMPreInstallApp::GetPreInstalledAppsL(RPointerArray< + TPreInstalledAppParams> &aPreInstalledAppParams) + { + + MakeAllInstallPathsL(); + ListPreInstalledAppL(); + aPreInstalledAppParams = iPreInstalledAppParams; + } + + +void CAMPreInstallApp::ListPreInstalledAppL(const TDesC& installDocPath) + { + + RDEBUG("Clist_PreInstallAppUi: ListPreInstalledApp: <<<<"); + CDir* dir= NULL; + TInt err = iFs.GetDir(installDocPath, KEntryAttNormal, ESortByName, dir); + // _LIT(KInstallpath,"C:\\private\\10202dce\\"); + //TInt err = iFs.GetDir(KInstallpath, KEntryAttNormal, ESortByName, dir); + RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: err in getting dir list : %d",err); + + if (err==KErrNone) + { + CleanupStack::PushL(dir); + RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: no of dir's : %d",dir->Count()); + for (TInt i(0); i < dir->Count(); i++) + { + + RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: <<<< dir entry %d", i); + TEntry entry; + entry = (*dir)[i]; + HBufC* pathAndName = HBufC::NewLC(installDocPath.Length() + + entry.iName.Length() ); + TPtr ptrPathAndName = pathAndName->Des(); + ptrPathAndName.Append(installDocPath); + ptrPathAndName.Append(entry.iName); + + HBufC* mimeType = HBufC::NewLC(KMaxDataTypeLength); + //Recognize + if (!RecognizeL(*pathAndName, mimeType)) + { + CleanupStack::PopAndDestroy(mimeType); + CleanupStack::PopAndDestroy(pathAndName); + continue; + } + +#ifdef RD_MULTIPLE_DRIVE + if (TParsePtrC(installDocPath).Path().CompareF(KPreInstallPath) + == 0) +#else + if (installDocPath.CompareF(iPreInstallPath) == 0) +#endif + { + + RDEBUG("Clist_PreInstallAppUi: ListPreInstalledApp: <<<< Entered installDocPath.CompareF(iPreInstallPath)"); + Swi::RSisRegistrySession regSession; + CleanupClosePushL(regSession); + User::LeaveIfError(regSession.Connect() ); + + RArray uids; + CleanupClosePushL(uids); + + regSession.InstalledUidsL(uids); + + RFile temp; + User::LeaveIfError(temp.Open(iFs, *pathAndName, + EFileShareReadersOnly | EFileRead) ); + CleanupClosePushL(temp); + + TUid appUid; + TInt uidLen = sizeof(TInt32); + TInt seekLen = sizeof(TInt32) + sizeof(TInt32); + + User::LeaveIfError(temp.Seek(ESeekStart, seekLen)); + + TPckg uid1(appUid.iUid); + User::LeaveIfError(temp.Read(uid1, uidLen)); + if (uid1.Length() != uidLen) + { + User::Leave(KErrUnderflow); + } + + //checking whether this is installed or not + TBool installed = regSession.IsInstalledL(appUid); + Swi::RSisRegistryEntry registryEntry; + TInt regEntryError = registryEntry.Open(regSession, appUid); + RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: RegEntryError : %d",regEntryError); + + //User::LeaveIfError(regEntryError); + if (regEntryError == KErrNone) + { + CleanupClosePushL(registryEntry); + TBool isPreInstalled = registryEntry.PreInstalledL(); + // TBool isPreInstalled = ETrue; + + RDEBUG_4("Clist_PreInstallAppUi: ListPreInstalledApp: UID is : '0x%X', installed:, preinstalled %d %d",appUid,installed,isPreInstalled); + + for (TInt i(0); isPreInstalled && i < uids.Count(); i++) + { + if (appUid == uids[i]) + { + + RDEBUG("Clist_PreInstallAppUi: appUid == uids[i]"); + Swi::CSisRegistryPackage* sisRegistry = NULL; + TRAPD( err, sisRegistry = regSession.SidToPackageL( uids[i] ) ) ; + //User::LeaveIfError(err); + if(err == KErrNone) + { + + RDEBUG("Clist_PreInstallAppUi: err == KErrNone"); + TPreInstalledAppParams *params = + new (ELeave) TPreInstalledAppParams; + params->iPreInstalledAppame.Copy(sisRegistry->Name()); + params->iPreInstalledAppVendorName.Copy( + sisRegistry->Vendor()); + params->iPreInstalledAppUid = sisRegistry->Uid(); + params->iMimeType.Copy(*mimeType); + //Get version + TVersion version = registryEntry.VersionL(); + TBuf8 pkgDes; + pkgDes.AppendNum(version.iMajor); + pkgDes.Append(KLiteralPeriod); + pkgDes.AppendNum(version.iMinor); + params->iVersion.Copy(pkgDes); + + iPreInstalledAppParams.Append(params); + + RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: Installed App UID is : '0x%X'",appUid); + RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: Installed App Name is: %S",&(sisRegistry->Name())); + RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: Installed App Vendor is: %S",&(sisRegistry->Vendor())); + RDEBUG_2("Clist_PreInstallAppUi: ListPreInstalledApp: Installed App UID is : '0x%X'",sisRegistry->Uid()); + delete sisRegistry; + } + continue; + } + } + + CleanupStack::PopAndDestroy(®istryEntry); + } + CleanupStack::PopAndDestroy(&temp); + CleanupStack::PopAndDestroy(&uids); + CleanupStack::PopAndDestroy(®Session); + CleanupStack::PopAndDestroy(mimeType); + CleanupStack::PopAndDestroy(pathAndName); + } + } + CleanupStack::PopAndDestroy(dir); + } + } +void CAMPreInstallApp::ListPreInstalledAppL() + { + iPreInstalledAppParams.Reset(); +#ifdef RD_MULTIPLE_DRIVE + TInt count = iInstallDocPathArray->Count(); + for ( TInt index(0); index < count; index++ ) + { + if ( (*iInstallDocPathArray)[index].Length()> 0 ) + { + ListPreInstalledAppL( (*iInstallDocPathArray)[index] ); + } + } +#else + if (iPreInstallDocumentPath.Length() > 0) + { + ListPreInstalledAppL(iPreInstallDocumentPath); + //_LIT(KInstallpath,"C:\\private\\10202dce\\"); + //ListPreInstalledAppL(KInstallpath); + } +#endif + + } + +TBool CAMPreInstallApp::RecognizeL(TDesC& aPathAndName, HBufC* aMimeType) + { + TBool IsOK(ETrue); + ContentAccess::CContent* pkgContent = ContentAccess::CContent::NewLC( + aPathAndName, ContentAccess::EContentShareReadWrite); + + TPtr mimePtr(aMimeType->Des()); + pkgContent->GetStringAttribute(ContentAccess::EMimeType, mimePtr); + + HBufC8* tmpMime8 = HBufC8::NewLC(aMimeType->Length()); + tmpMime8->Des().Copy(*aMimeType); + TPtr8 mimePtr8(tmpMime8->Des()); + + if ((mimePtr8 != SwiUI::KSisxMimeType) && (mimePtr8 + != SwiUI::KSisMimeType) && (mimePtr8 != SwiUI::KPipMimeType)) + { + IsOK = EFalse; + } + CleanupStack::PopAndDestroy(tmpMime8); + CleanupStack::PopAndDestroy(pkgContent); + return IsOK; + + } +void CAMPreInstallApp::MakeAllInstallPathsL() + { +#ifdef RD_MULTIPLE_DRIVE + iInstallDocPathArray = new (ELeave) CDesCArrayFlat( 2 ); + TDriveList driveList; + TInt driveCount = 0; + //User::LeaveIfError(iFs.Connect() ); + User::LeaveIfError( DriveInfo::GetUserVisibleDrives(iFs, driveList,driveCount)); + TUint driveStatus = 0; + for (TInt index(0); index < KMaxDrives; index++) + { + if (driveList[index]) + { + User::LeaveIfError( DriveInfo::GetDriveStatus(iFs, index, + driveStatus)); + TFileName path; + TDriveUnit driveUnit(index); + if ( !(driveStatus & DriveInfo::EDriveRemote )) + { + if (driveStatus & DriveInfo::EDriveRemovable) + { + path.Zero(); + path.Append(driveUnit.Name() ); + path.Append(KPreInstallPath); + iInstallDocPathArray->AppendL(path); + } + } + } + } + //iFs.Close(); +#else + TPtrC mmcDrive(TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive()); + iPreInstallDocumentPath.Append(mmcDrive); + iPreInstallDocumentPath.Append(KPreInstallPath); +#endif //RD_MULTIPLE_DRIVE + } diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/AMSmlHelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/AMSmlHelper.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + + +#include +#include +#include "amsmlhelper.h" +#include "debug.h" + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include +#include +#endif +#include + +const TUid KUidNSmlMediumTypeInternet = + { + 0x101F99F0 + }; +const TUid KSosServerUid = + { + 0x101F99FB + }; + +const TInt KBufSize32 = 32; + +using namespace NApplicationManagement; + +/* + void CApplicationManagementServer::StartDMSessionL( ) + { + RSyncMLSession ses; + ses.OpenL() ; + + CleanupClosePushL( ses ); + TSmlJobId jid; + TSmlUsageType jtype; + ses.CurrentJobL(jid, jtype ); + RSyncMLDevManJob job; + job.OpenL( ses, jid ); + CleanupClosePushL( job ) ; + TSmlProfileId pid( job.Profile() ); + RSyncMLDevManProfile prof; + prof.OpenL( ses, pid, ESmlOpenRead ); + + TBuf<64> serverid; + serverid.Copy( prof.ServerId()) ; + prof.Close(); + + CleanupStack::PopAndDestroy( &job ) ; + CleanupStack::PopAndDestroy( &ses ) ; + } + */ + +TInt SmlHelper::GetCurrentProfileIdL(TSmlProfileId &aProfile) + { + RSyncMLSession ses; + ses.OpenL() ; + CleanupClosePushL(ses); + TSmlJobId jid; + TSmlUsageType jtype; + ses.CurrentJobL(jid, jtype); + RSyncMLDevManJob job; + job.OpenL(ses, jid); + CleanupClosePushL(job) ; + TSmlProfileId pid(job.Profile() ); + aProfile = pid; + + CleanupStack::PopAndDestroy( &job) ; + CleanupStack::PopAndDestroy( &ses) ; + return 0; + } + +HBufC8* SmlHelper::GetCurrentServerIDL() + { + HBufC8 *serverid; + //TBufC<256> serverid; + RSyncMLSession ses; + ses.OpenL() ; + CleanupClosePushL(ses); + TSmlJobId jid; + TSmlUsageType jtype; + ses.CurrentJobL(jid, jtype); + RSyncMLDevManJob job; + job.OpenL(ses, jid); + CleanupClosePushL(job) ; + TSmlProfileId pid(job.Profile() ); + //aProfile = pid; + RSyncMLDevManProfile syncProfile; + syncProfile.OpenL(ses, pid); + RDEBUG(" 5/8"); + CleanupClosePushL(syncProfile); + + serverid = syncProfile.ServerId().AllocLC(); + + CleanupStack::Pop(); // serverid + + CleanupStack::PopAndDestroy( &syncProfile); + CleanupStack::PopAndDestroy( &job) ; + CleanupStack::PopAndDestroy( &ses) ; + + return serverid; + } + +TInt SmlHelper::LaunchSessionL(TSmlProfileId &aProfile) + { + if (aProfile > -1) + { + RSyncMLSession syncSession; + RSyncMLConnection conn; + RSyncMLDevManJob dmJob; + RSyncMLDevManProfile dmProfile; + + //TSmlProfileId id ; + TSmlConnectionId cid; + syncSession.OpenL(); + CleanupClosePushL(syncSession); + + TRAPD( err, dmProfile.OpenL( syncSession, aProfile, ESmlOpenRead ) ) + if (err == KErrNone) + { + CleanupClosePushL(dmProfile); + conn.OpenL(dmProfile, KUidNSmlMediumTypeInternet.iUid); + CleanupStack::PopAndDestroy( &dmProfile) ; +#ifdef __TARM_SYMBIAN_CONVERGENCY + cid = conn.Identifier(); +#else + cid = conn.ConnectionId(); +#endif + conn.Close(); + dmJob.CreateL(syncSession, aProfile, cid); + dmJob.Close(); + } + CleanupStack::PopAndDestroy( &syncSession) ; // + return err; + } + else + { + return KErrArgument; + } + } + +void SmlHelper::GetDefaultIAPFromDMProfileL(TInt& aDefaultIAP) + { + RDEBUG("ApplicationManagementServer::GetDefaultIAPFromDMProfileL() - start"); + + // first try to obtain the current profile id + RSyncMLSession ses; + ses.OpenL(); + RDEBUG(" 1/8"); + CleanupClosePushL(ses); + + TSmlJobId jid; + TSmlUsageType jtype; + ses.CurrentJobL(jid, jtype); + RDEBUG(" 2/8"); + RSyncMLDevManJob job; + job.OpenL(ses, jid); + RDEBUG(" 3/8"); + CleanupClosePushL(job); + // get profile id + TSmlProfileId pid(job.Profile() ); + CleanupStack::PopAndDestroy( &job); + + TBuf8 key; + TBuf value; + TInt num = KErrNotFound; + + // get connection property name first + GetConnectionPropertyNameL(ses, key, EPropertyIntenetAccessPoint); + RDEBUG(" 4/8"); + // we need to open sync profile in ordere to open the RSyncMLConnection + RSyncMLDevManProfile syncProfile; + syncProfile.OpenL(ses, pid); + RDEBUG(" 5/8"); + CleanupClosePushL(syncProfile); + + TSmlTransportId transport; + RArray connections; + _LIT8( KNSmlIAPId, "NSmlIapId" ); + + // now open the syncML connection + RSyncMLConnection syncConnection; + syncProfile.ListConnectionsL(connections); + + transport = connections[0]; + syncConnection.OpenL(syncProfile, transport); + RDEBUG(" 6/8"); + CleanupClosePushL(syncConnection); + + const TDesC8& source(syncConnection.GetPropertyL(KNSmlIAPId) ); + RDEBUG(" 7/8"); + value.Copy(source.Left(value.MaxLength() ) ); + User::LeaveIfError(StrToInt(value, num) ); + RDEBUG(" 8/8"); + + aDefaultIAP = num; + + // If there is no default Access point in DM profile then use + // currently used access point by DM session + + if (aDefaultIAP == -2) + { + + TInt sockIapid = -1; + + RSocketServ serv; + CleanupClosePushL(serv); + User::LeaveIfError(serv.Connect() ); + + RConnection conn; + CleanupClosePushL(conn); + User::LeaveIfError(conn.Open(serv) ); + + TUint count( 0); + User::LeaveIfError(conn.EnumerateConnections(count) ); + // enumerate connections + for (TUint idx=1; idx<=count; ++idx) + { + TConnectionInfo connectionInfo; + TConnectionInfoBuf connInfo(connectionInfo); + + TInt err = conn.GetConnectionInfo(idx, connInfo); // iapid + if (err != KErrNone) + { + CleanupStack::PopAndDestroy( 2); // conn, serv + User::Leave(err); + } + // enumerate connectionclients + TConnectionEnumArg conArg; + conArg.iIndex = idx; + TConnEnumArgBuf conArgBuf(conArg); + err=conn.Control(KCOLConnection, KCoEnumerateConnectionClients, + conArgBuf); + if (err != KErrNone) + { + CleanupStack::PopAndDestroy( 2); // conn, serv + User::Leave(err); + } + TInt cliCount = conArgBuf().iCount; + for (TUint j=1; j<=cliCount; ++j) + { + TConnectionGetClientInfoArg conCliInfo; + conCliInfo.iIndex = j; + TConnGetClientInfoArgBuf conCliInfoBuf(conCliInfo); + err=conn.Control(KCOLConnection, KCoGetConnectionClientInfo, + conCliInfoBuf); + + if (err != KErrNone) + { + CleanupStack::PopAndDestroy( 2); // conn, serv + User::Leave(err); + } + TConnectionClientInfo conCliInf = conCliInfoBuf().iClientInfo; + TUid uid = conCliInf.iUid; + if (uid == KSosServerUid) + { + sockIapid = connInfo().iIapId; + + } + + } + } + CleanupStack::PopAndDestroy( 2); // conn, serv + + aDefaultIAP = sockIapid; + + } + // get profile's server id + //aServerId = syncProfile.ServerId().AllocL(); + + CleanupStack::PopAndDestroy( &syncConnection); + CleanupStack::PopAndDestroy( &syncProfile); + + CleanupStack::PopAndDestroy( &ses); + connections.Close(); + RDEBUG("ApplicationManagementServer::GetDefaultIAPFromDMProfileL() - end"); + } + +void SmlHelper::GetConnectionPropertyNameL(RSyncMLSession& aSyncSession, + TDes8& aText, TInt aPropertyPos) + { + RDEBUG("ApplicationManagementServer::GetConnectionPropertyNameL() - start"); + + // at the moment RSyncMLTransport is only needed + // for internet connection settings + RSyncMLTransport transport; + CleanupClosePushL(transport); + transport.OpenL(aSyncSession, KUidNSmlMediumTypeInternet.iUid); + + const CSyncMLTransportPropertiesArray& arr = transport.Properties(); + + __ASSERT_DEBUG( arr.Count()> aPropertyPos, User::Panic(_L("invalid count"), KErrGeneral) ); + + const TSyncMLTransportPropertyInfo& info = arr.At(aPropertyPos); + aText = info.iName; + CleanupStack::PopAndDestroy( &transport); + + RDEBUG("ApplicationManagementServer::GetConnectionPropertyNameL() - end"); + } + +TInt SmlHelper::StrToInt(const TDesC& aText, TInt& aNum) + { + TLex lex(aText); + TInt err = lex.Val(aNum); + return err; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/ApplicationManagementJavaUtility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/ApplicationManagementJavaUtility.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,202 @@ +/* + * 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 applicationmanagement components + * + */ + +// CLASS HEADER + +#include +#include +#include +#include +#include "ApplicationManagementJavaUtility.h" +#include "debug.h" +// INTERNAL INCLUDES + + +using namespace NApplicationManagement; + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// CONSTRUCTION +CApplicationManagementJavaUtility* CApplicationManagementJavaUtility::NewL() + { + CApplicationManagementJavaUtility* self = + CApplicationManagementJavaUtility::NewLC(); + CleanupStack::Pop(); + + return self; + } + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// +CApplicationManagementJavaUtility* CApplicationManagementJavaUtility::NewLC() + { + CApplicationManagementJavaUtility* self = new( ELeave ) CApplicationManagementJavaUtility(); + CleanupStack::PushL(self); + + self->ConstructL(); + return self; + } + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// Destructor (virtual by CBase) +CApplicationManagementJavaUtility::~CApplicationManagementJavaUtility() + { + + if (iJavaRegistry) + { + delete iJavaRegistry; + } + } + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// Default constructor +CApplicationManagementJavaUtility::CApplicationManagementJavaUtility() + { + } + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// Second phase construct +void CApplicationManagementJavaUtility::ConstructL() + { + RefreshJavaRegistryL(); + } + +// METHODS + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// +TBool CApplicationManagementJavaUtility::FindInstalledJavaUidL( + const TUid &aUid) const + { + TBool ret; + ret = iJavaRegistry->RegistryEntryExistsL(aUid); + return ret; + + } + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// +void CApplicationManagementJavaUtility::InstalledSuiteUidsL( + RArray & aUids) + { + iJavaRegistry->GetRegistryEntryUidsL(aUids); + } + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// +void CApplicationManagementJavaUtility::JavaUidsL(RArray &aUids) + { + iJavaRegistry->GetRegistryEntryUidsL(aUids); + } + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +// +void CApplicationManagementJavaUtility::RefreshJavaRegistryL() + { + if (iJavaRegistry) + { + delete iJavaRegistry; + iJavaRegistry = NULL; + } + + iJavaRegistry = CJavaRegistry::NewL(); + } +void CApplicationManagementJavaUtility::GetInstalledMidletParametersL( + TMidletParameters& aMidletParameters) + { + RDEBUG( "CApplicationManagementJavaUtility::GetInstalledMidletParametersL: Start"); + TInt suiteUid = 0; + // Get UID for the latest installed Midlet suite + // KPSUidJavaLatestInstallation = 0x10282567 + RProperty::Get(KUidSystemCategory, KPSUidJavaLatestInstallation, suiteUid); + + if ( !suiteUid) + { + User::Leave(KErrNotFound); + } + + RArray uids; + CleanupClosePushL(uids); + + Java::CJavaRegistry* javaRegistry; + javaRegistry = Java::CJavaRegistry::NewLC(); + + Java::CJavaRegistryEntry* regEntry = + javaRegistry->RegistryEntryL(TUid::Uid(suiteUid) ); + + if (regEntry) + { + CleanupStack::PushL(regEntry); + Java::TJavaRegistryEntryType entryType = regEntry->Type(); + + if ( (entryType >= Java::EGeneralPackage ) && (entryType + < Java::EGeneralApplication)) + { + //package entry + Java::CJavaRegistryPackageEntry * regPackageEntry = + static_cast(regEntry ); + regPackageEntry->GetEmbeddedEntries(uids); + + aMidletParameters.iMidletUid = uids[0]; // conidered the first application from the suite + aMidletParameters.iMidletName.Copy(regPackageEntry->Name()); + aMidletParameters.iMidletVenorName.Copy(regPackageEntry->Vendor()); + + TAppVersion version; + version = regPackageEntry->Version(); + _LIT8(KDot,"."); + aMidletParameters.bufVersion.Num(version.iMajor); + aMidletParameters.bufVersion.Append(KDot); + aMidletParameters.bufVersion.AppendNum(version.iMinor); + } + else + { + //application entry + uids.AppendL(regEntry->Uid() ); + aMidletParameters.iMidletUid = regEntry->Uid(); + aMidletParameters.iMidletName.Copy(regEntry->Name()); + //How to get Vendor& version name for java application + aMidletParameters.iMidletVenorName.Copy(KNullDesC8); + TAppVersion version(0,0,0); + _LIT8(KDot,"."); + aMidletParameters.bufVersion.Num(version.iMajor); + aMidletParameters.bufVersion.Append(KDot); + aMidletParameters.bufVersion.AppendNum(version.iMinor); + } + CleanupStack::PopAndDestroy(regEntry); + } + CleanupStack::PopAndDestroy(javaRegistry); + CleanupStack::PopAndDestroy( &uids); + RDEBUG( "CApplicationManagementJavaUtility::GetInstalledMidletParametersL: End"); + } +// END OF FILE diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/ApplicationManagementJavaUtilityFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/ApplicationManagementJavaUtilityFactory.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,30 @@ +/* + * 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 applicationmanagement components + * + */ + +// CLASS HEADER +#include "ApplicationManagementUtilityFactory.h" +#include "ApplicationManagementJavaUtility.h" + +using namespace NApplicationManagement; + +// METHODS +CApplicationManagementUtility* ApplicationManagementUtilityFactory::CreateManagementUtilityL() + { + return CApplicationManagementJavaUtility::NewL(); + } + +// END OF FILE diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/ApplicationManagementServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/ApplicationManagementServer.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,3962 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#define __INCLUDE_CAPABILITY_NAMES__ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ampskeys.h" +#include "amprivateCRKeys.h" +#include "ApplicationManagementConst.h" +#include "ApplicationManagementCommon.h" +#include "ApplicationManagementClientServer.h" +#include "ApplicationManagementServer.h" +#include "AMDeploymentComponent.h" +#include "amsmlhelper.h" +#include "ApplicationManagementUtility.h" +#include "ApplicationManagementUtilityFactory.h" +#include "debug.h" +#include "coemain.h" +#include "AMPreInstallApp.h" +#include "amview.h" +#include "appmgmtnotifier.h" + +using namespace NApplicationManagement; + +#ifdef __AM_CONNECT_INSTALLER_ONSTARTUP_ + +#pragma message("AM Connecting installer at startup") +#else +#pragma message("AM Connecting installer when needed") +#endif +// Needed only for jad+jar installation +_LIT( KInstallDir, "c:\\temp\\" ); +_LIT8(KMIDletJarURL, "MIDlet-Jar-URL"); +//OMA SCOMO Specific +_LIT8(KDownloadState, "./SCOMO/Download/"); +_LIT8(KDeliveredState, "./SCOMO/Inventory/Delivered/"); +_LIT8(KDeployedState, "./SCOMO/Inventory/Deployed/"); + +//Package all the above together into a policy +CPolicyServer::TPolicy KApplicationManagementSecurityPolicy; + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::ComponentDownloadComplete() +// ------------------------------------------------------------------------------------------------ +void CApplicationManagementServer::ComponentDownloadComplete( + CDeploymentComponent *aComponent, TInt iapid, HBufC8 *aServerId) + { + TInt err = KErrNone; + TRAP( err, DownloadCompleteL( aComponent, iapid, aServerId )); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::DownloadCompleteL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::DownloadCompleteL( + CDeploymentComponent *aComponent, TInt iapid, HBufC8 *aServerId) + { + RDEBUG( "ApplicationManagementServer DownloadComplete - start" ); + __ASSERT_DEBUG( aComponent, User::Invariant() ); + iComp = aComponent; + iStorage->UpdateL(*aComponent); + TInt errdownload = KErrNone; + TInt errInstall = KErrNone; + TInt status = KStatusSuccess; + + if (!aComponent->DownloadFailed()) + { + CDeploymentComponent *old = DoDataUpdateCheckL(*aComponent); + TDownloadTarget trgt = aComponent->DownloadTarget(); + switch (trgt) + { + case EDeliver: + { + break; + } + case EInstall: + case EInstallAndActivate: + { + + TRAP(errInstall,DoTheInstallL( *aComponent)); +RDEBUG_2( "ApplicationManagementServer DownloadComplete - start %d", errInstall); + + if (trgt == EInstall && errInstall == KErrNone) + { + iStorage->DeactivateL(*aComponent); + } + break; + } + + case EUpdate: + case EUpdateAndActivate: + { + if (old) + { + FullUpdateL(*aComponent, *old); + if (trgt == EUpdate) + { + iStorage->DeactivateL(*aComponent); + } + } + break; + } + default: + { + break; + } + } + } + else + { + errdownload = aComponent->DownloadStatus(); + } + + RDEBUG( "ApplicationManagementServer DownloadComplete - Start Send to background" ); + //Download Completed/ Failed or installation success/ failure Send server to Background. + + iOMASCOMOEnabled = IsOMASCOMOEnabledL(); + + m_Window->lower(); + + if (iOMASCOMOEnabled) + { + status = GetErrorStatus(errdownload, errInstall); + + TInt ASyncSupported = -1; + + CRepository *repository = CRepository::NewLC( + KUidPSApplicationManagementKeys); + repository->Get(KAsyncEnabled, ASyncSupported); + CleanupStack::PopAndDestroy(); + + // For Sync Reporting + if (!ASyncSupported) + { + // Update Central Repository with proper error code for Sync + + CRepository *repository = CRepository::NewLC( + KUidPSApplicationManagementKeys); + repository->Set(KAMSyncStatus, status); + CleanupStack::PopAndDestroy(); + + RProperty counter; + + TInt r = counter.Attach(KUidPSApplicationManagementKeys, + KSyncNotifier, EOwnerThread); + User::LeaveIfError(r); + + TInt err = counter.Set(KErrCancel); + User::LeaveIfError(err); + counter.Close(); + } + else// Do AsyncReporting + { + + RDEBUG( "CApplicationManagementServer::ASync Reporting Step 1" ); + + // Get deployement component entries + TInt internalid = aComponent->InternalId(); + + RDEBUG( "CApplicationManagementServer::ASync Reporting Step 2" ); + + TBuf8<256> targetURI; + + TDeploymentComponentState state = aComponent->State(); + + RDEBUG( "CApplicationManagementServer::ASync Reporting Step 3" ); + + if (state == EDCSDownload) + { + + RDEBUG( "CApplicationManagementServer::ASync EDCSDownload Start" ); + + targetURI.Append(KDownloadState); + targetURI.Append(aComponent->UserId()); + + RDEBUG( "CApplicationManagementServer::ASync EDCSDownload End" ); + + } + else if (state == EDCSDelivered) + { + RDEBUG( "CApplicationManagementServer::ASync EDCSDelivered Start" ); + + targetURI.Append(KDeliveredState); + targetURI.Append(aComponent->UserId()); + + RDEBUG( "CApplicationManagementServer::ASync EDCSDelivered End" ); + + } + else if (state == EDCSActive || state == EDCSInactive) + { + + RDEBUG( "CApplicationManagementServer::ASync EDCSActive Start" ); + + targetURI.Append(KDeployedState); + targetURI.Append(aComponent->UserId()); + + RDEBUG( "CApplicationManagementServer::ASync EDCSActive End" ); + } + + //Save Entry to database with status and target URI of deployment component + TInt iapidval = 2; + TRAPD( err1, SmlHelper::GetDefaultIAPFromDMProfileL( iapid ) ); + if (err1 == KErrNone) + { + RDEBUG_2("Application Mgmt Server service::DownloadCompleteL iapid to : %d", iapid ); + } + + TInt index; + iAMServerDB->SaveToDatabaseL(index, internalid, status, + targetURI, iapidval); + + RDEBUG( "CApplicationManagementServer::ASync SaveToDatabaseL completed" ); + + EnableDMNetworkMonL(iapid, aServerId); + } + } + int value = 0 ; + int err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KDownloadActive, value); + RDEBUG_2("RProperty set (%d)", err ); + if (iDownloadMngr->DownloadCount() == 0) + { + + RDEBUG_2( "CApplicationManagementServer::ConstructL - ERROR leaving cannot connect installer: %d", iSessionCount ); + + // Is session count is not modified whenever there is error then at the end of download complete decrement + // the session count. + + if (status != KStatusSuccess && iSessionCount != 0) + { + iSessionCount--; + } + + if (iSessionCount == 0) + { + iShutdown.Start(); + } + } + aComponent->SetDriveSelectionStatus(false); + RDEBUG( "ApplicationManagementServer DownloadComplete - end" ); + } + +void CApplicationManagementServer::InstallationCancelled() + { + iInstaller.CancelOperation(); + } +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::IsOMASCOMOEnabledL() +// ------------------------------------------------------------------------------------------------ + +TBool CApplicationManagementServer::IsOMASCOMOEnabledL() + { + RDEBUG( "CApplicationManagementServer::IsOMASCOMOEnabledL Start" ); + + TInt adapterValue; + + CRepository *repository = CRepository::NewLC( + KCRUidPrivateApplicationManagementKeys); + repository->Get(KAMAdapterValue, adapterValue); + CleanupStack::PopAndDestroy(); + + RDEBUG( "CApplicationManagementServer::IsOMASCOMOEnabledL End" ); + + if (adapterValue == 0 || adapterValue == 1) + return EFalse; + else + return ETrue; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::GetErrorStatus() +// ------------------------------------------------------------------------------------------------ +TInt CApplicationManagementServer::GetErrorStatus(TInt aErrorDownload, + TInt aErrorInstall) + { + TInt status = KStatusSuccess; + + if (aErrorDownload != KErrNone) + { + if (aErrorDownload == KStatusUserCancelled || aErrorDownload + == KStatusDowloadFailedOOM || aErrorDownload + == KStatusUnSupportedEnvironment || aErrorDownload + == KStatusAlternateDownldAuthFail || aErrorDownload + == KStatusAltDowldUnavailable) + { + status = aErrorDownload; + } + else + status = KStatusDownloadFailed; + } + + else if (aErrorInstall != KErrNone) + { + if (aErrorInstall == SwiUI::KSWInstErrSecurityFailure) + status = KStatusPkgValidationFailed; + if (aErrorInstall == SwiUI::KSWInstErrInsufficientMemory) + status = KStatusInstallFailedOOM; + if (aErrorInstall == KStatusUserCancelled) + status = KStatusUserCancelled; + else + status = KStatusInstallFailed; + + } + + return status; + + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::EnableDMNetworkMonL() +// ------------------------------------------------------------------------------------------------ +void CApplicationManagementServer::EnableDMNetworkMonL(TInt iapid, + HBufC8 *aServerId) + { + TInt retryenabled = 1; + _LIT( KNetMon,"\\dmnetworkmon.exe" ); + + // Enable DM Network Monitoring for retry of Generic alert in case of N/W loss + + CRepository *repository = CRepository::NewLC( + KCRUidDeviceManagementInternalKeys); + TInt err_val = repository->Set(KDevManEnableDMNetworkMon, retryenabled); + RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL Retry enabled err: %d", err_val ); + RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL Retry enabled value: %d", retryenabled ); + + err_val = repository->Set(KDevManIapIdKey, iapid); + RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL devmaniapid: %d", err_val ); + RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL iap id: %d", iapid ); + + err_val = repository->Set(KDevManServerIdKey, *aServerId); + RDEBUG_2( "CApplicationManagementServer::EnableDMNetworkMonL serveridkey: %d", err_val ); + + TBuf<256> buf1; + buf1.Copy(*aServerId); + RDEBUG_2( "Server ID - '%S'", &buf1); + + CleanupStack::PopAndDestroy(); + + // create NetMon EXE + RProcess rp; + TInt err = rp.Create(KNetMon, KNullDesC); + User::LeaveIfError(err); + TRequestStatus stat; + rp.Rendezvous(stat); + + if (stat != KRequestPending) + rp.Kill(0); // abort startup + else + rp.Resume(); // logon OK - start the server + TInt r = (rp.ExitType() == EExitPanic) ? KErrGeneral : stat.Int(); + rp.Close(); + + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::CApplicationManagementServer +// ------------------------------------------------------------------------------------------------ + +inline CApplicationManagementServer::CApplicationManagementServer() : + CPolicyServer(0, KApplicationManagementSecurityPolicy, ESharableSessions) + { + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::AddSession() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::AddSession() + { + // A new session is being created + RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::AddSession" ); + ++iSessionCount; + + // Cancel the shutdown timer if it was running + iShutdown.Cancel(); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::DropSession() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::DropSession() + { + // A session is being destroyed + RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::DropSession" ); + + // Start the shutdown timer if it is the last session + if (--iSessionCount == 0) + { + if (iDownloadMngr->DownloadCount() > 0) + { + RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::DropSession download in progress" ); + } + else + { + iShutdown.Start(); + } + } + } + +// ----------------------------------------------------------------------------------------------------------- +// CApplicationManagementServer::AddDownloadL( CDeploymentComponent *aComponent ) +// ----------------------------------------------------------------------------------------------------------- + +void CApplicationManagementServer::AddDownloadL( + CDeploymentComponent *aComponent) + { + __ASSERT_DEBUG( aComponent, User::Invariant() ); + + RDEBUG( "CApplicationManagementServer::AddDownloadL Start" ); + + iDownloadMngr->AddDownloadL(aComponent); + + RDEBUG( "CApplicationManagementServer::AddDownloadL End" ); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer +// ----------------------------------------------------------------------------- + +CServer2* CApplicationManagementServer::NewL(HbMainWindow *mainWindow) + { + //specifies all connect attempts should pass + KApplicationManagementSecurityPolicy.iOnConnect + = CPolicyServer::EAlwaysPass; + KApplicationManagementSecurityPolicy.iRangeCount + = KApplicationManagementRangeCount; //number of ranges + KApplicationManagementSecurityPolicy.iRanges + = KApplicationManagementRanges; + KApplicationManagementSecurityPolicy.iElementsIndex + = KApplicationManagementSecurityElementsIndex; + KApplicationManagementSecurityPolicy.iElements + = KApplicationManagementSecurityElements; + + RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::NewLC" ); + + CApplicationManagementServer* self = + new (ELeave) CApplicationManagementServer; + CleanupStack::PushL(self); + + self->ConstructL(mainWindow); + CleanupStack::Pop(); + return self; + + } + +// ----------------------------------------------------------------------------- +// CApplicationManagementServer::~CApplicationManagementServer +// ------------------------------------------------------------------------------------------------ + +CApplicationManagementServer::~CApplicationManagementServer() + { + RDEBUG_3("CApplicationManagementServer::~CApplicationManagementServer 0x%X - 0x%X", reinterpret_cast(this ), + reinterpret_cast(this)+sizeof( CApplicationManagementServer ) ); + FeatureManager::UnInitializeLib(); + iInstaller.Close(); + delete iStorage; + + delete iUtility; + delete iAMServerDB; + + RProperty::Delete(KUidPSApplicationManagementKeys, KAMServerUIEnabled); + + RProperty::Delete(KUidPSApplicationManagementKeys, KAMOperationNonSilent); + + RProperty::Delete(KUidPSApplicationManagementKeys, KSyncNotifier); + + RProperty::Delete(KUidPSApplicationManagementKeys, KDMUINotClosed); + + iInstallFile.Close(); + iInstallRFs.Close(); + + delete iDownloadMngr; + + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::HandleAllClientsClosed +// ------------------------------------------------------------------------------------------------ +void CApplicationManagementServer::HandleAllClientsClosed() + { + // Do Nothing + RDEBUG( "CApplicationManagementServer::HandleAllClientsClosed" ); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::ConstructL +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::ConstructL(HbMainWindow* aWindow) + { + + // 2nd phase construction - ensure the timer and server objects are running + RDEBUG( "CApplicationManagementServer::ConstructL - Start" ); + + iOMASCOMOEnabled = ETrue; + mUserCancelled = 0; + TRAPD( errf, FeatureManager::InitializeLibL() ); + if (errf != KErrNone) + { + User::Leave(errf); + } + m_Window = aWindow; + RDEBUG( "CApplicationManagementServer::ConstructL - start" ); + StartL(KApplicationManagementServerName); + iStorage = CDeliveryComponentStorage::NewL(); + + iUtility + = ApplicationManagementUtilityFactory::CreateManagementUtilityL(); + iDownloadMngr = CAMDownloadStore::NewL(*this); + iAMServerDB = CAMDownloaddb::NewL(); + + // Define P&S Keys + RProperty::Define(KUidPSApplicationManagementKeys, KAMServerUIEnabled, + RProperty::EInt); + + RProperty::Define(KUidPSApplicationManagementKeys, KAMOperationNonSilent, + RProperty::EInt); + + RProperty::Define(KUidPSApplicationManagementKeys, KSyncNotifier, + RProperty::EInt); + + RProperty::Define(KUidPSApplicationManagementKeys, KDMUINotClosed, + RProperty::EInt); + + RProperty syncproperty; + + //Ignore error status + syncproperty.Attach(KUidPSApplicationManagementKeys, KSyncNotifier, + EOwnerThread); + syncproperty.Set(KErrNone); + syncproperty.Close(); + +#ifdef __AM_CONNECT_INSTALLER_ONSTARTUP_ + TInt err( iInstaller.Connect() ); + if ( err != KErrNone ) + { + RDEBUG_2( "CApplicationManagementServer::ConstructL - ERROR leaving cannot connect installer: %d", err ); + User::LeaveIfError( err ); + } +#endif + iShutdown.ConstructL(); + // ensure that the server still exits even if the 1st client fails to connect + iShutdown.Start(); + + RDEBUG( "CApplicationManagementServer::ConstructL - end" ); + } +//--------------------------------------------------------------------------- +// Create a new client session. +//--------------------------------------------------------------------------- +CSession2* CApplicationManagementServer::NewSessionL( + const TVersion& aVersion, const RMessage2& /*aMessage */) const + { + RDEBUG( "ApplicationManagementServer: CApplicationManagementServer::NewSessionL" ); + TVersion ver(KAMVerMajor, KAMVerMinor, KAMVerBuild); + if (!User::QueryVersionSupported(ver, aVersion)) + { + RDEBUG( "CApplicationManagementServer::NewSessionL(): wrong version offered -> BAIL OUT!" ); + User::Leave(KErrNotSupported); + } + return new (ELeave) CApplicationManagementSession(); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::CustomSecurityCheckL() +// ------------------------------------------------------------------------------------------------ + +CPolicyServer::TCustomResult CApplicationManagementServer::CustomSecurityCheckL( + const RMessage2& /*aMsg*/, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/) + { + return EPass; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::InstallCompleteL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::InstallCompleteL( + const CDeploymentComponent& aCompo, const TBool &aInstallSuccess) + { + RDEBUG_2("CApplicationManagementServer::InstallCompleteL start (%d)", aInstallSuccess); + + iInstallFile.Close(); + // if java jad + jar install, remove files from c:\temp directory + if (CDeploymentComponent::IsJavaMimeL(aCompo.MetaData().MimeType() ) && CDeploymentComponent::IsJavaMimeL(aCompo.Data().MimeType() ) ) + { + TFileName fn, fn2; + GenerateTempFileNameL(iInstallRFs, aCompo, fn, fn2); + RDEBUG_3("CApplicationManagementServer::InstallCompleteL delete files: (%S) (%S)", &fn, &fn2); + User::LeaveIfError(iInstallRFs.Delete(fn)); + User::LeaveIfError(iInstallRFs.Delete(fn2)); + } + TInt silentsession = 0; + TInt r2 = RProperty::Get(KPSUidNSmlSOSServerKey, KNSmlDMSilentJob, + silentsession); + + if(r2 == KErrNone) + CApplicationManagementUtility::iSilentSession = silentsession; + + if (!CApplicationManagementUtility::iSilentSession) + { + AppMgmtNotifier* note = new AppMgmtNotifier(m_appName); + if (aInstallSuccess) + { + note->showInstallSuccessNote(); + // Remove temporary files from private directory + const_cast (aCompo).ResetDataL(iInstallRFs); + } + else if(mUserCancelled == 0) + { + note->showInstallFailedNote(); + m_Window->lower(); + } + + delete note; + } + else + { + if (aInstallSuccess) + { + + const_cast (aCompo).ResetDataL(iInstallRFs); + m_Window->lower(); + } + } + + iInstallRFs.Close(); + + iInstallInProgress = EFalse; +#ifndef __AM_CONNECT_INSTALLER_ONSTARTUP_ + iInstaller.Close(); +#endif + RDEBUG("CApplicationManagementServer::InstallCompleteL end"); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::GenerateTempJarFileNameL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::GenerateTempJarFileNameL(RFs &aFs, + const TDesC& aMetaSource, TFileName &aFileName) const + { + if (aMetaSource != KNullDesC) + { + RFile file; + User::LeaveIfError(file.Open(aFs, aMetaSource, EFileRead)); + CleanupClosePushL(file); + TFileName temp; + temp = ReadJarFileNameL(file); + GenerateTempFileNameL(aFs, temp, aFileName); + CleanupStack::PopAndDestroy(&file); + } + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::GenerateTempFileNameL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::GenerateTempFileNameL(const RFs &aFs, + const TDesC& aSource, TFileName &aFileName) const + { + if (aSource != KNullDesC) + { + aFileName.Copy(KInstallDir); + TParse p; + User::LeaveIfError(aFs.Parse(aSource, p)); + aFileName.Append(p.NameAndExt()); + } + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::GenerateTempFileNameL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::GenerateTempFileNameL(RFs &aFs, + const CDeploymentComponent& aCompo, TFileName& aSource, + TFileName &aMetaSource, TFileName &aFileName, + TFileName &aMetaFileName) const + { + if (!BaflUtils::FolderExists(aFs, KInstallDir)) + { + aFs.MkDirAll(KInstallDir); + } + + aMetaSource.Copy(aCompo.MetaData().DataFileName()); + GenerateTempFileNameL(aFs, aMetaSource, aMetaFileName); + aSource.Copy(aCompo.Data().DataFileName()); + GenerateTempJarFileNameL(aFs, aMetaSource, aFileName); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::GenerateTempFileNameL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::GenerateTempFileNameL(RFs &aFs, + const CDeploymentComponent& aCompo, TFileName &aFileName, + TFileName &aMetaFileName) const + { + TFileName ftemp, msource; + GenerateTempFileNameL(aFs, aCompo, ftemp, msource, aFileName, + aMetaFileName); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::ReadJarFileNameL() +// ------------------------------------------------------------------------------------------------ + +TFileName CApplicationManagementServer::ReadJarFileNameL(RFile& aFile) const + { + TFileName jarFileName; + HBufC8* lineBuffer = HBufC8::NewLC(KMaxFileName + 72); // lets hope all lines fit to this + TPtr8 linePtr(lineBuffer->Des()); + TInt length(0); + aFile.Size(length); + HBufC8* data = HBufC8::NewLC(length); + TPtr8 ptr(data->Des()); + aFile.Read(ptr); + RDesReadStream stream(*data); + CleanupClosePushL(stream); + TInt colonIndex = -1; + TInt err(KErrNone); + TInt found(KErrNotFound); + const TInt KJadNameValueSeparator = 0x3A; //':' + + for (;;) + { + TRAP( err, ReadLineL(stream, linePtr) ); + if (err == KErrNone) + { + RDEBUG8_2("Read line: (%S)", &linePtr); + found = linePtr.Find(KMIDletJarURL); + if (found != KErrNotFound && found == 0) // found + { + TPtrC8 filename(linePtr); + colonIndex = linePtr.Locate(KJadNameValueSeparator); + if (colonIndex != KErrNotFound) + { + filename.Set(linePtr.Mid(colonIndex + 1)); // get jar filename, format is: MIDlet-Jar-URL: bomber.jar + jarFileName.Copy(filename); + jarFileName.Trim(); + break; + } + } + } + else + { + User::Leave(err); + } + } + CleanupStack::PopAndDestroy(3, lineBuffer); // stream, data + return jarFileName; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::ReadLineL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::ReadLineL(RReadStream& aStream, + TDes8& aLineBuffer) const + { + TBuf8<1> input; + const TUint32 LF = 10; + const TUint32 CR = 13; + TBool endOfLine(EFalse); + TInt errRead(KErrNone); + + // reset + aLineBuffer.Zero(); + + while (!endOfLine) + { + TRAP(errRead, aStream.ReadL(input, 1)); + + if (errRead == KErrEof) + { + // EOF + User::Leave(KErrEof); + } + // check special characters + if (input[0] == LF) + { + // End of line + endOfLine = ETrue; + } + else if (input[0] == CR) + { + // Only end of line if not followed by a LF + } + else + { + // We put any other character in the buffer + if (aLineBuffer.Length() < aLineBuffer.MaxLength()) + { + aLineBuffer.Append(input[0]); + } + } + } + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::PrepareInstallL() +// ------------------------------------------------------------------------------------------------ + +TBool CApplicationManagementServer::PrepareInstallL( + const CDeploymentComponent &aComponent, TFileName &aFileName) + { + RDEBUG( "CApplicationManagementServer::PrepareInstallL" ); + TBool res(ETrue); + +#ifndef __AM_CONNECT_INSTALLER_ONSTARTUP_ + TInt err(iInstaller.Connect()); + if (err != KErrNone) + { + RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - ERROR leaving cannot connect installer: %d", err ); + User::LeaveIfError(err); + } + CleanupClosePushL(iInstaller); +#endif + + RDEBUG( "CApplicationManagementServer::PrepareInstallL - connected to installer" ); + // Copy data file name (install file) + if (aComponent.Data().DataFileName().Length() > 0) + { + aFileName.Copy(aComponent.Data().DataFileName()); + } + else + { + // data file has not been created for component! + User::Leave(KErrNotFound); + } + // Open RFs session + User::LeaveIfError(iInstallRFs.Connect()); + User::LeaveIfError(iInstallRFs.ShareProtected()); + + // set installoptions and correct mime type + using namespace SwiUI; + iInstallOptions = aComponent.InstallOpts().iOptions; + TInstallReq req; + if (aComponent.Data().MimeType() == SwiUI::KSisMimeType) + { + //convert if MIME type is application/vnd.symbian.install to x-epoc/x-sisx-app + //as installer doesn't support application/vnd.symbian.install MIME type from S60 3rd edition onwards. + req.iMIME = SwiUI::KSisxMimeType; + } + else + { + req.iMIME = aComponent.Data().MimeType(); + } + + if (CDeploymentComponent::IsJavaMimeL(aComponent.MetaData().MimeType())) + { + // Check if both jad and jar files already exist in the phone + if (CDeploymentComponent::IsJavaMimeL(aComponent.Data().MimeType()) + && aComponent.MetaData().MimeType() == SwiUI::KJadMIMEType) + { + // Move both files to temporary location and use jad to install java application + CFileMan *fm = CFileMan::NewL(iInstallRFs); + CleanupStack::PushL(fm); + TFileName source, metasource, metatarget; + aFileName.Copy(KNullDesC8()); // reset + GenerateTempFileNameL(iInstallRFs, aComponent, source, + metasource, aFileName, metatarget); + + RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - temp jar file '%S'", &aFileName ); + RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - temp jad file '%S'", &metatarget ); + + // Copy datafile (jar) + TInt copyer(fm->Copy(source, aFileName)); + + // Copy metadatafile (jad) + TInt copyer2(fm->Copy(metasource, metatarget)); + + CleanupStack::PopAndDestroy(fm); + + RDEBUG_3( "CApplicationManagementServer::PrepareInstallL - (%d)-(%d)", copyer, copyer2 ); + + if (copyer == KErrNone && copyer2 == KErrNone) + { + res = ETrue; + aFileName = metatarget; + req.iMIME = aComponent.MetaData().MimeType(); + } + else + { + User::Leave(KErrWrite); + } + } + else if (aComponent.MetaData().MimeType() == SwiUI::KJadMIMEType) + { + aFileName.Copy(aComponent.MetaData().DataFileName()); + req.iMIME = aComponent.MetaData().MimeType(); + RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - Using Jad file to install java application: %S", &aFileName ); + } + } + + if (aComponent.GetIAP() > -1) + { + req.iIAP = aComponent.GetIAP(); + RDEBUG_2( "CApplicationManagementServer::PrepareInstallL: setting iap to %d", req.iIAP ); + } + else + { + TInt iap = KErrNotFound; + TRAPD( err, SmlHelper::GetDefaultIAPFromDMProfileL( iap ) ); + if (err == KErrNone) + { + req.iIAP = iap; + RDEBUG_2(" -> using DM profile default IAP: %d", iap); + } + else + { + RDEBUG_2("**** ERROR while fetching DM profile default iap: %d", err ); + } + } + + iInstallReq = SwiUI::TInstallReqPckg(req); + RDEBUG8_2( "CApplicationManagementServer::PrepareInstallL: mime type is (%S)", &req.iMIME); + RDEBUG_2( "CApplicationManagementServer::PrepareInstallL - Using temp file '%S'", &aFileName ); + + User::LeaveIfError(iInstallFile.Open(iInstallRFs, aFileName, EFileRead)); + TInt sz; + User::LeaveIfError(iInstallFile.Size(sz)); + if (!(sz > 0)) + { + res = EFalse; + RDEBUG( "CApplicationManagementServer::PrepareInstallL - ERROR size of source file is 0!" ); + } + +#ifndef __AM_CONNECT_INSTALLER_ONSTARTUP_ + CleanupStack::Pop(&iInstaller); +#endif + + RDEBUG( "CApplicationManagementServer::PrepareInstallL end" ); + + iAppname = aFileName; + + return res; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::InstallL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::InstallL( + const CDeploymentComponent &aComponent, TRequestStatus &aStatus) + { + RDEBUG( "CApplicationManagementServer::InstallL (async): begin" ); + + if (iInstallInProgress == EFalse) + { + TFileName fn; + TInt type = EInstallWaitDlg; + TInt silentsession = 0; + TInt r2 = RProperty::Get(KPSUidNSmlSOSServerKey, KNSmlDMSilentJob, + silentsession); + + if(r2 == KErrNone) + CApplicationManagementUtility::iSilentSession = silentsession; + + if (!CApplicationManagementUtility::iSilentSession) + { + m_Dlg = new AMWaitProgDialog(m_appName, *this); + m_Dlg->createWaitDialog(type); + if (CApplicationManagementUtility::mHidden == 1) + { + m_Dlg->startIndicator(); + } + else + { + m_Window->raise(); + CApplicationManagementUtility::mCurrDlg->setVisible(true); + } + } + if (PrepareInstallL(aComponent, fn)) + { + if (m_Dlg) + m_Dlg->registerInstallRequest(aStatus); + delete iArgu; + iArgu = NULL; + iArgu = Usif::COpaqueNamedParams::NewL(); + iArgu->AddIntL(Usif::KSifInParam_InstallSilently, 1); + TAMInstallOptions opts = aComponent.InstallOpts(); + TChar drive = opts.iOptions.iDrive; + RFs iFs; + TInt driveNumber; + iFs.CharToDrive(drive,driveNumber); + + iArgu->AddIntL(Usif::KSifInParam_Drive, driveNumber); + + delete iResults; + iResults = NULL; + iResults = Usif::COpaqueNamedParams::NewL(); + + RDEBUG_3( "CApplicationManagementServer::InstallL: Install '%S' sizeof opts: %d", &fn, sizeof (aComponent.InstallOpts())); + TRAPD( err ,iInstaller.Install( iInstallFile, *iArgu, *iResults, aStatus ) ); + + RDEBUG_2( "CApplicationManagementServer::InstallL: status: %d", err); + User::LeaveIfError(err); + iInstallInProgress = ETrue; + } + else + { + RDEBUG( "CApplicationManagementServer::InstallL - PrepareInstallL failed, leaving" ); + User::Leave(KErrArgument); + } + } + else + { + RDEBUG( "CApplicationManagementServer::InstallL (async): previous install still in progress...bailing out" ); + TRequestStatus * status = &aStatus; + User::RequestComplete(status, KErrInUse); + } + RDEBUG( "CApplicationManagementServer::InstallL (async): end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::PrepareInstallL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::InstallL( + const CDeploymentComponent &aComponent) + { + RDEBUG( "CApplicationManagementServer::InstallL: begin" ); + + if (iInstallInProgress == EFalse) + { + TFileName fn; + if (PrepareInstallL(aComponent, fn)) + { + iInstallInProgress = ETrue; + RDEBUG_2( "CApplicationManagementServer::InstallL: Install '%S' ", &fn); + SwiUI::TInstallOptionsPckg pkg(aComponent.InstallOpts().iOptions); + iInstallInProgress = EFalse; + } + else + { + RDEBUG( "CApplicationManagementServer::InstallL - PrepareInstallL failed, leaving" ); + User::Leave(KErrArgument); + } + } + RDEBUG( "CApplicationManagementServer::InstallL: end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::UninstallL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::UninstallL( + const CDeploymentComponent &aComponent, TRequestStatus &aStatus) + { + RDEBUG( "CApplicationManagementServer::UninstallL: begin" ); + if (iInstallInProgress == EFalse) + { + TInt err(iInstaller.Connect()); + User::LeaveIfError(err); + RDEBUG_2( "CApplicationManagementServer::UninstallL: UninstallL '0x%X' ", aComponent.Uid()); + using namespace SwiUI; + iUninstallOptions = aComponent.UninstallOpts(); + + delete iArgu; + iArgu = NULL; + iArgu = Usif::COpaqueNamedParams::NewL(); + iArgu->AddIntL( Usif::KSifInParam_InstallSilently, 1 ); + + delete iResults; + iResults = NULL; + iResults = Usif::COpaqueNamedParams::NewL(); + TRAP( err ,iInstaller.Uninstall( aComponent.GetComponentId(), *iArgu, *iResults, aStatus )); + + RDEBUG_2( "CApplicationManagementServer::UninstallL: UninstallL result '0x%X'", err ); + User::LeaveIfError(err); + iInstallInProgress = ETrue; + } + else + { + RDEBUG( "CApplicationManagementServer::UninstallL: previous uninstall still in progress...bailing out" ); + TRequestStatus * status = &aStatus; + User::RequestComplete(status, KErrInUse); + } + + RDEBUG( "CApplicationManagementServer::UninstallL: end" ); + } +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::PerformRFSL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::PerformRFSL() + { + RDEBUG( "CApplicationManagementServer::PerformRFSL: begin" ); + const RComponentIdArray &arrt = iStorage->GetComponentIds(); + TCertInfoPckg *corcert = NULL; + for (TInt i(0); i < arrt.Count(); i++) + { + RDEBUG_3( "CApplicationManagementServer::PerformRFSL processing dc %d of %d", i, arrt.Count() ); + CDeploymentComponent &c = iStorage->ComponentL(arrt[i]); + + const RCertArray &certs = iStorage->Certificates(); + TInt index = c.Owner(); + TCertInfoPckg *certp = NULL; + if (index >= 0) + { + certp = certs[c.Owner()]; + } + if (!corcert && certp) + { + if (CheckCertL((*certp)())) + { + corcert = certp; + RDEBUG_2( "CApplicationManagementServer::PerformRFSL Found CORP Cert! Removing %d ", i ); + RemoveInternalL(c); + } + else + { + RDEBUG_2( "CApplicationManagementServer::PerformRFSL skipping %d because not corp dc", i ); + } + } + else + { + if (corcert == certp) + { + RDEBUG_2( "CApplicationManagementServer::PerformRFSL Removing %d ", i ); + RemoveInternalL(c); + } + else + { + RDEBUG_2( "CApplicationManagementServer::PerformRFSL skipping %d because not corp dc", i ); + } + } + } + RDEBUG( "CApplicationManagementServer::PerformRFSL: end" ); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::RemoveInternalL() +// ------------------------------------------------------------------------------------------------ + + +void CApplicationManagementServer::RemoveInternalL( + const CDeploymentComponent &aCompo, TBool aDoUninstall /* = ETrue */) + { + RDEBUG_2("CApplicationManagementServer: RemoveInternalL - Remove id: (%d)", aCompo.InternalId() ); + TInt err(KErrNone); + TDeploymentComponentName name = aCompo.ComponentName(); + TBuf ne; + ne.Copy(name); + m_appName = QString::fromUtf16(ne.Ptr(), ne.Length()); + + RDEBUG("CApplicationManagementServer: RemoveInternalL - step1"); + + TInt err1 = KErrNone; + if (!err1) + { + RDEBUG("CApplicationManagementServer: RemoveInternalL - step2"); + + aCompo.SetStatusNode(EDelivered_RemoveProgress); + + TDeploymentComponentState st(aCompo.State()); + if (st == EDCSDelivered || st == EDCSDownload) + { + RDEBUG("CApplicationManagementServer: RemoveInternalL - step3 start"); + TRAP(err,iStorage->RemoveL( aCompo.InternalId() )); + RDEBUG("CApplicationManagementServer: RemoveInternalL - step4 start"); + } + else if (st == EDCSActive || st == EDCSInactive) + { + RDEBUG("CApplicationManagementServer: RemoveInternalL - step5 start"); + if (aDoUninstall) + { + if (aCompo.Uid() != TUid::Null()) + { + TInt nonSilentOperation = KErrNotFound; + iOMASCOMOEnabled = IsOMASCOMOEnabledL(); + if (!iOMASCOMOEnabled) + nonSilentOperation = 0; + RDEBUG("CApplicationManagementServer: RemoveInternalL - step5 start 1"); + + TInt silentsession = 0; + RProperty::Get(KPSUidNSmlSOSServerKey, KNSmlDMSilentJob, + silentsession); + + CApplicationManagementUtility::iSilentSession + = silentsession; + TRequestStatus s1 = KRequestPending; + AppMgmtNotifier* note = new AppMgmtNotifier(m_appName); + + // displaying uninstall confirm notes + if (!CApplicationManagementUtility::iSilentSession) + { + CDialogWait* wait = CDialogWait::NewL(); + note->showUninstallDialog(aCompo, wait->iStatus); + m_Window->raise(); + wait->StartWait(); + s1=wait->iStatus; + delete wait; + } + if (s1 != KStatusUserCancelled) + { + TInt type = EUninstallWaitDlg; + TRequestStatus s; + if (!CApplicationManagementUtility::iSilentSession) + { + m_Dlg = new AMWaitProgDialog(m_appName, *this); + m_Dlg->createWaitDialog(type); + m_Window->raise(); + CApplicationManagementUtility::mCurrDlg->setVisible( + true); + + } + CDialogWait* wait1 = CDialogWait::NewL(); + + TRAP(err,UninstallL( aCompo, wait1->iStatus )); + //wait till uninstall completes + wait1->StartWait(); + if (!CApplicationManagementUtility::iSilentSession) + m_Dlg->closeAMWaitDialog(); + m_Window->lower(); + s = wait1->iStatus; + delete wait1; + iInstallInProgress = EFalse; + // Capturing Installer errors,if any + err = s.Int(); + if (s.Int() == KErrNone) + { + note->showUnInstallSuccessNote(); + RDEBUG("CApplicationManagementServer::RemoveInternalL Uninstalled"); + } + else + { + note->showUnInstallFailedNote(); + if (s.Int() == KErrNotFound) + { + RDEBUG( "CApplicationManagementServer: RemoveInternalL WARNING component was not found by uninstaller" ); + } + else + { + RDEBUG_2("CApplicationManagementServer: RemoveInternalL ERROR uninstall failed %d", s.Int() ); + } + } + } + else + { + err = SwiUI::KSWInstErrUserCancel; + aCompo.SetStatusNode(EDelivered_RemoveFailed); + RDEBUG( "CApplicationManagementServer: RemoveInternalL User cancelled" ); + } + delete note; + } + else + { + RDEBUG( "CApplicationManagementServer: RemoveInternalL ERROR component is deployed but has null uid - it cannot be uninstalled!" ); + } + } + else + { + RDEBUG_2("CApplicationManagementServer: RemoveInternalL - Skipped uninstall of %d", aCompo.InternalId() ); + } + /* + * if (unstall is sucesss) then remove component from storage + * + */ + if (err == KErrNone) + { + iStorage->RemoveL(aCompo.InternalId()); + } + } + else + { + RDEBUG_2("CApplicationManagementServer: RemoveInternalL ERROR called with illegal state component id %d", aCompo.State() ); + User::Leave(KErrArgument); + } + /* + * if error set state to remove failed + * Finally call userleaveiferror() + * */ + if (err != KErrNone) + { + aCompo.SetStatusNode(EDelivered_RemoveFailed); + } + } + else + { + err = SwiUI::KSWInstErrUserCancel; + aCompo.SetStatusNode(EDelivered_RemoveFailed); + } + + User::LeaveIfError(err); + } + + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::CheckCertL() +// ------------------------------------------------------------------------------------------------ + +TBool CApplicationManagementServer::CheckCertL(const TCertInfo &aInfo) const + { + TBool go(EFalse); + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + // #ifdef __SAP_POLICY_MANAGEMENT + RPolicyEngine peng; + + // The management session + // + TInt err(peng.Connect()); + + if (err == KErrNone) + { + CleanupClosePushL(peng); + RPolicyRequest rq; + err = rq.Open(peng); + if (err == KErrNone) + { + CleanupClosePushL(rq); + + TRequestContext rc; + + using namespace PolicyEngineXACML; + using namespace NPolicyConstants; + + rc.AddSubjectAttributeL(KTrustedSubject, aInfo); + rc.AddResourceAttributeL(KResourceId, KApplicationManagement, + KStringDataType); + + TResponse resp; + err = rq.MakeRequest(rc, resp); + if (err == KErrNone) + { + if (resp.GetResponseValue() == EResponsePermit +#ifdef _DEBUG + || resp.GetResponseValue() + == EResponseNotApplicable +#endif + ) + { + go = ETrue; + } + else + { + RDEBUG_2( "CApplicationManagementSession::CheckCertL; Policy response denies access! %d", resp.GetResponseValue()); + } + } + else + { + RDEBUG_2( "CApplicationManagementSession::CheckCertL; ERROR making policy request! %d", err); + } + CleanupStack::PopAndDestroy(&rq); + } + else + { + RDEBUG_2( "CApplicationManagementSession::CheckCertL; ERROR Failed to open policy engine session! %d", err); + } + CleanupStack::PopAndDestroy(&peng); + } + else + { + RDEBUG_2( "CApplicationManagementSession::CheckCertL; ERROR Failed to connect policy engine! %d", err); + } + User::LeaveIfError(err); + } + else + { + RDEBUG( "CApplicationManagementSession::CheckCertL; No PolicyManagement by featmgr-> cert ok!" ); + go = ETrue; + } + return go; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::HasUidL() +// ------------------------------------------------------------------------------------------------ + +TBool CApplicationManagementServer::HasUidL(const TUid &aUid, + CDeploymentComponent *& aCompo, CDeploymentComponent *aIgnored /* = NULL */) + { + TBool found(EFalse); + const RComponentIdArray &arrt = iStorage->GetComponentIds(); + TInt count(arrt.Count()); + for (TInt i(0); i < count; i++) + { + CDeploymentComponent &compo = iStorage->ComponentL(arrt[i]); + if (compo.Uid() == aUid) + { + if (&compo != aIgnored) + { + aCompo = &compo; + found = ETrue; + RDEBUG_3( "ApplicationManagementServer: UidExistsL 0x%X - Found NOT ignored %d", aUid.iUid, compo.InternalId() ); + } + else + { + RDEBUG( "ApplicationManagementServer: UidExistsL - Found ignored " ); + } + } + } + if (!found) + { + found = FindInstalledSisUidL(aUid); + if (!found) + { + found = FindInstalledJavaUidL(aUid); + } + } + return found; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::FindInstalledSisUidL() +// ------------------------------------------------------------------------------------------------ + +TBool CApplicationManagementServer::FindInstalledSisUidL(const TUid &aUid) const + { + TBool found(EFalse); + Swi::RSisRegistrySession sisses; + TInt r(sisses.Connect()); + User::LeaveIfError(r); + CleanupClosePushL(sisses); + + RArray uids; + sisses.InstalledUidsL(uids); + CleanupClosePushL(uids); + + TInt uidc(uids.Count()); + for (TInt j(0); found == EFalse && j < uidc; j++) + { + if (uids[j] == aUid) + { + found = ETrue; + } + } + CleanupStack::PopAndDestroy(&uids); + CleanupStack::PopAndDestroy(&sisses); + + return found; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::FindInstalledJavaUidL() +// ------------------------------------------------------------------------------------------------ + +TBool CApplicationManagementServer::FindInstalledJavaUidL(const TUid &aUid) const + { + TBool found(EFalse); + iUtility->RefreshJavaRegistryL(); + found = iUtility->FindInstalledJavaUidL(aUid); + return found; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::FindNewUid() +// ------------------------------------------------------------------------------------------------ + +TUid CApplicationManagementServer::FindNewUid(const RArray &aUidsOrig, + const RArray &aUidsNew) const + { + TUid ret(TUid::Null()); + TInt c1(aUidsOrig.Count()); + TInt c2(aUidsNew.Count()); + if (c2 >= c1) + { + for (TInt i(c2 - 1); i >= 0 && !ret.iUid; i--) + { + if (aUidsOrig.Find(aUidsNew[i]) == KErrNotFound) + { + ret = aUidsNew[i]; + } + } + } + return ret; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::JavaUidsL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::JavaUidsL(RArray &aUids) const + { + iUtility->RefreshJavaRegistryL(); + iUtility->JavaUidsL(aUids); + } + +void CApplicationManagementServer::CheckforDuplicateMidletsL( + TMidletParameters& amidletParameters) + { + RDEBUG( "CApplicationManagementServer::CheckforDuplicateMidletsL: Start"); + const RComponentIdArray &arrt = iStorage->GetComponentIds(); + TInt cont(arrt.Count()); + for (TInt i( 0); i < cont; i++) + { + CDeploymentComponent &compo = iStorage->ComponentL(arrt[i]); + if (((compo.State() == EDCSActive) || (compo.State() == EDCSInactive )) + && (compo.MidletName()== amidletParameters.iMidletName) + && (compo.MidletVendor()== amidletParameters.iMidletVenorName)) + { + //remove old one + iStorage->RemoveL(compo.InternalId() ); + } + } + + RDEBUG( "CApplicationManagementServer::CheckforDuplicateMidletsL: End"); + } +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::JavaInstallL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::JavaInstallL(CDeploymentComponent &aCompo) + { + RDEBUG( "CApplicationManagementServer::JavaInstallL: Start"); + + //TRequestStatus s; + TInt err(KErrNone); + // set state to install progressf + CDialogWait* wait = CDialogWait::NewL(); + aCompo.SetStatusNode(EDelivered_InstallProgress); + TRAP(err,InstallL( aCompo,wait->iStatus )); + if (err != KErrNone) + { + aCompo.SetStatusNode(EDelivered_InstalledFailedWithData); + User::Leave(err); + } + wait->StartWait(); + if (!CApplicationManagementUtility::iSilentSession && CApplicationManagementUtility::mCurrDlg) + m_Dlg->closeAMWaitDialog(); + m_Window->lower(); + TRequestStatus s1 = wait->iStatus; + delete wait; + RDEBUG_2( "ApplicationManagementSession: JavaInstallL 1 failed with code %d", + s1.Int() ); + + TInt usifdeplid = -1; + if (iResults && wait->iStatus.Int()!=KErrCancel) + { + iResults->GetIntByNameL(Usif::KSifOutParam_ComponentId, usifdeplid); + RDEBUG_2( "ApplicationManagementSession: JavaInstallL usifdeplid %d", + usifdeplid); + + } + RDEBUG( "wait->StartWait() CApplicationManagementServer::javainstallL Step3"); + + aCompo.SetComponentId(usifdeplid); + + s1 = wait->iStatus; + delete wait; + RDEBUG_2("ApplicationManagementSession: javainstallL with code %d", + s1.Int() ); + if (s1 == KErrCancel) + { + RDEBUG_2( "ApplicationManagementSession: JavaInstallL failed with code %d", + s1.Int() ); + // set state to install failed with data + aCompo.SetStatusNode(EDelivered_InstalledFailedWithData); + User::Leave(s1.Int()); + } + else + { + TMidletParameters midletParameters; + iUtility->RefreshJavaRegistryL(); + //Ignore if any error comes + TRAPD(err,iUtility->GetInstalledMidletParametersL(midletParameters)); + TRAP(err,CheckforDuplicateMidletsL(midletParameters)); + + if (err != KErrNone) + { + aCompo.SetStatusNode(EDelivered_InstalledFailedWithData); + User::Leave(err); + } + else + { + aCompo.SetStatusNode(EIdle); + } + aCompo.SetUid(midletParameters.iMidletUid); + + RDEBUG( "CApplicationManagementServer::JavaInstallL: Step1"); + if (aCompo.ComponentVersion() == KNullDesC8) + { + aCompo.SetVersionL(midletParameters.bufVersion); + + } + + TBool status = EFalse; + + //Since "C" drive is not removable + + if (midletParameters.iDrive != EDriveC) + { + status = IsInstalledAppRemovableL(midletParameters.iDrive); + } + if (status) + { + RDEBUG( "IsInstalledAppRemovableL(midletParameters.iDrive); True"); + } + else + { + RDEBUG( "IsInstalledAppRemovableL(midletParameters.iDrive); False"); + } + + //check for status drive + aCompo.SetAppRemovableStatus(status); + } + + RDEBUG( "CApplicationManagementServer::JavaInstallL: End"); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::SisInstallL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::SisInstallL( + const CDeploymentComponent &aCompo) + { + TRequestStatus s; + CDialogWait* wait = CDialogWait::NewL(); + // set state to install progress + aCompo.SetStatusNode(EDelivered_InstallProgress); + TInt err(KErrNone); + TRAP(err,InstallL( aCompo,wait->iStatus )); + if (err != KErrNone) + { + aCompo.SetStatusNode(EDelivered_InstalledFailedWithData); + User::Leave(err); + } + RDEBUG_2("ApplicationManagementSession: SisInstallL failed with code before startwait %d", + wait->iStatus.Int() ); + wait->StartWait(); + RDEBUG_2("ApplicationManagementSession: SisInstallL failed with code after startwait %d", + wait->iStatus.Int() ); + RDEBUG( "wait->StartWait() CApplicationManagementServer::SisInstallL Step1"); + if (!CApplicationManagementUtility::iSilentSession && CApplicationManagementUtility::mCurrDlg) + m_Dlg->closeAMWaitDialog(); + delete m_Dlg; + m_Dlg=NULL; + RDEBUG( "wait->StartWait() CApplicationManagementServer::SisInstallL Step2"); + + m_Window->lower(); + + TInt usifdeplid = -1; + if (iResults && wait->iStatus.Int()!=KErrCancel) + iResults->GetIntByNameL(Usif::KSifOutParam_ComponentId, usifdeplid); + + RDEBUG( "wait->StartWait() CApplicationManagementServer::SisInstallL Step3"); + + iComp->SetComponentId(usifdeplid); + + TRequestStatus s1 = wait->iStatus; + delete wait; + RDEBUG_2("ApplicationManagementSession: SisInstallL with code %d", + s1.Int() ); + + if(s1 == KErrCancel) + { + s1 = KStatusUserCancelled; + RDEBUG( "KErrCancel visited operation cancelled"); + mUserCancelled=1; + } + if (s1 != KErrNone) + { + RDEBUG_2("ApplicationManagementSession: SisInstallL failed with code %d", + s1.Int() ); + // set state to install failed with data + aCompo.SetStatusNode(EDelivered_InstalledFailedWithData); + User::Leave(s1.Int()); + } + else + { + // set state to install sucessful + aCompo.SetStatusNode(EIdle); + RDEBUG("ApplicationManagementSession: SisInstallL successfull" ); + } + RDEBUG( "CApplicationManagementServer::SisInstallL: End"); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::DoTheInstallL() +// ---------------------------------------------------- -------------------------------------------- + +void CApplicationManagementServer::DoTheInstallL(CDeploymentComponent &aCompo) + { + RDEBUG( "CApplicationManagementServer::DoTheInstallL: Start"); + TInt error(KErrNone); + iComp = &aCompo; + + TDeploymentComponentName name = aCompo.ComponentName(); + if(name.Compare(KNullDesC8())==0) + { + name = aCompo.UserId(); + } + TBuf nameBuf; + nameBuf.Copy(name); + m_appName = QString::fromUtf16(nameBuf.Ptr(), nameBuf.Length()); + + TRequestStatus stat = KErrCompletion; + if (!aCompo.DriveSelected() + && !CApplicationManagementUtility::iSilentSession) + { + // displaying install confirm notes + CDialogWait* ao = CDialogWait::NewL(); + AppMgmtNotifier* note = new AppMgmtNotifier(); + int err = KErrNone; + TRAP( err, QT_TRYCATCH_LEAVING(note->showInstallDialog(iComp, ao->iStatus))); + ao->StartWait(); + stat = ao->iStatus; + delete ao; + m_Window->lower(); + delete note; + } + aCompo.SetDriveSelectionStatus(false); + if (stat == KErrCompletion) + { + if (CDeploymentComponent::IsJavaMimeL(aCompo.Data().MimeType()) + || CDeploymentComponent::IsJavaMimeL( + aCompo.MetaData().MimeType())) + { + TRAP( error, JavaInstallL( aCompo ) ); + } + else + { + TRAP( error, SisInstallL( aCompo ) ); + if(error==KErrNone) + { + SetSisAppVersionAndDriveL(aCompo); + } + } + + + + if (error == KErrNone) + { + InstallCompleteL(aCompo, ETrue); + CDeploymentComponent *old = DoDataUpdateCheckL(aCompo); + if (old) + { + if (aCompo.State() == EDCSDelivered) + { + if (old->State() == EDCSActive || old->State() + == EDCSInactive) + { + RDEBUG("AMSession: DoTheInstallL ** deleting old node **" ); + iStorage->RemoveL(old->InternalId()); + } + } + } + iStorage->InstalledL(aCompo); + } + else + { + InstallCompleteL(aCompo, EFalse); + User::Leave(error); + } + } + else + { + aCompo.SetStatusNode(EDelivered_InstallFailedwithOutData); + } + + RDEBUG( "CApplicationManagementServer::DoTheInstallL: End"); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::DoDataUpdateCheckL() +// ------------------------------------------------------------------------------------------------ + +CDeploymentComponent *CApplicationManagementServer::DoDataUpdateCheckL( + CDeploymentComponent &aCompo) + { + CDeploymentComponent *old = NULL; + if (aCompo.Uid() != TUid::Null() && HasUidL(aCompo.Uid(), old, &aCompo)) + { + // check for Uid component.. Legacy code removed. + } + return old; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::SetDataL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::SetDataL(CDeploymentComponent &aCompo, + const TDesC8 &aData, const TDesC8 &aMime) + { + aCompo.SetDataL(aData, aMime); + DoDataUpdateCheckL(aCompo); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::FullUpdateL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::FullUpdateL(const TUint32 sid, + const TUint32 tid) + { + CDeploymentComponent &scompo = iStorage->ComponentL(sid); + CDeploymentComponent &tcompo = iStorage->ComponentL(tid); + FullUpdateL(scompo, tcompo); + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::FullUpdateL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::FullUpdateL(CDeploymentComponent &scompo, + const CDeploymentComponent &tcompo) + { + if (scompo.State() == EDCSDelivered) + { + if (tcompo.State() == EDCSActive || tcompo.State() == EDCSInactive) + { + TRequestStatus s2; + InstallL(scompo, s2); + User::WaitForRequest(s2); + if (s2 != KErrNone) + { + RDEBUG_2( "ApplicationManagementSession: FullUpdateL failed with code %d", s2.Int() ); + User::Leave(s2.Int()); + } + else + { + InstallCompleteL(scompo); + // Before deleting old node ,copy node values which are not set in new node from old node + if (scompo.ComponentId() == KNullDesC8) + scompo.SetIdL(tcompo.ComponentId()); + + if (scompo.ComponentName() == KNullDesC8) + scompo.SetNameL(tcompo.ComponentName()); + + if (scompo.ComponentVersion() == KNullDesC8) + scompo.SetVersionL(tcompo.ComponentVersion()); + + //Tag tcompo state for deletion. Cant delete now, since nsmldmtree woudnt be updated + //Remove the const'ness since state needs to be updated. + + iStorage->SetDeploymentComponentState( + const_cast (tcompo), + EDCSDelete); + + iStorage->InstalledL(scompo); + RDEBUG( "ApplicationManagementSession: FullUpdateL ok" ); + } + } + else + { + RDEBUG_2( "ApplicationManagementSession: ERROR FullUpdateL called for illegal state component: %d!", scompo.State() ); + User::Leave(KErrArgument); + } + } + else + { + RDEBUG( "ApplicationManagementSession: ERROR FullUpdateL called for illegal state message!" ); + User::Leave(KErrArgument); + } + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementServer::IsDataFileB64EncodedL() +// ------------------------------------------------------------------------------------------------------------------- +TBool CApplicationManagementServer::IsDataFileB64EncodedL(RFile &aFile, + TInt& aLength) + { + RDEBUG("CApplicationManagementServer::IsDataFileB64EncodedL() : start"); + TBool encoded = ETrue; // assume b64 encoded + TInt bufSize(KBase64BufSize); + TInt offset(0); + HBufC8 *dataBuf = HBufC8::NewLC(bufSize); + TPtr8 dataPtr = dataBuf->Des(); + aFile.Size(aLength); + aFile.Seek(ESeekStart, offset); + + while (encoded) + { + aFile.Read(dataPtr); + if (!dataPtr.Length()) + { + break; + } + offset = 0; + aFile.Seek(ESeekCurrent, offset); + RDEBUG_2("OFFSET: %d", offset); + encoded = CheckB64Encode(dataPtr); + } + RDEBUG_2("Encoded: %d", encoded); + CleanupStack::PopAndDestroy(dataBuf); + offset = 0; + aFile.Seek(ESeekStart, offset); + + RDEBUG("CApplicationManagementServer::IsDataFileB64EncodedL() : end"); + return encoded; + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementServer::CheckB64Encode( const TDesC8& aData ) +// ------------------------------------------------------------------------------------------------------------------- +TBool CApplicationManagementServer::CheckB64Encode(const TDesC8& aData) + { + TInt inputIndex = 0; + TInt inputLen = aData.Length(); + + while (inputIndex < inputLen) + { + const TUint8& p = aData[inputIndex]; + + if ((p >= 48 && p <= 57) || (p >= 65 && p <= 90) || (p >= 97 && p + <= 122) || p == 43 || p == 47 || p == 61 || p == 10 || p + == 13) + { + } + else + { + return EFalse; + } + + inputIndex++; + + } + + return ETrue; + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::GetAMServerDownloadDBL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::GetAMServerDownloadDBL(TUint32 internalid, + TInt& finalresult, TDes8& aTargetURI) + { + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step1" ); + + TBuf<50> internalidbuf; + + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step2" ); + internalidbuf.Num(internalid); + + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step3" ); + + RPointerArray aItemArray; + + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step4" ); + + iAMServerDB->GetEntryForLUIDL(aItemArray, internalidbuf); + + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step5" ); + + if (aItemArray.Count() != 0) + { + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step6" ); + + finalresult = aItemArray[0]->iResult; + + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step7" ); + + if (finalresult < KErrNone) + User::Leave(KErrGeneral); + + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step8" ); + + if (*aItemArray[0]->iTargetURI == KNullDesC8()) + User::Leave(KErrGeneral); + + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step9" ); + aTargetURI.Copy(*aItemArray[0]->iTargetURI); + + } + RDEBUG( "CApplicationManagementServer::GetAMServerDownloadDBL(): Step10" ); + aItemArray.ResetAndDestroy(); + + } + +// ------------------------------------------------------------------------------------------------ +// CApplicationManagementServer::DeleteGenericAlertForIDL() +// ------------------------------------------------------------------------------------------------ + +void CApplicationManagementServer::DeleteGenericAlertForIDL( + TUint32 internalid) + { + iAMServerDB->DeleteFromDatabaseL(internalid); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementServer::DecodeB64DataFileL( RFile& aDataFile, RFile& aDestinationFile ) +// ------------------------------------------------------------------------------------------------------------------- +void CApplicationManagementServer::DecodeB64DataFileL(RFile& aSourceFile, + RFile& aDestinationFile) + { + RDEBUG( "CApplicationManagementServer::DecodeB64DataFileL(): Start" ); + // Create buffers + //TInt b64bufferSize = 131072; + TInt decodedBufferSize = ((KBase64BufSize * 3) / 4 + 16); + HBufC8 *dataBuf = HBufC8::NewLC(KBase64BufSize); + TPtr8 dataPtr = dataBuf->Des(); + HBufC8* targetBuf = HBufC8::NewLC(decodedBufferSize); + TPtr8 targetPtr(targetBuf->Des()); + + TInt offset(0); + TInt length(0); + TBool reading(ETrue); + aSourceFile.Size(length); + RDEBUG_2( "CApplicationManagementServer::DecodeB64DataFileL(): b64 file total size: (%d)", length ); + aSourceFile.Seek(ESeekStart, offset); + + // Initialize decoder + TImCodecB64 B64Coder; + B64Coder.Initialise(); + + while (reading) + { + aSourceFile.Read(dataPtr); + if (!dataPtr.Length()) + { + // EOF + break; + } + offset = 0; + aSourceFile.Seek(ESeekCurrent, offset); + RDEBUG_2("OFFSET: %d", offset); + + // decode data + B64Coder.Decode(dataPtr, targetPtr); + // write decoded data to temporary file + aDestinationFile.Write(targetPtr); + } + CleanupStack::PopAndDestroy(targetBuf); + CleanupStack::PopAndDestroy(dataBuf); + + offset = 0; + aDestinationFile.Seek(ESeekStart, offset); + RDEBUG( "CApplicationManagementServer::DecodeB64DataFileL(): end" ); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementServer::DecodeB64DataLC( const TDesC8& aData ) +// ------------------------------------------------------------------------------------------------------------------- +HBufC8* CApplicationManagementServer::DecodeB64DataLC(const TDesC8 &aData) + { + RDEBUG( "CApplicationManagementServer::DecodeB64DataLC(): Start" ); + TImCodecB64 B64Coder; + B64Coder.Initialise(); + HBufC8 *target = HBufC8::NewLC((aData.Length() * 3) / 4 + 16); + TPtr8 targetPtr(target->Des()); + B64Coder.Decode(aData, targetPtr); + RDEBUG( "CApplicationManagementServer::DecodeB64DataLC(): End" ); + return target; + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementServer::EncodeDataL( const TDesC8& aData, CBufBase &aTarget ) +// ------------------------------------------------------------------------------------------------------------------- +void CApplicationManagementServer::EncodeDataL(const TDesC8& aData, + CBufBase &aTarget) + { + TInt outLen(aData.Length() * 2); + aTarget.ExpandL(0, outLen); + TImCodecB64 B64Coder; + B64Coder.Initialise(); + TPtr8 target(aTarget.Ptr(0)); + TInt decoded(B64Coder.Encode(aData, target)); + TInt s(target.Length()); + aTarget.ResizeL(s); + aTarget.Compress(); + if (!decoded) + { + RDEBUG( "CApplicationManagementServer::EncodeDataL(): Encoding b64 failed?" ); + } + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::CApplicationManagementSession +// ------------------------------------------------------------------------------------------------------------------- +inline CApplicationManagementSession::CApplicationManagementSession() + { + RDEBUG_2( "CApplicationManagementSession::CApplicationManagementSession 0x%x", this); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::CApplicationManagementSession +// ------------------------------------------------------------------------------------------------------------------- + +inline CApplicationManagementSession::CApplicationManagementSession( + const TCertInfo &aInfo) : + iCertInfo(aInfo) + { + RDEBUG( "CApplicationManagementSession::CApplicationManagementSession (cert) " ); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::Server() +// ------------------------------------------------------------------------------------------------------------------- + +inline CApplicationManagementServer& CApplicationManagementSession::Server() const + { + return *static_cast (const_cast (CSession2::Server())); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::CreateL() +// ------------------------------------------------------------------------------------------------------------------- +// 2nd phase construct for sessions - called by the CServer framework + +void CApplicationManagementSession::CreateL() + { + RDEBUG_2( "ApplicationManagementSession: CApplicationManagementSession::CreateL: 0x%x", this ); + + Server().AddSession(); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::~CApplicationManagementSession() +// ------------------------------------------------------------------------------------------------------------------- + +CApplicationManagementSession::~CApplicationManagementSession() + { + RDEBUG_3("CApplicationManagementSession::~CApplicationManagementSession 0x%X - 0x%X", reinterpret_cast(this), + reinterpret_cast(this)+sizeof( CApplicationManagementSession ) ); + RDEBUG_2("CApplicationManagementSession::~CApplicationManagementSession iCertInfo offs 0x%X", + reinterpret_cast(&this->iCertInfo) - reinterpret_cast(this) ); + + Server().DropSession(); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::ServiceL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::ServiceL(const RMessage2& aMessage) + { + if (aMessage.Function() == EPerformRfs) + { + TRAPD( err, Server().PerformRFSL() ); + aMessage.Complete(err); + } + else + { + TBool handled(EFalse); + TInt err(KErrNone); + TRAP( err, handled = PreDispatchMessageL( aMessage ) ); + if (!handled) + { + TRAP(err,DispatchMessageL(aMessage)); + } + + // Some of the functions contains operations that already complete message + // doing Complete() twice will cause panic + if (aMessage.Handle()) + { + aMessage.Complete(err); + } + } + } + +// CApplicationManagementSession::PreDispatchMessageL() +// ------------------------------------------------------------------------------------------------------------------- + +TBool CApplicationManagementSession::PreDispatchMessageL( + const RMessage2 &aMessage) + { + TBool ret(EFalse); + // These succeed regardless of certificate.... + switch (aMessage.Function()) + { + case EGetStateChangingIdsCountOperation: + { + // gets count of items list of ids that are potentially changing state + StateChangeComponentIdsCountL(aMessage); + ret = ETrue; + break; + } + case EGetStateChangingIdsOperation: + { + // gets list of ids that are potentially changing state + StateChangeComponentIdsL(aMessage); + ret = ETrue; + break; + } + case ECompleteStateChangeOperation: // completes change of state + { + StateChangeCompleteL(aMessage); + ret = ETrue; + break; + } + default: + { + break; + } + } + return ret; + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::DispatchMessageL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::DispatchMessageL( + const RMessage2& aMessage) + { + RDEBUG_2( "CApplicationManagementSession::DispatchMessageL; %d" , + aMessage.Function() ); + + TBool go(EFalse); + if (iTrustAdded) + { + go = Server().CheckCertL(iCertInfo); + } + else + { + go = ETrue; + } + + if (go) + { + switch (aMessage.Function()) + { + case EAddTrust: + { + RDEBUG_2( "CApplicationManagementSession::DispatchMessageL; EAddTrust this=0x%x", this ); + AddTrustL(aMessage); + break; + } + case EDeplCompCountOperation: + { + ComponentCountL(aMessage); + return; + } + case EDeplCompIdsOperation: + { + ComponentIdsL(aMessage); + return; + } + case EDeplCompDeliverCompleteOperation: + { + DeliverCompleteL(aMessage); + break; + } + case EDeplCompGetOperation: + { + GetComponentL(aMessage); + break; + } + case EInstallOperation: + { + InstallL(aMessage); + break; + } + case EDeplCompAttrUpdateOperation: + { + UpdateL(aMessage); + break; + } + case EDeplCompGetDataOperation: + { + GetDataL(aMessage); + break; + } + case EDeplCompGetDataLengthOperation: + { + GetDataLengthL(aMessage); + break; + } + case EDeplCompRemoveOperation: + { + RemoveL(aMessage); + break; + } + case EDeplCompDeliverStartOperation2: + { + Deliver2L(aMessage); + break; + } + case EDeplCompUpdateDataOperation: + { + UpdateDataL(aMessage); + break; + } + case EDeplCompUpdateStreamedDataOperation: + { + UpdateStreamedDataL(aMessage); + break; + } + case EDeplCompDownloadOperation: + { + DownloadL(aMessage); + break; + } + case EDeplCompUpdateOperation: + { + FullUpdateL(aMessage); + break; + } + case EDeplCompGetUserIdOperation: + { + GetUserIdL(aMessage); + break; + } + case EDeplCompStartDownloadOperation: + { + StartDownloadL(aMessage); + break; + } + case EDeplCompDeactivateOperation: + { + DeactivateL(aMessage); + break; + } + case EDeplCompActivateOperation: + { + ActivateL(aMessage); + break; + } + case EDeplCompGetTemporaryInstFile: + { + GetTemporaryInstFileL(aMessage); + break; + } + + case EDeplCompGetFinalResultForGA: + { + GetFinalResultForGAL(aMessage); + break; + + } + case EDeplCompGenericAlertSent: + { + GenericAlertSentForIdL(aMessage); + break; + } + case ECheckStatusNodes: + { + CheckStatusNodesValuesL(); + break; + } + + default: + { + User::Leave(KErrNotSupported); + break; + } + } + } + else + { + RDEBUG_2( "CApplicationManagementSession::DispatchMessageL; Policy prevented action this=0x%x", this ); + User::Leave(KErrAccessDenied); + } + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::GenericAlertSentForIdL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::GenericAlertSentForIdL( + const RMessage2& aMessage) const + { + TUint32 luid; + TPckg pk(luid); + TInt read(aMessage.Read(0, pk)); + + Server().DeleteGenericAlertForIDL(luid); + + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::GetFinalResultForGAL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::GetFinalResultForGAL( + const RMessage2& aMessage) + { + + RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 1" ); + TUint32 luid; + TPckg pk(luid); + + TInt finalresult = KErrNone; + + RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 2" ); + + HBufC8 *targetURI = HBufC8::NewL(512); + TPtr8 ptr = targetURI->Des(); + + RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 3" ); + + TInt read(aMessage.Read(0, pk)); + + RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 4" ); + + Server().GetAMServerDownloadDBL(luid, finalresult, ptr); + + RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 5" ); + + RDEBUG_2( "ApplicationManagementServer: GetFinalResultForGAL Count is %d", finalresult ); + TPckg p1(finalresult); + aMessage.WriteL(1, p1); + + RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 6" ); + aMessage.WriteL(2, ptr); + + RDEBUG( "CApplicationManagementSession: GetFinalResultForGAL Step 7" ); + if (targetURI) + delete targetURI; + + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::ComponentCountL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::ComponentCountL(const RMessage2& aMessage) + { + RDEBUG( "CApplicationManagementSession: ComponentCountL" ); + TDeploymentComponentState st; + TPckg pk(st); + + TInt read(aMessage.Read(1, pk)); + RDEBUG_3( "CApplicationManagementSession: ComponentCountL State is %d, read %d", st, read); + + const RComponentIdArray &arrt = Server().Storage()->GetComponentIds(); + RComponentIdArray arr; + CleanupClosePushL(arr); + if ((st == EDCSActive) || (st == EDCSInactive)) + { + ActiveComponentsL(arrt, arr, st); + } + else + { + TInt count(arrt.Count()); + for (TInt i(0); i < count; i++) + { + CDeploymentComponent &compo = Server().Storage()->ComponentL( + arrt[i]); + if (st == EDCSNone || compo.State() == st) + { + arr.Append(arrt[i]); + } + } + } + TInt n(arr.Count()); + CleanupStack::PopAndDestroy(&arr); + + RDEBUG_2( "ApplicationManagementServer: ComponentCountL Count is %d", n ); + TPckg p(n); + + aMessage.WriteL(0, p); + + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::ActiveComponentsL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::ActiveComponentsL( + const RComponentIdArray &aArrt, RComponentIdArray &aArr, + TDeploymentComponentState &aState) const + { + Swi::RSisRegistrySession sisses; + TInt r(sisses.Connect()); + User::LeaveIfError(r); + CleanupClosePushL(sisses); + + RArray uids; + sisses.InstalledUidsL(uids); + CleanupClosePushL(uids); + TInt cont(aArrt.Count()); + TInt uidc(uids.Count()); + RArray juids; + Server().JavaUidsL(juids); + CleanupClosePushL(juids); + TInt juidc(juids.Count()); + RComponentIdArray rem; + CleanupClosePushL(rem); + for (TInt i(0); i < cont; i++) + { + CDeploymentComponent &compo = + Server().Storage()->ComponentL(aArrt[i]); + TDeploymentComponentState state = compo.State(); + if (state == aState) + { + TBool add(EFalse); + const TUid &uid(compo.Uid()); + for (TInt j(0); add == EFalse && j < uidc; j++) + { + + if (uids[j] == uid) + { + RDEBUG( "CApplicationManagementSession::ActiveComponentsL Entered" ); + + // Check if this registry entry is present + Swi::RSisRegistrySession sisSession; + User::LeaveIfError(sisSession.Connect()); + CleanupClosePushL(sisSession); + + Swi::RSisRegistryEntry sisEntry; + + //Opens the base package entry by specifying a UID. + User::LeaveIfError(sisEntry.Open(sisSession, compo.Uid())); + CleanupClosePushL(sisEntry); + + add = sisEntry.IsPresentL(); + + if (add) + { + // If Present update the Version, name and other info to that deployement component. Since application would have got an update + // by some other means + TVersion version = sisEntry.VersionL(); + TBuf8 pkgDes; + pkgDes.AppendNum(version.iMajor); + pkgDes.Append(KLiteralPeriod); + pkgDes.AppendNum(version.iMinor); + + HBufC *packagename = sisEntry.PackageNameL(); + TBuf8<512> packagename8; + packagename8.Copy(*packagename); + delete packagename; + + compo.SetNameL(packagename8); + compo.SetVersionL(pkgDes); + + Server().Storage()->UpdateL(compo); + + RDEBUG( "CApplicationManagementSession::ActiveComponentsL ETrue" ); + + } + else + RDEBUG( "CApplicationManagementSession::ActiveComponentsL EFalse" ); + CleanupStack::PopAndDestroy(2, &sisSession); + } + } + if (!add) // go throug java suites + { + for (TInt k(0); add == EFalse && k < juidc; k++) + { + if (juids[k] == uid) + { + add = ETrue; + } + } + } + if (add) + { + aArr.Append(aArrt[i]); + } + else + { + RDEBUG8_3( "ApplicationManagementServer: ActiveComponentCountL skipping 0x%x, %S", + compo.Uid() ,&compo.ComponentId() ); + rem.Append(aArrt[i]); + } + } + } + TInt rc(rem.Count()); + for (TInt t(0); t < rc; t++) + { + RDEBUG_2( "ApplicationManagementServer: ActiveComponentCountL removing non existing %d", rem[t] ); + CDeploymentComponent &compo = Server().Storage()->ComponentL(rem[t]); + if (!compo.AppRemovable()) + Server().RemoveInternalL(compo, EFalse); + } + CleanupStack::PopAndDestroy(&rem); + CleanupStack::PopAndDestroy(&juids); + CleanupStack::PopAndDestroy(&uids); + CleanupStack::PopAndDestroy(&sisses); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::ComponentIdsL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::ComponentIdsL(const RMessage2& aMessage) const + { + RDEBUG( "CApplicationManagementSession: ComponentIdsL" ); + TDeploymentComponentState st; + TPckg pk(st); + + TInt read(aMessage.Read(1, pk)); + RDEBUG_3( "CApplicationManagementSession: ComponentIdsL State is %d, read %d", st, read); + + const RComponentIdArray &arrt = Server().Storage()->GetComponentIds(); + TInt buflen(0); + TUint32* buf = NULL; + if (st == EDCSNone) + { + buflen = arrt.Count(); + buf = new (ELeave) TUint32[buflen]; + CleanupArrayDeletePushL(buf); + for (TInt i(0); i < buflen; i++) + { + RDEBUG_2("ApplicationManagementSession: ComponentIdsL Adding %d!!", arrt[i]); + buf[i] = arrt[i]; + } + } + else + { + RComponentIdArray arr; + if (st == EDCSActive) + { + ActiveComponentsL(arrt, arr, st); + } + else + { + TInt artc(arrt.Count()); + for (TInt i(0); i < artc; i++) + { + CDeploymentComponent &compo = Server().Storage()->ComponentL( + arrt[i]); + if (compo.State() == st) + { + arr.Append(arrt[i]); + } + } + } + buflen = arr.Count(); + buf = new (ELeave) TUint32[buflen]; + CleanupArrayDeletePushL(buf); + + TUint32 len(aMessage.GetDesMaxLength(0) / 4); + if (buflen == len) + { + RDEBUG( "CApplicationManagementSession: ComponentIdsL Right count!!" ); + } + else + { + RDEBUG_3( "CApplicationManagementSession: ComponentIdsL Wrong count (is %d, should be %d)!!", len, buflen); + if (len < buflen) + { + buflen = len; + } + } + for (TInt i(0); i < buflen; i++) + { + RDEBUG_2( "CApplicationManagementSession: ComponentIdsL Adding %d!!", + arr[i] ); + buf[i] = arr[i]; + } + arr.Close(); + } + + TPtrC8 p((TUint8*) buf, buflen * sizeof(TUint32)); + aMessage.WriteL(0, p); + + CleanupStack::PopAndDestroy(buf); + } + +#ifdef _DEBUG +HBufC* Des8to16LC(const TDesC8 &aDes) + { + HBufC *b = HBufC::NewLC(aDes.Length()); + TPtr p(b->Des()); + p.Copy(aDes); + return b; + } + +HBufC* ToStringLC(TDeploymentComponent &aComp) + { + HBufC *b = HBufC::NewLC(aComp.iId.Length() + aComp.iName.Length() + + aComp.iVersion.Length() + 10 + 50); + TPtr p(b->Des()); + _LIT( KFormat, "Id: '%S', Name: '%S', Version: '%S', State: %d, OldState: %d"); + p.Format(KFormat, &*Des8to16LC(aComp.iId), &*Des8to16LC(aComp.iName), + &*Des8to16LC(aComp.iVersion), aComp.iState, aComp.iOldState); + CleanupStack::PopAndDestroy(3); + return b; + } +#endif + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::Deliver2L() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::Deliver2L(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: Deliver2L" ); + + TDeploymentComponentIPC comp; + TPckg pcomp(comp); + TInt read2(aMessage.Read(0, pcomp)); + + HBufC8 *data = HBufC8::NewLC(aMessage.GetDesLength(1)); + TPtr8 pbuf(data->Des()); + TInt read(aMessage.Read(1, pbuf)); + + CDeploymentComponent *compo = NULL; + if (iTrustAdded) + { + compo = Server().Storage()->NewComponentL(EDCSDelivered, + comp.iUserId, &iCertInfo); + } + else + { + compo + = Server().Storage()->NewComponentL(EDCSDelivered, + comp.iUserId); + } + + compo->Set(comp.iComponent); + compo->Data().SetDataL(pbuf, comp.iMimeType); + Server().Storage()->UpdateL(*compo); + compo->CopyStateTo(comp.iComponent); + +#ifdef _DEBUG + RDEBUG_2( "Deliver2L: TDeploymentComponent is '%S'", + ToStringLC( comp.iComponent ) ); + CleanupStack::PopAndDestroy(); +#endif + + TPckg pcomp2(comp.iComponent); + aMessage.Write(0, pcomp2); + CleanupStack::PopAndDestroy(data); + TInt n(compo->InternalId()); + TPckg p(n); + aMessage.WriteL(2, p); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::DeliverCompleteL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::DeliverCompleteL( + const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: DeliverCompleteL" ); + TUint32 id; + TPckg pid(id); + + TInt read(aMessage.Read(0, pid)); + RDEBUG_2( "ApplicationManagementSession: DeliverCompleteL id is %d", id ); + + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + + HBufC8 *opts = HBufC8::NewLC(aMessage.GetDesLength(1)); + TPtr8 popts(opts->Des()); + TInt read1(aMessage.Read(1, popts)); + compo.SetInstallOptsL(*opts); + + HBufC8 *meta = HBufC8::NewLC(aMessage.GetDesLength(2)); + TPtr8 pmeta(meta->Des()); + TInt read2(aMessage.Read(2, pmeta)); + compo.SetMetaDataL(*meta, KNullDesC8); + + CleanupStack::PopAndDestroy(meta); + CleanupStack::PopAndDestroy(opts); + Server().Storage()->UpdateL(compo); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::GetComponentL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::GetComponentL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: GetComponentL" ); + TUint32 id; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + + RDEBUG_2( "ApplicationManagementSession: GetComponentL id is %d", id ); + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + + TDeploymentComponent comp; + compo.CopyStateTo(comp); + + TPckg pcomp(comp); + aMessage.Write(1, pcomp); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::StartDownloadL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::StartDownloadL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: StartDownloadL" ); + TUint32 id = 0; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + + TPckgBuf target; + read = aMessage.Read(1, target); + RDEBUG_2( "ApplicationManagementSession: StartDownloadL id is %d", id ); + + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + compo.SetDownloadTarget(target()); + Server().AddDownloadL(&compo); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::DeactivateL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::DeactivateL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: DeactivateL" ); + TUint32 id = 0; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + + RDEBUG_2( "ApplicationManagementSession: DeactivateL id is %d", id ); + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + Server().Storage()->DeactivateL(compo); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::ActivateL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::ActivateL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: ActivateL" ); + TUint32 id; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + + RDEBUG_2( "ApplicationManagementSession: ActivateL id is %d", id ); + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + Server().Storage()->ActivateL(compo); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::GetUserIdL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::GetUserIdL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: GetUserIdL" ); + TUint32 id = 0; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + + RDEBUG_2( "ApplicationManagementSession: GetUserIdL id is %d", id ); + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + + aMessage.Write(1, compo.UserId()); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::GetTemporaryInstFileL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::GetTemporaryInstFileL( + const RMessage2& aMessage) const + { + // TIpcArgs( &id, &itemid, &filehandle ) + RDEBUG( "ApplicationManagementSession: GetTemporaryInstFileL" ); + TUint32 id; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + + TDeplCompAttrType item; + TPckg itemid(item); + read = aMessage.Read(1, itemid); + + RDEBUG_2( "ApplicationManagementSession: GetTemporaryInstFileL id is %d", id ); + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + + TFileName fileName; + + if (item == EDCData) + { + fileName.Copy(compo.Data().DataFileName()); + } + else if (item == EDCMetaData) + { + fileName.Copy(compo.MetaData().DataFileName()); + } + else + { + RDEBUG_2( "ApplicationManagementSession: GetTemporaryInstFileL: Not supported type: (%d)", item); + User::Leave(KErrNotSupported); + } + + RDEBUG_2( "ApplicationManagementSession: GetTemporaryInstFileL: (%S)", &fileName); + + RFs fs; + User::LeaveIfError(fs.Connect()); + User::LeaveIfError(fs.ShareProtected()); + CleanupClosePushL(fs); + RFile file; + User::LeaveIfError(file.Open(fs, fileName, EFileWrite)); + CleanupClosePushL(file); + + // Takes care of completing with session (RFs), + // SendReceieve returns session handle at client side + User::LeaveIfError(file.TransferToClient(aMessage, 2)); + CleanupStack::PopAndDestroy(2, &fs); // fs , file + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::PackageSizeL() +// ------------------------------------------------------------------------------------------------------------------- + +TInt CApplicationManagementSession::PackageSizeL( + Swi::RSisRegistrySession& aSession, Swi::RSisRegistryEntry& aEntry) + { + RPointerArray listPackages; + TInt size(0); + TInt err(0); + CleanupClosePushL(listPackages); + + aEntry.AugmentationsL(listPackages); + + for (TInt index(0); index < listPackages.Count(); index++) + { + TRAP(err, AugmentationSizeL( aSession, *listPackages[index])) + if (err != KErrNone) + { + break; + } + } + + if (err != KErrNone) + { + size = 0; + } + else + { + TRAP(err, size += aEntry.SizeL() ); + } + + listPackages.ResetAndDestroy(); + CleanupStack::PopAndDestroy(&listPackages); + + if (err != KErrNone) + { + //We leave if there was an error, + // but we have to clean up the listPackages before the leave. + User::Leave(err); + } + + return size; + } + +// ------------------------------------------------------------------------------------------------ +// CAppMngrSisxInfo::AugmentationSizeL() +// Returns the Size of the package +// (other items were commented in a header). +// ------------------------------------------------------------------------------------------------ +// +TInt CApplicationManagementSession::AugmentationSizeL( + Swi::RSisRegistrySession& aSession, + const Swi::CSisRegistryPackage& aPackage) + { + TInt size(0); + Swi::RSisRegistryEntry regEntry; + CleanupClosePushL(regEntry); + + regEntry.OpenL(aSession, aPackage); + size += PackageSizeL(aSession, regEntry); + + CleanupStack::PopAndDestroy(®Entry); + + return size; + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::LookupSisRegistryL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::LookupSisRegistryL() + { + Swi::RSisRegistrySession sisses; + TInt r(sisses.Connect()); + RPointerArray pkgs(12); + sisses.InstalledPackagesL(pkgs); + + TInt count(pkgs.Count()); + for (TInt i(0); i < count; i++) + { + Swi::CSisRegistryPackage* p = pkgs[i]; + + RDEBUG_5(" Found package: %d, '%S', uid: 0x%X, size: %d" , + i, &p->Name(), p->Uid().iUid, AugmentationSizeL( sisses, *p ) ); + } + + sisses.Close(); + pkgs.ResetAndDestroy(); + + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::InstallL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::InstallL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: InstallL" ); + TUint32 id; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + + TDeploymentComponentState targetst; + TPckg pk(targetst); + + read = aMessage.Read(1, pk); + + RDEBUG_3( "ApplicationManagementSession: InstallL id is %d, targetstate %d", + id, targetst ); + + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + if (compo.State() == EDCSDelivered) + { + Server().DoTheInstallL(compo); + } + else + { + User::Leave(KErrArgument); + } + RDEBUG_2( "ApplicationManagementSession: InstallL success. New compo state (%d)", compo.State()); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::UpdateDataL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::UpdateDataL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: UpdateDataL" ); + + TDeplCompDataIPC ipc; + TPckg pipc(ipc); + TInt read(aMessage.Read(0, pipc)); + RDEBUG_2( "ApplicationManagementSession: UpdateDataL id is %d", ipc.iInternalId ); + + HBufC8 *buf = HBufC8::NewLC(aMessage.GetDesLength(1)); + TPtr8 pbuf(buf->Des()); + TInt read2(aMessage.Read(1, pbuf)); + + CDeploymentComponent &compo = Server().Storage()->ComponentL( + ipc.iInternalId); + + if (Server().CheckB64Encode(pbuf)) + { + RDEBUG( "ApplicationManagementSession: UpdateDataL data is base64 encoded"); + // b64 encoded data, decode it + HBufC8* tmp; + tmp = Server().DecodeB64DataLC(pbuf); + pbuf.Copy(*tmp); + pbuf = buf->Des(); + CleanupStack::PopAndDestroy(tmp); + } + + if (compo.State() == EDCSDelivered) + { + if (ipc.iAttrType == EDCData) + { + compo.SetDataL(pbuf, ipc.iDataMime); + } + else if (ipc.iAttrType == EDCMetaData) + { + compo.SetMetaDataL(pbuf, ipc.iDataMime); + } + else + { + RDEBUG_2( "ApplicationManagementSession::UpdateDataL - ERROR UpdateDataL called for illegal item: %d!", ipc.iAttrType ); + User::Leave(KErrArgument); + } + + Server().Storage()->UpdateL(compo); + } + else + { + RDEBUG( "ApplicationManagementSession::UpdateDataL - ERROR UpdateDataL called for illegal state message!" ); + User::Leave(KErrArgument); + } + CleanupStack::PopAndDestroy(buf); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::UpdateStreamedDataL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::UpdateStreamedDataL( + const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: UpdateStreamedDataL() Start"); + TDeplCompDataIPC ipc; + TPckg pipc(ipc); + TInt read(aMessage.Read(0, pipc)); + RDEBUG_2( "ApplicationManagementSession: UpdateStreamedDataL id is %d", ipc.iInternalId ); + + CDeploymentComponent &compo = Server().Storage()->ComponentL( + ipc.iInternalId); + + if (compo.State() == EDCSDelivered) + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + RFile file; + TFileName dataFileName; + TInt length(0); + + if (ipc.iAttrType == EDCData) + { + dataFileName.Copy(compo.Data().DataFileName()); + } + else if (ipc.iAttrType == EDCMetaData) + { + dataFileName.Copy(compo.MetaData().DataFileName()); + } + else + { + RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL - ERROR called for illegal item: %d!", ipc.iAttrType ); + User::Leave(KErrArgument); + } + + RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL(): using dataFile: (%S)", &dataFileName ); + + // EFileWrite So we can delete the original decoded data file + User::LeaveIfError(file.Open(fs, dataFileName, EFileWrite)); + CleanupClosePushL(file); + if (Server().IsDataFileB64EncodedL(file, length)) + { + RDEBUG( "CApplicationManagementServer::UpdateStreamedDataL(): data is decoded" ); + + TFileName tempFileName; + TBuf<30> privatePath; + fs.PrivatePath(privatePath); + RFile tempFile; + TInt err(KErrNone); + err = tempFile.Temp(fs, privatePath, tempFileName, EFileWrite); + if (err == KErrNone) + { + RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL(): created tempFile: (%S)", &tempFileName ); + } + else + { + User::Leave(err); + } + CleanupClosePushL(tempFile); + + TRAP( err, Server().DecodeB64DataFileL( file, tempFile ) ); + if (err != KErrNone) + { + RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL - failed to decode datafile: %d", err ); + CleanupStack::PopAndDestroy(2, &file); + compo.ResetDataL(fs); // Remove both files if exists + User::Leave(err); + } + else + { + // close both files, delete decode file and rename temp file to correct one + CleanupStack::PopAndDestroy(2, &file); + fs.Delete(dataFileName); + err = fs.Rename(tempFileName, dataFileName); + RDEBUG_2( "ApplicationManagementSession::UpdateStreamedDataL - successfully decoded datafile: %d", err ); + } + CleanupStack::PopAndDestroy(&fs); + } + else + { + RDEBUG( "ApplicationManagementSession::UpdateStreamedDataL(): data is NOT decoded" ); + CleanupStack::PopAndDestroy(2, &fs); + } + + if (ipc.iAttrType == EDCData) + { + compo.SetDataL(ipc.iDataMime); + } + else + { + compo.SetMetaDataL(ipc.iDataMime); + } + + Server().Storage()->UpdateL(compo); + } + else + { + RDEBUG( "ApplicationManagementSession::UpdateStreamedDataL - ERROR called for illegal state message!" ); + User::Leave(KErrArgument); + } + RDEBUG( "ApplicationManagementSession: UpdateStreamedDataL() End"); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::UpdateL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::UpdateL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: UpdateL" ); + + TUint32 id; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + RDEBUG_2("ApplicationManagementSession: UpdateL id is %d", id ); + + TDeplCompAttrType item; + TPckg itemid(item); + TInt read1(aMessage.Read(1, itemid)); + HBufC8 *buf = HBufC8::NewLC(aMessage.GetDesLength(2)); + TPtr8 pbuf(buf->Des()); + TInt read2(aMessage.Read(2, pbuf)); + + CDeploymentComponent &c = Server().Storage()->ComponentL(id); + TDeploymentComponentState st(c.State()); + if (st == EDCSDelivered || st == EDCSDownload) + { + switch (item) + { + case EDCId: + { + c.SetIdL(pbuf); + break; + } + case EDCName: + { + c.SetNameL(pbuf); + break; + } + case EDCVersion: + { + c.SetVersionL(pbuf); + break; + } + case EDCDescriptionRef: + { + c.SetDescriptionL(pbuf); + break; + } + case EDCInstallOptions: + { + c.SetInstallOptsL(pbuf); + break; + } + case EDCMetaData: + { + c.SetMetaDataL(pbuf, KNullDesC8); + break; + } + case EDCPkgID: + { + c.SetPkgIDL(pbuf); + break; + } + case EDCPkgType: + { + c.SetPkgTypeL(pbuf); + break; + } + + default: + { + if (st == EDCSDelivered) + { + switch (item) + { + case EDCData: + { + c.SetDataL(pbuf, KNullDesC8); + if (c.State() == EDCSDownload) + { + // Server().StartDownload( *compo ); + } + break; + } + default: + { + RDEBUG_2("ApplicationManagementSession: ERROR UpdateL called for illegal item type!!!! %d", item ); + User::Leave(KErrArgument); + } + } + } + else if (st == EDCSDownload) + { + switch (item) + { + case EDCId: + { + c.SetIdL(pbuf); + break; + } + case EDCName: + { + c.SetNameL(pbuf); + break; + } + case EDCVersion: + { + c.SetVersionL(pbuf); + break; + } + case EDCDownloadURI: + { + c.SetDownloadURIL(pbuf); + break; + } + case EDCConRef: + { + TPckgBuf aInt; + aInt.Copy(pbuf); + c.SetIAPL(aInt()); + break; + } + default: + { + RDEBUG_2( "ApplicationManagementSession: ERROR UpdateL called for illegal item type!!!! %d", item ); + User::Leave(KErrArgument); + break; + } + } + } + break; + } + } + Server().Storage()->UpdateL(c); + } + else if (st == EDCSActive || st == EDCSInactive) + { + switch (item) + { + case EDCName: + { + c.SetNameL(pbuf); + break; + } + case EDCVersion: + { + c.SetVersionL(pbuf); + break; + } + case EDCDescriptionRef: + { + c.SetDescriptionL(pbuf); + break; + } + default: + { + RDEBUG_2( "ApplicationManagementSession: ERROR UpdateL called for illegal item type!!!! %d", item ); + User::Leave(KErrArgument); + break; + } + } + Server().Storage()->UpdateL(c); + } + else + { + RDEBUG( "ApplicationManagementSession: ERROR UpdateL called for illegal state message!" ); + User::Leave(KErrArgument); + } + CleanupStack::PopAndDestroy(buf); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::GetDataLengthL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::GetDataLengthL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: GetDataLengthL" ); + TUint32 id; + TPckg pid(id); + + TInt read(aMessage.Read(0, pid)); + + TInt length(0); + + TDeplCompAttrType dt; + TPckg pdt(dt); + read = aMessage.Read(1, pdt); + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + if (compo.State() == EDCSDelivered) + { + if (dt == EDCInstallOptions) + { + if (compo.InstallOptsSet()) + { + length = sizeof(TAMInstallOptions); + } + } + else if (dt == EDCData) + { + length = compo.Data().DataLengthL(); + } + else if (dt == EDCDataMime) + { + length = compo.Data().MimeType().Length(); + } + else if (dt == EDCMetaData) + { + length = compo.MetaData().DataLengthL(); + } + else if (dt == EDCMetaDataMime) + { + length = compo.MetaData().MimeType().Length(); + } + else + { + RDEBUG_2( "ApplicationManagementSession: GetDataLengthL ERROR called with illegal type %d", dt ); + User::Leave(KErrArgument); + } + } + else if (compo.State() == EDCSDownload) + { + if (dt == EDCDownloadURI) + { + length = compo.DownloadURI().Length(); + } + else if (dt == EDCInstallOptions) + { + if (compo.InstallOptsSet()) + { + length = sizeof(TAMInstallOptions); + } + } + else + { + RDEBUG_2( "ApplicationManagementSession: GetDataLengthL ERROR Download / called with illegal state component id %d", + compo.State() ); + User::Leave(KErrArgument); + } + } + else + { + RDEBUG_2( "ApplicationManagementSession: GetDataLengthL ERROR called with illegal state component id %d", + compo.State() ); + User::Leave(KErrArgument); + } + + TPckg pcomp(length); + aMessage.Write(2, pcomp); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::GetDataL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::GetDataL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: GetDataL" ); + TUint32 id; + TPckg pid(id); + + TInt read(aMessage.Read(0, pid)); + + TDeplCompAttrType dt; + TPckg pdt(dt); + read = aMessage.Read(1, pdt); + + RDEBUG_3( "ApplicationManagementSession: GetDataL id is %d, and attribute %d", id, dt ); + CDeploymentComponent &compo = Server().Storage()->ComponentL(id); + if (dt == EDCStatus) + { + TPckg p(compo.Status()); + aMessage.Write(2, p); + } + else if (compo.State() == EDCSDelivered) + { + if (dt == EDCInstallOptions) + { + if (compo.InstallOptsSet()) + { + TAMInstallOptionsPckgBuf pckg(compo.InstallOpts()); + aMessage.Write(2, pckg); + } + else + { + aMessage.Write(2, KNullDesC8); + } + } + else if (dt == EDCData) + { + aMessage.Write(2, compo.Data().Data()); + } + else if (dt == EDCDataMime) + { + aMessage.Write(2, compo.Data().MimeType()); + } + else if (dt == EDCMetaData) + { + aMessage.Write(2, compo.MetaData().Data()); + } + else if (dt == EDCMetaDataMime) + { + aMessage.Write(2, compo.MetaData().MimeType()); + } + else + { + RDEBUG_2( "ApplicationManagementSession: GetDataL ERROR called with illegal type %d", dt ); + User::Leave(KErrArgument); + } + } + else if (compo.State() == EDCSDownload) + { + + if (dt == EDCDownloadURI) + { + aMessage.Write(2, compo.DownloadURI()); + } + + else if (dt == EDCInstallOptions) + { + if (compo.InstallOptsSet()) + { + TAMInstallOptionsPckgBuf pckg(compo.InstallOpts()); + aMessage.Write(2, pckg); + } + else + { + aMessage.Write(2, KNullDesC8); + } + } + else if (dt == EDCConRef) + { + TPckg p(compo.GetIAP()); + aMessage.Write(2, p); + } + else + { + RDEBUG_2( "ApplicationManagementSession:GetDataL ERROR called with illegal type %d", dt ); + User::Leave(KErrArgument); + } + } + else + { + RDEBUG_2("ApplicationManagementSession: GetDataL ERROR called with illegal state component id %d", compo.State() ); + User::Leave(KErrArgument); + } + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::RemoveL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::RemoveL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: RemoveL" ); + TUint32 id; + TPckg pid(id); + TInt read(aMessage.Read(0, pid)); + RDEBUG_2( "ApplicationManagementSession: RemoveL id is %d", id ); + RemoveInternalL(id); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::RemoveInternalL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::RemoveInternalL(const TUint32 &aId) const + { + CDeploymentComponent &compo = Server().Storage()->ComponentL(aId); + + Server().RemoveInternalL(compo); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::DownloadL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::DownloadL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: DownloadL" ); + + TDCUserId userId; + aMessage.ReadL(1, userId); + CDeploymentComponent *compo = NULL; + + if (iTrustAdded) + { + compo = Server().Storage()->NewComponentL(EDCSDownload, userId, + &iCertInfo); + } + else + { + compo = Server().Storage()->NewComponentL(EDCSDownload, userId); + } + TUint32 i(compo->InternalId()); + TPckg p(i); + aMessage.WriteL(0, p); + RDEBUG( "ApplicationManagementSession: DownloadL end" ); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::FullUpdateL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::FullUpdateL(const RMessage2& aMessage) const + { + RDEBUG( "ApplicationManagementSession: FullUpdateL" ); + + TUint32 sid; + + TPckg psid(sid); + TInt read(aMessage.Read(0, psid)); + TUint32 tid; + TPckg ptid(tid); + TInt read2(aMessage.Read(1, ptid)); + + RDEBUG_3( "ApplicationManagementSession: FullUpdateL sid is %d, tid is %d", sid, tid ); + CApplicationManagementServer &server = Server(); + server.FullUpdateL(sid, tid); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::ServiceError() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::ServiceError(const RMessage2& aMessage, + TInt aError) + { + RDEBUG_2( "ApplicationManagementSession: CApplicationManagementSession::ServiceError %d", aError); + CSession2::ServiceError(aMessage, aError); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::AddTrustL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::AddTrustL(const RMessage2 &aMessage) + { + TPckg pkg(iCertInfo); + aMessage.ReadL(0, pkg); + iTrustAdded = ETrue; + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::StateChangeComponentIdsL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::StateChangeComponentIdsL( + const RMessage2& aMessage) const + { + RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsL" ); + RComponentIdArray arr; + Server().Storage()->GetStateChangeComponentIdsL(arr); + TInt buflen(arr.Count()); + TUint32* buf = new (ELeave) TUint32[buflen]; + CleanupArrayDeletePushL(buf); + for (TInt i(0); i < buflen; i++) + { + RDEBUG_2( "ApplicationManagementSession:ComponentIdsL Adding %d!!", arr[i]); + buf[i] = arr[i]; + } + TPtrC8 p((TUint8*) buf, buflen * sizeof(TUint32)); + aMessage.WriteL(0, p); + arr.Close(); + CleanupStack::PopAndDestroy(buf); + RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsL end" ); + + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::StateChangeComponentIdsCountL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::StateChangeComponentIdsCountL( + const RMessage2& aMessage) const + { + RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL" ); + RPointerArray preInstalledAppParams; + CAMPreInstallApp* preInstallApp = CAMPreInstallApp::NewL(); + preInstallApp->GetPreInstalledAppsL(preInstalledAppParams); + TInt count = 0; + for (count = 0; count < preInstalledAppParams.Count(); count++) + { + RDEBUG8_2("CApplicationManagementSession::DownloadL: Installed App Name is: %S",&(preInstalledAppParams[count]->iPreInstalledAppame)); + RDEBUG8_2("CApplicationManagementSession::DownloadL: Installed App Vendor is: %S",&(preInstalledAppParams[count]->iPreInstalledAppVendorName)); + RDEBUG_2("CApplicationManagementSession::DownloadL: Installed App UID is : '0x%X'",preInstalledAppParams[count]->iPreInstalledAppUid); + + TBool found = EFalse; + const RComponentIdArray &arrt = Server().Storage()->GetComponentIds(); + TInt countval(arrt.Count()); + for (TInt i(0); i < countval; i++) + { + CDeploymentComponent &compo = Server().Storage()->ComponentL( + arrt[i]); + if (compo.Uid() + == preInstalledAppParams[count]->iPreInstalledAppUid) + { + RDEBUG( "CApplicationManagementSession: ActiveComponentsL found= TRUE" ); + found = ETrue; + } + } + if (!found) + { + RDEBUG( "CApplicationManagementSession: Adding Pre-installed app" ); + TDCUserId preInstalledAppName; + preInstalledAppName.Copy( + preInstalledAppParams[count]->iPreInstalledAppame); + CDeploymentComponent *preInstallCompo = NULL; + RDEBUG8_2("CApplicationManagementSession: Installed App Name is: %S",&preInstalledAppName); + preInstallCompo = Server().Storage()->NewComponentL(EDCSActive, + preInstalledAppName); + preInstallCompo->SetUid( + preInstalledAppParams[count]->iPreInstalledAppUid); + preInstallCompo->SetNameL(preInstalledAppName); + preInstallCompo->SetVersionL( + preInstalledAppParams[count]->iVersion); + preInstallCompo->SetMimeTypeL( + preInstalledAppParams[count]->iMimeType); + preInstallCompo->SetAppRemovableStatus(ETrue); + + Server().Storage()->UpdateL(*preInstallCompo); + Server().Storage()->CheckForDuplicateNodesInDeployedL( + *preInstallCompo); + } + } + delete preInstallApp; + RComponentIdArray arr; + Server().Storage()->GetStateChangeComponentIdsL(arr); + TPckgBuf buflen(arr.Count()); + aMessage.WriteL(0, buflen); + arr.Close(); + RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL end" ); + } + +// ------------------------------------------------------------------------------------------------------------------- +// CApplicationManagementSession::StateChangeCompleteL() +// ------------------------------------------------------------------------------------------------------------------- + +void CApplicationManagementSession::StateChangeCompleteL( + const RMessage2& aMessage) const + { + RDEBUG( "CApplicationManagementSession: StateChangeCompleteL" ); + TUint32 tid; + TPckg ptid(tid); + TInt read2(aMessage.Read(0, ptid)); + Server().Storage()->StateChangedL(tid); + } +void CApplicationManagementSession::CheckStatusNodesValuesL() + { + const RComponentIdArray &arrt = Server().Storage()->GetComponentIds(); + TInt cont(arrt.Count()); + TBool isUpdateRequired = ETrue; + for (TInt i(0); i < cont; i++) + { + CDeploymentComponent &compo = Server().Storage()->ComponentL(arrt[i]); + isUpdateRequired = EFalse; + if (compo.Status() == EDownload_DownloadProgress) + { + compo.SetStatusNode(EDownload_DownloadFailed); + isUpdateRequired = ETrue; + } + else if (compo.Status() == EDelivered_InstallProgress) + { + compo.SetStatusNode(EDelivered_InstalledFailedWithData); + isUpdateRequired = ETrue; + } + else if (compo.Status() == EDelivered_RemoveProgress) + { + compo.SetStatusNode(EDelivered_RemoveFailed); + isUpdateRequired = ETrue; + } + else if (compo.Status() == EDeployed_RemoveProgress) + { + compo.SetStatusNode(EDeployed_RemoveFailed); + isUpdateRequired = ETrue; + } + else if (compo.Status() == EDeployed_ActivateProgress) + { + compo.SetStatusNode(EDeployed_ActivateFailed); + isUpdateRequired = ETrue; + } + else if (compo.Status() == EDeployed_DeactivateProgress) + { + compo.SetStatusNode(EDeployed_DeactivateFailed); + isUpdateRequired = ETrue; + } + if (isUpdateRequired) + Server().Storage()->UpdateL(compo); + } + + } + +void CApplicationManagementServer::SetSisAppVersionAndDriveL( + CDeploymentComponent &aCompo) + { + RDEBUG( "CApplicationManagementSession: SetSisAppVersionAndDriveL: Begin" ); + + Swi::RSisRegistrySession sisSession; + User::LeaveIfError(sisSession.Connect()); + CleanupClosePushL(sisSession); + + Swi::RSisRegistryEntry sisEntry; + + //Opens the base package entry by specifying a UID. + User::LeaveIfError(sisEntry.Open(sisSession, aCompo.Uid())); + CleanupClosePushL(sisEntry); + + TUint drivesMask = sisEntry.InstalledDrivesL(); + + TInt drive = EDriveA; + TDriveNumber installedDrive = EDriveC; + + if (drivesMask) + { + // Select the highest drive as location drive. That's the case when + // all installation is not in same drive + + while (drivesMask >>= 1) + { + drive++; + } + + RDEBUG_2( "drive -> SetSisAppVersionAndDriveL %d", drive); + + installedDrive = (TDriveNumber) drive; + } + + TBool status = EFalse; + + //Since "C" drive is not removable + + if (installedDrive != EDriveC) + { + status = IsInstalledAppRemovableL(installedDrive); + } + if (status) + { + RDEBUG( "IsInstalledAppRemovableL(SetSisAppVersionAndDriveL); True"); + } + else + { + RDEBUG( "IsInstalledAppRemovableL(SetSisAppVersionAndDriveL); False"); + } + + //check for status drive + aCompo.SetAppRemovableStatus(status); + + TVersion version = sisEntry.VersionL(); + + if (aCompo.ComponentVersion() == KNullDesC8) + { + TBuf8 pkgDes; + pkgDes.AppendNum(version.iMajor); + pkgDes.Append(KLiteralPeriod); + pkgDes.AppendNum(version.iMinor); + aCompo.SetVersionL(pkgDes); + + } + CleanupStack::PopAndDestroy(2, &sisSession); + + RDEBUG( "CApplicationManagementSession: SetSisAppVersionAndDriveL: End" ); + } + +TBool CApplicationManagementServer::IsInstalledAppRemovableL( + TDriveNumber &iDrive) + { + RDEBUG( "IsInstalledAppRemovableL: Step1" ); + TBool removable = EFalse; + RFs rfs; + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + TDriveList driveList; + TInt driveCount; + + //Get all removeable drive, both physically and logically + User::LeaveIfError(DriveInfo::GetUserVisibleDrives(rfs, driveList, + driveCount, KDriveAttRemovable)); + + TInt max(driveList.Length()); + + RDEBUG_2( "driveList.Length() %d", max); + + RDEBUG_2( "driveCount %d", driveCount); + + TBuf<26> buf; + buf.Copy(driveList); + RDEBUG_2( "Drive Info (%S)", &buf); + + for (TInt i = 0; i < max; ++i) + { + if (driveList[i]) + { + TUint status; + RDEBUG( "IsInstalledAppRemovableL: Step3" ); + DriveInfo::GetDriveStatus(rfs, i, status); + + RDEBUG( "IsInstalledAppRemovableL: Step4" ); + //To make sure the drive is physically removeable not logically removeable + if (status & DriveInfo::EDriveRemovable) + { + RDEBUG( "IsInstalledAppRemovableL: Drive removable" ); + RDEBUG_2( "IsInstalledAppRemovableL: Drive removable Drive ID %d", i); + if (i == iDrive) + { + RDEBUG( "IsInstalledAppRemovableL: Step5" ); + removable = ETrue; + break; + } + } + } + } + + CleanupStack::PopAndDestroy(&rfs); + + return removable; + } + +// ----------------------------------------------------------------------------- +// CShutDown::CShutdown() +// ------------------------------------------------------------------------------------------------ + +inline CShutdown::CShutdown() : + CTimer(-1) + { + CActiveScheduler::Add(this); + } + +// ------------------------------------------------------------------------------------------------ +// CShutDown::ConstructL() +// ------------------------------------------------------------------------------------------------ + +inline void CShutdown::ConstructL() + { + CTimer::ConstructL(); + } + +// ------------------------------------------------------------------------------------------------ +// CShutDown::Start() +// ------------------------------------------------------------------------------------------------ + +inline void CShutdown::Start() + { + RDEBUG( "ApplicationManagementServer: starting shutdown timeout" ); + After(KApplicationManagementShutdownDelay); + } + +// ------------------------------------------------------------------------------------------------ +// CShutDown::RunL() +// ------------------------------------------------------------------------------------------------ + +void CShutdown::RunL() + { + RDEBUG( "ApplicationManagementServer timeout ... closing" ); + HbApplication::exit(0); + } + +// ------------------------------------------------------------------------------------------------ +// CShutDown::Start() +// ------------------------------------------------------------------------------------------------ +inline void CShutdown::Stop() + { + RDEBUG( "ApplicationManagementServer: Stop" ); + HbApplication::exit(0); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/ApplicationManagementUtility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/ApplicationManagementUtility.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,97 @@ +/* +* 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 applicationmanagement components + * +*/ + + +// CLASS HEADER +#include "ApplicationManagementUtility.h" +#include "debug.h" +using namespace NApplicationManagement; + +// CONSTRUCTION +CApplicationManagementUtility* CApplicationManagementUtility::NewL() + { + CApplicationManagementUtility* self = + CApplicationManagementUtility::NewLC(); + CleanupStack::Pop(); + + return self; + } +TInt CApplicationManagementUtility::mHidden=0; +HbDialog* CApplicationManagementUtility::mCurrDlg=0; +TInt CApplicationManagementUtility::iSilentSession = 0; +TFileName CApplicationManagementUtility::iFileName(KNullDesC); + +CApplicationManagementUtility* CApplicationManagementUtility::NewLC() + { + CApplicationManagementUtility* self = new( ELeave ) CApplicationManagementUtility(); + CleanupStack::PushL(self); + + self->ConstructL(); + return self; + } + +// Destructor (virtual by CBase) +CApplicationManagementUtility::~CApplicationManagementUtility() + { + } + +// Default constructor +CApplicationManagementUtility::CApplicationManagementUtility() + { + } + +// Second phase construct +void CApplicationManagementUtility::ConstructL() + { + } + +TBool CApplicationManagementUtility::FindInstalledJavaUidL(const TUid& /*aUid*/) const + { + return EFalse; + } + +void CApplicationManagementUtility::InstalledSuiteUidsL(RArray ) + { + // do nothing + } + +void CApplicationManagementUtility::JavaUidsL(RArray& /*aUids*/) + { + // do nothing + } + +void CApplicationManagementUtility::RefreshJavaRegistryL() + { + // do nothing + } +void CApplicationManagementUtility::GetInstalledMidletParametersL( + TMidletParameters& /*aMidletParameters*/) + { + RDEBUG( "CApplicationManagementUtility::GetInstalledMidletParametersL: Start"); + //do nothng + RDEBUG( "CApplicationManagementUtility::GetInstalledMidletParametersL: end"); + } +void CApplicationManagementUtility::SetFileName(const TFileName& aFileName) + { + iFileName = aFileName; + } +void CApplicationManagementUtility::GetFileName(TFileName& aFileName) + { + aFileName = iFileName; + } + +// END OF FILE diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/ApplicationManagementUtilityFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/ApplicationManagementUtilityFactory.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,29 @@ +/* + * 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 applicationmanagement components + * + */ + +// CLASS HEADER +#include "ApplicationManagementUtilityFactory.h" + +using namespace NApplicationManagement; + +// METHODS +CApplicationManagementUtility* ApplicationManagementUtilityFactory::CreateManagementUtilityL() + { + return CApplicationManagementUtility::NewL(); + } + +// END OF FILE \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/amstorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/amstorage.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,643 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + + +#include +#include +#include +#include +#ifndef __SERIES60_30__ +#include "AMAppHideUtil.h" +#endif +#include "debug.h" +#include "amprivateCRKeys.h" +#include "amstorage.h" +#include "AMDeploymentComponent.h" + +using namespace NApplicationManagement; + +// CONSTANTS + + +/*************************************************** + // RComponentIdArray + ***************************************************/ + +void RComponentIdArray::SetListL(const TDesC8& aChilds) + { +#ifdef _DEBUG + HBufC *b = HBufC::NewLC(aChilds.Length() ); + TPtr p(b->Des() ); + p.Copy(aChilds); + RDEBUG_2( "RComponentIdArray::SetListL: Setting list from: '%S'", &p); + CleanupStack::PopAndDestroy(b); +#endif + + RDesReadStream buf(aChilds); + //TInt size( buf.Source()->TellL( MStreamBuf::ERead ).SizeL() ); + TInt left(aChilds.Length() ); + const TInt KSize(sizeof(TUint32)); + while (left > 0) + { + TUint32 val(buf.ReadUint32L() ); +#ifdef _DEBUG + RDEBUG_2( "RComponentIdArray::SetListL: Appending id: '%d'", val); +#endif + Append(val); + left -= KSize; + } + buf.Close(); + } + +void RComponentIdArray::RemoveByValue(TUint32 aValue) + { + TInt ind(Find(aValue) ); + Remove(ind); + } + +void RComponentIdArray::GetListLC(HBufC8 *&aChilds, TInt &aLength) + { + ASSERT( aChilds == NULL ); + TInt c(Count() ); + if (c > 0) + { + aLength = c * sizeof(TUint32); + aChilds = HBufC8::NewLC(aLength); + TPtr8 p(aChilds->Des() ); + RDesWriteStream stream(p); + CleanupClosePushL(stream); + TInt i( 0); + do + { + stream.WriteUint32L(operator[](i) ); + } + while ( ++i < c); + stream.CommitL(); + CleanupStack::PopAndDestroy( &stream); + } + else + { + aChilds = KNullDesC8().AllocLC(); + aLength = 0; + } + } + +/* + void TCertInfoPckg::ExternalizeL(RWriteStream& aStream) const + { + aStream << iId; + TPckgBuf::ExternalizeL( aStream ); + } + + void TCertInfoPckg::InternalizeL(RReadStream& aStream) + { + + } + */ + +void RCertArray::ExternalizeL(RWriteStream& aStream) const + { + TInt c(Count() ); + aStream.WriteInt32L(c); + for (TInt i( 0); i < c; i++) + { + aStream.WriteInt32L(i); + aStream << (*(operator[](i))); + } + } + +void RCertArray::InternalizeL(RReadStream& aStream) + { + TInt c(aStream.ReadInt32L() ); + for (TInt i( 0); i < c; i++) + { + TCertInfoPckg *pkg = new ( ELeave ) TCertInfoPckg; + RDEBUG_2( "RCertArray::InternalizeL - allocated TCertInfoPckg 0x%X", reinterpret_cast( pkg ) ); + CleanupStack::PushL(pkg); + TInt idx(aStream.ReadInt32L() ); + aStream >> (*pkg); + Append(pkg); + CleanupStack::Pop(pkg); + } + } + +TInt RCertArray::FindByValue(const TCertInfoPckg &aPckg) + { + TInt c(Count() ); + for (TInt i( 0); i < c; i++) + { + if (operator[](i)->Compare(aPckg) == 0) + { + return i; + } + } + return KErrNotFound; + } + +/*************************************************** + // CDeliveryComponentStorage + ***************************************************/ + +CDeliveryComponentStorage::CDeliveryComponentStorage() + { + + } + +void CDeliveryComponentStorage::ConstructL() + { +#ifndef __SERIES60_30__ + iHidder = CAMAppHideUtil::NewL(); +#endif + LoadCertsL(); + TRAPD( erx, iRepository = CRepository::NewL ( KCRUidPrivateApplicationManagementKeys ) ) + ; + if (erx != KErrNone) + { + RDEBUG_2( "CDeliveryComponentStorage::ConstructL() ERROR CentRep not initialized: Check deployment! %d", erx ); + User::Leave(erx); + } + TInt err(iRepository->Get(KNextIdKey, iNextId) ); + if (err == KErrNotFound) + { + iNextId = KMinIdValue; + User::LeaveIfError(iRepository->Create(KNextIdKey, iNextId) ); + } + else + { + User::LeaveIfError(err); + } + LoadComponentsL(); + } + +void CDeliveryComponentStorage::LoadCertsL() + { + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); + TInt e(fs.CreatePrivatePath(KDefaultDrive) ); + + User::LeaveIfError(e); + TBuf<64> privatePath; + User::LeaveIfError(fs.PrivatePath(privatePath) ); + + TInt privPathLength(privatePath.Length() ); + _LIT( KCertFile, "amcerts.dat"); + HBufC *afile = HBufC::NewLC(privPathLength + KCertFile().Length()); + *afile = privatePath; + afile->Des().Append(KCertFile); + RFileReadStream certFile; + TInt err(certFile.Open(fs, *afile, EFileRead) ); + if (err == KErrNone) + { + CleanupClosePushL(certFile); + iCertificates.InternalizeL(certFile); + CleanupStack::PopAndDestroy( &certFile); + } + else + if (err == KErrNotFound) + { + + } + else + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(afile); + CleanupStack::PopAndDestroy( &fs); + } + +CDeliveryComponentStorage* CDeliveryComponentStorage::NewLC() + { + CDeliveryComponentStorage *self = new ( ELeave ) CDeliveryComponentStorage( ); + CleanupStack::PushL(self) ; + self->ConstructL() ; + return self; + } + +CDeliveryComponentStorage* CDeliveryComponentStorage::NewL() + { + CDeliveryComponentStorage *self = NewLC(); + CleanupStack::Pop(self) ; + return self; + } + +TInt CDeliveryComponentStorage::NextKey() + { + TInt oldNext(iNextId++); + iRepository->Set(KNextIdKey, iNextId); + return oldNext; + } + +CDeliveryComponentStorage::~CDeliveryComponentStorage() + { + RDEBUG_3( "CDeliveryComponentStorage::~CDeliveryComponentStorage 0x%X - 0x%X", reinterpret_cast(this), + reinterpret_cast(this)+sizeof( CDeliveryComponentStorage ) ); + delete iRepository; + iRepository = NULL; + iComponents.ResetAndDestroy(); + iComponentIds.Close(); + TRAPD( err,CloseCertificatesL() ) + ; + if (err != KErrNone) + { + RDEBUG_2( "CDeliveryComponentStorage::~CDeliveryComponentStorage: ERROR Failed to close certificate storage properly: %d", err); + } +#ifndef __SERIES60_30__ + delete iHidder; + iHidder = NULL; +#endif + } + +void CDeliveryComponentStorage::CloseCertificatesL() + { + RFs fs; + User::LeaveIfError(fs.Connect() ); + CleanupClosePushL(fs); + TInt e(fs.CreatePrivatePath(KDefaultDrive) ); + + User::LeaveIfError(e); + TBuf<64> privatePath; + User::LeaveIfError(fs.PrivatePath(privatePath) ); + + TInt privPathLength(privatePath.Length() ); + _LIT( KCertFile, "amcerts.dat"); + HBufC *afile = HBufC::NewLC(privPathLength + KCertFile().Length()); + *afile = privatePath; + afile->Des().Append(KCertFile); + RFileWriteStream certFile; + + TInt err(certFile.Replace(fs, *afile, EFileWrite) ); + if (err == KErrNone) + { + CleanupClosePushL(certFile); + iCertificates.ExternalizeL(certFile); + CleanupStack::PopAndDestroy( &certFile); + } + else + if (err == KErrNotFound) + { + + } + else + { + User::Leave(err); + } + CleanupStack::PopAndDestroy(afile); + CleanupStack::PopAndDestroy( &fs); + iCertificates.ResetAndDestroy(); + } + +const RComponentIdArray &CDeliveryComponentStorage::GetComponentIds() const + { + return iComponentIds; + } + +void CDeliveryComponentStorage::GetStateChangeComponentIdsL( + RComponentIdArray &aArray) + { + RDEBUG_2( "CDeliveryComponentStorage::GetStateChangeComponentIdsL %d dcs", iComponentIds.Count()); + aArray.Reset(); + TInt c(iComponentIds.Count() ); + for (TInt i( 0); i < c; i++) + { + CDeploymentComponent &compo = ComponentL(iComponentIds[i]); + if (compo.OldState() != EDCSNone) + { + aArray.Append(iComponentIds[i]); + } + } + RDEBUG( "CDeliveryComponentStorage::GetStateChangeComponentIdsL end"); + } + +void CDeliveryComponentStorage::StateChangedL(TUint32 aInternalId) + { + RDEBUG_2( "CDeliveryComponentStorage::StateChangedL id %d", aInternalId); + CDeploymentComponent &compo = ComponentL(aInternalId); + compo.StateChangeComplete(); + UpdateL(compo); + } + +void CDeliveryComponentStorage::LoadComponentsL() + { + TInt length( 0); + TInt err(iRepository->Get(KIdListLengthKey, length) ); + if (err == KErrNotFound) + { + length = 0; + User::LeaveIfError(iRepository->Create(KIdListLengthKey, length) ); + } + else + { + User::LeaveIfError(err); + } + HBufC8 *listbuf = HBufC8::NewLC(length) ; + TPtr8 ptr(listbuf->Des() ); + err = iRepository->Get(KIdListKey, ptr) ; + if (err == KErrNotFound) + { + err = iRepository->Create(KIdListKey, KNullDesC8); + } + else + { + + } + User::LeaveIfError(err); + TRAPD(code, iComponentIds.SetListL( ptr )) + ; + if (code != KErrEof) + { + User::LeaveIfError(code); + } + + CleanupStack::PopAndDestroy(listbuf); +#ifndef __SERIES60_30__ + TInt i(iComponentIds.Count() ); + //iHidder->Reset(); + while ( --i >= 0) + { + CDeploymentComponent &comp = ComponentL(iComponentIds[i]); + if (comp.State() == EDCSInactive) + { + iHidder->AddUidL(comp.Uid()); + } + else + if (comp.State() == EDCSActive) + { + iHidder->RemoveUidL(comp.Uid() ); + } + } + iHidder->PersistUidsL(); +#endif + + } + +CDeploymentComponent *CDeliveryComponentStorage::NewComponentL( + const TDeploymentComponentState &aState, const TDCUserId &aUserId, + const TCertInfo *aCertInfo/* = NULL */) + { + CDeploymentComponent *newc = CDeploymentComponent::NewLC(NextKey(), + aUserId); + if (aCertInfo != NULL) + { + TCertInfoPckg *p = new( ELeave ) TCertInfoPckg(*aCertInfo); + RDEBUG_2( "CDeliveryComponentStorage::NewComponentL - allocated TCertInfoPckg 0x%X", reinterpret_cast( p ) ); + + TInt idx(iCertificates.FindByValue(*p) ); + if (idx == KErrNotFound) + { + RDEBUG_2( "CDeliveryComponentStorage::NewComponentL - TCertInfoPckg NOT found 0x%X", reinterpret_cast( p ) ); + iCertificates.Append(p); + idx = iCertificates.Count() - 1; + } + else + { + RDEBUG_2( "CDeliveryComponentStorage::NewComponentL - TCertInfoPckg found at %d, deleting temporary", idx ); + delete p; + p = NULL; + } + if (idx >= 0) + { + RDEBUG_2( "CDeliveryComponentStorage::NewComponentL - TCertInfoPckg found 0x%X", reinterpret_cast( p ) ); + newc->SetOwner(idx); + } + else + { + RDEBUG_3( "CDeliveryComponentStorage::NewComponentL - WARNING Could not add certificate 0x%X: %d", reinterpret_cast( p ), idx ); + + } + } + newc->SetState(aState); + newc->SetStatusNode(EIdle); + UpdateL( *newc); + iComponents.Append(newc); + iComponentIds.Append(newc->InternalId() ); +RDEBUG_2( "CDeliveryComponentStorage::NewComponentL -Internal ID is %d, ", newc->InternalId() ); + PersistStateL(); + CleanupStack::Pop(newc); + return newc; + } + +void CDeliveryComponentStorage::UpdateL( + const CDeploymentComponent &aComponent) + { + aComponent.PersistL( *iRepository) ; + +#ifndef __SERIES60_30__ + if (aComponent.State() == EDCSInactive) + { + iHidder->AddUidL(aComponent.Uid(), ETrue); + } + else + { + iHidder->RemoveUidL(aComponent.Uid(), ETrue); + } +#endif + } + +void CDeliveryComponentStorage::PersistStateL() + { + TInt length( 0); + HBufC8 *buf= NULL; + iComponentIds.GetListLC(buf, length); + User::LeaveIfError(iRepository->Set(KIdListLengthKey, length) ); + User::LeaveIfError(iRepository->Set(KIdListKey, *buf) ); + CleanupStack::PopAndDestroy(buf); + } + +void CDeliveryComponentStorage::RemoveL(TUint32 aInternalId) + { + RDEBUG_2("CDeliveryComponentStorage::RemoveL - Remove id: (%d)", aInternalId ); + TInt count(iComponents.Count() ); + for (TInt i( 0); i < count; i++) + { + CDeploymentComponent *el = iComponents[i]; + if (aInternalId == el->iInternalId) + { +#ifndef __SERIES60_30__ + iHidder->RemoveUidL(el->Uid(), ETrue); +#endif + iComponents.Remove(i); + iComponentIds.RemoveByValue(aInternalId); + el->DestroyL( *iRepository); + delete el; + RDEBUG_2("CDeliveryComponentStorage::RemoveL - Removed id: (%d)", aInternalId ); + PersistStateL(); + break; + } + } + } + +CDeploymentComponent &CDeliveryComponentStorage::ComponentL( + TUint32 aInternalId) + { + CDeploymentComponent *resp= NULL; + TInt count(iComponents.Count() ); + for (TInt i( 0); i < count; i++) + { + CDeploymentComponent *el = iComponents[i]; + if (aInternalId == el->iInternalId) + { + resp = el; + break; + } + } + if (resp == NULL) + { + TBuf8< NCentralRepositoryConstants::KMaxBinaryLength> buf; + TInt err(iRepository->Get(aInternalId, buf) ); + User::LeaveIfError(err) ; + resp = LoadComponentL(aInternalId, buf) ; + iComponents.Append(resp); + } + if (resp == NULL) + { + User::Leave(KErrNotFound); + } + return *resp; + } + +CDeploymentComponent *CDeliveryComponentStorage::LoadComponentL( + TInt aInternalId, const TDesC8 &aBuffer) const + { + CDeploymentComponent *res = CDeploymentComponent::LoadL(aInternalId, + aBuffer); +#ifdef _DEBUG + if (res) + { + RDEBUG8_4( "CDeliveryComponentStorage::LoadComponentL - loaded component state %d, internalid %d, and userid: %S", res->State(), res->InternalId(),&res->UserId() ); + } + else + { + RDEBUG( "CDeliveryComponentStorage::LoadComponentL - WARNING failed to load component" ); + } +#endif + return res; + } +void CDeliveryComponentStorage::CheckForDuplicateNodesInDeployedL( + CDeploymentComponent &aComponent) + { + TInt CompIdsCount(iComponentIds.Count() ); + RDEBUG8_2("CheckForDuplicateNodesInDeployedL: CompIdsCount-> (%d)", CompIdsCount ); + RDEBUG8_2("CheckForDuplicateNodesInDeployedL: aComponent UserID is %S", &(aComponent.UserId())); + for (TInt i( 0); i < CompIdsCount; i++) + { + CDeploymentComponent &compo = ComponentL(iComponentIds[i]); + RDEBUG8_2("CheckForDuplicateNodesInDeployedL: compo UserID is %S", &(compo.UserId())); + if (&aComponent != &compo) + { + if (((compo.State()== EDCSActive) || (compo.State()== EDCSInactive)) + &&(compo.UserId() == aComponent.UserId())) + { + (aComponent.iUserId).Append(*IntToDes8LC(aComponent.iInternalId)); + CleanupStack::PopAndDestroy(); + break; + } + } + } + } + +HBufC8* CDeliveryComponentStorage::IntToDes8LC(const TInt aLuid) + { + HBufC8* buf = HBufC8::NewLC( 10); //10 = max length of 32bit integer + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + return buf; + } + +void CDeliveryComponentStorage::InstalledL(CDeploymentComponent &aComponent) + { + CheckForDuplicateNodesInDeployedL(aComponent); + aComponent.SetState(EDCSActive); + // set state to IDLE + aComponent.SetStatusNode(EIdle); + UpdateL(aComponent); + } + +void CDeliveryComponentStorage::DeactivateL(CDeploymentComponent &aComponent) + { + /* : + * set state to InActivate in progress + * use TRAP instead of leaving. + */ + aComponent.SetStatusNode(EDeployed_DeactivateProgress); + //User::LeaveIfError(aComponent.SetState(EDCSInactive) ); + TInt err = aComponent.SetState(EDCSInactive); + if (err == KErrNone) + { + TRAP(err,UpdateL(aComponent)); + } + //UpdateL(aComponent); + /*: + * if error set state to InActivate failed or else set to Idle + * call userleaveiferror() + */ + if (err == KErrNone) + { + aComponent.SetStatusNode(EIdle); + } + else + { + aComponent.SetStatusNode(EDeployed_DeactivateFailed); + } + User::LeaveIfError(err); + } + +void CDeliveryComponentStorage::SetDeploymentComponentState(CDeploymentComponent &aComponent,TDeploymentComponentState aState) + { + aComponent.SetState( aState ); + TRAP_IGNORE(UpdateL( aComponent )); + } + +void CDeliveryComponentStorage::ActivateL(CDeploymentComponent &aComponent) + { + /* : + * set state to Activate in progress + * use TRAP instead of leaving. + */ + aComponent.SetStatusNode(EDeployed_ActivateProgress); + TInt err = aComponent.SetState(EDCSActive); + //UpdateL( aComponent ); + if (err == KErrNone) + { + TRAP(err,UpdateL(aComponent)); + } + /*: + * if error set state to InActivate failed or else set to Idle + * call userleaveiferror() + */ + if (err == KErrNone) + { + aComponent.SetStatusNode(EIdle); + } + else + { + aComponent.SetStatusNode(EDeployed_ActivateFailed); + } + User::LeaveIfError(err); + } + +/*void CDeliveryComponentStorage::UninstalledL( CDeploymentComponent &aComponent ) + { + aComponent.SetState( EDCSInactive ); + UpdateL( aComponent ); + } + + void CDeliveryComponentStorage::ResetL() + { + } + */ +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/amview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/amview.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#include "amview.h" +#include "debug.h" +using namespace NApplicationManagement; + +// ------------------------------------------------------------------------------------------------ +// AMView::AMView() +// ------------------------------------------------------------------------------------------------ +AMView::AMView() + { + + } +// ------------------------------------------------------------------------------------------------ +// AMView::~AMView() +// ------------------------------------------------------------------------------------------------ +AMView::~AMView() + { + + } +// ------------------------------------------------------------------------------------------------ +// AMView::eventFilter() +// ------------------------------------------------------------------------------------------------ +bool AMView::eventFilter(QObject *object, QEvent *event) +{ + switch (event->type()) + { + case QEvent::ApplicationActivate: + { + RDEBUG( "eventFilter: QEvent::ApplicationActivate start" ); + CApplicationManagementUtility::mHidden=0; + if(CApplicationManagementUtility::mCurrDlg) + CApplicationManagementUtility::mCurrDlg->setVisible(true); + RDEBUG( "eventFilter: end" ); + break; + } + default: + break; + } +return HbView::eventFilter(object, event); +} diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/amwaitprogdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/amwaitprogdialog.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + + +#include +#include +#include +#include +#include +#include "amwaitprogdialog.h" +#include "ApplicationManagementServer.h" + +using namespace NApplicationManagement; + +// ------------------------------------------------------------------------------------------------ +// AMWaitProgDialog::AMWaitProgDialog() +// ------------------------------------------------------------------------------------------------ +AMWaitProgDialog::AMWaitProgDialog(QString aAppName, MInstallerCallBack& aCallback) +:mDlg(0),m_callback(aCallback) + { + mIndi = 0; + m_appname = aAppName; + } +// ------------------------------------------------------------------------------------------------ +// AMWaitProgDialog::~AMWaitProgDialog +// ------------------------------------------------------------------------------------------------ +AMWaitProgDialog::~AMWaitProgDialog() + { + if(mDlg) + { + delete mDlg; + mDlg=NULL; + } + if(mIndi) + { + delete mIndi; + mIndi = NULL; + } + } +// ------------------------------------------------------------------------------------------------ +// AMWaitProgDialog::createWaitDialog +// ------------------------------------------------------------------------------------------------ +void AMWaitProgDialog::createWaitDialog(TInt aType) + { + mType = aType; + if(mDlg==NULL) + { + mDlg = new HbProgressDialog(HbProgressDialog::WaitDialog); + CApplicationManagementUtility::mCurrDlg=mDlg; + } + if (aType == EInstallWaitDlg) + { + //installing wait dialog + mDlg->setHeadingWidget(new HbLabel(hbTrId( + "txt_device_update_title_installing"))); + mDlg->setText(hbTrId("txt_deviceupdate_info_file_1_2").arg(m_appname)); + QString val = hbTrId("txt_common_button_hide"); + HbAction* hide = new HbAction(mDlg); + hide->setText(val); + mDlg->clearActions(); + mDlg->addAction(hide); + val = hbTrId("txt_common_button_cancel"); + HbAction* cancel = new HbAction(mDlg); + cancel->setText(val); + mDlg->addAction(cancel); + QObject::connect(hide, SIGNAL(triggered()), this, + SLOT(hideAMWaitDialog())); + QObject::connect(cancel, SIGNAL(triggered()), this, + SLOT(cancelWaitDialog())); + + mDlg->show(); + } + else + { + //uninstalling wait dialog + mDlg->setHeadingWidget(new HbLabel(hbTrId( + "txt_device_update_title_removing"))); + mDlg->setText(hbTrId("txt_deviceupdate_info_application_1").arg(m_appname)); + QString val = hbTrId("txt_common_button_hide"); + HbAction* hide = new HbAction(); + hide->setText(val); + mDlg->clearActions(); + mDlg->addAction(hide); + val = hbTrId("txt_common_button_cancel"); + QObject::connect(hide, SIGNAL(triggered()), this, + SLOT(hideAMWaitDialog())); + mDlg->setAttribute(Qt::WA_DeleteOnClose, true); + mDlg->show(); + } + } + +// ------------------------------------------------------------------------------------------------ +// AMWaitProgDialog::startIndicator() +// ------------------------------------------------------------------------------------------------ +void AMWaitProgDialog::startIndicator() + { + CApplicationManagementUtility::mHidden = 1; + mIndi = new HbIndicator(); + if (mType == EInstallWaitDlg) + { + QString str(hbTrId("txt_device_update_title_installing")); + mIndi->activate(KScomoProgressIndicatorType, str); + } + else + { + QString str(hbTrId("txt_device_update_title_removing")); + mIndi->activate(KScomoProgressIndicatorType, str); + } + } + +// ------------------------------------------------------------------------------------------------ +// AMWaitProgDialog::closeAMWaitDialog() +// ------------------------------------------------------------------------------------------------ +void AMWaitProgDialog::closeAMWaitDialog() + { + CApplicationManagementUtility::mCurrDlg=0; + if(mDlg) + { + mDlg->close(); + } + if(mIndi) + { + mIndi->deactivate(KScomoProgressIndicatorType); + } + } + +// ------------------------------------------------------------------------------------------------ +// AMWaitProgDialog::hideAMWaitDialog() +// ------------------------------------------------------------------------------------------------ +void AMWaitProgDialog::hideAMWaitDialog() + { + CCoeEnv* coe = CCoeEnv::Static(); + TApaTaskList taskList(coe->WsSession()); + TApaTask task=taskList.FindApp(TUid::Uid(KAppMgmtServerUid)); + if(task.Exists()) + { + task.SendToBackground(); + } + startIndicator(); + } + +// ------------------------------------------------------------------------------------------------ +// AMWaitProgDialog::cancelDialog() +// ------------------------------------------------------------------------------------------------ +void AMWaitProgDialog::cancelWaitDialog() + { + //mInstaller.CancelOperation(); + m_callback.InstallationCancelled(); + closeAMWaitDialog(); + CCoeEnv* coe = CCoeEnv::Static(); + TApaTaskList taskList(coe->WsSession()); + TApaTask task=taskList.FindApp(TUid::Uid(KAppMgmtServerUid)); + if(task.Exists()) + { + task.SendToBackground(); + } + CApplicationManagementUtility::mCurrDlg=0; + } + +// ------------------------------------------------------------------------------------------------ +// AMWaitProgDialog::registerInstallRequest +// ------------------------------------------------------------------------------------------------ +void AMWaitProgDialog::registerInstallRequest(TRequestStatus &stat) + { + //mInstaller = aInstaller; + m_Stat = &stat; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/appmgmtdownloadmgr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/appmgmtdownloadmgr.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,933 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ApplicationManagementUtility.h" +#include "debug.h" +#include "dmcommon.h" +#include "amstorage.h" +#include "appmgmtnotifier.h" +#include "appmgmtdownloadmgr.h" +#include "ServicePluginLogger.h" +using namespace NApplicationManagement; + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::appmgmtdownloadmgr +// ------------------------------------------------------------------------------------------------ +appmgmtdownloadmgr::appmgmtdownloadmgr(QWidget* parent, + MDownloadMgrQTCallback& callback,TRequestStatus& aStatus) : + QWidget(parent), m_callback(callback), iStatus(aStatus) + { + iProgressNote = NULL; + iSetFinalValue = 0; + iProgressCancelled = 0; + iDialogAccepted = 0; + mEndReported = 0; + mNetworkLoss = 0; + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::~appmgmtdownloadmgr +// ------------------------------------------------------------------------------------------------ +appmgmtdownloadmgr::~appmgmtdownloadmgr() + { + if (iProgressNote) + { + iProgressNote->closeAMProgDialog(); + delete iProgressNote; + iProgressNote = 0; + } + if(mNote) + { + delete mNote; + mNote=0; + } + + delete iFileName; + + delete iContentType; + + delete iURI; + delete iComp; + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::startDownload +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::startDownload(CDeploymentComponent *aComponent) + { + + RDEBUG( "appmgmtdownloadmgr::startDownload Start" ); + + QString m_appName = "ApplicationManagementServer"; + + iComp = aComponent; + iDownloadManager = new DownloadManager(m_appName); + // initialise the downloads of the last session + + connect(iDownloadManager, + SIGNAL(downloadManagerEvent(DownloadManagerEvent *)), this, + SLOT(downloadMgrEventRecieved(DownloadManagerEvent *))); + + iDownloadManager->initialize(); + + DownloadType m_type = Parallel; + + DownloadPriority m_priority = High; + #ifdef __WINS__ + iDownloadManager->setProxy("bswebproxy01.americas.nokia.com", 8080); + #endif + TBuf buf; + buf.Copy(aComponent->DownloadURI()); + + QString url((QChar*) buf.Ptr(), buf.Length()); + + TInt silentsession = 0; + RProperty::Get(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,silentsession); + + CApplicationManagementUtility::iSilentSession = silentsession; + + iDl = iDownloadManager->createDownload(url, m_type); + + bool t = connect(iDl, SIGNAL(downloadEvent(DownloadEvent *)), this, + SLOT(downloadEventRecieved(DownloadEvent *))); + + if (!iDl) + return; + + QString path("c:\\system\\appmgr\\"); + + iDl->setAttribute(Priority, m_priority); + iDl->setAttribute(DestinationPath, path); + iDl->start(); + + iOperationType = aComponent->DownloadTarget(); + + RDEBUG( "appmgmtdownloadmgr::startDownload End" ); + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::convertSize +// ------------------------------------------------------------------------------------------------ +QString appmgmtdownloadmgr::convertSize() + { + RDEBUG( "appmgmtdownloadmgr::convertSize Start" ); + TBuf<64> size; + TReal filesize; + TRealFormat realFormat; + TInt64 fileKBytes; + realFormat.iWidth = 6; + + //converting size to Kb + fileKBytes = m_totalSize / KSizeDivisor; + filesize = (TReal) m_totalSize / (KSizeDivisor); + size.Num(fileKBytes); + + //get the length of the value in Kb before the decimal point. + //Accordingly convert it further. + int len = size.Length(); + QString text; + if (len >= 7) + { + //in gb + TReal mul = (KSizeDivisor * KSizeDivisor); + TReal temp = filesize / mul; + size.Num(temp, realFormat); + mSize = QString::fromUtf16(size.Ptr(), size.Length()); + text = hbTrId("txt_deviceupdate_info_size_1_Gb").arg(mSize); + mSizeFormat = "gb"; + } + else if (len >= 4) + { + //in mb + TReal temp = filesize / KSizeDivisor; + size.Num(temp, realFormat); + mSize = QString::fromUtf16(size.Ptr(), size.Length()); + text = hbTrId("txt_deviceupdate_info_size_1_mb").arg(mSize); + mSizeFormat = "mb"; + } + else + { + mSize = QString::fromUtf16(size.Ptr(), size.Length()); + text = hbTrId("txt_deviceupdate_info_size_1_kb").arg(mSize); + mSizeFormat = "kb"; + } + RDEBUG( "appmgmtdownloadmgr::convertSize End" ); + return text; + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::getAvailableDrives() +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::getAvailableDrives() + { + RDEBUG( "appmgmtdownloadmgr::getAvailableDrives start" ); + RFs iFs; + qt_symbian_throwIfError(iFs.Connect()); + TDriveList driveList; + TInt driveCount = 0; + TBuf<20> buf; + int i = 0; + QString val; + QStringList list; + TDriveInfo info; + TVolumeInfo volumeInfo; + qt_symbian_throwIfError(DriveInfo::GetUserVisibleDrives(iFs, driveList, + driveCount)); + TUint driveStatus = 0; + for (TInt index(0); index < KMaxDrives; index++) + { + if (driveList[index]) + { + TRealFormat realFormat; + qt_symbian_throwIfError(DriveInfo::GetDriveStatus(iFs, index, + driveStatus)); + TFileName path; + TDriveUnit driveUnit(index); + if (!(driveStatus & DriveInfo::EDriveRemote)) + { + TBuf<64> freeSpace; + TReal free; + TInt64 freeKBytes; + realFormat.iWidth = 6; + iFs.Drive(info, index); + if(iFs.Volume(volumeInfo, index)==KErrNone) + { + RDEBUG_2("free space: (%d)", volumeInfo.iFree ); + freeKBytes = 0; + freeKBytes = volumeInfo.iFree / KSizeDivisor; + free = volumeInfo.iFree / KSizeDivisor; + freeSpace.Num(freeKBytes); + TInt sizeUnit = EKb; + + //converting the drive freespace + int len = freeSpace.Length(); + if (len >= 7) + { + TReal nul = (KSizeDivisor * KSizeDivisor); + TReal temp = free / nul; + freeSpace.Num(temp, realFormat); + sizeUnit = EGb; + } + else + { + TReal temp = free / KSizeDivisor; + freeSpace.Num(temp, realFormat); + sizeUnit = EMb; + } + //Getting the drive name in QString + path.Zero(); + path.Append(driveUnit.Name()); + val = QString::fromUtf16(path.Ptr(), path.Length()); + drilist.Append(path); + //Getting the drive free space in QString + path.Zero(); + path.Append(freeSpace); + QString str1 = QString::fromUtf16(path.Ptr(), path.Length()); + QString driv; + if (sizeUnit == EKb) + { + driv + = hbTrId( + "txt_deviceupdate_setlabel_install_to_val_1_2_kb").arg( + val, str1); + } + else if (sizeUnit == EMb) + { + driv + = hbTrId( + "txt_deviceupdate_setlabel_install_to_val_1_2_Mb").arg( + val, str1); + } + else + { + driv + = hbTrId( + "txt_deviceupdate_setlabel_install_to_val_1_2_Gb").arg( + val, str1); + } + mDriveBox->insertItem(i++, driv); + } + } + } + } + RDEBUG( "appmgmtdownloadmgr::getAvailableDrives End" ); + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::showInstalltoDialog() +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::showInstalltoDialog() + { + RDEBUG( "appmgmtdownloadmgr::showIntalltoDialog start" ); + HbDocumentLoader loader; + QString val; + bool ok = false; + HbLabel* label; + + loader.load(":/xml/sample.docml", &ok); + if (!ok) + { + return; + } + Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); + mDialog = qobject_cast (loader.findWidget("dialog")); + + //set title for the dialog + label = qobject_cast (loader.findWidget( + "qtl_dialog_pri_heading")); + if (iOperationType == EInstallAndActivate) + { + val = hbTrId("txt_device_update_title_download_and_install"); + label->setPlainText(val); + } + else + { + val = hbTrId("txt_device_update_title_install"); + label->setPlainText(val); + } + + //set the app name + label = qobject_cast (loader.findWidget("label")); + val = hbTrId("txt_deviceupdate_info_file_1_2").arg(m_appName); + label->setPlainText(val); + + //size + label = qobject_cast (loader.findWidget("label_1")); + if (m_totalSize != 0) + { + m_sizeStr = convertSize(); + label->setPlainText(m_sizeStr); + } + else + { + val = hbTrId("txt_device_update_info_details_not_available"); + label->setPlainText(val); + } + + //icon + label = qobject_cast (loader.findWidget("icon")); + HbIcon* icon = new HbIcon(":/icon/qgn_prop_sml_http.svg"); + label->setIcon(*icon); + + //"install to" label + label = qobject_cast (loader.findWidget("qtl_dialog_pri5")); + val = hbTrId("txt_device_update_setlabel_install_to"); + label->setPlainText(val); + + //getting the available free space in all drives and adding to combobox + + mDriveBox = qobject_cast (loader.findWidget("combobox")); + int err(KErrNone); + TRAP(err,QT_TRYCATCH_LEAVING(getAvailableDrives())); + + if(err!=KErrNone) + { + mDriveBox->setVisible(false); + } + iComp->SetDriveSelectionStatus(true); + CDeliveryComponentStorage* iStorage; + QT_TRAP_THROWING(iStorage = CDeliveryComponentStorage::NewL()); + TRAP( err, QT_TRYCATCH_LEAVING(iStorage->UpdateL(*iComp))); + delete iStorage; + iStorage = NULL; + + connect(mDriveBox, SIGNAL(currentIndexChanged(int)), this, + SLOT(defaultDriveChanged(int ))); + //setting the actions + mOkButton = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_left")); + mCancel = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_right")); + val = hbTrId("txt_common_button_ok"); + mOkButton->setText(val); + val = hbTrId("txt_common_button_cancel"); + mCancel->setText(val); + RDEBUG( "appmgmtdownloadmgr::showIntalltoDialog End" ); + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::showDownloadDialog() +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::showDownloadDialog() + { + RDEBUG( "appmgmtdownloadmgr::showDownloadDialog start" ); + HbDocumentLoader loader; + QString val; + bool ok = false; + HbLabel* label; + + loader.load(":/xml/downloaddialog.docml", &ok); + + Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); + mDialog = qobject_cast (loader.findWidget("dialog")); + + //set title for the dialog + label = qobject_cast (loader.findWidget( + "qtl_dialog_pri_heading")); + val = hbTrId("txt_device_update_title_download"); + label->setPlainText(val); + + //set icon + label = qobject_cast (loader.findWidget("icon")); + HbIcon* icon = new HbIcon(":/icon/qgn_prop_sml_http.svg"); + label->setIcon(*icon); + + label = qobject_cast (loader.findWidget("qtl_dialog_pri5")); + + //set appname + val = hbTrId("txt_deviceupdate_info_file_1_2").arg(m_appName); + label->setPlainText(val); + + //size + label = qobject_cast (loader.findWidget("qtl_dialog_pri5_1")); + + //size + if (m_totalSize != 0) + { + m_sizeStr = convertSize(); + label->setPlainText(m_sizeStr); + } + else + { + val = hbTrId("txt_device_update_info_details_not_available"); + label->setPlainText(val); + } + //setting the actions + mOkButton = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_left")); + mCancel = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_right")); + val = hbTrId("txt_common_button_ok"); + mOkButton->setText(val); + val = hbTrId("txt_common_button_cancel"); + mCancel->setText(val); + RDEBUG( "appmgmtdownloadmgr::showDownloadDialog End" ); + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::showDialog +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::showDialog(CDeploymentComponent *aComponent) + { + CCoeEnv* coe = CCoeEnv::Static(); + TApaTaskList taskList(coe->WsSession()); + TApaTask task1(taskList.FindApp(TUid::Uid(KAppMgmtServerUid))); + if (task1.Exists()) + { + task1.BringToForeground(); + } + + + + //get the Size of the install package + m_totalSize = iDl->attribute(TotalSize).toInt(); + + //get the name of the install package + TDeploymentComponentName name = aComponent->ComponentName(); + TBuf nameBuf; + nameBuf.Copy(name); + m_appName = QString::fromUtf16(nameBuf.Ptr(), nameBuf.Length()); + + (iOperationType == EInstallAndActivate)?showInstalltoDialog():showDownloadDialog(); + + mDialog->setTimeout(20000); + mNotifierdata = m_appName; + QString comma(","); + mNotifierdata.append(comma); + mNotifierdata.append(mSize); + mNotifierdata.append(comma); + mNotifierdata.append(mSizeFormat); + + mDialogData = m_appName; + mDialogData.append(comma); + mDialogData.append(m_sizeStr); + + CApplicationManagementUtility::mCurrDlg = mDialog; + mDialog->setAttribute(Qt::WA_DeleteOnClose); + mDialog->open(this,SLOT(dialogSlot(HbAction*))); + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::defaultDriveChanged +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::defaultDriveChanged(int i) + { + TAMInstallOptions opts = iComp->InstallOpts(); + int err = KErrNone; + TChar drive = drilist[i*2]; + drive.LowerCase(); + opts.iOptions.iDrive = drive; + TPtrC8 buf; + TAMInstallOptionsPckg optsb(opts); + buf.Set(optsb); + TRAP( err, QT_TRYCATCH_LEAVING(iComp->SetInstallOptsL(buf))); + CDeliveryComponentStorage* iStorage; + TRAP( err, QT_TRYCATCH_LEAVING(iStorage = CDeliveryComponentStorage::NewL())); + TRAP( err, QT_TRYCATCH_LEAVING(iStorage->UpdateL(*iComp))); + delete iStorage; + iStorage = NULL; + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::dialogSlot +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::dialogSlot(HbAction* recAction) + { + RDEBUG("dialogslot"); + TRequestStatus* stat = &iWait->iStatus; + User::RequestComplete(stat,KErrNone); + if(recAction == mCancel) + { + mEndReported = 1; + sendSrvToBg(); + iWait->Stop(); + iDl->cancel(); + } + else + { + //visited if ok is selected or after timeout + iDialogAccepted = 1; + int err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KDownloadActive, iDialogAccepted); + RDEBUG_2("RProperty set (%d)", err ); + } + CApplicationManagementUtility::mCurrDlg = 0; + mOkButton=0; + mCancel = 0; + RDEBUG("dialogslot end"); + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::downloadMgrEventRecieved( +// ------------------------------------------------------------------------------------------------ +bool appmgmtdownloadmgr::downloadMgrEventRecieved(DownloadManagerEvent *event) + { + //DEventType type = (DEventType)event->type(); + //bool eventHandled = false; + switch (event->type()) + + { + case DownloadManagerEvent::Created: + { + RDEBUG("DownloadCreated"); + return true; + } + case DownloadManagerEvent::Removed: + { + RDEBUG("Removed"); + return true; + } + + default: + { + //QWidget::event(event); + return false; + } + } + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::FileName +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::FileName(QString& filename) + { + if (iDl) + filename = iDl->attribute(WRT::FileName).toString(); + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::MimeType +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::MimeType(QString& mimetype) + { + mimetype=m_mimetype; + TBuf<1024> buffer(mimetype.utf16()); + RDEBUG_2( "appmgmtdownloadmgr::MimeType '%S'", &buffer ); + } +void appmgmtdownloadmgr::SetMimeType() + { + if (iDl) + m_mimetype = iDl->attribute(ContentType).toString(); + TBuf<1024> buffer(m_mimetype.utf16()); + RDEBUG_2( "appmgmtdownloadmgr::MimeType SetMimeType '%S'", &buffer ); + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::downloadEventRecieved +// ------------------------------------------------------------------------------------------------ +bool appmgmtdownloadmgr::downloadEventRecieved(DownloadEvent *event) + { + //DEventType type = (DEventType)event->type(); + bool eventHandled = true; + switch (event->type()) + { + case DownloadEvent::Started: + { + RDEBUG("Started"); + m_inProgress = false; + break; + } + + case DownloadEvent::HeadersReceived: + { + RDEBUG("HeaderReceived"); + m_inProgress = false; + SetMimeType(); + break; + } + + case DownloadEvent::InProgress: + { + RDEBUG("Progress"); + + //HandleAlreadyRunningL(downloadedsize, contentsize, *download, aEvent.iProgressState); + if (!iDialogAccepted) + { + if (!CApplicationManagementUtility::iSilentSession) + { + showDialog(iComp); + int err = KErrNone; + TRAP( err, QT_TRYCATCH_LEAVING(iWait = CDialogWait::NewL())); + iWait->StartWait(); + } + } + else + { + m_totalSize = iDl->attribute(TotalSize).toInt(); + RDEBUG_2("total size = %d",m_totalSize ); + m_currentDownloadedSize + = iDl->attribute(DownloadedSize).toInt(); + RDEBUG_2("m_currentDownloadedSize = %d",m_currentDownloadedSize ); + if (!CApplicationManagementUtility::iSilentSession) + updateProgress(m_currentDownloadedSize, m_totalSize); + } + break; + } + case DownloadEvent::Paused: + { + RDEBUG("Paused"); + break; + } + case DownloadEvent::Completed: + { + RDEBUG("Completed"); + m_inProgress = false; + closeProgress(); + QApplication::processEvents(); + if (iOperationType == EDeliver && !CApplicationManagementUtility::iSilentSession) + { + mNote = new AppMgmtNotifier(m_appName); + if(mNote) + mNote->showDownloadSuccessNote(); + delete mNote; + mNote=NULL; + } + m_callback.DownloadCompleted(); + iStatus = KErrNone; + break; + } + + case DownloadEvent::Failed: + { + RDEBUG("Failed"); + m_inProgress = false; + closeProgress(); + if(!CApplicationManagementUtility::iSilentSession) + { + mNote = new AppMgmtNotifier(m_appName); + if(mNote) + { + bool ret = mNote->showDownloadFailedNote(mNotifierdata); + RDEBUG_2( "device dialog : %d", ret ); + delete mNote; + mNote=NULL; + } + } + + break; + } + case DownloadEvent::Cancelled: + { + RDEBUG("Cancelled"); + m_inProgress = false; + + closeProgress(); + if(!mNetworkLoss) + { + m_callback.DownloadFailed(KStatusUserCancelled); + } + else + { + m_callback.DownloadFailed(KStatusDownloadFailed); + } + iStatus = KErrNone; + break; + } + case DownloadEvent::ConnectionNeeded: + case DownloadEvent::ConnectionDisconnected: + case DownloadEvent::NetworkLoss: + { + RDEBUG("NetworkLoss"); + m_inProgress = false; + int errornum; + int statusdwnld; + closeProgress(); + if(!mEndReported) + { + mNetworkLoss = 1; + mEndReported = 1; + if (!CApplicationManagementUtility::iSilentSession) + { + mNote = new AppMgmtNotifier(m_appName); + if(mNote) + mNote->showDownloadFailedNote(mNotifierdata); + delete mNote; + mNote=NULL; + } + iDl->cancel(); + } + break; + } + + case DownloadEvent::Error: + { + RDEBUG("Error"); + m_inProgress = false; + + int errornum; + int statusdwnld; + + Download::State state = + (Download::State) iDl->attribute(State).toInt(); + + errornum = iDl->attribute(LastError).toInt(); + + statusdwnld = currDwnldStatForGenericAlert(errornum); + closeProgress(); + if(!mEndReported) + { + if (!CApplicationManagementUtility::iSilentSession) + { + mNote = new AppMgmtNotifier(m_appName); + if(mNote) + mNote->showDownloadFailedNote(mNotifierdata); + delete mNote; + mNote=NULL; + } + m_callback.DownloadFailed(statusdwnld); + mEndReported = 1; + } + iStatus = KErrNone; + break; + } + + default: + { + eventHandled = false; + } + } + return eventHandled; + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::updateProgress +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::updateProgress(TInt32 aDownloadedSize, + TInt32 aContentSize) + { + if (!iProgressNote) + { + iProgressNote = new AppMgmtProgDialog(mDialogData,*iDl,mEndReported); + iProgressNote->startDialog(aContentSize, aDownloadedSize); + } + + //handles the progress dialog + //creating progress dialog and set final val and update + if (aContentSize >= 0) + { + iProgressNote->updateProgress(aDownloadedSize); + } + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::currDwnldStatForGenericAlert +// ------------------------------------------------------------------------------------------------ +int appmgmtdownloadmgr::currDwnldStatForGenericAlert(int dwnldstatus) + { + int status; + if(dwnldstatus == DiskFull ) + status = KStatusDowloadFailedOOM; + else if(dwnldstatus == TransactionFailed ||dwnldstatus== HostNotFoundError || dwnldstatus== TimeoutError || dwnldstatus== OperationCanceledError) + status = KStatusAltDowldUnavailable; + else if (dwnldstatus == AuthenticationRequiredError ) + status = KStatusAlternateDownldAuthFail; + else + status = KStatusDownloadFailed; + + return status; + + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::closeProgress +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::closeProgress() + { + if(iProgressNote) + { + iProgressNote->closeAMProgDialog(); + } + } + +// ------------------------------------------------------------------------------------------------ +// appmgmtdownloadmgr::sendSrvToBg +// ------------------------------------------------------------------------------------------------ +void appmgmtdownloadmgr::sendSrvToBg() +{ + { + CCoeEnv* coe = CCoeEnv::Static(); + TApaTaskList taskList(coe->WsSession()); + TApaTask task=taskList.FindApp(TUid::Uid(KAppMgmtServerUid)); + if(task.Exists()) + { + task.SendToBackground(); + } + } +} + + + +//--------------------------------------------------------------------------------- +// CDialogWait::CDialogWait +//--------------------------------------------------------------------------------- +CDialogWait::CDialogWait() +: CActive(0) + { + CActiveScheduler::Add(this); + } + +//--------------------------------------------------------------------------------- +// CDialogWait::ConstructL +//--------------------------------------------------------------------------------- +void CDialogWait::ConstructL() + { + iWait = new( ELeave ) CActiveSchedulerWait; + } + +//--------------------------------------------------------------------------------- +// CDialogWait::NewL +//--------------------------------------------------------------------------------- +CDialogWait* CDialogWait::NewL() + { + CDialogWait* self = new( ELeave ) CDialogWait(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +//--------------------------------------------------------------------------------- +// CDialogWait::~CDialogWait +// Destructor +//--------------------------------------------------------------------------------- +CDialogWait::~CDialogWait() + { + Cancel(); + delete iWait; + } + +//--------------------------------------------------------------------------------- +// CDialogWait::Stop +//--------------------------------------------------------------------------------- +void CDialogWait::Stop() + { + if (iWait && iWait->IsStarted() && iWait->CanStopNow()) + { + iWait->AsyncStop(); + } + } + +//--------------------------------------------------------------------------------- +// CDialogWait::WaitOnDialog +//--------------------------------------------------------------------------------- +void CDialogWait::StartWait() + { + RDEBUG("startwait start"); + if (!IsActive() ) + { + if(iWait) + { + if(!iWait->IsStarted()) + { + iStatus = KRequestPending; + SetActive(); + iWait->Start(); + } + } + } + RDEBUG("startwait end"); + } + +// -------------------------------------------------------------------------- +// CDialogWait::DoCancel() +// -------------------------------------------------------------------------- +// +void CDialogWait::DoCancel() + { + if (iWait && iWait->IsStarted() && iWait->CanStopNow()) + { + iWait->AsyncStop(); + } + } + +// -------------------------------------------------------------------------- +// CDialogWait::RunL() +// -------------------------------------------------------------------------- +// +void CDialogWait::RunL() + { + if (iWait && iWait->IsStarted() && iWait->CanStopNow()) + { + iWait->AsyncStop(); + } + } + +// -------------------------------------------------------------------------- +// CDialogWait::RunError() +// -------------------------------------------------------------------------- +// +TInt CDialogWait::RunError(TInt aError) + { + RDEBUG_2("CDialogWait::RunError %d",aError ); + return KErrNone; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/appmgmtnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/appmgmtnotifier.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,601 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + + +#include +#include +#include +#include +#include "amstorage.h" +#include "appmgmtnotifier.h" +#include "appmgmtdownloadmgr.h" +#include "applicationmanagementutility.h" +#include "debug.h" +#include +#include +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::AppMgmtNotifier +// ------------------------------------------------------------------------------------------------ +AppMgmtNotifier::AppMgmtNotifier(QString aAppName) + { + m_appname = aAppName; + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::~AppMgmtNotifier +// ------------------------------------------------------------------------------------------------ +AppMgmtNotifier::~AppMgmtNotifier() + { + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::getAvailableDrives +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::getAvailableDrives() + { + RFs iFs; + int err; + qt_symbian_throwIfError(iFs.Connect()); + TDriveList driveList; + TInt driveCount = 0; + TBuf<20> buf; + int i = 0; + QString val; + QStringList list; + TDriveInfo info; + TVolumeInfo volumeInfo; + qt_symbian_throwIfError(DriveInfo::GetUserVisibleDrives(iFs, driveList, + driveCount)); + TUint driveStatus = 0; + for (TInt index(0); index < KMaxDrives; index++) + { + if (driveList[index]) + { + TRealFormat realFormat; + qt_symbian_throwIfError(DriveInfo::GetDriveStatus(iFs, index, + driveStatus)); + TFileName path; + TDriveUnit driveUnit(index); + if (!(driveStatus & DriveInfo::EDriveRemote)) + { + TBuf<64> freeSpace; + TReal free; + TInt64 freeKBytes; + realFormat.iWidth = 6; + iFs.Drive(info, index); + if(iFs.Volume(volumeInfo, index)==KErrNone) + { + freeKBytes = 0; + freeKBytes = volumeInfo.iFree / 1024; + RDEBUG_2("free space: (%d)", volumeInfo.iFree ); + free = volumeInfo.iFree / 1024; + freeSpace.Num(freeKBytes); + TInt sizeUnit = -1; + + //converting the drive freespace + int len = freeSpace.Length(); + if (len >= 7) + { + TReal nul = (1024 * 1024); + TReal temp = free / nul; + freeSpace.Num(temp, realFormat); + sizeUnit = 1; + } + else + { + TReal temp = free / 1024; + freeSpace.Num(temp, realFormat); + sizeUnit = 0; + } + //Getting the drive name in QString + path.Zero(); + path.Append(driveUnit.Name()); + val = QString::fromUtf16(path.Ptr(), path.Length()); + m_Drilist.Append(path); + //Getting the drive free space in QString + path.Zero(); + path.Append(freeSpace); + QString str1 = QString::fromUtf16(path.Ptr(), path.Length()); + QString driv; + if (sizeUnit == -1) + { + driv + = hbTrId( + "txt_deviceupdate_setlabel_install_to_val_1_2_kb").arg( + val, str1); + } + else if (sizeUnit == 0) + { + driv + = hbTrId( + "txt_deviceupdate_setlabel_install_to_val_1_2_Mb").arg( + val, str1); + } + else + { + driv + = hbTrId( + "txt_deviceupdate_setlabel_install_to_val_1_2_Gb").arg( + val, str1); + } + m_DriveBox->insertItem(i++, driv); + } + } + } + } + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::showInstallDialog +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::showInstallDialog(CDeploymentComponent *aCompo, TRequestStatus &s) + { + bringServerToForeground(); + iStat = &s; + iComp = aCompo; + HbDocumentLoader loader; + QString val; + bool ok = false; + HbLabel* label; + int err; + iComp->SetDriveSelectionStatus(true); + CDeliveryComponentStorage* iStorage ; + QT_TRAP_THROWING(iStorage= CDeliveryComponentStorage::NewL()); + TRAP( err, QT_TRYCATCH_LEAVING(iStorage->UpdateL(*iComp))); + delete iStorage; + loader.load(":/xml/sample.docml", &ok); + if (!ok) + { + return; + } + Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); + m_Dialog = qobject_cast (loader.findWidget("dialog")); + + //set title for the dialog + label = qobject_cast (loader.findWidget( + "qtl_dialog_pri_heading")); + + val = hbTrId("txt_device_update_title_install"); + label->setPlainText(val); + + TDeploymentComponentName name = aCompo->ComponentName(); + TBuf nameBuf; + nameBuf.Copy(name); + m_appname = QString::fromUtf16(nameBuf.Ptr(), nameBuf.Length()); + //set the app name + label = qobject_cast (loader.findWidget("label")); + val = hbTrId("txt_deviceupdate_info_file_1_2").arg(m_appname); + label->setPlainText(val); + + //size + label = qobject_cast (loader.findWidget("label_1")); + label->setPlainText(""); + //icon + label = qobject_cast (loader.findWidget("icon")); + label->setIcon(HbIcon(":/icon/qgn_prop_sml_http.svg")); + + //"install to" label + label = qobject_cast (loader.findWidget("qtl_dialog_pri5")); + val = hbTrId("txt_device_update_setlabel_install_to"); + label->setPlainText(val); + + //getting the available free space in all drives and adding to combobox + + m_DriveBox = qobject_cast (loader.findWidget("combobox")); + + TRAP(err,getAvailableDrives()); + if(err==KErrNone) + { + connect(m_DriveBox, SIGNAL(currentIndexChanged(int)), this, + SLOT(defaultDriveChanged(int ))); + } + else + m_DriveBox->setVisible(false); + //setting the actions + m_OkButton = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_left")); + m_Cancel = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_right")); + val = hbTrId("txt_common_button_ok"); + m_OkButton->setText(val); + val = hbTrId("txt_common_button_cancel"); + m_Cancel->setText(val); + m_Dialog->setTimeout(20000); + CApplicationManagementUtility::mCurrDlg = m_Dialog; + m_Dialog->open(this, SLOT(dlgSlot(HbAction*))); + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::defaultDriveChanged +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::defaultDriveChanged(int i) + { + TAMInstallOptions opts = iComp->InstallOpts(); + TChar drive = m_Drilist[i*2]; + drive.LowerCase(); + int err; + opts.iOptions.iDrive = drive; + TPtrC8 buf; + TAMInstallOptionsPckg optsb(opts); + buf.Set(optsb); + TRAP( err, QT_TRYCATCH_LEAVING(iComp->SetInstallOptsL(buf))); + CDeliveryComponentStorage* iStorage; + TRAP( err, QT_TRYCATCH_LEAVING(iStorage = CDeliveryComponentStorage::NewL())); + TRAP( err, QT_TRYCATCH_LEAVING(iStorage->UpdateL(*iComp))); + delete iStorage; + iStorage = NULL; + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::dlgSlot +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::dlgSlot(HbAction* action) + { + if(action == m_Cancel) + { + sendServerToBackground(); + TRequestStatus* status(iStat); + User::RequestComplete(status, KStatusUserCancelled); + } + else + { + TRequestStatus* status(iStat); + User::RequestComplete(status, KErrCompletion ); + } + CApplicationManagementUtility::mCurrDlg = 0; + m_OkButton=0; + m_Cancel = 0; + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::showInstallFailedNote +//launching a device dialog to display notefor "install failed" case +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::showInstallFailedNote() + { + HbDeviceDialog deviceDialog; + QVariantMap parameters; + //_LIT(KScomoNotifier, "scomonotifier"); + parameters.insertMulti(QString("scomonotifier"), QVariant(QString("installfailed"))); + QString data = m_appname; + parameters.insertMulti(QString("scomoappname"), QVariant(data)); + const char *deviceDialogType = "com.nokia.hb.devicemanagementdialog/1.0"; + bool ret = deviceDialog.show(QString(deviceDialogType), parameters); + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::sendServerToBackground +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::sendServerToBackground() + { + CCoeEnv* coe = CCoeEnv::Static(); + TApaTaskList taskList(coe->WsSession()); + TApaTask task=taskList.FindApp(TUid::Uid(KAppMgmtServerUid)); + if(task.Exists()) + { + task.SendToBackground(); + } + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::bringServerToForeground +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::bringServerToForeground() + { + CCoeEnv* coe = CCoeEnv::Static(); + TApaTaskList taskList(coe->WsSession()); + TApaTask task = taskList.FindApp(TUid::Uid(KAppMgmtServerUid)); + if (task.Exists()) + { + task.BringToForeground(); + } + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::operationSuccessSlot +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::successSlot(HbAction* action) + { + RDEBUG("successslot"); + if(action == m_OkButton || action == NULL) + { + sendServerToBackground(); + RDEBUG("slot entered"); + TRequestStatus* status(iStat); + User::RequestComplete(status, KErrCompletion); + } + m_OkButton = 0; + RDEBUG("successslot end"); + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::showInstallSuccessNote +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::showInstallSuccessNote() + { + if (CApplicationManagementUtility::mHidden == 1) + { + //Display Installation complete dialog + HbDeviceNotificationDialog notificationDialog; + QString text = + hbTrId("txt_device_update_title_installation_complete"); + notificationDialog.setTitle(text); + text + = hbTrId("txt_device_update_dblist_product_code_val_installa").arg( + m_appname); + notificationDialog.setText(text); + notificationDialog.show(); + } + else + { + bringServerToForeground(); + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/error_notes.docml", &ok); + QString val; + // Exit if the file format is invalid + Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); + m_Dialog = qobject_cast (loader.findWidget( + "dialog")); + HbLabel* label = qobject_cast (loader.findWidget( + "heading_text")); + val = hbTrId("txt_device_update_title_installation_complete"); + label->setPlainText(val); + + val = hbTrId("txt_deviceupdate_info_file_1_2").arg(m_appname); + label = qobject_cast (loader.findWidget("content_text")); + label->setPlainText(val); + m_OkButton = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_left")); + val = hbTrId("txt_common_button_ok"); + m_OkButton->setText(val); + + m_Dialog->setTimeout(HbPopup::ContextMenuTimeout); + //m_Dialog->setAttribute(Qt::WA_DeleteOnClose); + m_Dialog->open(this, SLOT(successSlot(HbAction*))); + CDialogWait* wait = CDialogWait::NewL(); + registerStatus(wait->iStatus); + RDEBUG_2("AppMgmtNotifier::Start before StartWait (%d)", wait->iStatus.Int()); + wait->StartWait(); + delete wait; + } + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::dialogUnSlot +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::dialogUnSlot(HbAction* retAction) + { + sendServerToBackground(); + if (retAction == m_Cancel) + { + TRequestStatus* status(iStat); + User::RequestComplete(status, KStatusUserCancelled); + } + else + { + TRequestStatus* status(iStat); + User::RequestComplete(status, KErrCompletion); + } + CApplicationManagementUtility::mCurrDlg = 0; + m_OkButton = 0; + m_Cancel = 0; + } + + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::showUninstallDialog +//uninstall beginning confirmation note +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::showUninstallDialog(const CDeploymentComponent &aCompo, + TRequestStatus &s) + { + iStat = &s; + bringServerToForeground(); + + HbDocumentLoader loader; + bool ok; + loader.load(":/xml/downloaddialog.docml", &ok); + + Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); + m_Dialog = qobject_cast (loader.findWidget("dialog")); + + HbLabel* label = qobject_cast (loader.findWidget( + "qtl_dialog_pri_heading")); + QString val = hbTrId("txt_device_update_title_uninstalling_application"); + label->setPlainText(val); + + label = qobject_cast (loader.findWidget("icon")); + label->setIcon(HbIcon(":/icons/qgn_prop_sml_http.svg")); + + label = qobject_cast (loader.findWidget("qtl_dialog_pri5")); + TDeploymentComponentName name = aCompo.ComponentName(); + TBuf<255> ne; + ne.Copy(name); + + QString str = QString::fromUtf16(ne.Ptr(), ne.Length()); + val = hbTrId("txt_deviceupdate_info_application_1").arg(str); + label->setPlainText(val); + + label = qobject_cast (loader.findWidget("qtl_dialog_pri5_1")); + label->setPlainText(""); + + m_OkButton = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_left")); + m_Cancel = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_right")); + val = hbTrId("txt_common_button_ok"); + m_OkButton->setText(val); + val = hbTrId("txt_common_button_cancel"); + m_Cancel->setText(val); + CApplicationManagementUtility::mCurrDlg = m_Dialog; + m_Dialog->setTimeout(10000); + m_Dialog->open(this, SLOT(dialogUnSlot(HbAction*))); + } + + +// ------------------------------------------------------------------------------------------------ +//AppMgmtNotifier::showUnInstallFailedNote +//Displaying uninstall failed note +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::showUnInstallFailedNote() + { + HbDeviceDialog deviceDialog; + QVariantMap parameters; + //_LIT(KScomoNotifier, "scomonotifier"); + parameters.insertMulti(QString("scomonotifier"), QVariant(QString( + "uninstallfailed"))); + QString data = m_appname; + parameters.insertMulti(QString("scomoappname"), QVariant(data)); + const char *deviceDialogType = "com.nokia.hb.devicemanagementdialog/1.0"; + bool ret = deviceDialog.show(QString(deviceDialogType), parameters); + } + + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::showUnInstallSuccessNote +//uninstall success notification +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::showUnInstallSuccessNote() + { + if (CApplicationManagementUtility::mHidden == 1) + { + //Display Installation complete dialog + HbDeviceNotificationDialog notificationDialog; + QString text = hbTrId( + "txt_device_update_title_uninstallation_complete"); + notificationDialog.setTitle(text); + text + = hbTrId( + "txt_device_update_dblist_product_code_val_uninstalla_comple").arg( + m_appname); + notificationDialog.setText(text); + notificationDialog.show(); + } + else + { + bringServerToForeground(); + + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/error_notes.docml", &ok); + QString val; + // Exit if the file format is invalid + Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); + m_Dialog = qobject_cast (loader.findWidget( + "dialog")); + QString blank(""); + HbLabel* label = qobject_cast (loader.findWidget( + "heading_text")); + val = hbTrId("txt_device_update_title_uninstallation_complete"); + label->setPlainText(val); + val + = hbTrId( + "txt_device_update_dblist_product_code_val_uninstalla_comple").arg( + m_appname); + label = qobject_cast (loader.findWidget("content_text")); + label->setPlainText(val); + m_OkButton = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_left")); + val = hbTrId("txt_common_button_ok"); + m_OkButton->setText(val); + + m_Dialog->setTimeout(HbPopup::StandardTimeout); + m_Dialog->open(this, SLOT(successSlot(HbAction*))); + CDialogWait* wait = CDialogWait::NewL(); + registerStatus(wait->iStatus); + RDEBUG_2("AppMgmtNotifier::Start before StartWait (%d)", wait->iStatus.Int()); + wait->StartWait(); + delete wait; + } + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::showDownloadFailedNote +// ------------------------------------------------------------------------------------------------ +bool AppMgmtNotifier::showDownloadFailedNote(QString aNotifierdata) + { + HbDeviceDialog deviceDialog; + QVariantMap parameters; + //_LIT(KScomoNotifier, "scomonotifier"); + parameters.insertMulti(QString("scomonotifier"), QVariant(QString( + "downloadfailed"))); + parameters.insertMulti(QString("scomoappdata"),QVariant(aNotifierdata)); + const char *deviceDialogType = "com.nokia.hb.devicemanagementdialog/1.0"; + bool stat = deviceDialog.show(QString(deviceDialogType), parameters); + return stat; + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtNotifier::showDownloadSuccessNote +// ------------------------------------------------------------------------------------------------ +void AppMgmtNotifier::showDownloadSuccessNote() + { + if (CApplicationManagementUtility::mHidden == 1) + { + HbDeviceNotificationDialog notificationDialog; + QString tr = hbTrId("txt_device_update_title_download_complete"); + notificationDialog.setTitle(tr); + tr + = hbTrId( + "txt_device_update_dblist_product_code_val_download_comple").arg( + m_appname); + notificationDialog.setText(tr); + notificationDialog.show(); + } + else + { + bringServerToForeground(); + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/error_notes.docml", &ok); + QString val; + // Exit if the file format is invalid + Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); + m_Dialog = qobject_cast (loader.findWidget( + "dialog")); + HbLabel* label = qobject_cast (loader.findWidget( + "heading_text")); + val = hbTrId("txt_device_update_title_download_complete"); + label->setPlainText(val); + + val = hbTrId("txt_device_update_dblist_product_code_val_download_comple").arg(m_appname); + label = qobject_cast (loader.findWidget("content_text")); + label->setPlainText(val); + m_OkButton = qobject_cast (loader.findObject( + "qtl_dialog_softkey_2_left")); + val = hbTrId("txt_common_button_ok"); + m_OkButton->setText(val); + + m_Dialog->setTimeout(HbPopup::ContextMenuTimeout); + + m_Dialog->open(this, SLOT(successSlot(HbAction*))); + CDialogWait* wait = CDialogWait::NewL(); + registerStatus(wait->iStatus); + RDEBUG_2("AppMgmtNotifier::Start before StartWait (%d)", wait->iStatus.Int()); + wait->StartWait(); + delete wait; + } + } +void AppMgmtNotifier::registerStatus(TRequestStatus &stat) + { + RDEBUG("registering request status"); + iStat = &stat; + stat = KRequestPending; + RDEBUG_2("stat = %d",stat.Int() ); + RDEBUG("registering request status end"); + } diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/appmgmtprogdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/appmgmtprogdialog.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2000 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 downloading progress note + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "appmgmtdownloadmgr.h" +#include "ApplicationManagementUtility.h" + +using namespace NApplicationManagement; + +// ------------------------------------------------------------------------------------------------ +// AppMgmtProgDialog::AppMgmtProgDialog +// ------------------------------------------------------------------------------------------------ +AppMgmtProgDialog::AppMgmtProgDialog(QString aAppData, Download &mdl,int &aUserCancelled) +:m_Dlg(0) + { + m_Data=aAppData; + iDl=&mdl; + mUsrCancel = aUserCancelled; + m_Indi = 0; + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtProgDialog::~AppMgmtProgDialog() +// ------------------------------------------------------------------------------------------------ +AppMgmtProgDialog::~AppMgmtProgDialog() + { + if(m_Dlg) + { + delete m_Dlg; + m_Dlg=NULL; + } + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtProgDialog::sendServerToBackground() +// ------------------------------------------------------------------------------------------------ +void AppMgmtProgDialog::sendServerToBackground() + { + CCoeEnv* coe = CCoeEnv::Static(); + TApaTaskList taskList(coe->WsSession()); + TApaTask task=taskList.FindApp(TUid::Uid(KAppMgmtServerUid)); + if(task.Exists()) + { + task.SendToBackground(); + } + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtProgDialog::startDialog +// ------------------------------------------------------------------------------------------------ +void AppMgmtProgDialog::startDialog(int aContentSize,int aDownloaded) + { + if (m_Dlg == NULL) + { + m_Dlg = new HbProgressDialog(HbProgressDialog::ProgressDialog); + CApplicationManagementUtility::mCurrDlg = m_Dlg; + QStringList strList = m_Data.split(","); + m_Name = strList[0]; + m_SizeStr = strList[1]; + } + m_Dlg->setMinimum(0); + m_Dlg->setMaximum(aContentSize); + + m_Dlg->setAutoClose(true); + m_Dlg->setProgressValue(aDownloaded); + + QString val = hbTrId("txt_device_update_title_downloading"); + m_Dlg->setHeadingWidget(new HbLabel(val)); + + val = hbTrId("txt_deviceupdate_info_file_1_2").arg(m_Name); + val.append("\n"); + val.append(m_SizeStr); + + m_Dlg->setText(val); + val = hbTrId("txt_common_button_hide"); + HbAction* hide = new HbAction(); + hide->setText(val); + m_Dlg->clearActions(); + m_Dlg->addAction(hide); + val = hbTrId("txt_common_button_cancel"); + HbAction* cancel = new HbAction(); + cancel->setText(val); + m_Dlg->addAction(cancel); + QObject::connect(hide, SIGNAL(triggered()), this, + SLOT(hideAMProgDialog())); + QObject::connect(cancel, SIGNAL(triggered()), this, SLOT(cancelDialog())); + m_Dlg->show(); + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtProgDialog::closeAMProgDialog() +// ------------------------------------------------------------------------------------------------ +void AppMgmtProgDialog::closeAMProgDialog() + { + CApplicationManagementUtility::mCurrDlg=0; + if(m_Dlg) + { + m_Dlg->close(); + } + if(CApplicationManagementUtility::mHidden==0) + { + sendServerToBackground(); + } + else + { + m_Indi->deactivate(KScomoProgressIndicatorType); + } + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtProgDialog::cancelDialog() +// ------------------------------------------------------------------------------------------------ +void AppMgmtProgDialog::cancelDialog() + { + mUsrCancel = 1; + iDl->cancel(); + if(m_Dlg) + { + m_Dlg->close(); + } + sendServerToBackground(); + CApplicationManagementUtility::mCurrDlg=0; + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtProgDialog::hideAMProgDialog() +// ------------------------------------------------------------------------------------------------ +void AppMgmtProgDialog::hideAMProgDialog() + { + sendServerToBackground(); + + QString str = hbTrId("txt_device_update_dblist_product_code_val_download").arg(m_Name); + CApplicationManagementUtility::mHidden=1; + m_Indi = new HbIndicator(); + m_Indi->activate(KScomoProgressIndicatorType,str); + } + +// ------------------------------------------------------------------------------------------------ +// AppMgmtProgDialog::updateProgress +// ------------------------------------------------------------------------------------------------ +void AppMgmtProgDialog::updateProgress(int aProgress) + { + if(m_Dlg) + { + m_Dlg->setProgressValue(aProgress); + } + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/main.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include "ApplicationManagementCommon.h" +#include "debug.h" +#include "amview.h" +#include "ApplicationManagementServer.h" + +using namespace NApplicationManagement; + +int main(int argc, char *argv[]) + { + RDEBUG( "ApplicationManagementServer: main" ); + + HbApplication app(argc, argv); + + AMView* view = new AMView(); + view->hideItems(Hb::AllItems); + view->setContentFullScreen(); + //Defining transparent window + HbMainWindow mainWindow(0, Hb::WindowFlagTransparent); + HbTransparentWindow *transparentWindow = new HbTransparentWindow; + HbStackedLayout *stackedLayout = new HbStackedLayout; + stackedLayout->addItem(transparentWindow); + view->setLayout(stackedLayout); + + mainWindow.addView(view); + mainWindow.setCurrentView(view); + + app.installEventFilter(view); + + //Installing the translator + QTranslator *translator = new QTranslator(); + QString lang = QLocale::system().name(); + + bool fine = translator->load("deviceupdates_" + lang, path);/*finally required once localisation available*/ + if (fine) + qApp->installTranslator(translator); + int err = KErrNone; + TRAP( err, QT_TRYCATCH_LEAVING(CApplicationManagementServer::NewL(&mainWindow))); + + RProcess::Rendezvous(KErrNone); + + //Pushing the server to background + mainWindow.lower(); + + TInt serverLaunchStatus = 1; + err = RProperty::Set(KProperty, KInteger, serverLaunchStatus); + + mainWindow.show(); + int err1 = app.exec(); + int value = 0; + err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KDownloadActive, value); + RDEBUG_2("RProperty set (%d)", err ); + return err1; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/nsmldmiapmatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/nsmldmiapmatcher.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,202 @@ +/* + * 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 Tree module + * + */ + +#include +#include +#include "nsmldmiapmatcher.h" + + +// ----------------------------------------------------------------------------- +// CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewL( MSmlDmCallback* aDmCallback ) +// ----------------------------------------------------------------------------- +CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewL(MSmlDmCallback* aDmCallback) + { + CNSmlDMIAPMatcher* self = CNSmlDMIAPMatcher::NewLC(aDmCallback); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewLC( MSmlDmCallback* aDmCallback ) +// ----------------------------------------------------------------------------- +CNSmlDMIAPMatcher* CNSmlDMIAPMatcher::NewLC(MSmlDmCallback* aDmCallback) + { + CNSmlDMIAPMatcher* self = new( ELeave ) CNSmlDMIAPMatcher; + CleanupStack::PushL(self); + self->ConstructL(aDmCallback); + return self; + } + +// ----------------------------------------------------------------------------- +// void CNSmlDMIAPMatcher::ConstructL( MSmlDmCallback* aDmCallback ) +// ----------------------------------------------------------------------------- +void CNSmlDMIAPMatcher::ConstructL(MSmlDmCallback* aDmCallback) + { + iCallback = aDmCallback; + } + +// ----------------------------------------------------------------------------- +// CNSmlDMIAPMatcher::~CNSmlDMIAPMatcher() +// ----------------------------------------------------------------------------- +CNSmlDMIAPMatcher::~CNSmlDMIAPMatcher() + { + } + +// ----------------------------------------------------------------------------- +// TInt CNSmlDMIAPMatcher::IAPIdFromURIL( const TDesC8& aURI ) +// ----------------------------------------------------------------------------- +TInt CNSmlDMIAPMatcher::IAPIdFromURIL(const TDesC8& aURI) + { + TInt iapId(KErrNotFound); + + MSmlDmAdapter::TError status; + CBufBase* allIAPs = CBufFlat::NewL(16); + CleanupStack::PushL(allIAPs); + iCallback->FetchLinkL(KNSmlDMIAPUri, *allIAPs, status); + TPtrC8 uri = RemoveDotSlash(aURI); + + if (status == MSmlDmAdapter::EOk && uri.Find(KNSmlDMIAPUri) == 0 + && allIAPs->Ptr(0).Find(LastURISeg(uri))>=0) + { + HBufC8* luid = iCallback->GetLuidAllocL(uri); + + if (luid->Length() ) + { + iapId = DesToInt(*luid); + } + delete luid; + } + + CleanupStack::PopAndDestroy(allIAPs); + + return iapId; + } + +// ----------------------------------------------------------------------------- +// HBufC8* CNSmlDMIAPMatcher::URIFromIAPIdL( TInt aIAPId ) +// ----------------------------------------------------------------------------- +HBufC8* CNSmlDMIAPMatcher::URIFromIAPIdL(TInt aIAPId) + { + CBufBase *allIAPs = CBufFlat::NewL(16); + CleanupStack::PushL(allIAPs); + MSmlDmAdapter::TError status; + + iCallback->FetchLinkL(KNSmlDMIAPUri, *allIAPs, status); + + if (status == MSmlDmAdapter::EOk) + { + TInt index(0); + TInt segStart(0); + + while (index != KErrNotFound) + { + TPtrC8 allIAPsptr = allIAPs->Ptr(segStart).Mid(0); + index = allIAPsptr.Locate('/'); + HBufC8* uriSeg = 0; + + if (index == KErrNotFound) + { + TPtrC8 uriSeg8Ptr = allIAPs->Ptr(segStart); + uriSeg = uriSeg8Ptr.AllocLC(); + } + else + { + TPtrC8 uriSeg8Ptr = allIAPs->Ptr(segStart).Mid( 0, index); + uriSeg = uriSeg8Ptr.AllocLC(); + } + + HBufC8* uri = HBufC8::NewLC(KNSmlDMIAPUri().Length() + 1 + uriSeg->Length() ); + + TPtr8 uriPtr = uri->Des(); + uriPtr.Format(KNSmlDMIAPUri); + uriPtr.Append(KNSmlDMSeparator8); + uriPtr.Append( *uriSeg); + HBufC8* luid = iCallback->GetLuidAllocL(uriPtr); + CleanupStack::PushL(luid); + + if (luid->Length() > 0) + { + TInt iapId = DesToInt(luid->Des()); + if (iapId == aIAPId) + { + CleanupStack::PopAndDestroy(); //luid + CleanupStack::Pop(); //uri + CleanupStack::PopAndDestroy(2); //uriSeg, allIAPs + return uri; + } + } + CleanupStack::PopAndDestroy(3); // luid, uri, uriSeg + + segStart += index + 1; + } + } + + CleanupStack::PopAndDestroy(); // allIAPs + + return 0; + } + +// ----------------------------------------------------------------------------- +// TInt CNSmlDMIAPMatcher::DesToInt(const TDesC& aLuid) +// ----------------------------------------------------------------------------- +TInt CNSmlDMIAPMatcher::DesToInt(const TDesC8& aLuid) + { + TLex8 lex(aLuid); + TInt value = 0; + lex.Val(value); + return value; + } + +// ----------------------------------------------------------------------------- +// TPtrC8 CNSmlDMIAPMatcher::RemoveDotSlash(const TDesC8& aURI) const +// ----------------------------------------------------------------------------- +TPtrC8 CNSmlDMIAPMatcher::RemoveDotSlash(const TDesC8& aURI) const + { + if (aURI.Find(KNSmlDMIAPUriDotSlash)==0) + { + return aURI.Right(aURI.Length()-KNSmlDMIAPUriDotSlash().Length() ); + } + else + { + return aURI; + } + } + +// ----------------------------------------------------------------------------- +// CNSmlDMIAPMatcher::TPtrC8 LastURISeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ----------------------------------------------------------------------------- +TPtrC8 CNSmlDMIAPMatcher::LastURISeg(const TDesC8& aURI) const + { + TInt i; + for (i=aURI.Length()-1; i>=0; i--) + { + if (aURI[i]==KNSmlDMSlash) + { + break; + } + } + if (i==0) + { + return aURI; + } + else + { + return aURI.Mid(i+1); + } + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/server/src/nsmldmuri.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/server/src/nsmldmuri.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,207 @@ +/* + * 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. + * + */ + +#include "nsmldmuri.h" + +// ------------------------------------------------------------------------------------------------ +// NSmlDmURI +// ------------------------------------------------------------------------------------------------ + + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::ParentURI(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::ParentURI(const TDesC8& aURI) + { + TBool onlyOneSeg = ETrue; + TInt i; + for (i=aURI.Length()-1; i>=0; i--) + { + if (aURI[i]==KNSmlDMUriSeparator) + { + onlyOneSeg = EFalse; + break; + } + } + if (onlyOneSeg) + { + return KNSmlDmRootUri(); + } + else + { + return aURI.Left(i); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::LastURISeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::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); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI) +// return uri without dot and slash in start +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI) + { + + TInt offset = 0; + TInt endSlash = 0; + + if (aURI.Find(KNSmlDmUriDotSlash)==0) + { + offset = 2; + } + else + { + return aURI; + } + + if (aURI.Length()>2&&aURI[aURI.Length()-1]==KNSmlDMUriSeparator) + { + endSlash = 1; + } + + return aURI.Mid(offset, aURI.Length()-endSlash-offset); + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI) +// removes property from the uri +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI) + { + TInt offset = aURI.Find(KNSmlDmQuestionMark); + if (offset!=KErrNotFound) + { + return aURI.Left(offset); + } + return aURI; + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 NSmlDmURI::RemoveLastSeg(const TDesC8& aURI) +// Removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 NSmlDmURI::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 NSmlDmURI::URISeg(const TDesC8& aURI,TInt aLocation,TInt aSegCount=1) +// Returns the aLocation:th URI segment +// ------------------------------------------------------------------------------------------------ +/*TPtrC8 NSmlDmURI::URISeg(const TDesC8& aURI, TInt aLocation, TInt aSegCount/*=1*///) + /*{ + TInt i, start; + if (aLocation < 0) + { + return aURI.Mid(0, 0); + } + if (aLocation > 0) + { + for (start=0, i=0; (start= aURI.Length()) + { + return aURI.Mid(0, 0); + } + // start points to beginning of segment + for (i=start+1; i + + + + + + + + + + + + + \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/eabi/amtestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/eabi/amtestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,9 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI7Camtest @ 2 NONAME ; ## + _ZTV7Camtest @ 3 NONAME ; ## + _ZTI16CTestDmDDFObject @ 4 NONAME ; ## + _ZTI8Cdmatest @ 5 NONAME ; ## + _ZTV16CTestDmDDFObject @ 6 NONAME ; ## + _ZTV8Cdmatest @ 7 NONAME ; ## + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/group/amtest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/group/amtest.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,66 @@ +/* +* 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 applicationmanagement components +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include + +TARGET amtest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 +CAPABILITY ALL -TCB + +//TARGETPATH +DEFFILE amtest.def + +SOURCEPATH ../src +SOURCE dmatest.cpp +SOURCE TestDmDDFObject.cpp +SOURCE amtest.cpp +SOURCE amtestBlocks.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include + +SYSTEMINCLUDE /epoc32/include/ecom +#ifdef __TARM_SYMBIAN_CONVERGENCY +SYSTEMINCLUDE /epoc32/include/devman +#else +// nothing +#endif + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY ApplicationManagement.lib +LIBRARY efsrv.lib +LIBRARY SWInstCli.lib +LIBRARY ecom.lib +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY estor.lib + +LANG SC + + + +SMPSAFE +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/group/amtest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/group/amtest.pkg Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,43 @@ +; +; 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: Package file for project Advance Device Management, Application Management component. +;File: amtest.pkg; +;File: amtest.pkg; +; + + +;*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. +#{"amtest"},(0x101FB3E3),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\amtest.dll" -"C:\sys\bin\amtest.dll" +"..\conf\amtest.cfg" -"C:\TestFramework\amtest.cfg" +"..\init\amtest.ini" -"C:\TestFramework\amtest.ini" +"..\data\dmtestmappings.txt" -"E:\Testing\Data\dmtestmappings.txt" +"..\data\testhbuf_S60_3_X_v_1_0_0.SISx" -"E:\Testing\Data\testhbuf_S60_3_X_v_1_0_0.SISx" +"..\data\verysilent_c_en.xml" -"E:\Testing\Data\verysilent_c_en.xml" diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,51 @@ +/* +* 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 applicationmanagement components +* +*/ + + + +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 + + +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. + + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' + +amtest.mmp + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/inc/TestDmDDFObject.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2002-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: Implementation of applicationmanagement components +* +*/ + + + +#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 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/inc/amtest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/inc/amtest.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,130 @@ +/* +* 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 applicationmanagement components +* +*/ + + + +#ifndef AMTEST_H +#define AMTEST_H + +// INCLUDES +#include +#include +#include +#include +#include "dmatest.h" + +const TUint KNSmlDMAMAdapterImplUid = 0x10207845; + + + +const TUid KAdapterUid = + { + KNSmlDMAMAdapterImplUid + }; +// Logging path +_LIT( KamtestLogPath, "\\logs\\testframework\\amtest\\" ); +// Log file +_LIT( KamtestLogFile, "amtest.txt" ); + + +// FORWARD DECLARATIONS +class Camtest; + + +// CLASS DECLARATION + +/** +* Camtest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +class Camtest : public Cdmatest + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Camtest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Camtest(); + + 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. + */ + Camtest( 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 // AMTEST_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/inc/dmatest.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2002-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: Helper base class for dm adapter testing +* +*/ + + + +#ifndef __DMA_TEST_H__ +#define __DMA_TEST_H__ + +// INCLUDES +#include +#include +#include +#include +#include + +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 FetchLeafObjectSizeL( CStifItemParser& aItem ) ; + //Newly added + TInt Cdmatest::AddLeafNode( CStifItemParser& aItem ); + TInt Cdmatest::InstallActivate( CStifItemParser& aItem ); + //Newly ended + + 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 ; + HBufC8 *iURI; + CArrayFix *iEmptyMappingInfoArray; + TFileName iSaveFileName; + RMappingArray iMappingTable; + TUid iUid; + TInt iCounter; + //class CNSmlDmMgmtTree* iMgmtTree; + class CNSmlDmMgmtTree* iMgmtTree; + CSmlDmAdapter *Adapter() ; + }; + +#endif // __DMA_TEST_H__ + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/init/amtest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/init/amtest.ini Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,221 @@ +# +# 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'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - 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, HTML or XML +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 + +ModuleName= testscripter +# ADM Test-Automation +ConfigFile= C:\TestFramework\amtest.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] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/src/TestDmDDFObject.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,512 @@ +/* +* Copyright (c) 2002-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: Implementation of applicationmanagement components +* +*/ + + + +// 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 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/src/amtest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/src/amtest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,103 @@ +/* +* 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 applicationmanagement components +* +*/ + + + +// INCLUDE FILES +#include +#include "amtest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Camtest::Camtest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Camtest::Camtest( CTestModuleIf& aTestModuleIf ) + : Cdmatest( aTestModuleIf, KAdapterUid ) + { + } +// ----------------------------------------------------------------------------- +// Camtest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Camtest::ConstructL() + { + iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile ); + + iLog->Log( _L( "Loading Adapter" ) ); + + Cdmatest::ConstructL(); + + } + +// ----------------------------------------------------------------------------- +// Camtest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Camtest* Camtest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Camtest* self = new (ELeave) Camtest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Camtest::~Camtest() + { + + // 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* ) Camtest::NewL( aTestModuleIf ); + + } + + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/src/amtestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/src/amtestBlocks.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,507 @@ +/* +* 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 applicationmanagement components +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include "amtest.h" +#include "applicationmanagementclient.h" +#include +#include +#include + + +using namespace NApplicationManagement; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Camtest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Camtest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Camtest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Camtest::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", Camtest::DDFStructureL), + ENTRY( "List", Camtest::ExampleL ), + ENTRY( "Deliver", Camtest::DeliverL ), + ENTRY( "Details", Camtest::DetailsL ), + ENTRY( "Install", Camtest::InstallL ), + ENTRY( "BareInstall", Camtest::BareInstallL ), + ENTRY( "FetchNode", Camtest::FetchNodeL ), + ENTRY( "FetchLeaf", Camtest::FetchLeafL ), + ENTRY( "FetchLeafObjectSizeL", Camtest::FetchLeafObjectSizeL ), + //ENTRY( "CompleteCommands", Cdmatest::CompleteCommandsL ), + ENTRY( "AddNode", Camtest::AddNodeL ), + ENTRY( "UpdateLeaf", Camtest::UpdateLeafL ), + ENTRY( "UpdateLeafData", Camtest::UpdateLeafDataL ), + ENTRY( "UpdateLeafDataURI", Camtest::UpdateLeafDataURLL ), + ENTRY( "Execute", Camtest::ExecuteLeafL ), + ENTRY( "ExecuteData", Camtest::ExecuteLeafDataL ), + ENTRY( "DeleteNode", Camtest::DeleteObjectL ), + ENTRY( "StartAtomic", Camtest::StartAtomicL), + ENTRY( "CommitAtomic", Camtest::CommitAtomicL), + ENTRY( "RollbackAtomic", Camtest::RollbackAtomicL), + //Newly addded + ENTRY( "AddLeafNode", Camtest::AddLeafNode), + ENTRY( "InstallActivate", Camtest::InstallActivate), + //Newly ended +// ENTRY( "BareAppInstall", Camtest::BareAppInstallL), +/* ENTRY( "DDFStructure", Camtest::DDFStructureL),*///BareAppInstallL + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Camtest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Camtest::ExampleL( CStifItemParser& /*aItem*/ ) + { + + // Print to UI + TestModuleIf().Printf( 0, _L("amtest"), _L("In Example") ); + // Print to log file + iLog->Log(_L("In Example")); + + RApplicationManagement ams ; + TInt err( ams.Connect() ); + + if ( err == KErrNone ) + { + RElementIdArray array; + ams.DeploymentComponentIdsL(array); + iLog->Log( _L( "Found %d Ids" ), array.Count() ); + for ( TInt i = 0; i < array.Count(); i++ ) + { + iLog->Log( _L( " Id %d: %d" ), i, array[i] ); + } + + + TDeploymentComponent comp ; + comp.iId = _L8( "Iidee" ); + TBuf8<10> buf; + TTime tm; + tm.HomeTime(); + TInt64 rn = tm.Int64() ; + TInt rand = Math::Rand( rn ) ; + buf.NumFixedWidth( rand, EHex, 10); + + comp.iId.Append( buf ); + comp.iVersion = _L8( "2.3" ); + comp.iName = _L8( "Nimi" ); + + err = ams.DeliverL(/*_L8("Leaf"), */comp.iId/*, comp.iName, comp.iVersion, EDCSDelivered, _L8("datadatadatadata"), _L8("iopts"), _L8("meta") */) ; + iLog->Log( _L( " Deliver response: %d, state: %d" ), err, comp.iState ); + User::LeaveIfError ( err ); + err = KErrNone; + + array.Reset(); + ams.DeploymentComponentIdsL(array); + iLog->Log( _L( "Found 2ndtime %d Ids" ), array.Count() ); + for ( TInt i = 0; i < array.Count(); i++ ) + { + iLog->Log( _L( " Id %d: %d" ), i, array[i] ); + + TDeploymentComponent comp2 ; + err = ams.DeploymentComponent(array[i], comp); + iLog->Log( _L( " DeploymentComponent response: %d, state: %d" ), err, comp.iState ); + if ( err == KErrNone ) + { + HBufC *b = HBufC::NewLC( comp.iId.Length() ); + TPtr p( b->Des() ); + p.Copy( comp.iId ); + + iLog->Log( _L( "CompId: %S" ), &p ); + CleanupStack::PopAndDestroy(); + } + else + { + + } + } + ams.Close(); + } + else + { + iLog->Log( _L( "Failed to connect: %d" ), err); + } + + return err; + + } + +// ----------------------------------------------------------------------------- +// Camtest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Camtest::DetailsL( CStifItemParser& aItem ) + { + + // Print to UI + TestModuleIf().Printf( 0, _L("amtest"), _L("In DetailsL") ); + // Print to log file + iLog->Log(_L("In DetailsL")); + + RApplicationManagement ams ; + TInt err( ams.Connect() ); + + if ( err == KErrNone ) + { + + TInt i( 0 ); + TInt nodename; + i = aItem.GetNextInt ( nodename ) ; + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading id argument: 0x%X"), i); + //return i; + } + else + { + iLog->Log( _L("id: %d"), nodename); + } + + RElementIdArray array; + ams.DeploymentComponentIdsL(array); + iLog->Log( _L( "Found %d Ids" ), array.Count() ); + for ( TInt i = 0; i < array.Count(); i++ ) + { + + iLog->Log( _L( " Id %d: %d" ), i, array[i] ); + + TDeploymentComponent comp2 ; + err = ams.DeploymentComponent(array[i], comp2); + iLog->Log( _L( " DeploymentComponent response: %d, state: %d" ), err, comp2.iState ); + if ( err == KErrNone ) + { + HBufC *b = HBufC::NewLC( comp2.iId.Length() ); + TPtr p( b->Des() ); + p.Copy( comp2.iId ); + + iLog->Log( _L( "CompId: %S" ), &p ); + CleanupStack::PopAndDestroy(); + } + else + { + + } + } + User::LeaveIfError ( err ); + err = KErrNone; + ams.Close(); + } + else + { + iLog->Log( _L( "Failed to connect: %d" ), err); + } + return err; + } + + +// ----------------------------------------------------------------------------- +// Camtest::InstallL +// ----------------------------------------------------------------------------- +// +TInt Camtest::InstallL( CStifItemParser& aItem ) + { + + // Print to UI + TestModuleIf().Printf( 0, _L("amtest"), _L("In InstallL") ); + // Print to log file + + iLog->Log(_L("In DetailsL")); + TCertInfo info ; + info.iFingerprint =_L8("finger"); + info.iSerialNo = _L8("serial"); + + RApplicationManagement ams ; + TInt err( ams.Connect( info ) ); + + + if ( err == KErrNone ) + { + + TInt i( 0 ); + TUint32 nodename; + i = aItem.GetNextInt ( (TInt&)nodename ) ; + if ( i != KErrNone ) + { + iLog->Log( _L( "ERROR Reading id argument: 0x%X"), i); + //return i; + } + else + { + iLog->Log( _L("id: %d"), nodename); + } + +/* RElementIdArray array; + ams.DeploymentComponentIdsL(array); + iLog->Log( _L( "Found %d Ids" ), array.Count() ); + for ( TInt i = 0; i < array.Count(); i++ ) + { + + iLog->Log( _L( " Id %d: %d" ), i, array[i] ); + + TDeploymentComponent comp2 ; + err = ams.DeploymentComponent(array[i], comp2); + iLog->Log( _L( " DeploymentComponent response: %d, state: %d" ), err, comp2.iState ); + if ( err == KErrNone ) + { + HBufC *b = HBufC::NewLC( comp2.iId.Length() ); + TPtr p( b->Des() ); + p.Copy( comp2.iId ); + + iLog->Log( _L( "CompId: %S" ), &p ); + CleanupStack::PopAndDestroy(); + + } + else + { + + } + + if ( nodename == array[i] ) + { + iLog->Log( _L( "CompId: %S" ), &p ); + } + } + */ + ams.InstallL( nodename ) ; + User::LeaveIfError ( err ); + err = KErrNone; + + ams.Close(); + } + else + { + iLog->Log( _L( "Failed to connect: %d" ), err); + } + return err; + } + +// ----------------------------------------------------------------------------- +// Camtest::InstallL +// ----------------------------------------------------------------------------- +// +TInt Camtest::BareInstallL( CStifItemParser& aItem ) + { + + // Print to UI + TestModuleIf().Printf( 0, _L("amtest"), _L("In InstallL") ); + // Print to log file + iLog->Log(_L("In DetailsL")); + +/*void CAmAdapter::InstallL( + TUint aLuidi, + const TDesC8& aURI, + const TDesC8& aLUID, + const TDeploymentComponentState aTargetState, + TError &aRet + TInt aluidi( 0 ); + TUint32 aLuidInt; + aluidi = aItem.GetNextInt ( (TInt&)aLuidInt ) ; + + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + + + SetURIL( nodename ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + TError ret( EError ); + + TRAPD( err, Adapter()->InstallL(aluidi,*iURI, *luid,3 ,ret));*/ + + //using namespace SwiUI; + SwiUI::RSWInstLauncher ams ; + TInt err( ams.Connect() ); + + if ( err == KErrNone ) + { + CleanupClosePushL( ams ); + iLog->Log( _L( "Connected!" )); + TPtrC filename ; + User::LeaveIfError( aItem.GetNextString( filename ) ); + + + + TRequestStatus stat; + + ams.Install( stat, filename ); + User::WaitForRequest( stat ); + CleanupStack::Pop(); + + ams.Close(); + } + else + { + iLog->Log( _L( "Failed to connect: %d" ), err); + } + return err; + } + + +HBufC8 *Camtest::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; + } + + +HBufC8 *LoadFileL( const TDesC8 &aDataFile ) + { + RFs fs ; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); // 1 + RFile file ; + TFileName fn; + fn.Copy( aDataFile ); + User::LeaveIfError ( file.Open( fs, fn, EFileRead ) ); + CleanupClosePushL( file ); // 2 + TInt size; + User::LeaveIfError( file.Size( size ) ); + + HBufC8 *res = HBufC8::NewLC( size ); //3 + TPtr8 p( res->Des() ); + User::LeaveIfError( file.Read( p ) ); + CleanupStack::Pop(); // res + CleanupStack::PopAndDestroy( 2 ); // file, fs + CleanupStack::PushL( res ); + return res ; + } + +// ----------------------------------------------------------------------------- +// Camtest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Camtest::DeliverL( CStifItemParser& aItem ) + { + + // Print to UI + TestModuleIf().Printf( 0, _L("amtest"), _L("In DeliverL") ); + // Print to log file + iLog->Log(_L("In DeliverL")); + + RApplicationManagement ams ; + TInt err( ams.Connect() ); + + if ( err == KErrNone ) + { + CleanupClosePushL( ams ); + HBufC8 *id = GetNextStringLC ( aItem, _L("Id") ) ; + HBufC8 *name = GetNextStringLC( aItem, _L( "Name" ) ) ; + HBufC8 *version = GetNextStringLC ( aItem, _L( "Version" ) ) ; + HBufC8 *data = GetNextStringLC ( aItem, _L( "data" ) ) ; + HBufC8 *instopt = GetNextStringLC (aItem, _L( "InstOpts" ) ) ; + if ( data != NULL ) + { + //HBufC8 *datat = NULL; + HBufC8 *datat = LoadFileL( *data ); + RElementIdArray array; + ams.DeploymentComponentIdsL(array); + iLog->Log( _L( "Found %d Ids" ), array.Count() ); + for ( TInt i = 0; i < array.Count(); i++ ) + { + iLog->Log( _L( " Id %d: %d" ), i, array[i] ); + } + + TDeploymentComponent comp ; + comp.iId = *id; + comp.iVersion = *version; + comp.iName = *name; + + err = ams.DeliverL(/*_L8("Jee"),*/ comp.iId/*, comp.iName, comp.iVersion, EDCSDelivered , *datat, *instopt, _L8("meta") */) ; + iLog->Log( _L( " Deliver response: %d, state: %d" ), err, comp.iState ); + User::LeaveIfError ( err ); + err = KErrNone; + + array.Reset(); + ams.DeploymentComponentIdsL(array); + iLog->Log( _L( "Found 2ndtime %d Ids" ), array.Count() ); + for ( TInt i = 0; i < array.Count(); i++ ) + { + iLog->Log( _L( " Id %d: %d" ), i, array[i] ); + } + + CleanupStack::PopAndDestroy( datat ); + } + CleanupStack::PopAndDestroy( instopt ); + CleanupStack::PopAndDestroy( data ); + CleanupStack::PopAndDestroy( version ); + CleanupStack::PopAndDestroy( name ); + CleanupStack::PopAndDestroy( id ); + CleanupStack::PopAndDestroy( ); //ams + } + else + { + iLog->Log( _L( "Failed to connect: %d" ), err); + } + + return err; + + } + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 applicationmanagement/tsrc/tarmappmng/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applicationmanagement/tsrc/tarmappmng/src/dmatest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,1127 @@ +/* +* Copyright (c) 2002-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: Implementation of applicationmanagement components +* +*/ + + + +// INCLUDE FILES +#include "dmatest.h" + +#include +#include +#include + +#include +#include +#ifdef __TARM_SYMBIAN_CONVERGENCY + #include "nsmldmtreedtd.h" +#else + //nothing +#endif +//#include "nsmldmtreedtd.h" +#include "TestDmDDFObject.h" + + +#include +#include "applicationmanagementclient.h" +#include +#include +#include + +using namespace NApplicationManagement; + +_LIT8( KEmptyType, "" ); +_LIT8( KDefaultType, "text/plain" ); +_LIT( KMappingTableFile, "c:\\TestFramework\\dmtestmappings.txt" ); +//_LIT8( KNSmlDMSeparator8, "/" ); + +//Newly added +_LIT8( KAMInstallOptsNodeName, "InstallOpts" ); +_LIT8( KAMDataNodeName, "Data" ); +//Newly ended +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 ); + } + } + +CSmlDmAdapter *Cdmatest::Adapter() + { + if ( iAdapter == NULL ) + { + if ( iLog ) + { + iLog->Log( _L( "Loading Adapter" ) ); + } + + TRAPD( err, iAdapter = 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 ); + } + // User::Leave( err ); + iAdapter = NULL; + } + } + return iAdapter; + } + + +void Cdmatest::LoadMappingsL() + { + TDataType type; + HBufC8 *data = LoadFileLC( KMappingTableFile, type ); + RDesReadStream buf( *data ); + CleanupClosePushL( buf ); + //buf.Set( aChilds) + 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() ) ; +// TPtrC8 datafile( GetNextStringLC( aItem, _L("outputfile" )->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 datafile (GetNextStringLC( aItem, _L("datafile"))->Des() ); + + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + //SetURIL( nodename ); + + TPtrC8 last( LastURISeg( nodename ) ); + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + TDataType type; + TPtrC8 data; + if ((last == KAMInstallOptsNodeName) ||(last == KAMDataNodeName)) + { + + HBufC8* bufdata = LoadFileLC( datafile, type );//->Des() ; + data.Set(bufdata->Des()); + } + + TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() ); + if ((last == KAMInstallOptsNodeName) ||(last == KAMDataNodeName)) + { + Adapter()->UpdateLeafObjectL( nodename , *luid, data, mimePtr, 3); + } + else + { + Adapter()->UpdateLeafObjectL( nodename , *luid, datafile, 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 ; + } + if ((last == KAMInstallOptsNodeName) ||(last == KAMDataNodeName)) + { + CleanupStack::PopAndDestroy(); // loadfile + } + CleanupStack::PopAndDestroy(); // luid + CleanupStack::PopAndDestroy(); // mime + CleanupStack::PopAndDestroy(); // datafile + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("UpdateLeafL 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 datafile (GetNextStringLC( aItem, _L("datafile"))->Des() ); + + HBufC8 *mime = GetNextStringLC( aItem, _L("mime") ) ; + SetURIL( nodename ); + + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + TDataType type; + TPtrC8 data( LoadFileLC( datafile, type )->Des() ); + TPtrC8 mimePtr( *mime == KNullDesC8 ? type.Des8() : mime->Des() ); + + 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(); // datafile + 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() ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + 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() ); + + + 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, 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 ); + */ + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + 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 datafile( 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 data( LoadFileLC( datafile, type )->Des() ); + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + Adapter()->ExecuteCommandL( *iURI, data, 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(); // datafile + 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("DeleteObjectL: DeleteObjectL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("DeleteObjectL: DeleteObjectL FetchLeafObjectL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + CleanupStack::PopAndDestroy( luid ); // luid + CleanupStack::PopAndDestroy(); // nodename + iLog->Log( _L("DeleteObjectL 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; + */ + + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + //Adapter()->ExecuteCommandL( *iURI, *luid, data, KEmptyType, 11 ) ; + Adapter()->ExecuteCommandL( *iURI, data, 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; + } + + + //Newly added +TInt Cdmatest::AddLeafNode( CStifItemParser& aItem ) +{ + return KErrNone; +} + +TInt Cdmatest::InstallActivate( CStifItemParser& aItem ) +{ + return KErrNone; +} + + //Newly ended + + +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 ); + +// TPtrC8 parentURI(RemoveLastSeg(*nUri)); +// HBufC8 *luid = GetLuidAllocLC( parentURI ); + HBufC8 *luid = GetLuidAllocLC( *iURI ); + + if(*luid != KNullDesC8) + { + Adapter()->ChildURIListL( *nUri, *luid, *iEmptyMappingInfoArray, 4, 5 ); + } + else + { + Adapter()->FetchLeafObjectL( *nUri, KNullDesC8, KEmptyType, 7, 8 ) ; + } + //Adapter()->ChildURIListL( *nUri, KNullDesC8, *iEmptyMappingInfoArray, 4, 5 ); + + + + CleanupStack::PopAndDestroy( luid ); + CleanupStack::Pop( nUri ); + + 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 + +TInt Cdmatest::FetchLeafObjectSizeL( CStifItemParser& aItem ) + { + TInt ret( KErrNone ); + // Print to UI + TestModuleIf().Printf( 0, _L("Camtest"), _L("ExecuteLeafL") ); + + iResultsFunction = NULL; + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Nodename") )->Des() ) ; + + //TPtrC datafile; + TInt i( 0 ); + 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 name is '%S'" ), &iSaveFileName ); + iResultsFunction = SaveDataL; + } + SetURIL(nodename) ; + +// HBufC8 *luid = GetLuidAllocLC( *iURI ); + TPtrC8 parentURI(RemoveLastSeg(nodename)); + HBufC8 *luid = GetLuidAllocLC( parentURI ); + + CleanupStack::PushL( luid ); + +// void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef ); + iAdapter->FetchLeafObjectSizeL( *iURI, *luid, KEmptyType, 7, 8 ); + if ( iStatus == MSmlDmAdapter::EOk ) + { + iLog->Log( _L("FetchLeafObjectSizeL: FetchLeafObjectSizeL Successful! %d" ), iStatus ); + } + else + { + iLog->Log( _L("FetchLeafObjectSizeL: FetchLeafObjectSizeL Error ! %d" ), iStatus ); + ret = KErrGeneral ; + } + + + + // Cleanup + CleanupStack::PopAndDestroy(); + CleanupStack::Pop( luid ); + CleanupStack::PopAndDestroy();//nodename +// CleanupStack::PopAndDestroy();//nodename + + + iLog->Log( _L("FetchLeafObjectSizeL Test Complete with status %d" ), ret ); + return ret; + } + +/*TInt Cdmatest::BareAppInstallL( CStifItemParser& aItem ) + { + + // Print to UI + TestModuleIf().Printf( 0, _L("amtest"), _L("In InstallL") ); + // Print to log file + iLog->Log(_L("In DetailsL")); + + TInt aluidi( 0 ); + TUint32 aLuidInt; + aluidi = aItem.GetNextInt ( (TInt&)aLuidInt ) ; + + + TPtrC8 nodename( GetNextStringLC ( aItem, _L("Node name") )->Des() ) ; + + + SetURIL( nodename ); + + HBufC8 *luid = GetLuidAllocLC( *iURI ); + MSmlDmAdapter::TError ret( MSmlDmAdapter::EError ); + + TRAPD( err, Adapter()->InstallL(aluidi,*iURI, *luid,3 ,ret)); + + return err; + + }*/ + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/clientprovisioning.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/clientprovisioning.pro Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,25 @@ +# +# 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: Device update project file +# +TEMPLATE = subdirs + +SUBDIRS += cpqtsp + +CONFIG += ordered + +symbian: { +SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + } diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/Cpqtsp.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/Cpqtsp.pri Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,17 @@ +SOURCES = src/CpMessage.cpp \ + src/CWPSaver.cpp \ + src/main.cpp \ + src/CpQtSpMainWindow.cpp \ + src/CpQtSpView.cpp \ + src/CWPBioControl.cpp \ + src/CWPNameValue.cpp \ + +HEADERS = inc/CpMessage.h \ + inc/CWPSaver.h \ + inc/CpQtSpMainWindow.h \ + inc/CpQtSpView.h \ + inc/PnpUtilLogger.h \ + inc/CWPBioControl.h \ + inc/CWPNameValue.h \ + inc/ProvisioningUIDs.h \ + inc/ProvisioningDebug.h diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/cpqtsp.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/cpqtsp.pro Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,50 @@ +# +# 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)" + SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 +} + +CONFIG += hb service +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +include(Cpqtsp.pri) +LIBS+=-lxqservice -lxqserviceutil -lflogger +MMP_RULES += "LIBRARY msgs.lib centralrepository.lib provisioningengine.lib featmgr.lib smcm.lib gsmu.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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/CWPBioControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/CWPBioControl.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,139 @@ +/* +* 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 +#include +#include +#include "CWPSaver.h" +#include +#include +#include + +class CWPEngine; +class CWPNameValue; +class CWPPushMessage; +class CWPBootstarp; +class CpMessage; +class CpQtSp; + +const TInt KMaxPinSize = 20; + +// 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 CActive, MHbDeviceDialogObserver +{ + 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,CpQtSp* sp); + ~CWPBioControl(); + RPointerArray* CollectItemsLC() const; + + void SaveSettingsL(); + void DoSaveL(); + void RestoreMsgL(); + TInt getAuth(); + // from MHbDeviceDialogObserver + void DataReceived( CHbSymbianVariantMap& aData ); + void DeviceDialogClosed(TInt aCompletionCode); + void SaveSettingStatus(); + void saveDefaultSetting(); + void postAuthetication(); + void updateAuthetication(); + void authenticationFailed(); + void senderUnknownContinue(); + void senderUnknownCancel(); + protected: // from CActive + void DoCancel(); + void RunL(); + + 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,CpQtSp* sp); + + private: + + void AddItemsL(); + void CollateAndAddItemsL( RPointerArray& aItems ); + TBool AuthenticateL( CWPPushMessage& aMessage ); + static TInt Compare( const CWPNameValue& aImpl1,const CWPNameValue& aImpl2 ); + void SetCenrepKeyL(const TDesC8& aValue); + void SaveMessageL(); + static void Cleanup( TAny* aAny ); + TInt WaitUntilDeviceDialogClosed(); + private: + CWPEngine* iEngine; + CWPPushMessage* iMessage; + CDummyObserver* iObserver; + CMsvSession* iSession; + TMsvId iId; + TMsvEntry iEntry; + TInt ireturnkey; + CHbDeviceDialogSymbian* iDevDialog; + CWPBootstrap* ibootstrap; + TInt itries; + TInt iAuth; + CActiveSchedulerWait* iWait; + TBool iIsDisplayingDialog; + TInt iCompletionCode; + CpMessage* iMsg; + CpQtSp* iSp; + }; + + + +#endif // CWPBIOCONTROL_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/CWPNameValue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/CWPNameValue.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,98 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/CWPSaver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/CWPSaver.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,110 @@ +/* +* ============================================================================ +* Name : CWPSaver.h +* Part of : Provisioning / ProvisioningBC +* Description : Settings saver with progress note. +* Version : %version: 2 % << Don't touch! Updated by Synergy at check-out. +* +* Copyright © 2002-2006 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ============================================================================ +*/ + +#ifndef CWPSAVER_H +#define CWPSAVER_H + +// INCLUDES + +#include + +// FORWARD DECLARATIONS +class CWPEngine; +//class CActiveFavouritesDbNotifier; + +// CLASS DECLARATION + +/** + * Helper class for saving Provisioning settings. Provides a progress note. + * @since 2.0 + */ +class CWPSaver : public CActive + + { + public: + /** + * C++ default constructor. + * @param aEngine Engine to be used for saving + * @param aSetAsDefault EFalse => call CWPEngine::SaveL, ETrue + * => call CWPEngine::SetAsDefaultL + */ + CWPSaver( CWPEngine& aEngine, TBool aSetAsDefault ); + + /** + * Destructor. + */ + virtual ~CWPSaver(); + + public: + /** + * Prepares the object for saving. + */ + void PrepareLC(); + + /** + * Executes save with a progress note. Ownership of the + * CWPSaver object is transferred. + * @param aNumSaved When returns, contains number of settings saved. + * @return Status code. >= 0 if saving was completed + */ + TInt ExecuteLD( TInt& aNumSaved, TBufC<256>& value ); + + protected: // From CActive + + void DoCancel(); + void RunL(); + TInt RunError( TInt aError ); + + private: + /** + * Complete the request so that RunL() gets called. + */ + void CompleteRequest(); + void Retry(); + + + private: + /// The engine used for performing the save. Refs. + CWPEngine& iEngine; + + /// ETrue if setting as default + TBool iSetAsDefault; + + /// The item to be saved next + TInt iCurrentItem; + + /// Contains result to be passed to the called of ExecuteLD + TInt iResult; + + /// Active scheduler. + CActiveSchedulerWait iWait; + + /// Timer for retry. Owns. + CPeriodic* iRetryTimer; + + /// Retry counter + TInt iRetryCount; + + HbProgressDialog *iProgress; + TBufC<200> iValue; + }; + + +#endif // CWPSAVER_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/CWPStringPair.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/CWPStringPair.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,69 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/CpMessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/CpMessage.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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 CPMESSAGE_H_ +#define CPMESSAGE_H_ + +#include +#include + +class CWPBioControl; + +class CpMessage : public QObject +{ + Q_OBJECT + +public: + CpMessage(CWPBioControl* bio); + ~CpMessage(); + void inValidPinMessage(); + void saveSettingMessage(); + void settingNotSaved(); + void setAsDefault(); + void autheticationFailure(); + void senderUnknown(); +public slots: + void saveSettingDialogClosed(HbAction *action); + void setAsDefaultDialogClosed(HbAction *action); + void autheticationFailureDialogClosed(HbAction *action); + void senderUnknownDialogClosed(HbAction *action); +private: + CWPBioControl* iBioControl; +}; + +#endif /* CPMESSAGE_H_ */ diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/CpQtSpMainWindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/CpQtSpMainWindow.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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 +#include +#include + +class CpQtSpView; +class CpQtSp; + +class CpQtSpMainWindow : public HbMainWindow +{ + Q_OBJECT + +public: + CpQtSpMainWindow(QWidget *parent=0); + ~CpQtSpMainWindow(); + void buildView(); + void closeWindow(); + +public slots: + void showView(); + void OrientationChange(); +private: + CpQtSp* iServiceProvider; + CpQtSpView* iView; + HbWidget* widget; + QGraphicsLinearLayout* layout; +}; + +#endif // CPQTSPMAINWINDOW_H diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/CpQtSpView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/CpQtSpView.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,106 @@ +/* +* 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 +#include +#include + +class CWPBioControl; + +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,CpQtSpMainWindow* ptr, QGraphicsItem *parent = 0); + ~CpQtSpView(); + void constructView(); + void orientationChanges(); + void setViewStatus(); + bool getViewStatus(); + bool buildView(QGraphicsLinearLayout* layout); + bool getOrientationFlag(); + +public slots: + void requestCompleted(const QVariant& value); + void saveProvisoningMessage(); + void deleteMessage(); + void expand(); + void setHorizontal(); + void setVertical(); + void corruptMessageDialog(HbAction *action); +private: + CpQtSp* iServiceProvider; + QGraphicsLinearLayout *layout; + HbFontSpec *iPrimaryFont; + HbFontSpec *iSecondaryFont; + RPointerArray* iArray; + CWPBioControl* iBio; + CpQtSpMainWindow* window; + HbGroupBox* group; + HbToolBar* toolBar1; + bool iViewStatus; + RPointerArray* array; + bool iOrientationFlag; +}; + +class CpQtSp : public XQServiceProvider +{ + Q_OBJECT +public: + CpQtSp( CpQtSpMainWindow* window, QObject *parent = 0 ); + ~CpQtSp(); + void complete(); + TMsvId returnId(); + CMsvSession* returnSession(); + CWPBioControl* returnBio(); + void authenticationStatus(); +Q_SIGNALS: + void showView(); + +public slots: + QString ProcessMessage(const QString& number); + +private: + TMsvId iId; + CObserver* iObserver; + CMsvSession* iSession; + CWPBioControl* iBioCtrl; + CpQtSpMainWindow* window; +}; + +#endif // CPQTSPVIEW_H diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/PnpUtilLogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/PnpUtilLogger.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,138 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/ProvisioningDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/ProvisioningDebug.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,131 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/inc/ProvisioningUIDs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/inc/ProvisioningUIDs.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,157 @@ +/* +* 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 + +#define KAUTENTICATIONSUCCESS 1 +#define KAUTENTICATIONFAILURE 2 +#define KAUTENTICATIONCANCEL 3 + +#define KLANDSCAPE 640 +#define KPORTRAIT 360 +#define KCOLLAPSED 60 +#define KEXPANDED 120 +#define KLENGTH 256 + +/// 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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/resources/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/resources/service_conf.xml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,7 @@ + + + OMA CP Service + + OMA CP Service Provider + + \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/rom/cpqtsp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/rom/cpqtsp.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ +/* +* 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 + +#endif \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/rom/cpsqtsp_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/rom/cpsqtsp_resources.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/src/CWPBioControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/src/CWPBioControl.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,678 @@ +/* +* 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 +#include +#include +#include +#include +#include "ProvisioningUIDs.h" +#include +#include "ProvisioningDebug.h" +#include "CWPNameValue.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CONSTANTS +_LIT(KNone,""); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Constructor. +// ----------------------------------------------------------------------------- +// +CWPBioControl::CWPBioControl(CMsvSession* /*aSession*/,TMsvId /*aId*/): CActive(EPriorityNormal) + + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CWPBioControl::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPBioControl::ConstructL(CMsvSession* aSession,TMsvId aId,CpQtSp* sp) + { + FLOG( _L( "[ProvisioningBC] CWPBioControl::ConstructL:" ) ); + FeatureManager::InitializeLibL(); + iSession = aSession; + iId = aId; + iSp = sp; + iEngine = CWPEngine::NewL(); + iDevDialog = NULL; + ibootstrap = NULL; + iMsg = new(ELeave)CpMessage(this); + iWait = new( ELeave ) CActiveSchedulerWait; + FLOG( _L( "[ProvisioningBC] CWPBioControl::ConstructL: done" ) ); + } + +// ----------------------------------------------------------------------------- +// CWPBioControl::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CWPBioControl* CWPBioControl::NewL(CMsvSession* aSession,TMsvId aId,CpQtSp* sp) + { + CWPBioControl* self = new( ELeave ) CWPBioControl(aSession,aId); + CleanupStack::PushL( self ); + self->ConstructL(aSession,aId,sp); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CWPBioControl::~CWPBioControl() + { + Cancel(); + delete iEngine; + delete iMessage; + FeatureManager::UnInitializeLib(); + if (iDevDialog) + { + delete iDevDialog; + } + delete ibootstrap; + delete iWait; + } +// ---------------------------------------------------------------------------- +// CWPBioControl ::RestoreMsgL +// ---------------------------------------------------------------------------- +// +void CWPBioControl::RestoreMsgL() + { + CMsvEntry* entry = iSession->GetEntryL(iId); + CleanupStack::PushL( entry ); + iEntry = 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 ); + AuthenticateL( *iMessage ); + CleanupStack::PopAndDestroy(); + if(iAuth == KAUTENTICATIONCANCEL || iAuth == KAUTENTICATIONSUCCESS) + { + iSp->authenticationStatus(); + } + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::postAuthetication +// ---------------------------------------------------------------------------- +// + +void CWPBioControl::postAuthetication() + { + iMsg->senderUnknown(); + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::senderUnknownContinue +// ---------------------------------------------------------------------------- +// + +void CWPBioControl::senderUnknownContinue() + { + iAuth = KAUTENTICATIONSUCCESS; + iSp->authenticationStatus(); + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::senderUnknownCancel +// ---------------------------------------------------------------------------- +// + +void CWPBioControl::senderUnknownCancel() + { + iAuth = KAUTENTICATIONCANCEL; + iSp->authenticationStatus(); + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::updateAuthetication +// ---------------------------------------------------------------------------- +// + +void CWPBioControl::updateAuthetication() +{ + if (iMessage->Authenticated() ) + { + //update Cenrep key + TBuf8<100> orig; + orig.Copy(iMessage->Originator()); + TRAPD(err, SetCenrepKeyL(orig)); + User::LeaveIfError(err); + } + + TBool preAuthenticated( iMessage->Authenticated() ); + if( !iEntry.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(); + FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL done" ) ); +} + +// ---------------------------------------------------------------------------- +// CWPBioControl ::getAuth +// ---------------------------------------------------------------------------- +// + +TInt CWPBioControl::getAuth() + { + return iAuth; + } +// ---------------------------------------------------------------------------- +// CWPBioControl ::RestoreMsgL +// ---------------------------------------------------------------------------- +// +TBool 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(); + } + ibootstrap = CWPBootstrap::NewL(imsi); + + if (phone) + delete phone; + + CWPBootstrap::TBootstrapResult result(ibootstrap->BootstrapL(aMessage,*iEngine, KNullDesC)); + if (result == CWPBootstrap::EPinRequired) + { + CMsvEntry* entry = iSession->GetEntryL(iId); + TInt count = (entry->Entry()).MtmData1(); + // Create a new device dialog if it is not there + if( !iDevDialog ) + { + iDevDialog = CHbDeviceDialogSymbian::NewL(); + LOGSTRING("CWPBioControl::AuthenticateL() iDevDialog is created"); + } + + CHbSymbianVariantMap* parameters = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(parameters); + for (TInt i(0); i < KPinRetries && !aMessage.Authenticated(); i++) + { + // Add dialog key and dialog type to the parameters + const TPtrC dialog (static_cast(keydialog.utf16()), keydialog.length()); + CHbSymbianVariant* dialogvariant = NULL; + const TInt dialogID = EOmaCPPinDialog; + dialogvariant = CHbSymbianVariant::NewL( &dialogID, CHbSymbianVariant::EInt ); + parameters->Add(dialog, dialogvariant ); + + // Add retries value to the parameters + itries = i; + const TPtrC ptrkeyparam1 (static_cast(keyparam1.utf16()), keyparam1.length()); + //Retries left after this attempt + TInt retries = KPinRetries - itries; + CHbSymbianVariant* retriesvariant = NULL; + retriesvariant = CHbSymbianVariant::NewL( &retries, CHbSymbianVariant::EInt ); + parameters->Add(ptrkeyparam1, retriesvariant ); + + if (iDevDialog && iIsDisplayingDialog) + { + LOGSTRING("[CWPBioControl] CWPBioControl::AuthenticateL updating the dialog"); + iDevDialog->Update(*parameters); + } + else if (iDevDialog && !iIsDisplayingDialog) + { + // Show the device dialog + iDevDialog->Show(KDeviceDialogType,*parameters, this); + iIsDisplayingDialog = ETrue; + // Wait for user response + TInt error = WaitUntilDeviceDialogClosed(); + LOGSTRING2("WaitUntilDeviceDialogClosed err is %d", error); + User::LeaveIfError(error); + if(ireturnkey == EHbRSK) + { + iAuth = KAUTENTICATIONCANCEL; + CleanupStack::PopAndDestroy(parameters); + return false; + } + } + + + } + + CleanupStack::PopAndDestroy(parameters); + + if (iDevDialog) + { + iDevDialog->Cancel(); + delete iDevDialog; + iDevDialog = NULL; + } + + if( !aMessage.Authenticated() && (itries == KPinRetries - 1) ) + { + iMsg->autheticationFailure(); + return false; + } + } + } + if(!aMessage.Authenticated()) + { + postAuthetication(); + } + else if(aMessage.Authenticated()) + { + iAuth = KAUTENTICATIONSUCCESS; + } + FLOG( _L( "[ProvisioningBC] CWPBioControl::AuthenticateL done" ) ); + return true; + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::authenticationFailed +// ---------------------------------------------------------------------------- +// + +void CWPBioControl::authenticationFailed() + { + iAuth = KAUTENTICATIONFAILURE; + iSp->authenticationStatus(); + } +// ---------------------------------------------------------------------------- +// 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 ::SaveSettingsL +// ---------------------------------------------------------------------------- +// +void CWPBioControl::SaveSettingsL() + { + if( !iMessage->Saved()) + { + DoSaveL(); + SaveSettingStatus(); + } + else + { + iMsg->saveSettingMessage(); + } + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::SaveSettingStatus +// ---------------------------------------------------------------------------- +// + +void CWPBioControl::SaveSettingStatus() + { + iMessage->SetSaved( ETrue ); + SaveMessageL(); + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::DoSaveL +// ---------------------------------------------------------------------------- +// +void CWPBioControl::DoSaveL() + { + TInt numSaved( 0 ); + CWPSaver* saver = new(ELeave) CWPSaver( *iEngine, EFalse ); + TBufC Value; + TInt err( saver->ExecuteLD( numSaved, Value ) ); + if( err >= 0 ) + { + // Check if any setting can be made default + TBool setDefault( EFalse ); + TInt itemCount( iEngine->ItemCount() ); + for( TInt i( 0 ); i < itemCount && !setDefault; i++ ) + { + if( iEngine->CanSetAsDefault( i ) ) + { + setDefault = ETrue; + } + } + + // Ask the user if the saved settings should be + // made default. + if( setDefault ) + { + iMsg->setAsDefault(); + } + } + else + { + iMsg->settingNotSaved(); + } + + + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::saveDefaultSetting +// ---------------------------------------------------------------------------- +// + +void CWPBioControl::saveDefaultSetting() + { + CWPSaver* setter = new(ELeave) CWPSaver( *iEngine, ETrue ); + TInt numSet( 0 ); + TBufC Value; + TInt result = KErrNone; + result = setter->ExecuteLD( numSet,Value ); + if (result) + { + iMsg->settingNotSaved(); + } + + + } +// ---------------------------------------------------------------------------- +// 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" ) ); + + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::DataReceived +// Slot to handle the data received from the plugin +// ---------------------------------------------------------------------------- +// +void CWPBioControl::DataReceived(CHbSymbianVariantMap& aData) + { + FLOG(_L("CWPBioControl::DataReceived() start")); + + // Get the return key + const TPtrC ptrreturnkey(static_cast (returnkey.utf16()), + returnkey.length()); + const CHbSymbianVariant* returnkeyvariant = aData.Get(ptrreturnkey); + + if (returnkeyvariant) + { + TInt* returnkey = returnkeyvariant->Value (); + if (returnkey) + { + ireturnkey = *returnkey; + FLOG(_L("CWPBioControl::DataReceived() ireturnkey")); + LOGSTRING2("ireturnkey is %d", ireturnkey); + if (ireturnkey == EHbLSK) + { + // Ok key pressed + FLOG(_L("Ok key pressed")); + LOGSTRING("CWPBioControl::DataReceived() Ok key pressed"); + // Get the PIN code + const TPtrC ptrpinquery( + static_cast (pinquery.utf16()), + pinquery.length()); + const CHbSymbianVariant* pinvariant = aData.Get(ptrpinquery); + if (pinvariant) + { + TPtrC pin = *pinvariant->Value (); + // Call BootstrapL to find out whether the PIN is correct or not + CWPBootstrap::TBootstrapResult result = + CWPBootstrap::EPinRequired; + TInt err = KErrNone; + TRAP( err, QT_TRYCATCH_LEAVING(result = ibootstrap->BootstrapL(*iMessage, *iEngine, pin) )); + if (err == KErrNone && result + == CWPBootstrap::EAuthenticationFailed && itries + < KPinRetries - 1) + { + FLOG(_L("CWPBioControl:deviceDialog:DataReceived() Authentication Failed")); + LOGSTRING("CWPBioControl::DataReceived() Authentication Failed"); + } + + } + + } + } + + } + + FLOG(_L("CWPBioControl:deviceDialog:DataReceived() end")); + } + +// ---------------------------------------------------------------------------- +// CWPBioControl ::DeviceDialogClosed +// Slot to handle the deviceDialogClosed signal from the plugin +// ---------------------------------------------------------------------------- +// +void CWPBioControl::DeviceDialogClosed(TInt aCompletionCode) + { + FLOG(_L("CWPBioControl::DeviceDialogClosed() start")); + LOGSTRING("CWPBioControl::DeviceDialogClosed() start"); + iCompletionCode = aCompletionCode; + LOGSTRING2("CWPBioControl::DeviceDialogClosed() iCompletionCode is %d", iCompletionCode); + + iIsDisplayingDialog = EFalse; + + TRequestStatus* status(&iStatus); + User::RequestComplete(status, KErrNone); + LOGSTRING("CWPBioControl::DeviceDialogClosed() end"); + FLOG(_L("CWPBioControl::DeviceDialogClosed() end")); + } + +// --------------------------------------------------------------------------- +// CWPBioControl::DoCancel() +// --------------------------------------------------------------------------- +// +void CWPBioControl::DoCancel() + { + FLOG(_L("CWPBioControl::DoCancel() start")); + LOGSTRING("CWPBioControl::DoCancel() start"); + if (iWait && iWait->IsStarted() && iWait->CanStopNow()) + { + LOGSTRING("CWPBioControl::DoCancel() In the iWait block"); + iCompletionCode = KErrCancel; + iWait->AsyncStop(); + } + LOGSTRING("CWPBioControl::DoCancel() end"); + FLOG(_L("CWPBioControl::DoCancel() end")); + } + +// --------------------------------------------------------------------------- +// CWPBioControl::RunL() +// --------------------------------------------------------------------------- +// +void CWPBioControl::RunL() + { + FLOG(_L("CWPBioControl::RunL() start")); + LOGSTRING("CWPBioControl::RunL() start"); + if (iWait) + { + LOGSTRING("CWPBioControl::RunL() iWait block "); + iWait->AsyncStop(); + } + LOGSTRING("CWPBioControl::RunL() end"); + FLOG(_L("CWPBioControl::RunL() end")); + } + +// --------------------------------------------------------------------------- +// CWPBioControl::WaitUntilDeviceDialogClosed() +// --------------------------------------------------------------------------- +// +TInt CWPBioControl::WaitUntilDeviceDialogClosed() + { + FLOG(_L("CWPBioControl::WaitUntilDeviceDialogClosed() start")); + iCompletionCode = KErrInUse; + ireturnkey = KErrUnknown; + if (!IsActive() && iWait && !iWait->IsStarted()) + { + FLOG(_L("CWPBioControl::WaitUntilDeviceDialogClosed() In WaitAsynch start block")); + LOGSTRING("CWPBioControl::WaitUntilDeviceDialogClosed() In WaitAsynch start block"); + iStatus = KRequestPending; + SetActive(); + LOGSTRING2("CWPBioControl::WaitUntilDeviceDialogClosed() iCompletionCode is %d", iCompletionCode); + iWait->Start(); + LOGSTRING2("CWPBioControl::WaitUntilDeviceDialogClosed() iCompletionCode is %d", iCompletionCode); + } + FLOG(_L("CWPBioControl::WaitUntilDeviceDialogClosed() end")); + return iCompletionCode; + } + + + + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/src/CWPNameValue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/src/CWPNameValue.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,87 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/src/CWPSaver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/src/CWPSaver.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,179 @@ +/* +* ============================================================================ +* Name : CWPSaver.cpp +* Part of : Provisioning / ProvisioningBC +* Description : Helper class for saving Provisioning settings. Provides a progress note. +* Version : %version: 2 % << Don't touch! Updated by Synergy at check-out. +* +* Copyright © 2002-2006 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ============================================================================ +*/ + +// INCLUDE FILES +#include +#include +#include + +#include "CWPSaver.h" +#include +#include + +// CONSTANTS +const TInt KMaxWaitTime = 2000000; +const TInt KRetryCount = 5; + +// CLASS DECLARATION + +// ========================== MEMBER FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// C++ default constructor. +// ---------------------------------------------------------------------------- +CWPSaver::CWPSaver( CWPEngine& aEngine, TBool aSetAsDefault ) + : CActive( EPriorityStandard ), + iEngine( aEngine ), + iSetAsDefault( aSetAsDefault ), + iCurrentItem( 0 ), + iResult( KErrNone ) + { + } + +// ---------------------------------------------------------------------------- +// CWPSaver::PrepareLC +// ---------------------------------------------------------------------------- +// +void CWPSaver::PrepareLC() + { + // Assume ownership of this. + CleanupStack::PushL( this ); + iProgress = new HbProgressDialog(HbProgressDialog::WaitDialog); + iProgress->setText(hbTrId("txt_device_update_setlabel_saving_settings")); + iProgress->clearActions(); + iProgress->show(); + + } + +// ---------------------------------------------------------------------------- +// CWPSaver::ExecuteLD +// ---------------------------------------------------------------------------- +// +TInt CWPSaver::ExecuteLD( TInt& aNumSaved, TBufC<256>& Value ) + { + PrepareLC(); + + // Add us to active scheduler and make sure RunL() gets called. + CActiveScheduler::Add( this ); + CompleteRequest(); + iWait.Start(); + + // Progress note has been finished/cancelled. Cache the result + // and delete this. + TInt result( iResult ); + aNumSaved = iCurrentItem; + Value = iValue; + CleanupStack::PopAndDestroy(); // this + + return result; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +CWPSaver::~CWPSaver() + { + Cancel(); + } + +// ---------------------------------------------------------------------------- +// CWPSaver::DoCancel +// ---------------------------------------------------------------------------- +// +void CWPSaver::DoCancel() + { + } + +// ---------------------------------------------------------------------------- +// CWPSaver::RunL +// ---------------------------------------------------------------------------- +// +void CWPSaver::RunL() + { + // Choose whether to save or set as default + TInt err( KErrNone ); + if( iSetAsDefault ) + { + TRAP( err, + if( iEngine.CanSetAsDefault( iCurrentItem ) ) + { + iEngine.SetAsDefaultL( iCurrentItem ); + } ); + } + else + { + TRAP(err, QT_TRYCATCH_LEAVING( iEngine.SaveL( iCurrentItem ) )); + } + if( err != KErrNone ) + { + // For all other errors, pass them through. + iValue = iEngine.SummaryText(iCurrentItem); + delete iProgress; + iProgress = NULL; + User::LeaveIfError( err ); + } + // Succesful save, so reset retry count + iRetryCount = 0; + + // Normal progress + if( iCurrentItem == iEngine.ItemCount()-1 ) + { + //iProgress->cancel(); + //iProgress->close(); + delete iProgress; + iProgress = NULL; + iWait.AsyncStop(); + } + else + { + //CEikProgressInfo* progressInfo = iDialog->GetProgressInfoL(); + iCurrentItem++; + //progressInfo->SetAndDraw(iCurrentItem); + CompleteRequest(); + } + } + +// ---------------------------------------------------------------------------- +// CWPSaver::RunError +// ---------------------------------------------------------------------------- +// +TInt CWPSaver::RunError( TInt aError ) + { + // There was a leave in RunL(). Store the error and + // stop the dialog. + iResult = aError; + iWait.AsyncStop(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CWPSaver::CompleteRequest +// ---------------------------------------------------------------------------- +// +void CWPSaver::CompleteRequest() + { + // Schedule an immediate complete. Make sure that there + // is no timer alive first + Cancel(); + //iRetryTimer->Cancel(); + + SetActive(); + TRequestStatus* sp = &iStatus; + User::RequestComplete( sp, KErrNone ); + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/src/CWPStringPair.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/src/CWPStringPair.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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: +* 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 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/src/CpMessage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/src/CpMessage.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,194 @@ +/* +* 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 + +// ---------------------------------------------------------------------------- +// CpMessage::CpMessage +// Description: Construtor +// ---------------------------------------------------------------------------- + +CpMessage::CpMessage(CWPBioControl* bioControl) + { + iBioControl = bioControl; + } + +// ---------------------------------------------------------------------------- +// CpMessage::~CpMessage +// Description: Destructor +// ---------------------------------------------------------------------------- + +CpMessage::~CpMessage() + { + } + +// ---------------------------------------------------------------------------- +// CpMessage::inValidPinMessage +// Description: inValidPinMessage +// ---------------------------------------------------------------------------- + + +void CpMessage::inValidPinMessage() + { + HbMessageBox *box = new HbMessageBox(hbTrId("code error"),HbMessageBox::MessageTypeWarning); + box->setAttribute(Qt::WA_DeleteOnClose); + box->open(); + } + +// ---------------------------------------------------------------------------- +// CpMessage::saveSettingMessage +// Description: saveSettingMessage +// ---------------------------------------------------------------------------- + + +void CpMessage::saveSettingMessage() + { + HbMessageBox *box = new HbMessageBox(hbTrId("txt_device_update_info_settings_are_already_saved"),HbMessageBox::MessageTypeQuestion); + box->setAttribute(Qt::WA_DeleteOnClose); + box->setTimeout(HbPopup::NoTimeout); + box->open(this,SLOT(saveSettingDialogClosed(HbAction*))); + } + +// ---------------------------------------------------------------------------- +// CpMessage::saveSettingDialogClosed +// Description: saveSettingDialogClosed +// ---------------------------------------------------------------------------- + +void CpMessage::saveSettingDialogClosed(HbAction *action) +{ + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + iBioControl->DoSaveL(); + iBioControl->SaveSettingStatus(); + } + } + +// ---------------------------------------------------------------------------- +// CpMessage::settingNotSaved +// Description: settingNotSaved +// ---------------------------------------------------------------------------- + + +void CpMessage::settingNotSaved() + { + HbMessageBox *box = new HbMessageBox(hbTrId("txt_device_update_info_settings_could_not_be_saved"),HbMessageBox::MessageTypeInformation); + box->setAttribute(Qt::WA_DeleteOnClose); + box->setTimeout(HbPopup::NoTimeout); + //box->open(this,SLOT(saveSettingDialogClosed(HbAction*))); + box->open(); + } + +// ---------------------------------------------------------------------------- +// CpMessage::setAsDefault +// Description: setAsDefault +// ---------------------------------------------------------------------------- + +void CpMessage::setAsDefault() + { + HbMessageBox *box = new HbMessageBox(hbTrId("txt_device_update_info_set_the_received_settings"),HbMessageBox::MessageTypeQuestion); + box->setAttribute(Qt::WA_DeleteOnClose); + box->setTimeout(HbPopup::NoTimeout); + box->clearActions(); + HbAction * action1 = new HbAction(hbTrId("txt_device_update_button_set_as_default")); + HbAction * action2 = new HbAction(hbTrId("txt_common_button_cancel")); + box->addAction(action1); + box->addAction(action2); + box->open(this,SLOT(setAsDefaultDialogClosed(HbAction*))); + + } + +// ---------------------------------------------------------------------------- +// CpMessage::setAsDefaultDialogClosed +// Description: setAsDefaultDialogClosed +// ---------------------------------------------------------------------------- + +void CpMessage::setAsDefaultDialogClosed(HbAction *action) +{ + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + iBioControl->saveDefaultSetting(); + } + } + +// ---------------------------------------------------------------------------- +// CpMessage::autheticationFailure +// Description: autheticationFailure +// ---------------------------------------------------------------------------- + +void CpMessage::autheticationFailure() + { + HbMessageBox *box = new HbMessageBox(hbTrId("txt_device_update_info_verification_failed_and_mes"),HbMessageBox::MessageTypeWarning); + box->setAttribute(Qt::WA_DeleteOnClose); + box->setTimeout(HbPopup::NoTimeout); + box->open(this,SLOT(autheticationFailureDialogClosed(HbAction*))); + } + +// ---------------------------------------------------------------------------- +// CpMessage::autheticationFailureDialogClosed +// Description: autheticationFailureDialogClosed +// ---------------------------------------------------------------------------- + +void CpMessage::autheticationFailureDialogClosed(HbAction *action) +{ + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + iBioControl->authenticationFailed(); + } + } + +// ---------------------------------------------------------------------------- +// CpMessage::senderUnknown +// Description: senderUnknown +// ---------------------------------------------------------------------------- + +void CpMessage::senderUnknown() + { + HbMessageBox *box = new HbMessageBox(hbTrId("txt_device_update_info_ender_of_the_message_is_unt"),HbMessageBox::MessageTypeQuestion); + box->setAttribute(Qt::WA_DeleteOnClose); + box->setTimeout(HbPopup::NoTimeout); + box->clearActions(); + HbAction * action1 = new HbAction(hbTrId("txt_common_button_continue")); + HbAction * action2 = new HbAction(hbTrId("txt_common_button_cancel")); + box->addAction(action1); + box->addAction(action2); + box->open(this,SLOT(senderUnknownDialogClosed(HbAction*))); + } + +// ---------------------------------------------------------------------------- +// CpMessage::senderUnknownDialogClosed +// Description: senderUnknownDialogClosed +// ---------------------------------------------------------------------------- + +void CpMessage::senderUnknownDialogClosed(HbAction *action) +{ + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + iBioControl->senderUnknownContinue(); + } + else + { + iBioControl->senderUnknownCancel(); + } + } diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/src/CpQtSpMainWindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/src/CpQtSpMainWindow.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,110 @@ +/* +* 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 + +// ---------------------------------------------------------------------------- +// CpQtSpMainWindow::CpQtSpMainWindow +// Description: Construtor +// ---------------------------------------------------------------------------- + +CpQtSpMainWindow::CpQtSpMainWindow(QWidget *parent) + : HbMainWindow(parent) +{ + iServiceProvider = new CpQtSp(this); + connect(iServiceProvider,SIGNAL(showView()),this, SLOT(showView())); + connect(this,SIGNAL(aboutToChangeOrientation()),this,SLOT(OrientationChange())); + iView = new CpQtSpView(iServiceProvider,this); + } + +// ---------------------------------------------------------------------------- +// CpQtSpMainWindow::~CpQtSpMainWindow +// Description: Destructor +// ---------------------------------------------------------------------------- + +CpQtSpMainWindow::~CpQtSpMainWindow() +{ + delete iServiceProvider; +} + +// ---------------------------------------------------------------------------- +// CpQtSpMainWindow::OrientationChange +// Description: Slot for orientation change notification +// ---------------------------------------------------------------------------- + +void CpQtSpMainWindow::OrientationChange() + { + if(iView->getOrientationFlag()) + { + if(orientation() == Qt::Horizontal) + { + iView->setHorizontal(); + } + else + { + iView->setVertical(); + } + } + } + +// ---------------------------------------------------------------------------- +// CpQtSpMainWindow::showView +// Description: Slot for construction of provisioning view - called by CpQtSp +// ---------------------------------------------------------------------------- + +void CpQtSpMainWindow::showView() +{ + iView->constructView(); +} + +void CpQtSpMainWindow::buildView() + { + HbScrollArea *area = new HbScrollArea(); + area->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); + area->setScrollDirections(Qt::Horizontal|Qt::Vertical); + area->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded); + area->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded); + + HbWidget* cont = new HbWidget(); + layout = new QGraphicsLinearLayout(Qt::Vertical); + iView->buildView(layout); + cont->setLayout(layout); + area->setContentWidget(cont); + HbToolBar* toolBar = iView->toolBar(); + HbAction* saveAction = new HbAction(hbTrId("txt_device_update_button_save")); + connect(saveAction, SIGNAL(triggered()), iView, SLOT(saveProvisoningMessage())); + HbAction* DeleteAction = new HbAction(hbTrId("txt_device_update_menu_delete")); + connect(DeleteAction, SIGNAL(triggered()), iView, SLOT(deleteMessage())); + toolBar->addAction(saveAction); + toolBar->addAction(DeleteAction); + toolBar->setOrientation(Qt::Horizontal); + iView->setWidget(area); + addView(iView); +} + +void CpQtSpMainWindow::closeWindow() + { + this->close(); + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/src/CpQtSpView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/src/CpQtSpView.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,467 @@ +/* +* 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ProvisioningDebug.h" +#include "ProvisioningUIDs.h" +#include +const QString DATE_TIME_FORMAT("dd.MM.yy hh:mm"); + +// ---------------------------------------------------------------------------- +// CpQtSpView::CpQtSpView +// Description: Construtor +// ---------------------------------------------------------------------------- + + +CpQtSpView::CpQtSpView(CpQtSp* service,CpQtSpMainWindow* ptr, QGraphicsItem *parent) + : HbView(parent), iServiceProvider(service), window(ptr) +{ + setTitle(hbTrId("txt_device_update_title_messaging")); + iViewStatus = true; + iOrientationFlag = false; +} + +// ---------------------------------------------------------------------------- +// CpQtSpView::~CpQtSpView +// Description: Destructor +// ---------------------------------------------------------------------------- + + +CpQtSpView::~CpQtSpView() +{ +} + +// ---------------------------------------------------------------------------- +// CpQtSpView::corruptMessageDialog +// Description: Construction of view for provisioning message +// ---------------------------------------------------------------------------- + +void CpQtSpView::corruptMessageDialog(HbAction *action) +{ + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->primaryAction()) + { + window->closeWindow(); + } +} +// ---------------------------------------------------------------------------- +// CpQtSpView::constructView +// Description: Construction of view for provisioning message +// ---------------------------------------------------------------------------- + +void CpQtSpView::constructView() +{ + iBio = iServiceProvider->returnBio(); + TInt err( KErrNone ); + TRAP(err, array = iBio->CollectItemsLC(); CleanupStack::Pop()); + + if(err != KErrNone) + { + array->ResetAndDestroy(); + HbMessageBox *box = new HbMessageBox(hbTrId("txt_device_update_info_unable_to_open_message_f")); + box->setAttribute(Qt::WA_DeleteOnClose); + box->setTimeout(HbPopup::NoTimeout); + box->open(this,SLOT(corruptMessageDialog(HbAction*))); + } + else + { + window->buildView(); + } +} +// ---------------------------------------------------------------------------- +// CpQtSpView::buildView +// Description: Construction of view for provisioning message +// ---------------------------------------------------------------------------- + +bool CpQtSpView::buildView(QGraphicsLinearLayout* layout) +{ + //Gather information about provisioning message + TMsvId tmsvid = iServiceProvider->returnId(); + CMsvSession* session = iServiceProvider->returnSession(); + CMsvEntry* entry = session->GetEntryL(tmsvid); + entry->SetEntryL(tmsvid); + TMsvEntry index = entry->Entry(); + + // Details about message sender + TBufC details = index.iDetails; + QString fromStringName((QChar*)details.Ptr(),details.Length()); + QString fromString = "From: "; + QString from; + from.append(fromString); + from.append(fromStringName); + + + + //Construction of group box + group = new HbGroupBox(); + connect(group,SIGNAL(toggled(bool)),this,SLOT(expand())); + group->setHeading(fromStringName); + HbLabel* label = new HbLabel(from); + group->setContentWidget(label); + group->setCollapsed(true); + orientationChanges(); + layout->addItem(group); + iOrientationFlag = true; + //Message recieved time + _LIT(KUnixEpoch, "19700000:000000.000000"); + QDateTime retTimeStamp; + TTime timeStamp = index.iDate; + TTime unixEpoch(KUnixEpoch); + TTimeIntervalSeconds seconds; + timeStamp.SecondsFrom(unixEpoch, seconds); + timeStamp.DaysFrom(unixEpoch); + retTimeStamp.setTime_t(seconds.Int()); + QString qtime = retTimeStamp.toString(DATE_TIME_FORMAT); + HbTextItem* time = new HbTextItem(qtime,this); + layout->addItem(time); + + //Blank Line + HbTextItem* blankLine = new HbTextItem("", this); + layout->addItem(blankLine); + + //Details about save message + QString cfgMsg = hbTrId("txt_device_update_dblist_configuration_message"); + QString saveMsg = hbTrId("txt_device_update_dblist_product_code_val_save_to"); + HbTextItem* mPrimaryItem1 = new HbTextItem(cfgMsg, this); + HbTextItem* mSecondaryItem2 = new HbTextItem(saveMsg, this); + + //Provisioning setting details + iPrimaryFont = new HbFontSpec(HbFontSpec::Primary); + iSecondaryFont = new HbFontSpec(HbFontSpec::Secondary); + + QFont font = iPrimaryFont->font(); + mPrimaryItem1->setFont(font); + + font = iSecondaryFont->font(); + mSecondaryItem2->setFont(font); + + layout->addItem(mPrimaryItem1); + layout->addItem(mSecondaryItem2); + + + TBufC Name; + TBufC Value; + HbTextItem* mPrimaryItem[100]; + HbTextItem* mSecondaryItem[KLENGTH]; + HbTextItem* mBlank[KLENGTH]; + + QFont pfont = iPrimaryFont->font(); + QFont sfont = iSecondaryFont->font(); + + + TBuf currentTitle(KNullDesC); + + for( TInt item = 0; item < array->Count(); item++ ) + { + CWPNameValue* pair = ((*array)[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); + mBlank[item] = new HbTextItem("", this); + mBlank[item]->setFont(pfont); + layout->addItem(mBlank[item]); + 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]); + } + + array->ResetAndDestroy(); + return true; +} + +// ---------------------------------------------------------------------------- +// CpQtSpView::saveProvisoningMessage +// Description: Saves the provisioning message +// ---------------------------------------------------------------------------- + + +void CpQtSpView::saveProvisoningMessage() +{ + iBio->SaveSettingsL(); +} + +// ---------------------------------------------------------------------------- +// CpQtSpView::expand +// Description: Alignement of groupbox according to orientation +// ---------------------------------------------------------------------------- + + +void CpQtSpView::expand() + { + this->orientationChanges(); + } + +// ---------------------------------------------------------------------------- +// CpQtSpView::orientationChanges +// Description: Group box orientation changes +// ---------------------------------------------------------------------------- + +void CpQtSpView::orientationChanges() + { + if(window->orientation() == Qt::Horizontal) + { + if(!group->isCollapsed()) + { + group->setMinimumSize(KLANDSCAPE,KEXPANDED); + group->setMaximumSize(KLANDSCAPE,KEXPANDED); + } + else + { + group->setMinimumSize(KLANDSCAPE,KCOLLAPSED); + group->setMaximumSize(KLANDSCAPE,KCOLLAPSED); + } + } + else + { + if(!group->isCollapsed()) + { + group->setMinimumSize(KPORTRAIT,KEXPANDED); + group->setMaximumSize(KPORTRAIT,KEXPANDED); + } + else + { + group->setMinimumSize(KPORTRAIT,KCOLLAPSED); + group->setMaximumSize(KPORTRAIT,KCOLLAPSED); + } + } + } + +// ---------------------------------------------------------------------------- +// CpQtSpView::getOrientationFlag +// Description: Get the Orientation status +// ---------------------------------------------------------------------------- +bool CpQtSpView::getOrientationFlag() + { + return iOrientationFlag; + } +// ---------------------------------------------------------------------------- +// CpQtSpView::setHorizontal +// Description: Landscape alignment +// ---------------------------------------------------------------------------- + + +void CpQtSpView::setHorizontal() + { + if(!group->isCollapsed()) + { + group->setMinimumSize(KPORTRAIT,KEXPANDED); + group->setMaximumSize(KPORTRAIT,KEXPANDED); + } + else + { + group->setMinimumSize(KPORTRAIT,KCOLLAPSED); + group->setMaximumSize(KPORTRAIT,KCOLLAPSED); + } + + } + +// ---------------------------------------------------------------------------- +// CpQtSpView::setVertical +// Description: Portrait alignment +// ---------------------------------------------------------------------------- + + +void CpQtSpView::setVertical() + { + if(!group->isCollapsed()) + { + group->setMinimumSize(KLANDSCAPE,KEXPANDED); + group->setMaximumSize(KLANDSCAPE,KEXPANDED); + } + else + { + group->setMinimumSize(KLANDSCAPE,KCOLLAPSED); + group->setMaximumSize(KLANDSCAPE,KCOLLAPSED); + } + } + +// ---------------------------------------------------------------------------- +// CpQtSpView::deleteMessage +// Description: Deletion of provisioning message +// ---------------------------------------------------------------------------- + + +void CpQtSpView::deleteMessage() +{ + TMsvId entryID = iServiceProvider->returnId(); + CMsvSession* session = iServiceProvider->returnSession(); + CMsvEntry* entry = session->GetEntryL(entryID); + CleanupStack::PushL(entry); + entry->DeleteL(entryID); + CleanupStack::PopAndDestroy(entry); + window->close(); +} + + + +// ---------------------------------------------------------------------------- +// CpQtSpView::requestCompleted +// Description: Framework call +// ---------------------------------------------------------------------------- + +void CpQtSpView::requestCompleted(const QVariant& /*value*/) +{ +} + +// ---------------------------------------------------------------------------- +// CpQtSp::CpQtSp +// Description: constructor +// ---------------------------------------------------------------------------- + + +CpQtSp::CpQtSp(CpQtSpMainWindow *ptr, QObject* parent) +: XQServiceProvider("com.nokia.services.MDM.Provisioning",parent) +{ + window = ptr; + publishAll(); +} + +// ---------------------------------------------------------------------------- +// CpQtSp::~CpQtSp +// Description: destructor +// ---------------------------------------------------------------------------- + +CpQtSp::~CpQtSp() +{ + delete iObserver; + delete iSession; + delete iBioCtrl; +} + +// ---------------------------------------------------------------------------- +// CpQtSp::complete +// Description: Framework call +// ---------------------------------------------------------------------------- + +void CpQtSp::complete() +{ + QString retvalue =""; + completeRequest(1,retvalue); +} + +// ---------------------------------------------------------------------------- +// CpQtSp::ProcessMessage +// Description: Messaging application calls this function via QTHighway +// ---------------------------------------------------------------------------- + +QString CpQtSp::ProcessMessage(const QString& tmsvid) +{ + iId = tmsvid.toInt(); + TMsvSelectionOrdering sort; + sort.SetShowInvisibleEntries(ETrue); + iObserver = new(ELeave) CObserver; + iSession = CMsvSession::OpenSyncL(*iObserver); + iBioCtrl = CWPBioControl::NewL(iSession,iId,this); + iBioCtrl->RestoreMsgL(); + return ""; +} + +void CpQtSp::authenticationStatus() +{ + TInt ret = iBioCtrl->getAuth(); + switch(ret) + { + case KAUTENTICATIONCANCEL: + { + window->close(); + } + break; + + case KAUTENTICATIONFAILURE: + { + CMsvEntry* entry = iSession->GetEntryL(iId); + CleanupStack::PushL(entry); + entry->DeleteL(iId); + CleanupStack::PopAndDestroy(entry); + window->close(); + } + break; + + case KAUTENTICATIONSUCCESS: + { + iBioCtrl->updateAuthetication(); + emit showView(); + setCurrentRequestAsync(); + } + break; + } +} + +// ---------------------------------------------------------------------------- +// CpQtSp::returnId +// Description: used by CpQtSpView +// ---------------------------------------------------------------------------- + +TMsvId CpQtSp::returnId() +{ + return iId; +} + +// ---------------------------------------------------------------------------- +// CpQtSp::returnSession +// Description: used by CpQtSpView +// ---------------------------------------------------------------------------- + +CMsvSession* CpQtSp::returnSession() +{ + return iSession; +} + +// ---------------------------------------------------------------------------- +// CpQtSp::returnBio +// Description: used by CpQtSpView +// ---------------------------------------------------------------------------- + +CWPBioControl* CpQtSp::returnBio() + { + return iBioCtrl; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 clientprovisioning/cpqtsp/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientprovisioning/cpqtsp/src/main.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,45 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 devicecontrol.pro --- a/devicecontrol.pro Fri Jun 11 16:23:35 2010 +0100 +++ b/devicecontrol.pro Thu Jul 22 16:30:53 2010 +0100 @@ -15,7 +15,11 @@ # TEMPLATE = subdirs -SUBDIRS += deviceupdatesui +SUBDIRS += devicemgmtdialogsplugin \ + devicemgmtindicatorsplugin \ + deviceupdatesui \ + clientprovisioning \ + applicationmanagement CONFIG += ordered diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/devicemanagementnotifierdevman.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/devicemanagementnotifierdevman.qrc Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,16 @@ + + + resources/dialog.docml + resources/dialoginformative.docml + resources/dialogserverpushconfirm.docml + resources/pin.docml + resources/fotainformativedialog.docml + resources/fotasoftkeydialog.docml + resources/fotasoftkeysdialog.docml + resources/fotaresumeupdate.docml + resources/error_notes.docml + + + resources/iconnotifier.svg + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/devicemgmtdialogsplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/devicemgmtdialogsplugin.pro Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,71 @@ +# +# 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: +# Pro file of devicemgmtdialogsplugin +# +# + +TEMPLATE = lib +TARGET = devicemanagementnotifiersplugin +CONFIG += hb \ + plugin +INCLUDEPATH += . +DEPENDPATH += . +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +DESTDIR = $${HB_BUILD_DIR}/plugins/devicedialogs + +SOURCES += src/devicemanagementnotifierplugin.cpp +SOURCES += src/devicemanagementnotifierwidget.cpp +SOURCES += src/devicemanagementnotifierutils.cpp +SOURCES += src/syncmlnotifierprivate.cpp +SOURCES += src/omacppinquerydialog.cpp +SOURCES += src/syncmlconnectnotifier.cpp +SOURCES += src/fotadevicedialogs.cpp + +HEADERS += inc/devicemanagementnotifierplugin_p.h +HEADERS += inc/devicemanagementnotifierwidget_p.h +HEADERS += inc/devicemanagementnotifierutils.h +HEADERS += inc/syncmlnotifierprivate.h +HEADERS += inc/omacppinquerydialog.h +HEADERS += inc/fotadevicedialogs.h + +RESOURCES = devicemanagementnotifierdevman.qrc +#TRANSLATIONS += deviceupdates_en.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" + + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "rom/devicemgmtdialogsplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(devicemgmtdialogsplugin.iby)" +} +!local { + target.path = $${HB_PLUGINS_DIR}/devicedialogs + INSTALLS += target +} + +MOC_DIR = moc diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/inc/devicemanagementnotifierplugin_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/inc/devicemanagementnotifierplugin_p.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,52 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/inc/devicemanagementnotifierutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/inc/devicemanagementnotifierutils.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,105 @@ +/* +* 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" +#include + +class syncmlnotifier; + +class devicemanagementnotifierwidget; +class syncmlConnectNotifier; +class devicemanagementnotifierutils :public HbDialog { + +Q_OBJECT + +public: +devicemanagementnotifierutils(devicemanagementnotifierwidget* ptr,const QVariantMap ¶meters); +virtual ~devicemanagementnotifierutils(); +private: +syncmlnotifier* notifier; +syncmlConnectNotifier* connectDialog; + +}; + +class syncmlnotifier:public QObject { + +Q_OBJECT + +public: +syncmlnotifier(devicemanagementnotifierwidget* ptr); +virtual ~syncmlnotifier(); +public: + void launchDialog(const QVariantMap ¶meters); + void createserverinitnotifier(int& profileid, int& uimode,QString& servername, + bool& defaultprofile, int& timeout); + void createserveralertinformative(const QString &string); + void createserveralertconfirmative(const QString &string); + void createscomonotifier(QString notifiertype, QString name=NULL,QString size=NULL, QString format=NULL); +public slots: + void okSelected(); + void cancelSelected(); + void infoNoteOkSelected(); + void conirmNoteOkSelected(); + void conirmNoteCancelSelected(); + void noteTimedOut(HbAction* action); + +signals: + void servertextmessage(const QString &string); + +private: + syncmlnotifierprivate* msymnotifier; + devicemanagementnotifierwidget* iPtr; + bool mDefaultServerPkgZero; + +}; + +class syncmlConnectNotifier:public QObject { + +Q_OBJECT + +public: +syncmlConnectNotifier(devicemanagementnotifierwidget* ptr); +virtual ~syncmlConnectNotifier(); +public: + void launchDialog(const QVariantMap ¶meters); + +public slots: +void buttonClicked(HbAction* action); + +private: +HbProgressDialog *pDialog; +devicemanagementnotifierwidget* iPtr; + +}; + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/inc/devicemanagementnotifierwidget_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/inc/devicemanagementnotifierwidget_p.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,59 @@ +/* +* 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: +enum ENotfierType + { + EServerAlertNote, + EConnectingNote, + EInformativeNote, + EConfirmativeNote + }; +public: + devicemanagementnotifierwidget(const QVariantMap ¶meters); + virtual ~devicemanagementnotifierwidget(); + +public: //derived from HbDeviceDialogInterface + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; + void closeDeviceDialog(bool byClient); + HbDialog *deviceDialogWidget() const; + void dmDevdialogDismissed(ENotfierType notifiertype, int response); + +signals: + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + }; + +#endif // devicemanagementnotifierwidget_P_H diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/inc/fotadevicedialogs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/inc/fotadevicedialogs.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,142 @@ +/* +* 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 FOTADEVICEDIALOGS_H_ +#define FOTADEVICEDIALOGS_H_ + +#include + +#include // HbDeviceDialogInterface +#include +#include +#include +#include "syncmlnotifierprivate.h" +#include "devicemanagementnotifierwidget_p.h" + + +class fotadevicedialogs:public HbDialog, public HbDeviceDialogInterface { +//class fotadevicedialogs:public devicemanagementnotifierwidget { + +Q_OBJECT + +public: +/** + * Construction and setting of observer happens here + * + * @since S60 SF4 + * @param aType - tell sthe type of the dialog to be shown + * @param aObserver is the parent class which owns the notifier and information is + * passed to the parent class from the device dialog. + */ + +fotadevicedialogs(const QVariantMap ¶meters); + +private: + /** + * Function to call the appropriate device dialog based on the dialog ID. + * + * @since S60 SF4 + * @param aType - tell sthe type of the dialog to be shown + * @param parameters - contains the dialogID + information to be shown in the dialogs + */ + + void launchFotaDialog(const QVariantMap ¶meters); + + /** + * Function to show the informative dialog of FOTA + * + * @since S60 SF4 + * @param aType - tell sthe type of the dialog to be shown + * @param parameters - contains the dialogID + information to be shown in the dialogs + */ + + void createfotainformativedialog(TFwUpdNoteTypes aType,const QVariantMap ¶meters); + + /** + * Function to show the error message dialog of FOTA + * + * @since S60 SF4 + * @param aType - tell sthe type of the dialog to be shown + * @param parameters - contains the dialogID + information to be shown in the dialogs + */ + + void createfotamessagedialog(TFwUpdNoteTypes aType,const QVariantMap ¶meters); + + /** + * Function to show the confirmative dialog of FOTA + * + * @since S60 SF4 + * @param aType - tell sthe type of the dialog to be shown + * @param parameters - contains the dialogID + information to be shown in the dialogs + */ + void createfotaconfirmationdialog(TFwUpdNoteTypes aType,const QVariantMap ¶meters); + +public slots: + +/** + * Construction and setting of observer happens here + * + * @since S60 SF4 + * @param aObserver is the parent class which owns the notifier and information is + * passed to the parent class from the device dialog. + */ + + void fotaLSK(); + /** + * Construction and setting of observer happens here + * + * @since S60 SF4 + * @param aObserver is the parent class which owns the notifier and information is + * passed to the parent class from the device dialog. + */ + + void fotaRSK(); + + +public: //derived from HbDeviceDialogInterface + /** + * Ccalled when device dialog is closed. + * + * @since S60 SF4 + * @param byClient - The Name of the client which closed the dialog. + */ + + void closeDeviceDialog(bool byClient); + + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; +// void closeDeviceDialog(bool byClient); + HbDialog *deviceDialogWidget() const; + +signals: + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + + +signals: +/** + * servertextmessage + * + * @since S60 SF4 + * @param aObserver is the parent class which owns the notifier and information is + * passed to the parent class from the device dialog. + */ + + void servertextmessage(const QString &string); +}; + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/inc/omacppinquerydialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/inc/omacppinquerydialog.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,54 @@ +/* + * 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: omacppinquerydialog class declaration + * + */ + +#ifndef OMACPPINQUERYDIALOG_H_ +#define OMACPPINQUERYDIALOG_H_ + +#include +#include +#include +#include +#include +#include +#include "devicemanagementnotifierwidget_p.h" + +class omacppinquerydialog : public devicemanagementnotifierwidget + { + +Q_OBJECT + +public: + omacppinquerydialog(const QVariantMap ¶meters); + +public: + void createcppinquery(const QVariantMap ¶meters); + HbDialog *deviceDialogWidget() const; + +public slots: + + void pintextChanged(); + void okSelected(); + void cancelSelected(); + +private: + HbLineEdit *mlineedit; + HbAction *mactionok; + }; + + + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/inc/pnputillogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/inc/pnputillogger.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,138 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/inc/syncmlnotifierprivate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/inc/syncmlnotifierprivate.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,39 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/dialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/dialog.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/dialoginformative.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/dialoginformative.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/dialogserverpushconfirm.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/dialogserverpushconfirm.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/error_notes.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/error_notes.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/fotainformativedialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/fotainformativedialog.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/fotaresumeupdate.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/fotaresumeupdate.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/fotasoftkeydialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/fotasoftkeydialog.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/fotasoftkeysdialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/fotasoftkeysdialog.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/iconnotifier.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/iconnotifier.svg Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/resources/pin.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/resources/pin.docml Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/rom/devicemgmtdialogsplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/rom/devicemgmtdialogsplugin.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,23 @@ +/* +* 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 __DEVICEMGMTDIALOGSPLUGIN_IBY__ +#define __DEVICEMGMTDIALOGSPLUGIN_IBY__ + +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 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/src/devicemanagementnotifierplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/src/devicemanagementnotifierplugin.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,138 @@ +/* +* 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 "devicemanagementnotifierplugin_p.h" +#include "devicemanagementnotifierwidget_p.h" +#include "omacppinquerydialog.h" +#include "fotadevicedialogs.h" + + +Q_EXPORT_PLUGIN2(devicemanagementnotifiersplugin, devicemanagementnotifierplugin) + +// This plugin implements one device dialog type +static const struct + { + const char *mTypeString; + } dialogInfos[] = + { + { + devicedialogtype + } + + }; + +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) + { + // Find the dialog key + QVariantMap::const_iterator i = parameters.find(keydialog); + if (i != parameters.end()) + { + int dialogtype = i.value().toInt(); + //Compare the dialog with the constant declared + if (dialogtype == EOmaCPPinDialog) + { + // Return specific object for showing appropriate dialog + return new omacppinquerydialog(parameters); + } + + if (dialogtype >= EFwDLNeedMoreMemory && dialogtype <= EFwUpdResumeUpdate) + { + // Return specific object for showing appropriate dialog + return new fotadevicedialogs(parameters); + } + + } + 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 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/src/devicemanagementnotifierutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/src/devicemanagementnotifierutils.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,557 @@ +/* +* 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 "devicemanagementnotifierutils.h" +#include +#include +#include +#include +#include +#include +#include +#include "SyncMLNotifierParams.h" +#include "pnputillogger.h" +#include "omacppinquerydialog.h" +#include "devicemanagementnotifierwidget_p.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(devicemanagementnotifierwidget* ptr, + const QVariantMap ¶meters) + { + qDebug("devicemanagementnotifierutils"); + LOGSTRING("devicemanagementnotifierutils"); + + QVariantMap::const_iterator i = parameters.constBegin(); + int notifiertolaunch = 0; + while (i != parameters.constEnd()) + { + if (i.key().toAscii() == "syncmlfw") + { + + notifiertolaunch = i.value().toInt(); + // profileidenabled = true; + } + ++i; + } + if(notifiertolaunch == 1000001 )// Connecting dialog + { + connectDialog = new syncmlConnectNotifier(ptr); + connectDialog->launchDialog(parameters); + notifier = NULL; + } + + else + { + notifier = new syncmlnotifier(ptr); + notifier->launchDialog(parameters); + connectDialog = NULL; + } + } +devicemanagementnotifierutils::~devicemanagementnotifierutils() + { + qDebug("devicemanagementnotifierutils::~devicemanagementnotifierutils"); + if(notifier) + delete notifier; + if(connectDialog) + delete connectDialog; + } + +syncmlnotifier::syncmlnotifier(devicemanagementnotifierwidget* ptr) + { + iPtr = ptr; + mDefaultServerPkgZero = false; + 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; + bool scomonotifierenabled = false; + + int profileid = 0; + int uimode = 0; + + QString serverpushinformmessage; + QString serverpushconfirmmessage; + QString appname = NULL; + QString size = NULL; + QString sizeformat = NULL; + QString data = NULL; + QString serverdispname; + bool defaultprofile = false; + QString scomonotifiertype; + int timeout = 0; + 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(); + } + + if (i.key().toAscii() == "fotadefaultprofile") + { + defaultprofile = i.value().toBool(); + } + + if (i.key().toAscii()== "scomonotifier") + { + scomonotifierenabled = true; + scomonotifiertype = i.value().toString(); + } + if (i.key().toAscii()=="scomoappdata") + { + //getting data for download failed cases + data = i.value().toString(); + QStringList list1 = data.split(","); + appname = list1[0]; + size =list1[1]; + sizeformat = list1[2]; + } + if(i.key().toAscii()=="scomoappname") + { + //getting app name for install and uninstall failed cases + appname = i.value().toString(); + } + if (i.key().toAscii() == "pkgzerotimeout") + { + timeout = i.value().toInt(); + } + ++i; + } + + if (profileidenabled && uiserverinteraction) + { + qDebug("server interaction packet 0 enabled "); + qDebug()<setnotifierorigin(EHbSOSNotifierKeyStatus); + createserverinitnotifier(profileid, uimode, serverdispname, + defaultprofile, timeout); + } + 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); + } + else if (scomonotifierenabled) + { + createscomonotifier(scomonotifiertype,appname,size,sizeformat); + } + + } + +void syncmlnotifier::createscomonotifier(QString notifiertype,QString app_name,QString asize,QString format) + { + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/resources/error_notes.docml", &ok); + if (!ok) + { + return; + } + QString val; + HbDialog* dialog = qobject_cast (loader.findWidget("dialog")); + HbLabel* label; + + dialog->setTimeout(HbPopup::ContextMenuTimeout); + + if (notifiertype == "installfailed") + { + //install failed case + label = qobject_cast (loader.findWidget("heading_text")); + val = hbTrId("txt_device_update_title_installation_failed"); + label->setPlainText(val); + val = hbTrId("txt_device_update_info_installation_of_1_kb_failed").arg( + app_name); + label = qobject_cast (loader.findWidget("content_text")); + label->setPlainText(val); + } + else if (notifiertype == "downloadfailed") + { + //download failed + label = qobject_cast (loader.findWidget("heading_text")); + val = hbTrId("txt_device_update_title_downloading_failed"); + + label->setPlainText(val); + int sizfor = -1; + format == QString("kb") ? sizfor = 0 : sizfor = 1; + format == QString("mb") ? sizfor = 1 : sizfor = 2; + switch (sizfor) + { + case 0: + val + = hbTrId( + "txt_device_update_info_downloading_of_1_Kb_failed").arg( + app_name, asize); + break; + case 1: + val + = hbTrId( + "txt_device_update_info_downloading_of_1_Mb_failed").arg( + app_name, asize); + break; + default: + val + = hbTrId( + "txt_device_update_info_downloading_of_1_Gb_failed").arg( + app_name, asize); + break; + } + label = qobject_cast (loader.findWidget("content_text")); + label->setPlainText(val); + } + else + { + //uninstall failed + label = qobject_cast (loader.findWidget("heading_text")); + val = hbTrId("txt_device_update_title_Uninstallation_failed"); + label->setPlainText(val); + val = hbTrId("txt_device_update_info_uninstalling_of_1_Mb_failed").arg( + app_name, asize); + + label = qobject_cast (loader.findWidget("content_text")); + label->setPlainText(val); + } + dialog->setTimeout(HbPopup::StandardTimeout); + dialog->show(); + } +void syncmlnotifier::createserverinitnotifier(int& profileid, int& uimode, + QString& servername, bool& defaultprofile, int& timeout) + { + + 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; + //set body content + HbLabel *contentbody = qobject_cast (loader.findWidget( + "qtl_dialog_pri5")); + QString serverinitmessage; + QString softkeyok; + QString softkeyCancel; + if(defaultprofile) + { + mDefaultServerPkgZero = true; + heading = hbTrId("txt_device_update_title_update_available"); + serverinitmessage = + hbTrId("txt_device_update_info_recommended_update_is_avail").arg( + servername); + softkeyok = hbTrId("txt_device_update_button_update"); + softkeyCancel = hbTrId("txt_device_update_button_later"); + } + else + { + mDefaultServerPkgZero = false; + heading = hbTrId("txt_device_update_title_service_recomended"); + serverinitmessage = + hbTrId("txt_device_update_info_1_recommends_a_service_for").arg( + servername); + softkeyok = hbTrId("txt_common_button_ok"); + softkeyCancel = hbTrId("txt_common_button_cancel"); + } + contentheading->setPlainText(heading); + contentbody->setPlainText(serverinitmessage); + + //set softkeys + HbAction *primaryAction = (HbAction *) dialog->actions().first(); + + primaryAction->setText(softkeyok); + + HbAction *secondaryAction = (HbAction *) dialog->actions().at(1); + + secondaryAction->setText(softkeyCancel); + + //set dialog properties + dialog->setTimeout(timeout); + dialog->setDismissPolicy(HbPopup::NoDismiss); + //load appropriate icon from svg file + HbLabel* label1 = qobject_cast (loader.findWidget("icon")); + HbIcon* icon1 = new HbIcon(":/devman_icon/resources/iconnotifier.svg"); + label1->setIcon(*icon1); + //label1->setMode(QIcon::Normal); + //label1->setState(QIcon::Off); + label1->setToolTip("Mode=Normal, State=Off"); + + QObject::connect(dialog, SIGNAL(finished(HbAction*)), + this, SLOT(noteTimedOut(HbAction*))); + 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/resources/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_deviceupdate_info_updating_device_from_server").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/resources/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(infoNoteOkSelected())); + + qDebug("createserveralertinformative end"); + + } + +void syncmlnotifier::createserveralertconfirmative(const QString &string) + { + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/resources/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(conirmNoteOkSelected())); + + QObject::connect(secondaryAction, SIGNAL(triggered()), this, + SLOT(conirmNoteCancelSelected())); + + if (dialog) + dialog->show(); + } + +void syncmlnotifier::okSelected() + { + qDebug("ok selected"); + //msymnotifier->setstatus(0); + +iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EServerAlertNote,0); + } +void syncmlnotifier::infoNoteOkSelected() + { + iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EInformativeNote,0); + } + +void syncmlnotifier::conirmNoteOkSelected() + { + iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConfirmativeNote,0); + } +void syncmlnotifier::conirmNoteCancelSelected() + { + iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConfirmativeNote,-3); + } + +void syncmlnotifier::cancelSelected() + { + qDebug("cancel selected"); + //msymnotifier->setstatus(-3); + iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EServerAlertNote,-3); + + } + +void syncmlnotifier::noteTimedOut(HbAction* action) + { + qDebug("Pkg zero note timed out"); + if (action == NULL) + { + int timeout = -33; //KErrTimedOut + msymnotifier->setstatus(timeout); + if(mDefaultServerPkgZero) //For default server action is RSK + iPtr->dmDevdialogDismissed( + devicemanagementnotifierwidget::EServerAlertNote, -3); + else //For Non default server action is LSK + iPtr->dmDevdialogDismissed( + devicemanagementnotifierwidget::EServerAlertNote, 0); + } + } + +syncmlnotifier::~syncmlnotifier() + { + qDebug("syncmlnotifier::~syncmlnotifier"); + qDebug("syncmlnotifier::~syncmlnotifier end"); + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/src/devicemanagementnotifierwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/src/devicemanagementnotifierwidget.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,85 @@ +/* +* 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(this, parameters) +{ + // Do translation + 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); + +} + +// 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); +} + +devicemanagementnotifierwidget::~devicemanagementnotifierwidget() + { + qDebug("devicemanagementnotifierutils::~devicemanagementnotifierutils"); + } + + +void devicemanagementnotifierwidget::dmDevdialogDismissed(ENotfierType notifiertype, int response) + { + QVariantMap resultMap; + resultMap.insert("notifiertype",notifiertype); + resultMap.insert("keypress", response); + emit deviceDialogData(resultMap); + } diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/src/fotadevicedialogs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/src/fotadevicedialogs.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,492 @@ +/* +* 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 "devicemanagementnotifierutils.h" +#include +#include +#include +#include +#include +#include +#include "syncmlnotifierparams.h" +#include "fotadevicedialogs.h" +#include "PnpUtilLogger.h" +#include +#include +#include +#include +#include + + +// --------------------------------------------------------------------------- +// fotadevicedialogs::fotadevicedialogs +// Constructor for fota related device dialogs +// --------------------------------------------------------------------------- +// + +fotadevicedialogs::fotadevicedialogs(const QVariantMap ¶meters) +//: devicemanagementnotifierwidget(parameters) + { + qDebug("devicemanagementnotifierutils fotadevicedialogs"); + QTranslator *translator = new QTranslator(); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + bool fine = translator->load("deviceupdates_" + lang, path); + if (fine) + qApp->installTranslator(translator); + + QTranslator *commontranslator = new QTranslator(); + fine = commontranslator->load("common_" + lang, path);/*finally required once localisation available*/ + if(fine) + qApp->installTranslator(commontranslator); + else + qDebug("device dialog common translator loading failed"); + + + launchFotaDialog(parameters); + } + + + +// --------------------------------------------------------------------------- +// fotadevicedialogs::launchFotaDialog +// This function lauches is called to lauch the specific dialog based on the +// dialogID passed to it. +// --------------------------------------------------------------------------- +// +void fotadevicedialogs::launchFotaDialog(const QVariantMap ¶meters) + { + + QVariantMap::const_iterator i = parameters.constBegin(); + qDebug("devicemanagementnotifierutils fotadevicedialogs launchDialog"); + TFwUpdNoteTypes aType = EFwUpdDeviceBusy; + + //QString temp = QString::fromUtf8(reinterpret_cast(url.Ptr()), url.Length()); + //TDesC8 * tempStr = KKeyDialog; + //const QString temp = QString::fromUtf8(reinterpret_cast(tempStr.Ptr()), tempStr.Length()); + i = parameters.find(keydialog); + if(i != parameters.end()) + aType = (TFwUpdNoteTypes)i.value().toInt(); + + + if(aType == EFwUpdRebootNote) + { + createfotainformativedialog(aType,parameters); + } + else if(aType == EFwUpdResumeDownload || aType == EFwUpdResumeUpdate) + { + createfotaconfirmationdialog(aType,parameters); + //createfotainformativedialog(); + } + else if(aType == EFwDLNeedMoreMemory || aType == EFwDLConnectionFailure || aType == EFwDLGeneralFailure || + aType == EFwUpdNotEnoughBattery || aType == EFwUpdDeviceBusy || aType == EFwUpdSuccess || aType == EFwUpdNotCompatible + || aType == EFwDLNonResumableFailure) + { + //createfotamessagedialog(); + createfotamessagedialog(aType,parameters); + } + } + + +// --------------------------------------------------------------------------- +// fotadevicedialogs::createfotainformativedialog +// This function is called to show the informative dialog of FOTA +// --------------------------------------------------------------------------- +// +void fotadevicedialogs::createfotainformativedialog(TFwUpdNoteTypes aType,const QVariantMap ¶meters) + { + qDebug("createserveralertinformative start"); + LOGSTRING("createserveralertinformative start"); + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/resources/fotainformativedialog.docml", &ok); + if (!ok) + { + return; + } + HbDialog *dialog = qobject_cast (loader.findWidget("dialog")); + + HbLabel *content = qobject_cast (loader.findWidget( + "lblContent")); + + // No translations required + //content->setPlainText("Testing"); + + dialog->setTimeout(3000); + + if (dialog) + dialog->show(); + + QObject::connect(dialog, SIGNAL(aboutToClose()), this, SLOT(okSelected())); + + qDebug("createserveralertinformative end"); + + } + + + +// --------------------------------------------------------------------------- +// fotadevicedialogs::createfotaconfirmationdialog +// This function is called to show the confirmation dialog of FOTA. +// --------------------------------------------------------------------------- +// +void fotadevicedialogs::createfotaconfirmationdialog(TFwUpdNoteTypes aType,const QVariantMap ¶meters) + { + qDebug("createserveralertinformative start"); + LOGSTRING("createserveralertinformative start"); + + QVariantMap::const_iterator i; + HbDocumentLoader loader; + bool ok = false; + HbDialog *dialog = NULL; + + QString param1; + QString param2; + TInt size = 0; + TBool postpone = 0; + + i = parameters.find(keyparam1); + if(i != parameters.end()) + size = i.value().toInt(); + + i = parameters.find(keyparam2); + if(i != parameters.end()) + param1 = i.value().toString(); + i = parameters.find(keyparam3); + if(i != parameters.end()) + param2 = i.value().toString(); + i = parameters.find(keyparam4); + if(i != parameters.end()) + postpone = i.value().toBool(); + + + switch(aType) + { + case EFwUpdResumeDownload: + { + loader.load(":/xml/resources/fotasoftkeysdialog.docml", &ok); + if (!ok) + { + return; + } + dialog = qobject_cast (loader.findWidget("dialog")); + + HbLabel *headingString = qobject_cast (loader.findWidget( + "lblDialogHeading")); + + headingString->setPlainText(hbTrId("txt_device_update_title_device_update")); + + HbLabel *contentString = qobject_cast (loader.findWidget( + "lblDialogContent")); + + TReal sizeRounded = 0; + TReal sizeKB = size / 1024; + if(sizeKB > 1024) + { + TReal sizeMB = sizeKB / 1024; + Math::Round(sizeRounded,sizeMB,2); + QString str = hbTrId("txt_device_update_info_the_last_updte_incomp_dwnld_Mb") + //.arg(param1).arg(param2).arg(sizeMB); + .arg(param2).arg(param1).arg(sizeRounded); + contentString->setPlainText(str);//HACK + } + else + { + Math::Round(sizeRounded,sizeKB,2); + contentString->setPlainText(hbTrId("txt_device_update_info_the_last_update_incomplete_dwnld_kb") + .arg(param1).arg(param2).arg(sizeRounded)); + } + //HbAction *primaryAction = dialog->primaryAction(); + HbAction *primaryAction = (HbAction *) dialog->actions().first(); + primaryAction->setText(hbTrId("txt_common_button_continue_dialog")); + + //HbAction *secondaryAction = dialog->secondaryAction(); + HbAction *secondaryAction = (HbAction *) dialog->actions().at(1); + secondaryAction->setText(hbTrId("txt_device_update_button_resume_later")); + if(!postpone) + secondaryAction->setEnabled(postpone); + + dialog->setTimeout(HbPopup::NoTimeout); + dialog->setDismissPolicy(HbPopup::NoDismiss); + + QObject::connect(primaryAction, SIGNAL(triggered()), this, + SLOT(fotaLSK())); + + QObject::connect(secondaryAction, SIGNAL(triggered()), this, + SLOT(fotaRSK())); + break; + } + case EFwUpdResumeUpdate: + { + bool ok = false; + loader.load(":/xml/resources/fotaresumeupdate.docml", &ok); + if (!ok) + { + return; + } + + dialog = qobject_cast (loader.findWidget("dialog")); + + dialog->setTimeout(HbPopup::NoTimeout); + dialog->setDismissPolicy(HbPopup::NoDismiss); + + HbLabel *headingString = qobject_cast (loader.findWidget( + "lblHeading")); + headingString->setPlainText(hbTrId("txt_device_update_title_device_update")); + + + //HbAction *primaryAction = dialog->primaryAction(); + HbAction *primaryAction = (HbAction *) dialog->actions().first(); + primaryAction->setText(hbTrId("txt_common_button_continue_dialog")); + + //HbAction *secondaryAction = dialog->secondaryAction(); + HbAction *secondaryAction = (HbAction *) dialog->actions().at(1); + secondaryAction->setText(hbTrId("txt_device_update_button_resume_later")); + if(!postpone) + secondaryAction->setEnabled(postpone); + + HbLabel *contentSwDetails = qobject_cast (loader.findWidget( + "label")); + TReal sizeRounded = 0; + TReal sizeKB = size / 1024; + + QString content; + if(sizeKB > 1024) + { + TReal sizeMB = sizeKB / 1024; + Math::Round(sizeRounded,sizeMB,2); + contentSwDetails->setPlainText(hbTrId("txt_device_update_info_the_last_update_incomp_instal_Mb") + .arg(param1).arg(param2).arg(sizeRounded)); + } + else + { + Math::Round(sizeRounded,sizeKB,2); + contentSwDetails->setPlainText(hbTrId("txt_device_update_info_the_last_update_incomp_instal_kb") + .arg(param1).arg(param2).arg(sizeRounded)); + } + + HbLabel *contentCharger = qobject_cast (loader.findWidget( + "label_3")); + contentCharger->setPlainText(hbTrId("txt_device_update_info_it_is_recommended_to_connec")); + + HbLabel *contentInstall = qobject_cast (loader.findWidget( + "label_2")); + contentInstall->setPlainText(hbTrId("txt_device_update_info_after_the_installation_the")); + + HbLabel *contentEmergency = qobject_cast (loader.findWidget( + "label_1")); + contentEmergency->setPlainText(hbTrId("txt_device_update_info_during_the_installation_the")); + + dialog->setTimeout(HbPopup::NoTimeout); + + QObject::connect(primaryAction, SIGNAL(triggered()), this, + SLOT(fotaLSK())); + + QObject::connect(secondaryAction, SIGNAL(triggered()), this, + SLOT(fotaRSK())); + } + break; + default: + { + break; + } + } + + if (dialog) + dialog->show(); + + qDebug("createserveralertinformative end"); + + } + + +// --------------------------------------------------------------------------- +// fotadevicedialogs::createfotamessagedialog +// This function is called to show the message dialog of FOTA +// --------------------------------------------------------------------------- +// +void fotadevicedialogs::createfotamessagedialog(TFwUpdNoteTypes aType,const QVariantMap ¶meters) + { + QVariantMap::const_iterator i; + qDebug("createserveralertinformative start"); + LOGSTRING("createserveralertinformative start"); + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/resources/fotasoftkeydialog.docml", &ok); + if (!ok) + { + return; + } + HbDialog *dialog = qobject_cast (loader.findWidget("dialog")); + + HbLabel *headingString = qobject_cast (loader.findWidget( + "lblHeaind")); + headingString->setPlainText(hbTrId("txt_device_update_title_device_update")); + + HbLabel *contentString = qobject_cast (loader.findWidget( + "lblContent")); + + dialog->setTimeout(HbPopup::NoTimeout); + dialog->setDismissPolicy(HbPopup::NoDismiss); + + //HbAction *primaryAction = dialog->primaryAction(); + HbAction *primaryAction = (HbAction *) dialog->actions().first(); + primaryAction->setText(hbTrId("txt_common_button_ok_single_dialog")); + + QObject::connect(primaryAction, SIGNAL(triggered()), this, + SLOT(fotaLSK())); + + + switch(aType) + { + case EFwDLNeedMoreMemory: + { + QString content; + TInt aMemNeeded = 0; + i = parameters.find(keyparam1); + if(i != parameters.end()) + aMemNeeded = i.value().toInt(); + TInt aMemNeededKB = aMemNeeded / 1024; + if(aMemNeededKB <= 1024) + { + content = hbTrId("txt_de_info_l1_kb_free_memory_needed_for_update").arg(aMemNeededKB); + } + else + { + TInt aMemNeededMB = aMemNeededKB / 1024; + content = hbTrId("txt_de_info_l1_Mb_free_memory_needed_for_update").arg(aMemNeededMB); + } + contentString->setPlainText(content); + break; + } + case EFwDLConnectionFailure: + { + contentString->setPlainText(hbTrId("txt_device_update_info_connection_lost_while_do")); + break; + } + case EFwDLGeneralFailure: + { + contentString->setPlainText(hbTrId("txt_device_update_info_an_error_occurred_during_do")); + break; + } + case EFwDLNonResumableFailure: + { + contentString->setPlainText(hbTrId("txt_device_update_info_an_error_occurred_update_stop")); + break; + } + case EFwUpdDeviceBusy: + { + contentString->setPlainText(hbTrId("txt_device_update_info_FS_warning_device_memory_is_b")); + break; + } + case EFwUpdSuccess: + { + headingString->setPlainText(hbTrId("txt_device_update_title_phone_uptodate")); + contentString->setPlainText(hbTrId("txt_device_update_info_your_phone_is_now_updated_w")); + break; + } + case EFwUpdNotCompatible: + { + contentString->setPlainText(hbTrId("txt_device_update_info_the_phone_was_not_updated")); + break; + } + case EFwUpdNotEnoughBattery: + { + contentString->setPlainText(hbTrId("txt_device_update_info_you_will_be_notified_once_t")); + break; + } + default: + { + break; + } + } + + if (dialog) + dialog->show(); + + qDebug("createserveralertinformative end"); + + } + + +// --------------------------------------------------------------------------- +// fotadevicedialogs::fotaLSK +// This slot is called when LSK is pressed in device dialog. +// --------------------------------------------------------------------------- +// +void fotadevicedialogs::fotaLSK() + { + qDebug("ok selected"); + QVariantMap resultMap; + resultMap.insert(returnkey, EHbLSK); + emit deviceDialogData(resultMap); + } + + + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::aboutToClose +// This slot is called when RSK is pressed in device dialog. +// --------------------------------------------------------------------------- +// +void fotadevicedialogs::fotaRSK() + { + qDebug("cancel selected"); + QVariantMap resultMap; + resultMap.insert(returnkey, EHbRSK); + emit deviceDialogData(resultMap); + } + + + +// Set parameters +bool fotadevicedialogs::setDeviceDialogParameters( + const QVariantMap ¶meters) +{ + + return true; +} + +// Get error +int fotadevicedialogs::deviceDialogError() const +{ + + return 0; +} + + +// Close device dialog +// --------------------------------------------------------------------------- +// fotadevicedialogs::closeDeviceDialog +// This slot is called when device dialog is closed due to errors. +// --------------------------------------------------------------------------- +// + +void fotadevicedialogs::closeDeviceDialog(bool byClient) +{ + qDebug("cancel selected"); + emit deviceDialogClosed(); +} + + +// Return display widget +HbDialog *fotadevicedialogs::deviceDialogWidget() const +{ + + return const_cast(this); + //return const_cast(this); +} diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/src/omacppinquerydialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/src/omacppinquerydialog.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,206 @@ +/* + * 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: omacppinquerydialog class implementation + * + */ + +#include +#include +#include +#include +#include +#include +#include "omacppinquerydialog.h" +#include "pnputillogger.h" + +// ---------------------------------------------------------------------------- +// omacppinquerydialog ::omacppinquerydialog +// Initialization of member variables; Create Pin query +// ---------------------------------------------------------------------------- +// +omacppinquerydialog::omacppinquerydialog(const QVariantMap ¶meters) : + devicemanagementnotifierwidget(parameters) + { + qDebug("omacppinquerydialog omacppinquerydialog() start"); + mlineedit = 0; + mactionok = 0; + createcppinquery(parameters); + qDebug("omacppinquerydialog omacppinquerydialog() end"); + } + +HbDialog *omacppinquerydialog::deviceDialogWidget() const + { + return const_cast (this); + } + +// ---------------------------------------------------------------------------- +// omacppinquerydialog ::createcppinquery +// Create Pin query dialog from docml; Connect the signals to slots +// ---------------------------------------------------------------------------- +// +void omacppinquerydialog::createcppinquery(const QVariantMap ¶meters) + { + qDebug("omacppinquerydialog createcppinquery() start"); + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/resources/pin.docml", &ok); + if (!ok) + { + qFatal("omacppinquerydialog createcppinquery() Unable to read pin.docml"); + + } + + HbDialog *dialog = qobject_cast (loader.findWidget("dialog")); + dialog->setDismissPolicy(HbPopup::NoDismiss); + dialog->setTimeout(HbPopup::NoTimeout); + + int tries = -1; + + //Get the reties left + QVariantMap::const_iterator i = parameters.find(keyparam1); + if (i != parameters.end()) + { + tries = i.value().toInt(); + } + // In the first trial, show label without tries + HbLabel *label = qobject_cast (loader.findObject("label")); + QString labelstring = hbTrId( + "txt_device_update_dialog_enter_the_configuration_p"); + + // In the second and third trials, show label with tries left + if ((tries >= 1) && (tries <= (KPinRetries - 1))) + { + labelstring = hbTrId( + "txt_device_update_dialog_enter_the_config_trial"); + label->setNumber(tries); + } + + label->setPlainText(labelstring); + + mactionok = (HbAction *) dialog->actions().first(); + QString softkeyok = hbTrId("txt_common_button_ok"); + mactionok->setText(softkeyok); + mactionok->setEnabled(false); + + HbAction *actioncancel = (HbAction *) dialog->actions().at(1); + QString softkeyCancel = hbTrId("txt_common_button_cancel"); + actioncancel->setText(softkeyCancel); + + mlineedit = qobject_cast (loader.findObject("lineEdit")); + mlineedit->setEchoMode(HbLineEdit::Password); + mlineedit->setMaxLength(KCPPinMaxLength); + + mlineedit->setInputMethodHints(Qt::ImhDigitsOnly); + HbEditorInterface editorInterface(mlineedit); + editorInterface.setMode(HbInputModeNumeric); + editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); + dialog->setTimeout(HbPopup::NoTimeout); + + bool bconnect = false; + // Connection to the slot when PIN text is changed + bconnect = QObject::connect(mlineedit, SIGNAL(contentsChanged()), this, + SLOT( pintextChanged())); + + qDebug("omacppinquerydialog::createcppinquery() bconnect value "); + qDebug() << bconnect; + + // Connections to the slot when Ok and Cancel buttons are clicked + QObject::connect(mactionok, SIGNAL(triggered()), this, SLOT(okSelected())); + QObject::connect(actioncancel, SIGNAL(triggered()), this, + SLOT(cancelSelected())); + + if (dialog) + dialog->show(); + + + + qDebug("omacppinquerydialog createcppinquery() end"); + } + +// ---------------------------------------------------------------------------- +// omacppinquerydialog ::pintextChanged +// Slot to enable/disable Ok button when text is entered/deleted +// ---------------------------------------------------------------------------- +// +void omacppinquerydialog::pintextChanged() + { + qDebug("omacppinquerydialog::pintextChanged start"); + LOGSTRING("omacppinquerydialog::pintextChanged start"); + int textlength = 0; + textlength = mlineedit->text().length(); + LOGSTRING2("omacppinquerydialog::pintextChanged start %d", textlength); + + if (textlength > 0) + { + //If text length is positive, enable Ok button + qDebug("omacppinquerydialog::pintextChanged text is entered"); + LOGSTRING("omacppinquerydialog::pintextChanged text is entered"); + mactionok->setEnabled(true); + } + else if (textlength == 0) + { + //If text length is zero, disable Ok button + qDebug("omacppinquerydialog::pintextChanged zero text"); + LOGSTRING("omacppinquerydialog::pintextChanged zero text"); + mactionok->setEnabled(false); + } + qDebug("omacppinquerydialog::pintextChanged end"); + } + +// ---------------------------------------------------------------------------- +// omacppinquerydialog ::okSelected +// Slot to emit signals when Ok is selected +// ---------------------------------------------------------------------------- +// +void omacppinquerydialog::okSelected() + { + qDebug("omacppinquerydialog::okSelected() start"); + LOGSTRING("omacppinquerydialog::okSelected() start"); + + QString stringpin = mlineedit->text(); + QVariantMap resultMap; + resultMap.insert(pinquery, stringpin); + resultMap.insert(returnkey, EHbLSK); + + //Emit signals with the data + emit + deviceDialogData(resultMap); + emit deviceDialogClosed(); + qDebug("omacppinquerydialog::okSelected() end"); + LOGSTRING("omacppinquerydialog::okSelected() end"); + } + +// ---------------------------------------------------------------------------- +// omacppinquerydialog ::cancelSelected +// Slot to emit signals when Cancel is selected +// ---------------------------------------------------------------------------- +// +void omacppinquerydialog::cancelSelected() + { + qDebug("omacppinquerydialog::cancelSelected() start"); + LOGSTRING("omacppinquerydialog::cancelSelected() start"); + QVariantMap resultMap; + resultMap.insert(returnkey, EHbRSK); + + //Emit signals with the data + emit + deviceDialogData(resultMap); + emit deviceDialogClosed(); + + LOGSTRING("omacppinquerydialog::cancelSelected() end"); + qDebug("omacppinquerydialog::cancelSelected() end"); + } + +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/src/syncmlconnectnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/src/syncmlconnectnotifier.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,80 @@ +/* +* 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 "devicemanagementnotifierutils.h" +#include "devicemanagementnotifierwidget_p.h" + +syncmlConnectNotifier::syncmlConnectNotifier(devicemanagementnotifierwidget* ptr) + { + iPtr = ptr; + qDebug("devicemanagementnotifierutils syncmlConnectNotifier"); + QTranslator *translator = new QTranslator(); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + bool fine = translator->load("deviceupdates_" + lang, path); + if (fine) + qApp->installTranslator(translator); + QTranslator *commontranslator = new QTranslator(); + fine = commontranslator->load("common_" + lang, path); + if (fine) + qApp->installTranslator(commontranslator); + pDialog = NULL; + } + +void syncmlConnectNotifier::launchDialog(const QVariantMap ¶meters) + { + qDebug("devicemanagementnotifierutils syncmlConnectNotifier launchDialog"); + pDialog = new HbProgressDialog(HbProgressDialog::ProgressDialog); + HbAction *action = new HbAction(hbTrId("txt_common_button_cancel"), + pDialog); + pDialog->setText(hbTrId("txt_device_update_info_connecting")); + pDialog->actions().at(0)->setText(hbTrId("txt_common_button_hide")); + pDialog->setMaximum(0); + pDialog->setMinimum(0); + pDialog->addAction(action); + pDialog->open(this, SLOT(buttonClicked(HbAction*))); + qDebug("devicemanagementnotifierutils syncmlConnectNotifier launchDialog end"); + } + +void syncmlConnectNotifier::buttonClicked(HbAction* action) +{ + // Figure out, what user pressed + qDebug("syncmlConnectNotifier::buttonClicked"); + if (pDialog->actions().at(0) == action ) { + qDebug("Hide was selected"); + iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConnectingNote,0); + } + else if ( pDialog->actions().at(1) == action ) { + + qDebug("OMADM Cancel was selected"); + qDebug("syncmlConnectNotifier::ultimateDialogSlot 1"); + iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConnectingNote,-3); + } + } + + +syncmlConnectNotifier::~syncmlConnectNotifier() + { + qDebug("syncmlConnectNotifier::~syncmlConnectNotifier"); + if(pDialog) + { + delete pDialog; + pDialog = NULL; + } + qDebug("syncmlConnectNotifier::~syncmlConnectNotifier end"); + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtdialogsplugin/src/syncmlnotifierprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtdialogsplugin/src/syncmlnotifierprivate.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,162 @@ +/* +* 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 "syncmlnotifierprivate.h" +#include +#include +#include +#include +#include "nsmlconstantdefs.h" +#include "syncmlnotifierparams.h" +#include + + + +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 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/devicemgmtindicatorsplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/devicemgmtindicatorsplugin.pro Thu Jul 22 16:30:53 2010 +0100 @@ -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: +TEMPLATE = lib +TARGET = dmindicatorsplugin +CONFIG += plugin +CONFIG += hb +INCLUDEPATH += . +DEPENDPATH += . +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +HEADERS += inc/dmpronoteindicators.h \ + inc/dmindicatorsplugin.h \ + inc/dmindicator.h + +SOURCES += src/dmpronoteindicators.cpp \ + src/dmindicatorsplugin.cpp \ + src/dmindicator.cpp \ + src/tarmtrustindicator.cpp + + +symbian { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.UID3 = 0x20030009 + + pluginstub.sources = dmindicatorsplugin.dll + pluginstub.path = /resource/plugins/indicators + DEPLOYMENT += pluginstub + } +BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " \ + "rom/dmindicatorsplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(dmindicatorsplugin.iby)" \ + "resources/message1.svg /epoc32/winscw/c/resource/devicemanagement/message1.svg" \ + "resources/qtg_small_smiley_kissing.svg /epoc32/winscw/c/resource/devicemanagement/qtg_small_smiley_kissing.svg" +LIBS += -lxqservice \ + -lcsserverclientapi \ + -lapgrfx \ + -lcone diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/inc/dmindicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/inc/dmindicator.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,63 @@ +/* + * 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: Tarm Trust Indicator class + * + */ + +#ifndef DMINDICATOR_H +#define DMINDICATOR_H + +#include +#include +#include + +/** + * DM indicator base class. + * Handles client request and showing the indications. + */ +class DMIndicator : public HbIndicatorInterface + { +public: + /** + * Constructor + */ + DMIndicator(const QString &indicatorType, + HbIndicatorInterface::Category category, + HbIndicatorInterface::InteractionTypes interactionTypes); + /** + * Destructor + */ + virtual ~DMIndicator(); + + /** + * @see HbIndicatorInterface + */ + //bool handleInteraction(InteractionType type); + + + /** + * @see HbIndicatorInterface + */ + QVariant indicatorData(int role) const; + +protected: + + /** + * @see HbIndicatorInterface + */ + bool handleClientRequest(RequestType type, const QVariant ¶meter); + QVariant mParameter; + }; + +#endif // DMINDICATOR_H diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/inc/dmindicatorsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/inc/dmindicatorsplugin.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,88 @@ +/* + * 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: Device Management Indicator Plugin Class + * + */ + +#ifndef DMINDICATORSPLUGIN_H +#define DMINDICATORSPLUGIN_H + +#include +#include +#include +#include +#include + +/** + * Device Management indicator plugin class. + * Main class of DM indicator plugin. + */ +class DMIndicatorsPlugin : public QObject, public HbIndicatorPluginInterface + { + Q_OBJECT + Q_INTERFACES(HbIndicatorPluginInterface) + +public: + /** + * Constructor + */ + DMIndicatorsPlugin(); + + /** + * Destructor + */ + ~DMIndicatorsPlugin(); + + /** + * @see HbIndicatorPluginInterface + */ + QStringList indicatorTypes() const; + + /** + * @see HbIndicatorPluginInterface + */ + bool accessAllowed(const QString &indicatorType, + const QVariantMap &securityInfo) const; + /** + * @see HbIndicatorPluginInterface + */ + HbIndicatorInterface* createIndicator(const QString &indicatorType); + + /** + * @see HbIndicatorPluginInterface + */ + int error() const; + +private: + Q_DISABLE_COPY(DMIndicatorsPlugin) + + /** + * Error value + */ + int mError; + + /** + * Indicator types + * supported indicator types. + */ + QStringList mIndicatorTypes; + + /** + * Secure Clients + * Only these clients can activate/deactivate the indicators + */ + QList mSecureClients; + }; + +#endif // DMINDICATORSPLUGIN_H diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/inc/dmpronoteindicators.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/inc/dmpronoteindicators.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,73 @@ +/* + * 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: DM Progress and Notification Indicators classes + * + */ + +#ifndef DMINDICATORS_H +#define DMINDICATORS_H + +#include +#include +#include + +/** + * DM Progress and Notification indicators class. + * Handles client request and showing the indications. + */ +class DMProNoteIndicator : public DMIndicator + { +public: + /** + * Constructor + */ + DMProNoteIndicator(const QString &indicatorType, + HbIndicatorInterface::Category category, + HbIndicatorInterface::InteractionTypes interactionTypes); + + /** + * @see HbIndicatorInterface + */ + bool handleInteraction(InteractionType type); + + /** + * @see HbIndicatorInterface + */ + QVariant indicatorData(int role) const; + + }; + +/** + * Scomo Progress and Notification indicators class. + * Handles client request and showing the indications. + */ +class ScomoProNoteIndicator : public DMProNoteIndicator + { +public: + /** + * Constructor + */ + ScomoProNoteIndicator(const QString &indicatorType, + HbIndicatorInterface::Category category, + HbIndicatorInterface::InteractionTypes interactionTypes); + + /** + * @see HbIndicatorInterface + */ + bool handleInteraction(InteractionType type); + + }; + + +#endif // DMINDICATORS_H diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/inc/tarmtrustindicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/inc/tarmtrustindicator.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,51 @@ +/* + * 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: Tarm Trust Indicator class + * + */ + +#ifndef TARMTRUSTINDICATOR_H +#define TARMTRUSTINDICATOR_H + +#include +#include +#include + +/** + * Tarm Trust indicator class. + * Handles client request and showing the indications. + */ +class TarmTrustIndicator : public DMIndicator + { +public: + /** + * Constructor + */ + TarmTrustIndicator(const QString &indicatorType, + HbIndicatorInterface::Category category, + HbIndicatorInterface::InteractionTypes interactionTypes); + + /** + * Destructor + */ + ~TarmTrustIndicator(); + + /** + * @see HbIndicatorInterface + */ + QVariant indicatorData(int role) const; + + }; + +#endif // TARMTRUSTINDICATOR_H diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/resources/message1.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/resources/message1.svg Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/resources/qtg_small_smiley_kissing.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/resources/qtg_small_smiley_kissing.svg Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/rom/dmindicatorsplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/rom/dmindicatorsplugin.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,25 @@ +/* +* 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 __DMINDICATORSPLUGIN_IBY__ +#define __DMINDICATORSPLUGIN_IBY__ + +REM DLL +file=ABI_DIR\UREL\dmindicatorsplugin.dll SHARED_LIB_DIR\dmindicatorsplugin.dll UNPAGED +data=\epoc32\data\z\resource\plugins\indicators\dmindicatorsplugin.qtplugin \resource\plugins\indicators\dmindicatorsplugin.qtplugin +data=\epoc32\winscw\c\resource\devicemanagement\qtg_small_smiley_kissing.svg \resource\devicemanagement\qtg_small_smiley_kissing.svg +data=\epoc32\winscw\c\resource\devicemanagement\message1.svg \resource\devicemanagement\message1.svg +#endif \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/src/dmindicator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/src/dmindicator.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,110 @@ +/* + * 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: DM indicator base class implementation + * + */ +#include +#include +#include +#include +#include +#include "dmindicator.h" + +// ---------------------------------------------------------------------------- +// DMIndicator::DMIndicator +// @see DMIndicator.h +// ---------------------------------------------------------------------------- +DMIndicator::DMIndicator(const QString &indicatorType, + HbIndicatorInterface::Category category, + HbIndicatorInterface::InteractionTypes interactionTypes) : + HbIndicatorInterface(indicatorType, category, interactionTypes) + { + qDebug("DMIndicator::DMIndicator() start"); + mParameter = 0; + + // Do translation + QTranslator *translator = new QTranslator(); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + bool fine = translator->load("deviceupdates_" + lang, path); + if (fine) + qApp->installTranslator(translator); + qDebug("DMIndicator::DMIndicator() end"); + } + +// ---------------------------------------------------------------------------- +// DMIndicator::~DMIndicator +// @see DMIndicator.h +// ---------------------------------------------------------------------------- +DMIndicator::~DMIndicator() + { + + } + +// ---------------------------------------------------------------------------- +// DMIndicator::indicatorData +// @see DMIndicator.h +// ---------------------------------------------------------------------------- +QVariant DMIndicator::indicatorData(int role) const + { + qDebug("DMIndicator::indicatorData() start"); + switch (role) + { + + case MonoDecorationNameRole: + { + //QString iconName("z:/resource/devicemanagement/qtg_small_smiley_kissing.svg"); + //QString iconName("C:/resource/devicemanagement/qtg_small_smiley_kissing.svg"); + QString iconName("qtg_small_smiley_kissing"); + return iconName; + } + + default: + return QVariant(); + + } + } + +// ---------------------------------------------------------------------------- +// DMIndicator::handleClientRequest +// @see DMIndicator.h +// ---------------------------------------------------------------------------- +bool DMIndicator::handleClientRequest(RequestType type, + const QVariant ¶meter) + { + qDebug("DMIndicator::handleClientRequest() start"); + bool handled(false); + switch (type) + { + case RequestActivate: + { + qDebug("DMIndicator::handleClientRequest() RequestActivate"); + mParameter = parameter; + emit + dataChanged(); + handled = true; + } + break; + case RequestDeactivate: + { + qDebug("DMIndicator::handleClientRequest() RequestDeactivate"); + emit deactivate(); + } + break; + default: + break; + } + qDebug("DMIndicator::handleClientRequest() end"); + return handled; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/src/dmindicatorsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/src/dmindicatorsplugin.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,172 @@ +/* + * 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: DM indicators plugin implementation + * + */ + +#include +#include +#include + +#include "dmindicatorsplugin.h" +#include "dmindicator.h" +#include "tarmtrustindicator.h" +#include "dmpronoteindicators.h" + + +Q_EXPORT_PLUGIN(DMIndicatorsPlugin) + +// Secure Clients UIDs +TUid PolicyManagmentSecUID = + { + 0x10207815 + }; + +TUid ScomoSecUID = + { + 0x200267FB + }; + +TUid FotaSecUID = + { + 0x2002FF68 + }; + + +// ---------------------------------------------------------------------------- +// DMIndicatorsPlugin::DMIndicatorsPlugin +// @see DMIndicatorsPlugin.h +// ---------------------------------------------------------------------------- +DMIndicatorsPlugin::DMIndicatorsPlugin() : + mError(0) + { + mIndicatorTypes.append(KDMProgressIndicatorType); + mIndicatorTypes.append(KDMNotificationIndicatorType); + mIndicatorTypes.append(KDMSettingsIndicatorType); + mIndicatorTypes.append(KScomoProgressIndicatorType); + mIndicatorTypes.append(KScomoNotificationIndicatorType); + mSecureClients.append(PolicyManagmentSecUID); + mSecureClients.append(ScomoSecUID); + mSecureClients.append(FotaSecUID); + + } + +// ---------------------------------------------------------------------------- +// DMIndicatorsPlugin::~DMIndicatorsPlugin +// @see DMIndicatorsPlugin.h +// ---------------------------------------------------------------------------- +DMIndicatorsPlugin::~DMIndicatorsPlugin() + { + } + +// ---------------------------------------------------------------------------- +// DMIndicatorsPlugin::indicatorTypes +// Return notification types this plugin implements +// @see DMIndicatorsPlugin.h +// ---------------------------------------------------------------------------- +QStringList DMIndicatorsPlugin::indicatorTypes() const + { + qDebug("DMIndicatorsPlugin::indicatorTypes()"); + return mIndicatorTypes; + } + +// ---------------------------------------------------------------------------- +// DMIndicatorsPlugin::accessAllowed +// Check if client is allowed to use notification widget +// @see DMIndicatorsPlugin.h +// ---------------------------------------------------------------------------- +bool DMIndicatorsPlugin::accessAllowed(const QString &indicatorType, + const QVariantMap &securityInfo) const + { + qDebug("DMIndicatorsPlugin::accessAllowed()"); + Q_UNUSED(indicatorType) + +#if defined(Q_OS_SYMBIAN) + + TUid SecUID = TUid::Uid(securityInfo.value("sym-secureId").toUInt()); + + if (mSecureClients.contains(SecUID)) + { + qDebug("DMIndicatorsPlugin::accessAllowed() SecUID is secure "); + return true; + } + else + { + qDebug("DMIndicatorsPlugin::accessAllowed() SecUID is not secure "); + return false; + } +#elif + Q_UNUSED(securityInfo) + qDebug("DMIndicatorsPlugin::accessAllowed() not Symbian "); + return false; + +#endif + } + +// ---------------------------------------------------------------------------- +// DMIndicatorsPlugin::createIndicator +// @see DMIndicatorsPlugin.h +// ---------------------------------------------------------------------------- +HbIndicatorInterface* DMIndicatorsPlugin::createIndicator( + const QString &indicatorType) + { + qDebug("DMIndicatorsPlugin::createIndicator() Start"); + HbIndicatorInterface *indicator = 0; + + if (indicatorType == KDMProgressIndicatorType) + { + indicator = new DMProNoteIndicator(indicatorType, + HbIndicatorInterface::ProgressCategory, + HbIndicatorInterface::InteractionActivated); + } + else if (indicatorType == KDMNotificationIndicatorType) + { + indicator = new DMProNoteIndicator(indicatorType, + HbIndicatorInterface::NotificationCategory, + HbIndicatorInterface::InteractionActivated); + } + + else if (indicatorType == KDMSettingsIndicatorType) + { + indicator = new TarmTrustIndicator(indicatorType, + HbIndicatorInterface::SettingCategory, + HbIndicatorInterface::NoInteraction); + } + else if (indicatorType == KScomoProgressIndicatorType) + { + indicator = new ScomoProNoteIndicator(indicatorType, + HbIndicatorInterface::ProgressCategory, + HbIndicatorInterface::InteractionActivated); + } + else if (indicatorType == KScomoNotificationIndicatorType) + { + indicator = new ScomoProNoteIndicator(indicatorType, + HbIndicatorInterface::NotificationCategory, + HbIndicatorInterface::InteractionActivated); + } + + qDebug("DMIndicatorsPlugin::createIndicator() end"); + return indicator; + } + +// ---------------------------------------------------------------------------- +// DMIndicatorsPlugin::error +// @see DMIndicatorsPlugin.h +// ---------------------------------------------------------------------------- +int DMIndicatorsPlugin::error() const + { + qDebug("DMIndicatorsPlugin::error()"); + return mError; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/src/dmpronoteindicators.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/src/dmpronoteindicators.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,128 @@ +/* + * 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: DM Progress and Notification indicators implementation + * + */ +#include "dmindicator.h" +#include "dmpronoteindicators.h" +#include +#include +#include +#include +#include +#include +#include + +#include +// ---------------------------------------------------------------------------- +// DMProNoteIndicator::DMProNoteIndicator +// @see dmpronoteindicators.h +// ---------------------------------------------------------------------------- +DMProNoteIndicator::DMProNoteIndicator(const QString &indicatorType, + HbIndicatorInterface::Category category, + HbIndicatorInterface::InteractionTypes interactionTypes) : + DMIndicator(indicatorType, category, interactionTypes) + { + + } + +// ---------------------------------------------------------------------------- +// DMProNoteIndicator::indicatorData +// @see dmpronoteindicators.h +// ---------------------------------------------------------------------------- +QVariant DMProNoteIndicator::indicatorData(int role) const + { + qDebug("DMProNoteIndicator::indicatorData()"); + switch (role) + { + case PrimaryTextRole: + { + QString text = hbTrId("txt_device_update_dblist_device_updates"); + return text; + } + case SecondaryTextRole: + { + QString text = mParameter.toString(); + return text; + } + case MonoDecorationNameRole: + { + //QString iconName("C:/resource/devicemanagement/qtg_small_smiley_kissing.svg"); + QString iconName("qtg_small_smiley_kissing"); + return iconName; + } + + case DecorationNameRole: + { + //QString iconName("C:/resource/devicemanagement/qtg_small_smiley_kissing.svg"); + QString iconName("qtg_small_smiley_kissing"); + return iconName; + } + default: + qDebug( + "DMProNoteIndicator::indicatorData() returning Null QVariant"); + return QVariant(); + + } + } + +// ---------------------------------------------------------------------------- +// DMProNoteIndicator::handleInteraction +// @see dmpronoteindicators.h +// ---------------------------------------------------------------------------- +bool DMProNoteIndicator::handleInteraction(InteractionType type) + { + qDebug("DMProNoteIndicator::handleInteraction() Start"); + QVariantMap map; + map.insert("data", indicatorType()); + emit userActivated(map); + emit deactivate(); + qDebug("DMProNoteIndicator::handleInteraction() End"); + return true; + } + +// ---------------------------------------------------------------------------- +// ScomoProNoteIndicator::ScomoProNoteIndicator +// @see dmpronoteindicators.h +// ---------------------------------------------------------------------------- +ScomoProNoteIndicator::ScomoProNoteIndicator(const QString &indicatorType, + HbIndicatorInterface::Category category, + HbIndicatorInterface::InteractionTypes interactionTypes) : +DMProNoteIndicator(indicatorType, category, interactionTypes) + { + + } + +// ---------------------------------------------------------------------------- +// ScomoProNoteIndicator::handleInteraction +// @see dmpronoteindicators.h +// ---------------------------------------------------------------------------- +bool ScomoProNoteIndicator::handleInteraction(InteractionType type) + { + qDebug("ScomoProNoteIndicator::handleInteraction() Start"); + bool handled = false; + + emit deactivate(); + CCoeEnv* coe = CCoeEnv::Static(); + TApaTaskList taskList(coe->WsSession()); + TApaTask task=taskList.FindApp(TUid::Uid(0x200267FB)); + if(task.Exists()) + { + task.BringToForeground(); + } + qDebug("ScomoProNoteIndicator::handleInteraction() End"); + return handled; + } + + diff -r 7d88c1eb7da3 -r 751cd8585b82 devicemgmtindicatorsplugin/src/tarmtrustindicator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtindicatorsplugin/src/tarmtrustindicator.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,75 @@ +/* + * 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: TarmTrust Indicator implementation + * + */ +#include "tarmtrustindicator.h" +#include "dmindicator.h" +#include +#include +#include + +// ---------------------------------------------------------------------------- +// TarmTrustIndicator::TarmTrustIndicator +// @see tarmtrustindicator.h +// ---------------------------------------------------------------------------- +TarmTrustIndicator::TarmTrustIndicator(const QString &indicatorType, + HbIndicatorInterface::Category category, + HbIndicatorInterface::InteractionTypes interactionTypes) : + DMIndicator(indicatorType, category, interactionTypes) + { + } + +// ---------------------------------------------------------------------------- +// TarmTrustIndicator::~TarmTrustIndicator +// @see tarmtrustindicator.h +// ---------------------------------------------------------------------------- +TarmTrustIndicator::~TarmTrustIndicator() + { + } + +// ---------------------------------------------------------------------------- +// TarmTrustIndicator::indicatorData +// @see tarmtrustindicator.h +// ---------------------------------------------------------------------------- +QVariant TarmTrustIndicator::indicatorData(int role) const + { + qDebug("TarmTrustIndicator::indicatorData()"); + switch (role) + { + case MonoDecorationNameRole: + { + QString StringText = mParameter.toString(); + QString iconName; + if (StringText == KTarmTrustManagementActive) + { + qDebug("TarmTrustIndicator::indicatorData() Management Active"); + //iconName = "C:/resource/devicemanagement/message1.svg"; + iconName = "message1"; + } + else if (StringText == KTarmTrustTerminalSecurity) + { + qDebug("TarmTrustIndicator::indicatorData() Terminal Security"); + //iconName = "C:/resource/devicemanagement/qtg_small_smiley_kissing.svg"; + iconName = "qtg_small_smiley_kissing"; + } + + return iconName; + } + default: + return QVariant(); + + } + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/bld/bld.inf --- a/deviceupdatesui/adapters/bld/bld.inf Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/bld/DevDetail_HwV.txt --- a/deviceupdatesui/adapters/devdetail/bld/DevDetail_HwV.txt Fri Jun 11 16:23:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -0000 \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/bld/DevDetail_SwV.txt --- a/deviceupdatesui/adapters/devdetail/bld/DevDetail_SwV.txt Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/bld/bld.inf --- a/deviceupdatesui/adapters/devdetail/bld/bld.inf Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/bld/nsmldmdevdetailadapter.mmp --- a/deviceupdatesui/adapters/devdetail/bld/nsmldmdevdetailadapter.mmp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/inc/nsmldmdevdetailadapter.h --- a/deviceupdatesui/adapters/devdetail/inc/nsmldmdevdetailadapter.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailadapter.cpp --- a/deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailadapter.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailadapter.rss --- a/deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailadapter.rss Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailutils_ARM.cpp --- a/deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailutils_ARM.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailutils_WINSCW.cpp --- a/deviceupdatesui/adapters/devdetail/src/nsmldmdevdetailutils_WINSCW.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devinfo/bld/bld.inf --- a/deviceupdatesui/adapters/devinfo/bld/bld.inf Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devinfo/bld/nsmldmdevinfoadapter.mmp --- a/deviceupdatesui/adapters/devinfo/bld/nsmldmdevinfoadapter.mmp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devinfo/inc/nsmldmdevinfoadapter.h --- a/deviceupdatesui/adapters/devinfo/inc/nsmldmdevinfoadapter.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.cpp --- a/deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.rss --- a/deviceupdatesui/adapters/devinfo/src/nsmldmdevinfoadapter.rss Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/inc/nsmldmimpluids.h --- a/deviceupdatesui/adapters/inc/nsmldmimpluids.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/bld/bld.inf --- a/deviceupdatesui/adapters/syncmldm12/bld/bld.inf Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/bld/nsmldmsettingsadapter12.mmp --- a/deviceupdatesui/adapters/syncmldm12/bld/nsmldmsettingsadapter12.mmp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h --- a/deviceupdatesui/adapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp --- a/deviceupdatesui/adapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/src/nsmldmsettingsadapter12.rss --- a/deviceupdatesui/adapters/syncmldm12/src/nsmldmsettingsadapter12.rss Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/bwins/syncmldm12testu.def --- a/deviceupdatesui/adapters/syncmldm12/tsrc/bwins/syncmldm12testu.def Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/conf/syncmldm12test.cfg --- a/deviceupdatesui/adapters/syncmldm12/tsrc/conf/syncmldm12test.cfg Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/eabi/syncmldm12testu.def --- a/deviceupdatesui/adapters/syncmldm12/tsrc/eabi/syncmldm12testu.def Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/group/bld.inf --- a/deviceupdatesui/adapters/syncmldm12/tsrc/group/bld.inf Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/group/syncmldm12test.mmp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/group/syncmldm12test.mmp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/group/syncmldm12test.pkg --- a/deviceupdatesui/adapters/syncmldm12/tsrc/group/syncmldm12test.pkg Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/inc/TestDmDDFObject.h --- a/deviceupdatesui/adapters/syncmldm12/tsrc/inc/TestDmDDFObject.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/inc/dmatest.h --- a/deviceupdatesui/adapters/syncmldm12/tsrc/inc/dmatest.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/inc/syncmldm12test.h --- a/deviceupdatesui/adapters/syncmldm12/tsrc/inc/syncmldm12test.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/init/syncmldm12test.ini --- a/deviceupdatesui/adapters/syncmldm12/tsrc/init/syncmldm12test.ini Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/src/TestDmDDFObject.cpp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/src/TestDmDDFObject.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/src/dmatest.cpp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/src/dmatest.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/src/syncmldm12test.cpp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/src/syncmldm12test.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/adapters/syncmldm12/tsrc/src/syncmldm12testBlocks.cpp --- a/deviceupdatesui/adapters/syncmldm12/tsrc/src/syncmldm12testBlocks.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/Cpqtsp.pri --- a/deviceupdatesui/cpqtsp/Cpqtsp.pri Fri Jun 11 16:23:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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: -# - -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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/cpqtsp.pro --- a/deviceupdatesui/cpqtsp/cpqtsp.pro Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/inc/CWPBioControl.h --- a/deviceupdatesui/cpqtsp/inc/CWPBioControl.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/inc/CWPNameValue.h --- a/deviceupdatesui/cpqtsp/inc/CWPNameValue.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/inc/CWPStringPair.h --- a/deviceupdatesui/cpqtsp/inc/CWPStringPair.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/inc/CpQtSpMainWindow.h --- a/deviceupdatesui/cpqtsp/inc/CpQtSpMainWindow.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/inc/CpQtSpView.h --- a/deviceupdatesui/cpqtsp/inc/CpQtSpView.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/inc/ProvisioningDebug.h --- a/deviceupdatesui/cpqtsp/inc/ProvisioningDebug.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/inc/ProvisioningUIDs.h --- a/deviceupdatesui/cpqtsp/inc/ProvisioningUIDs.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/resources/service_conf.xml --- a/deviceupdatesui/cpqtsp/resources/service_conf.xml Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/rom/cpqtsp.iby --- a/deviceupdatesui/cpqtsp/rom/cpqtsp.iby Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/rom/cpsqtsp_resources.iby --- a/deviceupdatesui/cpqtsp/rom/cpsqtsp_resources.iby Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/src/CWPBioControl.cpp --- a/deviceupdatesui/cpqtsp/src/CWPBioControl.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/src/CWPNameValue.cpp --- a/deviceupdatesui/cpqtsp/src/CWPNameValue.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/src/CWPStringPair.cpp --- a/deviceupdatesui/cpqtsp/src/CWPStringPair.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/src/CpQtSpMainWindow.cpp --- a/deviceupdatesui/cpqtsp/src/CpQtSpMainWindow.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/src/CpQtSpView.cpp --- a/deviceupdatesui/cpqtsp/src/CpQtSpView.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/cpqtsp/src/main.cpp --- a/deviceupdatesui/cpqtsp/src/main.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/PnpUtilLogger.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/PnpUtilLogger.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierdevman.qrc --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierdevman.qrc Fri Jun 11 16:23:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - dialog.docml - dialoginformative.docml - dialogserverpushconfirm.docml - - - iconnotifier.svg - - diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierplugin.cpp --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierplugin.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +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 -{ - - - 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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierplugin_p.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierplugin_p.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifiersplugin.pro --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifiersplugin.pro Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.cpp --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 = dialog->primaryAction(); - QString softkeyok = hbTrId("txt_common_button_ok"); - primaryAction->setText(softkeyok); - - HbAction *secondaryAction = dialog->secondaryAction(); - 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 = dialog->primaryAction(); - QString softkeyok = hbTrId("txt_common_button_yes"); - primaryAction->setText(softkeyok); - - HbAction *secondaryAction = dialog->secondaryAction(); - 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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierwidget.cpp --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierwidget.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierwidget_p.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierwidget_p.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/dialog.docml --- a/deviceupdatesui/devicemanagementnotifiersplugin/dialog.docml Fri Jun 11 16:23:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/dialoginformative.docml --- a/deviceupdatesui/devicemanagementnotifiersplugin/dialoginformative.docml Fri Jun 11 16:23:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/dialogserverpushconfirm.docml --- a/deviceupdatesui/devicemanagementnotifiersplugin/dialogserverpushconfirm.docml Fri Jun 11 16:23:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/iconnotifier.svg --- a/deviceupdatesui/devicemanagementnotifiersplugin/iconnotifier.svg Fri Jun 11 16:23:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/syncmlnotifierprivate.cpp --- a/deviceupdatesui/devicemanagementnotifiersplugin/syncmlnotifierprivate.cpp Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/devicemanagementnotifiersplugin/syncmlnotifierprivate.h --- a/deviceupdatesui/devicemanagementnotifiersplugin/syncmlnotifierprivate.h Fri Jun 11 16:23:35 2010 +0100 +++ /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 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/deviceupdates.pro --- a/deviceupdatesui/deviceupdates/deviceupdates.pro Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/deviceupdates.pro Thu Jul 22 16:30:53 2010 +0100 @@ -40,7 +40,11 @@ -letel3rdparty\ -letelpckt\ -lcmmanager\ - -lsisregistryclient + -lsisregistryclient \ + -lfotaengine \ + -leuser \ + -lflogger \ + -lxqutils } TEMPLATE = app TARGET = deviceupdates @@ -64,7 +68,10 @@ ./inc/dmadvancedview.h\ ./inc/settingsdataformcustomitem.h\ ./inc/dmfotaview.h\ -./inc/nsmldmdbnotifier.h +./inc/nsmldmdbnotifier.h \ +./inc/deviceupdatemoniter.h \ +./inc/deviceupdatemoniterobserver.h \ +./inc/DeviceUpdateDebug.h SOURCES += ./src/dmadvancedview.cpp \ ./src/main.cpp \ @@ -77,11 +84,12 @@ ./src/dminforetrieval.cpp\ ./src/serversettingsview.cpp\ ./src/settingsdataformcustomitem.cpp\ - ../src/dmfotaview.cpp \ - ../src/nsmldmdbnotifier.cpp + ./src/dmfotaview.cpp \ + ./src/nsmldmdbnotifier.cpp \ + ./src/deviceupdatemoniter.cpp RESOURCES += ./resources/deviceupdates.qrc CONFIG += hb -#TRANSLATIONS += deviceupdates.ts +TRANSLATIONS += deviceupdates.ts diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/DeviceUpdateDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/deviceupdates/inc/DeviceUpdateDebug.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,73 @@ +/* +* 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 +* +*/ + + + +#ifndef FOTADEBUG_H +#define FOTADEBUG_H + + // IMPORT_C static TInt Print(TRefByValue aFmt,...); +#if defined (__WINS__) + #define _FOTA_DEBUG + #define _FOTA_DEBUG_RDEBUG +#else + #define _FOTA_DEBUG +#endif + //#endif + #ifdef _FOTA_DEBUG + + + #include + #include + #include + #include + + _LIT( KLogFile, "deviceupdates.log" ); + _LIT( KLogDir, "fota" ); + + inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + #ifdef _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG RDebug::Print + #else // __GNUC__ + #define FLOG(arg...) RDebug::Print(arg); + #endif // __GNUC__ + #else // _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG FWrite + #else // __GNUC__ + #define FLOG(arg...) FWrite(arg); + #endif // __GNUC__ + #endif // _FOTA_DEBUG_RDEBUG + + #else // _FOTA_DEBUG + #ifndef __GNUC__ + #define FLOG + #else + #define FLOG(arg...) + #endif // __GNUC__ + #endif // _FOTA_DEBUG + +#endif // FOTADEBUG_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/deviceupdatemoniter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/deviceupdates/inc/deviceupdatemoniter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,104 @@ +/* + * 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: Fota server update and download functionality + * + */ + +#ifndef DEVICEUPDATEMONITER_H +#define DEVICEUPDATEMONITER_H + +// INCLUDES +#include +#include +#include +#include "deviceupdatemoniterobserver.h" +#include +// CLASS DECLARATION + +/** + * CClassName + * + */ +#include + +#define KOmaDMAppUid 0x101F6DE5 + +//static const TUid KOmaDMAppUid = { 0x101F6DE5 }; + +const TUint32 KFotaServerActive = 0x0000008; + + +//#include // MDeviceMoniterObserver + +class CDeviceUpdateMoniter + : + public CActive + //public MDeviceMoniterObserver + //: public QObject, public MHbDeviceDialogObserver + { +public: // new functions + static CDeviceUpdateMoniter* NewL (MDeviceMoniterObserver* aObserver); + + CDeviceUpdateMoniter(); + + ~CDeviceUpdateMoniter(); + + void StartMoniter(); + + void ConstructL(); + +public: + /** + * Handle user action + * + * @since S60 v3.1 + * @param None + * @return None + */ + virtual void RunL(); + + + /** + * Handle leaving Runl + * + * @since S60 v3.1 + * @param aError error code + * @return Error code + */ + virtual TInt RunError(TInt aError); + + + /** + * Handle cancel of active object + * + * @since S60 v3.1 + * @param none + * @return none + */ + void DoCancel(); + + + TInt CancelRequest(); + + +private: + + //MDeviceMoniterObserver* iDownload; + MDeviceMoniterObserver * iObserver; + + RProperty iProperty; + + }; + +#endif // DEVICEUPDATEMONITER_H diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/deviceupdatemoniterobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/deviceupdates/inc/deviceupdatemoniterobserver.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,33 @@ +/* + * 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: Fota server update and download functionality + * + */ + +#ifndef DEVICEUPDATEMONITEROBSERVER_H +#define DEVICEUPDATEMONITEROBSERVER_H + +class MDeviceMoniterObserver + { +public: + /** + * Notify the input of the device dialog to the respective caller. + */ + virtual void UpdateDMUI(TBool aVal) = 0; + }; + +#endif // DEVICEUPDATEMONITEROBSERVER_H + +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/dmadvancedview.h --- a/deviceupdatesui/deviceupdates/inc/dmadvancedview.h Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/inc/dmadvancedview.h Thu Jul 22 16:30:53 2010 +0100 @@ -45,6 +45,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include "nsmldmsyncprivatecrkeys.h" #include "serversettingsview.h" #include "dminforetrieval.h" #define DOCML_FILE_NAME ":xml/serversview.docml" @@ -61,13 +67,14 @@ #define PORTRAIT "portrait" const TInt KWlanMacAddrLength = 100; -const TInt KBTAddrLength = 64; +const TInt KBTAddrLength = 64; +class DMFotaView; class DmAdvancedView : public HbView { Q_OBJECT public: - explicit DmAdvancedView(HbMainWindow *mainWindow, HbView *mainView, QGraphicsItem *parent=0); + explicit DmAdvancedView(HbMainWindow *mainWindow, DMFotaView *mainView,DmInfo *info=NULL, QGraphicsItem *parent=0); virtual ~DmAdvancedView(); bool displayItems(); void saveProfile(QStringList& itemdata, bool& sessmode, QString& currap,unsigned int& portnum, bool& nauth ); @@ -78,7 +85,8 @@ void NetworkBand(RMobilePhone::TMobilePhoneNetworkBandInfo val, QString& string); void NetworkCiphering(RMobilePhone::TMobilePhoneNetworkSecurity val, QString& string); void mainCalltoUpdateView(); - + void addVersionInfo(); + void addOtherDetails(); private: void updateEarlierdefaultProfileIcon(); void updateListview(); @@ -109,9 +117,8 @@ HbPushButton* newserverprofile; int count; QTranslator *translator; - DmInfo* dminfo; QStandardItemModel *model; - QStandardItemModel *otherdetailsmodel; + QStandardItemModel *m_otherdetailsmodel; int currentdefaultprofile; bool connectionRequested; bool backbehaviorset; @@ -122,7 +129,8 @@ ServerSettingsView* serverSetView; HbAnchorLayout* layout; int currentview; - HbView* iMainView; + //HbView* iMainView; + DMFotaView* iMainView; HbAction* backaction; RMobilePhone imobPhone; RTelServer iServer; @@ -132,6 +140,8 @@ //This item should not be deleted,it just refer an item and deletion //will be taken care by List view QStandardItem *modelItem; +public: + DmInfo* dminfo; }; #endif // DMADVANCEDVIEW_H diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/dmfotaview.h --- a/deviceupdatesui/deviceupdates/inc/dmfotaview.h Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/inc/dmfotaview.h Thu Jul 22 16:30:53 2010 +0100 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -34,12 +35,18 @@ #include #include #include +#include "dminforetrieval.h" +#include +#include "deviceupdatemoniterobserver.h" //_LIT( KSmlEOL, "\n" ); class HbDialog; +class HbPushButton; class DmAdvancedView; -class DMFotaView : public HbView +class CDeviceUpdateMoniter; + +class DMFotaView : public HbView, public MDeviceMoniterObserver { Q_OBJECT public: @@ -47,15 +54,22 @@ virtual ~DMFotaView(); bool addFotaView(); //HbDialog* createDialog() const; + void displayNoteAndDisableButtons(); + void enableButtons(); private: void FormatList(QString val, QString str); + RFotaEngineSession& FotaEngineL(); + void fotaSupportEnabled(); public slots : void OnHelp(); void OnExit(); void CheckforUpdate(); - void AdvancedDeviceManager(); + void AdvancedDeviceManager(bool launchadvanceview = true); void backtoMainWindow(); void readSection( Qt::Orientation orientation ); + void ResumeUpdate(); +public: + void UpdateDMUI(TBool aVal); private: HbMainWindow* mMainWindow; HbView* fotaPortraitView; @@ -68,8 +82,20 @@ QTranslator* mTranslator; HbLabel *label,*label2,*label3,*label4; QStringList list1,list2; - TInt i; + TInt i; + DmInfo* mainDmInfo; HbDocumentLoader loader,loader2; + HbPushButton *updateButton; + TInt fotaValue; + HbPushButton *advancedButton; + HbPushButton *updateButtonLandscape; + HbPushButton *advancedButtonLandscape; + + RFotaEngineSession iFotaEngine; + RFotaEngineSession::TState iFotaState; + + CDeviceUpdateMoniter * iMoniter; + TBool Connected; }; diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/dminforetrieval.h --- a/deviceupdatesui/deviceupdates/inc/dminforetrieval.h Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/inc/dminforetrieval.h Thu Jul 22 16:30:53 2010 +0100 @@ -38,7 +38,7 @@ Q_OBJECT public: - DmInfo(DmAdvancedView* serversview, QGraphicsItem *parent=0); + DmInfo(DmAdvancedView* serversview=NULL, QGraphicsItem *parent=0); virtual ~DmInfo(); void refreshProfileList(TBool aIncludeHidden = ETrue); int profilescount(); @@ -54,6 +54,7 @@ bool checksrvid(QString& serverid); void getIaplist(QStringList& iaplist, int& iapselected, int& listindex); void synchronize(int& itemnum); + void sync(int aProfileId); void synccomplete(int); /** * Handles DB events @@ -61,13 +62,13 @@ * @return None */ void HandleDbEventL( TNSmlDMDbEvent aEvent ); - + TInt DefaultFotaProfileIdL() const; void DisableDbNotifications( TBool aEvent ); private: void GetProfiles( ); + TInt findProfile(TInt aProfileId); void OpenSyncSession(); - TInt DefaultFotaProfileIdL() const; void SetDefaultFotaProfileIdL( const TInt aProfileId ); public slots: diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/nsmldmsynchandler.h --- a/deviceupdatesui/deviceupdates/inc/nsmldmsynchandler.h Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/inc/nsmldmsynchandler.h Thu Jul 22 16:30:53 2010 +0100 @@ -27,6 +27,9 @@ #include "nsmldmsyncutil.h" #include "nsmldmsyncprofile.h" #include "nsmldmsyncappengine.h" +#include +#include +#include // FORWARD DECLARATIONS class CNSmlDMSyncState; class CNSmlDMActiveCaller; @@ -280,6 +283,10 @@ // Identifies Fota progress note launched or not TBool iFotaProgressLaunched; + + HbDialog * iDialog; + + HbAction * iPrimaryAction; }; #endif // NSMLDMSYNCHANDLER_H diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/serversettingsview.h --- a/deviceupdatesui/deviceupdates/inc/serversettingsview.h Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/inc/serversettingsview.h Thu Jul 22 16:30:53 2010 +0100 @@ -53,6 +53,7 @@ void backButtonClicked(); void checkServerIdvalue(); void accessPointItemChanged(int apindex); + void portItemChanged(QString port); public: HbMainWindow *iMainWindow; @@ -78,7 +79,8 @@ SettingsDataFormCustomItem* customPrototype; int currentiapindex; QStringList apnameslist; - bool backbehaviorset; + bool backbehaviorset; + unsigned int iPort; }; #endif /* SERVERSETTINGSVIEW_H_ */ diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/inc/settingsdataformcustomitem.h --- a/deviceupdatesui/deviceupdates/inc/settingsdataformcustomitem.h Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/inc/settingsdataformcustomitem.h Thu Jul 22 16:30:53 2010 +0100 @@ -21,6 +21,7 @@ #include +class HbLineEdit; class SettingsDataFormCustomItem : public HbDataFormViewItem { Q_OBJECT @@ -34,6 +35,12 @@ protected: virtual HbWidget* createCustomWidget(); + +public slots: +virtual void restore(); + +private: +HbLineEdit* mLineEdit; }; #endif // SETTINGS_DATAFORM_CUSTOMITEM_H diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/rom/deviceupdates.iby --- a/deviceupdatesui/deviceupdates/rom/deviceupdates.iby Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/rom/deviceupdates.iby Thu Jul 22 16:30:53 2010 +0100 @@ -1,20 +1,3 @@ -/* -* 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 __DEVICEUPDATES_IBY__ #define __DEVICEUPDATES_IBY__ diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/rom/deviceupdates_resources.iby --- a/deviceupdatesui/deviceupdates/rom/deviceupdates_resources.iby Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/rom/deviceupdates_resources.iby Thu Jul 22 16:30:53 2010 +0100 @@ -1,19 +1,3 @@ -/* -* 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 __DEVICEUPDATES_RESORCES_IBY__ #define __DEVICEUPDATES_RESORCES_IBY__ // Backup registration diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/src/deviceupdatemoniter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/deviceupdates/src/deviceupdatemoniter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,125 @@ +/* + * 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: Fota server update and download functionality + * + */ + +#include "deviceupdatemoniter.h" +#include "DeviceUpdateDebug.h" + +// -------------------------------------------------------------------------- +// CDeviceUpdateMoniter::NewL +// -------------------------------------------------------------------------- +// +CDeviceUpdateMoniter* CDeviceUpdateMoniter::NewL (MDeviceMoniterObserver* aObserver) + { + FLOG(_L("CDeviceUpdateMoniter::NewL >>")); + CDeviceUpdateMoniter* h=new (ELeave)CDeviceUpdateMoniter; + h->iObserver = aObserver; + h->ConstructL(); + FLOG(_L("CDeviceUpdateMoniter::NewL <<")); + return h; + } + +void CDeviceUpdateMoniter::ConstructL() + { + FLOG(_L("CDeviceUpdateMoniter::ConstructL >>")); + TInt err = RProperty::Define(TUid::Uid(KOmaDMAppUid), KFotaServerActive, RProperty::EInt); + + if(err == KErrAlreadyExists) + { + TInt value; + RProperty::Get(TUid::Uid(KOmaDMAppUid), KFotaServerActive, value); + if(value) + iObserver->UpdateDMUI(EFalse); + } + err = iProperty.Attach(TUid::Uid(KOmaDMAppUid), KFotaServerActive); + if(err == KErrNone) + { + iProperty.Subscribe(iStatus); + if ( !IsActive() ) + { + SetActive(); + } + } + FLOG(_L("CDeviceUpdateMoniter::ConstructL <<")); + } + + +void CDeviceUpdateMoniter::StartMoniter() + { + FLOG(_L("CDeviceUpdateMoniter::StartMoniter() >>")); + iProperty.Subscribe(iStatus); + if ( !IsActive() ) + { + SetActive(); + } + FLOG(_L("CDeviceUpdateMoniter::StartMoniter <<")); + } + +// -------------------------------------------------------------------------- +CDeviceUpdateMoniter::CDeviceUpdateMoniter() + : CActive(EPriorityNormal) + { + FLOG(_L("CDeviceUpdateMoniter::CDeviceUpdateMoniter() >>")); + CActiveScheduler::Add( this ); + FLOG(_L("CDeviceUpdateMoniter::CDeviceUpdateMoniter <<")); + } + +// -------------------------------------------------------------------------- +CDeviceUpdateMoniter::~CDeviceUpdateMoniter() + { + FLOG(_L("CDeviceUpdateMoniter::~CDeviceUpdateMoniter >>")); + //iNotifier.Close(); FOTA_10.1 changes + //Cancel(); + FLOG(_L("CDeviceUpdateMoniter::~CDeviceUpdateMoniter <<")); + } + +// -------------------------------------------------------------------------- +void CDeviceUpdateMoniter::RunL() + { + FLOG(_L("CDeviceUpdateMoniter::RunL >>")); + TInt value; + TUid uid = {0x102072C4}; + + RProperty::Get(TUid::Uid(KOmaDMAppUid), KFotaServerActive, value); + if(value) + iObserver->UpdateDMUI(EFalse); + else + iObserver->UpdateDMUI(ETrue); + StartMoniter(); + FLOG(_L("CDeviceUpdateMoniter::RunL <<")); + } + +// -------------------------------------------------------------------------- +TInt CDeviceUpdateMoniter::RunError(TInt aError) + { + FLOG(_L("CDeviceUpdateMoniter::RunL %d"),aError); + return aError; + } + +TInt CDeviceUpdateMoniter::CancelRequest() + { + FLOG(_L("CDeviceUpdateMoniter::CancelRequest %d")); + + } + +// -------------------------------------------------------------------------- +void CDeviceUpdateMoniter::DoCancel() + { + FLOG(_L("CDeviceUpdateMoniter::DoCancel >>")); + iProperty.Cancel(); + FLOG(_L("CDeviceUpdateMoniter::DoCancel <<")); + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/src/dmadvancedview.cpp --- a/deviceupdatesui/deviceupdates/src/dmadvancedview.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/src/dmadvancedview.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -17,22 +17,30 @@ */ #include #include "dmadvancedview.h" +#include "dmfotaview.h" #include "serversettingsview.h" -DmAdvancedView::DmAdvancedView(HbMainWindow *mainWindow, HbView *mainView, QGraphicsItem *parent):HbView(parent), +DmAdvancedView::DmAdvancedView(HbMainWindow *mainWindow,DMFotaView *mainView, DmInfo *info, QGraphicsItem *parent):HbView(parent), bluetooth(":/icons/qgn_prop_sml_bt.svg"), internet(":/icons/qgn_prop_sml_http.svg"), defaultprofileicon(":/icons/qtg_large_avatar.svg") { + qDebug("omadm DeviceManagerUi::DmAdvancedView >>"); iMainWindow = mainWindow; serverSetView = NULL; iMainView = mainView; - dminfo = new DmInfo(this); + if(info==NULL) + { + dminfo = new DmInfo(this); + } + else + dminfo = info; currentdefaultprofile = -1; currentview = 0; connectionRequested = false; backbehaviorset = false; currentselecteditem = -1; + qDebug("omadm DeviceManagerUi::DmAdvancedView >>"); } DmAdvancedView::~DmAdvancedView() @@ -47,7 +55,8 @@ void DmAdvancedView::handleLongPress(HbAbstractViewItem* item , QPointF coOrdinates) { - if (connectionRequested) + qDebug("omadm DeviceManagerUi::handleLongPress >>"); + if(connectionRequested) return; if (item) { @@ -80,11 +89,13 @@ csmenu->setPreferredPos(coOrdinates); csmenu->open(); } + qDebug("omadm DeviceManagerUi::handleLongPress >>"); } void DmAdvancedView::handleClicked(QModelIndex index) { + qDebug("omadm DeviceManagerUi::handleClicked >>"); if(connectionRequested) return; //Stop listening DB events for profile addition @@ -117,10 +128,12 @@ iMainWindow->setCurrentView(serverSetView); } + qDebug("omadm DeviceManagerUi::handleClicked >>"); } bool DmAdvancedView::displayItems() { + qDebug("omadm DeviceManagerUi::displayItems >>"); docmlLoader = new HbDocumentLoader; bool ok ; docmlLoader->load( DOCML_FILE_NAME, &ok ); @@ -233,11 +246,13 @@ { qDebug("omadm docml section loading failed"); } + qDebug("omadm DeviceManagerUi::displayItems >>"); return ok; } void DmAdvancedView::updateEarlierdefaultProfileIcon() { + qDebug("omadm DeviceManagerUi::updateEarlierdefaultProfileIcon >>"); if(currentdefaultprofile >= 0) { QStandardItem *earlierDefaultProfile = model->item(currentdefaultprofile); @@ -253,10 +268,12 @@ earlierDefaultProfile->setIcon(bluetooth); } } + qDebug("omadm DeviceManagerUi::updateEarlierdefaultProfileIcon >>"); } void DmAdvancedView::createNewProfile() { + qDebug("omadm DeviceManagerUi::createNewProfile >>"); if(dminfo->createNewprofile()) { //Open server settings view @@ -286,18 +303,22 @@ { qDebug("OMADM New server profile creation failed"); } + qDebug("omadm DeviceManagerUi::createNewProfile >>"); } void DmAdvancedView::saveProfile(QStringList& itemdata, bool& sessmode, QString& currap,unsigned int& portnum, bool& nauth ) { + qDebug("omadm DeviceManagerUi::saveProfile >>"); dminfo->DisableDbNotifications(true); dminfo->saveProfile(itemdata,sessmode,currap,portnum,nauth); updateListview(); dminfo->DisableDbNotifications(false); + qDebug("omadm DeviceManagerUi::saveProfile >>"); } void DmAdvancedView::updateListview() { + qDebug("omadm DeviceManagerUi::updateListview >>"); model->clear(); int IndicatorCount =dminfo->profilescount(); for (int i = 0; IndicatorCount > 0 && i < IndicatorCount; ++i) { @@ -342,34 +363,41 @@ model->setItem(i, item); } model->sort(0); + qDebug("omadm DeviceManagerUi::updateListview >>"); } void DmAdvancedView::serversListGroupClicked(bool state) { + qDebug("omadm DeviceManagerUi::serversListGroupClicked >>"); Q_UNUSED(state); if(serversListGroup->isCollapsed()) otherDetailsGroup->setCollapsed(false); else otherDetailsGroup->setCollapsed(true); + qDebug("omadm DeviceManagerUi::serversListGroupClicked >>"); } void DmAdvancedView::otherDetailsGroupClicked(bool state) { + qDebug("omadm DeviceManagerUi::otherDetailsGroupClicked >>"); Q_UNUSED(state); if(otherDetailsGroup->isCollapsed()) serversListGroup->setCollapsed(false); else serversListGroup->setCollapsed(true); + qDebug("omadm DeviceManagerUi::otherDetailsGroupClicked >>"); } bool DmAdvancedView::checkServerId(QString& serverid) { + qDebug("omadm DeviceManagerUi::CheckforUpdate >>"); return dminfo->checksrvid(serverid); + qDebug("omadm DeviceManagerUi::CheckforUpdate >>"); } void DmAdvancedView::reLayout(Qt::Orientation orientation) - { - qDebug("OMADM servers view DmAdvancedView::reLayout"); + { + qDebug("OMADM servers view DmAdvancedView::reLayout <<"); if(orientation == Qt::Horizontal) { qDebug("OMADM servers view landscape"); @@ -381,12 +409,12 @@ bool ok; docmlLoader->load( DOCML_FILE_NAME, PORTRAIT, &ok ); } - - + qDebug("OMADM servers view DmAdvancedView::reLayout >>"); } void DmAdvancedView::setBackBehavior() { + qDebug("OMADM servers view DmAdvancedView::setBackBehavior <<"); if (!backbehaviorset) { qDebug("OMADM servers view back behavior setting"); @@ -396,11 +424,12 @@ setNavigationAction(backaction); backbehaviorset = true; } - qDebug("OMADM servers view back behavior setting done"); + qDebug("OMADM servers view back behavior setting done setBackBehavior >>"); } void DmAdvancedView::backButtonClicked() { + qDebug("OMADM servers view DmAdvancedView::backButtonClicked <<"); QList views = iMainWindow->views(); if(iMainWindow->orientation()==Qt::Vertical) { @@ -410,152 +439,402 @@ { iMainWindow->setCurrentView(views[1]); } + qDebug("OMADM servers view DmAdvancedView::backButtonClicked >>"); } - -void DmAdvancedView::mainCalltoUpdateView() -{ - int IndicatorCount =6; - otherdetailsmodel = new QStandardItemModel(IndicatorCount,0); - TInt i=0; - TRequestStatus status; +void DmAdvancedView::addVersionInfo() + { + qDebug("OMADM servers view DmAdvancedView::addVersionInfo <<"); QStringList liststr; QStandardItem* item; QString val; QString str; - - iServer.Connect(); - iServer.GetPhoneInfo(0, info); - imobPhone.Open(iServer, info.iName); - //Bands supported - - RMobilePhone::TMobilePhoneNetworkInfoV1 nwInfov1; - RMobilePhone::TMobilePhoneNetworkInfoV1Pckg nwInfov1Pckg(nwInfov1); - imobPhone.GetCurrentNetwork(status, nwInfov1Pckg); - User::WaitForRequest( status ); - status = KRequestPending; - nwInfov1 = nwInfov1Pckg(); - NetworkBand(nwInfov1.iBandInfo, str); - item = new QStandardItem(); - val = hbTrId("txt_device_update_dblist_gsm_bands"); - liststr << val; - liststr << str; - item->setData(liststr , Qt::DisplayRole); - otherdetailsmodel->setItem(i++, item); - - //Packet Service - - TInt packetsrvc =0; - RMobilePhone::TMobilePhoneNetworkInfoV5 nwInfov5; - RMobilePhone::TMobilePhoneNetworkInfoV5Pckg nwInfov5Pckg(nwInfov5); - imobPhone.GetCurrentNetwork( status, nwInfov5Pckg ); - User::WaitForRequest( status ); - status = KRequestPending; - nwInfov5 = nwInfov5Pckg(); - - if(nwInfov5.iHsdpaAvailableIndicator) packetsrvc =1; - - if(nwInfov5.iEgprsAvailableIndicator) packetsrvc =2; - - if(!packetsrvc) + TInt runtimesupport(0); + CRepository* cenrep = NULL; + TRAPD( error, cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) ); + if(error) + { + FLOG( "[OMADM] CNSmlDMFotaContainer::FormatListboxL() cenrep problem" ); + } + if ( cenrep ) + { + cenrep->Get( KNsmlDmRuntimeVerSupport, runtimesupport ); + delete cenrep; cenrep = NULL; + } + //Browser version + Swi::RSisRegistrySession sisses ; + TInt r( sisses.Connect() ); + CleanupClosePushL( sisses ); + if (r== KErrNone && runtimesupport) + { + Swi::RSisRegistryEntry sientry; + TInt oerr = sientry.Open(sisses, browseruid); + TVersion bversion; + TBuf <255> browserversion; + if(oerr == KErrNone) + { + TRAPD(err2,bversion= sientry.VersionL()); + if (err2 == KErrNone) + { + browserversion.AppendNum(bversion.iMajor); + browserversion.Append(_L(".")); + browserversion.AppendNum(bversion.iMinor); + if( browserversion.Length()>0 ) + { + str = QString::fromUtf16(browserversion.Ptr(), browserversion.Length()); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_browser_version"); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + //m_otherdetailsmodel->setItem(i++, item); + m_otherdetailsmodel->appendRow(item); + } + } + } + } + + //flash version + if (r== KErrNone&& runtimesupport) + { + Swi::RSisRegistryEntry sientry; + TInt oerr = sientry.Open(sisses, flashuid); + TVersion fversion; + TBuf <255> flashversion; + if(oerr == KErrNone) + { + TRAPD(err2,fversion= sientry.VersionL()); + if (err2 == KErrNone) + { + flashversion.AppendNum(fversion.iMajor); + flashversion.Append(_L(".")); + flashversion.AppendNum(fversion.iMinor); + if( flashversion.Length()>0 ) + { + str = QString::fromUtf16(flashversion.Ptr(), flashversion.Length()); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_flash_version"); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + //m_otherdetailsmodel->setItem(i++, item); + m_otherdetailsmodel->appendRow(item); + } + } + } + } + + if (r== KErrNone&& runtimesupport) + { + Swi::RSisRegistryEntry sientry; + TInt oerr = sientry.Open(sisses, javauid); + TVersion jversion; + TBuf <255> javaversion; + if(oerr == KErrNone) + { + TRAPD(err2,jversion= sientry.VersionL()); + if (err2 == KErrNone) + { + javaversion.AppendNum(jversion.iMajor); + javaversion.Append(_L(".")); + javaversion.AppendNum(jversion.iMinor); + if( javaversion.Length()>0 ) + { + str = QString::fromUtf16(javaversion.Ptr(), javaversion.Length()); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_java_version"); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + } + } + } + } + CleanupStack::PopAndDestroy(1); + qDebug("OMADM servers view DmAdvancedView::addVersionInfo >>"); + } + +void DmAdvancedView::addOtherDetails() { - RMobilePhone::TMobilePhoneNetworkInfoV8 nwInfov8; - RMobilePhone::TMobilePhoneNetworkInfoV8Pckg nwInfov8Pckg(nwInfov8); - imobPhone.GetCurrentNetwork( status, nwInfov8Pckg ); + qDebug("OMADM servers view DmAdvancedView::addOtherDetails >>"); + TRequestStatus status; + QStringList liststr; + QStandardItem* item; + QString val; + QString str; + TInt error(iServer.Connect()); + if ( error != KErrNone ) + return; + iServer.GetPhoneInfo(0, info); + error = imobPhone.Open(iServer, info.iName); + if ( error != KErrNone ) + { + iServer.Close(); + return; + } + //Bands supported + + RMobilePhone::TMobilePhoneNetworkInfoV1 nwInfov1; + RMobilePhone::TMobilePhoneNetworkInfoV1Pckg nwInfov1Pckg(nwInfov1); + imobPhone.GetCurrentNetwork(status, nwInfov1Pckg); + User::WaitForRequest( status ); + status = KRequestPending; + nwInfov1 = nwInfov1Pckg(); + NetworkBand(nwInfov1.iBandInfo, str); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_gsm_bands"); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + + //Packet Service + + TInt packetsrvc =0; + RMobilePhone::TMobilePhoneNetworkInfoV5 nwInfov5; + RMobilePhone::TMobilePhoneNetworkInfoV5Pckg nwInfov5Pckg(nwInfov5); + imobPhone.GetCurrentNetwork( status, nwInfov5Pckg ); User::WaitForRequest( status ); status = KRequestPending; - nwInfov8 = nwInfov8Pckg(); - if(nwInfov8.iHsupaAvailableIndicator) packetsrvc =3; - } - liststr.clear(); - val = hbTrId("txt_device_update_dblist_wcdma_uldl_data_rates"); - liststr << val; - item = new QStandardItem(); - PacketService(packetsrvc, str); - liststr << str; - item->setData(liststr , Qt::DisplayRole); - otherdetailsmodel->setItem(i++, item); - - // Ciphering - - liststr.clear(); - item = new QStandardItem(); - val = hbTrId("txt_device_update_dblist_gsm_cipherings"); - liststr << val; - imobPhone.GetNetworkSecurityLevel(status,idispSecurity); - User::WaitForRequest( status ); - NetworkCiphering(idispSecurity, str); - liststr << str; - item->setData(liststr, Qt::DisplayRole); - otherdetailsmodel->setItem(i++, item); - - // WLAN MAC - - TUint KPhoneWlanSeparator (':'); - _LIT( KWLanMACDataFormat, "%02x"); - // Fetch WLAN MAC address - TBuf address; - RProperty::Get( KPSUidWlan, KPSWlanMacAddress, address ); - // Format fetched address - TBuf wlanMACAddress; - for ( TInt i( 0 ); i < address.Length(); i++ ) + nwInfov5 = nwInfov5Pckg(); + + if(nwInfov5.iHsdpaAvailableIndicator) packetsrvc =1; + + if(nwInfov5.iEgprsAvailableIndicator) packetsrvc =2; + + if(!packetsrvc) { - // Set separator - if( i > 0 ) + RMobilePhone::TMobilePhoneNetworkInfoV8 nwInfov8; + RMobilePhone::TMobilePhoneNetworkInfoV8Pckg nwInfov8Pckg(nwInfov8); + imobPhone.GetCurrentNetwork( status, nwInfov8Pckg ); + User::WaitForRequest( status ); + status = KRequestPending; + nwInfov8 = nwInfov8Pckg(); + if(nwInfov8.iHsupaAvailableIndicator) packetsrvc =3; + } + liststr.clear(); + val = hbTrId("txt_device_update_dblist_wcdma_uldl_data_rates"); + liststr << val; + item = new QStandardItem(); + PacketService(packetsrvc, str); + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + + // Ciphering + + liststr.clear(); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_gsm_cipherings"); + liststr << val; + imobPhone.GetNetworkSecurityLevel(status,idispSecurity); + User::WaitForRequest( status ); + NetworkCiphering(idispSecurity, str); + liststr << str; + item->setData(liststr, Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + + // WLAN MAC + + TUint KPhoneWlanSeparator (':'); + _LIT( KWLanMACDataFormat, "%02x"); + // Fetch WLAN MAC address + TBuf address; + RProperty::Get( KPSUidWlan, KPSWlanMacAddress, address ); + // Format fetched address + TBuf wlanMACAddress; + for ( TInt i( 0 ); i < address.Length(); i++ ) { - wlanMACAddress.Append( KPhoneWlanSeparator ); + // Set separator + if( i > 0 ) + { + wlanMACAddress.Append( KPhoneWlanSeparator ); + } + // Set data + TBuf<50> tmp; + tmp.Format( KWLanMACDataFormat, address[i] ); + wlanMACAddress.Append( tmp ); + } + liststr.clear(); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_wlan_mac_address"); + liststr << val; + str = QString::fromUtf16(wlanMACAddress.Ptr(), wlanMACAddress.Length()); + liststr << str; + item->setData(liststr, Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + + // BT MAC + + TBuf addressBuffer; + // Fetch from Cenrep + CRepository* repository = NULL; + TRAPD( err, repository = CRepository::NewL( KCRUidBluetoothLocalDeviceAddress ) ); + if ( err == KErrNone ) + { + qDebug("KCRUidBluetoothLocalDeviceAddress errnone"); + err = repository->Get( KBTLocalDeviceAddress, addressBuffer ); + + if (err == KErrNone) + qDebug("KBTLocalDeviceAddress errnone"); + else + qDebug("KBTLocalDeviceAddress Error"); + + delete repository; + } + else + { + qDebug("KCRUidBluetoothLocalDeviceAddress Error openin cenrep"); } - // Set data - TBuf<50> tmp; - tmp.Format( KWLanMACDataFormat, address[i] ); - wlanMACAddress.Append( tmp ); - } - liststr.clear(); - item = new QStandardItem(); - val = hbTrId("txt_device_update_dblist_wlan_mac_address"); - liststr << val; - str = QString::fromUtf16(wlanMACAddress.Ptr(), wlanMACAddress.Length()); - liststr << str; - item->setData(liststr, Qt::DisplayRole); - otherdetailsmodel->setItem(i++, item); - - // BT MAC - - TBuf addressBuffer; - // Fetch from Cenrep - CRepository* repository = NULL; - TRAPD( err, repository = CRepository::NewL( KCRUidBluetoothLocalDeviceAddress ) ); - if ( err == KErrNone ) + liststr.clear(); + val = hbTrId("txt_device_update_dblist_bt_mac_address"); + liststr << val; + item = new QStandardItem(); + str = QString::fromUtf16(addressBuffer.Ptr(), addressBuffer.Length()); + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + + imobPhone.Close(); + iServer.Close(); + + } +void DmAdvancedView::mainCalltoUpdateView() +{ + qDebug("OMADM servers view DmAdvancedView::mainCalltoUpdateView >>"); + m_otherdetailsmodel = new QStandardItemModel(); + TInt i=0; + + QStringList liststr; + QStandardItem* item; + QString val; + QString str; + //1. Device Updated + + + addVersionInfo(); + + addOtherDetails(); + + //sw version date + TBuf< KSysUtilVersionTextLength > swversiondate; + TBuf< KSysUtilVersionTextLength > version; + version.Zero(); + swversiondate.Zero(); + if( SysUtil::GetSWVersion(version)==KErrNone) { - qDebug("KCRUidBluetoothLocalDeviceAddress errnone"); - err = repository->Get( KBTLocalDeviceAddress, addressBuffer ); - - if (err == KErrNone) - qDebug("KBTLocalDeviceAddress errnone"); - else - qDebug("KBTLocalDeviceAddress Error"); - - delete repository; + TInt len= version.Length(); + TInt pos1 = version.Find(KSmlEOL); + if( pos1 != KErrNotFound && len > pos1 ) + { + TBuf version1; + version1.Zero(); + version1.Append( version.Right( len-pos1-1 )); + len= version1.Length(); + pos1 = version1.Find(KSmlEOL); + if( pos1 != KErrNotFound && len > pos1 ) + { + swversiondate.Append(version1.Left( pos1 )); + } + } + val = hbTrId("txt_device_update_dblist_sw_version_date"); + item = new QStandardItem(); + str = QString::fromUtf16(swversiondate.Ptr(), swversiondate.Length()); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + } + + //Custom version and date + //SysVersionInfo::TVersionInfoType x = SysVersionInfo::EOPVersion; + TBuf< KNSmlMaxTextLength64 > customsw; + TBuf< KNSmlMaxTextLength64 > customswdate; + version.Zero(); + if( SysVersionInfo::GetVersionInfo(SysVersionInfo::EOPVersion,version) == KErrNone ) + { + TInt len= version.Length(); + TInt pos1 = version.Find(KSmlEOL); + if( pos1 != KErrNotFound && len > pos1 ) + { + customsw.Append( version.Left(pos1)); + customswdate.Append( version.Right( len-pos1-1 )); + } + } + + if(customsw.Length()>0) + { + str = QString::fromUtf16(customsw.Ptr(), customsw.Length()); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_custom_version"); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); } - else - { - qDebug("KCRUidBluetoothLocalDeviceAddress Error openin cenrep"); - } - liststr.clear(); - val = hbTrId("txt_device_update_dblist_bt_mac_address"); - liststr << val; - item = new QStandardItem(); - str = QString::fromUtf16(addressBuffer.Ptr(), addressBuffer.Length()); - liststr << str; - item->setData(liststr , Qt::DisplayRole); - otherdetailsmodel->setItem(i++, item); + if(customswdate.Length()>0) + { + str = QString::fromUtf16(customswdate.Ptr(), customswdate.Length()); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_custom_version_date"); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + } - otherdetailslist->setModel(otherdetailsmodel); + TBuf Langversion; + TBuf lversion; + if( SysUtil::GetLangVersion(Langversion ) == KErrNone ) + { + str = QString::fromUtf16(Langversion.Ptr(), Langversion.Length()); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_language_set"); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + } + + + //lang variant version + Langversion.Zero(); + if( SysUtil::GetLangSWVersion(Langversion ) == KErrNone ) + { + int len = Langversion.Length(); + TInt pos1 = Langversion.Find( KSmlEOL ); + if( pos1 != KErrNotFound && len > pos1 ) + { + lversion.Zero(); + lversion.Append( Langversion.Left( pos1 ) ); + } + str = QString::fromUtf16(lversion.Ptr(), lversion.Length()); + item = new QStandardItem(); + val = hbTrId("txt_device_update_dblist_language_variant_version"); + liststr.clear(); + liststr << val; + liststr << str; + item->setData(liststr , Qt::DisplayRole); + m_otherdetailsmodel->appendRow(item); + } + + otherdetailslist->setModel(m_otherdetailsmodel); + qDebug("OMADM servers view DmAdvancedView::mainCalltoUpdateView <<"); } void DmAdvancedView::PacketService(TInt val, QString& string) { + qDebug("OMADM servers view DmAdvancedView::PacketService >>"); switch (val) { case (0): @@ -578,11 +857,13 @@ string = hbTrId("txt_device_update_dblist_wcdma_uldl_data_val_l5"); break; } + qDebug("OMADM servers view DmAdvancedView::PacketService <<"); } void DmAdvancedView::NetworkCiphering(RMobilePhone::TMobilePhoneNetworkSecurity val, QString& string) { + qDebug("OMADM servers view DmAdvancedView::NetworkCiphering >>"); switch (val) { case (RMobilePhone::ECipheringGSM): @@ -599,10 +880,12 @@ string = hbTrId("txt_device_update_dblist_gsm_cipherings_val_l1"); break; } + qDebug("OMADM servers view DmAdvancedView::NetworkCiphering <<"); } void DmAdvancedView::NetworkBand(RMobilePhone::TMobilePhoneNetworkBandInfo val, QString& string) { + qDebug("OMADM servers view DmAdvancedView::NetworkBand >>"); switch (val) { case (RMobilePhone::E800BandA): @@ -637,25 +920,32 @@ string = hbTrId("txt_device_update_dblist_gsm_bands_val_l1"); break; } + qDebug("OMADM servers view DmAdvancedView::NetworkBand <<"); } void DmAdvancedView::syncCompleted(int jobstatus) { + qDebug("OMADM servers view DmAdvancedView::syncCompleted >>"); Q_UNUSED(jobstatus); connectionRequested = false; updateListview(); + iMainView->enableButtons(); + qDebug("OMADM servers view DmAdvancedView::syncCompleted <<"); } void DmAdvancedView::defaultMenuItemSelected() { + qDebug("OMADM servers view DmAdvancedView::defaultMenuItemSelected >>"); dminfo->setDefaultProfile(currentselecteditem); updateEarlierdefaultProfileIcon(); modelItem->setIcon(defaultprofileicon); currentdefaultprofile = currentselecteditem; + qDebug("OMADM servers view DmAdvancedView::defaultMenuItemSelected <<"); } void DmAdvancedView::deleteMenuItemSelected() { + qDebug("OMADM servers view DmAdvancedView::deleteMenuItemSelected >>"); dminfo->DisableDbNotifications(true); //check currentdefaultprofile is current item if(currentselecteditem == currentdefaultprofile) // deleting default profile @@ -666,11 +956,16 @@ model->removeRow(currentselecteditem); } dminfo->DisableDbNotifications(false); + qDebug("OMADM servers view DmAdvancedView::deleteMenuItemSelected <<"); } void DmAdvancedView::connectMenuItemSelected() { - dminfo->synchronize(currentselecteditem); + qDebug("OMADM servers view DmAdvancedView::connectMenuItemSelected >>"); + iMainView->displayNoteAndDisableButtons(); + backButtonClicked(); + dminfo->synchronize(currentselecteditem); connectionRequested = true; + qDebug("OMADM servers view DmAdvancedView::connectMenuItemSelected <<"); } diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/src/dmfotaview.cpp --- a/deviceupdatesui/deviceupdates/src/dmfotaview.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/src/dmfotaview.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -30,6 +30,9 @@ #include "nsmldmsyncprivatecrkeys.h" #include "dmadvancedview.h" #include "dmfotaview.h" +#include +#include "deviceupdatemoniter.h" +#include "DeviceUpdateDebug.h" // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -37,10 +40,13 @@ // ----------------------------------------------------------------------------- // DMFotaView::DMFotaView(HbMainWindow *mainWindow): - mMainWindow(mainWindow),profilesView(NULL) + mMainWindow(mainWindow),profilesView(NULL),Connected(EFalse) { + qDebug("DMFotaView::DMFotaView >>"); fotaPortraitView=0; fotaLandscapeView=0; + mainDmInfo=0; + qDebug("DMFotaView::DMFotaView <<"); } // ----------------------------------------------------------------------------- @@ -49,7 +55,20 @@ // ----------------------------------------------------------------------------- // DMFotaView::~DMFotaView() -{ +{ + qDebug("DMFotaView::~DMFotaView >>"); + if(mainDmInfo) + delete mainDmInfo; + + if (iFotaEngine.Handle()) + iFotaEngine.Close(); + + if (iMoniter) + { + iMoniter->Cancel(); + delete iMoniter; + } + qDebug("DMFotaView::~DMFotaView <<"); } // ----------------------------------------------------------------------------- @@ -59,6 +78,7 @@ // bool DMFotaView::addFotaView() { + qDebug("DMFotaView::addFotaView >>"); connect( mMainWindow, SIGNAL( orientationChanged(Qt::Orientation) ), this, SLOT( readSection(Qt::Orientation) ) ); bool ok = false; @@ -107,12 +127,7 @@ label->setPlainText(val); label2->setPlainText(val); - //Setting help text for update button - label = qobject_cast (loader.findWidget("p:updatelabel")); - label2 = qobject_cast (loader2.findWidget("l:updatelabel")); - val = hbTrId("txt_device_update_setlabel_to_update_your_device_s"); - label->setPlainText(val); - label2->setPlainText(val); + HbScrollArea* area = qobject_cast (loader.findWidget("scrollArea")); area->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOn); @@ -173,6 +188,20 @@ } //Model + TBuf<100> phoneName; + TInt error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EModelVersion, phoneName); + if (error==KErrNone) + { + + //phoneName.Copy( telid.iModel ); + //imei.Copy(telid.iSerialNumber); + if( phoneName.Length()>0 ) + { + val = hbTrId("txt_device_update_dblist_model"); + str = QString::fromUtf16(phoneName.Ptr(), phoneName.Length()); + FormatList(val,str); + } + } RTelServer telServer; User::LeaveIfError( telServer.Connect() ); RTelServer::TPhoneInfo teleinfo; @@ -190,14 +219,7 @@ if (status==KErrNone) { TBuf<100> phoneName; - phoneName.Copy( telid.iModel ); imei.Copy(telid.iSerialNumber); - if( phoneName.Length()>0 ) - { - val = hbTrId("txt_device_update_dblist_model"); - str = QString::fromUtf16(phoneName.Ptr(), phoneName.Length()); - FormatList(val,str); - } } phone.Close(); telServer.Close(); @@ -227,7 +249,7 @@ { */ TBuf productcode; productcode.Zero(); - TInt error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EProductCode, productcode); + error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EProductCode, productcode); if(error ==KErrNone ) { if( productcode.Length()>0 ) @@ -246,24 +268,83 @@ FormatList(val,str); } + + iFotaState = FotaEngineL().GetState(-1); - val = hbTrId("txt_device_update_button_update"); - HbPushButton *updateButton = qobject_cast(loader.findWidget("p:update")); - updateButton->setText(val); - QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(CheckforUpdate())); - updateButton = qobject_cast(loader2.findWidget("l:update")); - updateButton->setText(val); - QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(CheckforUpdate())); + TBuf8<80> Name; + TBuf8<80> Version; + TInt Size; + + if(iFotaState == RFotaEngineSession::EDownloadComplete || iFotaState == RFotaEngineSession::EStartingUpdate + || iFotaState == RFotaEngineSession::EStartingDownload || iFotaState == RFotaEngineSession::EDownloadProgressing) + { + label = qobject_cast (loader.findWidget("p:updatelabel")); + label2 = qobject_cast (loader2.findWidget("l:updatelabel")); + FotaEngineL().GetCurrentFirmwareDetailsL(Name, Version, Size); + + const QString + name = + QString::fromUtf8( + reinterpret_cast (Name.Ptr()), + Name.Length()); + const QString + ver = + QString::fromUtf8( + reinterpret_cast (Version.Ptr()), + Version.Length()); + + TInt sizeKB = Size / 1024; + if(sizeKB < 1024) + { + val = hbTrId("txt_device_update_setlabel_the_last_update_1_2_kb").arg(name) + .arg(ver).arg(sizeKB); + } + else + { + TInt sizeMB = sizeKB / 1024; + val = hbTrId("txt_device_update_setlabel_the_last_update_1_2_mb").arg(name) + .arg(ver).arg(sizeMB); + } + label->setPlainText(val); + label2->setPlainText(val); + + val = hbTrId("txt_device_update_button_resume_update"); + + updateButton = qobject_cast(loader.findWidget("p:update")); + updateButton->setText(val); + QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(ResumeUpdate())); + updateButtonLandscape = qobject_cast(loader2.findWidget("l:update")); + updateButtonLandscape->setText(val); + QObject::connect(updateButtonLandscape, SIGNAL(clicked()), this, SLOT(ResumeUpdate())); + Connected = ETrue; + } + else + { + //Setting help text for update button + label = qobject_cast (loader.findWidget("p:updatelabel")); + label2 = qobject_cast (loader2.findWidget("l:updatelabel")); + val = hbTrId("txt_device_update_setlabel_to_update_your_device_s"); + label->setPlainText(val); + label2->setPlainText(val); + + val = hbTrId("txt_device_update_button_update"); + updateButton = qobject_cast(loader.findWidget("p:update")); + updateButton->setText(val); + QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(CheckforUpdate())); + updateButtonLandscape = qobject_cast(loader2.findWidget("l:update")); + updateButtonLandscape->setText(val); + QObject::connect(updateButtonLandscape, SIGNAL(clicked()), this, SLOT(CheckforUpdate())); + Connected = ETrue; + } val = hbTrId("txt_device_update_button_advanced"); - HbPushButton *advancedButton = qobject_cast(loader.findWidget("p:advanced")); + advancedButton = qobject_cast(loader.findWidget("p:advanced")); advancedButton->setText(val); QObject::connect(advancedButton, SIGNAL(clicked()), this, SLOT(AdvancedDeviceManager())); - advancedButton = qobject_cast(loader2.findWidget("l:advanced")); - advancedButton->setText(val); - QObject::connect(advancedButton, SIGNAL(clicked()), this, SLOT(AdvancedDeviceManager())); - - + advancedButtonLandscape = qobject_cast(loader2.findWidget("l:advanced")); + advancedButtonLandscape->setText(val); + QObject::connect(advancedButtonLandscape, SIGNAL(clicked()), this, SLOT(AdvancedDeviceManager())); + fotaSupportEnabled(); mMainWindow->addView(fotaPortraitView); mMainWindow->addView(fotaLandscapeView); @@ -271,6 +352,10 @@ mMainWindow->setCurrentView(fotaPortraitView); else mMainWindow->setCurrentView(fotaLandscapeView); + + iMoniter = CDeviceUpdateMoniter::NewL(this); + //iMoniter->StartMoniter(); + qDebug("DMFotaView::addFotaView <<"); return ETrue; } @@ -281,21 +366,23 @@ // void DMFotaView::CheckforUpdate() { - /*TInt profileId=NULL; + qDebug("omadm DeviceManagerUi::CheckforUpdate >>"); + + TInt profileId=NULL; if(mainDmInfo==0) { if(!profilesView) { - mainDmInfo = new DmInfo(); - mainDmInfo->refreshProfileList(); + bool launchview = false; + AdvancedDeviceManager(launchview); + /* mainDmInfo = new DmInfo(); + mainDmInfo->refreshProfileList();*/ } - else - { - mainDmInfo = profilesView->dminfo; - } + // else + mainDmInfo = profilesView->dminfo; } if((profileId = mainDmInfo->DefaultFotaProfileIdL())==KErrNotFound) - {*/ + { HbNotificationDialog* note = new HbNotificationDialog(); QString val = hbTrId("txt_device_update_info_no_server_configured_to_get"); @@ -305,26 +392,94 @@ note->setTimeout(HbPopup::StandardTimeout); note->setAttribute(Qt::WA_DeleteOnClose, true); note->open(); - /* } + } else { mainDmInfo->sync(profileId); - }*/ + //Connecting note to be displayed + //Buttons to be disabled + displayNoteAndDisableButtons(); + + } + qDebug("omadm DeviceManagerUi::CheckforUpdate >>"); } + +void DMFotaView::ResumeUpdate() + { + qDebug("omadm DeviceManagerUi::ResumeUpdate >>"); + + + if(iFotaState == RFotaEngineSession::EDownloadComplete || iFotaState == RFotaEngineSession::EStartingUpdate) + { + qDebug("Calling resuming of update"); + FotaEngineL().Update(-1,(TSmlProfileId)1, _L8(""), _L8("")); + } + else if(iFotaState == RFotaEngineSession::EStartingDownload || iFotaState == RFotaEngineSession::EDownloadProgressing) + { + qDebug("Calling resuming of download"); + FotaEngineL().TryResumeDownload(EFalse); + } + + qDebug("omadm DeviceManagerUi::ResumeUpdate <<"); + } + +// ----------------------------------------------------------------------------- +// DMFotaView::displayNoteAndDisableButtons +// Displays the connecting note and disable all buttons +// ----------------------------------------------------------------------------- +// +void DMFotaView::displayNoteAndDisableButtons() + { + qDebug("DMFotaView::displayNoteAndDisableButtons >>"); + updateButton->setEnabled(false); + advancedButton->setEnabled(false); + updateButtonLandscape->setEnabled(false); + advancedButtonLandscape->setEnabled(false); + HbNotificationDialog* note = new HbNotificationDialog(); + //QString val = hbTrId("txt_device_update_dpophead_device_update"); + note->setTitle(hbTrId("txt_device_update_dpophead_device_update")); + note->setTitleTextWrapping(Hb::TextWordWrap); + note->setText(hbTrId("txt_device_update_info_connecting")); + HbIcon icon1; + icon1.setIconName(":/icons/qgn_prop_sml_http.svg"); + note->setIcon(icon1); + note->setAttribute(Qt::WA_DeleteOnClose, true); + note->open(); + qDebug("DMFotaView::displayNoteAndDisableButtons <<"); + } + +// ----------------------------------------------------------------------------- +// DMFotaView::enableButtons +// Enables checkupdate and Advancedsetting buttons +// ----------------------------------------------------------------------------- +// +void DMFotaView::enableButtons() + { + qDebug("DMFotaView::enableButtons >>"); + TInt value (0); + RProperty::Get(TUid::Uid(KOmaDMAppUid), KFotaServerActive, value); + if (!value) + { + fotaSupportEnabled(); + advancedButtonLandscape->setEnabled(true); + advancedButton->setEnabled(true); + } + qDebug("DMFotaView::enableButtons <<"); + } + // ----------------------------------------------------------------------------- // DMFotaView::AdvancedDeviceManager // Displays the Profiles view // ----------------------------------------------------------------------------- // -void DMFotaView::AdvancedDeviceManager() - { - +void DMFotaView::AdvancedDeviceManager(bool launchadvanceview) + { qDebug("omadm DeviceManagerUi::AdvancedDeviceManager"); if(!profilesView) { qDebug("omadm DeviceManagerUi::AdvancedDeviceManager 1"); - profilesView = new DmAdvancedView(mMainWindow,this); + profilesView = new DmAdvancedView(mMainWindow,this,mainDmInfo); qDebug("omadm DeviceManagerUi::AdvancedDeviceManager 2"); bool loadingok = profilesView->displayItems(); if(loadingok) @@ -334,6 +489,7 @@ qDebug("omadm DeviceManagerUi::AdvancedDeviceManager 4"); profilesView->setBackBehavior(); qDebug("omadm DeviceManagerUi::AdvancedDeviceManager 5"); + if(launchadvanceview) mMainWindow->setCurrentView(profilesView); qDebug("omadm DeviceManagerUi::AdvancedDeviceManager 6"); } @@ -348,6 +504,7 @@ profilesView->setBackBehavior(); mMainWindow->setCurrentView(profilesView); } + qDebug("DMFotaView::AdvancedDeviceManager <<"); } // ----------------------------------------------------------------------------- @@ -357,6 +514,7 @@ // void DMFotaView::FormatList(QString val,QString str) { + qDebug("DMFotaView::FormatList >>"); label = qobject_cast (loader.findWidget(list1[i])); label2 = qobject_cast (loader2.findWidget(list2[i++])); label3 = qobject_cast (loader.findWidget(list1[i])); @@ -369,6 +527,17 @@ label2->setVisible(ETrue); label3->setVisible(ETrue); label4->setVisible(ETrue); + qDebug("DMFotaView::FormatList <<"); + } + + +inline RFotaEngineSession & DMFotaView::FotaEngineL() + { + qDebug("DMFotaView::FotaEngineL >>"); + if (!iFotaEngine.Handle()) + iFotaEngine.OpenL(); + qDebug("DMFotaView::FotaEngineL <<"); + return iFotaEngine; } // ----------------------------------------------------------------------------- // DMFotaView::backtoMainWindow @@ -377,7 +546,9 @@ // void DMFotaView::backtoMainWindow() { + qDebug("DMFotaView::backtoMainWindow >>"); qApp->quit(); + qDebug("DMFotaView::backtoMainWindow <<"); } // ----------------------------------------------------------------------------- @@ -395,11 +566,14 @@ // void DMFotaView::OnExit() { + qDebug("DMFotaView::OnExit >>"); qApp->quit(); + qDebug("DMFotaView::OnExit <<"); } void DMFotaView::readSection( Qt::Orientation orientation ) { + qDebug("DMFotaView::readSection >>"); if(mMainWindow->currentView() == fotaPortraitView || mMainWindow->currentView() == fotaLandscapeView) { if( orientation == Qt::Vertical ) { @@ -415,8 +589,122 @@ { profilesView->reLayout(orientation); } + qDebug("DMFotaView::readSection <<"); } +void DMFotaView::UpdateDMUI(TBool aVal) + { + qDebug("DMFotaView::UpdateDMUI >>"); + qDebug("DMFotaView::UpdateDMUI >>"); + QString val; + if (aVal == 1) + { + qDebug("DMFotaView::aVal == 1 >>"); + if(Connected) + { + qDebug("DMFotaView::Connected >>"); + QObject::disconnect(updateButton,0,0,0); + QObject::disconnect(updateButtonLandscape,0,0,0); + Connected = EFalse; + } + + iFotaState = FotaEngineL().GetState(-1); + if (iFotaState == RFotaEngineSession::EDownloadComplete || iFotaState + == RFotaEngineSession::EStartingUpdate || iFotaState + == RFotaEngineSession::EStartingDownload || iFotaState + == RFotaEngineSession::EDownloadProgressing) + { + qDebug("CDeviceUpdateMoniter::Resume >>"); + QString value = hbTrId("txt_device_update_button_resume_update"); + //updateButton = qobject_cast(loader.findWidget("p:update"); + updateButton->setText(value); + QObject::connect(updateButton, SIGNAL(clicked()), this,SLOT(ResumeUpdate())); + //updateButtonLandscape = qobject_cast(loader2.findWidget("l:update"); + updateButtonLandscape->setText(value); + QObject::connect(updateButtonLandscape, SIGNAL(clicked()), this, SLOT(ResumeUpdate())); + Connected = ETrue; + + TBuf8<80> Name; + TBuf8<80> Version; + TInt Size; + + FotaEngineL().GetCurrentFirmwareDetailsL(Name, Version, Size); + + const QString + name = + QString::fromUtf8( + reinterpret_cast (Name.Ptr()), + Name.Length()); + const QString + ver = + QString::fromUtf8( + reinterpret_cast (Version.Ptr()), + Version.Length()); + + TInt sizeKB = Size / 1024; + if(sizeKB < 1024) + { + val = hbTrId("txt_device_update_setlabel_the_last_update_1_2_kb").arg(name) + .arg(ver).arg(sizeKB); + } + else + { + TInt sizeMB = sizeKB / 1024; + val = hbTrId("txt_device_update_setlabel_the_last_update_1_2_mb").arg(name) + .arg(ver).arg(sizeMB); + } + + label->setPlainText(val); + label2->setPlainText(val); + } + else + { + qDebug("DMFotaView::Update >>"); + val = hbTrId("txt_device_update_setlabel_to_update_your_device_s"); + label->setPlainText(val); + label2->setPlainText(val); + val = hbTrId("txt_device_update_button_update"); + updateButton = qobject_cast(loader.findWidget("p:update")); + updateButton->setText(val); + QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(CheckforUpdate())); + updateButtonLandscape = qobject_cast(loader2.findWidget("l:update")); + updateButtonLandscape->setText(val); + QObject::connect(updateButtonLandscape, SIGNAL(clicked()), this, SLOT(CheckforUpdate())); + Connected = ETrue; + } + } + fotaSupportEnabled(); + if(fotaValue == 1 && aVal == 0) + { + updateButton->setEnabled(aVal); + updateButtonLandscape->setEnabled(aVal); + } + advancedButton->setEnabled(aVal); + advancedButtonLandscape->setEnabled(aVal); + qDebug("DMFotaView::UpdateDMUI <<"); + qDebug("DMFotaView::UpdateDMUI <<"); +} + +void DMFotaView::fotaSupportEnabled() + { + fotaValue = 1; + CRepository* centrep( NULL); + TUid uidValue = {0x101F9A08}; // KCRFotaAdapterEnabled + TInt err = KErrNone; + TRAP(err,centrep = CRepository::NewL( uidValue)); + if(centrep && err == KErrNone ) + { + centrep->Get( 1 , fotaValue ); // KCRFotaAdapterEnabled + delete centrep; + } + if(fotaValue == 0 || fotaValue == 1) + { + updateButton->setEnabled(fotaValue); + updateButtonLandscape->setEnabled(fotaValue); + } + } + + diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/src/dminforetrieval.cpp --- a/deviceupdatesui/deviceupdates/src/dminforetrieval.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/src/dminforetrieval.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -483,6 +483,15 @@ if(error == KErrNone) {} } +void DmInfo::sync(int aProfileId) + { + int itemNum = findProfile(aProfileId); + if(itemNum!=KErrNotFound) + { + synchronize(itemNum); + } + } + void DmInfo::synccomplete(int jobstatus) { if (jobstatus == ENSmlSyncComplete) @@ -491,7 +500,10 @@ //Update profile list refreshProfileList(); } - serversView->syncCompleted(jobstatus); + if(serversView!=NULL) + { + serversView->syncCompleted(jobstatus); + } iDbEventsBlocked = EFalse; } @@ -543,3 +555,14 @@ FLOG( "[OMADM] DmInfo::DisableDbNotifications() completed" ); } +TInt DmInfo::findProfile(TInt aProfileId) + { + for(TInt i=0;iCount();i++) + { + if(iProfileList->At(i).iProfileId == aProfileId) + { + return i; + } + } + return KErrNotFound; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/src/main.cpp --- a/deviceupdatesui/deviceupdates/src/main.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/src/main.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -23,53 +23,43 @@ int main(int argc, char *argv[]) { + HbApplication app(argc, argv); + //HbView* newview= new HbView(); - HbApplication app(argc, argv); - //HbView* newview= new HbView(); - - QTranslator *translator = new QTranslator(); + QTranslator *translator = new QTranslator(); QString lang = QLocale::system().name(); qDebug("OMADM Loading qm file"); qDebug()<load("deviceupdates_" + lang, path);/*finally required once localisation available*/ - bool fine = translator->load("deviceupdates_en.qm", path); - if(fine) - qApp->installTranslator(translator); - else - qDebug("omadm translator loading failed"); - QTranslator *commontranslator = new QTranslator(); + bool fine = translator->load("deviceupdates_" + lang, path);/*finally required once localisation available*/ + //bool fine = translator->load("deviceupdates_en.qm", path); + if(fine) + qApp->installTranslator(translator); + else + qDebug("omadm translator loading failed"); - fine = commontranslator->load("common_" + lang + ".qm", path);/*finally required once localisation available*/ - //fine = commontranslator->load("common_en" , path); - if(fine) - qApp->installTranslator(translator); - else - qDebug("omadm common translator loading failed"); + QTranslator *commontranslator = new QTranslator(); - app.setApplicationName(hbTrId("txt_device_update_subhead_device_updates")); - - CRepository *cenrep = CRepository::NewL(KUidSmlSyncApp); - TInt val(0); - if(cenrep) - { - cenrep->Get(KNsmlDmUILaunch, val); - { - if(val==1) - { - QTranslator *tempTranslator = new QTranslator(); - QString lang = QLocale::system().name(); - tempTranslator->load("control_panel_" + lang, path); - qApp->installTranslator(tempTranslator); - app.setApplicationName(hbTrId("txt_applib_list_control_panel")); - val=0; - cenrep->Set(KNsmlDmUILaunch, val); - delete cenrep; - cenrep = NULL; - } - } - } + fine = commontranslator->load("common_" + lang + ".qm", path);/*finally required once localisation available*/ + //fine = commontranslator->load("common_en" , path); + if(fine) + qApp->installTranslator(translator); + else + qDebug("omadm common translator loading failed"); + + if( argc == 2) // Launch via Control Panel + { + QTranslator *cptranslator = new QTranslator(); + cptranslator->load("control_panel_" + lang, path); + qApp->installTranslator(cptranslator); + app.setApplicationName(hbTrId("txt_applib_list_control_panel")); + } + else + { + app.setApplicationName(hbTrId("txt_device_update_subhead_device_updates")); + } + HbMainWindow window; DMFotaView* view = new DMFotaView(&window); diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/src/nsmldmsynchandler.cpp --- a/deviceupdatesui/deviceupdates/src/nsmldmsynchandler.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/src/nsmldmsynchandler.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -29,6 +29,7 @@ #include "nsmldmsynchandler.h" #include "nsmldmsyncdebug.h" #include "nsmldmsyncinternalpskeys.h" +#include "nsmldmsyncprivatecrkeys.h" // ----------------------------------------------------------------------------- // CNSmlDMSyncHandler::NewL @@ -64,6 +65,12 @@ TRAP_IGNORE( iSyncJob.StopL() ); iSyncJob.Close(); } + if(iPrimaryAction) + iPrimaryAction->deleteLater(); + + if(iDialog) + iDialog->deleteLater(); + FeatureManager::UnInitializeLib(); FLOG( "CNSmlDMSyncHandler::~CNSmlDMSyncHandler() completed" ); } @@ -227,6 +234,53 @@ iSyncError = aError; iCheckUpdate = EFalse; +#ifndef NO_UPDATE + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) ); + TInt profileId; + centrep->Get( KNSmlDMDefaultFotaProfileKey, profileId ); + //FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL profileId = %d", profileId ); + delete centrep; + if ( profileId == iProfileId ) + { + + //FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL - connected witrh default profile ID" ); + TInt configFlags( 0 ); + //TInt SetGenValue(0); + TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) ); + if ( centrep ) + { + + // FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL Centrep is defined" ); + if( err == KErrNone ) + { + centrep->Get( KDevManSessionType, configFlags ); + // FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL DevManSessiontype = %d", configFlags ); + } + centrep->Set( KDevManSessionType, 0 ); + //FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL KDevManSessionType getting reset" ); + delete centrep; + } + // configFlags=2 for FOTA Package not downloaded case ,1- successful download + if ( (aError == KErrNone) + && configFlags == 2 ) + { + //FLOG( "[OMADM]\t CNSmlDMSyncHandler::SynchronizeCompletedL(): No changes in FW Update states." ); + iDialog = new HbDialog(); + iDialog->setHeadingWidget(new HbLabel(hbTrId("txt_device_update_title_phone_uptodate"))); + iDialog->setContentWidget(new HbLabel(hbTrId("txt_device_update_dpopinfo_your_phone_is_already_u"))); + iPrimaryAction = new HbAction(); + iPrimaryAction->setText(hbTrId("OK")); + iDialog->setPrimaryAction(iPrimaryAction); + iDialog->setTimeout(HbPopup::NoTimeout); + iDialog->setDismissPolicy(HbPopup::NoDismiss); + iDialog->show(); + // show the dialog + } + + } +#endif + iUseFotaProgressNote = EFalse; iSyncJob.Close(); diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/src/serversettingsview.cpp --- a/deviceupdatesui/deviceupdates/src/serversettingsview.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/src/serversettingsview.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -31,6 +31,7 @@ exit = viewspecificmenu->addAction(hbTrId("txt_common_menu_exit")); connect(exit, SIGNAL(triggered()), QCoreApplication::instance(), SLOT(quit())); setMenu(viewspecificmenu); + iPort = 0; } ServerSettingsView::~ServerSettingsView() { @@ -86,8 +87,10 @@ else accesspoint->setContentWidgetData(QString("currentIndex"), apdata.count()-1); form->addConnection(accesspoint, SIGNAL(currentIndexChanged (int ) ),this, SLOT(accessPointItemChanged(int))); - hostaddress->setContentWidgetData(QString("text"),settingdatalist[3]); - port->setContentWidgetData(QString("text"),portnum);//Integer only setting needs to be done + hostaddress->setContentWidgetData(QString("text"),settingdatalist[3]); + iPort = portnum; + port->setContentWidgetData(QString("text"),iPort);//Integer only setting needs to be done + form->addConnection(port, SIGNAL(textChanged (QString) ),this, SLOT(portItemChanged(QString))); username->setContentWidgetData(QString("text"),settingdatalist[4]); userpwd->setContentWidgetData(QString("echoMode"),HbLineEdit::Password ); userpwd->setContentWidgetData(QString("text"),settingdatalist[5]); @@ -147,13 +150,11 @@ if ((itemlist[0].length() > 0) && (itemlist[1].length() > 0) && (itemlist[3].length() > 0) && (itemlist[4].length() > 0)) { - serversView->saveProfile(itemlist, sessmode, curriap, portval, - netauthval); - qDebug("omadm before crash"); + serversView->saveProfile(itemlist, sessmode, curriap, iPort, + netauthval); form->removeConnection(accesspoint, SIGNAL(currentIndexChanged (int ) ), this, - SLOT(accessPointItemChanged(int))); - qDebug("omadm after crash"); + SLOT(accessPointItemChanged(int))); iMainWindow->setCurrentView(serversView); //Form wk08 soft key owned by view //iMainWindow->removeSoftKeyAction(Hb::SecondarySoftKey,backaction); @@ -161,12 +162,35 @@ } else { + TInt x = itemlist.count(); + TInt valSet=0; + int i=0; + for(i=0;i0) + { + valSet=1; + break; + } + } + if(valSet==1) + { HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeInformation); note->setText(hbTrId( "txt_device_update_dialog_enter_mandatory_field_values")); note->setAttribute( Qt::WA_DeleteOnClose); note->setTimeout(HbPopup::NoTimeout); note->open(); + } + else + { + form->removeConnection(accesspoint,SIGNAL(currentIndexChanged (int ) ), this,SLOT(accessPointItemChanged(int))); + iMainWindow->setCurrentView(serversView); + //Form wk08 soft key owned by view + //iMainWindow->removeSoftKeyAction(Hb::SecondarySoftKey,backaction); + dataformmodel->clear(); + } + } } @@ -251,3 +275,8 @@ qDebug("omadm iap changed"); } +void ServerSettingsView::portItemChanged(QString port) + { + iPort = port.toInt(); + qDebug("omadm new port value is %d ",iPort); + } diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdates/src/settingsdataformcustomitem.cpp --- a/deviceupdatesui/deviceupdates/src/settingsdataformcustomitem.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdates/src/settingsdataformcustomitem.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -22,9 +22,11 @@ #include #include #include +#include +#include SettingsDataFormCustomItem::SettingsDataFormCustomItem(QGraphicsItem *parent) : -HbDataFormViewItem(parent) +HbDataFormViewItem(parent),mLineEdit(NULL) { } @@ -45,9 +47,8 @@ switch (itemType) { case HbDataFormModelItem::CustomItemBase : - { - HbLineEdit* mLineEdit = new HbLineEdit(); - mLineEdit->setText(QString("8080")); + { + mLineEdit = new HbLineEdit(); HbEditorInterface editorInterface(mLineEdit); editorInterface.setMode(HbInputModeNumeric); editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); @@ -63,3 +64,18 @@ int itemType = aIndex.data(HbDataFormModelItem::ItemTypeRole).toInt(); return itemType == HbDataFormModelItem::CustomItemBase; } + + void SettingsDataFormCustomItem::restore() + { + HbDataFormViewItem::restore(); + HbDataFormModelItem::DataItemType itemType = static_cast( + modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); + if( itemType == HbDataFormModelItem::CustomItemBase ) { + QModelIndex itemIndex = modelIndex(); + HbDataFormModelItem *modelItem = static_cast( + static_cast(itemView()->model())->itemFromIndex(itemIndex)); + QString port = modelItem->contentWidgetData("text").toString(); + qDebug("port is %d",port.toInt()); + mLineEdit->setText(port); + } + } diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdatesplugin/deviceupdatesplugin.pro --- a/deviceupdatesui/deviceupdatesplugin/deviceupdatesplugin.pro Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdatesplugin/deviceupdatesplugin.pro Thu Jul 22 16:30:53 2010 +0100 @@ -28,7 +28,9 @@ CONFIG += hb plugin LIBS += -lcpframework \ - -lcentralrepository + -lcentralrepository \ + -lws32 \ + -lapgrfx # Input HEADERS += deviceupdatesplugin.h \ @@ -66,5 +68,6 @@ plugin.sources = deviceupdatesplugin.dll plugin.path = \resource\qt\plugins\controlpanel DEPLOYMENT += plugin +RESOURCES += ./resources/deviceupdatesplugin.qrc # End of file --Don't remove this. \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdatesplugin/inc/deviceupdatesdata.h --- a/deviceupdatesui/deviceupdatesplugin/inc/deviceupdatesdata.h Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdatesplugin/inc/deviceupdatesdata.h Thu Jul 22 16:30:53 2010 +0100 @@ -18,6 +18,7 @@ #ifndef DEVICEUPDATESDATA_H_ #define DEVICEUPDATESDATA_H_ +#include #include _LIT( KDMUIProcess, "\\deviceupdates.exe" ); @@ -37,13 +38,16 @@ const QString &description = QString(), const HbIcon &icon = HbIcon(), const HbDataFormModelItem *parent = 0); - void OpenDmAppL(); - void CloseDmUi(); + void LaunchDeviceUpdatesUi(); + void CloseDeviceUpdatesUi(); virtual ~DeviceUpdateData(); public slots: void onLaunchView(); private: virtual CpBaseSettingView *createSettingView() const; + +private: + QProcess *mproc; }; #endif// DEVICEUPDATESVIEW_H_ diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdatesplugin/inc/deviceupdatesplugin.h --- a/deviceupdatesui/deviceupdatesplugin/inc/deviceupdatesplugin.h Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdatesplugin/inc/deviceupdatesplugin.h Thu Jul 22 16:30:53 2010 +0100 @@ -19,24 +19,22 @@ #ifndef DEVICEUPDATESPLUGIN_H_ #define DEVICEUPDATESPLUGIN_H_ -#include +#include #include class CpItemDataHelper; -class DeviceUpdatesPlugin : public QObject, public CpPluginPlatInterface +class DeviceUpdatesPlugin : public QObject, public CpPluginInterface { Q_OBJECT - Q_INTERFACES(CpPluginPlatInterface) + Q_INTERFACES(CpPluginInterface) public: DeviceUpdatesPlugin(); virtual ~DeviceUpdatesPlugin(); - - virtual int uid() const; - virtual CpSettingFormItemData *createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; }; #endif /* DEVICEUPDATESPLUGIN_H_ */ diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdatesplugin/resources/deviceupdatesplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/deviceupdatesplugin/resources/deviceupdatesplugin.qrc Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,6 @@ + + + + qtg_large_device_update.svg + + diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdatesplugin/resources/qtg_large_device_update.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/deviceupdatesplugin/resources/qtg_large_device_update.svg Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdatesplugin/src/deviceupdatesdata.cpp --- a/deviceupdatesui/deviceupdatesplugin/src/deviceupdatesdata.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdatesplugin/src/deviceupdatesdata.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -15,9 +15,11 @@ * */ - +#include +#include +#include #include -#include +#include #include "deviceupdatesdata.h" @@ -32,72 +34,72 @@ icon, parent) { + mproc = NULL; } DeviceUpdateData::~DeviceUpdateData() { - CloseDmUi(); + CloseDeviceUpdatesUi(); + if (mproc) + { + delete mproc; + mproc = NULL; + } } // ----------------------------------------------------------------------------- // DeviceUpdateData::OpenDmAppL() // ----------------------------------------------------------------------------- // -void DeviceUpdateData::OpenDmAppL() +void DeviceUpdateData::LaunchDeviceUpdatesUi() { - // Create DM UI Process - RProcess rp; - TInt cpLaunch(1); - CRepository *cenrep = CRepository::NewL(KUidSmlSyncApp); - if(cenrep) - { - cenrep->Set( KNsmlDmUILaunch, cpLaunch); - delete cenrep; - cenrep = NULL; - } - TInt err = rp.Create(KDMUIProcess,KNullDesC); - - User::LeaveIfError(err); - - - rp.Resume(); // logon OK - start the server - - + RWsSession ws; + User::LeaveIfError( ws.Connect() ); + CleanupClosePushL( ws ); + // Find the task with uid + TApaTaskList taskList(ws); + TApaTask task = taskList.FindApp( KUidSmlSyncApp ); + if ( task.Exists() ) + { + task.BringToForeground(); + } + else + { + // Create DM UI Process + if(!mproc) + mproc = new QProcess(); + if(mproc->state() != QProcess::Running) + { + QString app = QLatin1String("deviceupdates"); + QStringList args; + args<< QLatin1String("-cp"); + mproc->start(app, args); + mproc->waitForStarted(); + } + } + CleanupStack::PopAndDestroy(); // ws } // --------------------------------------------------------------------------------------------- // DeviceUpdateData::CloseDmUi // closes DM Ui // --------------------------------------------------------------------------------------------- -void DeviceUpdateData:: CloseDmUi() +void DeviceUpdateData:: CloseDeviceUpdatesUi() { - // Create DM UI Process - - TFullName processName; - TFindProcess process; - while ( process.Next( processName ) != KErrNotFound ) - { - if ( ( processName.Find( KDMUIName ) != KErrNotFound ) ) - { - RProcess rprocess; - if (rprocess.Open(process, EOwnerProcess) == KErrNone) - { - rprocess.Terminate(KErrNone); - rprocess.Close(); - } - } - } + if(( mproc )&&(mproc->state() == QProcess::Running)) + { + mproc->close(); + } + } void DeviceUpdateData::onLaunchView() { - TRAP_IGNORE( OpenDmAppL() ); + LaunchDeviceUpdatesUi(); } CpBaseSettingView *DeviceUpdateData::createSettingView() const { - return 0; + return 0; } - - diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdatesplugin/src/deviceupdatesplugin.cpp --- a/deviceupdatesui/deviceupdatesplugin/src/deviceupdatesplugin.cpp Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdatesplugin/src/deviceupdatesplugin.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -15,7 +15,6 @@ * */ -//#include #include #include "deviceupdatesplugin.h" @@ -33,19 +32,12 @@ } -int DeviceUpdatesPlugin::uid() const -{ - // get a uid and replace it. - return 0X2002DD04; -} - -CpSettingFormItemData *DeviceUpdatesPlugin::createSettingFormItemData(CpItemDataHelper& itemDataHelper) const +QList DeviceUpdatesPlugin::createSettingFormItemData(CpItemDataHelper& itemDataHelper) const { - CpSettingFormItemData *entryItem = new DeviceUpdateData(itemDataHelper, QString("Device updates"), - QString()); - - return entryItem; + return QList() + << new DeviceUpdateData(itemDataHelper, QString("Device updates"), + QString("Device updates plugin"), HbIcon(":/resources/qtg_large_device_update.svg")); } Q_EXPORT_PLUGIN2( deviceupdatesplugin, DeviceUpdatesPlugin) diff -r 7d88c1eb7da3 -r 751cd8585b82 deviceupdatesui/deviceupdatesui.pro --- a/deviceupdatesui/deviceupdatesui.pro Fri Jun 11 16:23:35 2010 +0100 +++ b/deviceupdatesui/deviceupdatesui.pro Thu Jul 22 16:30:53 2010 +0100 @@ -15,7 +15,7 @@ # TEMPLATE = subdirs -SUBDIRS += deviceupdates deviceupdatesplugin deviceupdatesqtsp cpqtsp devicemanagementnotifiersplugin +SUBDIRS += deviceupdates deviceupdatesplugin deviceupdatesqtsp CONFIG += ordered diff -r 7d88c1eb7da3 -r 751cd8585b82 group/bld.inf --- a/group/bld.inf Fri Jun 11 16:23:35 2010 +0100 +++ b/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -23,5 +23,14 @@ -//omadm -#include "../deviceupdatesui/adapters/bld/bld.inf" \ No newline at end of file +//omadmadapters +#include "../omadmadapters/bld/bld.inf" + +//omadcmoadapters +#include "../omadcmoadapters/group/bld.inf" + +//omacpadapters +#include "../omacpadapters/bld/bld.inf" + +//application management +#include "../applicationmanagement/group/bld.inf" \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/MbxNbrAdapter/Data/10207281.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/MbxNbrAdapter/Data/10207281.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 1020 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: ECOM DLL interface & implementation description resource for +* this DLL. +* +*/ + + +// INCLUDES +#include + +#include "ProvisioningUIDs.h" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// theInfo +// ECOM DLL interface & implementation description resource. +// +// ----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10207281; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KProvisioningAdapterInterface; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10207282; + version_no = 1; + display_name = "WAP Mbx Nbr PA"; // Use short name to save RAM and ROM space + default_data = ""; + opaque_data = "10"; // Adapter priority + } + }; + } + }; + } + +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/MbxNbrAdapter/Data/WPMbxNbrAdapterResource.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/MbxNbrAdapter/Data/WPMbxNbrAdapterResource.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,35 @@ +/* +* 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: Resource file. +* +*/ + + +// INCLUDES +#include +#include + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Mailbox number adapter title resource. +// +// ----------------------------------------------------------------------------- +// +RESOURCE LBUF r_mailbox_number_adapter_title + { + txt = qtn_op_head_mailbox; + } + +// End of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/MbxNbrAdapter/Group/MbxNbrAdapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/MbxNbrAdapter/Group/MbxNbrAdapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2002-2006 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 mailbox number settings adapter. +* +*/ + + +#include + +#include + +TARGET wpmbxnbradapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x10207281 +VENDORID VID_DEFAULT + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../Src +SOURCE MbxNbrAdapter.cpp +SOURCE MbxNbrAdapterGroupProxy.cpp + +SOURCEPATH ../Data + +START RESOURCE 10207281.rss +TARGET wpmbxnbradapter.rsc +END + +START RESOURCE WPMbxNbrAdapterResource.rss +HEADER +TARGET wpmbxnbradapterresource.rsc +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + +USERINCLUDE . +USERINCLUDE ../Inc +USERINCLUDE ../../bld + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib +LIBRARY provisioningengine.lib +LIBRARY commonengine.lib +LIBRARY vmbxengine +LIBRARY centralrepository.lib +DEBUGLIBRARY flogger.lib + + +SMPSAFE +//end of file + diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/MbxNbrAdapter/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/MbxNbrAdapter/Group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,2 @@ +PRJ_MMPFILES +MbxNbrAdapter.mmp \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/MbxNbrAdapter/Inc/MbxNbrAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/MbxNbrAdapter/Inc/MbxNbrAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,177 @@ +/* +* 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: Handles mailbox number settings in OMA provisioning. +* +*/ + + +#ifndef MbxNbrAdapter_H +#define MbxNbrAdapter_H + +// INCLUDES + +#include + +// FORWARD DECLARATIONS +//struct TMbxNbrAdapterData; + + +// MODULE DATA STRUCTURES + +// ENUMERATIONS + + +// CLASS DECLARATION + +/** + * CMbxNbrAdapter handles accesspoint settings. + */ +class CMbxNbrAdapter : public CWPAdapter + { + private: // ENUMERATIONS + + enum TMailboxType + { + ECSVoiceMailbox = 1, // Default if type is not received in XML + ECSVideoMailbox + }; + + private: // MODULE DATA STRUCTURES + + struct TMbxNbrAdapterData + { + TPtrC iName; + TPtrC iMailboxNumber; + TBool iVidiosupport; + TBool iIsVideosupport; + TMailboxType iMailboxType; + }; + + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return a instance of class. + */ + static CMbxNbrAdapter* NewL(); + + /** + * Destructor + */ + virtual ~CMbxNbrAdapter(); + + public: // Functions from base classes + + /** + * From CWPAdapter + */ + TInt ItemCount() const; + + /** + * From CWPAdapter + */ + const TDesC16& SummaryTitle( TInt aIndex ) const; + + /** + * From CWPAdapter + */ + const TDesC16& SummaryText( TInt aIndex ) const; + + /** + * From CWPAdapter + */ + TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); + + /** + * From CWPAdapter + */ + void SaveL( TInt aItem ); + + /** + * From CWPAdapter + */ + TBool CanSetAsDefault( TInt aItem ) const; + + /** + * From CWPAdapter + */ + void SetAsDefaultL( TInt aItem ); + + /** + * From CWPAdapter + */ + void VisitL( CWPCharacteristic& aElement ); + + /** + * From CWPAdapter + */ + void VisitL( CWPParameter& aElement ); + + /** + * From CWPAdapter + */ + void VisitLinkL( CWPCharacteristic& aCharacteristic ); + + private: // Default constructors + + /** + * C++ default constructor. + */ + CMbxNbrAdapter(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // New functions + + /** + * Validates the data in iTempData. + */ + TBool IsValid(); + + /** + * Validates the phone number string. + */ + TBool IsValidPhoneNumber( const TDesC& aPtr ); + + /** + * Parses an mailbox type from a descriptor. + */ + void ParseMbxTypeL( const TDesC& aPtr, TMailboxType& aInt ); + + /** + * Parses an video ON/OFF type from a descriptor. + */ + + void ParseVideoTypeL( const TDesC& aPtr, TBool& aInt, TBool& aInt1 ); + + private: // Data + + HBufC* iTitle; + + TPtrC iAppId; + RArray iSettings; + TMbxNbrAdapterData iTempData; + + private: + friend class T_CWPMbxNbrAdapter; + + + }; + +#endif // MbxNbrAdapter_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/MbxNbrAdapter/Src/MbxNbrAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/MbxNbrAdapter/Src/MbxNbrAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,397 @@ +/* +* 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: Handles mailbox number settings in OMA provisioning. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "WPAdapterUtil.h" +#include "MbxNbrAdapter.h" +#include "ProvisioningDebug.h" + +// CONSTANTS +#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw + _LIT( KAdapterName, "WPMbxNbrAdapterResource" ); +#else + _LIT( KAdapterName, "WPMbxNbrAdapter" ); +#endif +_LIT( KMailboxNumberStr, "MBNMBR" ); +_LIT( KMailboxTypeStr, "MBTYPE" ); +_LIT( KCSVideoMailboxType, "VIDEO" ); +_LIT( KVideoSupportType, "VIDEO_MBOX_SUPPORT" ); +_LIT( KVideoSupportTypeTrue, "TRUE" ); +_LIT( KVideoSupportTypeFalse, "FALSE" ); +_LIT( KMailboxAppId, "w9027" ); // From OMA provisioning registration document +const TInt KSettingsGranularity = 2; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::CMbxNbrAdapter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CMbxNbrAdapter::CMbxNbrAdapter() : + iSettings( KSettingsGranularity ) + { + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMbxNbrAdapter::ConstructL() + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::ConstructL:" ) ); + + TFileName fileName; + Dll::FileName( fileName ); + iTitle = WPAdapterUtil::ReadHBufCL( fileName, + KAdapterName, + R_MAILBOX_NUMBER_ADAPTER_TITLE ); + + FLOG( _L( "[Provisioning] CMbxNbrAdapter::ConstructL: Done" ) ); + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMbxNbrAdapter* CMbxNbrAdapter::NewL() + { + CMbxNbrAdapter* self = new( ELeave ) CMbxNbrAdapter; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::~CMbxNbrAdapter +// Destructor +// ----------------------------------------------------------------------------- +// +CMbxNbrAdapter::~CMbxNbrAdapter() + { + delete iTitle; + iSettings.Close(); + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::ItemCount +// ----------------------------------------------------------------------------- +// +TInt CMbxNbrAdapter::ItemCount() const + { + // SummaryTitle(), SummaryText(), SaveL(), SetAsDefaultL() and + // CanSetAsDefault() are called ItemCount() times + return iSettings.Count(); + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::SummaryTitle +// ----------------------------------------------------------------------------- +// +const TDesC16& CMbxNbrAdapter::SummaryTitle( TInt /*aIndex*/ ) const + { + return *iTitle; + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::SummaryText +// ----------------------------------------------------------------------------- +// +const TDesC16& CMbxNbrAdapter::SummaryText( TInt aIndex ) const + { + // SummaryText should be called ItemCount() times + __ASSERT_DEBUG( iSettings.Count() > aIndex, + User::Panic( _L("CMbxNbrAdapter::SummaryText"), KErrCorrupt ) ); + __ASSERT_DEBUG( aIndex >= 0, + User::Panic( _L("CMbxNbrAdapter::SummaryText"), KErrCorrupt ) ); + return iSettings[ aIndex ].iName; + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::DetailsL +// ----------------------------------------------------------------------------- +// +TInt CMbxNbrAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ ) + { + // Detail view is a feature for later release. + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::SaveL +// ----------------------------------------------------------------------------- +// +void CMbxNbrAdapter::SaveL( TInt aItem ) + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::SaveL:" ) ); + __ASSERT_DEBUG( iSettings.Count() > aItem, User::Leave( KErrCorrupt ) ); + __ASSERT_DEBUG( aItem >= 0, User::Leave( KErrCorrupt ) ); + + //RVmbxNumber model; + //User::LeaveIfError( model.Open() ); + //CleanupClosePushL( model ); + + TInt err( KErrNone ); + switch( iSettings[aItem].iMailboxType ) + { + case ECSVoiceMailbox: + + CVoiceMailbox* voiceModel = CVoiceMailbox::NewLC(); + CVoiceMailboxEntry* voiceEntry = CVoiceMailboxEntry::NewLC(); + voiceEntry->SetVoiceMailboxType(EVmbxVoice); + voiceEntry->SetVmbxNumber(iSettings[aItem].iMailboxNumber); + voiceModel->SaveProvisionedEntry(*voiceEntry); + CleanupStack::PopAndDestroy(voiceEntry); + CleanupStack::PopAndDestroy(voiceModel); + break; + case ECSVideoMailbox: + + CVoiceMailbox* videoModel = CVoiceMailbox::NewLC(); + CVoiceMailboxEntry* videoEntry = CVoiceMailboxEntry::NewLC(); + videoEntry->SetVoiceMailboxType(EVmbxVideo); + videoEntry->SetVmbxNumber(iSettings[aItem].iMailboxNumber); + videoModel->SaveProvisionedEntry(*videoEntry); + CleanupStack::PopAndDestroy(videoEntry); + CleanupStack::PopAndDestroy(videoModel); + + if ( iSettings[aItem].iIsVideosupport ) + { + CRepository* cenrep = CRepository::NewL( KCRUidVideoMailbox ); + FLOG( _L( "[Provisioning] CMbxNbrAdapter::SaveL:case Saving it to Cenrep" ) ); + TBuf<100> buf1; + buf1.AppendNum( iSettings[aItem].iVidiosupport ); + + FLOG( buf1 ); + CleanupStack::PushL(cenrep); + User::LeaveIfError( + cenrep->Set( KVideoMbxSupport, iSettings[aItem].iVidiosupport )); + FLOG( _L( "[Provisioning] CMbxNbrAdapter::SaveL:case Saved" ) ); + CleanupStack::PopAndDestroy(cenrep); + } + break; + default: + User::Leave( KErrCorrupt ); + break; + } + + User::LeaveIfError( err ); + //CleanupStack::PopAndDestroy(); // Close model + + FLOG( _L( "[Provisioning] CStreamingAdapter::SaveL: Done" ) ); + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::CanSetAsDefault +// ----------------------------------------------------------------------------- +// +TBool CMbxNbrAdapter::CanSetAsDefault( TInt /*aItem*/ ) const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::SetAsDefault +// ----------------------------------------------------------------------------- +// +void CMbxNbrAdapter::SetAsDefaultL( TInt /*aItem*/ ) + { + // This shouldn't be called because CanSetAsDefault + // always returns EFalse. + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::VisitL +// ----------------------------------------------------------------------------- +// +void CMbxNbrAdapter::VisitL( CWPCharacteristic& aCharacteristic ) + { + switch( aCharacteristic.Type() ) + { + case KWPApplication: + // Initialize iTempData's members + iTempData.iName.Set( KNullDesC ); + iTempData.iMailboxNumber.Set( KNullDesC ); + iTempData.iVidiosupport = EFalse; + iTempData.iIsVideosupport = EFalse; + iTempData.iMailboxType = ECSVoiceMailbox; + + // Accept characteristic + aCharacteristic.AcceptL( *this ); + + // Check iAppId and validate data + if( iAppId == KMailboxAppId && IsValid() ) + { + // iAppId is correct and data is valid + // -> Lets append it to array + iSettings.Append( iTempData ); + } + break; + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::VisitL +// ----------------------------------------------------------------------------- +// +void CMbxNbrAdapter::VisitL( CWPParameter& aParameter ) + { + switch( aParameter.ID() ) + { + case EWPParameterAppID: + iAppId.Set( aParameter.Value() ); + break; + case EWPParameterName: + iTempData.iName.Set( aParameter.Value() ); + break; + case EWPNamedParameter: + { + if( aParameter.Name().Compare( KMailboxNumberStr ) == 0 ) + { + iTempData.iMailboxNumber.Set( aParameter.Value() ); + } + else if( aParameter.Name().Compare( KMailboxTypeStr ) == 0 ) + { + ParseMbxTypeL( aParameter.Value(), iTempData.iMailboxType ); + } + else if( aParameter.Name().Compare( KVideoSupportType ) == 0) + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::VisitL:Visiting to ParseVideoTypeL" ) ); + ParseVideoTypeL( aParameter.Value(), iTempData.iVidiosupport, iTempData.iIsVideosupport ); + } + break; + } + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::VisitLinkL +// ----------------------------------------------------------------------------- +// +void CMbxNbrAdapter::VisitLinkL( CWPCharacteristic& /*aCharacteristic*/ ) + { + } + + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::IsValid +// ----------------------------------------------------------------------------- +// +TBool CMbxNbrAdapter::IsValid() + { + TBool validity( EFalse ); + + // Validity check: + // iMailboxType is either ECSVideoMailbox or ECSVoiceMailbox and + // iMailboxNumber is valid number in e.164 format + if( ( iTempData.iMailboxType == ECSVideoMailbox || + iTempData.iMailboxType == ECSVoiceMailbox ) && + IsValidPhoneNumber( iTempData.iMailboxNumber ) ) + { + validity = ETrue; + } + + return validity; + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::IsValidPhoneNumber +// ----------------------------------------------------------------------------- +// +TBool CMbxNbrAdapter::IsValidPhoneNumber( const TDesC& aPtr ) + { + return CommonPhoneParser::IsValidPhoneNumber( aPtr, + CommonPhoneParser::EPhoneClientNumber ); + } + +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::ParseMbxTypeL +// ----------------------------------------------------------------------------- +// +void CMbxNbrAdapter::ParseMbxTypeL( const TDesC& aPtr, TMailboxType& aType ) + { + if( aPtr.Length() ) + { + if( aPtr.Compare( KCSVideoMailboxType ) == 0 ) + { + aType = ECSVideoMailbox; + } + else + { + User::Leave( KErrNotSupported ); + } + } + else + { + aType = ECSVoiceMailbox; + } + } +// ----------------------------------------------------------------------------- +// CMbxNbrAdapter::ParseVideoTypeL +// ----------------------------------------------------------------------------- +// +void CMbxNbrAdapter::ParseVideoTypeL( const TDesC& aPtr, TBool& aType, TBool& aType1 ) + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:in" ) ); + if( aPtr.Length() ) + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:If there is ON/OFF Value" ) ); + if( aPtr.Compare( KVideoSupportTypeTrue ) == 0 ) + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:if ON set TRUE" ) ); + aType = ETrue; + aType1 = ETrue; + } + else if( aPtr.Compare( KVideoSupportTypeFalse ) == 0 ) + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:if OFF set False" ) ); + aType = EFalse; + aType1 = ETrue; + } + else + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:if some thing else set False" ) ); + aType1 = EFalse; + } + } + else + { + FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:no ON/OFF" ) ); + aType1 = EFalse; + } + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/MbxNbrAdapter/Src/MbxNbrAdapterGroupProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/MbxNbrAdapter/Src/MbxNbrAdapterGroupProxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,46 @@ +/* +* 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: Table of plugins for ECom +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "MbxNbrAdapter.h" + + +// CONSTANTS +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x10207282, CMbxNbrAdapter::NewL ) + }; + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ImplementationProxy +// ECOM implementation table entry. +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/MbxNbrAdapter/loc/MailboxAdapter.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/MbxNbrAdapter/loc/MailboxAdapter.loc Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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 is a localisation file for MediaSettings +* A .loc file is the one and only place where the logical strings +* to be localised are defined. +* +*/ + + + +// LOCALISATION STRINGS + +//d: Summary text for mailbox settings +//l: popup_info_list_pane_t2/opt1 +// +#define qtn_op_head_mailbox "Mailbox settings" + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/StreamingAdapter/Data/101F85CB.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/StreamingAdapter/Data/101F85CB.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,57 @@ +/* +* 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: ECOM DLL interface & implementation description resource for +* this DLL. +* +*/ + + +// INCLUDES +#include + +#include "ProvisioningUIDs.h" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// theInfo +// ECOM DLL interface & implementation description resource. +// +// ----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x101F85CB; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KProvisioningAdapterInterface; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F85CC; + version_no = 1; + display_name = "WP STREAMING PA";// Use short name to save RAM and ROM space + default_data = ""; + opaque_data = "10"; // Adapter priority + } + }; + } + }; + } + +// End of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/StreamingAdapter/Data/WPStreamingAdapterResource.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/StreamingAdapter/Data/WPStreamingAdapterResource.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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: Resource file. +* +*/ + + +// INCLUDES +#include +#include + + +RESOURCE LBUF r_streaming_adapter_title + { + txt = qtn_op_head_streaming; + } + +// End of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/StreamingAdapter/Group/StreamingAdapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/StreamingAdapter/Group/StreamingAdapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2002-2006 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 specification file for streaming app settings adapter. +* +*/ + + +#include + +#include + +TARGET wpstreamingadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F85CB +VENDORID VID_DEFAULT + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../Src +SOURCE Streamingadapter.cpp +SOURCE StreamingadapterGroupProxy.cpp + +SOURCEPATH ../Data + +START RESOURCE 101F85CB.rss +TARGET wpstreamingadapter.rsc +END + +START RESOURCE WPStreamingAdapterResource.rss +HEADER +TARGET wpstreamingadapterresource.rsc +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + + +USERINCLUDE . +USERINCLUDE ../Inc +USERINCLUDE ../../bld + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib +LIBRARY provisioningengine.lib +LIBRARY mpsettengine.lib +LIBRARY cmmanager.lib +LIBRARY commdb.lib +DEBUGLIBRARY flogger.lib + + +SMPSAFE +//end of file + diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/StreamingAdapter/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/StreamingAdapter/Group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,2 @@ +PRJ_MMPFILES +StreamingAdapter.mmp \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/StreamingAdapter/Inc/StreamingAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/StreamingAdapter/Inc/StreamingAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,182 @@ +/* +* 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: Handles streaming app settings in OMA provisioning. +* +*/ + + +#ifndef STREAMINGADAPTER_H +#define STREAMINGADAPTER_H + +// INCLUDES + +#include +#include + +// FORWARD DECLARATIONS +class CMPSettingsModel; +struct TStreamingAdapterData; + +// CLASS DECLARATION + +/** + * CStreamingAdapter handles accesspoint settings. + */ +class CStreamingAdapter : public CWPAdapter, + public MWPContextExtension + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return a instance of class. + */ + static CStreamingAdapter* NewL(); + + /** + * Destructor + */ + virtual ~CStreamingAdapter(); + + public: // Functions from base classes + + /** + * From CWPAdapter + */ + TInt ItemCount() const; + + /** + * From CWPAdapter + */ + const TDesC16& SummaryTitle(TInt aIndex) const; + + /** + * From CWPAdapter + */ + const TDesC16& SummaryText(TInt aIndex) const; + + /** + * From CWPAdapter + */ + TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); + + /** + * From CWPAdapter + */ + void SaveL(TInt aItem); + + /** + * From CWPAdapter + */ + TBool CanSetAsDefault(TInt aItem) const; + + /** + * From CWPAdapter + */ + void SetAsDefaultL(TInt aItem); + + /** + * From CWPAdapter + */ + void VisitL(CWPCharacteristic& aElement); + + /** + * From CWPAdapter + */ + void VisitL(CWPParameter& aElement); + + /** + * From CWPAdapter + */ + void VisitLinkL(CWPCharacteristic& aCharacteristic); + + /** + * From CWPAdapter + */ + TInt ContextExtension(MWPContextExtension*& aExtension); + + /** + * From MWPContextExtension + */ + const TDesC8& SaveDataL(TInt aIndex) const; + + /** + * From MWPContextExtension + */ + void DeleteL(const TDesC8& aSaveData); + + /** + * From MWPContextExtension + */ + TUint32 Uid() const; + + + private: // Default constructors + + /** + * C++ default constructor. + */ + CStreamingAdapter(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // New functions + + /** + * Validates the data in iTempData. + */ + TBool IsValid(); + + /** + * Parses an integer from a descriptor. + * Returns error code. + */ + TInt ParseIntegerL(const TDesC& aPtr, TInt& aInt); + + /** + * ResetAndDestroy() cleanup for ecom implementation array. + * @param aAny the implementation array + */ + static void Cleanup( TAny* aAny ); + + /** + * Initialise CMPSettingsModel + * @param None + * @return None + */ + void InitSettingsModelL(); + + private: // Data + + HBufC* iTitle; + CMPSettingsModel* iModel; + + TPtrC iAppId; + TStreamingAdapterData* iCurrentData; + TStreamingAdapterData* iTempData; + + TPckgBuf iSavedID; + + private: + friend class TM_CWPStreamingAdapterTestCase; + + + }; + +#endif // STREAMINGADAPTER_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/StreamingAdapter/Src/Streamingadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/StreamingAdapter/Src/Streamingadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,541 @@ +/* +* 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: Handles streaming app settings in OMA provisioning. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include "WPAdapterUtil.h" +#include "StreamingAdapter.h" +#include "ProvisioningDebug.h" + +// CONSTANTS +#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw + _LIT( KAdapterName, "WPStreamingAdapterResource" ); +#else + _LIT( KAdapterName, "WPStreamingAdapter" ); +#endif +_LIT(KMaxBandwidthStr,"MAX-BANDWIDTH"); +_LIT(KMaxUdpPortStr,"MAX-UDP-PORT"); +_LIT(KMinUdpPortStr,"MIN-UDP-PORT"); +_LIT(KStreamingAppId, "554"); + +const TInt KInvalidValue = -1; +const TInt KProxyEnabled = 1; + +const TInt KMinUDPPort = 1024; //6970; +const TInt KMaxUDPPort = 65535; //32000; +const TInt KDefaultMinUDPPort = 6970; +const TInt KDefaultMaxUDPPort = 32000; + +const TInt KBandwidthValue1 = 9050; +const TInt KBandwidthValue2 = 13400; +const TInt KBandwidthValue3 = 18100; +const TInt KBandwidthValue4 = 26800; +const TInt KBandwidthValue5 = 27150; +const TInt KBandwidthValue6 = 40200; + +// MODULE DATA STRUCTURES +struct TStreamingAdapterData + { + TPtrC iName; + TInt iMaxBw; + TInt iMinUdpPort; + TInt iMaxUdpPort; + CWPCharacteristic* iNapDef; + }; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::CStreamingAdapter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CStreamingAdapter::CStreamingAdapter() + { + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::ConstructL() + { + FLOG( _L( "[Provisioning] CStreamingAdapter::ConstructL:" ) ); + + TFileName fileName; + Dll::FileName( fileName ); + iTitle = WPAdapterUtil::ReadHBufCL( fileName, + KAdapterName, + R_STREAMING_ADAPTER_TITLE ); + + FLOG( _L( "[Provisioning] CStreamingAdapter::ConstructL: Done" ) ); + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CStreamingAdapter* CStreamingAdapter::NewL() + { + CStreamingAdapter* self = new(ELeave) CStreamingAdapter; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::~CStreamingAdapter +// Destructor +// ----------------------------------------------------------------------------- +// +CStreamingAdapter::~CStreamingAdapter() + { + delete iTitle; + delete iCurrentData; + delete iTempData; + delete iModel; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::ItemCount +// ----------------------------------------------------------------------------- +// +TInt CStreamingAdapter::ItemCount() const + { + // If ItemCount() returns zero, the adapter is unloaded at startup. + // SummaryTitle(), SummaryText(), SaveL(), SetAsDefaultL() and + // CanSetAsDefault() are called ItemCount() times + return iCurrentData ? 1 : 0; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::SummaryTitle +// ----------------------------------------------------------------------------- +// +const TDesC16& CStreamingAdapter::SummaryTitle(TInt /*aIndex*/) const + { + return *iTitle; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::SummaryText +// ----------------------------------------------------------------------------- +// +const TDesC16& CStreamingAdapter::SummaryText(TInt /*aIndex*/) const + { + return iCurrentData->iName; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::DetailsL +// ----------------------------------------------------------------------------- +// +TInt CStreamingAdapter::DetailsL(TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/) + { + // Detail view is a feature for later release. + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::SaveL +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::SaveL( TInt /*aItem*/ ) + { + FLOG( _L( "[Provisioning] CStreamingAdapter::SaveL:" ) ); + + __ASSERT_DEBUG( iCurrentData->iNapDef, User::Leave( KErrCorrupt ) ); + + InitSettingsModelL(); + + // Load default values + iModel->LoadSettingsL(EConfigDefault); + + // Set max bandwidth value if valid + if (iCurrentData->iMaxBw != KInvalidValue) + { + iModel->SetMaxBandwidth(iCurrentData->iMaxBw, EBearerGPRS); + } + + // Set udp port range if valid + if (iCurrentData->iMinUdpPort != KInvalidValue && + iCurrentData->iMaxUdpPort != KInvalidValue) + { + iModel->SetMinUDPPort(iCurrentData->iMinUdpPort); + iModel->SetMaxUDPPort(iCurrentData->iMaxUdpPort); + } + + // Get the IAP id + + RCmManagerExt cmmanagerExt; + cmmanagerExt.OpenL(); + CleanupClosePushL(cmmanagerExt); + + TPckgBuf uid; + TBool proxyDefined(EFalse); + TBool apDefined(EFalse); + TBool apWithoutProxyDefined(EFalse); + + for (TInt i(0); iCurrentData->iNapDef->Data(i).Length() == uid.MaxLength() + && !(proxyDefined && apWithoutProxyDefined); i++) + { + uid.Copy(iCurrentData->iNapDef->Data(i)); + RCmConnectionMethodExt cm; + cm = cmmanagerExt.ConnectionMethodL( uid() ); + CleanupClosePushL( cm ); + + TBool useProxy = cm.GetBoolAttributeL( CMManager::ECmProxyUsageEnabled ); + + if (!apDefined || (!useProxy && !apWithoutProxyDefined)) + { + iModel->SetDefaultAp(uid()); + apDefined = ETrue; + + iSavedID.Copy(uid); + + if (!useProxy) + { + apWithoutProxyDefined = ETrue; + } + } + + if (!proxyDefined && useProxy) + { + // Get proxy port + TUint32 proxyPort = cm.GetIntAttributeL( CMManager::ECmProxyPortNumber ); + + + // Get proxy host name + const HBufC* proxyHost = cm.GetStringAttributeL( CMManager::ECmProxyServerName ); + + if(*proxyHost != KNullDesC && proxyPort <= 65535) + { + iModel->SetProxyHostNameL(*proxyHost); + iModel->SetProxyPort(static_cast(proxyPort)); + iModel->SetProxyMode(KProxyEnabled); + + proxyDefined = ETrue; + } + delete proxyHost; + } + CleanupStack::PopAndDestroy();//cm + } + + CleanupStack::PopAndDestroy(); // cmmanagerext + + iModel->StoreSettingsL(); + + FLOG( _L( "[Provisioning] CStreamingAdapter::SaveL: Done" ) ); + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::CanSetAsDefault +// ----------------------------------------------------------------------------- +// +TBool CStreamingAdapter::CanSetAsDefault(TInt /*aItem*/) const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::SetAsDefault +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::SetAsDefaultL(TInt /*aItem*/) + { + // This shouldn't be called because CanSetAsDefault + // always returns EFalse. + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::VisitL +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::VisitL(CWPCharacteristic& aCharacteristic) + { + switch(aCharacteristic.Type()) + { + case KWPApplication: + // Create new iTempData + if (iTempData) + { + delete iTempData; + iTempData = NULL; + } + + iTempData = new (ELeave) TStreamingAdapterData; + + // Initialize iTempData's members + iTempData->iName.Set(KNullDesC); + iTempData->iMaxBw = KInvalidValue; + iTempData->iMinUdpPort = KInvalidValue; + iTempData->iMaxUdpPort = KInvalidValue; + iTempData->iNapDef = NULL; + + // Accept characteristic + aCharacteristic.AcceptL(*this); + + // Check iAppId and validate data + if (iAppId == KStreamingAppId && IsValid()) + { + // iAppId is correct and data is valid + delete iCurrentData; + iCurrentData = iTempData; + iTempData = NULL; + } + else + { + // iAppId is incorrect or data is invalid + delete iTempData; + iTempData = NULL; + } + break; + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::VisitL +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::VisitL(CWPParameter& aParameter) + { + // Check the contents of whole characteristic before overwriting iMaxBw, + // iMinUdpPort and iMaxUdpPort. Might be looking at the wrong application + // characteristic + + __ASSERT_DEBUG(iTempData, User::Leave(KErrCorrupt)); + + TInt value; + switch(aParameter.ID()) + { + case EWPParameterAppID: + iAppId.Set(aParameter.Value()); + break; + case EWPParameterName: + if (iTempData->iName == KNullDesC) + { + iTempData->iName.Set(aParameter.Value()); + } + break; + case EWPNamedParameter: + { + if( aParameter.Name().Compare( KMaxBandwidthStr ) == 0 + && !ParseIntegerL( aParameter.Value(), value ) ) + { + iTempData->iMaxBw = value; + } + else if( aParameter.Name().Compare( KMaxUdpPortStr ) == 0 + && !ParseIntegerL( aParameter.Value(), value ) ) + { + iTempData->iMaxUdpPort = value; + } + else if( aParameter.Name().Compare( KMinUdpPortStr ) == 0 + && !ParseIntegerL( aParameter.Value(), value ) ) + { + iTempData->iMinUdpPort = value; + } + break; + } + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::VisitLinkL +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::VisitLinkL(CWPCharacteristic& aCharacteristic) + { + // Here again, do not overwrite iPXLogical before you're sure + // you're looking at the correct APPLICATION + + __ASSERT_DEBUG(iTempData, User::Leave(KErrCorrupt)); + + switch(aCharacteristic.Type()) + { + //intentional fall-through + case KWPNapDef: + case KWPPxLogical: + iTempData->iNapDef = &aCharacteristic; + break; + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::ContextExtension +// ----------------------------------------------------------------------------- +// +TInt CStreamingAdapter::ContextExtension(MWPContextExtension*& aExtension) + { + aExtension = this; + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::SaveDataL +// ----------------------------------------------------------------------------- +// +const TDesC8& CStreamingAdapter::SaveDataL(TInt /*aIndex*/) const + { + return iSavedID; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::DeleteL +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::DeleteL(const TDesC8& aSaveData) + { + TUint32 id; + + InitSettingsModelL(); + + iModel->GetDefaultAp(id); + + TPckgBuf pckg; + pckg.Copy(aSaveData); + + if (id == pckg()) + { + iModel->LoadSettingsL(EConfigDefault); + iModel->StoreSettingsL(); + } + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::Uid +// ----------------------------------------------------------------------------- +// +TUint32 CStreamingAdapter::Uid() const + { + return iDtor_ID_Key.iUid; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::IsValid +// ----------------------------------------------------------------------------- +// +TBool CStreamingAdapter::IsValid() + { + TBool validity(EFalse); + + if (iTempData->iNapDef) + { + // Validity checks for min and max UDP port values + if (iTempData->iMinUdpPort < KMinUDPPort) + { + iTempData->iMinUdpPort = KDefaultMinUDPPort; + } + + if (iTempData->iMaxUdpPort > KMaxUDPPort) + { + iTempData->iMaxUdpPort = KDefaultMaxUDPPort; + } + + if (iTempData->iMinUdpPort > iTempData->iMaxUdpPort) + { + iTempData->iMinUdpPort = KInvalidValue; + iTempData->iMaxUdpPort = KInvalidValue; + } + + // Validity check for max bandwidth value + switch (iTempData->iMaxBw) + { + case KBandwidthValue1: + case KBandwidthValue2: + case KBandwidthValue3: + case KBandwidthValue4: + case KBandwidthValue5: + case KBandwidthValue6: + // iMaxBw is valid + break; + default: + // iMaxBw is invalid + iTempData->iMaxBw = KInvalidValue; + break; + } + + validity = ETrue; + } + + return validity; + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::ParseIntegerL +// ----------------------------------------------------------------------------- +// +TInt CStreamingAdapter::ParseIntegerL(const TDesC& aPtr, TInt& aInt) + { + TLex lex(aPtr); + return lex.Val(aInt); + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::Cleanup +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::Cleanup( TAny* aAny ) + { + RImplInfoPtrArray* implArray = + reinterpret_cast< RImplInfoPtrArray*> ( aAny ); + implArray->ResetAndDestroy(); + implArray->Close(); + } + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::InitSettingsModelL +// ----------------------------------------------------------------------------- +// +void CStreamingAdapter::InitSettingsModelL() + { + FLOG( _L( "[Provisioning] CStreamingAdapter::InitSettingsModelL:" ) ); + + if ( !iModel ) + { + RImplInfoPtrArray impl; + CleanupStack::PushL( TCleanupItem( Cleanup, &impl ) ); + CMPSettingsModel::ListImplementationsL( impl ); + if( impl.Count() > 0 ) + { + FLOG( _L( "[Provisioning] CStreamingAdapter::InitSettingsModelL: Creating CMPSettingsModel" ) ); + // using the first available implementation + iModel= CMPSettingsModel::NewL( impl[0]->ImplementationUid() ); + FLOG( _L( "[Provisioning] CStreamingAdapter::InitSettingsModelL: Creating CMPSettingsModel Done" ) ); + } + CleanupStack::PopAndDestroy(); // implArray + } + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/StreamingAdapter/Src/StreamingadapterGroupProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/StreamingAdapter/Src/StreamingadapterGroupProxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2002-2006 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: Table of plugins for ECom +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "StreamingAdapter.h" + + +// CONSTANTS +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F85CC, CStreamingAdapter::NewL ) +// {{0x101F85CC}, CStreamingAdapter::NewL}, + }; + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ImplementationProxy +// ECOM implementation table entry. +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/StreamingAdapter/loc/StreamingAdapter.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/StreamingAdapter/loc/StreamingAdapter.loc Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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 is a localisation file for MediaSettings +* A .loc file is the one and only place where the logical strings +* to be localised are defined. +* +*/ + + + +// LOCALISATION STRINGS + +//d: Summary text for streaming settings +//l: popup_info_list_pane_t2/opt1 +// +#define qtn_op_head_streaming "Streaming settings" + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Data/101F84DC.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Data/101F84DC.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,64 @@ +/* +* 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: Resource file defining the ProvisioningAdapter plugin. +* +*/ + + + +// INCLUDES +#include +#include "ProvisioningUIDs.h" + + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// theInfo +// Resource defining the ProvisioningAdapter plugin. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KProvisioningWAPAdapterDllUid3; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KProvisioningAdapterInterface; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KProvisioningMMSAdapterUid; + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = "101"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KProvisioningBrowserAdapterUid; + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = "100"; + } + }; + } + }; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Data/WPWAPAdapterResource.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Data/WPWAPAdapterResource.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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: Resource file. +* +*/ + + + +// INCLUDES +#include +#include + +// Rich text labels + +RESOURCE LBUF r_qtn_op_head_browser + { + txt = qtn_op_head_browser; + } + +RESOURCE LBUF r_qtn_sm_mms_accesspoints + { + txt = qtn_sm_mms_accesspoints; + } + +RESOURCE LBUF r_qtn_sm_wapap_name + { + txt = qtn_sm_wapap_name; + } + +RESOURCE LBUF r_qtn_sm_bookmark_name + { + txt = qtn_sm_bookmark_name; + } + +RESOURCE LBUF r_qtn_sm_bookmarks + { + txt = qtn_sm_bookmarks; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Group/WPWAPAdapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Group/WPWAPAdapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2002-2006 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 the WPWAPAdapter. +* +*/ + + +#include +#include +#include "../../bld/ProvisioningUIDs.h" +#include "../Inc/WPWAPDebug.h" + +TARGET wpwapadapter.dll +TARGETTYPE PLUGIN +UID KProvisioningWAPAdapterDllUid2 KProvisioningWAPAdapterDllUid3 + + +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../Src +SOURCE CWPWAPAdapterBase.cpp +SOURCE CWPWAPMMSAdapter.cpp +SOURCE CWPWAPMMSItem.cpp +SOURCE CWPWAPBookmarkItem.cpp +SOURCE CWPWAPItemBAse.cpp +SOURCE WPWAPUtil.cpp +SOURCE WPWAPItemFactory.cpp +SOURCE WPWAPAdapterGroupProxy.cpp +SOURCE WPWAPAdapterMain.cpp + +SOURCEPATH ../Data +START RESOURCE 101F84DC.rss +TARGET wpwapadapter.rsc +END + +START RESOURCE WPWAPAdapterResource.rss +HEADER +TARGET wpwapadapterresource.rsc +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + +USERINCLUDE ../Inc ../Group ../../bld + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib +LIBRARY provisioningengine.lib +LIBRARY msgs.lib +LIBRARY cmmanager.lib +LIBRARY commdb.lib +LIBRARY commonengine.lib +LIBRARY centralrepository.lib + +DEBUGLIBRARY flogger.lib + +#ifdef __MESSAGING_API_V2__ +LIBRARY mmsserversettings.lib +#endif +SMPSAFE diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,2 @@ +PRJ_MMPFILES +WPWAPAdapter.mmp \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/CWPWAPAdapterBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/CWPWAPAdapterBase.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,112 @@ +/* +* 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: +* Base for WAP adapters. +* +*/ + + +#ifndef CWPWAPADAPTERBASE_H +#define CWPWAPADAPTERBASE_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CWPCharacteristic; +class MWPWAPItemBase; +class CCommsDatabase; +class RCmConnectionMethodExt; +class RCmManagerExt; + +// CLASS DECLARATION + +/** + * CWPWAPAdapterBase is a base for WAP adapters. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class CWPWAPAdapterBase : public CWPAdapter, private MWPContextExtension + { + public: // Constructors and destructor + + /** + * Destructor. + */ + ~CWPWAPAdapterBase(); + + public: // from CWPAdapter + + TInt ItemCount() const; + const TDesC16& SummaryTitle(TInt aIndex) const; + const TDesC16& SummaryText(TInt aIndex) const; + void SaveL( TInt aItem ); + TBool CanSetAsDefault( TInt aItem ) const; + void SetAsDefaultL( TInt aItem ); + TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); + void VisitL(CWPCharacteristic& aElement); + void VisitL(CWPParameter& aElement); + void VisitLinkL(CWPCharacteristic& aCharacteristic ); + TInt ContextExtension( MWPContextExtension*& aExtension ); + + public: // from MWPContextExtension + virtual const TDesC8& SaveDataL( TInt aIndex ) const; + virtual void DeleteL( const TDesC8& aSaveData ); + TUint32 Uid() const; + + public: // New methods + /** + * Handles one application characteristic. + * @param aCharacteristic The application characteristic + */ + virtual void ApplicationL( CWPCharacteristic& aCharacteristic ) = 0; + + protected: // New functions + /** + * C++ default constructor. + */ + CWPWAPAdapterBase(); + + /** + * 2nd phase base constructor. Derived classes must call this. + */ + void BaseConstructL(); + + /** + * Create CCommsDatabase and APEngine if NULL. + */ + void CreateDbL(); + + protected: // Data + // The application if of the current characteristic + TPtrC iAppID; + + // The visible setting items. Owns. + RPointerArray iItems; + + // The hidden setting items. Owns. + RPointerArray iHiddenItems; + + // Comms database for saving. Owns. + CCommsDatabase* iCommsDb; + + // APEngine for saving. Owns. + RCmManagerExt* iCmManager; + }; + +#endif // CWPWAPADAPTERBASE_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/CWPWAPBookmarkItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/CWPWAPBookmarkItem.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2002-2006 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: One bookmark item in browser settings. +* +*/ + + +#ifndef CWPWAPBOOKMARKITEM_H +#define CWPWAPBOOKMARKITEM_H + +// INCLUDES +#include +#include + +#include "CWPWAPItemBAse.h" + + +// FORWARD DECLARATIONS +class CBookmarkDb; + +// CLASS DECLARATION + +/** + * CWPWAPBookmarkItem handles one bookmark item in browser settings. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class CWPWAPBookmarkItem : public CBase, public MWPWAPItemBase, private MWPVisitor + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aTitle The title to be returned in Name(). + * @param aDefaultName The default name for bookmarks. + * @param aCharacteristic The RESOURCE characteristic. + * @param aLink Link to NAPDEF + * @param aDb The bookmark database to use. Created if NULL. + * @return CWPWAPBookmarkItem instance + */ + static CWPWAPBookmarkItem* NewL( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CWPCharacteristic*& aLink + ); + + + /** + * Destructor. + */ + ~CWPWAPBookmarkItem(); + + public: // From MWPMMSItemBase + + const TDesC& Name() const; + const TDesC& Title() const; + TBool CanSetAsDefault() const; + void SaveL(); + void SetAsDefaultL(); + TBool ValidateL(); + void AddL( RPointerArray& aShownItems, + RPointerArray& aHiddenItems ); + const TDesC8& SaveData() const; + const TDesC& Address() const; + + public: // From MWPVisitor + + void VisitL(CWPCharacteristic& aCharacteristic); + void VisitL(CWPParameter& aParameter); + void VisitLinkL(CWPCharacteristic& aCharacteristic ); + + private: // New functions + /** + * C++ constructor. + * @param aTitle The title to be returned in Name(). + * @param aDefaultName The default name for bookmarks. + * @param aLink Link to access point + * @param aDb The bookmark database to use. Created if NULL. + */ + CWPWAPBookmarkItem( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic*& aLink + ); + + /** + * By default Symbian 2nd phase constructor is private. + * @param aCharacteristic The RESOURCE characteristic + * to scan. + */ + void ConstructL( CWPCharacteristic& aCharacteristic ); + + /** + * Create the bookmarks db. + */ + void CreateDbL(); + + private: + // The title for bookmark items + const TDesC& iTitle; + + // The default name for bookmarks. + const TDesC& iDefaultName; + + // The access point characteristic. Refs. + CWPCharacteristic*& iLink; + + // The name of the bookmark + TPtrC iName; + + // The URI of the bookmark + TPtrC iURI; + + // Startpage parameter + TBool iHasStartPage; + + //RFavouritesDb iBookmarkDb; + //RFavouritesSession iSession; + + // Access point uid. + TUint32 iUID; + + // UIDs of the saved items + TPckgBuf iSaveItem; + }; + +#endif // CWPWAPBOOKMARKITEM_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/CWPWAPBrowserAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/CWPWAPBrowserAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2002-2006 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: Handles browser settings in provisioning. +* +*/ + + +#ifndef CWPWAPBROWSERADAPTER_H +#define CWPWAPBROWSERADAPTER_H + +// INCLUDES +#include "CWPWAPAdapterBase.h" + +#include +#include + + +// FORWARD DECLARATIONS +class CWPCharacteristic; +class CBookmarkDb; +// CLASS DECLARATION + +/** + * CWPWAPBrowserAdapter handles browser settings. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class CWPWAPBrowserAdapter : public CWPWAPAdapterBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return CWPWAPBrowserAdapter instance + */ + static CWPWAPBrowserAdapter* NewL(); + + /** + * Destructor. + */ + ~CWPWAPBrowserAdapter(); + + public: // from CWPWAPAdapterBase + + void ApplicationL( CWPCharacteristic& aCharacteristic ); + void DeleteL( const TDesC8& aSaveData ); + + private: // New functions + /** + * C++ default constructor. + */ + CWPWAPBrowserAdapter(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Create the bookmarks db. + */ + void CreateDbL(); + + private: // Data + // Title for browser items. Owns. + HBufC* iTitle; + + // Title for bookmarks. Owns. + HBufC* iBookmarkTitle; + + // Default name for browser items. Owns. + HBufC* iDefaultName; + + // Default name for bookmarks. Owns. + HBufC* iDefaultBookmarkName; + + // ETrue if one browser application has been processed. + TBool iProcessed; + + // Favourites database. Owns. + CBookmarkDb* iBookmarkDb; + + RFavouritesSession iSession; + + RFavouritesDb iFavouritesDb; + }; + +#endif // CWPWAPBROWSERADAPTER_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/CWPWAPBrowserItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/CWPWAPBrowserItem.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2002-2006 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: Setting item for browser settings. +* +*/ + + +#ifndef CWPWAPBROWSERITEM_H +#define CWPWAPBROWSERITEM_H + +// INCLUDES +#include +#include +#include +#include "CWPWAPItemBAse.h" + +// FORWARD DECLARATIONS +class MWPWAPItemBase; +class CBookmarkDb; +class RCmManagerExt; +// CLASS DECLARATION + +/** + * CWPWAPBrowserItem handles one browser setting. + * + * @lib WPWAPAdapter + * @since 2.0 + */ + + +class CWPWAPBrowserItem : public CWPWAPItemBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aFirst ETrue if this browser item is first + * @param aTitle Title for browser items + * @param aBookmarkTitle Title for bookmark items + * @param aDefaultName Default name for browser items + * @param aDefaultBookmarkName Default name for bookmarks. + * @param aCharacteristic The APPLICATION characteristic + * @param aCommsDb The CommsDB to use. Created if NULL. + * @param aAPHandler The APEngine data handler to use. Created if NULL. + * @param aBookmarkDb The bookmark database to use. Created if NULL. + * @return CWPWAPBrowserItem instance + */ + static CWPWAPBrowserItem* NewL( TBool aFirst, + const TDesC& aTitle, + const TDesC& aBookmarkTitle, + const TDesC& aDefaultName, + const TDesC& aDefaultBookmarkName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager + ); + + /** + * Destructor. + */ + ~CWPWAPBrowserItem(); + + public: // From CWPMMSItemBase + + TBool CanSetAsDefault() const; + void SaveL(); + void SetAsDefaultL(); + TBool ValidateL(); + void ResourceL( CWPCharacteristic& aResource ); + void AddL( RPointerArray& aShownItems, + RPointerArray& aHiddenItems ); + + private: // New functions + /** + * C++ default constructor. + * @see CWPWAPBrowserItem::NewL() for description of parameters. + */ + CWPWAPBrowserItem( TBool aFirst, + const TDesC& aTitle, + const TDesC& aBookmarkTitle, + const TDesC& aDefaultName, + const TDesC& aDefaultBookmarkName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager, + ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + // The bookmarks. Owns. + RPointerArray iBookmarks; + + // The default name for bookmarks. + const TDesC& iDefaultBookmarkName; + + // The title for bookmarks + const TDesC& iBookmarkTitle; + + //RFavouritesDb iDb; + + // ETrue if this browser item is first in list. + TBool iFirst; + }; + +#endif // CWPWAPBROWSERITEM_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/CWPWAPItemBAse.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/CWPWAPItemBAse.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,144 @@ +/* +* 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: +* Base class for WAP setting items. +* +*/ + + +#ifndef CWPWAPITEMBASE_H +#define CWPWAPITEMBASE_H + +// INCLUDES +#include +#include +#include "MWPWAPItemBase.h" +#include +#include + +// FORWARD DECLARATIONS +class CCommsDatabase; + + +// CLASS DECLARATION + +/** + * CWPWAPItemBase is a base class for browser settings. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class CWPWAPItemBase : public CBase, private MWPVisitor, public MWPWAPItemBase + { + public: // Constructors and destructor + + /** + * Destructor. + */ + ~CWPWAPItemBase(); + + public: // From MWPVisitor + + void VisitL(CWPCharacteristic& aCharacteristic); + void VisitL(CWPParameter& aParameter); + void VisitLinkL(CWPCharacteristic& aCharacteristic ); + + public: // From MWPWAPItemBase + + const TDesC& Name() const; + const TDesC& Title() const; + const TDesC& Address() const; + const TDesC8& SaveData() const; + + protected: // New methods + /** + * C++ default constructor. + * @param aTitle Title for items + * @param aDefaultName Default name for items + * @param aCharacteristic The APPLICATION characteristic + * @param aCommsDb The CommsDB to use. Created if NULL. + * @param aAPHandler The APEngine data handler to use. Created if NULL. + */ + CWPWAPItemBase( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager); + + /** + * 2nd phase base constructor. Derived classes must call this. + */ + void BaseConstructL(); + + /** + * Handles one resource item. + * @param aResource The RESOURCE item + */ + virtual void ResourceL( CWPCharacteristic& aResource ) = 0; + + /** + * Create CCommsDatabase and APEngine if NULL. + */ + void CreateDbL(); + + /** + * Writes a home page to an access point. If access point already + * has a home page, create a new one. + * @param aItem Access point to access + */ + void WriteHomePageL( RCmConnectionMethodExt& aCmItem ); + + /** + * Create a valid name for the access point. + * @param aName The base name for access point + * @param aDb CommsDb instance + */ + void MakeValidNameL( TDes& aName, CCommsDatabase& aDb ) const; + + protected: + // The parent characteristic. Refs. + CWPCharacteristic& iCharacteristic; + + // The preferred access point name + TPtrC iName; + + // The access point address, Owns. + HBufC* iAddr; + + // The UID of the access point + TUint32 iUID; + + // UID of the saved item + TPckgBuf iSaveItem; + + // Temporary current proxy while visiting. Refs. + CWPCharacteristic* iLink; + + // Text to return in SummaryTitle(). + const TDesC& iTitle; + + // Default name of access point. + const TDesC& iDefaultName; + + // Comms db. Refs. + CCommsDatabase*& iCommsDb; + + // @var Pointer to Connection Method Manager that is required to access + // Access Point data + RCmManagerExt*& iCmManager; + }; + +#endif // CWPWAPITEMBASE_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/CWPWAPMMSAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/CWPWAPMMSAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,76 @@ +/* +* 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: +* Handles MMS settings in provisioning. +* +*/ + + +#ifndef CWPWAPMMSADAPTER_H +#define CWPWAPMMSADAPTER_H + +// INCLUDES +#include "CWPWAPAdapterBase.h" + +// FORWARD DECLARATIONS +class CWPCharacteristic; + +// CLASS DECLARATION + +/** + * CWPWAPMMSAdapter handles MMS settings. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class CWPWAPMMSAdapter : public CWPWAPAdapterBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CWPWAPMMSAdapter* NewL(); + + /** + * Destructor. + */ + ~CWPWAPMMSAdapter(); + + public: // from CWPWAPAdapterBase + + void ApplicationL( CWPCharacteristic& aCharacteristic ); + + private: // New functions + /** + * C++ default constructor. + */ + CWPWAPMMSAdapter(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + // Title for MMS items. Owns. + HBufC* iTitle; + + // Default name for MMS items. Owns. + HBufC* iDefaultName; + }; + +#endif // CWPWAPMMSADAPTER_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/CWPWAPMMSItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/CWPWAPMMSItem.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,106 @@ +/* +* 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: +* Setting item for MMS settings. +* +*/ + + +#ifndef CWPWAPMMSITEM_H +#define CWPWAPMMSITEM_H + +// INCLUDES +#include +#include +#include "CWPWAPItemBAse.h" + +// FORWARD DECLARATIONS +class CBookmarkDb; +class RCmManagerExt; + +// CLASS DECLARATION + +/** + * CWPWAPMMSItem contains one MMS setting. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class CWPWAPMMSItem : public CWPWAPItemBase, private MMsvSessionObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aTitle Title for MMS items + * @param aDefaultName Default name for MMS items + * @param aCharacteristic The APPLICATION characteristic + * @param aCommsDb The CommsDB to use. Created if NULL. + * @param aAPHandler The APEngine data handler to use. Created if NULL. + */ + static CWPWAPMMSItem* NewL( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager); + + /** + * Destructor. + */ + ~CWPWAPMMSItem(); + + public: // From CWPWAPMMSItemBase + + TBool CanSetAsDefault() const; + void SaveL(); + void SetAsDefaultL(); + TBool ValidateL(); + void ResourceL( CWPCharacteristic& aResource ); + void AddL( RPointerArray& aShownItems, + RPointerArray& aHiddenItems ); + void VisitLinkL( CWPCharacteristic& aCharacteristic ); + + private: // from MMsvSessionObserver + + void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); + + private: // New functions + /** + * C++ default constructor. + * @see CWPWAPMMSItem::NewL() for description of parameters. + */ + CWPWAPMMSItem( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + + private: // Data + // The bookmarks database. Refs. + CBookmarkDb* iDb; + + // The potential links + RPointerArray iLinks; + }; + +#endif // CWPWAPMMSITEM_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/MWPWAPItemBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/MWPWAPItemBase.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,122 @@ +/* +* 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: +* Base class for WAP setting items. +* +*/ + + +#ifndef MWPWAPITEMBASE_H +#define MWPWAPITEMBASE_H + +// INCLUDES +#include + +// CONSTANTS +const TUint32 KWPWAPNoUID = 0; +const TUint32 KWPWAPItemTypeNone = 0; +const TUint32 KWPWAPItemTypeBookmark = 1; +const TUint32 KWPWAPItemTypeAccesspoint = 2; + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** + * MWPWAPItemBase is a base class for wap settings. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class MWPWAPItemBase + { + public: + struct TWPWAPSaveItem + { + TUint32 iSaveItemType; + TUint32 iUID; + }; + + public: // Constructors and destructor + + /** + * Destructor. + */ + virtual ~MWPWAPItemBase() {}; + + public: // New functions + + /** + * Returns the name of the item to be returned in + * SummaryText(). + * @return Name of the item + */ + virtual const TDesC& Name() const = 0; + + /** + * Returns the title of the item to be returned in + * SummaryTitle(). + * @return Name of the item + */ + virtual const TDesC& Title() const = 0; + + /** + * Returns the address of the service pointed by + * the item. + * @return Address of the service + */ + virtual const TDesC& Address() const = 0; + + /** + * Saves the item. Call BaseSaveL() in beginning. + */ + virtual void SaveL() = 0; + + /** + * Returns ETrue if the item can be saved as + * default setting. + * @return Whether the item can be made default + */ + virtual TBool CanSetAsDefault() const = 0; + + /** + * Sets the item as default setting. + */ + virtual void SetAsDefaultL() = 0; + + /** + * Returns ETrue if the item is valid. + * @return ETrue if valid + */ + virtual TBool ValidateL() = 0; + + /** + * Adds the item and its children to a list of items. + * @param aShownItems The list of shown items to be appended to + * @param aHiddenItems The list of hidden items to be appended to + */ + virtual void AddL( RPointerArray& aShownItems, + RPointerArray& aHiddenItems ) = 0; + + /** + * Returns the ID of the saved item. + * @return ID of the saved item, or KWPWAPNoUID + */ + virtual const TDesC8& SaveData() const = 0; + + }; + +#endif // MWPWAPITEMBASE_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/WPWAPDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/WPWAPDebug.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,45 @@ +/* +* 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: +* WPWAPDebug contains debug macros. +* +*/ + + +#ifndef WPWAPDEBUG_H +#define WPWAPDEBUG_H + +// MACROS + +// Define this to enable debug output +//#define WAPDEBUG + +// DEBUG can be used for outputting debug +#ifdef WAPDEBUG +#define DEBUG(TEXT) Debug( _L(#TEXT) ); +#define DVA(TEXT, ARG1) Debug( _L(#TEXT), (ARG1) ); +#define DVA2(TEXT, ARG1, ARG2) Debug( _L(#TEXT), (ARG1), (ARG2) ); +#define DVA3(TEXT, ARG1, ARG2, ARG3) Debug( _L(#TEXT), (ARG1), (ARG2), (ARG3) ); +#else +#define DEBUG(TEXT) +#define DVA(TEXT, ARG1) +#define DVA2(TEXT, ARG1, ARG2) +#define DVA3(TEXT, ARG1, ARG2, ARG3) +#endif + +#if defined(__WINS__) || defined(__EPOC32__) +GLDEF_C void Debug( TRefByValue aText, ...); +#endif + +#endif /* WPWAPDEBUG_H */ diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/WPWAPItemFactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/WPWAPItemFactory.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2002-2006 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: Factory for WAP items. +* +*/ + + +#ifndef WPITEMFACTORY_H +#define WPITEMFACTORY_H + +// INCLUDE FILES +#include + +// FORWARD DECLARATIONS +class MWPWAPItemBase; +class CWPCharacteristic; +class CCommsDatabase; +class RCmConnectionMethodExt; +class RCmDestinationExt; +class CBookmarkDb; + +// CLASS DECLARATION +class RCmManagerExt; +/** + * WPWAPItemFactory is a factory for all WAP items. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class WPWAPItemFactory + { + public: + /** + * Create an MMS item. + * @param aTitle Title for MMS items + * @param aDefaultName Default name for MMS items + * @param aCharacteristic The APPLICATION characteristic + * @param aCommsDb The CommsDB to use. Created if NULL. + * @param aAPHandler The APEngine data handler to use. Created if NULL. + * @return MWPWAPItemBase instance + */ + static MWPWAPItemBase* CreateMMSLC( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager ); + + + /** + * Create a browser item. + * @param aFirst ETrue if this browser item is first + * @param aTitle Title for browser items + * @param aBookmarkTitle Title for bookmark items + * @param aDefaultName Default name for browser items + * @param aCharacteristic The APPLICATION characteristic + * @param aDb The CommsDB to use. Created if NULL. + * @param aAPHandler The APEngine data handler to use. Created if NULL. + * @param aBookmarkDb The bookmark database to use. Created if NULL. + * @return MWPWAPItemBase instance + */ + /*static MWPWAPItemBase* CreateBrowserLC( TBool aFirst, + const TDesC& aTitle, + const TDesC& aBookmarkTitle, + const TDesC& aDefaultName, + const TDesC& aDefaultBookmarkName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager, + RFavouritesDb aBookmarkDb ); + + /** + * Create a bookmark item. + * @param aTitle The title to be returned in Name(). + * @param aDefaultName The default name for bookmarks. + * @param aResource The RESOURCE characteristic. + * @param aLink Link to NAPDEF + * @param aDb The bookmark database to use. Created if NULL. + * @return MWPWAPItemBase instance + */ + static MWPWAPItemBase* CreateBookmarkLC( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aResource, + CWPCharacteristic*& aNapdef); + + }; + + +#endif // WPITEMFACTORY_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Inc/WPWAPUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Inc/WPWAPUtil.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,70 @@ +/* +* 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: +* Utility class for reading resource strings. +* +*/ + + +#ifndef WPWAPUTIL_H +#define WPWAPUTIL_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class RResourceFile; + +// CLASS DECLARATION + +/** + * WPWAPUtil is a utility class for reading resource strings. + * + * @lib WPWAPAdapter + * @since 2.0 + */ +class WPWAPUtil + { + public: // New functions + /** + * Loads a specified resource string from resource file. + * @param aResourceId is of a resource string. + * @return pointer to loaded descriptor. + */ + static HBufC* ReadHBufCL( TInt aResourceId ); + + /** + * Searches for the resource file with the correct language extension + * for the language of the current locale, or failing this, the best + * matching file. + * @param aFs reference to file server. + * @param aResFileName resource file name. + * @param aResFile reference to resource file. + */ + static void FindAndOpenResourceFileLC(RFs& aFs, + const TDesC& aResFileName, + RResourceFile& aResFile); + + /** + * Checks if a URL is valid. + * @param aURL the URL to check + * @return ETrue if the URL is valid + */ + static TBool CheckURI( const TDesC& aUrl ); + + }; + +#endif // WPWAPUTIL_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/CWPWAPAdapterBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/CWPWAPAdapterBase.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,261 @@ +/* +* 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: Base for WAP adapters. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include "CWPWAPItemBAse.h" +#include "CWPWAPAdapterBase.h" +#include "WPWAPDebug.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::CWPWAPAdapterBase +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPWAPAdapterBase::CWPWAPAdapterBase() + : CWPAdapter() + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::BaseConstructL +// 2nd phase base class constructor. +// ----------------------------------------------------------------------------- +// +void CWPWAPAdapterBase::BaseConstructL() + { + } + +// Destructor +CWPWAPAdapterBase::~CWPWAPAdapterBase() + { + iItems.ResetAndDestroy(); + iHiddenItems.ResetAndDestroy(); + delete iCommsDb; + + if ( iCmManager != NULL ) + { + iCmManager->Close(); + delete iCmManager; + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::SummaryCount +// ----------------------------------------------------------------------------- +// +TInt CWPWAPAdapterBase::ItemCount() const + { + return iItems.Count(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::SummaryTitle +// ----------------------------------------------------------------------------- +// +const TDesC16& CWPWAPAdapterBase::SummaryTitle(TInt aIndex) const + { + return iItems[aIndex]->Title(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::SummaryText +// ----------------------------------------------------------------------------- +// +const TDesC& CWPWAPAdapterBase::SummaryText(TInt aIndex) const + { + return iItems[aIndex]->Name(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::SaveL +// ----------------------------------------------------------------------------- +// +void CWPWAPAdapterBase::SaveL(TInt aIndex) + { + iItems[aIndex]->SaveL(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::CanSetAsDefault +// ----------------------------------------------------------------------------- +// +TBool CWPWAPAdapterBase::CanSetAsDefault(TInt aIndex) const + { + return iItems[aIndex]->CanSetAsDefault(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::SetAsDefaultL +// ----------------------------------------------------------------------------- +// +void CWPWAPAdapterBase::SetAsDefaultL(TInt aIndex) + { + iItems[aIndex]->SetAsDefaultL(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::DetailsL +// ----------------------------------------------------------------------------- +// +TInt CWPWAPAdapterBase::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ ) + { + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::VisitL +// ----------------------------------------------------------------------------- +// +void CWPWAPAdapterBase::VisitL( CWPCharacteristic& aCharacteristic ) + { + switch( aCharacteristic.Type() ) + { + case KWPApplication: + { + aCharacteristic.AcceptL( *this ); + ApplicationL( aCharacteristic ); + iAppID.Set( KNullDesC ); + break; + } + + default: + { + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::VisitL +// ----------------------------------------------------------------------------- +// +void CWPWAPAdapterBase::VisitL( CWPParameter& aParameter ) + { + if( aParameter.ID() == EWPParameterAppID ) + { + iAppID.Set( aParameter.Value() ); + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::VisitL +// ----------------------------------------------------------------------------- +// +void CWPWAPAdapterBase::VisitLinkL( CWPCharacteristic& /*aLink*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::ContextExtension +// ----------------------------------------------------------------------------- +// +TInt CWPWAPAdapterBase::ContextExtension( MWPContextExtension*& aExtension ) + { + aExtension = this; + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::SaveDataL +// ----------------------------------------------------------------------------- +// +const TDesC8& CWPWAPAdapterBase::SaveDataL( TInt aIndex ) const + { + return iItems[aIndex]->SaveData(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::DeleteL +// ----------------------------------------------------------------------------- +// +void CWPWAPAdapterBase::DeleteL( const TDesC8& aSaveData ) + { + CreateDbL(); + + TPckgBuf pckg; + pckg.Copy( aSaveData ); + + // Base class handles only access point deletion + if( pckg().iSaveItemType == KWPWAPItemTypeAccesspoint ) + { + DVA( "DeleteL: Deleting access point %08x", pckg().iUID ); + TRAPD( err, iCmManager->ConnectionMethodL( pckg().iUID).DeleteL()); + DVA( "DeleteL: Deleted, %d", err ); + + switch( err ) + { + case KErrNotFound: + { + // Item not existing is what we want, so this error is ok + break; + } + + case KErrLocked: + { + // Transform the code so that the caller can retry + User::Leave( EWPCommsDBLocked ); + break; + } + + default: + { + User::LeaveIfError( err ); + break; + } + } + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::Uid +// ----------------------------------------------------------------------------- +// +TUint32 CWPWAPAdapterBase::Uid() const + { + return iDtor_ID_Key.iUid; + } + +// ----------------------------------------------------------------------------- +// CWPWAPAdapterBase::CreateDbL +// ----------------------------------------------------------------------------- +// +void CWPWAPAdapterBase::CreateDbL() + { + if( !iCommsDb ) + { + iCommsDb = CCommsDatabase::NewL(); + } + iCmManager = new RCmManagerExt; + iCmManager->OpenL(); + + + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/CWPWAPBookmarkItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/CWPWAPBookmarkItem.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,268 @@ +/* +* Copyright (c) 2002-2006 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: One bookmark item. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include "CWPWAPBookmarkItem.h" +#include "WPWAPUtil.h" + +// CONSTANTS +const TInt KUrlMaxLength = 255; +const TInt KNameMaxLength = 50; + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::CWPWAPBookmarkItem +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPWAPBookmarkItem::CWPWAPBookmarkItem( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic*& aLink) +: iTitle( aTitle ), iDefaultName( aDefaultName ), iLink( aLink ) + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPWAPBookmarkItem::ConstructL( CWPCharacteristic& aCharacteristic ) + { + aCharacteristic.AcceptL( *this ); + if( iName == KNullDesC ) + { + iName.Set( iDefaultName ); + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPWAPBookmarkItem* CWPWAPBookmarkItem::NewL( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CWPCharacteristic*& aLink) + { + CWPWAPBookmarkItem* self = new(ELeave) CWPWAPBookmarkItem( aTitle, + aDefaultName, aLink); + CleanupStack::PushL(self); + self->ConstructL( aCharacteristic ); + CleanupStack::Pop(self); + return self; + } + +// Destructor +CWPWAPBookmarkItem::~CWPWAPBookmarkItem() + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::Name +// ----------------------------------------------------------------------------- +// +const TDesC& CWPWAPBookmarkItem::Name() const + { + return iName; + } + + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::Title +// ----------------------------------------------------------------------------- +// +const TDesC& CWPWAPBookmarkItem::Title() const + { + return iTitle; + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::Title +// ----------------------------------------------------------------------------- +// +const TDesC& CWPWAPBookmarkItem::Address() const + { + return iURI; + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::SaveID +// ----------------------------------------------------------------------------- +// +const TDesC8& CWPWAPBookmarkItem::SaveData() const + { + if( iSaveItem().iSaveItemType != KWPWAPItemTypeNone ) + { + return iSaveItem; + } + else + { + return KNullDesC8; + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::AddL +// ----------------------------------------------------------------------------- +// +void CWPWAPBookmarkItem::AddL( RPointerArray& aShownItems, + RPointerArray& /*aHiddenItems*/ ) + { + User::LeaveIfError( aShownItems.Append( this ) ); + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::SaveL +// ----------------------------------------------------------------------------- +// +void CWPWAPBookmarkItem::SaveL() + { + TPckgBuf uid; + if( iLink && iLink->Data().Length() == uid.MaxLength() ) + { + uid.Copy( iLink->Data() ); + iUID = uid(); + } + + CreateDbL(); + + //CFavouritesItem* item = CFavouritesItem::NewL(); + //CleanupStack::PushL( item ); + + //item->SetType( CFavouritesItem::EItem ); + //item->SetParentFolder( KFavouritesRootUid ); + //item->SetNameL( iName ); + //item->SetUrlL( iURI ); + + //if( iUID != KWPWAPNoUID ) + // { + // TFavouritesWapAp ap; + // ap.SetApId( iUID ); + // item->SetWapAp( ap ); + // } + //TInt err( iBookmarkDb.Add( *item, ETrue ) ); + //if( err == KErrLocked ) + // { + // err = EWPBookmarksLocked; + // } + //User::LeaveIfError( err ); + //iSaveItem().iSaveItemType = KWPWAPItemTypeBookmark; + //iSaveItem().iUID = item->Uid(); + + CleanupStack::PopAndDestroy(); // item + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::CanSetAsDefault +// ----------------------------------------------------------------------------- +// +TBool CWPWAPBookmarkItem::CanSetAsDefault() const + { + // Startpage support. This can be set as default if this is to be + // interpreted as startpage. + return iHasStartPage; + } + + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::SetAsDefaultL +// ----------------------------------------------------------------------------- +// +void CWPWAPBookmarkItem::SetAsDefaultL() + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::ValidateL +// ----------------------------------------------------------------------------- +// +TBool CWPWAPBookmarkItem::ValidateL() + { + return iURI.Length() <= KUrlMaxLength + && iName.Length() <= KNameMaxLength + && iURI.Length() > 0 + && WPWAPUtil::CheckURI( iURI ); + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::VisitL +// ----------------------------------------------------------------------------- +// +void CWPWAPBookmarkItem::VisitL( CWPCharacteristic& /*aCharacteristic*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::VisitL +// ----------------------------------------------------------------------------- +// +void CWPWAPBookmarkItem::VisitL( CWPParameter& aParameter ) + { + switch( aParameter.ID() ) + { + case EWPParameterURI: + { + iURI.Set( aParameter.Value() ); + break; + } + + case EWPParameterName: + { + iName.Set( aParameter.Value() ); + break; + } + + case EWPParameterStartPage: + { + iHasStartPage = ETrue; + break; + } + default: + { + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::VisitL +// ----------------------------------------------------------------------------- +// +void CWPWAPBookmarkItem::VisitLinkL( CWPCharacteristic& /*aLink*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPBookmarkItem::CreateDbL +// ----------------------------------------------------------------------------- +// +void CWPWAPBookmarkItem::CreateDbL() + { + //User::LeaveIfError( iSession.Connect() ); + //User::LeaveIfError( iBookmarkDb.Open( iSession, KBrowserBookmarks ) ); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/CWPWAPBrowserAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/CWPWAPBrowserAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2002-2006 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: Handles browser settings in provisioning. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include "CWPWAPBrowserAdapter.h" +#include "MWPWAPItemBase.h" +#include "WPWAPItemFactory.h" +#include "WPWAPUtil.h" +#include "WPWAPDebug.h" + +// CONSTANTS +_LIT( KBrowserAppID, "w2" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserAdapter::CWPWAPBrowserAdapter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPWAPBrowserAdapter::CWPWAPBrowserAdapter() + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserAdapter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserAdapter::ConstructL() + { + BaseConstructL(); + + iTitle = WPWAPUtil::ReadHBufCL( R_QTN_OP_HEAD_BROWSER ); + iBookmarkTitle = WPWAPUtil::ReadHBufCL( R_QTN_SM_BOOKMARKS ); + iDefaultName = WPWAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME ); + iDefaultBookmarkName = WPWAPUtil::ReadHBufCL( R_QTN_SM_BOOKMARK_NAME ); + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserAdapter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPWAPBrowserAdapter* CWPWAPBrowserAdapter::NewL() + { + CWPWAPBrowserAdapter* self = new(ELeave) CWPWAPBrowserAdapter; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// Destructor +CWPWAPBrowserAdapter::~CWPWAPBrowserAdapter() + { + delete iTitle; + delete iBookmarkTitle; + delete iDefaultName; + delete iDefaultBookmarkName; + iFavouritesDb.Close(); + iSession.Close(); + } + + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserAdapter::ApplicationL +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserAdapter::ApplicationL( CWPCharacteristic& aCharacteristic ) + { + if( iAppID == KBrowserAppID ) + { + MWPWAPItemBase* item = WPWAPItemFactory::CreateBrowserLC( !iProcessed, *iTitle, + *iBookmarkTitle, *iDefaultName, *iDefaultBookmarkName, + aCharacteristic, iCommsDb, iCmManager, iFavouritesDb ); + + if( item->ValidateL() ) + { + iProcessed = ETrue; + item->AddL( iItems, iHiddenItems ); + CleanupStack::Pop(); // item + } + else + { + CleanupStack::PopAndDestroy(); // item + } + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserAdapter::DeleteL +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserAdapter::DeleteL( const TDesC8& aSaveData ) + { + CreateDbL(); + + TPckgBuf item; + item.Copy( aSaveData ); + + switch( item().iSaveItemType ) + { + case KWPWAPItemTypeAccesspoint: + { + // Access point deletion is handled by the base class + CWPWAPAdapterBase::DeleteL( aSaveData ); + break; + } + + case KWPWAPItemTypeBookmark: + { + DVA( "DeleteL: Deleting bookmark %08x", item().iUID ); + TInt err = iFavouritesDb.Begin( ETrue ); + iFavouritesDb.CleanupRollbackPushL(); // push a rollback + + DVA( "DeleteL: Transaction, %d", err ); + if( err == KErrNone ) + { + err = iFavouritesDb.Delete( item().iUID ); + DVA( "DeleteL: Deleted, %d", err ); + iFavouritesDb.Commit(); + DEBUG( "DeleteL: Committed" ); + } + CleanupStack::Pop(); // pop the rollback + + switch( err ) + { + case KErrNotFound: + { + // Item not existing is what we want, so this error is ok + break; + } + + case KErrLocked: + { + User::Leave( EWPBookmarksLocked ); + break; + } + + default: + { + User::LeaveIfError( err ); + break; + } + } + break; + } + + default: + { + // Don't know how to delete an item of this type. Better + // just ignore it. + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserAdapter::CreateDbL +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserAdapter::CreateDbL() + { + User::LeaveIfError( iSession.Connect() ); + User::LeaveIfError( iFavouritesDb.Open( iSession, KBrowserBookmarks ) ); + + CWPWAPAdapterBase::CreateDbL(); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/CWPWAPBrowserItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/CWPWAPBrowserItem.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,268 @@ +/* +* Copyright (c) 2002-2006 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: One browser setting item. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include "CWPWAPBrowserItem.h" +#include "WPWAPItemFactory.h" +#include "ProvisioningDebug.h" + +// CONSTANTS +/// Delay to wait for WmlBrowser to catch up with changes in CommsDb. Microseconds. +const TInt KWmlDelay = 4*500000; +// Force browser to use User Defined AP +const TInt KUserDefined = 0; + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::CWPWAPBrowserItem +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPWAPBrowserItem::CWPWAPBrowserItem( TBool aFirst, + const TDesC& aTitle, + const TDesC& aBookmarkTitle, + const TDesC& aDefaultName, + const TDesC& aDefaultBookmarkName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager, + RFavouritesDb aBookmarkDb + ) + : CWPWAPItemBase( aTitle, + aDefaultName, + aCharacteristic, + aCommsDb, + aCmManager ), + iDefaultBookmarkName( aDefaultBookmarkName ), + iBookmarkTitle( aBookmarkTitle ), + iDb( aBookmarkDb ), + iFirst( aFirst ) + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserItem::ConstructL() + { + BaseConstructL(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPWAPBrowserItem* CWPWAPBrowserItem::NewL( TBool aFirst, + const TDesC& aTitle, + const TDesC& aBookmarkTitle, + const TDesC& aDefaultName, + const TDesC& aDefaultBookmarkName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager, + RFavouritesDb aBookmarkDb + ) + { + CWPWAPBrowserItem* self = new(ELeave) CWPWAPBrowserItem( aFirst, + aTitle, + aBookmarkTitle, + aDefaultName, + aDefaultBookmarkName, + aCharacteristic, + aCommsDb, + aCmManager, + aBookmarkDb ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CWPWAPBrowserItem::~CWPWAPBrowserItem() + { + iBookmarks.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::SaveL +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserItem::SaveL() + { + CreateDbL(); + + TPckg uid( iUID ); + // Check if the iLink->Data() contains an item of the same size as uid. + // This is an extra check to ensure that iLink->Data() contains a packaged + // TUin32. + if( iLink && iLink->Data().Length() == uid.MaxLength() ) + { + uid.Copy( iLink->Data() ); + } + RCmConnectionMethodExt cm; + cm = iCmManager->ConnectionMethodL( iUID ); + CleanupClosePushL( cm ); + if( iAddr ) + { + // Update the access point startpage + WriteHomePageL( cm ); + } + CleanupStack::PopAndDestroy(); // cm + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::CanSetAsDefault +// ----------------------------------------------------------------------------- +// +TBool CWPWAPBrowserItem::CanSetAsDefault() const + { + return iUID != KWPWAPNoUID; + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::SetAsDefaultL +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserItem::SetAsDefaultL() + { + FLOG( _L( "[Provisioning] CWPWAPBrowserItem::SetAsDefaultL:" ) ); + + /* CreateDbL(); + TRAPD( err, iAPHandler->SetAsDefaultL( (TInt)iUID, EIspTypeWAPOnly) ); + if( err == KErrLocked ) + { + err = EWPCommsDBLocked; + } + // This function need to leave at the end of the function + // otherwise we dont set the default AP when db is locked + //User::LeaveIfError( err ); + + // There's some delay before the WmlBrowser can find the stored + // accesspoint from CommsDb so therefore we wait for a while before + // telling the WmlBrowser that default accesspoint should be changed. + // The value 500000 is chosen just by trying out. + User::After( KWmlDelay ); + + CRepository* repository = CRepository::NewLC( KCRUidBrowser ); + FTRACE(RDebug::Print( + _L("[Provisioning] CWPWAPBrowserItem::SetAsDefaultL: AP:(%d)"), + (TInt)iUID)); + + // Force the browser to use the User Defined AP selection mode. + User::LeaveIfError( repository->Set( KBrowserAccessPointSelectionMode, + KUserDefined ) ); + // This sets the accesspoint default for browser. + User::LeaveIfError( repository->Set( KBrowserDefaultAccessPoint, + (TInt)iUID ) ); + + //Set the HomePage to default + if(iUID) + { + User::LeaveIfError( repository->Set( KBrowserNGHomepageType, EBrowserCenRepAccessPoint) ); + } + + CleanupStack::PopAndDestroy(); // repository + FLOG( _L( "[Provisioning] CWPWAPBrowserItem::SetAsDefaultL: Set Done" ) ); + + User::LeaveIfError( err );*/ + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::ValidateL +// ----------------------------------------------------------------------------- +// +TBool CWPWAPBrowserItem::ValidateL() + { + return iLink != NULL; + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::ResourceL +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserItem::ResourceL( CWPCharacteristic& aResource ) + { + MWPWAPItemBase* item = WPWAPItemFactory::CreateBookmarkLC( + iBookmarkTitle, + iDefaultBookmarkName, + aResource, + iLink, + iDb ); + + if( item->CanSetAsDefault() && !iAddr ) + { + iAddr = item->Address().AllocL(); + CleanupStack::PopAndDestroy(); // item + } + else + { + User::LeaveIfError( iBookmarks.Append( item ) ); + CleanupStack::Pop(); // item + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPBrowserItem::AddL +// ----------------------------------------------------------------------------- +// +void CWPWAPBrowserItem::AddL( RPointerArray& aShownItems, + RPointerArray& aHiddenItems ) + { + for( TInt i( iBookmarks.Count()-1 ); i >= 0 ; i-- ) + { + MWPWAPItemBase* item = iBookmarks[i]; + + if( item->ValidateL() ) + { + // Transfer ownership of iBookmarks[i] to aItems + iBookmarks[i]->AddL( aShownItems, aHiddenItems ); + } + else + { + // invalid items get deleted + delete item; + } + iBookmarks.Remove( i ); + } + + // Only first browser item is shown to the user. + if( iFirst ) + { + User::LeaveIfError( aShownItems.Append( this ) ); + } + else + { + User::LeaveIfError( aHiddenItems.Append( this ) ); + } + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/CWPWAPItemBAse.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/CWPWAPItemBAse.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,303 @@ +/* +* 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: Base class for WAP setting items. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "CWPWAPItemBAse.h" +#include "ProvisioningDebug.h" +#include + +// CONSTANTS +const TInt KNamesGranularity = 1; +const TInt KNameMaxLength = 50; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::CWPWAPItemBase +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPWAPItemBase::CWPWAPItemBase( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager) + : iCharacteristic( aCharacteristic ), + iTitle( aTitle ), + iDefaultName( aDefaultName ), + iCommsDb( aCommsDb ), + iCmManager( aCmManager ) + { + + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::BaseConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPWAPItemBase::BaseConstructL() + { + iCharacteristic.AcceptL( *this ); + + if( iName == KNullDesC ) + { + iName.Set( iDefaultName ); + } + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CWPWAPItemBase::~CWPWAPItemBase() + { + delete iAddr; + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::VisitL +// ----------------------------------------------------------------------------- +// +void CWPWAPItemBase::VisitL( CWPCharacteristic& aCharacteristic ) + { + if( aCharacteristic.Type() == KWPResource ) + { + ResourceL( aCharacteristic ); + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::VisitL +// ----------------------------------------------------------------------------- +// +void CWPWAPItemBase::VisitL( CWPParameter& aParameter ) + { + switch( aParameter.ID() ) + { + case EWPParameterName: + { + iName.Set( aParameter.Value() ); + break; + } + + case EWPParameterAddr: + { + if( !iAddr ) + { + iAddr = aParameter.Value().AllocL(); + } + break; + } + + default: + { + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::VisitLinkL +// ----------------------------------------------------------------------------- +// +void CWPWAPItemBase::VisitLinkL( CWPCharacteristic& aLink ) + { + if( !iLink ) + { + iLink = &aLink; + + if( iName == KNullDesC ) + { + // Get the name + CArrayFix* names = new(ELeave) CArrayFixFlat( KNamesGranularity ); + CleanupStack::PushL( names ); + aLink.ParameterL( EWPParameterName, names ); + if( names->Count() > 0 ) + { + iName.Set( names->At(0) ); + } + CleanupStack::PopAndDestroy(); // names + } + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::Name +// ----------------------------------------------------------------------------- +// +const TDesC& CWPWAPItemBase::Name() const + { + return iName; + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::Title +// ----------------------------------------------------------------------------- +// +const TDesC& CWPWAPItemBase::Title() const + { + return iTitle; + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::Address +// ----------------------------------------------------------------------------- +// +const TDesC& CWPWAPItemBase::Address() const + { + if( iAddr ) + { + return *iAddr; + } + else + { + return KNullDesC; + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::SaveData +// ----------------------------------------------------------------------------- +// +const TDesC8& CWPWAPItemBase::SaveData() const + { + if( iSaveItem().iSaveItemType != KWPWAPItemTypeNone ) + { + return iSaveItem; + } + else + { + return KNullDesC8; + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::CreateDbL +// ----------------------------------------------------------------------------- +// +void CWPWAPItemBase::CreateDbL() + { + if( !iCommsDb ) + { + iCommsDb = CCommsDatabase::NewL(); + } + + if( !iCmManager ) + { + iCmManager = new RCmManagerExt; + iCmManager->OpenL(); + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::WriteHomePageL +// ----------------------------------------------------------------------------- +// +void CWPWAPItemBase::WriteHomePageL( RCmConnectionMethodExt& aCmItem ) + { + FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL:" ) ); + + if( iAddr ) + { + HBufC* startPage = aCmItem.GetStringAttributeL(CMManager::ECmStartPage); + TInt length = startPage->Length(); + delete startPage; + + if( length > 0 ) + { + FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL: EApWapStartPage " ) ); + // Make a copy of the AP + RCmConnectionMethodExt cm = aCmItem.CreateCopyL(); + CleanupClosePushL( cm ); + + // Create a proper name for the copy + TBuf name( iName.Left( KNameMaxLength ) ); + // MakeValidNameL( name, *iCommsDb ); + + + // Write name + cm.SetStringAttributeL(CMManager::ECmName,name); + //cm.SetStringAttributeL(CMManager::ENamingUnique,name); + + // Write MMSC address + cm.SetStringAttributeL(CMManager::ECmStartPage,*iAddr); + + // Create the new access point + TRAPD( err, cm.UpdateL() ); + + FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL err (%d)"), err)); + FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL iUID (%d)"), iUID)); + + if( err == KErrLocked ) + { + err = EWPCommsDBLocked; + } + User::LeaveIfError( err ); + + iSaveItem().iSaveItemType = KWPWAPItemTypeAccesspoint; + iUID = aCmItem.GetIntAttributeL(CMManager::ECmIapId); + iSaveItem().iUID = iUID; + + CleanupStack::PopAndDestroy(); // newItem + } + else + { + FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL: EApWapStartPage 0 " ) ); + aCmItem.SetStringAttributeL(CMManager::ECmStartPage,*iAddr); + + // Update the access point + TBool nameChanged( EFalse ); + TRAPD( err, aCmItem.UpdateL() ); + FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL err (%d)"), err)); + if( err == KErrLocked ) + { + err = EWPCommsDBLocked; + } + User::LeaveIfError( err ); + iUID = aCmItem.GetIntAttributeL(CMManager::ECmIapId); + FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL iUID (%d)"), iUID)); + } + } + } + +// ----------------------------------------------------------------------------- +// CWPWAPItemBase::MakeValidNameL +// ----------------------------------------------------------------------------- +// +void CWPWAPItemBase::MakeValidNameL( TDes& aName, CCommsDatabase& aDb ) const + { + /* CApUtils* utils = CApUtils::NewLC( aDb ); + utils->MakeValidNameL( aName ); + CleanupStack::PopAndDestroy(); // utils*/ + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/CWPWAPMMSAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/CWPWAPMMSAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,102 @@ +/* +* 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: Handles MMS settings in provisioning. +* +*/ + + + +// INCLUDE FILES +#include "CWPWAPMMSAdapter.h" +#include +#include +#include +#include +#include +#include "MWPWAPItemBase.h" +#include "WPWAPUtil.h" +#include "WPWAPItemFactory.h" + +// CONSTANTS +_LIT( KMMSAppID, "w4" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPWAPMMSAdapter::CWPWAPMMSAdapter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPWAPMMSAdapter::CWPWAPMMSAdapter() + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSAdapter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSAdapter::ConstructL() + { + BaseConstructL(); + + iTitle = WPWAPUtil::ReadHBufCL( R_QTN_SM_MMS_ACCESSPOINTS ); + iDefaultName = WPWAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME ); + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSAdapter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPWAPMMSAdapter* CWPWAPMMSAdapter::NewL() + { + CWPWAPMMSAdapter* self = new(ELeave) CWPWAPMMSAdapter; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// Destructor +CWPWAPMMSAdapter::~CWPWAPMMSAdapter() + { + delete iTitle; + delete iDefaultName; + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSAdapter::ApplicationL +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSAdapter::ApplicationL( CWPCharacteristic& aCharacteristic ) + { + if( iItems.Count() == 0 && iAppID == KMMSAppID ) + { + MWPWAPItemBase* item = WPWAPItemFactory::CreateMMSLC( *iTitle, *iDefaultName, + aCharacteristic, iCommsDb, iCmManager ); + if( item->ValidateL() ) + { + item->AddL( iItems, iHiddenItems ); + CleanupStack::Pop(); // item + } + else + { + CleanupStack::PopAndDestroy(); // item + } + } + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/CWPWAPMMSItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/CWPWAPMMSItem.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2002-2006 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: One MMS setting item. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "CWPWAPMMSItem.h" +#include "WPWAPItemFactory.h" +#include "WPWAPUtil.h" + +#ifdef __MESSAGING_API_V2__ +#include +#endif + +// CONSTANTS +const TInt KUrlMaxLength = 255; + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::CWPWAPMMSItem +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPWAPMMSItem::CWPWAPMMSItem( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aDb, + RCmManagerExt*& aCmManager ) +: CWPWAPItemBase( aTitle, aDefaultName, aCharacteristic, aDb, aCmManager ) + { + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSItem::ConstructL() + { + BaseConstructL(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPWAPMMSItem* CWPWAPMMSItem::NewL( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aDb, + RCmManagerExt*& aCmManager ) + { + CWPWAPMMSItem* self = new(ELeave) CWPWAPMMSItem( aTitle, aDefaultName, + aCharacteristic, aDb, aCmManager ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// Destructor +CWPWAPMMSItem::~CWPWAPMMSItem() + { + iLinks.Close(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::SaveL +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSItem::SaveL() + { + CreateDbL(); + TBool check = EFalse; + RCmConnectionMethodExt cm; + TUint32 bearer = 0; + for( TInt i( 0 ); i < iLinks.Count() && check == EFalse ; i++ ) + { + CWPCharacteristic* curr = iLinks[i]; + TPckgBuf uidPckg; + const TInt pkgLength( uidPckg.MaxLength() ); + for( TInt dataNum( 0 ); check == EFalse && curr->Data( dataNum ).Length() == pkgLength;dataNum++ ) + { + uidPckg.Copy( curr->Data( dataNum ) ); + // Read the access point pointed to by TO-NAPID or TO-PROXY + cm = iCmManager->ConnectionMethodL( uidPckg() ); + CleanupClosePushL( cm ); + bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); + if( bearer == KUidPacketDataBearerType ) + { + // Item left on cleanup stack + check = ETrue; + } + else + { + CleanupStack::PopAndDestroy(); // cm + } + } + } + + WriteHomePageL( cm ); + CleanupStack::PopAndDestroy(); // cm + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::CanSetAsDefault +// ----------------------------------------------------------------------------- +// +TBool CWPWAPMMSItem::CanSetAsDefault() const + { + return ETrue; + } + + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::SetAsDefaultL +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSItem::SetAsDefaultL() + { + // Open Messaging Server session + CMsvSession* session = CMsvSession::OpenSyncL( *this ); + CleanupStack::PushL( session ); + + // Read the MMS client information via registry + CClientMtmRegistry* registry = CClientMtmRegistry::NewL( *session ); + CleanupStack::PushL( registry ); + + CMmsClientMtm* mmsClient = + static_cast( registry->NewMtmL( KUidMsgTypeMultimedia ) ); + CleanupStack::PushL( mmsClient ); + +#ifdef __MESSAGING_API_V2__ + + CMmsSettings* mmsSettings = CMmsSettings::NewL(); + CleanupStack::PushL( mmsSettings ); + + mmsClient->RestoreSettingsL(); + + mmsSettings->CopyL( mmsClient->MmsSettings() ); + TInt apCount = mmsSettings->AccessPointCount(); + TInt index; + for ( index = 0; index < apCount; index++) + { + mmsSettings->DeleteAccessPointL( 0 ); + } + mmsSettings->AddAccessPointL( iUID, 0 ); + mmsClient->SetSettingsL( *mmsSettings ); + mmsClient->StoreSettingsL(); + + CleanupStack::PopAndDestroy(); // mmsSettings + +#else + + mmsClient->LoadMessageL(); + // Set the correct access point and save + mmsClient->SetFirstAccessPoint( iUID ); + mmsClient->SaveMessageL(); + +#endif + + CleanupStack::PopAndDestroy(3); // mmsClient, registry, session + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::ValidateL +// ----------------------------------------------------------------------------- +// +TBool CWPWAPMMSItem::ValidateL() + { + return iLinks.Count() > 0 + && iAddr + && iAddr->Length() <=KUrlMaxLength + && WPWAPUtil::CheckURI( *iAddr ); + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::ResourceL +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSItem::ResourceL( CWPCharacteristic& aResource ) + { + MWPWAPItemBase* item = WPWAPItemFactory::CreateBookmarkLC( KNullDesC, + KNullDesC, aResource, iLink ); // iDb is NULL but it's not used. + + // Not supporting resources without startpage. + if ( item->CanSetAsDefault() && !iAddr ) + { + iAddr = item->Address().AllocL(); + } + CleanupStack::PopAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::AddL +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSItem::AddL( RPointerArray& aShownItems, + RPointerArray& /*aHiddenItems*/ ) + { + User::LeaveIfError( aShownItems.Append( this ) ); + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::VisitLinkL +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSItem::VisitLinkL( CWPCharacteristic& aLink ) + { + CWPWAPItemBase::VisitLinkL( aLink ); + User::LeaveIfError( iLinks.Append( &aLink ) ); + } + +// ----------------------------------------------------------------------------- +// CWPWAPMMSItem::HandleSessionEventL +// ----------------------------------------------------------------------------- +// +void CWPWAPMMSItem::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, + TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) + { + } + + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/WPWAPAdapterGroupProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/WPWAPAdapterGroupProxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,46 @@ +/* +* 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: Table of plugins for ECom +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "ProvisioningUIDs.h" +#include "CWPWAPMMSAdapter.h" +//#include "CWPWAPBrowserAdapter.h" + +// CONSTANTS +const TImplementationProxy KImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KProvisioningMMSAdapterUid, CWPWAPMMSAdapter::NewL ) + }; + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); + + return KImplementationTable; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/WPWAPAdapterMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/WPWAPAdapterMain.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2002-2006 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: DLL entry point +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include "WPWAPDebug.h" + +// CONSTANTS + +#ifdef WAPDEBUG +#ifdef WINS +/// Folder where the log resides +_LIT( KLogFolder, "provisioning" ); + +/// The name of the log file +_LIT( KLogFileName, "wapadapter" ); + +/// The format in which the time is formatted in log +_LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d "); + +/// The length of the string produced by KLogTimeFormat +const TInt KLogTimeFormatLength = 16; + +/// How many characters a log line can contain +const TInt KLogLineLength = 256; +#endif +#endif + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// Debug +// ----------------------------------------------------------------------------- +// +#ifdef WAPDEBUG +GLDEF_C void Debug( TRefByValue aText, ... ) + { + #ifdef WINS + VA_LIST args; + VA_START( args, aText ); + + TBuf buf; + buf.FormatList( aText, args ); + + RFileLogger logger; + TInt ret=logger.Connect(); + if (ret==KErrNone) + { + logger.SetDateAndTime( EFalse,EFalse ); + logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend ); + TBuf timeStamp; + TTime now; + now.HomeTime(); + TDateTime dateTime; + dateTime = now.DateTime(); + timeStamp.Format( KLogTimeFormat, + dateTime.Hour(), dateTime.Minute(), + dateTime.Second(), dateTime.MicroSecond() ); + buf.Insert( 0, timeStamp ); + + logger.Write(buf); + } + + logger.Close(); + + VA_END( args ); + #else + RDebug::Print(aText); + #endif + } +#else +GLDEF_C void Debug( TRefByValue /*aText*/, ... ) + { + } +#endif + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/WPWAPItemFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/WPWAPItemFactory.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2002-2006 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: WPWAPItemFactory creates WAP settings items. +* +*/ + + + +// INCLUDE FILES +#include "WPWAPItemFactory.h" +#include "CWPWAPMMSItem.h" +//#include "CWPWAPBrowserItem.h" +#include "CWPWAPBookmarkItem.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// WPWAPItemFactory::CreateMMSL +// ----------------------------------------------------------------------------- +// +MWPWAPItemBase* WPWAPItemFactory::CreateMMSLC( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager ) + { + CWPWAPMMSItem* item = CWPWAPMMSItem::NewL( aTitle, aDefaultName, + aCharacteristic, aCommsDb, aCmManager ); + CleanupStack::PushL( item ); + return item; + } + +// ----------------------------------------------------------------------------- +// WPWAPItemFactory::CreateBrowserL +// ----------------------------------------------------------------------------- +// +/*MWPWAPItemBase* WPWAPItemFactory::CreateBrowserLC( TBool aFirst, + const TDesC& aTitle, + const TDesC& aBookmarkTitle, + const TDesC& aDefaultName, + const TDesC& aDefaultBookmarkName, + CWPCharacteristic& aCharacteristic, + CCommsDatabase*& aCommsDb, + RCmManagerExt*& aCmManager, + RFavouritesDb aBookmarkDb ) + { + CWPWAPBrowserItem* item = CWPWAPBrowserItem::NewL( aFirst, aTitle, aBookmarkTitle, + aDefaultName, aDefaultBookmarkName, aCharacteristic, aCommsDb, aCmManager, aBookmarkDb ); + CleanupStack::PushL( item ); + return item; + } +*/ +// ----------------------------------------------------------------------------- +// WPWAPItemFactory::CreateMMSL +// ----------------------------------------------------------------------------- +// +MWPWAPItemBase* WPWAPItemFactory::CreateBookmarkLC( const TDesC& aTitle, + const TDesC& aDefaultName, + CWPCharacteristic& aResource, + CWPCharacteristic*& aLink + ) + { + CWPWAPBookmarkItem* item = CWPWAPBookmarkItem::NewL( aTitle, + aDefaultName, aResource, aLink); + CleanupStack::PushL( item ); + return item; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/WAPAdapter/Src/WPWAPUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/WAPAdapter/Src/WPWAPUtil.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,60 @@ +/* +* 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: WPWAPUtil is a utility class for reading resource strings. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include // TUriParser8 +#include "WPWAPUtil.h" + +// CONSTANTS +#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw + _LIT( KAdapterName, "WPWAPAdapterResource" ); +#else + _LIT( KAdapterName, "WPWAPAdapter" ); +#endif + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// WPWAPUtil::ReadHBufCL +// ----------------------------------------------------------------------------- +// +HBufC* WPWAPUtil::ReadHBufCL( TInt aResourceId ) + { + TFileName fileName; + Dll::FileName( fileName ); + + return WPAdapterUtil::ReadHBufCL( fileName, KAdapterName, aResourceId ); + } + +// ----------------------------------------------------------------------------- +// WPWAPUtil::CheckURL +// ----------------------------------------------------------------------------- +// +TBool WPWAPUtil::CheckURI( const TDesC& aUrl ) + { + return WPAdapterUtil::CheckURI( aUrl ); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/CWPAPAccesspointItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/CWPAPAccesspointItem.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,167 @@ +/* +* 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: Class stores data for one accesspoint +* +*/ + + + +#ifndef CWPAPACCESSPOINTITEM_H +#define CWPAPACCESSPOINTITEM_H + +// INCLUDES +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CWPEngine; +class CWPAPItemBase; +class CWPParameter; +class CWPCharacteristic; +class CCommsDatabase; +class CWPAPNapdef; +class RCmManagerExt; + +// CLASS DECLARATION + +/** + * CWPAPAccesspointItem handles accesspoint settings. It links data from + * logical proxy, physical proxy and napdef into one item. + */ +class CWPAPAccesspointItem : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aDefaultName The default name if none is found + * @param aLogicalProxy The logical proxy + * @param aPhysicalProxy The physical proxy + * @param aNapdef The napdef + * @param aCharacteristic The characteristic + */ + static CWPAPAccesspointItem* NewLC( + const TDesC& aDefaultName, + CWPAPItemBase* iLogicalProxy, + CWPAPItemBase* iPhysicalProxy, + CWPAPItemBase* aNapdef, + CWPCharacteristic& aCharacteristic ); + + /** + * Destructor. + */ + virtual ~CWPAPAccesspointItem(); + + public: // New methods + + /** + * Get the accesspoint name. + * @return reference to name. + */ + const TDesC& Name() const; + + /** + * Get the NAPdef pointer + * @return pointer to napdef. + */ + CWPAPItemBase* NapDef(); + + /** + * Set the pointer to the CM manager + * @return void + */ + void SetCMManager( RCmManagerExt* aCm ); + + /** + * Get the characteristic value + * @return iCharacteristic. + */ + TInt Characteristic(); + + /** + * Save this accesspoint to comms database. + * @param aCommsDb reference to CCommsdatabase + */ + TUint32 SaveL( CCommsDatabase& aCommsDb ); + + /** + * Return the UID of the saved access point. + * @return UID + */ + const TDesC8& Uid() const; + + /** + * Delete old data from engine model. + */ + void DeleteUidData() const; + + private: // New functions + + /** + * Store the accesspoint data to comms database. + * @param aCommsDb reference to CCommsdatabase + */ + TUint32 StoreL( CCommsDatabase& aCommsDb ); + + /** + * C++ default constructor. + * @param aDefaultName The default name if none is found + * @param aLogicalProxy The logical proxy + * @param aPhysicalProxy The physical proxy + * @param aNapdef The napdef + * @param aCharacteristic The characteristic + */ + CWPAPAccesspointItem( const TDesC& aDefaultName, + CWPAPItemBase* iLogicalProxy, + CWPAPItemBase* iPhysicalProxy, + CWPAPItemBase* aNapdef, + CWPCharacteristic& aCharacteristic ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data (Total ownership is assumed unless otherwise stated) + + /// The default name if no other is found + const TDesC& iDefaultName; + + /// The napdef + CWPAPItemBase* iNapdef; + + /// The physical proxy + CWPAPItemBase* iPhysicalProxy; + + /// The logical proxy + CWPAPItemBase* iLogicalProxy; + + /// The uid created when saving + TPckgBuf iUid; + + /// The characteristic the caused the creation of an access point + CWPCharacteristic& iCharacteristic; + RCmManagerExt* iCmManager; + + private: // For testing usage. + friend class T_CWPAPAccesspointItem; + friend class T_CWPAPAdapter; + friend class T_WPAPTestUtils; + }; + +#endif // CWPAPACCESSPOINTITEM_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/CWPAPAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/CWPAPAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,119 @@ +/* +* 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: Main class for handling provisioning accesspoint data +* +*/ + + + +#ifndef CWPAPADAPTER_H +#define CWPAPADAPTER_H + +// INCLUDES + +#include +#include +#include + +// FORWARD DECLARATIONS + +class CWPAPAccesspointItem; +class CCommsDatabase; + +// CLASS DECLARATION + +/** + * CWPAPAdapter handles accesspoint settings. + */ +class CWPAPAdapter : public CWPAdapter, public MWPContextExtension + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return a instance of class. + */ + static CWPAPAdapter* NewL(); + + /** + * Destructor + */ + ~CWPAPAdapter(); + + public: // From CWPAdapter + + TInt ItemCount() const; + const TDesC16& SummaryTitle(TInt aIndex) const; + const TDesC16& SummaryText(TInt aIndex) const; + TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); + void SaveL( TInt aItem ); + TBool CanSetAsDefault( TInt aItem ) const; + void SetAsDefaultL( TInt aItem ); + void VisitL(CWPCharacteristic& aElement); + void VisitL(CWPParameter& aElement); + void VisitLinkL(CWPCharacteristic& aCharacteristic ); + TInt ContextExtension( MWPContextExtension*& ); + + public: // From MWPContextExtension + + const TDesC8& SaveDataL( TInt aIndex ) const; + void DeleteL( const TDesC8& aSaveData ); + TUint32 Uid() const; + + private: // New functions + + /** + * C++ default constructor. + */ + CWPAPAdapter(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Check whether this characteristic is already linked. + * @param aCharacteristic characteristic to compare. + * @return ETrue if link to given characteristic was found. + */ + TBool IsAlreadyLinked( CWPCharacteristic& aCharacteristic ); + + private: // Data + + /// Array of linked NAPDEF and PXLOGICAL characteristics. Refs. + RPointerArray iLinks; + /// Array of data items for memory management. Owns. + RPointerArray iDataItems; + /// Array of save items. Owns. + RPointerArray iSaveItems; + /// Pointer to commsdatabase used in saving. Owns. + CCommsDatabase* iCommsDb; + /// Summary title. Owns. + HBufC* iTitle; + /// Default name. Owns. + HBufC* iDefaultName; + /// Indicates whether these settings are already saved. + TBool iAlreadySavedOnce; + // CMManager for managing connection methods + RCmManagerExt* iCmManager; + RArray iAPValue; + + private: // For testing. + friend class T_CWPAPAdapter; + }; + +#endif // CWPAPADAPTER_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/CWPAPItemBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/CWPAPItemBase.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,136 @@ +/* +* 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: Defines a base class for all the items in WPAPAdapter +* +*/ + + + + + +#ifndef CWPAPITEMBASE_H +#define CWPAPITEMBASE_H + +// INCLUDES + +#include +#include +#include + +// DATA TYPES + +// Field types that can be marked received. +// Values defined to the power of to to enable masking. +enum TMarkedField + { + EWPParameterPxAddrType_id = 2, + EWPParameterPxAddrFQDN_id = 4, + EWPParameterNapID_id = 8, + EWPParameterService_id = 16, + EWPParameterPortNbr_id = 32, + EWPParameterPxAddr_id = 64, + EWPParameterAuthentication_id = 512, + EWPParameterIfNetworks_id = 1024, + EWPParameterInternet_id = 2048, + EWPParameterWlan_id = 4096 + }; + +// FORWARD DECLARATIONS + +class CWPAPAccesspointItem; +class CCommsDatabase; + +// CLASS DECLARATION + +/** + * CWPAPItemBase is a base class for all the items in WPAPAdapter. + */ +class CWPAPItemBase : public CBase + { + public: + + /** + * Destructor. + */ + ~CWPAPItemBase(); + + public: // New methods + + /** + * Store the item data to APEngine's accesspoint item. + * @param aAPItem item where data is stored. + */ + virtual void AddDataL( RCmConnectionMethodExt& ) = 0; + + /** + * Add access point items to an array. + * @param aItems The array to add to + * @param aLogicalProxy The related logical proxy, if any + * @param aPhysicalProxy The related physical proxy, if any + */ + virtual TInt AddItemsL( RPointerArray& aItems, + CWPAPItemBase* aLogicalProxy, + CWPAPItemBase* aPhysicalProxy ) = 0; + + /** + * The name of the item to be displayed to the user. + * @return The name + */ + virtual const TDesC& Name() = 0; + + /** + * SaveWlanDataL + */ + virtual void SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb ) = 0; + + virtual void UpdateLingerL(const TUint32 aIapId) = 0; + + protected: // New methods. Only for subclasses use. + + /** + * Base constructor. + * @param aDefaultName The default name to use for an access point + */ + CWPAPItemBase( const TDesC& aDefaultName ); + + /** + * Mark that this field has arrived and was correctly handled. + * @param aField received field enumeration + */ + void MarkReceived( TMarkedField aField ); + + /** + * Check has the given field been received. + * @param aField received field enumeration + * @return ETrue if the field has already been received and handled + */ + TBool IsReceived( TMarkedField aField ); + + protected: + + /// The default name for an access point + const TDesC& iDefaultName; + + private: // Data + + /// Received fields marked here. + TUint32 iReceivedFieldsFlags; + + private: // For testing. + friend class T_CWPAPItemBase; + }; + +#endif // CWPAPITEMBASE_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/CWPAPLogicalProxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/CWPAPLogicalProxy.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,117 @@ +/* +* 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: Defines a class, which holds logical proxy information. +* +*/ + + + + + +#ifndef CWPAPLOGICALPROXY_H +#define CWPAPLOGICALPROXY_H + +// INCLUDES + +#include +#include "CWPAPItemBase.h" +#include + +// FORWARD DECLARATIONS + +class CWPAPPhysicalProxy; +class CWPAPAccesspointItem; +class CWPAPPort; + +// CLASS DECLARATION + +/** + * CWPAPLogicalProxy contains logical proxy data. + */ +class CWPAPLogicalProxy : public CWPAPItemBase, private MWPVisitor + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aDefaultName The default name of an access point + * @param aCharacteristic The PXLOGICAL characteristic + */ + static CWPAPLogicalProxy* NewLC( const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic ); + + /** + * Destructor. + */ + ~CWPAPLogicalProxy(); + + public: // From CWPAPItemBase + + TBool ValidateL(); + void AddDataL( RCmConnectionMethodExt& aCmItem ); + TInt AddItemsL( RPointerArray& aItems, + CWPAPItemBase* aLogicalProxy, + CWPAPItemBase* aPhysicalProxy ); + const TDesC& Name(); + void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {}; + + void UpdateLingerL(const TUint32 /*aIapId*/){}; + + private: // From CWPAPItemBase + + void VisitL(CWPCharacteristic& aElement); + void VisitL(CWPParameter& aElement); + void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {}; + + private: // New methods + + /** + * C++ default constructor. + * @param aDefaultName The default name of an access point + */ + CWPAPLogicalProxy( CWPCharacteristic& aCharacteristic, + const TDesC& aDefaultName ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + /// Pointer to data model parameter. Refs. + CWPParameter* iHomepage; + + /// Pointer to data model parameter. Refs. + CWPParameter* iName; + + /// Pointer to port object. Owns. + CWPAPPort* iPort; + + /// Array of physical proxy objects. Owns. + RPointerArray iPhysicalProxies; + + /// Characteristic + CWPCharacteristic& iCharacteristic; + + private: // For testing + + friend class T_CWPAPLogicalProxy; + friend class T_CWPAPAdapter; + friend class T_WPAPTestUtils; + }; + +#endif // CWPAPLOGICALPROXY_H + +// End of File \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/CWPAPNapdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/CWPAPNapdef.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,388 @@ +/* +* Copyright (c) 2002-2006 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: Class stores data for one accesspoint +* +*/ + + + + + +#ifndef CWPAPNAPDEF_H +#define CWPAPNAPDEF_H + +// INCLUDES +#include +#include +#include +#include "CWPAPItemBase.h" +#include "WPAPDefs.h" +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CWPAPPhysicalProxy; + +class CWPParameter; +class CCommsDatabase; +class EAPSettings; +class EapCertificateEntry; +class RCmManagerExt; +class TEapExpandedType; + + +// CLASS DECLARATION + +/** + * CEapTypeElement is arrray element for several EapTypes + */ +class CEapTypeElement: public CBase + { + public: + ~CEapTypeElement(); + TBuf8 iEapTypeString; + TBuf8 iEncapsulatingExpandedEapId; + EAPSettings* iEAPSettings; + EapCertificateEntry* iCertificate; + }; + +struct SECssID + { + CWPParameter* iSSSID; + CWPParameter* iSUSSID; + }; +/** + * CWPAPNapdef handles NAPDEF characteristics. + */ +class CWPAPNapdef : public CWPAPItemBase, private MWPVisitor + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aFollowingLink ETrue if the NAPDEF was reached + * via a link. + * @param aDefaultName The default name of an access point + * @param aLogicalCharacteristic The PXLOGICAL, if following a link from + * there, or NAPDEF, if a direct link to NAPDEF. + * @param aLink The NAPDEF characteristic + */ + static CWPAPNapdef* NewLC( TBool aFollowingLink, + const TDesC& aDefaultName, + CWPCharacteristic& aLogicalCharacteristic, + CWPCharacteristic& aLink ); + + /** + * Destructor. + */ + virtual ~CWPAPNapdef(); + + public: // From CWPAPItemBase + + /** + * @precondition characteristic must be set otherwise Panics. + */ + TBool ValidateL(); + + /** + * AddDataL + */ + void AddDataL( RCmConnectionMethodExt& aCmItem ); + + /** + * AddItemsL + */ + TInt AddItemsL( RPointerArray& aItems, + CWPAPItemBase* aLogicalProxy, + CWPAPItemBase* aPhysicalProxy ); + /** + * Name + */ + const TDesC& Name(); + + /** + * SaveWlanDataL + */ + void SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb ); + + /** + * UpdateLingerL from the ItemBase + */ + + void UpdateLingerL(const TUint32 aIapId); + + /** + * Set The Internet Parameter Indicator + */ + void SetInternetIndicator(TInt value); + + /** + * Get The Internet Parameter Indicator + */ + TInt GetInternetIndicator(); + + + private: // From MWPVisitor + + /** + * VisitL + */ + void VisitL( CWPCharacteristic& aElement ); + + /** + * VisitL + */ + void VisitL( CWPParameter& aElement ); + + /** + * VisitLinkL + */ + void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {}; + + private: // New functions + + /** + * C++ default constructor. + * @param aFollowingLink ETrue if the NAPDEF was reached + * via a link. + * @param aDefaultName The default name of an access point + * @param aLogicalCharacteristic The PXLOGICAL, if following a link from + * there, or NAPDEF, if a direct link to NAPDEF. + */ + CWPAPNapdef( TBool aFollowingLink, + const TDesC& aDefaultName, + CWPCharacteristic& aLogicalCharacteristic ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Writes a DNS address in either IPv4 or IPv6 format + * to an access point item. + * @param aAPItem The access point item + * @param aValue The DNS address to write + */ + void WriteDNSAddressL( RCmConnectionMethodExt& aCmItem, + const TDesC& aValue ); + + /** + * AddWlanDataL + */ + void AddWlanDataL( RCmConnectionMethodExt& aCmItem ); + + /** + * HandleWLanParameters + */ + void HandleWLanParametersL( CWPParameter& aParameter ); + + void HandleEAPParametersCCL( CWPParameter& aParameter ); + + /** + * ConvertAsciiToHex + */ + void ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest ); + + /** + * StrCopy + */ + void StrCopy( TDes8& aTarget, const TDesC& aSource ); + + /** + * Add linger value + */ + void AddLingerL( const TInt , const TInt ); + + /** + * Update linger value + */ + void UdateligerValueL(CWPParameter* aLinger); + /** + * Isalpha + */ + TBool Notalpha(const TDesC& aValue); + /** + * CheckIPv4values + */ + TBool CheckIPv4values(const TDesC& aValue ); + + /** + * CheckAddressPart + */ + TBool CheckAddressPart( TLex& aLex ); + + /** + * ConvertEAPStringToIds + */ + void ConvertEAPStringToIds(const TDesC& aEAPString, TDes8& aExpandedId, TEapExpandedType& aID); + public: // new function + + /** + * NapId value + */ + const TDesC& NapId(); + /** + * Bearer value + */ + TUint Bearer(); + + /** + * SetCMManager + */ + void SetCMManager( RCmManagerExt* aCm ); + + private: // Data (Total ownership is assumed unless otherwise stated) + + enum TAPWEPKeyFormat + { + EAscii, // Ascii format + EHexadecimal // Hex format + }; + /// PXLOGICAL characteristic + CWPCharacteristic& iCharacteristic; + + /// The human-readable name of the connection. Refs. + CWPParameter* iConnectionName; + + /// The access point address. Refs. + CWPParameter* iAccesspointName; + + /// The access point address. Refs. + CWPParameter* iAccesspointNameType; + + /// The user name. Refs. + CWPParameter* iUserName; + + /// The password. Refs. + CWPParameter* iPassword; + + /// The IP address of the phone. Refs. + CWPParameter* iPhoneIPAddress; + + /// The network type of the access point. Refs. + CWPParameter* iIfNetworks; + + /// Array of name servers. Refs. + RPointerArray iNameServers; + + /// Number of IPv4 name servers found so far. + TInt iNumIPv4NameServers; + + /// Number of IPv6 name servers found so far. + TInt iNumIPv6NameServers; + + /// The bearer of the access point. + //TApBearerType iBearer; + TUint iBearer; + + // Received bearer was unsupported + TBool iBearerUnsupported; + + /// The PDP type of a GPRS access point. + TUint32 iPdpType; + + /// ETrue of secure authentication must be used. + TBool iSecureAuthentication; + + /// ETrue if the user must be prompted for password. + TBool iPromptPassword; + + /// ETrue if we arrived to NAPDEF via a link + TBool iFollowingLink; + +//JMan for WLan + + // Is WLAN supported (queried from Feature Manager) + TBool iWlanSupported; + + // The Network Access Point ID. + CWPParameter* iNapID; + + // WLAN characteristic parameters + + // The Primary Service Set Identifier name. + CWPParameter* iPriSSID; + + // The Used Primary Service Set Identifier name. + CWPParameter* iPriUSSID; + + // The Hidden Primary Service Set Identifier name. + CWPParameter* iPriHSSID; + + //for secssid + RPointerArray iSecSSID; + + + // The operation mode of the WLAN network. + TUint32 iNetMode; + + // The Security mode of the WLAN network. + TUint32 iSecMode; + + // The ascii formed pre-shared key. + CWPParameter* iWpaPresKeyAsc; + + // The wep authentication mode + CWPParameter* iWepAuthMode; + + // Indicates the default wepkey + TUint iDefaultWepKeyIndex; + + // WEPKEY characteristic parameters + + // The lenght of the wepkey + CWPParameter* iWepKeyLength; + + // The index of the wepkey + TUint iWepInd; + + // The wepkey data + CWPParameter* iWepKeyData; + + // Type of authentication (EAuthOpen, EAuthShared) + TWEPAuthentication iAuthentication; + + // Data of the key + TBuf8 iKeyData[KMaxNumberofKeys]; + + // Format of the key + TAPWEPKeyFormat iKeyFormat[KMaxNumberofKeys]; + + RPointerArray iEapTypeArray; + + // Pointer to Linger value parameter. Refs. + CWPParameter* iLinger; + + //linger value + TUint iLingerValue; + TBool iLingerFlag; + + // Pointer to the used CMManager, needed to save WLAN data + RCmManagerExt* iCm; + + //Internet parameter Indicator + TInt iInternetIndicator; + + private: // For testing usage. + friend class T_CWPAPNapdef; + friend class T_CWPAPAdapter; + friend class T_WPAPTestUtils; + }; + +#endif // CWPAPNAPDEF_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/CWPAPPhysicalProxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/CWPAPPhysicalProxy.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,136 @@ +/* +* 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: Defines a class, which holds physical proxy information. +* +*/ + + + + + +#ifndef CWPAPPHYSICALPROXY_H +#define CWPAPPHYSICALPROXY_H + +// INCLUDES + +#include +#include "CWPAPItemBase.h" +#include + +// DATA TYPES + +enum TWPAPPxAddrType + { + EPxAddrTypeIPv4 = 1, + EPxAddrTypeIPv6, + EPxAddrTypeUnsupported // (IPv6, E164, ALPHA are not supported) + }; + +// FORWARD DECLARATIONS + +class CWPAPLogicalProxy; +class CWPAPPort; +class CWPAPNapdef; + +// CLASS DECLARATION + +/** + * CWPAPPhysicalProxy contains physical proxy information + */ +class CWPAPPhysicalProxy : public CWPAPItemBase, private MWPVisitor + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aDefaultName The default name of an access point + * @param aCharacteristic The PXPHYSICAL characteristic. + * @param aPort Reference to a pointer containing PORT of a PXLOGICAL. + */ + static CWPAPPhysicalProxy* NewLC( const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CWPCharacteristic& aLogicalCharacteristic, + CWPAPPort*& aPort ); + + /** + * Destructor. + */ + ~CWPAPPhysicalProxy(); + + public: // From CWPAPItemBase + + TBool ValidateL(); + void AddDataL( RCmConnectionMethodExt& aCmItem ); + TInt AddItemsL( RPointerArray& aItems, + CWPAPItemBase* aLogicalProxy, + CWPAPItemBase* aPhysicalProxy ); + const TDesC& Name(); + void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {}; + void UpdateLingerL(const TUint32 /*aIapId*/){}; + + private: // From CWPAPItemBase. Override default implementation. + + void VisitL( CWPCharacteristic& aElement ); + void VisitL( CWPParameter& aElement ); + void VisitLinkL( CWPCharacteristic& aCharacteristic ); + + private: // New functions + + /** + * C++ default constructor. + * @param aDefaultName The default name of an access point + * @param aPort Reference to a pointer containing PORT of a PXLOGICAL. + */ + CWPAPPhysicalProxy( const TDesC& aDefaultName, + CWPCharacteristic& aLogicalCharacteristic, + CWPAPPort*& aPort ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + /// Pointer to data model parameter. Refs. + CWPParameter* iProxyAddr; + + /// Pointer to data model parameter. Refs. + CWPParameter* iName; + + /// Proxy address type + TWPAPPxAddrType iPxAddrType; + + /// Pointer to port object. Owns. + CWPAPPort* iPort; + + /// Pointer to port object owned by logical proxy. Refs. + CWPAPPort*& iLogicalPort; + + /// Napdefs linked to by PXPHYSICAL + RPointerArray iNapdefs; + + /// Pointer to characteristic + CWPCharacteristic& iLogicalCharacteristic; + + private: // For testing + + friend class T_CWPAPLogicalProxy; + friend class T_CWPAPAdapter; + friend class T_WPAPTestUtils; + }; + +#endif // CWPAPPHYSICALPROXY_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/CWPAPPort.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/CWPAPPort.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,110 @@ +/* +* 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: Defines a class, which holds proxy port information. +* +*/ + + + + + +#ifndef CWPAPPORT_H +#define CWPAPPORT_H + +// INCLUDES + +#include +#include "CWPAPItemBase.h" + +// FORWARD DECLARATIONS + + + +// CLASS DECLARATION + +/** + * CWPAPPort contains port information + */ +class CWPAPPort : public CWPAPItemBase, private MWPVisitor + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aCharacteristic The PORT characteristic + */ + static CWPAPPort* NewLC( CWPCharacteristic& aCharacteristic ); + + /** + * Destructor. + */ + virtual ~CWPAPPort(); + + public: // From CWPAPItemBase + + TBool ValidateL(); + void AddDataL( RCmConnectionMethodExt& aCmItem ); //CMManager + TInt AddItemsL( RPointerArray& aItems, + CWPAPItemBase* aLogicalProxy, + CWPAPItemBase* aPhysicalProxy ); + const TDesC& Name(); + void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {}; + void UpdateLingerL(const TUint32 /*aIapId*/){}; + + private: // From MWPVisitor + + void VisitL(CWPCharacteristic& aCharacteristic); + void VisitL(CWPParameter& aParameter); + void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {}; + + private: // New functions + + /** + * Constructor. + */ + CWPAPPort(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Helper method to set the internal values. + * @param aConnectionSecurity sets value for iConnectionSecurity. + * @param aSessionMode sets value for iSessionMode. + * @param aReceivedField marks the field as received + */ + void SetValues( TBool aConnectionSecurity, + TInt aSessionMode, + TMarkedField aReceivedField ); + + private: // Data + + /// ETrue if secure connection should be established + TBool iConnectionSecurity; + /// Session mode for WAP connections: connection oriented/less. + TInt iSessionMode; + /// Pointer to port number parameter. Refs. + CWPParameter* iPortNbr; + + private: + friend class T_CWPAPProxyData; + friend class T_CWPAPAdapter; + friend class T_WPAPTestUtils; + }; + +#endif // CWPAPPORT_H + +// End of File \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/ProvisioningDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/ProvisioningDebug.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,194 @@ +/* +* 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 +#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) + { + RFs fs; + RFile file; + _LIT( TmpOutputName, "C:\\provisioning.wbxml" ); + fs.Connect(); + CleanupClosePushL(fs); + //if( aFile.Open(aFileSession, TmpOutputName(), EFileShareAny|EFileWrite) == KErrNone ) + file.Replace(fs, TmpOutputName(), EFileShareAny|EFileWrite); + CleanupClosePushL(file); + TInt pos(0); + file.Seek(ESeekEnd, pos); +// HBufC8* tmp = HBufC8::NewLC(line.Size()); +// TPtr8 ptr = tmp->Des(); +// ptr.Copy(line); + TInt result = file.Write(aDes); + CleanupStack::PopAndDestroy(2); // file, fs +/////////////////////////////////////////////////// + +// 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; } + +*/ + +//////////////MIKA/////////////// +#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 ); + } + +//////////////MIKA/////////////// + + +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG( a ) +#define FTRACE( a ) + +#endif // _DEBUG + +///////// Kailash /////////////////////// +inline void LOGX(TInt aSource) + { + HBufC *iMyBufNumber = HBufC::NewLC(255); + TPtr bufNumberPtr(iMyBufNumber->Des()); + bufNumberPtr.FillZ(); + bufNumberPtr.AppendFormat(_L("%d"),aSource); + FLOG(iMyBufNumber->Des()); + CleanupStack::PopAndDestroy(); + } +///////// Kailash /////////////////////// + +#endif // PROVISIONINGDEBUG_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/WPAPAdapter.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/WPAPAdapter.pan Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,40 @@ +/* +* 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: Panic codes for Provisioning accesspoint adapter +* +*/ + + + + + +#ifndef WPAPADAPTER_PAN +#define WPAPADAPTER_PAN + +enum TWPAPAdapterPanicCodes + { + EDebugCode = 1000, + EIllegalCharacteristic, + EIllegalState, + EIndexOutOfBounds, + ENullPointer, + EPreConditionFail, + EPostConditionFail, + ESaveOperationAlreadyActive, + ENoUniqueNameResolved + }; + +GLDEF_C void Panic( TInt aPanic ); + +#endif \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/WPAPDefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/WPAPDefs.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2005-2006 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: Definitions to WPAPAdapter +* +*/ + + + + + +#ifndef WPAPDEFS_H +#define WPAPDEFS_H + +#include + +// CONSTANTS + +const TUint32 KMaxWEPKeyLength = 29; +// The maximum WPA Pre-Shared Key length. +const TUint KMaxWpaPskLength = 63; +// same as connection name max length in Prov req. +const TInt KNameMaxLength = 30; +const TInt KTwoNameServersPerNetworkType = 2; +// The maximum length of key data +const TUint KMaxLengthOfKeyData = 58; +const TUint KMaxLengthOfEapList = 50; +const TUint KExpandedEapIdLength = 8; +// Number of keys +const TUint KMaxNumberofKeys = 4; + +const TInt KInitialArraySize = 3; + +const TUint KMaxSubKeyLenght = 255; + +_LIT(KIPV4, "IPV4"); +_LIT(KIPV6, "IPV6"); +_LIT(KCLWSP, "CL-WSP"); +_LIT(KCOWSP, "CO-WSP"); +_LIT(KCLSECWSP, "CL-SEC-WSP"); +_LIT(KCOSECWSP, "CO-SEC-WSP"); +_LIT(K9200, "9200"); +_LIT(K9201, "9201"); +_LIT(K9202, "9202"); +_LIT(K9203, "9203"); +_LIT(K80, "80"); +_LIT(K8080, "8080"); +_LIT(K443, "443"); + +_LIT(KGSMGPRS, "GSM-GPRS"); + +//Characteristic WLAN +_LIT(KWLAN, "WLAN"); +_LIT(PRISSID, "PRI-SSID"); +_LIT(PRIUSSID, "PRI-U-SSID"); +_LIT(PRIHSSID, "PRI-H-SSID"); + +//Characteristic WLAN/SEC-SSID +_LIT(SECSSID, "SEC-SSID"); +_LIT(SSSID, "S-SSID"); +_LIT(SUSSID, "S-U-SSID"); + +_LIT(NETMODE, "NETMODE"); +_LIT(SECMODE, "SECMODE"); + +//Characteristic WLAN/EAP +_LIT(KEAP, "EAP"); +_LIT(EAPTYPE, "EAPTYPE"); +_LIT(EAPUSERNAME, "USERNAME"); +_LIT(EAPPASSWORD, "PASSWORD"); +_LIT(EAPREALM, "REALM"); +_LIT(EAPUSEPSEUD, "USE-PSEUD"); +_LIT(EAPMAXAUTHS, "MAXAUTHS"); +_LIT(EAPENCAPS, "ENCAPS"); +_LIT(EAPVERSERREALM, "VER-SER-REALM"); +_LIT(EAPCLIENTHAUTH, "CLIENTH-AUTH"); +_LIT(EAPSESVALTIME, "SES-VAL-TIME"); +_LIT(EAPCIPSUIT, "CIP-SUIT"); +_LIT(EAPPEAPV0, "PEAP-V0"); +_LIT(EAPPEAPV1, "PEAP-V1"); +_LIT(EAPPEAPV2, "PEAP-V2"); + +//Characteristic WLAN/EAP/CERT +_LIT(KCERT, "CERT"); +_LIT(EAPISSNAME, "ISS-NAME"); +_LIT(EAPSUBNAME, "SUB-NAME"); +_LIT(EAPCERTTYPE, "CERT-TYPE"); +_LIT(EAPSERNUM, "SER-NUM"); +_LIT(EAPSUBKEYID, "SUB-KEY-ID"); +_LIT(EAPTHUMBPRINT, "THUMBPRINT"); + +_LIT(EAPCERTUSER, "USER"); +_LIT(EAPCERTCA, "CA"); + +_LIT(WPAPRESKEYASC, "WPA-PRES-KEY-ASC"); +_LIT(WPAPRESKEYHEX, "WPA-PRES-KEY-HEX"); +_LIT(DEFAULTWEPIND, "WEPKEYIND"); +_LIT(WEPAUTHMODE, "WEPAUTHMODE"); + +//Characteristic WLAN/WEPKEY +_LIT(KWEP, "WEPKEY"); +_LIT(WEPKEYLENGTH, "LENGTH"); +_LIT(WEPKEYINDEX, "INDEX"); +_LIT(WEPKEYDATA, "DATA"); + +_LIT(KPAP, "PAP"); +_LIT(KCHAP, "CHAP"); +_LIT(KMD5, "MD5"); +_LIT(KANALOGMODEM, "ANALOG-MODEM"); +_LIT(KV110, "V.110"); +_LIT(KV120, "V.120"); +_LIT(KAUTOBAUDING, "AUTOBAUDING"); +_LIT(K9600, "9600"); +_LIT(K14400, "14400"); +_LIT(K19200, "19200"); +_LIT(K28800, "28800"); +_LIT(K38400, "38400"); +_LIT(K43200, "43200"); +_LIT(KIPv6, "IPv6"); +_LIT(KIPv4, "IPv4"); +_LIT(KAddrTypeE164, "E164"); +_LIT(KAddrTypeAPN, "APN"); + +_LIT(KADHOC, "ADHOC"); + +_LIT(KWEPSEC, "WEP"); +_LIT(KWPASEC, "WPA"); +_LIT(KWPA2SEC, "WPA2"); +_LIT(K8021XSEC, "8021X"); +_LIT(KWPAPRESSEC, "WPA-PRESHARED-KEY"); +_LIT(KWPA2PRESSEC, "WPA2-PRESHARED-KEY"); + + +_LIT(KEAPSIM, "EAP-SIM"); +_LIT(KEAPAKA, "EAP-AKA"); +_LIT(KEAPTLS, "EAP-TLS"); +_LIT(KEAPPEAP, "EAP-PEAP"); +_LIT(KEAPTTLS, "EAP-TTLS"); +_LIT(KEAPLEAP, "EAP-LEAP"); +_LIT(KEAPMSCHAPV2, "EAP-MSCHAPV2"); +_LIT(KEAPGTC, "EAP-GTC"); +_LIT(KEAPFAST, "EAP-FAST"); + +/* +_LIT8(KEapNone,"0"); +_LIT8(KEapGtc,"6"); +_LIT8(KEapTls, "13"); +_LIT8(KEapLeap,"17"); +_LIT8(KEapSim,"18"); +_LIT8(KEapTtls,"21"); +_LIT8(KEapAka,"23"); +_LIT8(KEapPeap,"25"); +_LIT8(KEapMschapv2,"26"); +_LIT8(KEapSecurid,"32"); +_LIT8(KEapFast,"43"); +*/ +_LIT8(KEapAll,"-017,-018,-023,-013,-025,-021,-043" ); + +const TUint8 KEapNoneId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +const TUint8 KEapTlsTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d}; +const TUint8 KEapGtcTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06}; +const TUint8 KEapLeapTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11}; +const TUint8 KEapSimTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12}; +const TUint8 KEapTtlsTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15}; +const TUint8 KEapAkaTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17}; +const TUint8 KEapPeapTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19}; +const TUint8 KEapMschapv2TypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A}; +const TUint8 KEapSecuridTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}; +const TUint8 KEapFastTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B}; + + +const TUint8 KEapPlus = '+'; + +_LIT(KWEPAUTHMODEOPEN, "OPEN"); +_LIT(KWEPAUTHMODESHARED, "SHARED"); + +enum TWEPAuthentication + { + EAuthOpen, // Open authentication + EAuthShared // Shared authentication + }; + +// DATA TYPES + +/** +* Data structure for storing a WEP key. +*/ +struct TWep + { + /** Specifies which key to add or remove. Range: 0-3 */ + TUint32 KeyIndex; + /** The length of KeyMaterial in bytes. Range: 0-29 */ + TUint32 KeyLength; + /** Array that stores the WEP key. */ + TUint8 KeyMaterial[KMaxWEPKeyLength]; + }; + +/** +* Data structure for storing a WPA Pre-Shared Key. +*/ +struct TWpaPsk + { + /** The length of KeyMaterial in bytes. Range: 0-63 */ + TUint KeyLength; + /** Array of that stores the WPA Pre-Shared Key. */ + TUint8 KeyMaterial[KMaxWpaPskLength]; + }; + + + +#endif // WPAPDEFS_H + +// End of File. diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/WPAPSharedDataKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/WPAPSharedDataKeys.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,46 @@ +/* +* 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: Shared data keys for operator AP settings +* +*/ + + + + + +#ifndef WPAPSHAREDDATAKEYS_H +#define WPAPSHAREDDATAKEYS_H + +// CONSTANTS + +// ----------------------------------------------------------------------------- +// AP Operator setting 0x101F466B +// ----------------------------------------------------------------------------- + +const TUid KSDUidOperatorSettings = {0x101F466B}; + +/** +* Modification of locked APs via OTA allowed +* +* Possible values: +* 0 (no) +* 1 (yes) +* +* Default value: 0 +**/ +_LIT( KOsOtaModificationAllowed, "A" ); + +#endif // WPAPSharedDataKeys_H + +// End of File \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Inc/WPAPUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Inc/WPAPUtil.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* +* 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: Class offers common utility methods. +* +*/ + + + + + +#ifndef WPAPUTIL_H +#define WPAPUTIL_H + +// INCLUDES + +#include + +// CLASS DECLARATION + +/** + * WPAPUtil offers common helper methods. + */ +class WPAPUtil + { + public: // New methods + + /** + * Loads a specified resource string from resource file. + * @param aResourceId is of a resource string. + * @return pointer to loaded descriptor. + */ + static HBufC* ReadHBufCL( TInt aResourceId ); + + }; + +#endif // WPAPUTIL_H + +// End of File \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPAPAccesspointItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPAPAccesspointItem.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,320 @@ +/* +* 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: Class stores data for one accesspoint +* +*/ + + + +// INCLUDE FILES + +#include "CWPAPAccesspointItem.h" // Own header + +#include +#include +#include + + +#include +#include // Feature manager +#include // Leave code for protected +#include "CWPAPItemBase.h" +#include "CWPAPNapdef.h" +#include "WPAPAdapter.pan" +#include "ProvisioningDebug.h" +#include +#include +#include +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::NewLC +// ----------------------------------------------------------------------------- +CWPAPAccesspointItem* CWPAPAccesspointItem::NewLC( + const TDesC& aDefaultName, + CWPAPItemBase* aLogicalProxy, + CWPAPItemBase* aPhysicalProxy, + CWPAPItemBase* aNapdef, + CWPCharacteristic& aCharacteristic ) + { + CWPAPAccesspointItem* self = + new(ELeave) CWPAPAccesspointItem( aDefaultName, + aLogicalProxy, + aPhysicalProxy, + aNapdef, + aCharacteristic ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CWPAPAccesspointItem::~CWPAPAccesspointItem() + { + } + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::Name +// ----------------------------------------------------------------------------- +// +const TDesC& CWPAPAccesspointItem::Name() const + { + if ( iLogicalProxy && iLogicalProxy->Name() != KNullDesC ) + { + return iLogicalProxy->Name(); + } + else if( iPhysicalProxy && iPhysicalProxy->Name() != KNullDesC ) + { + return iPhysicalProxy->Name(); + } + else if( iNapdef && iNapdef->Name() != KNullDesC ) + { + return iNapdef->Name(); + } + else + { + return iDefaultName; + } + } +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::NapDef +// ----------------------------------------------------------------------------- +// +CWPAPItemBase* CWPAPAccesspointItem::NapDef() + { + return iNapdef; + } + + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::SetCMManager +// ----------------------------------------------------------------------------- +// +void CWPAPAccesspointItem::SetCMManager( RCmManagerExt* aCm ) + { + iCmManager = aCm; + } + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::Characteristic +// ----------------------------------------------------------------------------- +// +TInt CWPAPAccesspointItem::Characteristic() + { + return iCharacteristic.Type(); + } + + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::SaveL +// ----------------------------------------------------------------------------- +// +TUint32 CWPAPAccesspointItem::SaveL( CCommsDatabase& aCommsDb ) + { + FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::SaveL:" ) ); + + if ( FeatureManager::FeatureSupported( KFeatureIdSettingsProtection ) ) + { + // This protection check is no longer needed since CMManager + // initiates the transactions to the database + /*if( CApProtHandler::IsTableProtectedL( &aCommsDb ) ) + { + // Table protected -> leave with specific code. + User::Leave( EWPAccessPointsProtected ); + }*/ + } + + TUint32 iap = 0; + TRAPD( err,iap = StoreL( aCommsDb ) ); + if( err == KErrLocked ) + { + err = EWPCommsDBLocked; + } + User::LeaveIfError( err ); + return iap; + } + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::StoreL +// ----------------------------------------------------------------------------- +// +TUint32 CWPAPAccesspointItem::StoreL( CCommsDatabase& aCommsDb ) + { + FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL:" ) ); + + // CMManager + // Create the cmIten, give the bearer as parameter if it is available + RCmConnectionMethodExt cmItem; + TBool created = EFalse; + TUint bearer; + TInt err(KErrNone); + + // If the NapDef object exists and the bearer is defined, then we can + // create the connection method using the bearer + if ( iNapdef != NULL ) + { + bearer = static_cast(iNapdef)->Bearer(); + if ( bearer != 0 ) + { + cmItem = iCmManager->CreateConnectionMethodL(bearer); + created = ETrue; + } + } + + // If the bearer id is not known we will use packet data + if ( !created) + { + cmItem = iCmManager->CreateConnectionMethodL(KUidPacketDataBearerType); + } + // Create the connection method into the DB + TRAP( err,cmItem.UpdateL() ); + // Leave if the creation fails for some reason + if(err!=KErrNone) + { + User::Leave(err); + } + + if( iNapdef ) + { + FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: napdef" ) ); + + // CMManager + TRAP (err, iNapdef->AddDataL( cmItem )); + TRAP ( err,cmItem.UpdateL() ); + // Leave if the update of the parameters fails + if(err!=KErrNone) + { + User::Leave(err); + } + } + + if( iLogicalProxy ) + { + FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: logicalproxy" ) ); + // CMManager + iLogicalProxy->AddDataL( cmItem ); + TRAP( err,cmItem.UpdateL() ); + // Leave if the update of the parameters fails + if(err!=KErrNone) + { + User::Leave(err); + } + } + + if( iPhysicalProxy ) + { + FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: physicalproxy" ) ); + // CMManager + iPhysicalProxy->AddDataL( cmItem ); + TRAP( err,cmItem.UpdateL() ); + // Leave if the update of the parameters fails + if(err!=KErrNone) + { + User::Leave(err); + } + } + + FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: cmItem.UpdateL" ) ); + + // CMManager + iUid = cmItem.GetIntAttributeL( CMManager::ECmWapId ); + + TInt test( KErrNone ); + // Update parameter data to CM + TRAP( test,cmItem.UpdateL() ); + FTRACE(RDebug::Print(_L("[AccessPointAdapter] CWPAPAccesspointItem::StoreL: UpdateL err: %d"), test )); + + TUint32 cmId = cmItem.GetIntAttributeL( CMManager::ECmId ); + cmItem.Close(); + + if( iNapdef ) + { + iNapdef->UpdateLingerL(iUid()); + } + + + FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: SaveWlanDataL" ) ); + if( iNapdef ) + { + // Give CMManager pointer and save WLAN data + static_cast(iNapdef)->SetCMManager( iCmManager ); + iNapdef->SaveWlanDataL( cmId, aCommsDb ); + } + + + TInt i( 0 ); + TPtrC8 data( iCharacteristic.Data(i) ); + while( data != KNullDesC8 ) + { + i++; + data.Set( iCharacteristic.Data(i) ); + } + + iCharacteristic.SetDataL( iUid, i ); + + FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: done" ) ); + return iUid(); + } + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::Uid +// ----------------------------------------------------------------------------- +// +const TDesC8& CWPAPAccesspointItem::Uid() const + { + return iUid; + } + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::DeleteUidData +// ----------------------------------------------------------------------------- +// +void CWPAPAccesspointItem::DeleteUidData() const + { + iCharacteristic.DeleteAllData(); + } + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::CWPAPAccesspointItem +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPAPAccesspointItem::CWPAPAccesspointItem( const TDesC& aDefaultName, + CWPAPItemBase* aLogicalProxy, + CWPAPItemBase* aPhysicalProxy, + CWPAPItemBase* aNapdef, + CWPCharacteristic& aCharacteristic ) + : iDefaultName( aDefaultName ), + iNapdef( aNapdef ), + iPhysicalProxy( aPhysicalProxy ), + iLogicalProxy( aLogicalProxy ), + iCharacteristic( aCharacteristic ) + { + } + +// ----------------------------------------------------------------------------- +// CWPAPAccesspointItem::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPAPAccesspointItem::ConstructL() + { + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPAPAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPAPAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,452 @@ +/* +* 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: Main class for handling provisioning accesspoint data +* +*/ + + + +// INCLUDE FILES + +#include "CWPAPAdapter.h" // Own header + +#include +#include +#include +#include // Feature manager +#include "WPAPUtil.h" +#include "CWPAPAccesspointItem.h" +#include "CWPAPNapdef.h" +#include "CWPAPLogicalProxy.h" +#include "WPAPAdapter.pan" +#include "CWPLog.h" +#include "ProvisioningDebug.h" +#include "WPAPDefs.h" +#include +#include +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::CWPAPAdapter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPAPAdapter::CWPAPAdapter() : CWPAdapter(), + iLinks( KInitialArraySize ), + iDataItems( KInitialArraySize ), + iSaveItems( KInitialArraySize ) + { + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPAPAdapter::ConstructL() + { + FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::ConstructL:" ) ); + + iTitle = WPAPUtil::ReadHBufCL( R_QTN_SM_WML_ACCESSPOINTS ); + iDefaultName = WPAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME ); + + FeatureManager::InitializeLibL(); + + iCmManager = new RCmManagerExt; + iCmManager->OpenL(); + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPAPAdapter* CWPAPAdapter::NewL() + { + CWPAPAdapter* self = new(ELeave) CWPAPAdapter; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CWPAPAdapter::~CWPAPAdapter() + { + // Contents of iLinks array are not owned + iLinks.Close(); + + iDataItems.ResetAndDestroy(); + iDataItems.Close(); + + iSaveItems.ResetAndDestroy(); + iSaveItems.Close(); + iAPValue.Reset(); + + delete iTitle; + delete iDefaultName; + delete iCommsDb; + + if ( iCmManager != NULL ) + { + iCmManager->Close(); + delete iCmManager; + } + + FeatureManager::UnInitializeLib(); + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::ItemCount +// ----------------------------------------------------------------------------- +// +TInt CWPAPAdapter::ItemCount() const + { + LOG1("Number of Access points: %d", iSaveItems.Count() ); + return iSaveItems.Count(); + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::SummaryTitle +// ----------------------------------------------------------------------------- +// +const TDesC16& CWPAPAdapter::SummaryTitle(TInt aIndex) const + { + __ASSERT_DEBUG( aIndex >= 0 && aIndex < iSaveItems.Count(), + Panic( EIndexOutOfBounds )); + // The title is always the same. + return *iTitle; + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::SummaryText +// ----------------------------------------------------------------------------- +// +const TDesC16& CWPAPAdapter::SummaryText(TInt aIndex) const + { + __ASSERT_DEBUG( aIndex >= 0 && aIndex < iSaveItems.Count(), + Panic( EIndexOutOfBounds )); + return iSaveItems[ aIndex ]->Name(); + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::DetailsL +// ----------------------------------------------------------------------------- +// +TInt CWPAPAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/) + { + // Detail view is a feature for later release. + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::SaveL +// ----------------------------------------------------------------------------- +// +void CWPAPAdapter::SaveL( TInt aItem ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::SaveL:" ) ); + + __ASSERT_DEBUG(aItem >= 0 && + aItem < iSaveItems.Count(), + Panic( EPreConditionFail )); + + TBool internetparmfound = EFalse; + TInt err1; + + for (TInt i = 0; i < iAPValue.Count(); i++) + { + if (aItem == iAPValue[i]) + { + internetparmfound = ETrue; + break; + } + + } + + // Create the commsdb when the save is initiated first time. + // This stays alive until the adapter is destroyed. + if ( !iCommsDb ) + { + iCommsDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); + } + + if( iAlreadySavedOnce && aItem == 0 ) + { + for( TInt i( 0 ); i < iSaveItems.Count(); i++ ) + { + iSaveItems[i]->DeleteUidData(); + } + } + + // ********************************************************************************** // + // ***** check that the napdefs with a certain id are only saved once SKSS-79REKH *** // + // ********************************************************************************** // + TBool found = EFalse; + if (iSaveItems[ aItem ]->Characteristic() == KWPNapDef) + { + + // Get the napdef pointer from the saved items and check that it is not NULL + CWPAPNapdef* napdef = static_cast(iSaveItems[ aItem ]->NapDef()); + + if ( napdef ) + { + // Store the id of the NAP that is being saved now + TBufC napId = napdef->NapId(); + + // check whether napdef with same id has been already saved. + for ( TInt j( 0 ); j < aItem; j++ ) + { + // If a napdef is not in question we can move to the next item + if ( iSaveItems[ j ]->Characteristic() != KWPNapDef) + { + continue; + } + + // Store the pointer to to comparison napdef and make the nap id check if + // the pointer is other than NULL + CWPAPNapdef* tmpNap = static_cast(iSaveItems[ j ]->NapDef()); + + if ( tmpNap != NULL ) + { + // If the id was found, the napdef with this id is already stored + if ( tmpNap->NapId() == napId ) + { + found = ETrue; + break; + } + } + } + } + } + + // if access point is not already stored, then we store it + if ( !found ) + { + TUint32 iap = 0; + if (internetparmfound) + { + // Give pointer to cm manager to access point item + iSaveItems[ aItem ]->SetCMManager(iCmManager); + TRAPD(err,iap = iSaveItems[ aItem ]->SaveL( *iCommsDb)); + if(err!=KErrNone) + { + User::LeaveIfError(err); + } + + TRAP(err1, WPAdapterUtil::SetAPDetailsL(iap)); + if (err1 == KErrNone) + { + iAlreadySavedOnce = ETrue; + } + } + + if (!internetparmfound || (internetparmfound && err1 != KErrNone)) + { + // Give pointer to cm manager to access point item + iSaveItems[ aItem ]->SetCMManager(iCmManager); + TRAPD(err,iap = iSaveItems[ aItem ]->SaveL( *iCommsDb)); + if(err!=KErrNone) + { + User::LeaveIfError(err); + } + iAlreadySavedOnce = ETrue; + } + } + FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::SaveL: done" ) ); + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::CanSetAsDefault +// ----------------------------------------------------------------------------- +// +TBool CWPAPAdapter::CanSetAsDefault( TInt /*aItem*/ ) const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::SetAsDefault +// ----------------------------------------------------------------------------- +// +void CWPAPAdapter::SetAsDefaultL( TInt /*aItem*/ ) + { + // This shouldn't be called because CanSetAsDefault + // always returns EFalse. + Panic( EPreConditionFail ); + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPAdapter::VisitL( CWPCharacteristic& aCharacteristic ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL:" ) ); + + TInt type = aCharacteristic.Type(); + + if ( type == KWPApplication ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL: KWPApplication" ) ); + aCharacteristic.AcceptL( *this ); + } + // Check every NAPDEF characteristic. If it contains INTERNET + // parameter then new access point is created from NAPDEF data. + else if ( type == KWPNapDef && !IsAlreadyLinked( aCharacteristic ) ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL: KWPNapDef" ) ); + CWPAPNapdef* item = CWPAPNapdef::NewLC( EFalse, + *iDefaultName, + aCharacteristic, + aCharacteristic ); + if( item->AddItemsL( iSaveItems, NULL, NULL ) > 0 ) + { + User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) ); + } + User::LeaveIfError( iDataItems.Append( item ) ); + + + TInt val = item->GetInternetIndicator(); + if (val != -1) + { + iAPValue.Append(val); + } + CleanupStack::Pop( item ); + } + FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL:done" ) ); + + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPAdapter::VisitL( CWPParameter& /*aParameter*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::VisitLinkL +// ----------------------------------------------------------------------------- +// +void CWPAPAdapter::VisitLinkL( CWPCharacteristic& aCharacteristic ) + { + if( !IsAlreadyLinked( aCharacteristic ) ) + { + switch( aCharacteristic.Type() ) + { + // This is link in APPLICATION characteristic to certain NAPDEF or LOGICAL proxy + case KWPPxLogical: + { + CWPAPLogicalProxy* item = CWPAPLogicalProxy::NewLC( + *iDefaultName, aCharacteristic ); + item->AddItemsL( iSaveItems, NULL, NULL ); + User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) ); + User::LeaveIfError( iDataItems.Append( item ) ); + CleanupStack::Pop( item ); + break; + } + case KWPNapDef: + { + CWPAPNapdef* item = CWPAPNapdef::NewLC( ETrue, + *iDefaultName, + aCharacteristic, + aCharacteristic ); + item->AddItemsL( iSaveItems, NULL, NULL ); + User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) ); + User::LeaveIfError( iDataItems.Append( item ) ); + CleanupStack::Pop( item ); + break; + } + } + } + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::ContextExtension +// ----------------------------------------------------------------------------- +// +TInt CWPAPAdapter::ContextExtension( MWPContextExtension*& aContextExtension ) + { + aContextExtension = this; + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::SaveDataL +// ----------------------------------------------------------------------------- +// +const TDesC8& CWPAPAdapter::SaveDataL( TInt aIndex ) const + { + return iSaveItems[ aIndex ]->Uid(); + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::DeleteL +// ----------------------------------------------------------------------------- +// +void CWPAPAdapter::DeleteL( const TDesC8& aSaveData ) + { + if ( !iCommsDb ) + { + iCommsDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); + } + + TPckgBuf uid; + if( aSaveData.Length() == uid.MaxLength() ) + { + LOG1( "DeleteL: Deleting %08x", uid() ); + uid.Copy( aSaveData ); + + // CMManager + TRAPD( err, iCmManager->ConnectionMethodL( uid()).DeleteL() ); + + LOG1( "DeleteL: Result: %d", err ); + if( err == KErrLocked ) + { + User::Leave( EWPCommsDBLocked ); + } + else if ( err != KErrNone && err != KErrNotFound ) + { + User::Leave( err ); + } + } + + //CleanupStack::PopAndDestroy( dataHandler ); + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::Uid +// ----------------------------------------------------------------------------- +// +TUint32 CWPAPAdapter::Uid() const + { + return iDtor_ID_Key.iUid; + } + +// ----------------------------------------------------------------------------- +// CWPAPAdapter::IsAlreadyLinked +// ----------------------------------------------------------------------------- +// +TBool CWPAPAdapter::IsAlreadyLinked( CWPCharacteristic& aCharacteristic ) + { + return iLinks.FindInAddressOrder( &aCharacteristic ) >= 0; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPAPItemBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPAPItemBase.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,62 @@ +/* +* 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: Defines a base class for all the items in WPAPAdapter +* +*/ + + + + + +// INCLUDE FILES + +#include "CWPAPItemBase.h" +#include "WPAPAdapter.pan" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CWPAPItemBase::~CWPAPItemBase() + { + } + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +CWPAPItemBase::CWPAPItemBase( const TDesC& aDefaultName ) + : iDefaultName( aDefaultName ) + { + } + +// ----------------------------------------------------------------------------- +// CWPAPItemBase::MarkReceived +// ----------------------------------------------------------------------------- +// +void CWPAPItemBase::MarkReceived( TMarkedField aField ) + { + iReceivedFieldsFlags |= aField; + } + +// ----------------------------------------------------------------------------- +// CWPAPItemBase::IsReceived +// ----------------------------------------------------------------------------- +// +TBool CWPAPItemBase::IsReceived( TMarkedField aField ) + { + return ( iReceivedFieldsFlags & aField ); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPAPLogicalProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPAPLogicalProxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,269 @@ +/* +* 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: Defines a class, which holds logical proxy information. +* +*/ + + + + + +// INCLUDE FILES + +#include "CWPAPLogicalProxy.h" +#include +#include +#include +#include "CWPLog.h" +#include "CWPAPPhysicalProxy.h" +#include "CWPAPPort.h" +#include "WPAPAdapter.pan" +#include "WPAPDefs.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPAPLogicalProxy* CWPAPLogicalProxy::NewLC( + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic ) + { + CWPAPLogicalProxy* self = new(ELeave) CWPAPLogicalProxy( aCharacteristic, + aDefaultName ); + CleanupStack::PushL( self ); + self->ConstructL(); + aCharacteristic.AcceptL( *self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CWPAPLogicalProxy::~CWPAPLogicalProxy() + { + delete iPort; + iPhysicalProxies.ResetAndDestroy(); + iPhysicalProxies.Close(); + } + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::ValidateL +// ----------------------------------------------------------------------------- +// +TBool CWPAPLogicalProxy::ValidateL() + { + // Logical proxy is valid if it contains either one or more + // physical proxies + return iPhysicalProxies.Count() > 0; + } + + + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::AddDataL +// ----------------------------------------------------------------------------- +// +void CWPAPLogicalProxy::AddDataL( RCmConnectionMethodExt& aCmItem ) + { + LOG("--CWPAP CWPAPLogicalProxy::AddDataL begin--"); + // This method is called by child physical proxy. + + // Store name if came along with the document. If missing then access point + // name is used. + if ( iName ) + { + // CMManager + aCmItem.SetStringAttributeL( CMManager::ECmName, iName->Value() ); + } + + // Store homepage if defined. + if ( iHomepage ) + { + // CMManager + TRAPD( err, aCmItem.SetStringAttributeL( CMManager::ECmStartPage, iHomepage->Value() )); + + LOG2("CWPAP EApWapStartPage, value: %S, err: %d", &iHomepage->Value(), err); + User::LeaveIfError( err ); + } + + // Store port data, which overrides the data stored by child physical proxy. + + if ( iPort ) + { + //CMManager + iPort->AddDataL (aCmItem); + + } + LOG("--CWPAP CWPAPLogicalProxy::AddDataL end--"); + } + + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::AddItemsL +// ----------------------------------------------------------------------------- +// +TInt CWPAPLogicalProxy::AddItemsL( RPointerArray& aItems, + CWPAPItemBase* /*aLogicalProxy*/, + CWPAPItemBase* /*aPhysicalProxy*/ ) + { + TInt count( 0 ); + for( TInt i( 0 ); i < iPhysicalProxies.Count(); i++ ) + { + CWPAPPhysicalProxy* pp = iPhysicalProxies[ i ]; + if( pp->ValidateL() ) + { + count += pp->AddItemsL( aItems, this, NULL ); + } + } + + return count; + } + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::Name +// ----------------------------------------------------------------------------- +// +const TDesC& CWPAPLogicalProxy::Name() + { + if ( iName ) + { + return iName->Value(); + } + else + { + return KNullDesC; + } + } + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPLogicalProxy::VisitL( CWPCharacteristic& aCharacteristic ) + { + TInt type = aCharacteristic.Type(); + + // KWPPort + + // One valid port is enough for us. + if ( type == KWPPort && !iPort ) + { + CWPAPPort* port = CWPAPPort::NewLC( aCharacteristic ); + + if ( port->ValidateL() ) + { + iPort = port; + CleanupStack::Pop( port ); + } + else // Data not valid. + { + CleanupStack::PopAndDestroy( port ); + } + } + + // KWPPxPhysical + + else if ( type == KWPPxPhysical ) + { + CWPAPPhysicalProxy* physicalProxy = CWPAPPhysicalProxy::NewLC( + iDefaultName, + aCharacteristic, + iCharacteristic, + iPort ); + + if ( physicalProxy->ValidateL() ) + { + User::LeaveIfError( iPhysicalProxies.Append( physicalProxy ) ); + CleanupStack::Pop( physicalProxy ); + } + else // Data not valid. + { + CleanupStack::PopAndDestroy( physicalProxy ); + } + } + else if ( type == KWPPxAuthInfo ) + { + // Not supported + } + } + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPLogicalProxy::VisitL( CWPParameter& aParameter) + { + TInt id = aParameter.ID(); + const TDesC& value = aParameter.Value(); + + if ( value.Length() == 0 ) + { + // No use process zero length value. + return; + } + + switch ( id ) + { + case EWPParameterStartPage: // iHomepage + { + if ( !iHomepage ) + { + iHomepage = &aParameter; + } + break; + } + case EWPParameterName: + { + if ( !iName ) + { + iName = &aParameter; + } + break; + } + default: + { + // Just let through + } + } + } + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::CWPAPLogicalProxy +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPAPLogicalProxy::CWPAPLogicalProxy( CWPCharacteristic& aCharacteristic, + const TDesC& aDefaultName ) + : CWPAPItemBase( aDefaultName ), + iPhysicalProxies( KInitialArraySize ), + iCharacteristic( aCharacteristic ) + { + } + +// ----------------------------------------------------------------------------- +// CWPAPLogicalProxy::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPAPLogicalProxy::ConstructL() + { + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPAPNapdef.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPAPNapdef.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,2050 @@ +/* +* Copyright (c) 2002-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: Class stores data for one accesspoint +* +*/ + + + + +// INCLUDE FILES + +#include "CWPAPNapdef.h" +#include +#include +#include +#include +#include +#include "CWPAPAccesspointItem.h" +#include "WPAPAdapter.pan" +#include +#include +#include +#include "ProvisioningDebug.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const TUint KIapColumn = 0x00000100; +const TUint KLingerColumn = 0x00000200; +const TUint KColumnMask = 0xFFFFFF00; +const TUint KRowMask = 0x000000FF; + +// Delay for comms db begintransaction retry (microseconds) +const TInt KBeginTransRetryDelay = 1000000; +// Maximum number of retries +const TInt KBeginTransRetryCount = 7; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::NewLC +// ----------------------------------------------------------------------------- +// +CWPAPNapdef* CWPAPNapdef::NewLC( TBool aFollowingLink, + const TDesC& aDefaultName, + CWPCharacteristic& aLogicalCharacteristic, + CWPCharacteristic& aLink ) + { + CWPAPNapdef* self = new(ELeave) CWPAPNapdef( aFollowingLink, + aDefaultName, + aLogicalCharacteristic ); + CleanupStack::PushL( self ); + self->ConstructL(); + aLink.AcceptL( *self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CWPAPNapdef::~CWPAPNapdef() + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::~CWPAPNapdef" ) ); + + iEapTypeArray.ResetAndDestroy(); + iEapTypeArray.Close(); + iSecSSID.ResetAndDestroy(); + iSecSSID.Close(); + iNameServers.Close(); + + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::ValidateL +// ----------------------------------------------------------------------------- +// +TBool CWPAPNapdef::ValidateL() + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL" ) ); + + TBool result( ETrue ); + + if ( iBearer == KUidWlanBearerType ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan" ) ); + if ( iWlanSupported ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan supported" ) ); + return result; + } + else + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan NOT supported" ) ); + return EFalse; + } + } + + // Received unsupported bearer + if( iBearerUnsupported ) + { + return EFalse; + } + + // Didn't receive a bearer value. + if ( iBearer == 0 ) + { + // Access point address type can also tell the bearer + if( iAccesspointNameType ) + { + TPtrC addrType( iAccesspointNameType->Value() ); + if( addrType == KAddrTypeAPN ) + { + iBearer =KUidPacketDataBearerType; + } + } + + // If still couldn't determine the bearer, default to GPRS + if( iBearer == 0 ) + { + iBearer = KUidPacketDataBearerType; + } + } + + // "NAP-ADDRESS" (Access point name) must be defined + if( iAccesspointName ) + { + if( iAccesspointName->Value() == KNullDesC ) + { + return EFalse; + } + } + else + { + return EFalse; + } + + /* + Combinations of authentication type, username and password and corressponding + value of prompt for password field. AuthType in this table means that provisioning document + contained authtype parameter and it was supported by the implementation. + Provisioning document names are used in table. + x means that value of the specified parameter is received and it was valid. + AuthType received & supported + | AuthName + | | AuthSecret + | | | "Prompt for Password" + no + x no + x no + x x yes + x no + x x yes + x x no + x x x no + */ + + // Set the "prompt password"-value. See the table above. Value is set to true + // only if we have supported authentication type and either username or password + // is empty. + if ( IsReceived( EWPParameterAuthentication_id ) && + ( ( !iPassword && iUserName ) ||( iPassword && !iUserName ) ) ) + { + iPromptPassword = ETrue; + } + + // IFNETWORKS is a list of possible protocols that a GPRS access points can be + // used for. + if( iBearer == KUidPacketDataBearerType && IsReceived( EWPParameterIfNetworks_id ) ) + { + TLex lex( iIfNetworks->Value() ); + lex.Mark(); + do + { + TChar ch( lex.Get() ); + + if( ( !iPdpType && !ch.IsAlphaDigit() ) || ( !iPdpType && lex.Eos() ) ) + { + if(!lex.Eos()) + { + lex.UnGet(); + } + TPtrC value( lex.MarkedToken() ); + if( !lex.Eos() ) + { + lex.Inc(); + } + + if( value == KIPv6 + && FeatureManager::FeatureSupported( KFeatureIdIPv6 ) ) + { + //iPdpType = EIPv6; + // CMManager + iPdpType = RPacketContext::EPdpTypeIPv6; + result = ETrue; + } + else if( value == KIPv6 + && !FeatureManager::FeatureSupported( KFeatureIdIPv6 ) ) + { + result = EFalse; + } + else if( value == KIPv4 ) + { + //iPdpType = EIPv4; + // CMManager + iPdpType = RPacketContext::EPdpTypeIPv4; + result = ETrue; + } + } + } while( !lex.Eos() ); + } + + return result; + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::AddItemsL +// ----------------------------------------------------------------------------- +// +TInt CWPAPNapdef::AddItemsL( RPointerArray& aItems, + CWPAPItemBase* aLogicalProxy, + CWPAPItemBase* aPhysicalProxy ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL" ) ); + + TInt count( 0 ); + + if( ( iFollowingLink || IsReceived( EWPParameterInternet_id ) + || IsReceived( EWPParameterWlan_id ) ) + && ValidateL() ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL append" ) ); + CWPAPAccesspointItem* item = CWPAPAccesspointItem::NewLC( + iDefaultName, + aLogicalProxy, + aPhysicalProxy, + this, + iCharacteristic ); + User::LeaveIfError( aItems.Append( item ) ); + //Internet Parameter is received + if (IsReceived(EWPParameterInternet_id) && !iFollowingLink) + { + SetInternetIndicator(aItems.Count() - 1); + } + + + count++; + CleanupStack::Pop( item ); + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL append done" ) ); + } + return count; + } + + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::SetInternetIndicator +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::SetInternetIndicator(TInt aValue) + { + iInternetIndicator = aValue; + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::GetInternetIndicator +// ----------------------------------------------------------------------------- +// +TInt CWPAPNapdef::GetInternetIndicator() + { + return iInternetIndicator; + } + + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::AddDataL +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::AddDataL( /*CApAccessPointItem& aAPItem*/ RCmConnectionMethodExt& aCmItem ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL" ) ); + + TInt err( KErrNone ); + + if ( iBearer == KUidWlanBearerType ) + { + if ( iWlanSupported ) + { + // CMManager + AddWlanDataL( aCmItem); + } + else + { + // WLAN is disabled (or does not exist) in the device. + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL WLAN disabled." ) ); + User::Leave( KErrNotSupported ); + } + } + else + { + if ( iConnectionName ) + { + // CMManager + aCmItem.SetStringAttributeL( CMManager::ECmName, (iConnectionName->Value().Left( KNameMaxLength ))); + } + else // Use default name + { + // CMManager + aCmItem.SetStringAttributeL( CMManager::ECmName, iDefaultName ); + } + + if ( iAccesspointName ) + { + if ( iBearer == KUidPacketDataBearerType ) + { + // CMManager + TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EPacketDataAPName, iAccesspointName->Value() )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL value: %S, err: %d"), + &iAccesspointName->Value(), err)); + } + else + { + // CMManager + TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialDefaultTelNum, iAccesspointName->Value() )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::EApIspDefaultTelNumber value: %S, err: %d"), + &iAccesspointName->Value(), err ) ); + } + } + + TRAP ( err, aCmItem.UpdateL() ); + + if ( iUserName ) + { + // CMManager + TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialLoginName, iUserName->Value() )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialLoginName value: %S, err: %d"), + &iUserName->Value(), err)); + TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialIFAuthName, iUserName->Value() )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialIFAuthName value: %S, err: %d"), + &iUserName->Value(), err)); + TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIFAuthName, iUserName->Value() )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFAuthName value: %S, err: %d"), + &iUserName->Value(), err)); + } + + // CMManager + TRAP ( err, aCmItem.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, iPromptPassword)); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFPromptForAuth value: %d, err: %d"), + iPromptPassword, err )); + + if ( iPassword ) + { + // CMManager + TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialLoginPassword, iPassword->Value() )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialLoginPassword value: %d, err: %d"), + &iPassword->Value(), err ) ); + TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIFAuthPass, iPassword->Value() )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFAuthPass value: %d, err: %d"), + &iPassword->Value(), err ) ); + } + + // CMManager + TRAP ( err, aCmItem.SetBoolAttributeL( CMManager::ECmDisablePlainTextAuth, iSecureAuthentication )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EApEApIspDisablePlainTextAuth value: %d, err: %d"), + iSecureAuthentication, err ) ); + + + // IPv6 APs always have dynamic phone address + //CMManager + if ( iPhoneIPAddress && iPdpType != RPacketContext::EPdpTypeIPv6 ) + { + // CMManager IS CORRECT? + //err = aAPItem.WriteTextL( EApIspIPAddr, iPhoneIPAddress->Value() ); + TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIPAddress, iPhoneIPAddress->Value() )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EApIspIPAddr value: %S, err: %d"), + &iPhoneIPAddress->Value(), err ) ); + } + + TRAP ( err, aCmItem.UpdateL() ); + for( TInt i( 0 ); i < iNameServers.Count(); i++ ) + { + WriteDNSAddressL( aCmItem, iNameServers[i]->Value() ); + } + TRAP ( err, aCmItem.UpdateL() ); + if( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) + && iPdpType ) + { + // CMManager + TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EPacketDataPDPType, iPdpType )); + } + + if ( err ) err = 0; // prevent compiler warning + } + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL" ) ); + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::AddWlanDataL +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::AddWlanDataL( RCmConnectionMethodExt& aCmItem ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL" ) ); + + if ( !iWlanSupported ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL WLAN NOT supported." ) ); + User::Leave( KErrNotSupported); + } + + TInt err = KErrNone; + + if ( iConnectionName ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName" ) ); + + //Connection name + // CMManager + aCmItem.SetStringAttributeL( CMManager::ECmName, iConnectionName->Value().Left( KNameMaxLength ) ); + + // CMManager + // Network name + aCmItem.SetStringAttributeL( CMManager::EWlanSSID, iConnectionName->Value()); + + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName err (%d) (%S)"), err, &iConnectionName->Value())); + + } + else // Use default name + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName default" ) ); + aCmItem.SetStringAttributeL( CMManager::EWlanSSID, iDefaultName); + } + + //EApWlanNetworkMode Gives network mode, TUint32 + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanNetworkMode" ) ); + // CMManager + TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EWlanConnectionMode, iNetMode )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanNetworkMode err (%d)"), err)); + + //EApWlanSecurityMode The security mode, TUint32 + if ( iSecMode == 0 ) + { + // This is needed if Provisioning message does not contain SECMODE parameter + // AP does not work if secmode is not set + iSecMode = CMManager::EWlanSecModeOpen; + } + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanSecurityMode" ) ); + // CMManager, securitymode causes error -1, this will be set manually in SaveWlanData + //TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EWlanSecurityMode, iSecMode )); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanSecurityMode err (%d)"), err)); + + if (err) + { + err = KErrNone; + } + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::WriteDNSAddressL +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::WriteDNSAddressL( /*CApAccessPointItem& aAPItem*/ RCmConnectionMethodExt& aCmItem, + const TDesC& aValue ) + { + // GPRS access points supports IPv6 only if explicitly stated. + // CMManager + TBool apSupportsIPv6( iPdpType == RPacketContext::EPdpTypeIPv6 | iBearer != KUidPacketDataBearerType ); + + // If IPv6 is supported, write the DNS address as IPv6 if + // bearer supports IPv6 and the address format is IPv6 + if( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) + && apSupportsIPv6 + && WPAdapterUtil::CheckIPv6( aValue ) ) + { + // Two name servers per network type + if( iNumIPv6NameServers < KTwoNameServersPerNetworkType ) + { + // CMManager + TRAPD (err, aCmItem.SetStringAttributeL( CMManager::TConnectionMethodCommonAttributes( + ( CMManager::ECmIP6NameServer1 ) + iNumIPv6NameServers ), aValue ) ); + User::LeaveIfError( err ); + iNumIPv6NameServers++; + } + } + else if( CheckIPv4values( aValue) ) + { + // Two name servers per network type + if( iNumIPv4NameServers < KTwoNameServersPerNetworkType ) + { + // CMManager + TRAPD ( err, aCmItem.SetStringAttributeL( CMManager::TConnectionMethodCommonAttributes( + ( CMManager::ECmIPNameServer1 ) + iNumIPv4NameServers ), aValue ) ); + User::LeaveIfError( err ); + aCmItem.SetBoolAttributeL( CMManager::ECmIPDNSAddrFromServer, EFalse); + iNumIPv4NameServers++; + } + } + } +// ----------------------------------------------------------------------------- +// CWPAPNapdef::CheckAddressPart +// ----------------------------------------------------------------------------- +// + +TBool CWPAPNapdef:: CheckAddressPart( TLex& aLex ) + { + TBool result( aLex.Peek().IsDigit() ); + aLex.Inc(); + if( aLex.Peek().IsDigit() ) + { + aLex.Inc(); + if( aLex.Peek().IsDigit() ) + { + aLex.Inc(); + } + } + + return result; + } + + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::CheckIPv4values +// ----------------------------------------------------------------------------- +// + +TBool CWPAPNapdef::CheckIPv4values( const TDesC& aValue ) +{ + + TLex aLex( aValue ); + return CheckAddressPart( aLex ) + && aLex.Get() == '.' + && CheckAddressPart( aLex ) + && aLex.Get() == '.' + && CheckAddressPart( aLex ) + && aLex.Get() == '.' + && CheckAddressPart( aLex ) + && aLex.Get() == '\0'; + +} +// ----------------------------------------------------------------------------- +// CWPAPNapdef::Name +// ----------------------------------------------------------------------------- +// +const TDesC& CWPAPNapdef::Name() + { + if ( iConnectionName ) + { + return iConnectionName->Value(); + } + else + { + return KNullDesC; + } + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::VisitL( CWPCharacteristic& aCharacteristic ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic)" ) ); + + TInt type = aCharacteristic.Type(); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) type (%d)"), type)); + switch ( type ) + { + case KWPNapAuthInfo: + case KWPValidity: + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) normal" ) ); + aCharacteristic.AcceptL( *this ); + break; + } + case KWPWLAN: + case KWPWepKey: + { + if( iWlanSupported ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) accept WLAN characteristic" ) ); + aCharacteristic.AcceptL( *this ); + } + } + default: + { + if ( ( ( ( aCharacteristic.Name().Compare( KWLAN ) ) == 0 ) || + ( ( aCharacteristic.Name().Compare( SECSSID ) ) == 0 ) || + ( ( aCharacteristic.Name().Compare( KEAP ) ) == 0 ) || + ( ( aCharacteristic.Name().Compare( KCERT ) ) == 0 ) || + ( ( aCharacteristic.Name().Compare( KWEP ) ) == 0 ) ) && iWlanSupported ) + { + if(aCharacteristic.Name().Compare( KEAP ) == 0) + { + CEapTypeElement* newEap = new (ELeave) CEapTypeElement; + newEap->iEAPSettings = new (ELeave) EAPSettings; + newEap->iCertificate = new (ELeave) EapCertificateEntry; + iEapTypeArray.AppendL(newEap); + } + else if(aCharacteristic.Name().Compare( SECSSID ) == 0) + { + SECssID* newsecSSID = new (ELeave) SECssID; + newsecSSID->iSSSID = NULL; + newsecSSID->iSUSSID = NULL; + iSecSSID.AppendL(newsecSSID); + } + + aCharacteristic.AcceptL( *this ); + } + } + } + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) done" ) ); + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::VisitL( CWPParameter& aParameter ) + { + TInt id = aParameter.ID(); + TPtrC value( aParameter.Value() ); + + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::VisitL(CWPParameter) id: %d value: %S"), id, &value)); + + switch ( id ) + { + case EWPParameterName: + { + if ( !iConnectionName ) + { + iConnectionName = &aParameter; + } + break; + } + case EWPParameterBearer: + { + if ( iBearer != 0 || iBearerUnsupported ) + { + break; // Already received a bearer information + } + + if ( value == KGSMGPRS ) + { + iBearer = KUidPacketDataBearerType; + } + else if ( value == KWLAN && iWlanSupported ) + { + iBearer = KUidWlanBearerType; + MarkReceived( EWPParameterWlan_id ); + } + else + { + // Unsupported bearer type + iBearerUnsupported = ETrue; + } + break; + } + case EWPParameterNapAddress: + { + if ( !iAccesspointName ) + { + iAccesspointName = &aParameter; + } + break; + } + case EWPParameterLinger: + { + iLinger = &aParameter; + UdateligerValueL( iLinger ); + break; + } + case EWPParameterNapAddrType: + { + if ( !iAccesspointNameType ) + { + iAccesspointNameType = &aParameter; + } + break; + } + case EWPParameterAuthName: + { + if ( !iUserName ) + { + iUserName = &aParameter; + } + break; + } + case EWPParameterAuthSecret: + { + if ( !iPassword ) + { + iPassword = &aParameter; + } + break; + } + case EWPParameterAuthType: + { + // If already received don't accept + if (IsReceived(EWPParameterAuthentication_id)) + { + break; + } + + if ( value == KCHAP || value == KMD5 ) + { + iSecureAuthentication = ETrue; + MarkReceived( EWPParameterAuthentication_id ); + } + else if ( value == KPAP ) + { + iSecureAuthentication = EFalse; + MarkReceived( EWPParameterAuthentication_id ); + } + else + { + // Not supported... + } + break; + } + case EWPParameterLocalAddr: // iPhoneIPAddress + { + if ( !iPhoneIPAddress ) + { + iPhoneIPAddress = &aParameter; + } + break; + } + case EWPParameterDNSAddr: + { + // All name servers must be stored, as some of them might + // be IPv6 and some IPv4 + User::LeaveIfError( iNameServers.Append( &aParameter ) ); + break; + } + case EWPParameterIfNetworks: + { + if( !iIfNetworks ) + { + iIfNetworks = &aParameter; + MarkReceived( EWPParameterIfNetworks_id ); + } + break; + } + case EWPParameterInternet: + { + MarkReceived( EWPParameterInternet_id ); + break; + } +//JMan for WLan + case EWPParameterNapID: + { + if ( !iNapID ) + { + iNapID = &aParameter; + } + break; + } + // Here case 0 are handled the WLAN parameters that are extensions + // to OMA Client Provisioning parameter set. + case 0: + { + if( iWlanSupported ) + { + HandleWLanParametersL( aParameter ); + } + break; + } +//JMan for WLan ends + default: + { + } + } + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::HandleWLanParametersL +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::HandleWLanParametersL( CWPParameter& aParameter ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL" ) ); + + if( !iWlanSupported ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WLAN not supported." ) ); + User::Leave( KErrNotSupported ); + } + + SECssID* scssid = NULL; + if( iSecSSID.Count() ) + { + scssid = iSecSSID[iSecSSID.Count()-1]; + } + + TPtrC value( aParameter.Value() ); + if( ( aParameter.Name().Compare( PRISSID ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriSSID" ) ); + if ( !iPriSSID ) + { + iPriSSID = &aParameter; + } + } + else if( ( aParameter.Name().Compare( PRIUSSID ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriUSSID" ) ); + if ( !iPriUSSID ) + { + iPriUSSID = &aParameter; + } + }// else if + + else if( ( aParameter.Name().Compare( PRIHSSID ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) ); + if ( !iPriHSSID ) + { + iPriHSSID = &aParameter; + } + }// else if + + else if( ( aParameter.Name().Compare( SSSID ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) ); + if(scssid!=NULL) + { + scssid->iSSSID = &aParameter; + } + + + }// else if + + else if( ( aParameter.Name().Compare( SUSSID ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) ); + if(scssid!=NULL) + { + scssid->iSUSSID = &aParameter; + } + }// else if + + else if( ( aParameter.Name().Compare( NETMODE ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode" ) ); + if ( value == KADHOC ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode adhoc" ) ); + iNetMode = CMManager::EAdhoc; + } + else // default is INFRA + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode infra" ) ); + iNetMode =CMManager::EInfra; + } + } + + else if( ( aParameter.Name().Compare( SECMODE ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode" ) ); + if ( value == KWEPSEC ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWEPSEC" ) ); + iSecMode = CMManager::EWlanSecModeWep; + } + else if( value == K8021XSEC ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode K8021XSEC" ) ); + iSecMode = CMManager::EWlanSecMode802_1x; + } + else if( value == KWPASEC ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPASEC" ) ); + + iSecMode = CMManager::EWlanSecModeWpa; + } + else if( value == KWPA2SEC ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPA2SEC" ) ); + iSecMode = CMManager::EWlanSecModeWpa2; + } + else if( value == KWPAPRESSEC ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPAPRESSEC" ) ); + iSecMode = CMManager::EWlanSecModeWpa; + } + else if( value == KWPA2PRESSEC ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPA2PRESSEC" ) ); + iSecMode = CMManager::EWlanSecModeWpa2; + } + else + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode open" ) ); + iSecMode = CMManager::EWlanSecModeOpen; + } + } + + else if( ( aParameter.Name().Compare( WPAPRESKEYASC ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WPAPRESKEYASC" ) ); + if ( !iWpaPresKeyAsc ) + { + iWpaPresKeyAsc = &aParameter; + } + }// else if + // indicates the default wepkey index + else if( ( aParameter.Name().Compare( DEFAULTWEPIND ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepind" ) ); + + TLex lex( value ); + lex.Val( iDefaultWepKeyIndex ); + if ( iDefaultWepKeyIndex >= 4 ) + { + iDefaultWepKeyIndex = 0; + } + }// else if + + else if( ( aParameter.Name().Compare( WEPAUTHMODE ) ) == 0 ) + { + if ( value == KWEPAUTHMODEOPEN ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepauthmode OPEN" ) ); + iAuthentication = EAuthOpen; + } + else if ( value == KWEPAUTHMODESHARED ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepauthmode SHARED" ) ); + iAuthentication = EAuthShared; + } + }// else if + + else if( ( aParameter.Name().Compare( WEPKEYLENGTH ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYLENGTH" ) ); + if ( !iWepKeyLength ) + { + iWepKeyLength = &aParameter; + } + }// else if + else if( ( aParameter.Name().Compare( WEPKEYINDEX ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYINDEX" ) ); + TLex lex( value ); + lex.Val( iWepInd ); + }// else if + else if( ( aParameter.Name().Compare( WEPKEYDATA ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYDATA" ) ); + + if ( iWepInd < 4 ) + { + const TUint8 K40Bits = 5; + const TUint8 K104Bits = 13; + const TUint8 K232Bits = 29; + + TBuf8 buf8; + StrCopy( buf8, aParameter.Value() ); + + if(buf8.Length() == K232Bits || + buf8.Length() == K104Bits || + buf8.Length() == K40Bits ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL ASCI Wep Key" ) ); + HBufC8* buf8Conv = HBufC8::NewLC( KMaxLengthOfKeyData ); + ConvertAsciiToHex( buf8, buf8Conv ); + iKeyData[iWepInd] = *buf8Conv; + iKeyFormat[iWepInd] = CWPAPNapdef::EAscii; + CleanupStack::PopAndDestroy( buf8Conv ); + } + else if( buf8.Length()==K232Bits*2 || + buf8.Length()== K104Bits*2 || + buf8.Length() == K40Bits*2) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL HEX Wep Key" ) ); + iKeyData[iWepInd] = buf8; + iKeyFormat[iWepInd] = CWPAPNapdef::EHexadecimal; + } + } + + }// else if + + // Handle EAP parameter + HandleEAPParametersCCL( aParameter ); + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL done" ) ); + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::HandleEAPParametersL +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::HandleEAPParametersCCL( CWPParameter& aParameter ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL" ) ); + + CEapTypeElement* eap = NULL; + if ( iEapTypeArray.Count() ) + { + eap = iEapTypeArray[iEapTypeArray.Count()-1]; + } + if(!eap) + { + return; + } + + TPtrC value( aParameter.Value() ); + + if( ( aParameter.Name().Compare( EAPTYPE ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPTYPE" ) ); + + ConvertEAPStringToIds( value, eap->iEapTypeString, eap->iEAPSettings->iEAPExpandedType ); + + } + else if( ( aParameter.Name().Compare( EAPUSERNAME ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPUSERNAME" ) ); + if ( eap->iEAPSettings->iUsername.Length() == 0 ) + { + eap->iEAPSettings->iUsername = value; + eap->iEAPSettings->iUsernamePresent = ETrue; + eap->iEAPSettings->iUseAutomaticUsernamePresent = ETrue; + eap->iEAPSettings->iUseAutomaticUsername = EFalse; + } + }// else if + else if( ( aParameter.Name().Compare( EAPPASSWORD ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPASSWORD" ) ); + if ( eap->iEAPSettings->iPassword.Length() == 0 ) + { + eap->iEAPSettings->iPassword = value; + eap->iEAPSettings->iPasswordPresent = ETrue; + eap->iEAPSettings-> iShowPassWordPromptPresent = ETrue; + eap->iEAPSettings-> iShowPassWordPrompt = EFalse; + } + }// else if + else if( ( aParameter.Name().Compare( EAPREALM ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPREALM" ) ); + + if ( eap->iEAPSettings->iRealm.Length() == 0 ) + { + eap->iEAPSettings->iRealm = value; + eap->iEAPSettings->iRealmPresent = ETrue; + eap->iEAPSettings->iUseAutomaticRealmPresent = ETrue; + eap->iEAPSettings->iUseAutomaticRealm = EFalse; + } + }// else if + else if( ( aParameter.Name().Compare( EAPUSEPSEUD ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPUSEPSEUD" ) ); + TInt pseudonyms; + TLex lex( value ); + lex.Val( pseudonyms ); + + eap->iEAPSettings->iUsePseudonymsPresent = ETrue; + if ( pseudonyms == 1 ) + { + eap->iEAPSettings->iUsePseudonyms = ETrue; + } + else + { + eap->iEAPSettings->iUsePseudonyms = EFalse; + } + }// else if + else if( ( aParameter.Name().Compare( EAPMAXAUTHS ) ) == 0 ) + { + // not supported + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPMAXAUTHS" ) ); + }// else if + else if( ( aParameter.Name().Compare( EAPENCAPS ) ) == 0 ) + { + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPENCAPS" ) ); + + TEapExpandedType dummy; + ConvertEAPStringToIds( value, eap->iEncapsulatingExpandedEapId, dummy ); + + }// else if + else if( ( aParameter.Name().Compare( EAPVERSERREALM ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPVERSERREALM" ) ); + + TInt serverRealm; + TLex lex( value ); + lex.Val( serverRealm ); + + eap->iEAPSettings->iVerifyServerRealmPresent = ETrue; + + if ( serverRealm == 1 ) + { + eap->iEAPSettings->iVerifyServerRealm = ETrue; + } + else + { + eap->iEAPSettings->iVerifyServerRealm = EFalse; + } + }// else if + else if( ( aParameter.Name().Compare( EAPCLIENTHAUTH ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCLIENTHAUTH" ) ); + + TInt clientAuthentication; + TLex lex( value ); + lex.Val( clientAuthentication ); + + eap->iEAPSettings->iRequireClientAuthenticationPresent = ETrue; + + if ( clientAuthentication == 1 ) + { + eap->iEAPSettings->iRequireClientAuthentication = ETrue; + } + else + { + eap->iEAPSettings->iRequireClientAuthentication = EFalse; + } + }// else if + else if( ( aParameter.Name().Compare( EAPSESVALTIME ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSESVALTIME" ) ); + + TInt sessionValidityTime; + TLex lex( value ); + lex.Val( sessionValidityTime ); + eap->iEAPSettings->iSessionValidityTime = sessionValidityTime; + eap->iEAPSettings->iSessionValidityTimePresent = ETrue; + + }// else if + else if( ( aParameter.Name().Compare( EAPCIPSUIT ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCIPSUIT" ) ); + + TInt cipherSuites; + TLex lex( value ); + lex.Val( cipherSuites ); + eap->iEAPSettings->iCipherSuites.Append( cipherSuites ); + eap->iEAPSettings->iCipherSuitesPresent = ETrue; + + }// else if + else if( ( aParameter.Name().Compare( EAPPEAPV0 ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV0" ) ); + + TInt peap; + TLex lex( value ); + lex.Val( peap ); + + eap->iEAPSettings->iPEAPVersionsPresent = ETrue; + if ( peap == 1 ) + { + eap->iEAPSettings->iPEAPv0Allowed = ETrue; + } + else + { + eap->iEAPSettings->iPEAPv0Allowed = EFalse; + } + }// else if + else if( ( aParameter.Name().Compare( EAPPEAPV1 ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV1" ) ); + TInt peap; + TLex lex( value ); + lex.Val( peap ); + eap->iEAPSettings->iPEAPVersionsPresent = ETrue; + if ( peap == 1 ) + { + eap->iEAPSettings->iPEAPv1Allowed = ETrue; + } + else + { + eap->iEAPSettings->iPEAPv1Allowed = EFalse; + } + }// else if + else if( ( aParameter.Name().Compare( EAPPEAPV2 ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV2" ) ); + TInt peap; + TLex lex( value ); + lex.Val( peap ); + eap->iEAPSettings->iPEAPVersionsPresent = ETrue; + if ( peap == 1 ) + { + eap->iEAPSettings->iPEAPv2Allowed = ETrue; + } + else + { + eap->iEAPSettings->iPEAPv2Allowed = EFalse; + } + }// else if + + else if( ( aParameter.Name().Compare( EAPISSNAME ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPISSNAME" ) ); + + eap->iCertificate->SetSubjectName(value); + eap->iCertificate->SetSubjectNamePresent(); + }// else if + + else if( ( aParameter.Name().Compare( EAPSUBNAME ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSUBNAME" ) ); + + eap->iCertificate->SetIssuerName(value); + eap->iCertificate->SetIssuerNamePresent(); + }// else if + + else if( ( aParameter.Name().Compare( EAPCERTTYPE ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCERTTYPE" ) ); + if ( value == EAPCERTCA ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EEapSim" ) ); + + eap->iCertificate->SetCertType(EapCertificateEntry::ECA); + eap->iEAPSettings-> iUseAutomaticCACertificatePresent = ETrue; + eap->iEAPSettings-> iUseAutomaticCACertificate = EFalse; + } + else + { + eap->iCertificate->SetCertType(EapCertificateEntry::EUser); + } + // Certificates must be present since this field was added + eap->iEAPSettings->iCertificatesPresent = ETrue; + eap->iCertificate->SetIsEnabledPresent(); + eap->iCertificate->SetIsEnabled(ETrue) ; + + }// else if + else if( ( aParameter.Name().Compare( EAPSERNUM ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSERNUM" ) ); + + eap->iCertificate->SetSerialNumber(value); + eap->iCertificate->SetSerialNumberPresent(); + }// else if + + else if( ( aParameter.Name().Compare( EAPSUBKEYID ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSUBKEYID" ) ); + + _LIT(KHexIdLC, "0x"); + _LIT(KHexIdUC, "0X"); + TBuf<2> HexIdBuf; + TInt keyLen = aParameter.Value().Length(); + + // setting the given key to the key buffer + TBuf origKey; + origKey.SetLength(keyLen); + origKey = aParameter.Value(); + TBuf key; + TLex tmpByte; + TInt err(KErrNone); + TUint16 byte; + + // Remove possible spaces from the beginning + origKey.TrimLeft(); + + // if the key is over two chars long, then we have to check + // whether there is 0x or 0X in the beginning + if (origKey.Length() >= 2) + { + // Copy the two left most characters in to the buffer + HexIdBuf.Copy(origKey.Left(2)); + + // If the first characters are 0x or 0X, then they should be ignored + if (HexIdBuf.Compare(KHexIdLC) == 0 + || HexIdBuf.Compare(KHexIdUC) == 0) + { + // delete two characters + origKey.Delete(0, 2); + } + } + + // looping the subject key through, removing whitespaces + for (TInt i = 0; i < keyLen; i++) + { + // removing white spaces from the left side of the key + origKey.TrimLeft(); + // check that there are characters left + if (origKey.Length() >= 2) + { + // pick the two left most bytes from the key + tmpByte = origKey.Left(2); + // convert byte into binary format + err = tmpByte.Val(byte, EHex); + + // delete two characters from the left side of the character array in the buffer + origKey.Delete(0, 2); + + // check whether conversion to decimal went ok + if (err != KErrNone) + { + // if there are problems, then leave the loop + break; + } + + // store the appended byte into the key variable + key.Append(byte); + } + + else if (origKey.Length() == 1) + { + // pick the left most bytes from the key + tmpByte = origKey.Left(1); + // convert byte into binary format + err = tmpByte.Val(byte, EHex); + + // delete two characters from the left side of the character array in the buffer + origKey.Delete(0, 1); + + // check whether conversion to decimal went ok + if (err != KErrNone) + { + // if there are problems, then leave the loop + break; + } + + // store the appended byte into the key variable + key.Append(byte); + } + else + { + break; + } + } + TBuf8 keyIdentifier; + keyIdentifier.Copy(key); + // store key value only if no errors occurred + if (err == KErrNone) + { + eap->iCertificate->SetSubjectKeyId(keyIdentifier); + eap->iCertificate->SetSubjectKeyIdPresent(); + eap->iEAPSettings->iCertificatesPresent = ETrue; + } + } + + + else if( ( aParameter.Name().Compare( EAPTHUMBPRINT ) ) == 0 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPTHUMBPRINT" ) ); + eap->iCertificate->SetThumbprintPresent(); + eap->iCertificate->SetThumbprint(value); + }// else if + } + + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::CWPAPNapdef +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPAPNapdef::CWPAPNapdef( TBool aFollowingLink, + const TDesC& aDefaultName, + CWPCharacteristic& aLogicalCharacteristic ) + : CWPAPItemBase( aDefaultName ), + iCharacteristic( aLogicalCharacteristic ), + iFollowingLink( aFollowingLink ) + { + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::ConstructL() + { + iLingerValue = NULL; + iLingerFlag = ETrue; + iInternetIndicator = -1; + //checks if Wlan feature is supported + FeatureManager::InitializeLibL(); + iWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + FeatureManager::UnInitializeLib(); + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::SaveWlanDataL +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb ) + { + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL APid: (%d)"), aIapId) ); + + if ( iBearer == KUidWlanBearerType ) + { + CCommsDbTableView* wLanServiceTable; + + // CMManager + // Search the Iap Service Id using the received IapId + RCmConnectionMethodExt cm = iCm->ConnectionMethodL( aIapId ); + TUint32 serviceId = cm.GetIntAttributeL( CMManager::ECmIapServiceId ); + + // The BeginTransaction might fail if someone else has locked CommsDat + TInt dberr = aCommsDb.BeginTransaction(); + if( dberr == KErrLocked ) + { + // Try BeginTransaction again to get lock + TInt retry = KBeginTransRetryCount; + while ( retry > 0 && dberr == KErrLocked ) + { + User::After(KBeginTransRetryDelay); + dberr = aCommsDb.BeginTransaction(); + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL: Database locked. BeginTransaction retry." ) ); + retry--; + } + if(dberr != KErrNone) + { + // Could not get lock to CommsDat at all + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL: BeginTransaction failed completely." ) ); + User::Leave( dberr ); + } + } + + TInt indexToSec = 0; + wLanServiceTable = aCommsDb.OpenViewMatchingUintLC( + TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), serviceId ); + TInt errorCode = wLanServiceTable->GotoFirstRecord(); + + if ( errorCode == KErrNone ) + { + indexToSec = serviceId; + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL updaterecord" ) ); + wLanServiceTable->UpdateRecord(); + } + else + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL insertrecord" ) ); + TUint32 dummyUid( 0 ); + User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) ); + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_SERVICE_ID" ) ); + // Save link to LAN service + wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), aIapId ); + indexToSec = aIapId; + } + + // Setting the security mode manually, because CMManager does not do that + wLanServiceTable->WriteUintL( TPtrC( WLAN_SECURITY_MODE ), iSecMode ); + + if( iSecSSID.Count() ) + { + CCommsDbTableView* wLanSecserviceTable; + wLanSecserviceTable = aCommsDb.OpenTableLC( TPtrC( WLAN_SECONDARY_SSID ) ); + //CleanupStack::Pop(wLanSecserviceTable); // wLanSecserviceTable + TBuf<4> blank; + blank.Append(KNullDesC); + + TBool sssid = EFalse; + TBool sussid = EFalse; + + for(TInt i = 0; i < iSecSSID.Count(); i++ ) + { + TUint32 id ; + + + TInt retval = wLanSecserviceTable->InsertRecord(id); + wLanSecserviceTable->WriteUintL(TPtrC(WLAN_SEC_SSID_SERVICE_ID), indexToSec ); + wLanSecserviceTable->WriteUintL(TPtrC(WLAN_SEC_SSID_ID), id ); + + if( iSecSSID[i]->iSSSID != NULL) + sssid = ETrue; + if(iSecSSID[i]->iSUSSID != NULL) + sussid = ETrue; + + if((sssid && iSecSSID[i]->iSSSID->Value() != blank) || (sussid && iSecSSID[i]->iSUSSID->Value() != blank )) + { + if( sssid ) + wLanSecserviceTable->WriteTextL(TPtrC(WLAN_SEC_SSID_SCANNED_SSID), iSecSSID[i]->iSSSID->Value()); + + if(sussid) + wLanSecserviceTable->WriteTextL(TPtrC(WLAN_SEC_SSID_USED_SSID), iSecSSID[i]->iSUSSID->Value()); + + } + wLanSecserviceTable->PutRecordChanges(); + sssid = EFalse; + sussid = EFalse; + } + CleanupStack::PopAndDestroy( wLanSecserviceTable ); + } + + iSecSSID.ResetAndDestroy(); + iSecSSID.Close(); + if ( iPriSSID ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_SSID" ) ); + // Save NU_WLAN_SSID + wLanServiceTable->WriteTextL( TPtrC(NU_WLAN_SSID), iPriSSID->Value() ); + } + if ( iPriUSSID ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_USED_SSID" ) ); + // Save WLAN_USED_SSID + wLanServiceTable->WriteTextL( TPtrC(WLAN_USED_SSID), iPriUSSID->Value() ); + } + if ( iPriHSSID ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_SCAN_SSID" ) ); + // Save WLAN_SCAN_SSID + wLanServiceTable->WriteBoolL( TPtrC(WLAN_SCAN_SSID), ETrue ); + } + else + { + wLanServiceTable->WriteBoolL( TPtrC(WLAN_SCAN_SSID), EFalse ); + } + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WEP_INDEX" ) ); + // Save index of key in use + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_INDEX ), + (TUint32&) iDefaultWepKeyIndex ); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WEP_INDEX: (%d)"), iDefaultWepKeyIndex) ); + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL NU_WLAN_AUTHENTICATION_MODE" ) ); + // Open / Shared (0/1) + // Save index of key in use + wLanServiceTable->WriteUintL( TPtrC( NU_WLAN_AUTHENTICATION_MODE ), + ( TUint32& ) iAuthentication ); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL NU_WLAN_AUTHENTICATION_MODE: (%d)"), iAuthentication) ); + + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY1" ) ); + // Save first WEP key + wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY1 ), iKeyData[0] ); + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY1_FORMAT ), + ( TUint32& ) iKeyFormat[0] ); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[0] ) ); + + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY2" ) ); + // Save second WEP key + wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY2 ), iKeyData[1] ); + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY2_FORMAT ), + ( TUint32& ) iKeyFormat[1] ); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[1] ) ); + + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY3" ) ); + // Save third WEP key + wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY3 ), iKeyData[2] ); + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY3_FORMAT ), + ( TUint32& ) iKeyFormat[2] ); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[2] ) ); + + + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY4" ) ); + // Save fourth WEP key + wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY4 ), iKeyData[3] ); + wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY4_FORMAT ), + ( TUint32& ) iKeyFormat[3] ); + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[3] ) ); + + + if ( iWpaPresKeyAsc ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL convert WPAKEY to ascii" ) ); + // convert unicode to 8-bit ascii + TBuf8 wpaKey; + StrCopy( wpaKey, iWpaPresKeyAsc->Value() ); + + // Enable WPA Pre Shared key mode + wLanServiceTable->WriteBoolL( TPtrC( WLAN_ENABLE_WPA_PSK ), ETrue ); + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WPA_PRE_SHARED_KEY" ) ); + // Save PreShared Key + wLanServiceTable->WriteTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), + wpaKey ); + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WPA_KEY_LENGTH" ) ); + // Save PreShared Key Length + wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), + wpaKey.Length() ); + } + + TBuf eapList; + eapList.Copy(KEapAll); + + for (TInt i=0;iiEAPSettings->iCertificatesPresent ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL Certificate was present." ) ); + eap->iEAPSettings->iCertificates.Append( eap->iCertificate ); + } + + // Save EAP list + if ( eap->iEapTypeString.Length() > 0 + && eap->iEncapsulatingExpandedEapId.Length() == 0) // AND method is not encapsulated + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_EAPS" ) ); + + TBuf8<3> buf; + _LIT8(KFormat, "%d"); + // pick the last byte from the array + buf.Format(KFormat, eap->iEapTypeString[KExpandedEapIdLength - 1]); + // search for the correct offset for the eap type from the KEapAll literal + TInt index = KEapAll().Find(buf); + + const TUint8 offset = 2; //length = f "-0" string + // Add '+' to the correct offset, so that the eap is repsesented activated in the list + if(index >= offset) + { + eapList[index-offset] = KEapPlus; + } + + } + // Set iEncapsulatingEapTypes + for ( TInt j = 0; j < iEapTypeArray.Count(); j++ ) + { + // Check if any method has this method as the encapsulating method + if ( eap->iEapTypeString == iEapTypeArray[j]->iEncapsulatingExpandedEapId ) + { + // Append this method to iEncapsulatedEAPType + eap->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( iEapTypeArray[j]->iEAPSettings->iEAPExpandedType ); + eap->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue; + } + } + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings CEapType::NewL" ) ); + CEapType* eapType = NULL; + + + TRAPD( error, ( eapType = CEapType::NewL( ELan, serviceId, eap->iEAPSettings->iEAPExpandedType ) ) ); + + if ( ( error == KErrNone ) && eapType ) + { + CleanupStack::PushL( eapType ); + + // Check if this type is tunneled + if ( eap->iEncapsulatingExpandedEapId.Length() > 0 ) + { + // It is tunneled. + eapType->SetTunnelingType( eap->iEncapsulatingExpandedEapId); + + } + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings SetConfigurationL" ) ); + TRAP_IGNORE( eapType->SetConfigurationL( *eap->iEAPSettings ) ); + + CleanupStack::PopAndDestroy( eapType ); + + } + else + { + FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL CEapType::NewL err: %d"), error ) ); + } + + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings done" ) ); + } + + + + // Expanded EAP types in use. Write the eap list to the new columns. + + // generate appropriate entries in the new enabled and disabled list, + // overwriting those values + + // count the + and - signs to determine the size of enabled and + // disabled descriptors + + TLex lex( eapList ); + TInt numPlus = 0; + TInt numMinus = 0; + TChar ch; + while ( !lex.Eos() ) + { + ch = lex.Get(); + if ( ch == '+' ) ++numPlus; + else if ( ch == '-' ) ++numMinus; + } + // load general EAP settings If + CEapGeneralSettings* genSettings; + genSettings = CEapGeneralSettings::NewL(ELan, serviceId); + CleanupStack::PushL( genSettings ); + + // get lists of enabled/disabled EAPs for the IAP + + RArray enabledEapMethods; + RArray disabledEapMethods; + + enabledEapMethods.Reset(); + disabledEapMethods.Reset(); + + + // each entry consumes 8 bytes in binary format + HBufC8* enabledEAPPlugin = HBufC8::NewL( 8 * numPlus ); + CleanupStack::PushL( enabledEAPPlugin ); + + HBufC8* disabledEAPPlugin = HBufC8::NewL( 8 * numMinus ); + CleanupStack::PushL( disabledEAPPlugin ); + + lex.Assign( eapList ); + + while ( !lex.Eos() ) + { + // beginning of implementation UID + TInt16 implUid = 0; + + if ( lex.Val( implUid ) != KErrNone || !implUid ) + { + // if the old string is corrupted, null out both lists + enabledEAPPlugin->Des().Zero(); + disabledEAPPlugin->Des().Zero(); + break; + } + + // append it to the appropriate list ('+' enabled, '-' disabled) + _LIT8( KPadding, "\xFE\0\0\0\0\0\0" ); + _LIT8( KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); + const TInt KPlainMsChapV2ImplUid = 99; + + if ( implUid > 0 ) + { + enabledEAPPlugin->Des().Append( + Abs( implUid ) == KPlainMsChapV2ImplUid? + KMsChapV2Padding: KPadding ); + enabledEAPPlugin->Des().Append( Abs( implUid ) ); + TPtrC8 data(reinterpret_cast(&implUid), KExpandedEapIdLength); + TEapExpandedType expandedType; + expandedType.SetValue(enabledEAPPlugin,KEapExpandedTypeLength); + enabledEapMethods.Append(expandedType); + } + + // swallow the delimiter (',') + lex.Get(); + } + + genSettings->SetEapMethods(enabledEapMethods, disabledEapMethods); + + + + CleanupStack::PopAndDestroy( disabledEAPPlugin ); + CleanupStack::PopAndDestroy( enabledEAPPlugin ); + CleanupStack::PopAndDestroy( genSettings ); + + + + + iEapTypeArray.ResetAndDestroy(); + wLanServiceTable->PutRecordChanges(); + + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL PutRecordChanges" ) ); + CleanupStack::PopAndDestroy( wLanServiceTable ); + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL done" ) ); + aCommsDb.CommitTransaction(); + } + else + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL ignored not a WLAN AP" ) ); + } + + } + +//------------------------------------------------------------------------------ +// CWPAPNapdef::ConvertAsciiToHex +//------------------------------------------------------------------------------ +// +void CWPAPNapdef::ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertAsciiToHex" ) ); + + _LIT( hex, "0123456789ABCDEF" ); + TInt size = aSource.Size(); + TPtr8 ptr = aDest->Des(); + for ( TInt ii = 0; ii < size; ii++ ) + { + TText8 ch = aSource[ii]; + ptr.Append( hex()[(ch/16)&0x0f] ); + ptr.Append( hex()[ch&0x0f] ); + } + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertAsciiToHex Done" ) ); + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::StrCopy +// String copy with lenght check. +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::StrCopy( TDes8& aTarget, const TDesC& aSource ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::StrCopy" ) ); + + TInt len = aTarget.MaxLength(); + if( len < aSource.Length() ) + { + aTarget.Copy( aSource.Left( len ) ); + return; + } + aTarget.Copy( aSource ); + + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::StrCopy Done" ) ); + } + +CEapTypeElement::~CEapTypeElement() + { + delete iEAPSettings; + delete iCertificate; + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::UpdateLingerL +// +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::UpdateLingerL(const TUint32 aIapId) +{ + if ( iLinger && ( !iLingerFlag ) ) + { + AddLingerL( aIapId , iLingerValue ); + } + +} + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::UdateligerValueL +// +// ----------------------------------------------------------------------------- +// +void CWPAPNapdef::UdateligerValueL(CWPParameter* aLinger) +{ + TInt err(KErrNone); + const TDesC& value = aLinger->Value(); + if( !Notalpha(value)) + { + TLex lex( value ); + TUint Linger = 0; + TInt lingerint; + err = lex.Val( Linger, EDecimal ); + if( err == KErrNone ) + { + lingerint = Linger; + if( lingerint >= 0 ) + { + iLingerValue = lingerint; + iLingerFlag = EFalse; + } + } + } +} + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::UdateligerValueL +// +// ----------------------------------------------------------------------------- +// +TBool CWPAPNapdef::Notalpha(const TDesC& aValue) +{ + TBool NotAlpha = EFalse; + TChar character; + for(TInt i = 0 ; i < aValue.Length(); i++) + { + character = aValue[i]; + NotAlpha = character.IsAlpha(); + if(NotAlpha) + break; + } + + return NotAlpha; +} + + +// --------------------------------------------------------------------------- +// Adds iapID and linger interval to CentralRepository +// --------------------------------------------------------------------------- +// +void CWPAPNapdef::AddLingerL( const TInt aIapId, const TInt aLingerInterval ) + { + TInt err( KErrNone ); + + // Open repository + CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); + + // Find if an entry for "iapId" already exists in CentRep + RArray< TUint32 > foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL( KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys ); // found keys + + if ( err == KErrNone || err == KErrNotFound ) + { + if ( foundKeys.Count() == 0 ) + { + // Add a new entry + TInt arrayCount( 0 ); + + // Get number of iapId&linger entries in Centrep + err = repository->Get( KPdpContextManagerLingerArrayCount, + arrayCount ); + + if ( err == KErrNone ) + { + arrayCount++; + + err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); + + if ( err == KErrNone ) + { + err = repository->Create( ( KLingerColumn | arrayCount ), + aLingerInterval ); + } + + if ( err == KErrNone ) + { + // Update number of iapId&linger entries in Centrep + err = repository->Set( KPdpContextManagerLingerArrayCount, + arrayCount ); + } + } + } + else + { + // Update existing entry on current row + TInt32 row = foundKeys[ 0 ] & KRowMask; + + err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy( repository ); + + User::LeaveIfError( err ); + + } + +void CWPAPNapdef::ConvertEAPStringToIds( const TDesC& aEAPString, TDes8& aExpandedId, TEapExpandedType& aID) + { + if ( aEAPString == KEAPSIM ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapSim" ) ); + aExpandedId.Copy( KEapSimTypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypeSim.GetType(); + } + else if( aEAPString == KEAPAKA ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapAka" ) ); + aExpandedId.Copy( KEapAkaTypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypeAka.GetType(); + } + else if( aEAPString == KEAPTLS ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapTls" ) ); + aExpandedId.Copy( KEapTlsTypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypeTls.GetType(); + } + else if( aEAPString == KEAPPEAP ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapPeap" ) ); + aExpandedId.Copy( KEapPeapTypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypePeap.GetType(); + } + else if( aEAPString == KEAPTTLS ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapTtls" ) ); + aExpandedId.Copy( KEapTtlsTypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypeTtls.GetType(); + } + else if( aEAPString == KEAPLEAP ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapLeap" ) ); + aExpandedId.Copy( KEapLeapTypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypeLeap.GetType(); + } + else if( aEAPString == KEAPMSCHAPV2 ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapMschapv2" ) ); + aExpandedId.Copy( KEapMschapv2TypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypeMsChapv2.GetType(); + } + else if( aEAPString == KEAPGTC ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapGtc" ) ); + aExpandedId.Copy( KEapGtcTypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypeGtc.GetType(); + } + else if( aEAPString == KEAPFAST ) + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapFast" ) ); + aExpandedId.Copy( KEapFastTypeId, KExpandedEapIdLength ); + aID = *EapExpandedTypeFast.GetType(); + } + + else + { + FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapNone" ) ); + aExpandedId.Copy( KEapNoneId, KExpandedEapIdLength ); + aID = *EapExpandedTypeNone.GetType(); + } + + } + +// --------------------------------------------------------------------------- +// Returns the NAP-ID +// --------------------------------------------------------------------------- +// +const TDesC& CWPAPNapdef::NapId() + { + return iNapID->Value(); + } + +// --------------------------------------------------------------------------- +// Returns the bearer value +// --------------------------------------------------------------------------- +// +TUint CWPAPNapdef::Bearer() + { + return iBearer; + } + +// --------------------------------------------------------------------------- +// Returns the bearer value +// --------------------------------------------------------------------------- +// +void CWPAPNapdef::SetCMManager( RCmManagerExt* aCm ) + { + iCm = aCm; + } + + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPAPPhysicalProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPAPPhysicalProxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,349 @@ +/* +* 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: Defines a class, which holds physical proxy information. +* +*/ + + + + + +// INCLUDE FILES + +#include "CWPAPPhysicalProxy.h" // Own header +#include +#include +#include +#include +#include "CWPAPLogicalProxy.h" +#include "CWPAPPort.h" +#include "CWPAPNapdef.h" +#include "WPAPAdapter.pan" +#include "CWPLog.h" +#include "WPAPDefs.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPAPPhysicalProxy* CWPAPPhysicalProxy::NewLC( + const TDesC& aDefaultName, + CWPCharacteristic& aCharacteristic, + CWPCharacteristic& aLogicalCharacteristic, + CWPAPPort*& aPort ) + { + CWPAPPhysicalProxy* self = new(ELeave) CWPAPPhysicalProxy( + aDefaultName, + aLogicalCharacteristic, + aPort ); + CleanupStack::PushL( self ); + self->ConstructL(); + aCharacteristic.AcceptL( *self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CWPAPPhysicalProxy::~CWPAPPhysicalProxy() + { + delete iPort; + + iNapdefs.ResetAndDestroy(); + iNapdefs.Close(); + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::ValidateL +// ----------------------------------------------------------------------------- +// +TBool CWPAPPhysicalProxy::ValidateL() + { + TBool isValid( EFalse ); + + // We must have proxy address otherwise this proxy isn't valid. + if ( iProxyAddr ) + { + switch ( iPxAddrType ) + { + case EPxAddrTypeIPv4: + { + isValid = WPAdapterUtil::CheckIPv4( iProxyAddr->Value() ); + break; + } + case EPxAddrTypeIPv6: + { + isValid = FeatureManager::FeatureSupported( KFeatureIdIPv6 ) + && WPAdapterUtil::CheckIPv6( iProxyAddr->Value() ); + break; + } + case EPxAddrTypeUnsupported: + { + isValid = EFalse; + break; + } + default: // default value is assumed to be EPxAddrTypeIPv4 + { + isValid = WPAdapterUtil::CheckIPv4( iProxyAddr->Value() ); + } + } + } + return isValid; + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::AddDataL +// ----------------------------------------------------------------------------- +// +void CWPAPPhysicalProxy::AddDataL( RCmConnectionMethodExt& aCmItem ) + { + LOG("--CWPAP CWPAPPhysicalProxy::AddDataL begin--"); + TInt err(KErrNone); + + // CMManager + aCmItem.SetStringAttributeL( CMManager::ECmWapIPGatewayAddress, iProxyAddr->Value()); + LOG2("CWPAP EApWapStartPage, value: %S, err: %d", + &iProxyAddr->Value(), err); + + //CMManager + aCmItem.SetStringAttributeL( CMManager::ECmIPGateway, iProxyAddr->Value()); + LOG2("CWPAP EApIspIPGateway, value: %S, err: %d", + &iProxyAddr->Value(), err); + + //CMManager + aCmItem.SetStringAttributeL( CMManager::ECmProxyServerName, iProxyAddr->Value() ); + LOG2("CWPAP EApProxyServerAddress, value: %S, err: %d", + &iProxyAddr->Value(), err); + + + // Store port data + if ( iPort ) + { + iPort->AddDataL( aCmItem ); + } + + if ( iLogicalPort) + { + iLogicalPort->AddDataL( aCmItem ); + } + if ( err ) err = 0; // prevent compiler warning + + LOG("--CWPAP CWPAPPhysicalProxy::AddDataL end--"); + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::AddItemsL +// ----------------------------------------------------------------------------- +// +TInt CWPAPPhysicalProxy::AddItemsL( RPointerArray& aItems, + CWPAPItemBase* iLogicalProxy, + CWPAPItemBase* /*iPhysicalProxy*/ ) + { + TInt count( 0 ); + for( TInt i( 0 ); i < iNapdefs.Count(); i++ ) + { + CWPAPNapdef* pp = iNapdefs[ i ]; + if( pp->ValidateL() ) + { + count += pp->AddItemsL( aItems, iLogicalProxy, this ); + } + } + + return count; + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::Name +// ----------------------------------------------------------------------------- +// +const TDesC& CWPAPPhysicalProxy::Name() + { + if( iName ) + { + return iName->Value(); + } + else + { + return KNullDesC; + } + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPPhysicalProxy::VisitL( CWPCharacteristic& aCharacteristic ) + { + TInt type = aCharacteristic.Type(); + + // Accept only KWPPort characteristics + // One valid port is enough for us + if ( type == KWPPort && !iPort ) + { + CWPAPPort* port = CWPAPPort::NewLC( aCharacteristic ); + + if ( port->ValidateL() ) + { + iPort = port; + CleanupStack::Pop( port ); + } + else // Data not valid. + { + CleanupStack::PopAndDestroy( port ); + } + } + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPPhysicalProxy::VisitL( CWPParameter& aParameter) + { + TInt id = aParameter.ID(); + const TDesC& value = aParameter.Value(); + + if ( value.Length() == 0 ) + { + // No use to store zero length value. + return; + } + + switch ( id ) + { + case EWPParameterPxAddrFQDN: // iGatewayIPAddress + { + // Implementation comments: + // The value of this field is a domain name but we can't + // at the moment resolve this to IP address + // (at least from this adapter). + // Therefore this field can't be used. + // EWPParameterPxAddr is supported + // and should be used. + + /// Validate the domain name + /// Resolve to IP address + + /* // Uncomment if domain name can be validated and IP address resolved + // Add only if we haven't already received this field + if ( !IsReceived( EWPParameterPxAddrFQDN_id )) + { + iGatewayIPAddress = &aParameter; + MarkReceived( EWPParameterPxAddrFQDN_id ); + } + */ + break; + } + case EWPParameterPxAddr: // iGatewayIPAddress + { + // Accept only first occurrence of either PxAddr or PxAddrFQDN + if ( IsReceived( EWPParameterPxAddrFQDN_id ) || + IsReceived( EWPParameterPxAddr_id ) ) + { + return; + } + else + { + // The max allowed lenght for proxy address is 45 bytes. + // Nothing is stored if max lenght is exceeded + if ( aParameter.Value().Length() < 46 ) + { + iProxyAddr = &aParameter; + MarkReceived( EWPParameterPxAddr_id ); + } + } + break; + } + case EWPParameterPxAddrType: + { + if ( !IsReceived( EWPParameterPxAddrType_id ) ) + { + // Only IPv4 addresses are supported. + if ( value == KIPV4 ) + { + iPxAddrType = EPxAddrTypeIPv4; + } + else if( value == KIPV6 ) + { + iPxAddrType = EPxAddrTypeIPv6; + } + else + { + iPxAddrType = EPxAddrTypeUnsupported; + } + MarkReceived( EWPParameterPxAddrType_id ); + } + break; + } + case EWPParameterName: + { + if( !iName ) + { + iName = &aParameter; + } + break; + } + default: + { + // Just let through + } + } + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPPhysicalProxy::VisitLinkL( CWPCharacteristic& aLink ) + { + CWPAPNapdef* item = CWPAPNapdef::NewLC( ETrue, + iDefaultName, + iLogicalCharacteristic, + aLink ); + User::LeaveIfError( iNapdefs.Append( item ) ); + CleanupStack::Pop( item ); // item + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::CWPAPPhysicalProxy +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPAPPhysicalProxy::CWPAPPhysicalProxy( + const TDesC& aDefaultName, + CWPCharacteristic& aLogicalCharacteristic, + CWPAPPort*& aPort ) + : CWPAPItemBase( aDefaultName ), + iLogicalPort( aPort ), + iNapdefs( KInitialArraySize ), + iLogicalCharacteristic( aLogicalCharacteristic ) + { + } + +// ----------------------------------------------------------------------------- +// CWPAPPhysicalProxy::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPAPPhysicalProxy::ConstructL() + { + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPAPPort.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPAPPort.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,294 @@ +/* +* 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: Defines a class, which holds proxy port information. +* +*/ + + + + + +// INCLUDE FILES + +#include "CWPAPPort.h" // Own header +#include "WPAPAdapter.pan" +#include "CWPLog.h" +#include "WPAPDefs.h" + +#include +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CWPAPPort::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWPAPPort* CWPAPPort::NewLC( CWPCharacteristic& aCharacteristic ) + { + CWPAPPort* self = new(ELeave) CWPAPPort(); + CleanupStack::PushL( self ); + self->ConstructL(); + aCharacteristic.AcceptL( *self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::CWPAPPort +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CWPAPPort::CWPAPPort() : CWPAPItemBase( KNullDesC ) + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CWPAPPort::~CWPAPPort() + { + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::Validate +// ----------------------------------------------------------------------------- +// +TBool CWPAPPort::ValidateL() + { + // If we got either service or portnumber and + // Those we successfully interpreted the port + // information is valid. + if ( IsReceived( EWPParameterService_id ) || + IsReceived( EWPParameterPortNbr_id )) + { + return ETrue; + } + LOG("CWPAP ERROR! Port not valid"); + return EFalse; // Nothing received so this is invalid. + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::AddData +// ----------------------------------------------------------------------------- +// +void CWPAPPort::AddDataL( RCmConnectionMethodExt& aCmItem ) + { + LOG("--CWPAP CWPAPPort::AddDataL begin--"); + TInt err(KErrNone); + + // CMManager + TRAP (err, aCmItem.SetBoolAttributeL( CMManager::ECmWapIPSecurity, iConnectionSecurity )); + LOG2("CWPAP EApWapSecurity, value: %d, err: %d", iConnectionSecurity, err); + + // CMManager + TRAP (err, aCmItem.SetIntAttributeL( CMManager::ECmWapIPWSPOption, iSessionMode )); + LOG2("CWPAP EApWapWspOption, value: %d, err: %d", iSessionMode, err); + + if ( iPortNbr ) + { + const TDesC& value = iPortNbr->Value(); + TLex lex( value ); + TUint32 intValue=0; + err = lex.Val( intValue, EDecimal ); + if ( err == KErrNone ) + { + if( intValue > 65535 ) + { + intValue = 0; + } + + // CMManager + TRAP (err, aCmItem.SetIntAttributeL( CMManager::ECmProxyPortNumber, intValue )); + LOG2("CWPAP EApProxyPortNumber, value: %d, err: %d", + intValue, err); + } + } + LOG("--CWPAP CWPAPPort::AddDataL end--"); + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::Name +// ----------------------------------------------------------------------------- +// +const TDesC& CWPAPPort::Name() + { + return KNullDesC; + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::AddItemsL +// ----------------------------------------------------------------------------- +// +TInt CWPAPPort::AddItemsL( RPointerArray& /*aItems*/, + CWPAPItemBase* /*aLogicalProxy*/, + CWPAPItemBase* /*aPhysicalProxy*/ ) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPPort::VisitL( CWPCharacteristic& /*aCharacteristic*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::VisitL +// ----------------------------------------------------------------------------- +// +void CWPAPPort::VisitL( CWPParameter& aParameter ) + { + TInt id = aParameter.ID(); + const TDesC& value = aParameter.Value(); + + if ( value.Length() == 0 ) + { + // No use of checking the zero legth parameter. + return; + } + + switch ( id ) + { + case EWPParameterService: // iConnectionSecurity and iSessionMode + { + // If EWPParameterService value have already received + // or service type has been solved from EWPParameterPortNbr value + // don't accept this anymore. + if ( IsReceived( EWPParameterService_id ) ) + { + break; + } + + if ( value == KCLWSP) + { + // CMManager + SetValues( EFalse, CMManager::ECmWapWspOptionConnectionless, + EWPParameterPortNbr_id ); + } + else if ( value == KCOWSP) + { + // CMManager + SetValues( EFalse, CMManager::ECmWapWspOptionConnectionOriented, + EWPParameterPortNbr_id ); + + } + else if ( value == KCLSECWSP) + { + // CMManager + SetValues( ETrue, CMManager::ECmWapWspOptionConnectionless, + EWPParameterPortNbr_id ); + } + else if ( value == KCOSECWSP) + { + // CMManager + SetValues( ETrue, CMManager::ECmWapWspOptionConnectionOriented, + EWPParameterPortNbr_id ); + } + else + { + // Not supported... + } + break; + } + case EWPParameterPortNbr: // iConnectionSecurity and iSessionMode + { + // If EWPParameterPortNbr value have already handled + // don't accept it anymore. + if ( IsReceived( EWPParameterPortNbr_id ) ) + { + break; + } + + // Store the pointer to port parameter + iPortNbr = &aParameter; + MarkReceived( EWPParameterPortNbr_id ); + + if ( value == K9200 ) + { + // CMManager + SetValues( EFalse, CMManager::ECmWapWspOptionConnectionless, + EWPParameterPortNbr_id ); + + // Type of service identified. + // No need for Service parameter anymore. + MarkReceived( EWPParameterService_id ); + } + else if ( value == K9201 || value == K80 || value == K8080) + { + // CMManager + SetValues( EFalse, CMManager::ECmWapWspOptionConnectionOriented, + EWPParameterPortNbr_id ); + MarkReceived( EWPParameterService_id ); + } + else if ( value == K9202 ) + { + // CMManager + SetValues( ETrue, CMManager::ECmWapWspOptionConnectionless, + EWPParameterPortNbr_id ); + MarkReceived( EWPParameterService_id ); + } + else if ( value == K9203 || value == K443 ) + { + // CMManager + SetValues( ETrue, CMManager::ECmWapWspOptionConnectionOriented, + EWPParameterPortNbr_id ); + MarkReceived( EWPParameterService_id ); + } + else + { + // Not supported... + } + break; + } + default: + { + // Just let through + } + } + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::SetValues +// ----------------------------------------------------------------------------- +// +void CWPAPPort::SetValues( TBool aConnectionSecurity, + TInt aSessionMode, + TMarkedField aReceivedField ) + { + __ASSERT_DEBUG( aReceivedField == EWPParameterService_id || + aReceivedField == EWPParameterPortNbr_id, + Panic( EPreConditionFail ) ); + + iConnectionSecurity = aConnectionSecurity; + iSessionMode = aSessionMode; + + MarkReceived( aReceivedField ); + } + +// ----------------------------------------------------------------------------- +// CWPAPPort::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CWPAPPort::ConstructL() + { + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPLog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPLog.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,94 @@ +/* +* 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: Class offers static utility functions for CWmlBMSubItem. +* +*/ + + + + +// INCLUDE FILES + +#include +#include "CWPLog.h" + + +#ifdef ENABLE_LOGGING +#include + +/// Folder where the WMLBC log resides +_LIT( KLogFolder, "ringbc" ); + +/// The name of the log file +_LIT( KLogFileName, "ringbc.txt" ); + +/// The format in which the time is formatted in log +_LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d "); + +/// The length of the string produced by KLogTimeFormat +const TInt KLogTimeFormatLength = 16; + +/// How many characters a log line can contain +const TInt KLogLineLength = 256; + +#endif // ENABLE_LOGGING + +// ================= MEMBER FUNCTIONS ======================= + +#ifdef ENABLE_LOGGING +// --------------------------------------------------------- +// Log() +// +// --------------------------------------------------------- +void Log::DoLog( TRefByValue aText, ... ) + { + VA_LIST args; + VA_START( args, aText ); + + TBuf buf; + buf.FormatList( aText, args ); + +#ifdef _DEBUG +#ifdef LOG_TO_FILE + RFileLogger logger; + TInt ret = logger.Connect(); + if (ret==KErrNone) + { + logger.SetDateAndTime( EFalse,EFalse ); + logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend ); + TBuf timeStamp; + TTime now; + now.HomeTime(); + TDateTime dateTime; + dateTime = now.DateTime(); + timeStamp.Format( KLogTimeFormat, + dateTime.Hour(), dateTime.Minute(), + dateTime.Second(), dateTime.MicroSecond() ); + buf.Insert( 0, timeStamp ); + + logger.Write(buf); + } + + logger.Close(); + +#else + RDebug::Print( buf ); +#endif // LOG_TO_FILE +#endif // _DEBUG + VA_END( args ); + } + +#endif // ENABLE_LOGGING + +// End of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPLog.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,79 @@ +/* +* 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: Logging class +* +*/ + + + + + +#ifndef CWPLOG_H +#define CWPLOG_H + +///////////////////////////////////////////////////////////////////////////// +// #Defines that control printing of additional information to debug stream. +///////////////////////////////////////////////////////////////////////////// + +// INCLUDES + +#include "CWPLogDef.h" +#include + +// DEFINES + +#ifdef ENABLE_LOGGING +#define LOG(s) Log::DoLog(_L(s)) +#define LOG1(s, v) Log::DoLog( _L(s), v ) +#define LOG2(s, v1, v2) Log::DoLog( _L(s), v1, v2 ) +#else +#define LOG(s) +#define LOG1(s, v) +#define LOG2(s, v1, v2) +#endif // ENABLE_LOGGING + +// DATA TYPES + + +// CLASS DECLARATION + +/** +* Class offers logging functionality. +*/ +class Log + { + + public: + + /** + * Log the message. + * @param aText text to be written to log. + */ + static void DoLog( TRefByValue aText, ... ); + + private: // constructor + + /// Prohibited default constructor + Log(); + + /// Prohibited copy constructor + Log( const Log& ); + + /// Prohibited assignment operator + Log& operator=( const Log& ); + }; + +#endif // CWPLOG_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/CWPLogDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/CWPLogDef.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,37 @@ +/* +* 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: Logging class definition +* +*/ + + + + + +#ifndef CWPLOGDEF_H +#define CWPLOGDEF_H + +///////////////////////////////////////////////////////////////////////////// +// #Defines that control printing of additional information to debug stream. +///////////////////////////////////////////////////////////////////////////// + +// Defining this enables logging +//#define ENABLE_LOGGING + +// Defining this will direct all messages to a log file +//#define LOG_TO_FILE + +#endif // LOGDEF_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/WPAPAdapterGroupProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/WPAPAdapterGroupProxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,46 @@ +/* +* 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: Table of plugins for ECom +* +*/ + + + + + +// INCLUDE FILES +#include +#include +#include "CWPAPAdapter.h" + +// CONSTANTS +const TImplementationProxy KImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F84D9, CWPAPAdapter::NewL) + }; + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// ImplementationGroupProxy +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); + + return KImplementationTable; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/WPAPAdapterPanics.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/WPAPAdapterPanics.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,35 @@ +/* +* 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: Panic implementation +* +*/ + + + + +// INCLUDES + +#include // for GLDEF_C +#include "WPAPAdapter.pan" + +// CONSTANTS + +_LIT(KWPAPAdapter, "wpapadapter.dll"); + +GLDEF_C void Panic( TInt aPanic ) + { + User::Panic( KWPAPAdapter, aPanic ); + } + +// End of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/Src/WPAPUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/Src/WPAPUtil.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,48 @@ +/* +* 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: Class offers common utility methods. +* +*/ + + + + +// INCLUDE FILES + +#include "WPAPUtil.h" // Own header +#include + +// CONSTANTS +// Commented out by JN +//#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw + _LIT( KAdapterName, "WPAPAdapterResource" ); +//#else +// _LIT( KAdapterName, "WPAPAdapter" ); +//#endif + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// WPAPUtil::ReadHBufCLC +// ----------------------------------------------------------------------------- +// +HBufC* WPAPUtil::ReadHBufCL( TInt aResourceId ) + { + TFileName fileName; + Dll::FileName( fileName ); + + return WPAdapterUtil::ReadHBufCL( fileName, KAdapterName, aResourceId ); + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/group/101F84D8.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/group/101F84D8.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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: Resource file defining the AccesspointAdapter plugin. +* +*/ + + + + +// INCLUDES +#include "registryinfo.rh" + + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// theInfo +// Resource defining the ProvisioningAdapter plugin. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x101F84D8; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101F84D5; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F84D9; + version_no = 1; + display_name = "WAP AP PA"; // Use short name to save RAM and ROM space + default_data = ""; + opaque_data = "0"; + } + }; + } + }; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/group/WPAPAdapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/group/WPAPAdapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002-2006 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 accesspoint adapter. +* +*/ + + + +#include +#include +#include + +TARGET WPAPAdapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F84D8 + + +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../Src +SOURCE CWPAPAdapter.cpp +SOURCE CWPAPItemBase.cpp +SOURCE CWPAPAccesspointItem.cpp +SOURCE CWPAPNapdef.cpp +SOURCE CWPAPLogicalProxy.cpp +SOURCE CWPAPPhysicalProxy.cpp +SOURCE CWPAPPort.cpp +SOURCE WPAPUtil.cpp +SOURCE WPAPAdapterPanics.cpp +SOURCE WPAPAdapterGroupProxy.cpp +SOURCE CWPLog.cpp + +SOURCEPATH ../group + +START RESOURCE 101F84D8.rss +TARGET WPAPAdapter.rsc +END + +START RESOURCE WPAPAdapterResource.rss +HEADER +TARGET WPAPAdapterResource.rsc +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + + +USERINCLUDE ../Inc +USERINCLUDE ../../bld +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib +LIBRARY ProvisioningEngine.lib +LIBRARY commdb.lib +LIBRARY FeatMgr.lib +LIBRARY ecom.lib +LIBRARY centralrepository.lib +LIBRARY cmmanager.lib +LIBRARY eapsymbiantools.lib +LIBRARY eaptools.lib +LIBRARY eaptrace.lib +DEBUGLIBRARY flogger.lib // Only in debug builds + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/group/WPAPAdapterResource.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/group/WPAPAdapterResource.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,35 @@ +/* +* 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: Resource file. +* +*/ + + + + +// INCLUDES +#include +#include + +// Rich text labels + +RESOURCE LBUF r_qtn_sm_wapap_name + { + txt = qtn_sm_wapap_name; + } + +RESOURCE LBUF r_qtn_sm_wml_accesspoints + { + txt = qtn_sm_wml_accesspoints; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2001-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 AccesspointAdapter CP adapter +* +*/ + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +//../rom/WPAPAdapter.iby CORE_MW_LAYER_IBY_EXPORT_PATH(WPAPAdapter.iby) +//../rom/WPAPAdapterResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(WPAPAdapterResources.iby) + +// export localised loc file +../loc/WPAPAdapter.loc MW_LAYER_LOC_EXPORT_PATH(wpapadapter.loc) + +PRJ_MMPFILES +WPAPAdapter.mmp + +PRJ_TESTMMPFILES + diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/loc/WPAPAdapter.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/loc/WPAPAdapter.loc Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2002-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: This is a localisation file for AccesspointAdapter +* +*/ + + + + +// LOCALISATION STRINGS + +//d: Summary text for access points +//l: popup_info_list_pane_t2/opt1 +//r: 5.0 + +#define qtn_sm_wml_accesspoints "Access points:" + +//d:This is the default name for new WAP access point. +//l:query_popup_data_pane_t1/opt4 +//r: 5.0 + +#define qtn_sm_wapap_name "WAP access point" + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/rom/WPAPAdapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/rom/WPAPAdapter.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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 wpapadapter +* +*/ + + + + +#ifndef WPAPADAPTER_IBY +#define WPAPADAPTER_IBY + +#include +#include + +ECOM_PLUGIN(WPAPAdapter.dll, WPAPAdapter.rsc) + +#endif // WPAPADAPTER_IBY diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/accesspointadapter/rom/WPAPAdapterResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/accesspointadapter/rom/WPAPAdapterResources.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,29 @@ +/* +* 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 wpapadapter +* +*/ + + + + +#ifndef WPAPADAPTERRESOURCES_IBY +#define WPAPADAPTERRESOURCES_IBY + +#include +#include + +data=DATAZ_\RESOURCE_FILES_DIR\WPAPAdapterResource.rsc RESOURCE_FILES_DIR\WPAPAdapterResource.rsc + +#endif // WPAPADAPTERRESOURCES_IBY diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/bld/ProvisioningDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/bld/ProvisioningDebug.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,131 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/bld/ProvisioningUIDs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/bld/ProvisioningUIDs.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,147 @@ +/* +* 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 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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: for building DM adapters +* +*/ + +PRJ_PLATFORMS +DEFAULT +PRJ_EXPORTS +../Rom/ProvisioningAdapter.iby CORE_APP_LAYER_IBY_EXPORT_PATH(provisioningAdapter.iby) +../Rom/ProvisioningAdapterResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(provisioningAdapterresources.iby) + +../MbxNbrAdapter/loc/MailboxAdapter.loc MW_LAYER_LOC_EXPORT_PATH(mailboxadapter.loc) +../accesspointadapter/loc/WPAPAdapter.loc MW_LAYER_LOC_EXPORT_PATH(WPAPAdapter.loc) +../StreamingAdapter/loc/StreamingAdapter.loc MW_LAYER_LOC_EXPORT_PATH(streamingadapter.loc) + + +#include "../accesspointadapter/group/bld.inf" +#include "../MbxNbrAdapter/Group/bld.inf" +#include "../StreamingAdapter/Group/bld.inf" +#include "../WAPAdapter/Group/bld.inf" \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/rom/ProvisioningAdapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/rom/ProvisioningAdapter.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2002-2006 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 the Provisioning +* +*/ + + +#ifndef __PROVISIONINGADAPTER_IBY__ +#define __PROVISIONINGADAPTER_IBY__ + +ECOM_PLUGIN(WPWAPAdapter.dll,101F84DC.rsc) +ECOM_PLUGIN(WPStreamingAdapter.dll,101F85CB.rsc) +ECOM_PLUGIN(WPAPAdapter.dll, WPAPAdapter.rsc) +ECOM_PLUGIN(WPMbxNbrAdapter.dll,10207281.rsc) + +#endif \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omacpadapters/rom/ProvisioningAdapterResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omacpadapters/rom/ProvisioningAdapterResources.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2002-2006 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 the Provisioning Resources +* +*/ + + +#ifndef __PROVISIONINGADAPTERRESOURCES_IBY__ +#define __PROVISIONINGADAPTERRESOURCES_IBY__ + + +data=DATAZ_\RESOURCE_FILES_DIR\WPWAPAdapterResource.rsc RESOURCE_FILES_DIR\WPWAPAdapter.rsc +data=DATAZ_\RESOURCE_FILES_DIR\WpstreamingadapterResource.rsc RESOURCE_FILES_DIR\Wpstreamingadapter.rsc +data=DATAZ_\RESOURCE_FILES_DIR\WPMbxNbrAdapterResource.rsc RESOURCE_FILES_DIR\WPMbxNbrAdapter.rsc +data=DATAZ_\RESOURCE_FILES_DIR\WPAPAdapterResource.rsc RESOURCE_FILES_DIR\WPAPAdapterResource.rsc + +#endif \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/extmemctrl/data/2002132B.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/extmemctrl/data/2002132B.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,47 @@ +/* +* 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: Resource file for ExtMemCtrl Interface Implementation. +* +*/ + +#include "registryinfo.rh" + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x2002132B; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x2001FD40; + implementations = + { + // Info for ExtMemCtrlDCMOAdapter + IMPLEMENTATION_INFO + { + implementation_uid = 0x2002132C; + version_no = 1; + display_name = "ExtMemCtrlDCMOAdapter"; + default_data = "text/wml||This is the type of data that this implementation understands. (Can be anything which will allow the resolver to identify this implementation as the correct one at run time. In this case it is a mime type)."; + opaque_data = "ExternalMemory"; + } + }; + } + }; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/extmemctrl/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/extmemctrl/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ +/* +* 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: This file provides building information for FOTACtrl. +* +*/ + +#include + +PRJ_EXPORTS + +PRJ_MMPFILES +extmemctrldcmoadapter.mmp + + +// End Of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/extmemctrl/group/extmemctrldcmoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/extmemctrl/group/extmemctrldcmoadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,52 @@ +/* +* 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: ExtMemCtrl plug-in adapter for DCMO +* +*/ + +#include + +TARGET extmemctrldcmoadapter.dll +TARGETTYPE PLUGIN + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x2002132B +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE extmemctrldcmoadapter.cpp +SOURCE extmemctrldcmoadapterproxy.cpp + +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore + +SOURCEPATH ../data +start resource 2002132B.rss +TARGET extmemctrldcmoadapter.rsc +LANGUAGE_IDS +end + +LIBRARY euser.lib ecom.lib efsrv.lib bafl.lib etul.lib +LIBRARY centralrepository.lib +LIBRARY platformenv.lib +LIBRARY commonengine.lib // Series 60 common components library +LIBRARY hbcore.lib hbwidgets.lib + +SMPSAFE diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/extmemctrl/inc/extmemctrldcmoadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/extmemctrl/inc/extmemctrldcmoadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,89 @@ +/* +* 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: ExtMemCtrl plug-in adapter for DCMO +* +*/ + +#ifndef _EXTMEMCTRLDCMOADAPTER__ +#define _EXTMEMCTRLDCMOADAPTER__ + +#include "dcmointerface.h" + +// An implementation of the CDCMOInterface definition +class CExtMemCtrlDCMOAdapter : public CDCMOInterface + { +public: + // Standardised safe construction which leaves nothing the cleanup stack. + static CExtMemCtrlDCMOAdapter* NewL(TAny* aInitParams); + // Destructor + ~CExtMemCtrlDCMOAdapter(); + + // Implementation of CDCMOInterface + /** + * Get the interger type value + * @param aId + * @param aValue + * @return TDCMOStatus + */ + TDCMOStatus GetDCMOPluginIntAttributeValueL(TDCMONode aId, TInt& aValue); + + /** + * Get the string type value + * @param aId + * @param aStrValue + * @return TDCMOStatus + */ + TDCMOStatus GetDCMOPluginStrAttributeValueL(TDCMONode aId, TDes& aStrValue); + + /** + * Set the interger type value + * @param aId + * @param aValue + * @return TDCMOStatus + */ + TDCMOStatus SetDCMOPluginIntAttributeValueL(TDCMONode aId, TInt aValue); + + /** + * Set the string type value + * @param aId + * @param aStrValue + * @return TDCMOStatus + */ + TDCMOStatus SetDCMOPluginStrAttributeValueL(TDCMONode aId, const TDes& aStrValue); + + /** + * Get the localized name of this plug-in + * @param aLocName + * @return None + */ + void GetLocalizedNameL (HBufC*& aLocName); + +private: + // Construction + CExtMemCtrlDCMOAdapter(TAny* aInitParams); + + /** + * second phase constructor + */ + void ConstructL(); + +private: + // Data to pass back from implementation to client + HBufC* iProperty; + HBufC* iDescription; + // Parameters taken from client + CDCMOInterface::TDCMOInterfaceInitParams* iInitParams; + }; + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/extmemctrl/src/extmemctrldcmoadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/extmemctrl/src/extmemctrldcmoadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,257 @@ +/* +* 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: ExtMemCtrl plug-in adapter for DCMO +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include "extmemctrldcmoadapter.h" +#include "hbtextresolversymbian.h" + +_LIT( KdcmoResourceFileName, "deviceupdates_" ); +_LIT( KdcmoResourceFilePath, "z:/resource/qt/translations/" ); +_LIT( KExtMemCtrlProperty, "ExternalMemory"); +_LIT( KExtMemCtrlDescription, "Used to enable/disable the ExtMem"); + + +// Construction and destruction functions + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::NewL +// ---------------------------------------------------------------------------------------- +CExtMemCtrlDCMOAdapter* CExtMemCtrlDCMOAdapter::NewL(TAny* aParams) + { + CExtMemCtrlDCMOAdapter* self=new(ELeave) CExtMemCtrlDCMOAdapter(aParams); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::~CExtMemCtrlDCMOAdapter +// ---------------------------------------------------------------------------------------- +CExtMemCtrlDCMOAdapter::~CExtMemCtrlDCMOAdapter() + { + delete iProperty; + iProperty = NULL; + delete iDescription; + iDescription = NULL; + } + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::CExtMemCtrlDCMOAdapter +// ---------------------------------------------------------------------------------------- +CExtMemCtrlDCMOAdapter::CExtMemCtrlDCMOAdapter(TAny* aInitParams) +: iInitParams((CDCMOInterface::TDCMOInterfaceInitParams*)aInitParams) + { + // See ConstructL() for initialisation completion. + } + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::ConstructL +// ---------------------------------------------------------------------------------------- +void CExtMemCtrlDCMOAdapter::ConstructL() +{ + // Safely complete the initialization of the constructed object + if(iInitParams->descriptor) + iProperty = (iInitParams->descriptor)->AllocL(); + else + iProperty = KExtMemCtrlProperty().AllocL(); + iDescription = KExtMemCtrlDescription().AllocL(); +} + +// Implementation of CDCMOInterface + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::GetDCMOPluginIntAttributeValueL +// Gets the integer attribute value. +// ---------------------------------------------------------------------------------------- +TDCMOStatus CExtMemCtrlDCMOAdapter::GetDCMOPluginIntAttributeValueL(TDCMONode aId, TInt& aValue) +{ + TDCMOStatus status(EDcmoSuccess); + TInt err(KErrNone); + + switch(aId) + { + case EGroup: { + aValue = EHardware; + } + break; + case EAttached: { + aValue = 0; + RFs fsMemoryCard; + err = fsMemoryCard.Connect(); + if ( err != KErrNone ) + { + status = EDcmoFail; + } + TDriveInfo dInfo; + TVolumeInfo vInfo; + TInt error = fsMemoryCard.Drive( dInfo, EDriveF ); + if( error == KErrNone ) + { + error = fsMemoryCard.Volume( vInfo, EDriveF ); + if( error == KErrNone ) + { + aValue = 1; + } + } + fsMemoryCard.Close(); + } + break; + case EEnabled:{ + RFs fsMemoryCard; + err = fsMemoryCard.Connect(); + if ( err != KErrNone ) + { + status = EDcmoFail; + } + + TDriveInfo info; + err=fsMemoryCard.Drive(info, EDriveF); + // DBG_ARGS8( _S8("ExtMem err = %d info.iType = %d"), err, info.iType ); + + if (info.iType == EMediaNotPresent || err != KErrNone ||info.iType == EMediaUnknown ) + { + aValue = 0; + } + else + { + aValue = 1; + } + fsMemoryCard.Close(); + } + break; + case EDenyUserEnable: { + aValue = 1; + } + break; + case ENotifyUser: { + aValue = 1; + } + break; + default : + status = EDcmoNotFound; + } + return status; +} + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::GetDCMOPluginStrAttributeValueL +// Gets the string attribute value. +// ---------------------------------------------------------------------------------------- +TDCMOStatus CExtMemCtrlDCMOAdapter::GetDCMOPluginStrAttributeValueL(TDCMONode aId, TDes& aStrValue) +{ + TDCMOStatus status(EDcmoSuccess); + switch(aId) + { + case EProperty: aStrValue = *iProperty; + break; + case EDescription: aStrValue = *iDescription; + break; + default : + status = EDcmoNotFound; + } + return status; +} + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::SetDCMOPluginIntAttributeValueL +// Sets the integer attribute value. +// ---------------------------------------------------------------------------------------- +TDCMOStatus CExtMemCtrlDCMOAdapter::SetDCMOPluginIntAttributeValueL(TDCMONode aId, TInt aValue) +{ + TDCMOStatus status(EDcmoFail); + TInt err(KErrNone); + + switch(aId) + { + case EDenyUserEnable: + break; + case ENotifyUser: + break; + case EEnable: { + RFs fsMemoryCard; + err = fsMemoryCard.Connect(); + if ( err != KErrNone ) + { + return status ; + } + TBuf<255> fsysname; + fsysname.Zero(); + if (!aValue) + { + fsMemoryCard.FileSystemName(fsysname,EDriveF); + TRequestStatus stat; + fsMemoryCard.NotifyDismount(EDriveF, stat, EFsDismountForceDismount); + User::WaitForRequest(stat); + //err= fsMemoryCard.DismountFileSystem(fsysname, EDriveF); + //if (err == KErrNone) + status =EDcmoSuccess; + } + else + { + TInt err(fsMemoryCard.FileSystemName(fsysname,EDriveF)); + if (err != KErrNone && !fsysname.Length()) + { + _LIT( KFmgrFatFSName, "Fat" ); + err = fsMemoryCard.MountFileSystem( KFmgrFatFSName, EDriveF ); + } + status = EDcmoSuccess; + } + fsMemoryCard.Close(); + CRepository *rep = NULL; + TRAPD( err1, rep = CRepository::NewL( KCRUidDeviceManagementInternalKeys )) ; + if(!err1) + rep->Set( KDevManMemCardCtrl, aValue ); + delete rep; + rep = NULL; + } + break; + default : + status = EDcmoNotFound; + } + return status; +} + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::SetDCMOPluginStrAttributeValueL +// Sets the string attribute value. +// ---------------------------------------------------------------------------------------- +TDCMOStatus CExtMemCtrlDCMOAdapter::SetDCMOPluginStrAttributeValueL(TDCMONode /* aId */, const TDes& /* aStrValue */) +{ + // Nothing to do + TDCMOStatus status(EDcmoNotSupported); + return status; +} + +// ---------------------------------------------------------------------------------------- +// CExtMemCtrlDCMOAdapter::GetLocalizedNameL +// returns the localized plug-in name. +// ---------------------------------------------------------------------------------------- +void CExtMemCtrlDCMOAdapter::GetLocalizedNameL (HBufC*& aLocName) +{ + TBool result = HbTextResolverSymbian::Init(KdcmoResourceFileName, KdcmoResourceFilePath ); + _LIT(KTextExtMemory, "txt_device_update_info_external_memory_card"); + aLocName = HbTextResolverSymbian::LoadL(KTextExtMemory); +} diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/extmemctrl/src/extmemctrldcmoadapterproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/extmemctrl/src/extmemctrldcmoadapterproxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,37 @@ +/* +* 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: ExtMemCtrl plug-in adapter for DCMO +* +*/ + +#include +#include + +#include "extmemctrldcmoadapter.h" + + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x2002132C, CExtMemCtrlDCMOAdapter::NewL), + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,27 @@ +/* +* 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 provides building information for DCMO plug-in adapters. +* +*/ + + +PRJ_PLATFORMS + +PRJ_EXPORTS +../rom/omadcmoadapters.iby CORE_APP_LAYER_IBY_EXPORT_PATH(omadcmoadapters.iby) + +PRJ_MMPFILES + +#include "../extmemctrl/group/bld.inf" +#include "../wlanctrl/group/bld.inf" diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/rom/omadcmoadapters.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/rom/omadcmoadapters.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,26 @@ +/* +* 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: Image description file for project dcmo +* +*/ + +#ifndef _OMADCMOADAPTERS_IBY_ +#define _OMADCMOADAPTERS_IBY_ + +#ifdef FF_RUNTIME_DEVICE_CAPABILITY_CONFIGURATION +ECOM_PLUGIN(extmemctrldcmoadapter.dll,extmemctrldcmoadapter.rsc) +ECOM_PLUGIN(wlanctrldcmoadapter.dll,wlanctrldcmoadapter.rsc) +#endif + +#endif // _OMADCMOADAPTERS_IBY_ diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/wlanctrl/data/wlanctrldcmoadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/wlanctrl/data/wlanctrldcmoadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* + * ============================================================================== + * 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 "registryinfo.rh" + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x20022FB5; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x2001FD40; + implementations = + { + // Info for WlanCtrlDCMOAdapter + IMPLEMENTATION_INFO + { + implementation_uid = 0x20022FB4; + version_no = 1; + display_name = "WlanCtrlDCMOAdapter"; + default_data = "text/wml||Allow/Disallow Wifi."; + opaque_data = "WLAN"; + } + }; + } + }; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/wlanctrl/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/wlanctrl/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,32 @@ +/* + * ============================================================================== + * 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 +wlanctrldcmoadapter.mmp + + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/wlanctrl/group/wlanctrldcmoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/wlanctrl/group/wlanctrldcmoadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* + * ============================================================================== + * 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 +CAPABILITY CAP_GENERAL_DLL +TARGET wlanctrldcmoadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20022FB5 +VENDORID VID_DEFAULT + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore + +USERINCLUDE ../inc + +SOURCEPATH ../data +START RESOURCE wlanctrldcmoadapter.rss +TARGET wlanctrldcmoadapter.rsc +LANGUAGE_IDS +END + +LIBRARY euser.lib ECom.lib featmgr.lib +LIBRARY commonengine.lib +LIBRARY hbcore.lib hbwidgets.lib + +SOURCEPATH ../src +SOURCE wlanctrldcmoadapterproxy.cpp wlanctrldcmoadapter.cpp + +SMPSAFE diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/wlanctrl/inc/wlanctrldcmoadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/wlanctrl/inc/wlanctrldcmoadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,60 @@ +// +/* + * ============================================================================== + * 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 _WlanCtrlDCMOAdapter__ +#define _WlanCtrlDCMOAdapter__ + +#include "dcmointerface.h" +#include "dcmoconst.h" + +// An implementation of the CDCMOInterface definition +class CWLanCtrlDCMOAdapter : public CDCMOInterface + { +public: + // Standardised safe construction which leaves nothing the cleanup stack. + static CWLanCtrlDCMOAdapter* NewL(TAny* aInitParams); + + // Destructor + ~CWLanCtrlDCMOAdapter(); + + // Implementation of CDCMOInterface + virtual TDCMOStatus GetDCMOPluginIntAttributeValueL( TDCMONode aId, TInt& aValue); + virtual TDCMOStatus GetDCMOPluginStrAttributeValueL( TDCMONode aId, TDes& aStrValue); + virtual TDCMOStatus SetDCMOPluginIntAttributeValueL( TDCMONode aId, TInt aValue); + virtual TDCMOStatus SetDCMOPluginStrAttributeValueL( TDCMONode aId, const TDes& aStrValue); + virtual void GetLocalizedNameL( HBufC*& aLocName ); + +private: + // Construction + CWLanCtrlDCMOAdapter(TAny* aInitParams); + void ConstructL(); + TDCMOStatus MapFeatureControlError( TInt aErrorCode ); + +private: + // Data to pass back from implementation to client + HBufC* iProperty; + HBufC* iDescription; + // Parameters taken from client + CDCMOInterface::TDCMOInterfaceInitParams* iInitParams; + + + }; + +#endif diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/wlanctrl/src/wlanctrldcmoadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/wlanctrl/src/wlanctrldcmoadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,200 @@ +/* + * ============================================================================== + * 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 "wlanctrldcmoadapter.h" +#include "hbtextresolversymbian.h" + +_LIT( KdcmoResourceFileName, "deviceupdates_" ); +_LIT( KdcmoResourceFilePath, "z:/resource/qt/translations/" ); +_LIT( KWlanCtrlProperty, "WLAN" ); +_LIT( KDisableWlanDescription, "Used to enable/disable the WLAN connectivity." ); // Description + + +TDCMOStatus CWLanCtrlDCMOAdapter::MapFeatureControlError( TInt aErrorCode ) + { + TDCMOStatus status( EDcmoFail ); + + switch ( aErrorCode ) + { + case KErrNone: + status = EDcmoSuccess; + break; + case KErrPermissionDenied: + case KErrAccessDenied: + status = EDcmoAccessDenied; + break; + case KErrNotFound: + status = EDcmoNotFound; + break; + default: + break; + } + return status; + } + +// Construction and destruction functions + +CWLanCtrlDCMOAdapter* CWLanCtrlDCMOAdapter::NewL( TAny* aParams ) + { + CWLanCtrlDCMOAdapter* self = new ( ELeave ) CWLanCtrlDCMOAdapter( aParams ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CWLanCtrlDCMOAdapter::~CWLanCtrlDCMOAdapter() + { + FeatureManager::UnInitializeLib(); + + delete iProperty; + delete iDescription; + } + +CWLanCtrlDCMOAdapter::CWLanCtrlDCMOAdapter( TAny* aInitParams ) +: iInitParams( ( CDCMOInterface::TDCMOInterfaceInitParams* ) aInitParams ) + { + // See ConstructL() for initialisation completion. + } + +void CWLanCtrlDCMOAdapter::ConstructL() + { + // Set up the data to pass back + iProperty = KWlanCtrlProperty().AllocL(); + iDescription = KDisableWlanDescription().AllocL(); + + FeatureManager::InitializeLibL(); + + } + + +// Implementation of CDCMOInterface +TDCMOStatus CWLanCtrlDCMOAdapter::SetDCMOPluginIntAttributeValueL(TDCMONode aId, TInt aValue) +{ + TDCMOStatus status(EDcmoFail); + TInt err( KErrNone ); + + switch( aId ) + { + case EDenyUserEnable: + status = EDcmoNotSupported; + break; + case ENotifyUser: + status = EDcmoNotSupported; + break; + case EEnable: + { + RFeatureControl featureControl; + TUid wlanUid( TUid::Uid( KFeatureIdProtocolWlan ) ); + err = featureControl.Connect(); + + if ( err == KErrNone ) + { + if( aValue == 0 ) + { + // Disable WLAN + err = featureControl.DisableFeature( wlanUid ); + } + else if ( aValue == 1 ) + { + // Enable WLAN + err = featureControl.EnableFeature( wlanUid ); + } + status = MapFeatureControlError( err ); + featureControl.Close(); + } + + } + break; + default: + break; + } + + return status; +} + +TDCMOStatus CWLanCtrlDCMOAdapter::GetDCMOPluginIntAttributeValueL(TDCMONode aId, TInt& aValue) +{ + TDCMOStatus status( EDcmoSuccess ); + + switch(aId) + { + case EGroup: + aValue = EConnectivity; + break; + case EAttached: + aValue = EFalse; + break; + case EEnabled: + aValue = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + break; + case EDenyUserEnable: + aValue = EFalse; + break; + case ENotifyUser: + aValue = ETrue; + break; + case EEnable: + status = EDcmoAccessDenied; + break; + default: + break; + } + + return status; +} + +TDCMOStatus CWLanCtrlDCMOAdapter::SetDCMOPluginStrAttributeValueL( TDCMONode /* aId */, + const TDes& /* aStrValue */ ) +{ + // Nothing to do + TDCMOStatus status( EDcmoFail ); + + return status; +} + +TDCMOStatus CWLanCtrlDCMOAdapter::GetDCMOPluginStrAttributeValueL( TDCMONode aId, TDes& aStrValue ) +{ + TDCMOStatus status( EDcmoSuccess ); + switch( aId ) + { + case EProperty: + aStrValue = *iProperty; + break; + case EDescription: + aStrValue = *iDescription; + break; + default: + status = EDcmoNotFound; + break; + } + + return status; +} + +void CWLanCtrlDCMOAdapter::GetLocalizedNameL( HBufC*& aLocName ) + { + TBool result = HbTextResolverSymbian::Init(KdcmoResourceFileName, KdcmoResourceFilePath ); + _LIT(KTextWLAN, "txt_device_update_info_wlan"); + aLocName = HbTextResolverSymbian::LoadL(KTextWLAN); + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omadcmoadapters/wlanctrl/src/wlanctrldcmoadapterproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadcmoadapters/wlanctrl/src/wlanctrldcmoadapterproxy.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,43 @@ +/* + * ============================================================================== + * 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 "wlanctrldcmoadapter.h" + +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) {{aUid},(aFuncPtr)} +#endif + + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x20022FB4, CWLanCtrlDCMOAdapter::NewL), + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/group/connmoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/group/connmoadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/inc/AddBuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/inc/AddBuffer.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/inc/BranchBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/inc/BranchBase.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/inc/ConnMoAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/inc/ConnMoAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/inc/NapBranch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/inc/NapBranch.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/inc/ProxyBranch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/inc/ProxyBranch.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/inc/Utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/inc/Utils.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/rom/connmoadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/rom/connmoadapter.iby Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/src/AddBuffer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/src/AddBuffer.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/src/BranchBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/src/BranchBase.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/src/ConnMoAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/src/ConnMoAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/src/ConnMoAdapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/src/ConnMoAdapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/src/Luid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/src/Luid.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/src/NapBranch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/src/NapBranch.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/src/ProxyBranch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/src/ProxyBranch.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/src/Utils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/src/Utils.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/traces/OstTraceDefinitions.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/traces/fixed_id.definitions Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/connmoadapter/traces/trace.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/connmoadapter/traces/trace.properties Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/dcmodmadapter/data/dcmodmadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/dcmodmadapter/data/dcmodmadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,58 @@ +/* +* 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: Resource file for DCMO DM Adapter. +* +*/ + +// INCLUDES +#include +#include + +// CONSTANTS + +// MACROS + +// RESOURCE DEFINITIONS + +//----------------------------------------------------------------------------- +// +// theInfo +// - +// +//----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x2001FD3E; // The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001FD3F; + version_no = 1; + display_name = "DCMO DM Adapter"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End Of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/dcmodmadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/dcmodmadapter/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,25 @@ +/* +* 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: This file provides building information for DCMO DM Adapter. +* +*/ + +#include + +PRJ_EXPORTS + +PRJ_MMPFILES +dcmodmadapter.mmp + +// End Of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/dcmodmadapter/group/dcmodmadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/dcmodmadapter/group/dcmodmadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,56 @@ +/* +* 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: DCMO DM Adapter +* +*/ + +#include + +TARGET dcmodmadapter.dll +TARGETTYPE PLUGIN +CAPABILITY CAP_ECOM_PLUGIN + +UID 0x10009D8D 0x2001FD3E +VENDORID VID_DEFAULT +LANG SC + +SOURCEPATH ../src +SOURCE dcmodmadapter.cpp +SOURCE dcmodmadaptermain.cpp + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SYSTEMINCLUDE /epoc32/include/ecom + + +START RESOURCE ../data/dcmodmadapter.rss +TARGET dcmodmadapter.rsc +LANGUAGE_IDS +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY centralrepository.lib +LIBRARY dmutil.lib +LIBRARY charconv.lib +LIBRARY dcmoclient.lib +LIBRARY policyengine.lib +LIBRARY nsmldebug.lib + + +SMPSAFE +// End Of File + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/dcmodmadapter/inc/dcmodmadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/dcmodmadapter/inc/dcmodmadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,528 @@ +/* +* 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: DCMO DM Adapter +* +*/ + +#ifndef __DCMODMADAPTER_H +#define __DCMODMADAPTER_H + +// INCLUDES +#include +#include +#include +#include "dcmoclient.h" +#include "dcmoconst.h" + +const TUid KCRUidDCMOServer={0x2001FE47}; +const TInt KDCMOKeyMaxNumber = 16; +const TInt KDCMOPropertyNumber = 1; + +_LIT8( KMimeType, "text/plain" ); +_LIT8( KNSmlDCMOAdapterTitle, "DCMO DM Adapter" ); +_LIT8( KNSmlTrue, "True" ); +_LIT8( KNSmlFalse, "False" ); + +_LIT8( KNSmlHardware, "Hardware" ); +_LIT8( KNSmlIO, "IO" ); +_LIT8( KNSmlConnectivity, "Connectivity" ); +_LIT8( KNSmlSoftware, "Software" ); +_LIT8( KNSmlService, "Service" ); + +//DDF accepted DM-fieldnames +_LIT8( KNSmlDdfProperty, "Property" ); +_LIT8( KNSmlDdfGroup, "Group" ); +_LIT8( KNSmlDdfDescription, "Description" ); +_LIT8( KNSmlDdfAttached, "Attached" ); +_LIT8( KNSmlDdfEnabled, "Enabled" ); +_LIT8( KNSmlDdfDCMOConfig, "DCMOConfig" ); +_LIT8( KNSmlDdfDenyUserEnable, "DenyUserEnable" ); +_LIT8( KNSmlDdfNotifyUser, "NotifyUser" ); +_LIT8( KNSmlDdfOperations, "Operations" ); +_LIT8( KNSmlDdfEnable, "Enable" ); +_LIT8( KNSmlDdfDisable, "Disable" ); +_LIT8( KNSmlDdfOpExt, "Ext" ); +_LIT8( KNSmlDdfExt, "Ext" ); +_LIT8( KNSmlDdfOpExtSemiEnable, "SemiEnable" ); + +//DDF DM-field descriptions +_LIT8( KDCMOCapabilityDescription, "DCMO capability node"); +_LIT8( KNSmlDdfPropertyDescription, "Property of DCMO" ); +_LIT8( KNSmlDdfGroupDescription, "Group of DCMO" ); +_LIT8( KNSmlDdfDescDescription, "The Description node" ); +_LIT8( KNSmlDdfAttachedDescription, "Attached" ); +_LIT8( KNSmlDdfEnabledDescription, "Enabled" ); +_LIT8( KNSmlDdfDCMOConfigDescription, "The DCMO Configuration node" ); +_LIT8( KNSmlDdfDenyUserEnableDescription, "DenyUserEnable" ); +_LIT8( KNSmlDdfNotifyUserDescription, "NotifyUser" ); +_LIT8( KNSmlDdfOperationsDescription , "Operations node " ); +_LIT8( KNSmlDdfEnableDescription , "Enable Operation " ); +_LIT8( KNSmlDdfDisableDescription , "Disable Operation " ); +_LIT8( KNSmlDdfOpExtDescription , "Extra Operations " ); +_LIT8( KNSmlDdfExtDescription, "Extra" ); +_LIT8( KNSmlDdfOpExtSemiEnableDescription, "Semi Enable Operation" ); + +_LIT8( KDcmoMatch, "DCMO" ); +_LIT8( KDcmoMatch2, "DCMO/*" ); +_LIT8( KDcmoMatch3, "DCMO/*/*" ); +_LIT8( KDcmoConfigMatch, "DCMO/*/DCMOConfig"); +_LIT8( KSegmDcmo, "Property/Group/Description/Attached/Enabled/DCMOConfig/Operations/Ext"); +_LIT8( KSegmDcmoConfig, "DenyUserEnable/NotifyUser"); +_LIT8( KSegmDcmoOperations, "Enable/Disable/Ext"); +_LIT8( KDcmoConfigDenyUserEnableMatch, "DCMO/*/DCMOConfig/DenyUserEnable"); +_LIT8( KDcmoConfigNotifyUserMatch, "DCMO/*/DCMOConfig/NotifyUser"); +_LIT8( KDcmoOperationsMatch, "DCMO/*/Operations"); +_LIT8( KDcmoOperationsExtMatch, "DCMO/*/Operations/Ext"); + + +_LIT8( KNSmlBluetooth, "Bluetooth" ); + +// CLASS DECLARATION + +/** +* Adapter class +* Provides DM adapter interface +*/ +class CDcmoDMAdapter : public CSmlDmAdapter + { + + public: // Constructors, destructor + /** + * Create instance of CDcmoDMAdapter + * @param aDmCallBack + * @return Instance of CDcmoDMAdapter + */ + static CDcmoDMAdapter* NewL( MSmlDmCallback* aDmCallback ); + + /** + * Create instance of CDcmoDMAdapter + * @param aDmCallBack + * @return Instance of CDcmoDMAdapter + */ + static CDcmoDMAdapter* NewLC( MSmlDmCallback* aDmCallback ); + + /** + * C++ Destructor + */ + virtual ~CDcmoDMAdapter(); + + public: + /** + * The function returns current version of the DDF. + * By asking current DDF versions from adapters DM Module can control + * possible changes in the data structure and send the changed DDF + * description to a management server. + * This function is always called after DDFStructureL. + * @param aVersion DDF version of the adapter. (filled by the adapter) + * @publishedPartner + * @prototype + */ + void DDFVersionL( CBufBase& aVersion ); + + /** + * The function for filling the DDF structure of the adapter + * This function is only called once, immediately after the adapter is created. + * @param aDDFObject Reference to root object. A DM adapter starts filling + the data structure by calling AddChildObjectL to the root object and + so describes the DDF of the adapter. + * @publishedPartner + * @prototype + */ + 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 should be + * returned by calling SetStatusL function of MSmlDmCallback callback + * interface. This makes it possible to buffer the commands. However, all + * the status codes for buffered commands must be returned at the latest when + * the adapter's CompleteOutstandingCmdsL() is called. + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter has earlier returned a + LUID to the DM Module). For new objects, this is the LUID + inherited through the parent node. + * @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 + * @publishedPartner + * @prototype + */ + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef + ); + + /** + * The function creates new leaf objects, or replaces data in existing leaf + * objects, in the case where data is large enough to be streamed. The + * information about the success of the command should be returned by calling + * SetStatusL function of MSmlDmCallback callback interface. This makes it + * possible to buffer the commands. However, all the status codes for buffered + * commands must be returned at the latest when the CompleteOutstandingCmdsL() + * of adapter is called. + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter has earlier returned a + LUID to the DM Module). For new objects, this is the LUID + inherited through the parent node. + * @param aStream Data of the object. Adapter should create write stream + and return, when data is written to stream by DM agent, + StreamCommittedL() is called by DM engine + * @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. + * @publishedPartner + * @prototype + */ + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef + ); + + /** + * The function deletes an object and its child objects. The SetStatusL + * should be used as described in UpdateLeafObjectL() + * @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. + * @publishedPartner + * @prototype + */ + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef + ); + + /** + * The function fetches data of a leaf object. The SetStatusL should be used + * as described in UpdateLeafObjectL(). The data is returned by using the + * SetResultsL function of MSmlCallback callback interface, and may be streamed. + * @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. + * @publishedPartner + * @prototype + */ + 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. The SetStatusL should be used + * as described in FetchLeafObjectL(). The size value is returned by using + * the SetResultsL function of MSmlCallback callback interface, and must be + * a decimal integer expressed as a string, eg. "1234". + * Results from this call MUST NOT be streamed. + * @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. + * @publishedPartner + * @prototype + */ + 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. Results from this call MUST NOT be streamed. + * @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. An adapter + can use this information when verifying + if old objects still exists. An adapter + also knows what objects are new to DM + engine and can provide LUID mapping for + them. aPreviousURISegmentList parameter + (see above) helps to recognise new + objects. + * @param aResultsRef Reference to correct results, i.e. this + reference must be used when returning + the result by calling the SetResultsL. + * @param aStatusRef Reference to correct command, i.e. this + reference must be used when calling the + SetStatusL of this command. + * @publishedPartner + * @prototype + */ + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef + ); + + /** + * The function adds node object. In some cases an implementation of the + * function may be empty function, if the node object does not need concrete + * database update. Still this function may be helpful to an adapter, i.e. in + * passing mapping LUID of the node to DM Module. The SetStatusL should be + * used as described in UpdateLeafObjectL() + * @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. + * @publishedPartner + * @prototype + */ + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef + ); + + /** + * The function implements execute command. The information about the success + * of the command should be returned by calling SetStatusL function of + * MSmlDmCallback callback interface. This makes it possible to buffer the + * commands. + * However, all the status codes for buffered commands must be returned at + * the latest when the CompleteOutstandingCmdsL() of adapter is called. + * @param aURI URI of the command + * @param aLUID LUID of the object (if the adapter have earlier + returned LUID to the DM Module). + * @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. + * @publishedPartner + * @prototype + */ + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + TInt aStatusRef + ); + + /** + * The function implements execute command. The information about the + * success of the command should be returned by calling SetStatusL function + * of MSmlDmCallback callback interface. This makes it possible to buffer the + * commands. + * However, all the status codes for buffered commands must be returned at + * the latest when the CompleteOutstandingCmdsL() of adapter is called. + * @param aURI URI of the command + * @param aLUID LUID of the object (if the adapter have earlier + returned LUID to the DM Module). + * @param aStream Argument for the command. Adapter should create + write stream and return, when data is written to + stream by DM agent, StreamCommittedL() is called by + DM engine + * @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. + * @publishedPartner + * @prototype + */ + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + TInt aStatusRef + ); + + /** + * The function implements copy command. The information about the success of + * the command should be returned by calling SetStatusL function of + * MSmlDmCallback callback interface. This makes it possible to buffer the + * commands. + * However, all the status codes for buffered commands must be returned at + * the latest when the CompleteOutstandingCmdsL() of adapter is called. + * @param aTargetURI Target URI for the command + * @param aSourceLUID LUID of the target object (if one exists, and if the adapter + has earlier returned a LUID to the DM Module). + * @param aSourceURI Source URI for the command + * @param aSourceLUID LUID of the source object (if the adapter has + earlier returned a LUID to the DM Module). + * @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. + * @publishedPartner + * @prototype + */ + void CopyCommandL( const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, + TInt aStatusRef + ); + + /** + * The function indicates start of Atomic command. + * @publishedPartner + * @prototype + */ + void StartAtomicL(); + + /** + * The function indicates successful end of Atomic command. The adapter + * should commit all changes issued between StartAtomicL() and + * CommitAtomicL() + * @publishedPartner + * @prototype + */ + void CommitAtomicL(); + + /** + * The function indicates unsuccessful end of Atomic command. The adapter + * should rollback all changes issued between StartAtomicL() and + * RollbackAtomicL(). If rollback fails for a command, adapter should use + * SetStatusL() to indicate it. + * @publishedPartner + * @prototype + */ + void RollbackAtomicL(); + + /** + * Returns ETrue if adapter supports streaming otherwise EFalse. + * @param aItemSize size limit for stream usage + * @return TBool ETrue for streaming support + * @publishedPartner + * @prototype + */ + TBool StreamingSupport( TInt& aItemSize ); + + /** + * Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has + * been written to and committed. Not called when fetching item. + * @publishedPartner + * @prototype + */ + 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 indicates 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. In the case of Atomic processing, the function will be + * followed by a call to CommitAtomicL or RollbackAtomicL. + * @publishedPartner + * @prototype + */ + void CompleteOutstandingCmdsL(); + + private: // New methods + + /** + * The function fills the adapter node with the details + * @publishedPartner + * @prototype + */ + void FillNodeInfoL( MSmlDmDDFObject& aDDFObject, + TSmlDmAccessTypes& aAccessTypes, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + MSmlDmDDFObject::TOccurence aOccurence, + const TDesC8& aDescription, + const TDesC8& aMIMEType ); + + /** + * This function loads all the DCMO plug-in adapters + * @publishedPartner + * @prototype + */ + void DDFDCMOAdaptersL(MSmlDmDDFObject& rootdcmo); + + /** + * This function constructs the DDFnode with the details + * @publishedPartner + * @prototype + */ + void FillDCMODDFL(MSmlDmDDFObject& aDDF); + + + /** + * This function returns the Category of the plug-in + * adapter from the aURI. + * @param aURI + * @return TPtrC8 category + */ + + TPtrC8 GetCategoryFromUriL(const TDesC8& aURI ) ; + + /** + * Maps a system wide error code to a TError. + * @param aError A system wide error code. + * @return A TError value depending on aError. + */ + CSmlDmAdapter::TError MapErrorToStatus( TInt aError ) const; + + /** + * This function returns the dcmo enforcement + * @param None + * @return TBool true if dcmo enforcement or false + */ + TBool CheckEnforcementL(); + + private: // Constructor + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + /** + * C++ Constructor + */ + CDcmoDMAdapter( TAny* aEcomArguments ); + + private: // Data + RDCMOClient* idcmoClient; + TBool iExtOpNode; + }; + +#endif // __DCMODMADAPTER_H + +// End Of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/dcmodmadapter/src/dcmodmadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/dcmodmadapter/src/dcmodmadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,926 @@ +/* +* 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: DCMO DM Adapter implementation +* +*/ + +// INCLUDE +#include +#include +#include +#include +#include +#include +#include +#include // DCMO Enforcement +#include "nsmldebug.h" +#include "dcmodmadapter.h" +#include "dcmointerface.h" + +// CONSTANTS + +#define MAXBUFLEN 255 + +_LIT8( KTextType,"text/plain" ); // Leaf inputs +_LIT8( KDCMODMAdapterVersion, "1.0" ); // Adapter version +_LIT8( KDCMORootNode, "DCMO" ); // root URI + + +// ============================= MEMBER FUNCTIONS ============================= + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::NewL +// Symbian 1st phase contructor +// (static, may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +CDcmoDMAdapter* CDcmoDMAdapter::NewL( MSmlDmCallback* aCallback ) + { + CDcmoDMAdapter* self = NewLC( aCallback ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::NewLC +// Symbian 1st phase contructor. Push object to cleanup-stack +// (static, may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +CDcmoDMAdapter* CDcmoDMAdapter::NewLC( MSmlDmCallback* aCallback ) + { + _DBG_FILE( "CDcmoDMAdapter NewLC : begin" ); + CDcmoDMAdapter* self = new ( ELeave ) CDcmoDMAdapter( aCallback ); + CleanupStack::PushL( self ); + self->ConstructL(); + _DBG_FILE( "CDcmoDMAdapter NewLC : end" ); + return self; + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::CDcmoDMAdapter() +// C++ Constructor +// Status : Draft +// ---------------------------------------------------------------------------- +CDcmoDMAdapter::CDcmoDMAdapter( TAny* aEcomArguments ) + : CSmlDmAdapter::CSmlDmAdapter( aEcomArguments ) + { + _DBG_FILE( "CDcmoDMAdapter Constructor" ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::ConstructL +// 2nd phase contructor +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::ConstructL() + { + _DBG_FILE( "CDcmoDMAdapter::ConstructL" ); + idcmoClient = RDCMOClient::NewL(); + iExtOpNode = EFalse; + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::~CDcmoDMAdapter() +// C++ Destructor +// Status : Draft +// ---------------------------------------------------------------------------- +// +CDcmoDMAdapter::~CDcmoDMAdapter() + { + _DBG_FILE( "CDcmoDMAdapter Destructor" ); + if( idcmoClient ) + { + idcmoClient->Close(); + delete idcmoClient; + } + idcmoClient = NULL; + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::DDFVersionL +// Return DM plug-in version +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + // Insert version information + _DBG_FILE( "CDcmoDMAdapter::DDFVersionL" ); + aDDFVersion.InsertL( 0, KDCMODMAdapterVersion ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::DDFStructureL +// Return DM plug-in structure +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + // Declare accesses + _DBG_FILE( "CDcmoDMAdapter::DDFStructureL begin" ); + TSmlDmAccessTypes accessTypes; + accessTypes.SetGet(); + + // Create root node + MSmlDmDDFObject& root = aDDF.AddChildObjectL( KDCMORootNode ); + FillNodeInfoL( root, + accessTypes, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, + MSmlDmDDFObject::EOne, + KNullDesC8(), + KTextType ); + + root.SetDFTitleL( KNSmlDCMOAdapterTitle ); + + DDFDCMOAdaptersL(root); + _DBG_FILE( "CDcmoDMAdapter::DDFStructureL end" ); + + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::StreamingSupport +// Return streaming support status, set supported item size +// Status : Draft +// ---------------------------------------------------------------------------- +// +TBool CDcmoDMAdapter::StreamingSupport( TInt& /* aItemSize */ ) + { + // Not supported + _DBG_FILE( "CDcmoDMAdapter::StreamingSupport" ); + return EFalse; + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::StreamCommittedL +// Commit stream buffer +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::StreamCommittedL() + { + _DBG_FILE("CDcmoDMAdapter::StreamCommitted" ); + // Intentionally left empty + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::CompleteOutstandingCmdsL +// Complete outstanding commands +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::CompleteOutstandingCmdsL() + { + _DBG_FILE( "CDcmoDMAdapter::CompleteOutstandingCmdsL" ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::FillNodeInfoL +// Fill node info +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::FillNodeInfoL( MSmlDmDDFObject& aDDFObject, + TSmlDmAccessTypes& aAccessTypes, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + MSmlDmDDFObject::TOccurence aOccurence, + const TDesC8& aDescription, + const TDesC8& aMIMEType ) + { + _DBG_FILE( "CDcmoDMAdapter::FillNodeInfoL - begin" ); + aDDFObject.SetAccessTypesL( aAccessTypes ); + aDDFObject.SetScopeL( aScope ); + aDDFObject.SetOccurenceL( aOccurence ); + aDDFObject.SetDFFormatL( aFormat ); + aDDFObject.SetDescriptionL( aDescription ); + if ( aFormat != MSmlDmDDFObject::ENode ) + { + aDDFObject.AddDFTypeMimeTypeL( aMIMEType ); + } + _DBG_FILE( "CDcmoDMAdapter::FillNodeInfoL - end" ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::CopyCommandL +// Copy object +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + // Not supported + _DBG_FILE( "CDcmoDMAdapter::CopyCommandL" ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + +// ---------------------------------------------------------------------------- +// DeleteObjectL +// Delete object +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::DeleteObjectL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + TInt aStatusRef ) + + { + // Not supported + _DBG_FILE( "CDcmoDMAdapter::DeleteObjectL" ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::FetchLeafObjectL +// Fetch leaf +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& /* aLUID */, + const TDesC8& aType, + TInt aResultsRef, + TInt aStatusRef ) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - begin" ); + MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + TDCMOStatus err (EDcmoFail); + + TBool dcmoEnforce=EFalse; + TRAPD(eError, dcmoEnforce =CheckEnforcementL()) + if(!(eError==KErrNone && dcmoEnforce)) + { + // Respond + retValue = CSmlDmAdapter::ENotAllowed; + Callback().SetStatusL( aStatusRef, retValue ); + return; + } + + TBuf iName; + + TPtrC8 category = GetCategoryFromUriL( aURI ); + iName.Copy ( category ); + + CBufBase *lObject = CBufFlat::NewL( 128 ); + CleanupStack::PushL( lObject ); + lObject->Reset(); + TBool value; + TInt group; + + if(aURI.Find(KNSmlDdfProperty)!= KErrNotFound) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - In Property" ); + TBuf property; + err = idcmoClient->GetDCMOStrAttributeValue(iName, EProperty,property); + lObject->Reset(); + TBuf8 tmp; + tmp.Copy(property); + lObject->InsertL(lObject->Size(),tmp); + } + + else if(aURI.Find(KNSmlDdfGroup)!= KErrNotFound) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - In Group" ); + err = idcmoClient->GetDCMOIntAttributeValue(iName, EGroup, group); + switch(group) + { + case EHardware : lObject->InsertL(lObject->Size(),KNSmlHardware); + break; + case EIO : lObject->InsertL(lObject->Size(),KNSmlIO); + break; + case EConnectivity : lObject->InsertL(lObject->Size(),KNSmlConnectivity); + break; + case ESoftware : lObject->InsertL(lObject->Size(),KNSmlSoftware); + break; + case EService : lObject->InsertL(lObject->Size(),KNSmlService); + break; + default : retValue = CSmlDmAdapter::ENotFound; + + } + } + else if(aURI.Find(KNSmlDdfDescription)!= KErrNotFound) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - In Description" ); + TBuf description; + err = idcmoClient->GetDCMOStrAttributeValue(iName, EDescription, description); + lObject->Reset(); + TBuf8 tmp; + tmp.Copy(description); + lObject->InsertL(lObject->Size(),tmp); + } + + else if(aURI.Find(KNSmlDdfAttached)!= KErrNotFound) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - In Attached" ); + err = idcmoClient->GetDCMOIntAttributeValue(iName, EAttached, value); + if(value) + lObject->InsertL(lObject->Size(),KNSmlTrue); + else + lObject->InsertL(lObject->Size(),KNSmlFalse); + } + + else if(aURI.Find(KNSmlDdfEnabled)!= KErrNotFound) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - In Enabled" ); + err = idcmoClient->GetDCMOIntAttributeValue(iName, EEnabled, value); + if(value) + lObject->InsertL(lObject->Size(),KNSmlTrue); + else + lObject->InsertL(lObject->Size(),KNSmlFalse); + } + + else if(aURI.Find(KNSmlDdfDenyUserEnable)!= KErrNotFound) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - In DenyUserEnable" ); + err = idcmoClient->GetDCMOIntAttributeValue(iName, EDenyUserEnable, value); + if(value) + lObject->InsertL(lObject->Size(),KNSmlTrue); + else + lObject->InsertL(lObject->Size(),KNSmlFalse); + } + + else if(aURI.Find(KNSmlDdfNotifyUser)!= KErrNotFound) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - In NotifyUser" ); + err = idcmoClient->GetDCMOIntAttributeValue(iName, ENotifyUser, value); + if(value) + lObject->InsertL(lObject->Size(),KNSmlTrue); + else + lObject->InsertL(lObject->Size(),KNSmlFalse); + } + + else if(aURI.Find(KNSmlDdfExt)!= KErrNotFound) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - In Ext" ); + lObject->Reset(); + lObject->InsertL(lObject->Size(), KNullDesC8); + err = EDcmoSuccess; + } + + else + retValue = CSmlDmAdapter::ENotFound; + + if(retValue == CSmlDmAdapter::EOk) + { + switch(err) + { + case EDcmoSuccess : Callback().SetResultsL( aResultsRef, *lObject, aType ); + break; + case EDcmoNotSupported : retValue = CSmlDmAdapter::EError; + break; + case EDcmoAccessDenied : retValue = CSmlDmAdapter::ENotAllowed; + break; + default : + retValue = CSmlDmAdapter::EError; + } + + } + + CleanupStack::PopAndDestroy(); //lObject + + // Respond + Callback().SetStatusL( aStatusRef, retValue ); + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - end" ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::FetchLeafObjectSizeL +// Calculate leaf object size +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::FetchLeafObjectSizeL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + const TDesC8& /* aType */, + TInt /* aResultsRef */, + TInt aStatusRef ) + { + _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectSizeL" ); + MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + // Respond + Callback().SetStatusL( aStatusRef, retValue ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::ChildURIListL +// Create child URI list +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& /* aLUID */, + const CArrayFix& /* aPreviousURISegmentList */, + TInt aResultsRef, + TInt aStatusRef ) + { + _DBG_FILE( "CDcmoDMAdapter::ChildURIListL - begin" ); + MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + CBufBase *currentURISegmentList = CBufFlat::NewL( 128 ); + CleanupStack::PushL( currentURISegmentList ); + + if(( aURI.Match( KDcmoMatch2 ) != KErrNotFound ) && + (aURI.Match( KDcmoMatch3 ) == KErrNotFound )) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDcmo ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + Callback().SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + CleanupStack::PopAndDestroy( ); // currentURISegmentList + _DBG_FILE( "CDcmoDMAdapter::ChildURIListL(): end" ); + return; + } + else if(( aURI.Match( KDcmoMatch ) != KErrNotFound ) && + (aURI.Match( KDcmoMatch2 ) == KErrNotFound )) + { + // + } + // DCMOConfig subtree + else if( ( aURI.Match( KDcmoConfigMatch ) != KErrNotFound )) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDcmoConfig ); + } + // Operations + else if(( aURI.Match( KDcmoOperationsMatch ) != KErrNotFound )) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDcmoOperations ); + } + // Ext + else if(( aURI.Match(KNSmlBluetooth) != KErrNotFound) && ( aURI.Match(KDcmoOperationsExtMatch)!= KErrNotFound )) + { + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDdfOpExtSemiEnable ); + } + else + { + retValue = CSmlDmAdapter::ENotFound; + } + + // Respond + Callback().SetStatusL( aStatusRef, retValue ); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE( "CDcmoDMAdapter::ChildURIListL - end" ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::AddNodeObjectL +// Add node +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::AddNodeObjectL( const TDesC8& /* aURI */, + const TDesC8& /* aParentLUID */, + TInt aStatusRef ) + { + // Not supported + _DBG_FILE( "CDcmoDMAdapter::AddNodeObjectL - begin" ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE( "CDcmoDMAdapter::AddNodeObjectL - end" ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::ExecuteCommandL +// Execute command +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::ExecuteCommandL( const TDesC8& aURI , + const TDesC8& /* aLUID */, + const TDesC8& /* aArgument */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + _DBG_FILE( "CDcmoDMAdapter::ExecuteCommandL - begin" ); + MSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + TInt err (EDcmoFail); + + TBool dcmoEnforce=EFalse; + TRAPD(eError, dcmoEnforce =CheckEnforcementL()) + if(!(eError==KErrNone && dcmoEnforce)) + { + // Respond + status = CSmlDmAdapter::ENotAllowed; + Callback().SetStatusL( aStatusRef, status ); + return; + } + + TBuf iName; + TPtrC8 category = GetCategoryFromUriL( aURI ); + iName.Copy ( category ); + + if((category.Compare( KNSmlBluetooth ) == KErrNone ) && (aURI.Find( KNSmlDdfOpExtSemiEnable ) != KErrNotFound )) + err = idcmoClient->SetDCMOIntAttributeValue(iName, EEnable, 2); + else if(aURI.Find( KNSmlDdfEnable ) != KErrNotFound ) + err = idcmoClient->SetDCMOIntAttributeValue(iName, EEnable, 1); + else if(aURI.Find( KNSmlDdfDisable ) != KErrNotFound ) + err = idcmoClient->SetDCMOIntAttributeValue(iName, EEnable, 0); + else + err = EDcmoNotFound; + // map error + status = MapErrorToStatus( err ); + + Callback().SetStatusL( aStatusRef, status ); + _DBG_FILE( "CDcmoDMAdapter::ExecuteCommandL - end" ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::ExecuteCommandL +// Execute command, streaming enabled +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + // Not supported + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::UpdateLeafObjectL +// Update leaf object +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::UpdateLeafObjectL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + const TDesC8& /* aObject */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + _DBG_FILE( "CDcmoDMAdapter::UpdateLeafObjectL - begin" ); + // Not supported + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE( "CDcmoDMAdapter::UpdateLeafObjectL - end" ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::UpdateLeafObjectL +// Update leaf object, streaming enabled +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::UpdateLeafObjectL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + // Not supported + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::StartAtomicL +// Start atomic +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::StartAtomicL() + { + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::CommitAtomicL +// Commit atomic commands +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::CommitAtomicL() + { + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::RollbackAtomicL +// Lose all modifications after 'StartAtomicL' command +// (may leave) +// Status : Draft +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::RollbackAtomicL() + { + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::MapStatusToError() +// Returns a status code corresponding to the system error code given +// as parameter. +// --------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CDcmoDMAdapter::MapErrorToStatus( TInt aError ) const + { + CSmlDmAdapter::TError err = CSmlDmAdapter::EError; + + switch( aError ) + { + case EDcmoSuccess: + err = CSmlDmAdapter::EExecSuccess; + break; + case EDcmoFail: + err = CSmlDmAdapter::EExecClientError; + break; + case EDcmoNotFound: + err = CSmlDmAdapter::EExecDownloadFailed; + break; + case EDcmoNotSupported: + err = CSmlDmAdapter::EExecClientError; + break; + case EDcmoAccessDenied: + err = CSmlDmAdapter::EExecClientError; + break; + default : + err = CSmlDmAdapter::EExecClientError; + } + + return err; + } + +// ========================= OTHER EXPORTED FUNCTIONS ========================= + +void CleanupEComArray(TAny* aArray) + { + (static_cast (aArray))->ResetAndDestroy(); + (static_cast (aArray))->Close(); + } + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::DDFDCMOAdaptersL +// This function loads all the DCMO plug-in adapters +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::DDFDCMOAdaptersL(MSmlDmDDFObject& rootdcmo) +{ + _DBG_FILE("CDcmoDMAdapter::DDFDCMOAdaptersL(): begin"); + TBuf8 buf; + TSmlDmAccessTypes accessTypes; + accessTypes.SetGet(); + + CRepository* centrep = NULL; + TInt err(KErrNone); + TRAP(err, centrep = CRepository::NewL( KCRUidDCMOServer )); + if(err == KErrNone) + { + TUint32 centrepKey = 0; + TInt count(0); + TInt reterr = centrep->Get( centrepKey, count ); + if(reterr == KErrNone) + { + TBuf buffer; + for(TInt i=0; iGet( centrepKey, buffer ); + if( reterr== KErrNone ) + { + buf.Copy ( buffer ); + MSmlDmDDFObject& entityNode = rootdcmo.AddChildObjectL( buf ); + FillNodeInfoL( entityNode, + accessTypes, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + MSmlDmDDFObject::EZeroOrOne, + KDCMOCapabilityDescription, + KMimeType ); + + FillDCMODDFL(entityNode); + buf.Zero(); + } + } + } + delete centrep; + centrep = NULL; + } + + // Read info about all implementations into infoArray + RImplInfoPtrArray infoArray; + // Note that a special cleanup function is required to reset and destroy + // all items in the array, and then close it. + TCleanupItem cleanup(CleanupEComArray, &infoArray); + CleanupStack::PushL(cleanup); + REComSession::ListImplementationsL(KDCMOInterfaceUid, infoArray); + + // Loop through each info for each implementation + // and create and use each in turn + CDCMOInterface* ex; + + for (TInt i=0; i< infoArray.Count(); i++) + { + + TUid impluid = infoArray[i]->ImplementationUid(); + // Create object of type and call its function + + buf = infoArray[i]->OpaqueData(); + + CDCMOInterface::TDCMOInterfaceInitParams initParms; + initParms.uid = impluid; + TBuf categoryName; + categoryName.Copy(buf); + initParms.descriptor = categoryName.AllocL(); + ex = CDCMOInterface::NewL(initParms); + CleanupStack::PushL(ex); + if( buf.Compare(KNSmlBluetooth)== KErrNone ) + { + iExtOpNode = ETrue; + } + MSmlDmDDFObject& entityNode = rootdcmo.AddChildObjectL( buf ); + FillNodeInfoL( entityNode, + accessTypes, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + MSmlDmDDFObject::EZeroOrOne, + KDCMOCapabilityDescription, + KMimeType ); + + FillDCMODDFL(entityNode); + ex = NULL; + buf.Zero(); + CleanupStack::PopAndDestroy(); //ex + } + + // Clean up + CleanupStack::PopAndDestroy(); //infoArray, results in a call to CleanupEComArray + _DBG_FILE("CDcmoDMAdapter::DDFDCMOAdaptersL(): end"); +} + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::FillDCMODDFL +// This function constructs the DDFnode with the details +// ---------------------------------------------------------------------------- +// +void CDcmoDMAdapter::FillDCMODDFL(MSmlDmDDFObject& aDDF) +{ + _DBG_FILE("CDcmoDMAdapter::FillDCMPDDFL(): begin"); + + TSmlDmAccessTypes accessTypesG; + accessTypesG.SetGet(); + + MSmlDmDDFObject& nPropertyDDF = aDDF.AddChildObjectL( KNSmlDdfProperty ); // Property + FillNodeInfoL( nPropertyDDF, accessTypesG, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfPropertyDescription, KMimeType ); + + //Group + MSmlDmDDFObject& nGroupDDF = aDDF.AddChildObjectL( KNSmlDdfGroup ); // Group + FillNodeInfoL( nGroupDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfGroupDescription, KMimeType ); + + // Description node + MSmlDmDDFObject& nDescriptionDDF = aDDF.AddChildObjectL( KNSmlDdfDescription ); // Description + FillNodeInfoL( nDescriptionDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfDescDescription, KMimeType ); + + MSmlDmDDFObject& nAttachedDDF = aDDF.AddChildObjectL( KNSmlDdfAttached ); // Attached + FillNodeInfoL( nAttachedDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfAttachedDescription, KMimeType ); + + MSmlDmDDFObject& nEnabledDDF = aDDF.AddChildObjectL( KNSmlDdfEnabled ); // Enabled + FillNodeInfoL( nEnabledDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfEnabledDescription, KMimeType ); + + MSmlDmDDFObject& nDCMOConfigDDF = aDDF.AddChildObjectL( KNSmlDdfDCMOConfig ); // DCMOConfig + FillNodeInfoL( nDCMOConfigDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, MSmlDmDDFObject::EOne, + KNSmlDdfDCMOConfigDescription, KMimeType ); + + MSmlDmDDFObject& nDenyUserEnableDDF = nDCMOConfigDDF.AddChildObjectL( KNSmlDdfDenyUserEnable ); // DenyUserEnable + FillNodeInfoL( nDenyUserEnableDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EZeroOrOne, + KNSmlDdfDenyUserEnableDescription, KMimeType ); + + + MSmlDmDDFObject& nNotifyUserDDF = nDCMOConfigDDF.AddChildObjectL( KNSmlDdfNotifyUser ); // NotifyUser + FillNodeInfoL( nNotifyUserDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfNotifyUserDescription, KMimeType ); + //Operations + + MSmlDmDDFObject& nOperationsDDF = aDDF.AddChildObjectL( KNSmlDdfOperations ); // Operations + FillNodeInfoL( nOperationsDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, MSmlDmDDFObject::EOne, + KNSmlDdfOperationsDescription, KMimeType ); + + + TSmlDmAccessTypes accessTypesE; + accessTypesE.SetExec(); + + MSmlDmDDFObject& nEnableDDF = nOperationsDDF.AddChildObjectL( KNSmlDdfEnable ); // Enable + FillNodeInfoL( nEnableDDF, accessTypesE, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfEnableDescription, KMimeType ); + + + MSmlDmDDFObject& nDisableDDF = nOperationsDDF.AddChildObjectL( KNSmlDdfDisable ); // Disable + FillNodeInfoL( nDisableDDF, accessTypesE, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfDisableDescription, KMimeType ); + + + MSmlDmDDFObject& nOpExtDDF = nOperationsDDF.AddChildObjectL( KNSmlDdfOpExt ); // Operations/Ext + FillNodeInfoL( nOpExtDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, MSmlDmDDFObject::EOne, + KNSmlDdfOpExtDescription, KMimeType ); + + if( iExtOpNode ) + { + MSmlDmDDFObject& nOpExtSemiEnableDDF = nOpExtDDF.AddChildObjectL( KNSmlDdfOpExtSemiEnable ); // Operations/Ext/SemiEnable + FillNodeInfoL( nOpExtSemiEnableDDF, accessTypesE, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfOpExtSemiEnableDescription, KMimeType ); + iExtOpNode = EFalse; + } + + MSmlDmDDFObject& nExtDDF = aDDF.AddChildObjectL( KNSmlDdfExt ); // Ext + FillNodeInfoL( nExtDDF, accessTypesG, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, + KNSmlDdfExtDescription, KMimeType ); + + + _DBG_FILE("CDcmoDMAdapter::FillDCMPDDFL(): end"); +} + +// ---------------------------------------------------------------------------- +// CDcmoDMAdapter::GetCategoryFromUriL +// This function returns the implementation UID if the plug-in +// ---------------------------------------------------------------------------- +// +TPtrC8 CDcmoDMAdapter::GetCategoryFromUriL(const TDesC8& aURI ) +{ + _DBG_FILE("CDcmoDMAdapter::GetDCMOAdapterUidL(): begin"); + + TInt length = aURI.Length (); + TInt count = 0; + TInt flag = 0; + for (count=0; countEnforcementActive(EDCMOEnforcement, enforceActive)); + CleanupStack::PopAndDestroy(info); + return enforceActive; +} + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/dcmodmadapter/src/dcmodmadaptermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/dcmodmadapter/src/dcmodmadaptermain.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,47 @@ +/* +* 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: DCMO DM Adapter implementation +* +*/ + +// INCLUDE +#include +#include "dcmodmadapter.h" + +// ---------------------------------------------------------------------------- +// ImplementationTable +// Ecom plug-in implementation table +// Status : Draft +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x2001FD3F, CDcmoDMAdapter::NewL ) + }; + +// ---------------------------------------------------------------------------- +// ImplementationGroupProxy +// Instance of implementation proxy +// (exported) +// Status : Draft +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + + return ImplementationTable; + } + +// End Of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/bld/DevDetail_HwV.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/bld/DevDetail_HwV.txt Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,1 @@ +0000 \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/bld/DevDetail_SwV.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/bld/DevDetail_SwV.txt Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,1 @@ +xxx-xxx 0.00 00 \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/bld/nsmldmdevdetailadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/bld/nsmldmdevdetailadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/inc/nsmldmdevdetailadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/inc/nsmldmdevdetailadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/src/nsmldmdevdetailadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/src/nsmldmdevdetailadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/src/nsmldmdevdetailadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/src/nsmldmdevdetailadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/src/nsmldmdevdetailutils_ARM.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/src/nsmldmdevdetailutils_ARM.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devdetail/src/nsmldmdevdetailutils_WINSCW.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devdetail/src/nsmldmdevdetailutils_WINSCW.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devinfo/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devinfo/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devinfo/bld/nsmldmdevinfoadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devinfo/bld/nsmldmdevinfoadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devinfo/inc/nsmldmdevinfoadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devinfo/inc/nsmldmdevinfoadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devinfo/src/nsmldmdevinfoadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devinfo/src/nsmldmdevinfoadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/devinfo/src/nsmldmdevinfoadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/devinfo/src/nsmldmdevinfoadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,25 @@ +/* +* 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: build info file for email settings adapter +* +*/ + + + + +PRJ_MMPFILES +./nsmldmemailadapter.mmp + + +// End of File \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/bld/nsmldmemailadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/bld/nsmldmemailadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,51 @@ +/* +* 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 SyncML DM Email adapter +* +*/ + + + + +#include "defaultcaps.hrh" +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET nsmldmemailadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F6E34 +VENDORID VID_DEFAULT + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc ../../inc +SOURCE nsmldmemailadapter.cpp + +START RESOURCE nsmldmemailadapter.rss +TARGET nsmldmemailadapter.rsc +LANGUAGE_IDS +END + + + +LIBRARY euser.lib ecom.lib msgs.lib charconv.lib imcm.lib nsmldebug.lib commdb.lib +LIBRARY efsrv.lib sysutil.lib nsmldmiapmatcher.lib +LIBRARY etel.lib // RTelServer +LIBRARY etelmm.lib // RMobilePhone + + +SMPSAFE +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/inc/nsmldmemailadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/inc/nsmldmemailadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,744 @@ +/* +* 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 Email Settings Adapter + * +*/ + + + + + +#ifndef __NSMLDMEMAILADAPTER_H__ +#define __NSMLDMEMAILADAPTER_H__ + +// ----------------------------------------------------------------------------- +// Includes +// ----------------------------------------------------------------------------- +#include +#include +#include + +// ----------------------------------------------------------------------------- +// Class forwards +// ----------------------------------------------------------------------------- +class CImSmtpSettings; +class CImPop3Settings; +class CImImap4Settings; +class CImIAPPreferences; +class CMsvSession; +class CEmailAccounts; + + +// ----------------------------------------------------------------------------- +// Definitions +// ----------------------------------------------------------------------------- + +// the DDF version must be changed if any changes in DDF structure +// ( built in DDFStructureL() function ) +// +_LIT8( KNSmlDMEmailDDFVersion, "1.1" ); + +_LIT8( KNSmlDMEmailTextPlain, "text/plain" ); +_LIT8( KNSmlDMEmailNodeName, "Email" ); +_LIT8( KNSmlDMEmailDescription, "The interior object holds all email objects" ); +_LIT8( KNSmlDMDynamicNodeDescription, "Placeholder for one or more Email objects" ); +_LIT8( KNSmlDMNameDescription, "Displayable Account Name for the Email Settings" ); +_LIT8( KNSmlDMUIDDescription, "User ID for email account" ); +_LIT8( KNSmlDMPWDescription, "Password for email account " ); +_LIT8( KNSmlDMUAddrDescription, "User's email address" ); +_LIT8( KNSmlDMUNameDescription, "Displayable name for the user" ); +_LIT8( KNSmlDMMrcvDescription, "Host name of the receiving (IMAP/POP3) server" ); +_LIT8( KNSmlDMMsndDescription, "Host name of the SMTP server" ); +_LIT8( KNSmlDMMproDescription, "Remote mailbox protocol" ); +_LIT8( KNSmlDMUseSecConDescription, "Secure connection is used or not" ); +_LIT8( KNSmlDMUseSauthDescription, "SMTP authentication is used or not" ); +_LIT8( KNSmlDMSauthUIDDescription, "SMTP authenticatio user Id" ); +_LIT8( KNSmlDMSauthPWDescription, "SMTP authentication password" ); +_LIT8( KNSmlDMPtxtSAuthDescription, "Plain text SMTP authentication is allowed or not" ); +_LIT8( KNSmlDMDelFetDescription, "Defines whether to delete fetched mail from remote server" ); +_LIT8( KNSmlDMUseAPOPDescription, "Defines whether the APOP is used or not" ); +_LIT8( KNSmlDMRcvPortDescription, "Port for IMAP4 or POP3" ); +_LIT8( KNSmlDMSndPortDescription, "Port for SMTP" ); +_LIT8( KNSmlDMToNapIDDescription, "Link to connectivity information" ); + +_LIT8( KNSmlDMSToNapIDDescription, "Link to connectivity information for sending SMTP" ); +_LIT8( KNSmlDMSUseSecConDescription, "Defines whether SSL/TLS security is used in SMTP" ); +_LIT8( KNSmlDMUseStartTLSDescription, "Defines whether StartTLS is used in IMAP/POP" ); +_LIT8( KNSmlDMSUseStartTLSDescription, "Defines whether StartTLS is in SMTP" ); +_LIT8( KNSmlDMMrcvPortDescription, "Defines the port number of the IMAP/POP server" ); +_LIT8( KNSmlDMMsndPortDescription, "Defines the port number of the SMTP server" ); +_LIT8( KNSmlDMFolderPathDescription, "Defines the mailbox folder path" ); + +_LIT8( KNSmlDMEmailDynamicNode, "" ); +_LIT8( KNSmlDMEmailName, "Name" ); +_LIT8( KNSmlDMEmailUID, "UID" ); +_LIT8( KNSmlDMEmailPW, "PW" ); +_LIT8( KNSmlDMEmailUAddr, "UAddr" ); +_LIT8( KNSmlDMEmailUName, "UName" ); +_LIT8( KNSmlDMEmailMrcv, "Mrcv" ); +_LIT8( KNSmlDMEmailMsnd, "Msnd" ); +_LIT8( KNSmlDMEmailMpro, "Mpro" ); +_LIT8( KNSmlDMEmailUseAPOP, "UseAPOP" ); +_LIT8( KNSmlDMEmailUseSecCon, "UseSecCon" ); +_LIT8( KNSmlDMEmailUseSauth, "UseSauth" ); +_LIT8( KNSmlDMEmailSauthUID, "SauthUID" ); +_LIT8( KNSmlDMEmailSauthPW, "SauthPW" ); +_LIT8( KNSmlDMEmailPtxtSAuth, "PtxtSAuth" ); +//_LIT8( KNSmlDMEmailRcvPort, "RcvPort" ); +//_LIT8( KNSmlDMEmailSndPort, "SndPort" ); +_LIT8( KNSmlDMEmailToNapID, "ToNapID" ); +_LIT8( KNSmlDMEmailIAPUri, "AP" ); + +_LIT8( KNSmlDMEmailSToNapID, "SToNapID" ); +_LIT8( KNSmlDMEmailSUseSecCon, "SUseSecCon" ); +_LIT8( KNSmlDMEmailUseStartTLS, "UseStartTLS" ); +_LIT8( KNSmlDMEmailSUseStartTLS, "SUseStartTLS" ); +_LIT8( KNSmlDMEmailMrcvPort, "MrcvPort" ); +_LIT8( KNSmlDMEmailMsndPort, "MsndPort" ); +_LIT8( KNSmlDMEmailFolderPath, "FolderPath" ); + +_LIT8( KNSmlDMEmailMproPOP, "POP" ); +_LIT8( KNSmlDMEmailMproIMAP, "IMAP" ); +_LIT8( KNSmlDMEmailTrue, "True" ); +_LIT8( KNSmlDMEmailFalse, "False" ); + +_LIT8( KNSmlDMEmailListOfLeafs, "Name/UID/PW/UAddr/UName/Mrcv/Msnd/Mpro/UseSecCon/UseSauth/SauthUID/SauthPW/PtxtSAuth/ToNapID/SToNapID/SUseSecCon/UseStartTLS/SUseStartTLS/MrcvPort/MsndPort/UseAPOP/FolderPath" ); +_LIT8( KNSmlDMEmailSeparator8, "/" ); +_LIT8( KNSmlEmailUriDotSlash, "./"); + +const TInt KNSmlDmFatMinimumFileSize = 512; +const TInt KNSmlSmtpMessageTypeValue = 0x10001028; +const TInt KNSmlDefaultMaxLimit = 1024*10; //maximum message size (default) +const TInt KNSmlDmEmailGranularity = 4; +const TUint32 KNSmlDmEmailAlwaysAskIap = 0; + +const TInt KNSmlDMEmailNormalSmtpPort = 25; +const TInt KNSmlDMEmailSslSmtpPort = 465; +const TInt KNSmlDMEmailNormalImap4Port = 143; +const TInt KNSmlDMEmailNormalPop3Port = 110; +const TInt KNSmlDMEmailSslWrappedImap4Port = 993; +const TInt KNSmlDMEmailSslWrappedPop3Port = 995; +const TInt KNSmlDMEmailDefaultHeaderCount = 30; + +const TInt KNSmlDmEmailImapLuidLow = 50000; +const TInt KNSmlDmEmailImapLuidHigh = 100000; +const TInt KNSmlDmEmailPopLuidHigh = 150000; +const TUint32 KNSmlDMEmailMaxPortNbr = 0xffff; + +/** +* The main class of the SyncML DM Email adapter. +* +* @since +*/ +class CNSmlDmEmailAdapter : public CSmlDmAdapter, public MMsvSessionObserver + { +public: + /** + * The one phase constructor + * + */ + static CNSmlDmEmailAdapter* NewL(MSmlDmCallback* aDmCallback ); + + /** + * The destructor + * + */ + virtual ~CNSmlDmEmailAdapter(); + + // Adapter interface from CSmlDmAdapter + /** + * The function returns current version of the DDF. By asking + * current DDF versions from adapters DM Module can control * + * possible changes in the data structure and send the changed DDF + * description to a management server. This function is always + * called after DDFStructureL. + * @param aVersion DDF version of the + * adapter. (filled by the adapter) + * @publishedPartner + * @prototype + */ + + void DDFVersionL( CBufBase& aDDFVersion ); + /** + * The function for filling the DDF structure of the adapter + * This function is only called once, immediately after the adapter is created. + * @param aDDFObject Reference to root object. A DM adapter starts filling + * the data structure by calling AddChildObjectL to the root object and + * so describes the DDF of the adapter. + * @publishedPartner + * @prototype + */ + 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 should be + * returned by calling SetStatusL function of MSmlDmCallback callback + * interface. This makes it possible to buffer the commands. However, all + * the status codes for buffered commands must be returned at the latest when + * the adapter's CompleteOutstandingCmdsL() is called. + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter has earlier returned a + * LUID to the DM Module). For new objects, this is the LUID + * inherited through the parent node. + * @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 + * @publishedPartner + * @prototype + */ + 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. The SetStatusL + * should be used as described in UpdateLeafObjectL() + * @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. + * @publishedPartner + * @prototype + */ + void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TInt aStatusRef ); + /** + * The function fetches data of a leaf object. The SetStatusL should be used + * as described in UpdateLeafObjectL(). The data is returned by using the + * SetResultsL function of MSmlCallback callback interface, and may be streamed. + * @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. + * @publishedPartner + * @prototype + */ + void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + /** + * The function fetches URI list. An adapter returns the list of URI segments + * under the given URI be separated by slash ("/"). The URI segment names for + * new objects must be given by the adapter. + * The list is returned by calling the SetResultsL function of MSmlCallback + * callback interface. Results from this call MUST NOT be streamed. + * @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. An adapter + * can use this information when verifying + * if old objects still exists. An adapter + * also knows what objects are new to DM + * engine and can provide LUID mapping for + * them. aPreviousURISegmentList parameter + * (see above) helps to recognise new + * objects. + * @param aResultsRef Reference to correct results, i.e. this + * reference must be used when returning + * the result by calling the SetResultsL. + * @param aStatusRef Reference to correct command, i.e. this + * reference must be used when calling the + * SetStatusL of this command. + * @publishedPartner + * @prototype + */ + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef ); + /** + * The function adds node object. In some cases an implementation of the + * function may be empty function, if the node object does not need concrete + * database update. Still this function may be helpful to an adapter, i.e. in + * passing mapping LUID of the node to DM Module. The SetStatusL should be + * used as described in UpdateLeafObjectL() + * @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. + * @publishedPartner + * @prototype + */ + void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef ); + /** + * The function creates new leaf objects, or replaces data in existing leaf + * objects, in the case where data is large enough to be streamed. The + * information about the success of the command should be returned by calling + * SetStatusL function of MSmlDmCallback callback interface. This makes it + * possible to buffer the commands. However, all the status codes for buffered + * commands must be returned at the latest when the CompleteOutstandingCmdsL() + * of adapter is called. + * @param aURI URI of the object + * @param aLUID LUID of the object (if the adapter has earlier returned a + * LUID to the DM Module). For new objects, this is the LUID + * inherited through the parent node. + * @param aStream Data of the object. Adapter should create write stream + * and return, when data is written to stream by DM agent, + * StreamCommittedL() is called by DM engine + * @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. + * @publishedPartner + * @prototype + */ + void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const 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. The SetStatusL should be used + * as described in FetchLeafObjectL(). The size value is returned by using + * the SetResultsL function of MSmlCallback callback interface, and must be + * a decimal integer expressed as a string, eg. "1234". + * Results from this call MUST NOT be streamed. + * @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. + * @publishedPartner + * @prototype + */ + void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef ); + /** + * The function implements execute command. The information about the success + * of the command should be returned by calling SetStatusL function of + * MSmlDmCallback callback interface. This makes it possible to buffer the + * commands. + * However, all the status codes for buffered commands must be returned at + * the latest when the CompleteOutstandingCmdsL() of adapter is called. + * @param aURI URI of the command + * @param aLUID LUID of the object (if the adapter have earlier + * returned LUID to the DM Module). + * @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. + * @publishedPartner + * @prototype + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + const TDesC8& aArgument, const TDesC8& aType, + const TInt aStatusRef ); + /** + * The function implements execute command. The information about the + * success of the command should be returned by calling SetStatusL function + * of MSmlDmCallback callback interface. This makes it possible to buffer the + * commands. + * However, all the status codes for buffered commands must be returned at + * the latest when the CompleteOutstandingCmdsL() of adapter is called. + * @param aURI URI of the command + * @param aLUID LUID of the object (if the adapter have earlier + * returned LUID to the DM Module). + * @param aStream Argument for the command. Adapter should create + * write stream and return, when data is written to + * stream by DM agent, StreamCommittedL() is called by + * DM engine + * @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. + * @publishedPartner + * @prototype + */ + void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, + RWriteStream*& aStream, const TDesC8& aType, + const TInt aStatusRef ); + /** + * The function implements copy command. The information about the success of + * the command should be returned by calling SetStatusL function of + * MSmlDmCallback callback interface. This makes it possible to buffer the + * commands. + * However, all the status codes for buffered commands must be returned at + * the latest when the CompleteOutstandingCmdsL() of adapter is called. + * @param aTargetURI Target URI for the command + * @param aSourceLUID LUID of the target object (if one exists, and if the adapter + * has earlier returned a LUID to the DM Module). + * @param aSourceURI Source URI for the command + * @param aSourceLUID LUID of the source object (if the adapter has + * earlier returned a LUID to the DM Module). + * @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. + * @publishedPartner + * @prototype + */ + void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, const TDesC8& aSourceLUID, + const TDesC8& aType, TInt aStatusRef ); + /** + * The function indicates start of Atomic command. + * @publishedPartner + * @prototype + */ + void StartAtomicL(); + /** + * The function indicates successful end of Atomic command. The adapter + * should commit all changes issued between StartAtomicL() and + * CommitAtomicL() + * @publishedPartner + * @prototype + */ + void CommitAtomicL(); + /** + * The function indicates unsuccessful end of Atomic command. The adapter + * should rollback all changes issued between StartAtomicL() and + * RollbackAtomicL(). If rollback fails for a command, adapter should use + * SetStatusL() to indicate it. + * @publishedPartner + * @prototype + */ + void RollbackAtomicL(); + /** + * Returns ETrue if adapter supports streaming otherwise EFalse. + * @param aItemSize size limit for stream usage + * @return TBool ETrue for streaming support + * @publishedPartner + * @prototype + */ + TBool StreamingSupport( TInt& aItemSize ); + /** + * Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has + * been written to and committed. Not called when fetching item. + * @publishedPartner + * @prototype + */ + 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. In the case of Atomic processing, the function will be + * followed by a call to CommitAtomicL or RollbackAtomicL. + * @publishedPartner + * @prototype + */ + void CompleteOutstandingCmdsL(); + +protected: + /** + * Inherited from MMsvSessionObserver + * Indicates an event has occurred. + * @param aEvent Indicates the event type. + * @param aArg1 Event type-specific argument value + * @param aArg2 Event type-specific argument value + * @param aArg3 Event type-specific argument value + */ + void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, + TAny* aArg3 ); + +private: + +struct TNSmlEmailCommandElement + { + HBufC8* iLastUriSeg; + HBufC8* iData; + TInt iStatusRef; + TBool iLeaf; + CSmlDmAdapter::TError iStatus; + }; + +enum TNSmlEmailAccountType + { + EImap, + EPop, + EUnknown + }; + +enum TNSmlEmailSecuritySetting + { + EUseSecCon = 1, + EUseStartTls, + ESuseSecCon, + ESuseStartTls, + }; + +struct TNSmlEmailSettingsElement + { + CArrayFixFlat *iNodeBuf; + /* iMappingName = Email/xxxx */ + HBufC8* iMappingName; + HBufC* iName; + CImSmtpSettings* iSmtpSettings; + CImPop3Settings* iPop3Settings; + CImImap4Settings* iImap4Settings; + CImIAPPreferences* iIapPref; + CImIAPPreferences* iSmtpIapPref; + + TBool iExecuted; + TInt iLuid; + TBool iJustFetch; + CNSmlDmEmailAdapter::TNSmlEmailAccountType iAccType; + TInt iAccId; + TMsvId iServiceId; + }; + + /** + * C++ default constructor. + */ + void ConstructL(); + CNSmlDmEmailAdapter(); + CNSmlDmEmailAdapter( MSmlDmCallback* aDmCallback ); + + /** + * Initializes the buffer for leaf nodes. + * @param aURI URI of the object + * @param aObject The data to be updated + * @param aStatusRef The status reference + * @param aIndex The index to command buffer + * @return status of the operation + */ + TInt FirstAddLeafL(const TDesC8& aURI, + const TDesC8& aObject, + TInt aStatusRef, + TInt aIndex); + + /** + * Updates the value of leaf object + * @param aLastUriSeg URI of the object + * @param aObject The data to be updated + * @param aIndex The index to node buffer + * @param aCommand The index to command buffer + * @return status of the operation + */ + TInt DoAddLeafObjectL(const TDesC8& aLastUriSeg, + const TDesC8& aObject, + TInt aIndex, + TInt aCommand); + + /** + * Set the default values to email account + * @param aIndex The index to node buffer + * @return none + */ + void SetDefaultSettingsL(TInt aIndex); + + /** + * Converts 16bit descriptor to integer + * @param aLuid The descriptor to be converted + * @return Integer value of the descriptor + */ + TInt DesToInt(const TDesC& aLuid) const; + + /** + * Converts 8bit descriptor to integer + * @param aLuid The descriptor to be converted + * @return Integer value of the descriptor + */ + TInt DesToInt(const TDesC8& aLuid) const; + + /** + * Converts integer to 16bit descriptor + * @param aLuid The integer to be converted + * @return The Integer as a descriptor + */ + HBufC* IntToDesLC(const TInt aLuid) const; + + /** + * Converts integer to 8bit descriptor + * @param aLuid The integer to be converted + * @return The Integer as a descriptor + */ + HBufC8* IntToDes8LC(const TInt aLuid) const; + + /** + * Converts 16bit descriptor to 8bit descriptor + * @param aSource The descriptor to be converted + * @return The 8bit descriptor + */ + HBufC8* ConvertTo8LC( const TDesC& aSource ) const; + + /** + * Transfers the email settings from memory to phones permanent data store + * @param aIndex The index to command buffer + * @return Luid of the email account + */ + TInt ValidateAndStoreSettingsL(TInt aIndex); + + /** + * Restores the settings to the adapter from phones permanent data store + * @param aIndex The index to command buffer + * @return Status of the operation + */ + TInt DoRestoreSettingsL(TInt aIndex); + + /** + * Opens the CMsvSession if it is not open already + * @param none + * @return Status of the operation + */ + TInt OpenSessionL(); + + /** + * Parses the last URI segment from URI + * @param aURI The whole URI + * @return The last URI segment + */ + TPtrC8 LastURISeg(const TDesC8& aURI) const; + + /** + * Removes the last URI segment from URI + * @param aURI The whole URI + * @return The aURI without the last URI segment + */ + TPtrC8 RemoveLastURISeg(const TDesC8& aURI) const; + + /** + * Calculates the number of URI segments + * @param aURI The whole URI + * @return The number of URI segments + */ + TInt NumOfURISegs(const TDesC8& aURI) const; + + /** + * Fills the DDF node with desired properties + * @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. + * @return none + */ + void FillNodeInfoL( MSmlDmDDFObject& aNode, + const TSmlDmAccessTypes& aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription) const; + + /** + * Parses the dot and slash in start of URI away + * @param aURI The whole URI + * @return The URI without dot and slash in start + */ + TPtrC8 RemoveDotSlash(const TDesC8& aURI) const; + + /** + * Fetches the value of leaf node + * @param aURI The whole URI + * @param aLUID The LUID + * @param aObject The storage for the result + * @return Status of the operation + */ + CSmlDmAdapter::TError FetchObjectL(const TDesC8& aURI, + const TDesC8& aLUID, + CBufBase& aObject); + + /** + * Calculates correct account id from the LUID + * @param aAccType Account Type + * @param aAccId Account ID + * @param aLuid The LUID + * @return none + */ + void GetIdByLuid( TNSmlEmailAccountType& aAccType, + TInt& aAccId, const TInt aLuid ) const; + + /** + * Calculates LUID from the account id + * @param aAccType Account Type + * @param aAccId Account ID + * @param aLuid The LUID + * @return none + */ + void SetLuidById( const TNSmlEmailAccountType& aAccType, + const TInt& aAccId, TInt& aLuid ) const; + + /** + * Checks if the account with given id exists + * @param aAccs Pointer to CEmailAccount object + * @param aAccType Account Type + * @param aId Account ID + * @param aIndex The LUIDIndex to the command buffer + * @return True if the account exists + */ + TBool AccountExistsL( CEmailAccounts* aAccs, + const TNSmlEmailAccountType aAccType, + const TInt aId, + TInt aIndex ); + + /** + * Sets the parameters related to STARTTLS and SSL/TLS + * @param aObject The value(True/False) to be set + * @param aThisElem The element of which value is to be set. + * @param aSetting The setting which value is to be set + * @return none + */ + void SetDefaultSecurityL(const TDesC8& aObject, + const TNSmlEmailSettingsElement* aThisElem, + const TNSmlEmailSecuritySetting aSetting + ) const; + + /** + * Fetches the parameters related to STARTTLS and SSL/TLS + * @param aObject The storage for the value + * @param aElem The element of which value is fetched. + * @param aSetting The setting which value is fetched. + * @return Status of the operation + */ + CSmlDmAdapter::TError FetchSecurityValueL(CBufBase& aObject, + const TNSmlEmailSettingsElement* aElem, + const TNSmlEmailSecuritySetting aSetting ) const; + + /** + * Creates the mapping for the email account preset + * @param aURI The whole URI + * @return the luid of the email account specified im aURI, else -1 + */ + TInt ConstructTreeL(const TDesC8& aURI); + + /** + * The function extracts Email/x node from aURI + * @param aURI Email aURI. + * @return Email/x node. + */ + TPtrC8 GetDynamicEmailNodeUri( const TDesC8& aURI ); + +private: + // Pointer to CMsvSession + CMsvSession* iMsvSession; + // The buffer for received commands + CArrayFixFlat* iBuffer; + }; + +#endif // __NSMLDMEMAILADAPTER_H__ + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/sis/emailadapter.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/sis/emailadapter.pkg Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,35 @@ +; +; 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. +; +&EN + +; standard SIS file header +#{"nsmlemailadapter"},(0x101F6E34),2,0,0,TYPE=SA + +;Localised Vendor name +%{"Nokia-EN"} + +;Unique Vendor name +:"Nokia" + +;Supports Series 60 v 3.0 +;[0x101F6E34], 0, 0, 0, {"Series60ProductID"} + +;Files to install +;Exes to be installed +"\EPOC32\RELEASE\ARMV5\UREL\nsmldmemailadapter.dll" -"!:\sys\bin\nsmldmemailadapter.dll" +; Application resource files to be installed +"\EPOC32\data\z\resource\plugins\nsmldmemailadapter.Rsc" -"!:\resource\plugins\nsmldmemailadapter.Rsc" diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/sis/gensis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/sis/gensis.bat Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,19 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Implementation of dm adapters +rem This is part of omadmextensions. +rem + +makesis emailadapter.pkg +signsis emailadapter.SIS emailadapter.SISX \S60\mw\contentmanagement\swinstalleruis\Appinstui\internal\RD_rootCA\rd.cer \s60\mw\contentmanagement\swinstalleruis\appinstui\internal\RD_rootca\rd-key.pem \ No newline at end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/src/nsmldmemailadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/src/nsmldmemailadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,3364 @@ +/* +* 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 Email Settings Adapter + * +*/ + + + + +#include // For TImplementationProxy definition +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "nsmldmimpluids.h" +#include "nsmldmemailadapter.h" +#include "nsmldebug.h" +#include "nsmlconstants.h" +#include "nsmldmconst.h" +#include "nsmldmiapmatcher.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 + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter* CNSmlDmEmailAdapter::NewL( ) +// ----------------------------------------------------------------------------- +CNSmlDmEmailAdapter* CNSmlDmEmailAdapter::NewL(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmEmailAdapter::NewL(): begin"); + CNSmlDmEmailAdapter* self = new (ELeave) CNSmlDmEmailAdapter(aDmCallback); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + _DBG_FILE("CNSmlDmEmailAdapter::NewL(): end"); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::CNSmlDmEmailAdapter() +// ----------------------------------------------------------------------------- + +CNSmlDmEmailAdapter::CNSmlDmEmailAdapter( MSmlDmCallback* aDmCallback ) + : CSmlDmAdapter(aDmCallback) + { + _DBG_FILE("CNSmlDmEmailAdapter::CNSmlDmEmailAdapter(): begin"); + iMsvSession = NULL; + _DBG_FILE("CNSmlDmEmailAdapter::CNSmlDmEmailAdapter(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::ConstructL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::ConstructL() + { + iBuffer = new (ELeave) CArrayFixFlat + (KNSmlDmEmailGranularity); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::~CNSmlDmEmailAdapter() +// ----------------------------------------------------------------------------- +CNSmlDmEmailAdapter::~CNSmlDmEmailAdapter() + { + _DBG_FILE("CNSmlDmEmailAdapter::~CNSmlDmEmailAdapter(): begin"); + delete iMsvSession; + if(iBuffer) + { + for(TInt i=0;iCount();i++) + { + delete iBuffer->At(i).iMappingName; + delete iBuffer->At(i).iName; + delete iBuffer->At(i).iSmtpSettings; + delete iBuffer->At(i).iPop3Settings; + delete iBuffer->At(i).iImap4Settings; + delete iBuffer->At(i).iIapPref; + delete iBuffer->At(i).iSmtpIapPref; + + if(iBuffer->At(i).iNodeBuf) + { + for(TInt j=0;jAt(i).iNodeBuf->Count();j++) + { + delete iBuffer->At(i).iNodeBuf->At(j).iLastUriSeg; + delete iBuffer->At(i).iNodeBuf->At(j).iData; + } + iBuffer->At(i).iNodeBuf->Reset(); + delete iBuffer->At(i).iNodeBuf; + } + } + iBuffer->Reset(); + delete iBuffer; + } + + _DBG_FILE("CNSmlDmEmailAdapter::~CNSmlDmEmailAdapter(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::DDFVersionL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + _DBG_FILE("CNSmlDmEmailAdapter::DDFVersionL(TDes& aDDFVersion): begin"); + aDDFVersion.InsertL(0,KNSmlDMEmailDDFVersion); + _DBG_FILE("CNSmlDmEmailAdapter::DDFVersionL(TDes& aDDFVersion): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::DDFStructureL() +// +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::DDFStructureL(MSmlDmDDFObject& aDDF) + { + _DBG_FILE("CNSmlDmEmailAdapter::DDFStructureL(): begin"); + + TSmlDmAccessTypes accessTypesNode; + + accessTypesNode.SetGet(); + + // Email + MSmlDmDDFObject& email = aDDF.AddChildObjectL(KNSmlDMEmailNodeName); + FillNodeInfoL(email,accessTypesNode,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode,KNSmlDMEmailDescription); + + accessTypesNode.SetAdd(); + accessTypesNode.SetDelete(); + accessTypesNode.SetReplace(); + MSmlDmDDFObject& rtNode = email.AddChildObjectGroupL(); + + + FillNodeInfoL(rtNode,accessTypesNode,MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::ENode, + KNSmlDMDynamicNodeDescription); + + TSmlDmAccessTypes accessTypes; + accessTypes.SetGet(); + accessTypes.SetAdd(); + accessTypes.SetReplace(); + //displayable account name + MSmlDmDDFObject& name = rtNode.AddChildObjectL(KNSmlDMEmailName); + FillNodeInfoL(name,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMNameDescription); + + //user id for email account + MSmlDmDDFObject& uid = rtNode.AddChildObjectL(KNSmlDMEmailUID); + FillNodeInfoL(uid,accessTypes,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMUIDDescription); + + //password for email account + TSmlDmAccessTypes accessTypesPw; + accessTypesPw.SetAdd(); + accessTypesPw.SetReplace(); + MSmlDmDDFObject& pw = rtNode.AddChildObjectL(KNSmlDMEmailPW); + FillNodeInfoL(pw,accessTypesPw,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMPWDescription); + + //user's email address + MSmlDmDDFObject& uaddr = rtNode.AddChildObjectL(KNSmlDMEmailUAddr); + FillNodeInfoL(uaddr,accessTypes,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMUAddrDescription); + + //Displayable name for the user + MSmlDmDDFObject& uname = rtNode.AddChildObjectL(KNSmlDMEmailUName); + FillNodeInfoL(uname,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMUNameDescription); + + //Host name for the receiving server + MSmlDmDDFObject& mrcv = rtNode.AddChildObjectL(KNSmlDMEmailMrcv); + FillNodeInfoL(mrcv,accessTypes,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMrcvDescription); + + //Host name for the sending server + MSmlDmDDFObject& msnd = rtNode.AddChildObjectL(KNSmlDMEmailMsnd); + FillNodeInfoL(msnd,accessTypes,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMsndDescription); + + //Remote mailbox protocol + MSmlDmDDFObject& mpro = rtNode.AddChildObjectL(KNSmlDMEmailMpro); + FillNodeInfoL(mpro,accessTypes,MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMMproDescription); + + //Use secure connection + MSmlDmDDFObject& useSecCon = rtNode.AddChildObjectL(KNSmlDMEmailUseSecCon); + FillNodeInfoL(useSecCon,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMUseSecConDescription); + + //Use APop + MSmlDmDDFObject& useAPOP = rtNode.AddChildObjectL(KNSmlDMEmailUseAPOP); + FillNodeInfoL(useAPOP, accessTypes, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EBool, + KNSmlDMUseAPOPDescription ); + + //Use smtp authentication + MSmlDmDDFObject& useSauth = rtNode.AddChildObjectL(KNSmlDMEmailUseSauth); + FillNodeInfoL(useSauth,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMUseSauthDescription); + + //smtp authentication user id + MSmlDmDDFObject& sauthUid = rtNode.AddChildObjectL(KNSmlDMEmailSauthUID); + FillNodeInfoL(sauthUid,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMSauthUIDDescription); + + //Use smtp authentication + MSmlDmDDFObject& sauthPw = rtNode.AddChildObjectL(KNSmlDMEmailSauthPW); + FillNodeInfoL(sauthPw,accessTypesPw,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMSauthPWDescription); + + //Use smtp authentication + MSmlDmDDFObject& ptxtSAuth = rtNode.AddChildObjectL(KNSmlDMEmailPtxtSAuth); + FillNodeInfoL(ptxtSAuth,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMPtxtSAuthDescription); + + //Link to IAP + MSmlDmDDFObject& toNapId = rtNode.AddChildObjectL(KNSmlDMEmailToNapID); + FillNodeInfoL(toNapId,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMToNapIDDescription); + + //Link to IAP for SMTP + MSmlDmDDFObject& sToNapId = rtNode.AddChildObjectL(KNSmlDMEmailSToNapID); + FillNodeInfoL(sToNapId,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMSToNapIDDescription); + + //SSL/TLS used in SMTP + MSmlDmDDFObject& sUseSecCon = rtNode. + AddChildObjectL(KNSmlDMEmailSUseSecCon); + FillNodeInfoL(sUseSecCon,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMSUseSecConDescription); + + //StartTLS used in IMAP/POP + MSmlDmDDFObject& useStartTls = rtNode. + AddChildObjectL(KNSmlDMEmailUseStartTLS); + FillNodeInfoL(useStartTls,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMUseStartTLSDescription); + + //StartTLS used in SMTP + MSmlDmDDFObject& sUseStartTls = rtNode. + AddChildObjectL(KNSmlDMEmailSUseStartTLS); + FillNodeInfoL(sUseStartTls,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EBool, + KNSmlDMSUseStartTLSDescription); + + //port of IMAP/POP server + MSmlDmDDFObject& mrcvPort = rtNode.AddChildObjectL(KNSmlDMEmailMrcvPort); + FillNodeInfoL(mrcvPort,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EInt, + KNSmlDMMrcvPortDescription); + + //port of SMTP server + MSmlDmDDFObject& msndPort = rtNode.AddChildObjectL(KNSmlDMEmailMsndPort); + FillNodeInfoL(msndPort,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EInt, + KNSmlDMMsndPortDescription); + + //IMAP folder path + MSmlDmDDFObject& folderPath = rtNode. + AddChildObjectL(KNSmlDMEmailFolderPath); + FillNodeInfoL(folderPath,accessTypes,MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic,MSmlDmDDFObject::EChr, + KNSmlDMFolderPathDescription); + + _DBG_FILE("CNSmlDmEmailAdapter::DDFStructureL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(): begin"); + + TInt index = -1; + TBool firstAdd = EFalse; + + for(TInt i = 0; iCount(); i++) + { + TPtrC8 parentUri = RemoveLastURISeg(aURI); + //Check Node from buffer if match + if(iBuffer->At(i).iMappingName->Compare(parentUri) == 0 ) + { + firstAdd = ETrue; + index = i; + break; + } + } + + TInt luid = DesToInt(aLUID); + + if(aLUID.Length()==0 && index<0) + { + luid = ConstructTreeL(aURI); + if(luid == -1) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(): end"); + return; + } + } + + if( OpenSessionL() != KErrNone ) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(): end"); + return; + } + + if(!firstAdd) + { + + if(LastURISeg(aURI).Compare(KNSmlDMEmailMpro)==0) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(): end"); + return; + } + index = -1; + for(TInt i=0;iCount();i++) + { + if(iBuffer->At(i).iLuid == luid) + { + index = i; + break; + } + } + + if(index<0) + { + TNSmlEmailSettingsElement newNode; + newNode.iImap4Settings = NULL; + newNode.iPop3Settings = NULL; + newNode.iSmtpSettings = NULL; + newNode.iIapPref = NULL; + newNode.iSmtpIapPref = NULL; + newNode.iLuid = luid; + newNode.iMappingName = aURI.AllocLC(); + newNode.iName = HBufC::NewLC(0); + newNode.iNodeBuf = new (ELeave) CArrayFixFlat + (KNSmlDmEmailGranularity); + newNode.iExecuted = ETrue; + GetIdByLuid(newNode.iAccType, newNode.iAccId, luid); + iBuffer->AppendL(newNode); + index = iBuffer->Count() - 1; + TInt err = DoRestoreSettingsL(index); + if(err!=KErrNone) + { + CleanupStack::PopAndDestroy(2); //newNode.iMappingName,newNode.iName + newNode.iMappingName = NULL; + newNode.iName = NULL; + iBuffer->At(index).iNodeBuf->Reset(); + delete iBuffer->At(index).iNodeBuf; + iBuffer->Delete(index); + } + if(err==KErrNotFound) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(): end"); + return; + } + else if(err!=KErrNone) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(): end"); + return; + } + CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName + } + TNSmlEmailCommandElement newCommand; + newCommand.iLastUriSeg = LastURISeg(aURI).AllocLC(); + newCommand.iData = NULL; + newCommand.iStatusRef = aStatusRef; + newCommand.iLeaf = ETrue; + newCommand.iStatus = CSmlDmAdapter::EOk; + iBuffer->At(index).iNodeBuf->AppendL(newCommand); + CleanupStack::Pop(); //newCommand.iLastUriSeg + iBuffer->At(index).iJustFetch=EFalse; + DoAddLeafObjectL(newCommand.iLastUriSeg->Des(),aObject,index, + iBuffer->At(index).iNodeBuf->Count()-1); + } + else + { + FirstAddLeafL(aURI,aObject,aStatusRef,index); + } + + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::DeleteObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, +// const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmEmailAdapter::DeleteLeafObjectL( ): begin"); + if(NumOfURISegs(aURI)==2) + { + if(aLUID.Length()==0) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlDmEmailAdapter::DeleteLeafObjectL( ): ENotFound end"); + return; + } + + TInt luid = DesToInt(aLUID); + TInt err = OpenSessionL(); + if(err!=KErrNone) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::DeleteLeafObjectL( ): EError end"); + return; + } + CEmailAccounts* emailAccs = CEmailAccounts::NewLC(); + TNSmlEmailAccountType accType; + TInt id; + GetIdByLuid(accType, id, luid ); + if( AccountExistsL( emailAccs, accType, id, -1 ) ) + { + switch ( accType ) + { + case EImap: + { + RArray imap4Accs; + CleanupClosePushL( imap4Accs ); + emailAccs->GetImapAccountsL( imap4Accs ); + + for (TInt i(0); i < imap4Accs.Count(); i++) + { + if ( imap4Accs[i].iImapAccountId == id ) + { + // Delete also related Smtp account + TSmtpAccount relatedSmtp; + emailAccs->GetSmtpAccountL( imap4Accs[i].iSmtpService, relatedSmtp ); + emailAccs->DeleteImapAccountL( imap4Accs[i] ); + emailAccs->DeleteSmtpAccountL( relatedSmtp ); + //The only email a/c in phone gettiong deleted , so delete the default sntp a/c + if( imap4Accs.Count() == 1 ) + { + TInt deferr = KErrNone; + TRAP(deferr, emailAccs->DeleteDefaultSmtpAccountL()); + DBG_ARGS(_S16("CNSmlDmEmailAdapter::DeleteLeafObjectL( ): Delete default smtp account Error code %d"),deferr); + } + break; + } + } + + CleanupStack::PopAndDestroy(&imap4Accs); //imap4Accs + + // If the default account was just deleted, + // new one needs to be set. + // + TSmtpAccount defaultSmtp; + TInt retVal = emailAccs->DefaultSmtpAccountL( defaultSmtp ); + if ( retVal != KErrNone ) + { + RArray imapAccs; + CleanupClosePushL( imapAccs ); + emailAccs->GetImapAccountsL( imapAccs ); + if ( imapAccs.Count() > 0 ) + { + TSmtpAccount relatedSmtp; + emailAccs->GetSmtpAccountL( imapAccs[0].iSmtpService, relatedSmtp ); + emailAccs->SetDefaultSmtpAccountL( relatedSmtp ); + } + CleanupStack::PopAndDestroy( &imapAccs ); + RArray popAccounts; + CleanupClosePushL( popAccounts ); + emailAccs->GetPopAccountsL( popAccounts ); + if ( popAccounts.Count() > 0 ) + { + TSmtpAccount relatedSmtp; + emailAccs->GetSmtpAccountL( popAccounts[0].iSmtpService, relatedSmtp ); + emailAccs->SetDefaultSmtpAccountL( relatedSmtp ); + } + CleanupStack::PopAndDestroy( &popAccounts ); + } + break; + } + + case EPop: + { + RArray popAccs; + CleanupClosePushL( popAccs ); + emailAccs->GetPopAccountsL( popAccs ); + + for (TInt i(0); i < popAccs.Count(); i++) + { + if ( popAccs[i].iPopAccountId == id ) + { + // Delete also related Smtp account + TSmtpAccount relatedSmtp; + emailAccs->GetSmtpAccountL( popAccs[i].iSmtpService, relatedSmtp ); + emailAccs->DeletePopAccountL( popAccs[i] ); + emailAccs->DeleteSmtpAccountL( relatedSmtp ); + if( popAccs.Count() == 1 ) + { + TInt deferr = KErrNone; + TRAP(deferr, emailAccs->DeleteDefaultSmtpAccountL()); + DBG_ARGS(_S16("CNSmlDmEmailAdapter::DeleteLeafObjectL( ): Delete default smtp account Error code %d "),deferr); + } + break; + } + } + + CleanupStack::PopAndDestroy(); //popAccs + + // If the default account was just deleted, + // new one needs to be set. + // + TSmtpAccount defSmtp; + TInt retVal = emailAccs->DefaultSmtpAccountL( defSmtp ); + if ( retVal != KErrNone ) + { + RArray popAccounts; + CleanupClosePushL( popAccounts ); + emailAccs->GetPopAccountsL( popAccounts ); + if ( popAccounts.Count() > 0 ) + { + TSmtpAccount relatedSmtp; + emailAccs->GetSmtpAccountL( popAccounts[0].iSmtpService, relatedSmtp ); + emailAccs->SetDefaultSmtpAccountL( relatedSmtp ); + } + CleanupStack::PopAndDestroy( &popAccounts ); + RArray imapAccs; + CleanupClosePushL( imapAccs ); + emailAccs->GetImapAccountsL( imapAccs ); + if ( imapAccs.Count() > 0 ) + { + TSmtpAccount relatedSmtp; + emailAccs->GetSmtpAccountL( imapAccs[0].iSmtpService, relatedSmtp ); + emailAccs->SetDefaultSmtpAccountL( relatedSmtp ); + } + CleanupStack::PopAndDestroy( &imapAccs ); + } + break; + } + + default: + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + break; + } + + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + else + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + } + CleanupStack::PopAndDestroy(); //emailAccs + } + else + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + + _DBG_FILE("CNSmlDmEmailAdapter::DeleteLeafObjectL( ): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::FetchLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, +// const TDesC8& aType, +// const TInt aResultsRef, +// const TInt aStatusRef ) +// +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmEmailAdapter::FetchLeafObjectL(): begin"); + + TInt luid = DesToInt(aLUID); + + if(aLUID.Length()==0) + { + luid = ConstructTreeL(aURI); + if(luid == -1) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlDmEmailAdapter::FetchLeafObjectL(): ENotFound end"); + return; + } + } + if( OpenSessionL() != KErrNone ) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::FetchLeafObjectL(): EError end"); + return; + } + + TInt index = -1; + for(TInt i=0;iCount();i++) + { + if(iBuffer->At(i).iLuid == luid) + { + index = i; + break; + } + } + + if(index<0) + { + TNSmlEmailSettingsElement newNode; + newNode.iImap4Settings = NULL; + newNode.iPop3Settings = NULL; + newNode.iSmtpSettings = NULL; + newNode.iIapPref = NULL; + newNode.iSmtpIapPref = NULL; + newNode.iLuid = luid; + newNode.iMappingName = aURI.AllocLC(); + newNode.iName = HBufC::NewLC(0); + newNode.iNodeBuf = new (ELeave) + CArrayFixFlat (KNSmlDmEmailGranularity); + newNode.iExecuted = ETrue; + newNode.iJustFetch = ETrue; + GetIdByLuid(newNode.iAccType, newNode.iAccId, luid); + iBuffer->AppendL(newNode); + index = iBuffer->Count() - 1; + if( DoRestoreSettingsL(index) != KErrNone ) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName + _DBG_FILE("CNSmlDmEmailAdapter::FetchLeafObjectL(): EError end"); + return; + } + CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName + } + + TPtrC8 lastUriSeg = LastURISeg(aURI); + CBufBase* object = CBufFlat::NewL(32); + CleanupStack::PushL(object); + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + if(lastUriSeg.Compare(KNSmlDMEmailName)==0) + { + HBufC8 *data = HBufC8::NewLC(iBuffer->At(index).iName->Length()); + TPtr8 dataPtr = data->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( + dataPtr,iBuffer->At(index).iName->Des() ); + object->InsertL(0,dataPtr); + CleanupStack::PopAndDestroy(); //data + } + + else if(lastUriSeg.Compare(KNSmlDMEmailUID)==0) + { + HBufC *data = NULL; + if(iBuffer->At(index).iPop3Settings!= NULL) + { + data = HBufC::NewLC(iBuffer->At(index).iPop3Settings->LoginName().Length()); + data->Des().Copy(iBuffer->At(index).iPop3Settings->LoginName()); + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + data = HBufC::NewLC(iBuffer->At(index).iImap4Settings->LoginName().Length()); + data->Des().Copy(iBuffer->At(index).iImap4Settings->LoginName()); + } + if(data) + { + HBufC8 *data8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(*data); + CleanupStack::PushL(data8); + object->InsertL(0,*data8); + CleanupStack::PopAndDestroy(2);//data, data8 + } + } + + else if(lastUriSeg.Compare(KNSmlDMEmailPW)==0) + { + HBufC *data = NULL; + if(iBuffer->At(index).iPop3Settings!= NULL) + { + data = HBufC::NewLC(iBuffer->At(index).iPop3Settings->Password().Length()); + data->Des().Copy(iBuffer->At(index).iPop3Settings->Password()); + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + data = HBufC::NewLC(iBuffer->At(index).iImap4Settings->Password().Length()); + data->Des().Copy(iBuffer->At(index).iImap4Settings->Password()); + } + if(data) + { + HBufC8 *data8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(*data); + CleanupStack::PushL(data8); + object->InsertL(0,*data8); + CleanupStack::PopAndDestroy(2);//data, data8 + } + } + + else if(lastUriSeg.Compare(KNSmlDMEmailUAddr)==0) + { + HBufC *data = NULL; + data = iBuffer->At(index).iSmtpSettings->EmailAddress().AllocLC(); + HBufC8 *data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + object->InsertL(0,dataPtr8); + CleanupStack::PopAndDestroy(2); //data, data8 + } + + else if(lastUriSeg.Compare(KNSmlDMEmailUName)==0) + { + + HBufC *data = NULL; + data = iBuffer->At(index).iSmtpSettings->EmailAlias().AllocLC(); + HBufC8 *data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + object->InsertL(0,dataPtr8); + CleanupStack::PopAndDestroy(2); //data, data8 + } + + else if(lastUriSeg.Compare( KNSmlDMEmailMrcv)==0) + { + HBufC *data = NULL; + if(iBuffer->At(index).iPop3Settings!= NULL) + { + data = iBuffer->At(index).iPop3Settings->ServerAddress().AllocLC(); + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + data = iBuffer->At(index).iImap4Settings->ServerAddress().AllocLC(); + } + else + { + status = CSmlDmAdapter::ENotFound; + } + if(data) + { + HBufC8 *data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + object->InsertL(0,dataPtr8); + CleanupStack::PopAndDestroy(2); //data, data8 + } + } + + else if(lastUriSeg.Compare(KNSmlDMEmailMsnd)==0) + { + HBufC *data = NULL; + data = iBuffer->At(index).iSmtpSettings->ServerAddress().AllocLC(); + HBufC8 *data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + object->InsertL(0,dataPtr8); + CleanupStack::PopAndDestroy(2); //data, data8 + } + + else if(lastUriSeg.Compare(KNSmlDMEmailMpro)==0) + { + if(iBuffer->At(index).iPop3Settings!= NULL) + { + object->InsertL(0,KNSmlDMEmailMproPOP); + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + object->InsertL(0,KNSmlDMEmailMproIMAP); + } + } + + else if(lastUriSeg.Compare(KNSmlDMEmailUseSecCon)==0) + { + FetchSecurityValueL(*object, &iBuffer->At(index), EUseSecCon ); + } + + else if(lastUriSeg.Compare(KNSmlDMEmailUseSauth)==0) + { + if(iBuffer->At(index).iSmtpSettings->SMTPAuth()) + { + object->InsertL(0,KNSmlDMEmailTrue); + } + else + { + object->InsertL(0,KNSmlDMEmailFalse); + } + } + + else if(lastUriSeg.Compare(KNSmlDMEmailSauthUID)==0) + { + HBufC *data = HBufC::NewLC(iBuffer->At(index).iSmtpSettings->LoginName().Length()); + data->Des().Copy(iBuffer->At(index).iSmtpSettings->LoginName()); + HBufC8 *data8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(*data); + CleanupStack::PushL(data8); + object->InsertL(0,*data8); + CleanupStack::PopAndDestroy(2);//data, data8 + } + + else if(lastUriSeg.Compare(KNSmlDMEmailSauthPW)==0) + { + HBufC *data = HBufC::NewLC(iBuffer->At(index).iSmtpSettings->Password().Length()); + data->Des().Copy(iBuffer->At(index).iSmtpSettings->Password()); + HBufC8 *data8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(*data); + CleanupStack::PushL(data8); + object->InsertL(0,*data8); + CleanupStack::PopAndDestroy(2);//data, data8 + } + + else if(lastUriSeg.Compare(KNSmlDMEmailPtxtSAuth)==0) + { + if(iBuffer->At(index).iSmtpSettings->InboxLoginDetails()) + { + object->InsertL(0,KNSmlDMEmailTrue); + } + else + { + object->InsertL(0,KNSmlDMEmailFalse); + } + } + + else if (lastUriSeg.Compare(KNSmlDMEmailSUseSecCon)==0) + { + FetchSecurityValueL(*object, &iBuffer->At(index), ESuseSecCon ); + } + + else if (lastUriSeg.Compare(KNSmlDMEmailUseStartTLS)==0) + { + FetchSecurityValueL(*object, &iBuffer->At(index), EUseStartTls ); + } + + else if (lastUriSeg.Compare(KNSmlDMEmailSUseStartTLS)==0) + { + FetchSecurityValueL(*object, &iBuffer->At(index), ESuseStartTls ); + } + + else if(lastUriSeg.Compare(KNSmlDMEmailMrcvPort)==0) + { + TUint port; + if(iBuffer->At(index).iPop3Settings!= NULL) + { + port = iBuffer->At(index).iPop3Settings->Port(); + } + else + { + port = iBuffer->At(index).iImap4Settings->Port(); + } + HBufC8 *data = IntToDes8LC(port); + object->InsertL(0,data->Des()); + CleanupStack::PopAndDestroy(); //data + } + + else if(lastUriSeg.Compare(KNSmlDMEmailMsndPort)==0) + { + TUint port = iBuffer->At(index).iSmtpSettings->Port(); + HBufC8 *data = IntToDes8LC(port); + object->InsertL(0,data->Des()); + CleanupStack::PopAndDestroy(); //data + } + + else if(lastUriSeg.Compare(KNSmlDMEmailUseAPOP)==0) + { + if(iBuffer->At(index).iPop3Settings!= NULL) + { + if(iBuffer->At(index).iPop3Settings->Apop()) + { + object->InsertL(0,KNSmlDMEmailTrue); + } + else + { + object->InsertL(0,KNSmlDMEmailFalse); + } + } + else + { + status = CSmlDmAdapter::ENotFound; + } + } + + else if (lastUriSeg.Compare(KNSmlDMEmailFolderPath)==0) + { + if(iBuffer->At(index).iImap4Settings) + { + object->InsertL(0, iBuffer->At(index).iImap4Settings->FolderPath() ); + } + else + { + status = CSmlDmAdapter::ENotFound; + } + } + + else if(lastUriSeg.Compare(KNSmlDMEmailToNapID)==0) + { + + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + HBufC8* uri8 = NULL; + TInt iapCount = iBuffer->At(index).iIapPref->NumberOfIAPs(); + if ( iapCount ) + { + TImIAPChoice localIAP = iBuffer->At(index).iIapPref->IAPPreference(0); + uri8 = iapmatch->URIFromIAPIdL( localIAP.iIAP ); + } + + if( uri8 ) + { + CleanupStack::PushL(uri8); + object->InsertL(0,uri8->Des()); + status = CSmlDmAdapter::EOk; + CleanupStack::PopAndDestroy(); // uri8 + } + + CleanupStack::PopAndDestroy(); // iapMatch + } + else if(lastUriSeg.Compare(KNSmlDMEmailSToNapID)==0) + { + + // SToNapID exists only for SMTP + if (iBuffer->At(index).iSmtpSettings!= NULL) + { + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + HBufC8* uri8 = NULL; + TInt iapCount = iBuffer->At(index).iIapPref->NumberOfIAPs(); + if ( iapCount ) + { + TImIAPChoice localIAP = iBuffer->At(index).iSmtpIapPref->IAPPreference(0); + uri8 = iapmatch->URIFromIAPIdL( localIAP.iIAP ); + } + + if( uri8 ) + { + CleanupStack::PushL(uri8); + object->InsertL(0,uri8->Des()); + status = CSmlDmAdapter::EOk; + CleanupStack::PopAndDestroy(); // uri8 + } + + CleanupStack::PopAndDestroy(); // iapMatch + } + else + { + status = CSmlDmAdapter::ENotFound; + } + } + + if(status == CSmlDmAdapter::EOk) + { + Callback().SetResultsL(aResultsRef,*object,aType); + } + Callback().SetStatusL(aStatusRef, status); + CleanupStack::PopAndDestroy(object); //object + + _DBG_FILE("CNSmlDmEmailAdapter::FetchLeafObjectL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::ChildURIListL( const TDesC8& aURI, +// const TDesC8& aParentLUID, +// const CArrayFix& +// aPreviousURISegmentList, +// const TInt aResultsRef, +// const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const CArrayFix& + aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmEmailAdapter::ChildURIListL(): begin"); + + CSmlDmAdapter::TError ret = CSmlDmAdapter::EError; + + if( OpenSessionL() != KErrNone ) + { + Callback().SetStatusL(aStatusRef, ret); + _DBG_FILE("CNSmlDmEmailAdapter::ChildURIListL(): end"); + return; + } + CBufBase *currentList = CBufFlat::NewL(128); + CleanupStack::PushL(currentList); + + CEmailAccounts* emailAccs = CEmailAccounts::NewLC(); + + if(aURI.Compare(KNSmlDMEmailNodeName)==0) + { + RArray imap4Accounts; + CleanupClosePushL( imap4Accounts ); + emailAccs->GetImapAccountsL(imap4Accounts); + + // First, IMAP accounts + // + TInt luid; + TPtrC8 name; + // cycle through every found account + for(TInt count = 0; count < imap4Accounts.Count(); count++) + { + SetLuidById( EImap, imap4Accounts[count].iImapAccountId, luid ); + + TBool found = EFalse; + // cycle through every known account + for(TInt i = 0; iDes(); + uriPtr.Format(aURI); + uriPtr.Append(KNSmlDMEmailSeparator8); + uriPtr.Append(KNSmlDMEmailMproIMAP); + TUint16 crc; + Mem::Crc ( crc, &imap4Accounts[count],sizeof(TImapAccount) ); + HBufC8 *crcBuf = IntToDes8LC(crc); + uriPtr.Append(*crcBuf); + HBufC8 *luidBuf = IntToDes8LC(luid); + Callback().SetMappingL(uriPtr,luidBuf->Des()); + currentList->InsertL( currentList->Size(),LastURISeg(uriPtr)); + CleanupStack::PopAndDestroy(3); //uri,luidBuf, crcBuf + } + else + { + currentList->InsertL( currentList->Size(),name ); + } + // in all cases: add it to results. + if(count < imap4Accounts.Count()-1 ) + { + currentList->InsertL(currentList->Size(),KNSmlDMEmailSeparator8); + } + } + CleanupStack::PopAndDestroy(); //imap4Accounts + + // Then, POP accounts + // + RArray pop3Accounts; + CleanupClosePushL( pop3Accounts ); + emailAccs->GetPopAccountsL( pop3Accounts ); + if (pop3Accounts.Count()&¤tList->Size()>0) + { + // there is at least one account; insert separator + currentList->InsertL(currentList->Size(),KNSmlDMEmailSeparator8); + } + // cycle through every found account + for(TInt count = 0; count < pop3Accounts.Count(); count++) + { + SetLuidById( EPop, pop3Accounts[count].iPopAccountId, luid ); + + TBool found = EFalse; + // cycle through every known account + for(TInt i = 0; iDes(); + uriPtr.Format(aURI); + uriPtr.Append(KNSmlDMEmailSeparator8); + uriPtr.Append(KNSmlDMEmailMproPOP); + TUint16 crc; + Mem::Crc ( crc, &pop3Accounts[count],sizeof(TPopAccount) ); + HBufC8 *crcBuf = IntToDes8LC(crc); + uriPtr.Append(*crcBuf); + HBufC8 *luidBuf = IntToDes8LC(luid); + Callback().SetMappingL(uriPtr,luidBuf->Des()); + currentList->InsertL( currentList->Size(),LastURISeg(uriPtr)); + CleanupStack::PopAndDestroy(3); //uri,luidBuf,crcBuf + } + else + { + currentList->InsertL( currentList->Size(),name ); + } + // in all cases: add it to results. + if(count < pop3Accounts.Count()-1) + { + currentList->InsertL(currentList->Size(),KNSmlDMEmailSeparator8); + } + } + CleanupStack::PopAndDestroy(); //pop3Accounts + ret = CSmlDmAdapter::EOk; + } + else + { + if(aParentLUID.Length() > 0) + { + TInt err = KErrNotFound; + TInt luid = DesToInt(aParentLUID); + TNSmlEmailAccountType accType; + TInt id; + GetIdByLuid( accType, id, luid ); + switch ( accType ) + { + case EImap: + { + RArray imap4Accounts; + CleanupClosePushL( imap4Accounts ); + emailAccs->GetImapAccountsL( imap4Accounts ); + for ( TInt i=0; i pop3Accounts; + CleanupClosePushL( pop3Accounts ); + emailAccs->GetPopAccountsL(pop3Accounts); + for ( TInt i=0; iInsertL(0,KNSmlDMEmailListOfLeafs); + } + } + else + { + ret = CSmlDmAdapter::ENotFound; + } + } + // Common part + Callback().SetStatusL(aStatusRef, ret); + if( ret == CSmlDmAdapter::EOk ) + { + Callback().SetResultsL(aResultsRef,*currentList,KNullDesC8); + } + + CleanupStack::PopAndDestroy(emailAccs); //emailAccs + CleanupStack::PopAndDestroy(currentList); //currentList + _DBG_FILE("CNSmlDmEmailAdapter::ChildURIListL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::AddNodeObjectL( const TDesC8& aURI, +// const TDesC8& aParentLUID, const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmEmailAdapter::AddNodeObjectL(): begin"); + + if(aParentLUID.Length()>0) + { + TInt luid = DesToInt(aParentLUID); + TInt accId; + TNSmlEmailAccountType accType; + GetIdByLuid( accType, accId, luid ); + TInt err = OpenSessionL(); + if(err!=KErrNone) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::AddNodeObjectL(): EError end"); + return; + } + CEmailAccounts* emailAccs = CEmailAccounts::NewLC(); + TBool accEx = AccountExistsL( emailAccs, accType, accId, -1 ); + CleanupStack::PopAndDestroy( emailAccs ); + if( accEx ) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EAlreadyExists); + _DBG_FILE("CNSmlDmEmailAdapter::AddNodeObjectL(): EAlreadyExists end"); + return; + } + else + { + TInt ret = Callback().RemoveMappingL( KNSmlDMEmailAdapterImplUid, + GetDynamicEmailNodeUri(aURI), ETrue ); + if(ret != KErrNone) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::AddNodeObjectL(): EError end"); + return; + } + } + Callback().SetMappingL(aURI,KNullDesC8); + } + + if( aURI.Find(KNSmlDMEmailNodeName)>=0 && NumOfURISegs(aURI)==2 ) + { + if( OpenSessionL() != KErrNone ) + { + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::AddNodeObjectL(): EError end"); + return; + } + + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + //2files and 2 folders are needed for settings + if (SysUtil::FFSSpaceBelowCriticalLevelL(&fs, + KNSmlDmFatMinimumFileSize*4)) + { + CleanupStack::PopAndDestroy(); //fs + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EDiskFull); + _DBG_FILE("CNSmlDmEmailAdapter::AddNodeObjectL(): EDiskFull end"); + return; + // do not write + } + CleanupStack::PopAndDestroy(); //fs + + + TNSmlEmailSettingsElement newNode; + newNode.iMappingName = aURI.AllocLC(); + newNode.iName = HBufC::NewLC(0); + newNode.iNodeBuf = new (ELeave) + CArrayFixFlat (KNSmlDmEmailGranularity); + newNode.iExecuted = EFalse; + newNode.iImap4Settings = NULL; + newNode.iPop3Settings = NULL; + newNode.iSmtpSettings = NULL; + newNode.iIapPref = NULL; + newNode.iSmtpIapPref = NULL; + newNode.iLuid = 0; + newNode.iJustFetch=EFalse; + iBuffer->AppendL(newNode); + CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName + TNSmlEmailCommandElement newCommand; + newCommand.iLastUriSeg = LastURISeg(aURI).AllocLC(); //aURI.AllocLC(); + newCommand.iData = NULL; + newCommand.iStatusRef = aStatusRef; + newCommand.iLeaf = EFalse; + newCommand.iStatus = CSmlDmAdapter::EOk; + TInt index = iBuffer->Count() - 1; + iBuffer->At(index).iNodeBuf->AppendL(newCommand); + CleanupStack::Pop(); //newCommand.iLastUriSeg + + + } + _DBG_FILE("CNSmlDmEmailAdapter::AddNodeObjectL(): end"); + } +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::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 Email settings streaming +// is not supported. +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(stream): begin"); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::UpdateLeafObjectL(stream): end"); + } +// ----------------------------------------------------------------------------- +// void CNSmlDmEmailAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef, +// const TInt aStatusRef ) +// Fetches data object and returns its size. +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmEmailAdapter::FetchLeafObjectSizeL(): begin"); + + CBufBase *result = CBufFlat::NewL(32); + CleanupStack::PushL(result); + CSmlDmAdapter::TError status = FetchObjectL(aURI, aLUID, *result); + if( status == CSmlDmAdapter::EOk ) + { + TInt objSizeInBytes = result->Size(); + TBuf8<4> stringObjSizeInBytes; + stringObjSizeInBytes.Num( objSizeInBytes ); + result->Reset(); + result->InsertL( 0, stringObjSizeInBytes ); + Callback().SetResultsL(aResultsRef, *result, aType); + } + Callback().SetStatusL(aStatusRef, status); + CleanupStack::PopAndDestroy(); //result + _DBG_FILE("CNSmlDmEmailAdapter::FetchLeafObjectSizeL(): end"); + } +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::ExecuteCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + //Not supported + _DBG_FILE("CNSmlDmEmailAdapter::ExecuteCommandL(): begin"); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::ExecuteCommandL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::ExecuteCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + //Not supported + _DBG_FILE("CNSmlDmEmailAdapter::ExecuteCommandL(): begin"); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::ExecuteCommandL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::CopyCommandL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + //Not supported + _DBG_FILE("CNSmlDmEmailAdapter::CopyCommandL(): begin"); + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlDmEmailAdapter::CopyCommandL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::StartAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::StartAtomicL() + { + //Not supported + _DBG_FILE("CNSmlDmEmailAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlDmEmailAdapter::StartAtomicL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::CommitAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::CommitAtomicL() + { + //Not supported + _DBG_FILE("CNSmlDmEmailAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlDmEmailAdapter::CommitAtomicL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::RollbackAtomicL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::RollbackAtomicL() + { + //Not supported + _DBG_FILE("CNSmlDmEmailAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlDmEmailAdapter::RollbackAtomicL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::StreamingSupport() +// ----------------------------------------------------------------------------- +TBool CNSmlDmEmailAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + _DBG_FILE("CNSmlDmEmailAdapter::StreamingSupport(): begin"); + _DBG_FILE("CNSmlDmEmailAdapter::StreamingSupport(): end"); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::StreamCommittedL() +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::StreamCommittedL() + { + //Not supported + _DBG_FILE("CNSmlDmEmailAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CNSmlDmEmailAdapter::StreamCommittedL(): end"); + } +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::CompleteOutstandingCmdsL() +// Indication of message ending. The buffered commands must be executed +// before return of this function. +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::CompleteOutstandingCmdsL() + { + _DBG_FILE("CNSmlDmEmailAdapter::CompleteOutstandingCmdsL(): begin"); + + for(TInt i=0;iCount();i++) + { + + //Set buffered port values + for(TInt cmd=0;cmdAt(i).iNodeBuf->Count();cmd++) + { + + TNSmlEmailSettingsElement& bufElem = iBuffer->At(i); + TNSmlEmailCommandElement& elem = bufElem.iNodeBuf->At(cmd); + + if(elem.iLastUriSeg->Compare(KNSmlDMEmailMrcvPort)==0) + { + TUint port = DesToInt(*elem.iData); + + if(port>0 && port <= KNSmlDMEmailMaxPortNbr) + { + if(bufElem.iPop3Settings!= NULL) + { + bufElem.iPop3Settings->SetPort(port); + } + else if(bufElem.iImap4Settings!= NULL) + { + bufElem.iImap4Settings->SetPort(port); + } + } + else + { + elem.iStatus = CSmlDmAdapter::EInvalidObject; + } + } + else if(elem.iLastUriSeg->Compare(KNSmlDMEmailMsndPort)==0) + { + TUint port = DesToInt(*elem.iData); + + if(port>0 && port <= KNSmlDMEmailMaxPortNbr) + { + bufElem.iSmtpSettings->SetPort(port); + } + else + { + elem.iStatus = CSmlDmAdapter::EInvalidObject; + } + } + if((iBuffer->At(i).iSmtpSettings->LoginName()==KNullDesC8) && elem.iLastUriSeg->Compare(KNSmlDMEmailUID)==0) + { + elem.iStatus = CSmlDmAdapter::EError; + } + } + + + CSmlDmAdapter::TError stat = CSmlDmAdapter::EOk; + TInt luid=-1; + + if(iBuffer->At(i).iExecuted) + { + TRAPD( leaveCode,luid = ValidateAndStoreSettingsL(i) ); + if(leaveCode!=KErrNone) + { + stat = CSmlDmAdapter::EError; + } + } + else + { + stat = CSmlDmAdapter::EError; + } + + for(TInt cmd=0;cmdAt(i).iNodeBuf->Count();cmd++) + { + + if(iBuffer->At(i).iNodeBuf->At(cmd).iStatus==CSmlDmAdapter::EOk) + { + Callback().SetStatusL(iBuffer->At(i).iNodeBuf->At(cmd).iStatusRef, + stat); + if(!iBuffer->At(i).iNodeBuf->At(cmd).iLeaf) + { + if(stat==CSmlDmAdapter::EOk) + { + HBufC8* luidDes = IntToDes8LC(luid); + Callback().SetMappingL( iBuffer->At(i).iMappingName->Des(), + luidDes->Des() ); + CleanupStack::PopAndDestroy(); //luidDes + } + } + } + else + { + Callback().SetStatusL(iBuffer->At(i).iNodeBuf->At(cmd).iStatusRef, + iBuffer->At(i).iNodeBuf->At(cmd).iStatus); + } + + delete iBuffer->At(i).iNodeBuf->At(cmd).iLastUriSeg; + iBuffer->At(i).iNodeBuf->At(cmd).iLastUriSeg= NULL; + delete iBuffer->At(i).iNodeBuf->At(cmd).iData; + iBuffer->At(i).iNodeBuf->At(cmd).iData= NULL; + + } + iBuffer->At(i).iNodeBuf->Reset(); + delete iBuffer->At(i).iNodeBuf; + iBuffer->At(i).iNodeBuf = NULL; + delete iBuffer->At(i).iMappingName; + iBuffer->At(i).iMappingName= NULL; + delete iBuffer->At(i).iName; + iBuffer->At(i).iName= NULL; + delete iBuffer->At(i).iSmtpSettings; + iBuffer->At(i).iSmtpSettings= NULL; + delete iBuffer->At(i).iPop3Settings; + iBuffer->At(i).iPop3Settings= NULL; + delete iBuffer->At(i).iImap4Settings; + iBuffer->At(i).iImap4Settings= NULL; + delete iBuffer->At(i).iIapPref; + iBuffer->At(i).iIapPref= NULL; + delete iBuffer->At(i).iSmtpIapPref; + iBuffer->At(i).iSmtpIapPref= NULL; + + } // end for + iBuffer->Reset(); + + _DBG_FILE("CNSmlDmEmailAdapter::CompleteOutstandingCmdsL(): end"); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- + +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KNSmlDMEmailAdapterImplUid, + CNSmlDmEmailAdapter::NewL) + }; + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmEmailAdapter: begin"); + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmEmailAdapter: end"); + return ImplementationTable; + } + + + +// ----------------------------------------------------------------------------- +// TPtrC8 CNSmlDmEmailAdapter::LastURISeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ----------------------------------------------------------------------------- +TPtrC8 CNSmlDmEmailAdapter::LastURISeg(const TDesC8& aURI) const + { + _DBG_FILE("CNSmlDmEmailAdapter::LastURISeg() : begin"); + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]=='/') + { + break; + } + } + _DBG_FILE("CNSmlDmEmailAdapter::LastURISeg() : end"); + if(i==0) + { + return aURI; + } + else + { + return aURI.Mid(i+1); + } + } + +// ----------------------------------------------------------------------------- +// TPtrC8 CNSmlDmEmailAdapter::RemoveLastURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ----------------------------------------------------------------------------- +TPtrC8 CNSmlDmEmailAdapter::RemoveLastURISeg(const TDesC8& aURI) const + { + TInt i; + for(i=aURI.Length()-1;i>=0;i--) + { + if(aURI[i]=='/') + { + break; + } + } + return aURI.Left(i); + } + + + +// ----------------------------------------------------------------------------- +// TInt CNSmlDmEmailAdapter::NumOfURISegs(const TDesC8& aURI) +// Returns the num of uri segs +// ----------------------------------------------------------------------------- +TInt CNSmlDmEmailAdapter::NumOfURISegs(const TDesC8& aURI) const + { + TInt numOfURISegs = 1; + for(TInt i=0;iAt(aIndex).iNodeBuf->AppendL(newCommand); + CleanupStack::Pop(2); //newCommand.iLastUriSeg, newCommand.iData + if(!iBuffer->At(aIndex).iExecuted) + { + if(lastSeg.Compare(KNSmlDMEmailMpro)==0) + { + TBool ok = EFalse; + HBufC8* object = aObject.AllocLC(); + TPtr8 objectPtr = object->Des(); + objectPtr.UpperCase(); + + if(objectPtr.Find(KNSmlDMEmailMproPOP) >= 0) + { + iBuffer->At(aIndex).iPop3Settings = new(ELeave) CImPop3Settings; + ok=ETrue; + } + + else if(objectPtr.Find(KNSmlDMEmailMproIMAP) >= 0) + { + iBuffer->At(aIndex).iImap4Settings = new(ELeave) CImImap4Settings; + ok=ETrue; + } + if(ok) + { + iBuffer->At(aIndex).iSmtpSettings = new(ELeave) CImSmtpSettings; + iBuffer->At(aIndex).iIapPref = CImIAPPreferences::NewLC(); + iBuffer->At(aIndex).iSmtpIapPref = CImIAPPreferences::NewLC(); + CleanupStack::Pop(); //iBuffer->At(index).iIapPref + CleanupStack::Pop(); //iBuffer->At(index).iSmtpIapPref + SetDefaultSettingsL(aIndex); + + for(TInt i = 0; iAt(aIndex).iNodeBuf->Count();i++) + { + if(iBuffer->At(aIndex).iNodeBuf->At(i).iLeaf) + { + DoAddLeafObjectL(iBuffer->At(aIndex).iNodeBuf->At(i).iLastUriSeg->Des(), + iBuffer->At(aIndex).iNodeBuf->At(i).iData->Des(), + aIndex, i); + } + } + + iBuffer->At(aIndex).iExecuted = ETrue; + } + CleanupStack::PopAndDestroy(); //object + } + } + else + { + DoAddLeafObjectL(lastSeg,aObject,aIndex, + iBuffer->At(aIndex).iNodeBuf->Count()-1); + } + + _DBG_FILE("CNSmlDmEmailAdapter::FirstAddLeafL() :: end"); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::DoAddLeafObjectL +// ----------------------------------------------------------------------------- +TInt CNSmlDmEmailAdapter::DoAddLeafObjectL(const TDesC8& aLastUriSeg, + const TDesC8& aObject, + TInt aIndex, + TInt aCommand) + { + _DBG_FILE("CNSmlDmEmailAdapter::DoAddLeafObjectL() :: begin"); + if(aLastUriSeg.Compare(KNSmlDMEmailName)==0) + { + if ( aObject.Size() < KEmailAccountNameSize ) + { + delete iBuffer->At(aIndex).iName; + iBuffer->At(aIndex).iName = NULL; + iBuffer->At(aIndex).iName = HBufC::NewL(aObject.Size()); + TPtr namePtr = iBuffer->At(aIndex).iName->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, aObject ); + } + else + { + iBuffer->At(aIndex).iNodeBuf->At(aCommand).iStatus = + CSmlDmAdapter::ETooLargeObject; + } + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailUID)==0) + { + if(iBuffer->At(aIndex).iPop3Settings!= NULL) + { + iBuffer->At(aIndex).iPop3Settings->SetLoginNameL(aObject); + } + else if(iBuffer->At(aIndex).iImap4Settings!= NULL) + { + iBuffer->At(aIndex).iImap4Settings->SetLoginNameL(aObject); + } + if(iBuffer->At(aIndex).iSmtpSettings->LoginName()==KNullDesC8) + { + iBuffer->At(aIndex).iSmtpSettings->SetLoginNameL(aObject); + } + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailPW)==0) + { + if(iBuffer->At(aIndex).iPop3Settings!= NULL) + { + iBuffer->At(aIndex).iPop3Settings->SetPasswordL(aObject); + } + else if(iBuffer->At(aIndex).iImap4Settings!= NULL) + { + iBuffer->At(aIndex).iImap4Settings->SetPasswordL(aObject); + } + if(iBuffer->At(aIndex).iSmtpSettings->Password()==KNullDesC8) + { + iBuffer->At(aIndex).iSmtpSettings->SetPasswordL(aObject); + } + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailUAddr)==0) + { + HBufC *object = HBufC::NewLC(aObject.Size()); + TPtr objectPtr = object->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( objectPtr, aObject ); + if(iBuffer->At(aIndex).iSmtpSettings!= NULL) + { + iBuffer->At(aIndex).iSmtpSettings->SetEmailAddressL(objectPtr); + iBuffer->At(aIndex).iSmtpSettings->SetReplyToAddressL(objectPtr); + iBuffer->At(aIndex).iSmtpSettings->SetReceiptAddressL(objectPtr); + } + + CleanupStack::PopAndDestroy(); //object + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailUName)==0) + { + HBufC *object = HBufC::NewLC(aObject.Size()); + TPtr objectPtr = object->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( objectPtr, aObject ); + if(iBuffer->At(aIndex).iSmtpSettings!= NULL) + { + iBuffer->At(aIndex).iSmtpSettings->SetEmailAliasL(objectPtr); + } + CleanupStack::PopAndDestroy(); //object + } + + else if(aLastUriSeg.Compare( KNSmlDMEmailMrcv)==0) + { + HBufC *object = HBufC::NewLC(aObject.Size()); + TPtr objectPtr = object->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( objectPtr, aObject ); + if(iBuffer->At(aIndex).iPop3Settings!= NULL) + { + iBuffer->At(aIndex).iPop3Settings->SetServerAddressL(objectPtr); + } + else if(iBuffer->At(aIndex).iImap4Settings!= NULL) + { + iBuffer->At(aIndex).iImap4Settings->SetServerAddressL(objectPtr); + } + CleanupStack::PopAndDestroy(); //object + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailMsnd)==0) + { + HBufC *object = HBufC::NewLC(aObject.Size()); + TPtr objectPtr = object->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( objectPtr, aObject ); + if(iBuffer->At(aIndex).iSmtpSettings!= NULL) + { + iBuffer->At(aIndex).iSmtpSettings->SetServerAddressL(objectPtr); + } + CleanupStack::PopAndDestroy(); //object + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailMpro)==0) + { + iBuffer->At(aIndex).iNodeBuf->At(aCommand).iStatus = CSmlDmAdapter::EOk; + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailUseSecCon)==0) + { + SetDefaultSecurityL(aObject, &iBuffer->At(aIndex), EUseSecCon ); + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailUseSauth)==0) + { + HBufC8 *data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + TBool object=EFalse; + if(dataPtr.Find(KNSmlDMEmailTrue)>=0) + { + object = ETrue; + } + if(iBuffer->At(aIndex).iSmtpSettings!= NULL) + { + iBuffer->At(aIndex).iSmtpSettings->SetSMTPAuth(object); + } + CleanupStack::PopAndDestroy(); //data + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailSauthUID)==0) + { + if( iBuffer->At(aIndex).iSmtpSettings ) + { + iBuffer->At(aIndex).iSmtpSettings->SetLoginNameL(aObject); + } + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailSauthPW)==0) + { + if( iBuffer->At(aIndex).iSmtpSettings ) + { + iBuffer->At(aIndex).iSmtpSettings->SetPasswordL( aObject ); + } + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailPtxtSAuth)==0) + { + HBufC8 *data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + TBool object=EFalse; + if(dataPtr.Find(KNSmlDMEmailTrue)>=0) + { + object = ETrue; + } + if(iBuffer->At(aIndex).iSmtpSettings!= NULL) + { + iBuffer->At(aIndex).iSmtpSettings->SetInboxLoginDetails(object); + } + CleanupStack::PopAndDestroy(); //data + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailSUseSecCon)==0) + { + SetDefaultSecurityL(aObject, &iBuffer->At(aIndex), ESuseSecCon ); + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailUseStartTLS)==0) + { + SetDefaultSecurityL(aObject, &iBuffer->At(aIndex), EUseStartTls ); + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailSUseStartTLS)==0) + { + SetDefaultSecurityL(aObject, &iBuffer->At(aIndex), ESuseStartTls ); + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailMrcvPort)==0) + { + TNSmlEmailSettingsElement& bufElem = iBuffer->At(aIndex); + TNSmlEmailCommandElement& elem = bufElem.iNodeBuf->At(aCommand); + elem.iData = aObject.AllocL(); + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailMsndPort)==0) + { + TNSmlEmailSettingsElement& bufElem = iBuffer->At(aIndex); + TNSmlEmailCommandElement& elem = bufElem.iNodeBuf->At(aCommand); + elem.iData = aObject.AllocL(); + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailUseAPOP)==0) + { + TBool object=EFalse; + if(aObject.Find(_L8("True"))>=0 || aObject.Find(_L8("true"))>=0) + { + object = ETrue; + } + if(iBuffer->At(aIndex).iPop3Settings!= NULL) + { + iBuffer->At(aIndex).iPop3Settings->SetApop(object); + } + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailFolderPath)==0) + { + if(iBuffer->At(aIndex).iImap4Settings!= NULL) + { + iBuffer->At(aIndex).iImap4Settings->SetFolderPathL(aObject); + } + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailToNapID)==0) + { + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + + TInt iap = iapmatch->IAPIdFromURIL( aObject ); + + if ( iap != KErrNotFound ) + { + TImIAPChoice localIAP; + localIAP.iIAP = iap; + DBG_ARGS(_S("IAP = %d"), localIAP.iIAP); + localIAP.iDialogPref = ECommDbDialogPrefDoNotPrompt; + + if ( iBuffer->At(aIndex).iSmtpIapPref->NumberOfIAPs() ) + { + iBuffer->At(aIndex).iIapPref->RemoveIAPL(0); + } + iBuffer->At(aIndex).iIapPref->AddIAPL(localIAP,0); + if (iBuffer->At(aIndex).iSmtpSettings!= NULL) + { + if ( iBuffer->At(aIndex).iSmtpIapPref->NumberOfIAPs() ) + { + iBuffer->At(aIndex).iSmtpIapPref->RemoveIAPL(0); + } + iBuffer->At(aIndex).iSmtpIapPref->AddIAPL(localIAP,0); + } + } + else + { + iBuffer->At(aIndex).iNodeBuf->At(aCommand).iStatus = CSmlDmAdapter::ENotFound; + } + + CleanupStack::PopAndDestroy(); // iapmatch + } + + else if(aLastUriSeg.Compare(KNSmlDMEmailSToNapID)==0) + { + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + + TInt iap = iapmatch->IAPIdFromURIL( aObject ); + + if ( iap != KErrNotFound ) + { + TImIAPChoice localIAP; + localIAP.iIAP = iap; + DBG_ARGS(_S("SMTP IAP = %d"), localIAP.iIAP); + localIAP.iDialogPref = ECommDbDialogPrefDoNotPrompt; + if ( iBuffer->At(aIndex).iSmtpSettings!= NULL ) + { + if ( iBuffer->At(aIndex).iSmtpIapPref->NumberOfIAPs() ) + { + iBuffer->At(aIndex).iSmtpIapPref->RemoveIAPL(0); + } + iBuffer->At(aIndex).iSmtpIapPref->AddIAPL(localIAP,0); + } + else + { + iBuffer->At(aIndex).iNodeBuf->At(aCommand).iStatus = + CSmlDmAdapter::ENotFound; + } + } + else + { + iBuffer->At(aIndex).iNodeBuf->At(aCommand).iStatus = + CSmlDmAdapter::ENotFound; + } + + CleanupStack::PopAndDestroy(); // iapmatch + } + _DBG_FILE("CNSmlDmEmailAdapter::DoAddLeafObjectL() :: end"); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// void CNSmlDmEmailAdapter::SetDefaultSettingsL(TInt aIndex) +// Set defaults for used protocol +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::SetDefaultSettingsL(TInt aIndex) + { + _DBG_FILE("CNSmlDmEmailAdapter::SetDefaultSettingsL() :: begin"); + TNSmlEmailSettingsElement& thisElem = iBuffer->At(aIndex); + CEmailAccounts* emailAccs = CEmailAccounts::NewLC(); + if( thisElem.iPop3Settings ) + { + + emailAccs->PopulateDefaultPopSettingsL(*thisElem.iPop3Settings, + *thisElem.iIapPref + ); + emailAccs->PopulateDefaultSmtpSettingsL(*thisElem.iSmtpSettings, + *thisElem.iSmtpIapPref + ); + + thisElem.iPop3Settings->SetDeleteEmailsWhenDisconnecting( EFalse ); + thisElem.iPop3Settings->SetInboxSynchronisationLimit( KNSmlDMEmailDefaultHeaderCount ); + thisElem.iPop3Settings->SetSecureSockets( EFalse ); + thisElem.iPop3Settings->SetAutoSendOnConnect( ETrue ); + thisElem.iPop3Settings->SetDisconnectedUserMode( ETrue ); + thisElem.iPop3Settings->SetAcknowledgeReceipts( EFalse ); + } + else if( thisElem.iImap4Settings ) + { + + emailAccs->PopulateDefaultImapSettingsL(*thisElem.iImap4Settings, + *thisElem.iIapPref + ); + + emailAccs->PopulateDefaultSmtpSettingsL(*thisElem.iSmtpSettings, + *thisElem.iSmtpIapPref + ); + + thisElem.iImap4Settings->SetDeleteEmailsWhenDisconnecting( EFalse ); + thisElem.iImap4Settings->SetInboxSynchronisationLimit( KNSmlDMEmailDefaultHeaderCount ); + thisElem.iImap4Settings->SetMailboxSynchronisationLimit( KNSmlDMEmailDefaultHeaderCount ); + thisElem.iImap4Settings->SetSecureSockets( EFalse ); + thisElem.iImap4Settings->SetAutoSendOnConnect( ETrue ); + thisElem.iImap4Settings->SetDisconnectedUserMode( ETrue ); + thisElem.iImap4Settings->SetImapIdle( ETrue ); + thisElem.iImap4Settings->SetUpdatingSeenFlags( ETrue ); + } + thisElem.iSmtpSettings->SetLoginNameL(KNullDesC8); + thisElem.iSmtpSettings->SetPasswordL(KNullDesC8); + // Set IAP id to 0 and ask from user if ToNapID/SToNapID not sent + TImIAPChoice tmpIap; + tmpIap.iIAP = KNSmlDmEmailAlwaysAskIap; + tmpIap.iDialogPref = ECommDbDialogPrefPrompt; + thisElem.iIapPref->AddIAPL( tmpIap, 0 ); + thisElem.iSmtpIapPref->AddIAPL( tmpIap, 0 ); + CleanupStack::PopAndDestroy(); //emailAccs + _DBG_FILE("CNSmlDmEmailAdapter::SetDefaultSettingsL() :: end"); + } + +// ----------------------------------------------------------------------------- +// HBufC* CNSmlDmEmailAdapter::IntToDesLC(const TInt aLuid) const +// Converts integer to 16bit descriptor +// ----------------------------------------------------------------------------- +HBufC* CNSmlDmEmailAdapter::IntToDesLC(const TInt aLuid) const + { + HBufC* buf = HBufC::NewLC(10); //10 = max length of 32bit integer + TPtr ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + return buf; + } + +// ----------------------------------------------------------------------------- +// HBufC8* CNSmlDmEmailAdapter::IntToDes8LC(const TInt aLuid) const +// Converts integer to 8bit descriptor +// ----------------------------------------------------------------------------- +HBufC8* CNSmlDmEmailAdapter::IntToDes8LC(const TInt aLuid) const + { + HBufC8* buf = HBufC8::NewLC(10); //10 = max length of 32bit integer + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + return buf; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::ConvertTo8LC() +// Converts string value to 8-bit +// +// ----------------------------------------------------------------------------- +HBufC8* CNSmlDmEmailAdapter::ConvertTo8LC( const TDesC& aSource ) const + { + HBufC8* buf = HBufC8::NewLC( aSource.Length()*2); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); + + return buf; + } + +// ----------------------------------------------------------------------------- +// TInt CNSmlDmEmailAdapter::ValidateAndStoreSettingsL(TInt aIndex +// Transfers the email settings from memory to phones permanent data store +// ----------------------------------------------------------------------------- +TInt CNSmlDmEmailAdapter::ValidateAndStoreSettingsL(TInt aIndex) + { + _DBG_FILE("CNSmlDmEmailAdapter::ValidateAndStoreSettingsL() : begin"); + TInt luid = 0; + + TNSmlEmailSettingsElement& thisElem = iBuffer->At(aIndex); + + if( iBuffer->At( aIndex ).iJustFetch ) + { + _DBG_FILE("CNSmlDmEmailAdapter::ValidateAndStoreSettingsL() : end"); + return luid; + } + CEmailAccounts* emailAccs = CEmailAccounts::NewLC(); + if( iBuffer->At( aIndex ).iLuid != 0 ) + { + switch ( thisElem.iAccType ) + { + case EPop: + { + TPopAccount accId; + emailAccs->GetPopAccountL( thisElem.iServiceId, accId ); + //Copy name field + accId.iPopAccountName.Copy(thisElem.iName->Des()); + emailAccs->SavePopSettingsL( accId, *thisElem.iPop3Settings ); + emailAccs->SavePopIapSettingsL( accId, *thisElem.iIapPref ); + TSmtpAccount smtpAcc; + emailAccs->GetSmtpAccountL( accId.iSmtpService, smtpAcc ); + //Copy name field + smtpAcc.iSmtpAccountName.Copy(thisElem.iName->Des()); + emailAccs->SaveSmtpSettingsL( smtpAcc, *thisElem.iSmtpSettings ); + emailAccs->SaveSmtpIapSettingsL( smtpAcc, *thisElem.iSmtpIapPref ); + break; + } + case EImap: + { + TImapAccount accId2; + emailAccs->GetImapAccountL( thisElem.iServiceId, accId2 ); + //Copy name field + accId2.iImapAccountName.Copy(thisElem.iName->Des()); + emailAccs->SaveImapSettingsL( accId2, *thisElem.iImap4Settings ); + emailAccs->SaveImapIapSettingsL( accId2, *thisElem.iIapPref ); + TSmtpAccount smtpAccForImap; + emailAccs->GetSmtpAccountL( accId2.iSmtpService, smtpAccForImap ); + //Copy name field + smtpAccForImap.iSmtpAccountName.Copy(thisElem.iName->Des()); + emailAccs->SaveSmtpSettingsL( smtpAccForImap, *thisElem.iSmtpSettings ); + emailAccs->SaveSmtpIapSettingsL( smtpAccForImap, *thisElem.iSmtpIapPref ); + break; + } + default: + + break; + } + } + else // if(iBuffer->At(aIndex).iLuid != 0) + { + RTelServer telServer; + User::LeaveIfError( telServer.Connect() ); + CleanupClosePushL(telServer); + + TInt numPhones = 0; + User::LeaveIfError( telServer.EnumeratePhones( numPhones ) ); + if ( numPhones < 1 ) + { + User::Leave( KErrNotFound ); + } + + RTelServer::TPhoneInfo info; + User::LeaveIfError( telServer.GetPhoneInfo( 0, info ) ); + RMobilePhone mobilePhone; + User::LeaveIfError( mobilePhone.Open( telServer, info.iName ) ); + CleanupClosePushL( mobilePhone ); + TRequestStatus status; + RMobilePhone::TMobilePhoneIdentityV1 mobilePhoneIdentity; + mobilePhone.GetPhoneId( status, mobilePhoneIdentity ); + User::WaitForRequest( status ); + User::LeaveIfError( status.Int() ); + TBuf<50> imei; + imei.Copy( mobilePhoneIdentity.iSerialNumber ); + + CleanupStack::PopAndDestroy(&mobilePhone); + CleanupStack::PopAndDestroy(&telServer); + if ( thisElem.iPop3Settings ) + { + TPopAccount accId; + accId = emailAccs->CreatePopAccountL( *thisElem.iName, + *thisElem.iPop3Settings, + *thisElem.iIapPref, + EFalse ); + + TSmtpAccount smtpAcc = emailAccs->CreateSmtpAccountL( accId, + *thisElem.iSmtpSettings, + *thisElem.iSmtpIapPref, + EFalse ); + TMsvEntry smtpEntry; + TMsvEntry popEntry; + CMsvEntry* entry = iMsvSession->GetEntryL(smtpAcc.iSmtpService); + CleanupStack::PushL(entry); + smtpEntry = entry->Entry(); + smtpEntry.iMtmData2 = smtpAcc.iSmtpAccountId; + smtpEntry.iDescription.Set( imei ); + entry->ChangeL(smtpEntry); + CleanupStack::PopAndDestroy(entry); + + entry = iMsvSession->GetEntryL(smtpAcc.iRelatedService); + CleanupStack::PushL(entry); + popEntry = entry->Entry(); + popEntry.iMtmData2 = accId.iPopAccountId; + popEntry.iDescription.Set( imei ); + entry->ChangeL(popEntry); + CleanupStack::PopAndDestroy(entry); + + if ( accId.iSmtpService != smtpAcc.iSmtpService || smtpAcc.iRelatedService != accId.iPopService ) + { + DBG_ARGS8(_S8("ERROR!!! PopAccount creation: iSmtpService=%d, smtpAcc.iSmtpService=%d, iRelatedService=%d, iPopService=%d"), + accId.iSmtpService, smtpAcc.iSmtpService, smtpAcc.iRelatedService, accId.iPopService ); + } + + thisElem.iAccType = EPop; + thisElem.iAccId = accId.iPopAccountId; + SetLuidById( thisElem.iAccType, thisElem.iAccId, thisElem.iLuid ); + + RArray popAccs; + CleanupClosePushL( popAccs ); + emailAccs->GetPopAccountsL( popAccs ); + + RArray imapAccs; + CleanupClosePushL( imapAccs ); + emailAccs->GetImapAccountsL( imapAccs ); + + if ( popAccs.Count() == 1 && !imapAccs.Count()) + { + emailAccs->SetDefaultSmtpAccountL( smtpAcc ); + } + + CleanupStack::PopAndDestroy( &imapAccs ); + CleanupStack::PopAndDestroy( &popAccs ); + // Check and set the default account + TSmtpAccount defSmtp; + TInt retVal = emailAccs->DefaultSmtpAccountL( defSmtp ); + if ( retVal != KErrNone ) + { + RArray popAccounts; + CleanupClosePushL( popAccounts ); + emailAccs->GetPopAccountsL( popAccounts ); + if ( popAccounts.Count() > 0 ) + { + TSmtpAccount relatedSmtp; + emailAccs->GetSmtpAccountL( popAccounts[0].iSmtpService, relatedSmtp ); + emailAccs->SetDefaultSmtpAccountL( relatedSmtp ); + } + CleanupStack::PopAndDestroy( &popAccounts ); + } + } + else if ( thisElem.iImap4Settings ) + { + TImapAccount accId2; + accId2 = emailAccs->CreateImapAccountL(*thisElem.iName, + *thisElem.iImap4Settings, + *thisElem.iIapPref, + EFalse); + + TSmtpAccount smtpAcc = emailAccs->CreateSmtpAccountL( accId2, + *thisElem.iSmtpSettings, + *thisElem.iSmtpIapPref, + EFalse ); + + TMsvEntry smtpEntry; + TMsvEntry imapEntry; + CMsvEntry* entry = iMsvSession->GetEntryL(smtpAcc.iSmtpService); + CleanupStack::PushL(entry); + smtpEntry = entry->Entry(); + smtpEntry.iMtmData2 = smtpAcc.iSmtpAccountId; + smtpEntry.iDescription.Set( imei ); + entry->ChangeL(smtpEntry); + CleanupStack::PopAndDestroy(entry); + + entry = iMsvSession->GetEntryL(smtpAcc.iRelatedService); + CleanupStack::PushL(entry); + imapEntry = entry->Entry(); + imapEntry.iMtmData2 = accId2.iImapAccountId; + imapEntry.iDescription.Set( imei ); + entry->ChangeL(imapEntry); + CleanupStack::PopAndDestroy(entry); + + if ( accId2.iSmtpService != smtpAcc.iSmtpService || smtpAcc.iRelatedService != accId2.iImapService ) + { + DBG_ARGS8(_S8("ERROR!!! ImapAccount creation: iSmtpService=%d, smtpAcc.iSmtpService=%d, iRelatedService=%d, iImapService=%d"), + accId2.iSmtpService, smtpAcc.iSmtpService, smtpAcc.iRelatedService, accId2.iImapService ); + } + + + thisElem.iAccType = EImap; + thisElem.iAccId = accId2.iImapAccountId; + SetLuidById( thisElem.iAccType, thisElem.iAccId, thisElem.iLuid ); + + // Check and set the default account + RArray popAccs; + CleanupClosePushL( popAccs ); + emailAccs->GetPopAccountsL( popAccs ); + + RArray imapAccs; + CleanupClosePushL( imapAccs ); + emailAccs->GetImapAccountsL( imapAccs ); + + if ( imapAccs.Count() == 1 && !popAccs.Count()) + { + emailAccs->SetDefaultSmtpAccountL( smtpAcc ); + } + + CleanupStack::PopAndDestroy( &imapAccs ); + CleanupStack::PopAndDestroy( &popAccs ); + TSmtpAccount defaultSmtp; + TInt retVal = emailAccs->DefaultSmtpAccountL( defaultSmtp ); + if ( retVal != KErrNone ) + { + RArray imapAccs; + CleanupClosePushL( imapAccs ); + emailAccs->GetImapAccountsL( imapAccs ); + if ( imapAccs.Count() > 0 ) + { + TSmtpAccount relatedSmtp; + emailAccs->GetSmtpAccountL( imapAccs[0].iSmtpService, relatedSmtp ); + emailAccs->SetDefaultSmtpAccountL( relatedSmtp ); + } + CleanupStack::PopAndDestroy( &imapAccs ); + } + } + + } + luid = thisElem.iLuid; + CleanupStack::PopAndDestroy(); //emailAccs + _DBG_FILE("CNSmlDmEmailAdapter::ValidateAndStoreSettingsL() : end"); + return luid; + } +// ----------------------------------------------------------------------------- +// void CNSmlDmEmailAdapter::GetIdByLuid( TNSmlEmailAccountType& aAccType, +// TInt& aAccId, +// const TInt aLuid ) const +// Calculates the account type and id on basis of luid +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::GetIdByLuid( TNSmlEmailAccountType& aAccType, + TInt& aAccId, + const TInt aLuid ) const + { + if ( ( aLuid > KNSmlDmEmailImapLuidLow ) && + ( aLuid < KNSmlDmEmailImapLuidHigh ) ) + { + aAccType = EImap; + aAccId = aLuid - KNSmlDmEmailImapLuidLow; + } + else if (( aLuid > KNSmlDmEmailImapLuidHigh ) && + ( aLuid < KNSmlDmEmailPopLuidHigh )) + { + aAccType = EPop; + aAccId = aLuid - KNSmlDmEmailImapLuidHigh; + } + else + { + aAccType = EUnknown; + } + + } + + +// ----------------------------------------------------------------------------- +// void CNSmlDmEmailAdapter::SetLuidById( const TNSmlEmailAccountType& aAccType, +// const TInt& aAccId, TInt& aLuid ) const +// Sets the luid on basis of account type and id +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::SetLuidById( const TNSmlEmailAccountType& aAccType, + const TInt& aAccId, TInt& aLuid ) const + { + switch (aAccType) + { + case EImap : + aLuid = KNSmlDmEmailImapLuidLow + aAccId; + break; + + case EPop : + aLuid = KNSmlDmEmailImapLuidHigh + aAccId; + break; + + default : + aLuid = -1; + break; + } + } + +// ----------------------------------------------------------------------------- +// TBool CNSmlDmEmailAdapter::AccountExistsL( const CEmailAccounts* aAccs, +// const TNSmlEmailAccountType aAccType, +// const TInt aId, +// TInt aIndex ) +// Checks if the accout matching the given parameters is found. +// returns True if found. +// ----------------------------------------------------------------------------- +TBool CNSmlDmEmailAdapter::AccountExistsL( CEmailAccounts* aAccs, + const TNSmlEmailAccountType aAccType, + const TInt aId, + TInt aIndex ) + { + RArray imap4Accs; + CleanupClosePushL( imap4Accs ); + RArray pop3Accs; + CleanupClosePushL( pop3Accs ); + switch ( aAccType ) + { + case EImap: + aAccs->GetImapAccountsL(imap4Accs); + for(TInt i=0;i= 0 ) + { + iBuffer->At(aIndex).iServiceId = imap4Accs[i].iImapService; + delete iBuffer->At(aIndex).iName; + iBuffer->At(aIndex).iName = NULL; + iBuffer->At(aIndex).iName = HBufC::NewL(imap4Accs[i].iImapAccountName.Size()); + *iBuffer->At(aIndex).iName = imap4Accs[i].iImapAccountName; + } + CleanupStack::PopAndDestroy(2); //imap4Accs, pop3Accs + return ETrue; + } + } + break; + + case EPop: + aAccs->GetPopAccountsL(pop3Accs); + for(TInt i=0;i= 0 ) + { + iBuffer->At(aIndex).iServiceId = pop3Accs[i].iPopService; + delete iBuffer->At(aIndex).iName; + iBuffer->At(aIndex).iName = NULL; + iBuffer->At(aIndex).iName = HBufC::NewL(pop3Accs[i].iPopAccountName.Size()); + *iBuffer->At(aIndex).iName = pop3Accs[i].iPopAccountName; + } + CleanupStack::PopAndDestroy(2); //imap4Accs, pop3Accs + return ETrue; + } + } + break; + default: + // Returns EFalse in this case. + break; + } + CleanupStack::PopAndDestroy(2); //imap4Accs, pop3Accs + return EFalse; + } + +// ----------------------------------------------------------------------------- +// TInt CNSmlDmEmailAdapter::DoRestoreSettingsL(TInt aIndex) +// Restores the settings to the adapter from settings store +// ----------------------------------------------------------------------------- +TInt CNSmlDmEmailAdapter::DoRestoreSettingsL(TInt aIndex) + { + _DBG_FILE("CNSmlDmEmailAdapter::DoRestoreSettingsL() : begin"); + TNSmlEmailSettingsElement& thisElem = iBuffer->At(aIndex); + + CEmailAccounts* emailAccs = CEmailAccounts::NewLC(); + TInt err = KErrNone; + + // These are destroyed latest at destructor + thisElem.iSmtpSettings = new (ELeave) CImSmtpSettings; + thisElem.iIapPref = CImIAPPreferences::NewLC(); + thisElem.iSmtpIapPref = CImIAPPreferences::NewLC(); + + switch( thisElem.iAccType ) + { + case EImap: + if (AccountExistsL(emailAccs, thisElem.iAccType, thisElem.iAccId, aIndex )) + { + TImapAccount imapAccId; + + thisElem.iImap4Settings = new(ELeave) CImImap4Settings; + + //Get IMAP account by iAccId id + emailAccs->GetImapAccountL(thisElem.iServiceId, imapAccId); + //Get IMAP settings by account id + emailAccs->LoadImapSettingsL( imapAccId, *thisElem.iImap4Settings ); + //Get IMAP settings IAP prefs + emailAccs->LoadImapIapSettingsL( imapAccId, *thisElem.iIapPref ); + + TSmtpAccount smtpAccount; + //Get smtp account by related IMAP id + emailAccs->GetSmtpAccountL( imapAccId.iSmtpService, smtpAccount ); + //Get smtp settings by IMAP id + emailAccs->LoadSmtpSettingsL( smtpAccount, *thisElem.iSmtpSettings ); + //Get Smtp settings IAP prefs + emailAccs->LoadSmtpIapSettingsL( smtpAccount, *thisElem.iSmtpIapPref ); + } + else + { + err = KErrNotFound; + } + break; + + case EPop: + if (AccountExistsL(emailAccs, thisElem.iAccType, thisElem.iAccId, aIndex )) + { + TPopAccount popAccId; + + thisElem.iPop3Settings = new(ELeave) CImPop3Settings; + + //Get POP3 account by iAccId id + emailAccs->GetPopAccountL( thisElem.iServiceId, popAccId ); + //Get POP3 settings by account id + emailAccs->LoadPopSettingsL( popAccId, *thisElem.iPop3Settings ); + //Get POP3 setting IAP prefs + emailAccs->LoadPopIapSettingsL( popAccId, *thisElem.iIapPref ); + + TSmtpAccount smtpAccount; + //Get smtp account by related POP id + emailAccs->GetSmtpAccountL( popAccId.iSmtpService, smtpAccount ); + //Get smtp settings + emailAccs->LoadSmtpSettingsL( smtpAccount, *thisElem.iSmtpSettings ); + //Get Smtp setting IAP prefs + emailAccs->LoadSmtpIapSettingsL( smtpAccount, *thisElem.iSmtpIapPref ); + } + else + { + err = KErrNotFound; + } + break; + + default: + err = KErrNotFound; + break; + } + + if ( err ) + { + _DBG_FILE("CNSmlDmEmailAdapter::DoRestoreSettingsL() : \ + KErrNotFound end"); + CleanupStack::PopAndDestroy(2); // iIapPref, iSmtpIapPref + CleanupStack::PopAndDestroy(emailAccs); //emailAccs + return KErrNotFound; + } + + CleanupStack::Pop(2); // iIapPref, iSmtpIapPref + CleanupStack::PopAndDestroy(emailAccs); //emailAccs + _DBG_FILE("CNSmlDmEmailAdapter::DoRestoreSettingsL() : end"); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::OpenSessionL() +// Opens the CMsvSession if it is not open already +// ----------------------------------------------------------------------------- +TInt CNSmlDmEmailAdapter::OpenSessionL() + { + _DBG_FILE("CNSmlDmEmailAdapter::OpenSessionL() : begin"); + if(!iMsvSession) + { + TRAPD(err, iMsvSession = CMsvSession::OpenSyncL(*this)); + _DBG_FILE("CNSmlDmEmailAdapter::OpenSessionL() : end"); + return err; + } + + _DBG_FILE("CNSmlDmEmailAdapter::OpenSessionL() : end"); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmEmailAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + const TSmlDmAccessTypes& aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription) const + { + aNode.SetAccessTypesL(aAccTypes); + aNode.SetOccurenceL(aOccurrence); + aNode.SetScopeL(aScope); + aNode.SetDFFormatL(aFormat); + if(aFormat!=MSmlDmDDFObject::ENode) + { + aNode.AddDFTypeMimeTypeL(KNSmlDMEmailTextPlain); + } + aNode.SetDescriptionL(aDescription); + + } + +// ----------------------------------------------------------------------------- +// TPtrC8 CNSmlDmEmailAdapter::RemoveDotSlash(const TDesC8& aURI) +// return uri without dot and slash in start +// ----------------------------------------------------------------------------- +TPtrC8 CNSmlDmEmailAdapter::RemoveDotSlash(const TDesC8& aURI) const + { + if(aURI.Find(KNSmlEmailUriDotSlash)==0) + { + return aURI.Right(aURI.Length()-KNSmlEmailUriDotSlash().Length()); + } + else + { + return aURI; + } + } +// ----------------------------------------------------------------------------- +// CSmlDmAdapter::TError CNSmlDmEmailAdapter::FetchObjectL(const TDesC8& aURI, +// const TDesC8& aLUID, CBufBase& aObject) +// Fetches object acording to URI & LUID. Retur codes acording to +// CSmlDmAdapter::TError. +// ----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlDmEmailAdapter::FetchObjectL(const TDesC8& aURI, + const TDesC8& aLUID, + CBufBase& aObject) + { + _DBG_FILE("CNSmlDmEmailAdapter::FetchObjectL() : begin"); + CSmlDmAdapter::TError status = EOk; + if(aLUID.Length()==0) + { + _DBG_FILE("CNSmlDmEmailAdapter::FetchObjectL() : ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + if( OpenSessionL() != KErrNone ) + { + _DBG_FILE("CNSmlDmEmailAdapter::FetchObjectL() : EError end"); + return CSmlDmAdapter::EError; + } + TInt luid = DesToInt(aLUID); + TInt index = -1; + for(TInt i=0;iCount();i++) + { + if(iBuffer->At(i).iLuid == luid) + { + index = i; + break; + } + } + + if(index<0) + { + TNSmlEmailSettingsElement newNode; + newNode.iImap4Settings = NULL; + newNode.iPop3Settings = NULL; + newNode.iSmtpSettings = NULL; + newNode.iIapPref = NULL; + newNode.iLuid = luid; + newNode.iMappingName = aURI.AllocLC(); + newNode.iName = HBufC::NewLC(0); + newNode.iNodeBuf = new (ELeave) + CArrayFixFlat (KNSmlDmEmailGranularity); + newNode.iExecuted = ETrue; + newNode.iJustFetch = ETrue; + GetIdByLuid(newNode.iAccType, newNode.iAccId, luid); + iBuffer->AppendL(newNode); + index = iBuffer->Count() - 1; + if(DoRestoreSettingsL(index)!=KErrNone) + { + CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName + _DBG_FILE("CNSmlDmEmailAdapter::FetchObjectL() : EError end"); + return CSmlDmAdapter::EError; + } + CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName + } + + TPtrC8 lastUriSeg = LastURISeg(aURI); + + if(lastUriSeg.Compare(KNSmlDMEmailName)==0) + { + HBufC8 *data = HBufC8::NewLC(iBuffer->At(index).iName->Length()); + TPtr8 dataPtr = data->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr, iBuffer->At(index).iName->Des() ); + aObject.InsertL(0,dataPtr); + CleanupStack::PopAndDestroy(); //data + } + else if(lastUriSeg.Compare(KNSmlDMEmailUID)==0) + { + HBufC *data = NULL; + if(iBuffer->At(index).iPop3Settings!= NULL) + { + data = HBufC::NewLC(iBuffer->At(index).iPop3Settings->LoginName().Length()); + data->Des().Copy(iBuffer->At(index).iPop3Settings->LoginName()); + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + data = HBufC::NewLC(iBuffer->At(index).iImap4Settings->LoginName().Length()); + data->Des().Copy(iBuffer->At(index).iImap4Settings->LoginName()); + } + if(data) + { + HBufC8 *data8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(*data); + CleanupStack::PushL(data8); + aObject.InsertL(0,*data8); + CleanupStack::PopAndDestroy(2);//data, data8 + } + } + else if(lastUriSeg.Compare(KNSmlDMEmailPW)==0) + { + HBufC *data = NULL; + if(iBuffer->At(index).iPop3Settings!= NULL) + { + data = HBufC::NewLC(iBuffer->At(index).iPop3Settings->Password().Length()); + data->Des().Copy(iBuffer->At(index).iPop3Settings->Password()); + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + data = HBufC::NewLC(iBuffer->At(index).iImap4Settings->Password().Length()); + data->Des().Copy(iBuffer->At(index).iImap4Settings->Password()); + } + if(data) + { + HBufC8 *data8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(*data); + CleanupStack::PushL(data8); + aObject.InsertL(0,*data8); + CleanupStack::PopAndDestroy(2);//data, data8 + } + } + else if(lastUriSeg.Compare(KNSmlDMEmailUAddr)==0) + { + HBufC *data = NULL; + data = iBuffer->At(index).iSmtpSettings->EmailAddress().AllocLC(); + HBufC8 *data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL(0,dataPtr8); + CleanupStack::PopAndDestroy(2); //data, data8 + } + else if(lastUriSeg.Compare(KNSmlDMEmailUName)==0) + { + + HBufC *data = NULL; + data = iBuffer->At(index).iSmtpSettings->EmailAlias().AllocLC(); + HBufC8 *data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL(0,dataPtr8); + CleanupStack::PopAndDestroy(2); //data, data8 + } + + else if(lastUriSeg.Compare( KNSmlDMEmailMrcv)==0) + { + HBufC *data = NULL; + if(iBuffer->At(index).iPop3Settings!= NULL) + { + data = iBuffer->At(index).iPop3Settings->ServerAddress().AllocLC(); + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + data = iBuffer->At(index).iImap4Settings->ServerAddress().AllocLC(); + } + else + { + status = CSmlDmAdapter::ENotFound; + return status; + } + HBufC8 *data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL(0,dataPtr8); + CleanupStack::PopAndDestroy(2); //data, data8 + } + else if(lastUriSeg.Compare(KNSmlDMEmailMsnd)==0) + { + HBufC *data = NULL; + data = iBuffer->At(index).iSmtpSettings->ServerAddress().AllocLC(); + HBufC8 *data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( dataPtr8, data->Des() ); + + aObject.InsertL(0,dataPtr8); + CleanupStack::PopAndDestroy(2); //data, data8 + } + else if(lastUriSeg.Compare(KNSmlDMEmailMpro)==0) + { + if(iBuffer->At(index).iPop3Settings!= NULL) + { + aObject.InsertL(0,KNSmlDMEmailMproPOP); + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + aObject.InsertL(0,KNSmlDMEmailMproIMAP); + } + } + else if(lastUriSeg.Compare(KNSmlDMEmailUseSecCon)==0) + { + FetchSecurityValueL(aObject, &iBuffer->At(index), EUseSecCon ); + } + + else if(lastUriSeg.Compare(KNSmlDMEmailUseSauth)==0) + { + if(iBuffer->At(index).iSmtpSettings->SMTPAuth()) + { + aObject.InsertL(0,KNSmlDMEmailTrue); + } + else + { + aObject.InsertL(0,KNSmlDMEmailFalse); + } + } + else if(lastUriSeg.Compare(KNSmlDMEmailSauthUID)==0) + { + HBufC *data = HBufC::NewLC(iBuffer->At(index).iSmtpSettings->LoginName().Length()); + data->Des().Copy(iBuffer->At(index).iSmtpSettings->LoginName()); + HBufC8 *data8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(*data); + CleanupStack::PushL(data8); + aObject.InsertL(0,*data8); + CleanupStack::PopAndDestroy(2);//data, data8 + } + else if(lastUriSeg.Compare(KNSmlDMEmailSauthPW)==0) + { + HBufC *data = HBufC::NewLC(iBuffer->At(index).iSmtpSettings->Password().Length()); + data->Des().Copy(iBuffer->At(index).iSmtpSettings->Password()); + HBufC8 *data8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(*data); + CleanupStack::PushL(data8); + aObject.InsertL(0,*data8); + CleanupStack::PopAndDestroy(2);//data, data8 + } + else if(lastUriSeg.Compare(KNSmlDMEmailPtxtSAuth)==0) + { + if(iBuffer->At(index).iSmtpSettings->InboxLoginDetails()) + { + aObject.InsertL(0,KNSmlDMEmailTrue); + } + else + { + aObject.InsertL(0,KNSmlDMEmailFalse); + } + } + + else if (lastUriSeg.Compare(KNSmlDMEmailSUseSecCon)==0) + { + FetchSecurityValueL(aObject, &iBuffer->At(index), ESuseSecCon ); + } + + else if (lastUriSeg.Compare(KNSmlDMEmailUseStartTLS)==0) + { + FetchSecurityValueL(aObject, &iBuffer->At(index), EUseStartTls ); + } + + else if (lastUriSeg.Compare(KNSmlDMEmailSUseStartTLS)==0) + { + FetchSecurityValueL(aObject, &iBuffer->At(index), ESuseStartTls ); + } + + else if(lastUriSeg.Compare(KNSmlDMEmailMrcvPort)==0) + { + TUint port; + if(iBuffer->At(index).iPop3Settings!= NULL) + { + port = iBuffer->At(index).iPop3Settings->Port(); + } + else + { + port = iBuffer->At(index).iImap4Settings->Port(); + } + HBufC8 *data = IntToDes8LC(port); + aObject.InsertL(0,data->Des()); + CleanupStack::PopAndDestroy(); //data + } + + else if(lastUriSeg.Compare(KNSmlDMEmailMsndPort)==0) + { + TUint port = iBuffer->At(index).iSmtpSettings->Port(); + HBufC8 *data = IntToDes8LC(port); + aObject.InsertL(0,data->Des()); + CleanupStack::PopAndDestroy(); //data + } + + else if(lastUriSeg.Compare(KNSmlDMEmailUseAPOP)==0) + { + if(iBuffer->At(index).iPop3Settings!= NULL) + { + if(iBuffer->At(index).iPop3Settings->Apop()) + { + aObject.InsertL(0,KNSmlDMEmailTrue); + } + else + { + aObject.InsertL(0,KNSmlDMEmailFalse); + } + } + else if(iBuffer->At(index).iImap4Settings!= NULL) + { + status = CSmlDmAdapter::ENotFound; + } + } + + else if (lastUriSeg.Compare(KNSmlDMEmailFolderPath)==0) + { + if( iBuffer->At(index).iImap4Settings ) + { + aObject.InsertL(0, iBuffer->At(index).iImap4Settings->FolderPath() ); + } + else + { + status = CSmlDmAdapter::ENotFound; + } + } + + else if(lastUriSeg.Compare(KNSmlDMEmailToNapID)==0) + { + CNSmlDMIAPMatcher* iapmatch=CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + HBufC8* uri8 = NULL; + TInt iapCount = iBuffer->At(index).iIapPref->NumberOfIAPs(); + if ( iapCount ) + { + TImIAPChoice localIAP = iBuffer->At(index).iIapPref->IAPPreference(0); + uri8 = iapmatch->URIFromIAPIdL( localIAP.iIAP ); + } + + if( uri8 ) + { + CleanupStack::PushL(uri8); + aObject.InsertL(0,uri8->Des()); + status = CSmlDmAdapter::EOk; + CleanupStack::PopAndDestroy(); // uri8 + } + + CleanupStack::PopAndDestroy(); // iapMatch + } + else if(lastUriSeg.Compare(KNSmlDMEmailSToNapID)==0) + { + // SToNapID exists only for SMTP + if (iBuffer->At(index).iSmtpSettings!= NULL) + { + CNSmlDMIAPMatcher* iapmatch=CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + HBufC8* uri8 = NULL; + TInt iapCount = iBuffer->At(index).iIapPref->NumberOfIAPs(); + if ( iapCount ) + { + TImIAPChoice localIAP = iBuffer->At(index).iSmtpIapPref->IAPPreference(0); + uri8 = iapmatch->URIFromIAPIdL( localIAP.iIAP ); + } + + if( uri8 ) + { + CleanupStack::PushL(uri8); + aObject.InsertL(0,uri8->Des()); + status = CSmlDmAdapter::EOk; + CleanupStack::PopAndDestroy(); // uri8 + } + + CleanupStack::PopAndDestroy(); // iapMatch + } + else + { + status = CSmlDmAdapter::ENotFound; + } + } + _DBG_FILE("CNSmlDmEmailAdapter::FetchObjectL() : end"); + return status; + } + +// ----------------------------------------------------------------------------- +// void CNSmlDmEmailAdapter::SetDefaultSecurityL(const TDesC8& aObject, +// const TNSmlEmailSettingsElement* thisElem, +// const TNSmlEmailSecuritySetting aSetting ) +// Sets (on/off) the security modes: SSL/TLS, StartTLS +// ----------------------------------------------------------------------------- +void CNSmlDmEmailAdapter::SetDefaultSecurityL(const TDesC8& aObject, + const TNSmlEmailSettingsElement* aThisElem, + const TNSmlEmailSecuritySetting aSetting + ) const + { + _DBG_FILE("CNSmlDmEmailAdapter::SetDefaultSecurityL(): begin"); + HBufC8 *data = aObject.AllocLC(); + TPtr8 dataPtr = data->Des(); + dataPtr.Capitalize(); + TBool object=EFalse; + if(dataPtr.Find(KNSmlDMEmailTrue)>=0) + { + object = ETrue; + } + switch ( aSetting ) + { + case EUseSecCon : + if ( object ) + { + if ( aThisElem->iImap4Settings ) + { + aThisElem->iImap4Settings->SetSecureSockets(EFalse); + aThisElem->iImap4Settings->SetSSLWrapper(ETrue); + aThisElem->iImap4Settings->SetPort( KNSmlDMEmailSslWrappedImap4Port ); + } + else if ( aThisElem->iPop3Settings ) + { + aThisElem->iPop3Settings->SetSecureSockets(EFalse); + aThisElem->iPop3Settings->SetSSLWrapper(ETrue); + aThisElem->iPop3Settings->SetPort( KNSmlDMEmailSslWrappedPop3Port ); + } + } + else + { + if ( aThisElem->iImap4Settings ) + { + aThisElem->iImap4Settings->SetPort( KNSmlDMEmailNormalImap4Port ); + aThisElem->iImap4Settings->SetSSLWrapper(EFalse); + } + else if ( aThisElem->iPop3Settings ) + { + aThisElem->iPop3Settings->SetPort( KNSmlDMEmailNormalPop3Port ); + aThisElem->iPop3Settings->SetSSLWrapper(EFalse); + } + } + break; + case EUseStartTls : + if ( object ) + { + if ( aThisElem->iImap4Settings ) + { + aThisElem->iImap4Settings->SetSecureSockets(ETrue); + aThisElem->iImap4Settings->SetSSLWrapper(EFalse); + aThisElem->iImap4Settings->SetPort( KNSmlDMEmailNormalImap4Port ); + } + else if ( aThisElem->iPop3Settings ) + { + aThisElem->iPop3Settings->SetSecureSockets(ETrue); + aThisElem->iPop3Settings->SetSSLWrapper(EFalse); + aThisElem->iPop3Settings->SetPort( KNSmlDMEmailNormalPop3Port ); + } + } + else + { + if ( aThisElem->iImap4Settings ) + { + aThisElem->iImap4Settings->SetSecureSockets(EFalse); + } + else if ( aThisElem->iPop3Settings ) + { + aThisElem->iPop3Settings->SetSecureSockets(EFalse); + } + } + break; + case ESuseSecCon : + if ( object ) + { + // The port is same in all cases + aThisElem->iSmtpSettings->SetSecureSockets(EFalse); + aThisElem->iSmtpSettings->SetSSLWrapper(ETrue); + aThisElem->iSmtpSettings->SetPort( KNSmlDMEmailSslSmtpPort ); + } + else + { + aThisElem->iSmtpSettings->SetPort( KNSmlDMEmailNormalSmtpPort ); + aThisElem->iSmtpSettings->SetSSLWrapper( EFalse ); + } + break; + case ESuseStartTls : + if ( object ) + { + // The port is same in all cases + aThisElem->iSmtpSettings->SetSecureSockets(ETrue); + aThisElem->iSmtpSettings->SetSSLWrapper(EFalse); + aThisElem->iSmtpSettings->SetPort( KNSmlDMEmailNormalSmtpPort ); + } + else + { + aThisElem->iSmtpSettings->SetSecureSockets( EFalse ); + } + + break; + default : + break; + } + CleanupStack::PopAndDestroy(); // object + _DBG_FILE("CNSmlDmEmailAdapter::SetDefaultSecurityL(): end"); + } + +// ----------------------------------------------------------------------------- +// CSmlDmAdapter::TError CNSmlDmEmailAdapter::FetchSecurityValueL( +// CBufBase& aObject, +// const TNSmlEmailSettingsElement* aElem, +// const TNSmlEmailSecuritySetting aSetting ) +// Gets the status(on/off) of security modes SSL/TLS or StartTLS +// ----------------------------------------------------------------------------- + +CSmlDmAdapter::TError CNSmlDmEmailAdapter::FetchSecurityValueL( + CBufBase& aObject, + const TNSmlEmailSettingsElement* aElem, + const TNSmlEmailSecuritySetting aSetting ) const + { + _DBG_FILE("CNSmlDmEmailAdapter::FetchSecurityValueL(): start"); + TBool result=EFalse; + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + switch ( aSetting ) + { + + case EUseStartTls : + if ( aElem->iImap4Settings) + { + result = aElem->iImap4Settings->SecureSockets(); + } + else if(aElem->iPop3Settings) + { + result = aElem->iPop3Settings->SecureSockets(); + } + else + { + status = CSmlDmAdapter::EError; + } + break; + case EUseSecCon : + if ( aElem->iImap4Settings) + { + result = aElem->iImap4Settings->SSLWrapper(); + } + else if(aElem->iPop3Settings) + { + result = aElem->iPop3Settings->SSLWrapper(); + } + else + { + status = CSmlDmAdapter::EError; + } + break; + case ESuseStartTls : + if(aElem->iSmtpSettings) + { + result = aElem->iSmtpSettings->SecureSockets(); + } + else + { + status = CSmlDmAdapter::EError; + } + break; + case ESuseSecCon : + if(aElem->iSmtpSettings) + { + result = aElem->iSmtpSettings->SSLWrapper(); + } + else + { + status = CSmlDmAdapter::EError; + } + break; + default: + status = CSmlDmAdapter::EError; + break; + } + + if ( result ) + { + aObject.InsertL(0,KNSmlDMEmailTrue); + } + else + { + aObject.InsertL(0,KNSmlDMEmailFalse); + } + _DBG_FILE("CNSmlDmEmailAdapter::FetchSecurityValueL(): end"); + return status; + } + +//-------------------------------------------------------------------- +//TInt CNSmlDmEmailAdapter::ConstructTreeL(const TDesC8& aURI) +// +//------------------------------------------------------------------- + +TInt CNSmlDmEmailAdapter::ConstructTreeL(const TDesC8& aURI) +{ + TInt ret = KErrNotFound; + CEmailAccounts* emailAccs = CEmailAccounts::NewLC(); + + if(aURI.Find(KNSmlDMEmailNodeName)!= KErrNotFound) + { + RArray imap4Accounts; + CleanupClosePushL( imap4Accounts ); + emailAccs->GetImapAccountsL(imap4Accounts); + + // First, IMAP accounts + // + TInt luid; + TPtrC8 name; + // cycle through every found account + for(TInt count = 0; count < imap4Accounts.Count(); count++) + { + + SetLuidById( EImap, imap4Accounts[count].iImapAccountId, luid ); + HBufC8 *uri = HBufC8::NewLC(KNSmlDMEmailNodeName().Length() + + KNSmlDMEmailMproIMAP().Length() + 6); + + TPtr8 uriPtr = uri->Des(); + uriPtr.Append(KNSmlDMEmailNodeName); + uriPtr.Append(KNSmlDMEmailSeparator8); + uriPtr.Append(KNSmlDMEmailMproIMAP); + uriPtr.AppendNumFixedWidth(count,EDecimal,3); + HBufC8 *luidBuf = IntToDes8LC(luid); + HBufC8* mapInfo = Callback().GetLuidAllocL(uriPtr); + if (mapInfo->Length() == 0) + { + Callback().SetMappingL(uriPtr, luidBuf->Des()); + if( aURI.Find(uriPtr) >= 0 ) + { + ret = luid; + } + } + else + { + delete mapInfo; + } + + CleanupStack::PopAndDestroy(2); //uri,luidBuf + } + CleanupStack::PopAndDestroy(); //imap4Accounts + + // Then, POP accounts + // + RArray pop3Accounts; + CleanupClosePushL( pop3Accounts ); + emailAccs->GetPopAccountsL( pop3Accounts ); + // cycle through every found account + for(TInt count = 0; count < pop3Accounts.Count(); count++) + { + SetLuidById( EPop, pop3Accounts[count].iPopAccountId, luid ); + + HBufC8 *uri = HBufC8::NewLC(KNSmlDMEmailNodeName().Length() + + KNSmlDMEmailMproPOP().Length() + 5); + TPtr8 uriPtr = uri->Des(); + uriPtr.Append(KNSmlDMEmailNodeName); + uriPtr.Append(KNSmlDMEmailSeparator8); + uriPtr.Append(KNSmlDMEmailMproPOP); + uriPtr.AppendNumFixedWidth(count,EDecimal,3); + HBufC8 *luidBuf = IntToDes8LC(luid); + HBufC8* mapInfo = Callback().GetLuidAllocL(uriPtr); + if (mapInfo->Length() == 0) + { + Callback().SetMappingL(uriPtr,luidBuf->Des()); + if( aURI.Find(uriPtr) >= 0 ) + { + ret = luid; + } + } + else + { + delete mapInfo; + } + + CleanupStack::PopAndDestroy(2); //uri,luidBuf + } + CleanupStack::PopAndDestroy(); //pop3Accounts + } + CleanupStack::PopAndDestroy(); //emailAccs + return ret; +} + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlDmEmailAdapter::GetDynamicEmailNodeUri( const TDesC8& aURI ) +// returns Email/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CNSmlDmEmailAdapter::GetDynamicEmailNodeUri( const TDesC8& aURI ) + { + DBG_ARGS8(_S8("CNSmlDmEmailAdapter::GetDynamicEmailNodeUri() - <%S> "), &aURI); + TInt i= 0; + TBuf8<50> EmailAccRoot(KNSmlDMEmailNodeName); + for ( i = aURI.Find( KNSmlDMEmailNodeName ) + EmailAccRoot.Length() + 1; + i < aURI.Length(); i++ ) + { + if( aURI[i] == '/' ) + { + break; + } + } + _DBG_FILE("CNSmlDmEmailAdapter::GetDynamicEmailNodeUri(): end"); + return aURI.Left( i ); + } + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/src/nsmldmemailadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/src/nsmldmemailadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +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 SyncML DM Email adapter +* +*/ + + + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F6E34; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F6E35; // DM Email implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/bwins/emailtestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/bwins/emailtestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/conf/emailtest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/conf/emailtest.cfg Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,96 @@ +[Test] +title DDF +create emailtest foobar jee +foobar DDFStructure +delete foobar +[Endtest] + +[Test] +title StartAtomic +create emailtest foobar +foobar StartAtomic +delete foobar +[Endtest] + +[Test] +title CommitAtomic +create emailtest foobar +foobar CommitAtomic +delete foobar +[Endtest] + +[Test] +title RollbackAtomic +create emailtest foobar +foobar RollbackAtomic +delete foobar +[Endtest] + +[Test] +title AddEmail +create emailtest foobar +foobar AddNode Email/IMAP33245 +foobar UpdateLeaf Email/IMAP33245/Name email99 +foobar UpdateLeaf Email/IMAP33245/UName Test +foobar UpdateLeaf Email/IMAP33245/Mpro IMAP +foobar UpdateLeaf Email/IMAP33245/Mrcv mai..yaho.com +foobar UpdateLeaf Email/IMAP33245/Msnd smtp.yahoo.com +foobar CompleteCommands +delete foobar +[Endtest] + +[Test] +title UpdateLeafEmailName +create emailtest foobar +foobar UpdateLeaf Email/IMAP33245/Name newname99 +delete foobar +[Endtest] + +[Test] +title FetchNodeEmail +create emailtest foobar +foobar FetchNode Email/IMAP33245 +delete foobar +[Endtest] + +[Test] +title FetchLeafEmailName +create emailtest foobar +foobar FetchLeaf Email/IMAP33245/Name +delete foobar +[Endtest] + +[Test] +title FetchLeafEmailUName +create emailtest foobar +foobar FetchLeaf Email/IMAP33245/UName +delete foobar +[Endtest] + +[Test] +title FetchLeafEmailMpro +create emailtest foobar +foobar FetchLeaf Email/IMAP33245/Mpro +delete foobar +[Endtest] + +[Test] +title FetchLeafEmailMrcv +create emailtest foobar +foobar FetchLeaf Email/IMAP33245/Mrcv +delete foobar +[Endtest] + +[Test] +title FetchLeafEmailMsnd +create emailtest foobar +foobar FetchLeaf Email/IMAP33245/Msnd +delete foobar +[Endtest] + +[Test] +title DeleteEmail +create emailtest foobar +foobar DeleteNode Email/IMAP33245 +delete foobar +[Endtest] diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/eabi/emailtestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/eabi/emailtestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,9 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI10CemailTest @ 2 NONAME ; ## + _ZTI16CTestDmDDFObject @ 3 NONAME ; ## + _ZTI8Cdmatest @ 4 NONAME ; ## + _ZTV10CemailTest @ 5 NONAME ; ## + _ZTV16CTestDmDDFObject @ 6 NONAME ; ## + _ZTV8Cdmatest @ 7 NONAME ; ## + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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' +emailtest.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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/group/emailtest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/group/emailtest.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 emailtest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE emailtest.def + +SOURCEPATH ../src +SOURCE dmatest.cpp +SOURCE TestDmDDFObject.cpp +SOURCE emailtest.cpp +SOURCE emailtestBlocks.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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/group/emailtest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/group/emailtest.pkg Thu Jul 22 16:30:53 2010 +0100 @@ -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. +#{"emailtest"},(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\emailtest.dll" -"C:\sys\bin\emailtest.dll" +"..\conf\emailtest.cfg"-"C:\TestFramework\emailtest.cfg" +"..\init\emailtest.ini"-"C:\TestFramework\emailtest.ini" diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/inc/TestDmDDFObject.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/inc/dmatest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 "nsmldmemailadapter.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 ; + CNSmlDmEmailAdapter *iAdapter ; + HBufC8 *iURI; + CArrayFix *iEmptyMappingInfoArray; + TFileName iSaveFileName; + RMappingArray iMappingTable; + TUid iUid; + TInt iCounter; + //class CNSmlDmMgmtTree* iMgmtTree; + class CNSmlDmMgmtTree* iMgmtTree; + CNSmlDmEmailAdapter *Adapter() ; + }; + +#endif // __DMA_TEST_H__ + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/inc/emailtest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/inc/emailtest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 KNSmlemailAdapterImplUid = 0x101F6E35; + + +const TUid KAdapterUid = + { + KNSmlemailAdapterImplUid + }; +// Logging path +_LIT( KamtestLogPath, "\\logs\\testframework\\tctest\\" ); +// Log file +_LIT( KamtestLogFile, "tctest.txt" ); + + +// FORWARD DECLARATIONS +class CemailTest; + + +// CLASS DECLARATION + +/** +* CemailTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +class CemailTest : public Cdmatest + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CemailTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CemailTest(); + + 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. + */ + CemailTest( 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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/init/emailtest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/init/emailtest.ini Thu Jul 22 16:30:53 2010 +0100 @@ -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\emailtest.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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/src/TestDmDDFObject.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/src/dmatest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,953 @@ +/* +* 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 ); + } + } + +CNSmlDmEmailAdapter *Cdmatest::Adapter() + { + if ( iAdapter == NULL ) + { + if ( iLog ) + { + iLog->Log( _L( "Loading Adapter" ) ); + } + + TRAPD( err, iAdapter = (CNSmlDmEmailAdapter*) 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 ) + { + 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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/src/emailtest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/src/emailtest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 "emailTest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CemailTest::CemailTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +/*CemailTest::CemailTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + }*/ +CemailTest::CemailTest( CTestModuleIf& aTestModuleIf ) + : Cdmatest( aTestModuleIf, KAdapterUid ) + { + } +// ----------------------------------------------------------------------------- +// CemailTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CemailTest::ConstructL() + { +/* iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse );*///Commented the Part for emailTest Dipak + iLog = CStifLogger::NewL( KamtestLogPath, + KamtestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile ); + + iLog->Log( _L( "Loading Adapter" ) ); + + Cdmatest::ConstructL(); + + } + +// ----------------------------------------------------------------------------- +// CemailTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CemailTest* CemailTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CemailTest* self = new (ELeave) CemailTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CemailTest::~CemailTest() + { + + // 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* ) CemailTest::NewL( aTestModuleIf ); + + } + + + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/email/tsrc/src/emailtestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/email/tsrc/src/emailtestBlocks.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 "emailTest.h" +#include +#include +#include + + +//using namespace NApplicationManagement;//Dipak + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CemailTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CemailTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CemailTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CemailTest::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", CemailTest::DDFStructureL), + ENTRY( "FetchNode", CemailTest::FetchNodeL ), + ENTRY( "FetchLeaf", CemailTest::FetchLeafL ), + ENTRY( "AddNode", CemailTest::AddNodeL ), + ENTRY( "UpdateLeaf", CemailTest::UpdateLeafL ), + ENTRY( "UpdateLeafData", CemailTest::UpdateLeafDataL ), + ENTRY( "Execute", CemailTest::ExecuteLeafL ), + ENTRY( "ExecuteData", CemailTest::ExecuteLeafDataL ), + ENTRY( "DeleteNode", CemailTest::DeleteObjectL ), + ENTRY( "StartAtomic", CemailTest::StartAtomicL), + ENTRY( "CommitAtomic", CemailTest::CommitAtomicL), + ENTRY( "RollbackAtomic", CemailTest::RollbackAtomicL), + ENTRY( "CompleteCommands", CemailTest::CompleteCommandsL), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + + +HBufC8 *CemailTest::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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,48 @@ +/* +* 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: build info file for Fota adapter +* +*/ + + + + +#include + +PRJ_EXPORTS + +// Generic configuration interface for component cenrep settings +../conf/fotaadapter.confml APP_LAYER_CONFML(fotaadapter.confml) +../conf/fotaadapter_101F9A08.crml APP_LAYER_CRML(fotaadapter_101F9A08.crml) + +// ARMv5 udeb +../src/101F9A02.SPD /epoc32/release/armv5/udeb/z/private/100012a5/policy/101f9a02.spd + +// ARMv5 urel +../src/101F9A02.SPD /epoc32/release/armv5/urel/z/private/100012a5/policy/101f9a02.spd + +// WINSCW udeb +../src/101F9A02.SPD /epoc32/release/winscw/udeb/z/private/100012a5/policy/101f9a02.spd + +// WINSCW urel +../src/101F9A02.SPD /epoc32/release/winscw/urel/z/private/100012a5/policy/101f9a02.spd + + + +PRJ_MMPFILES +./nsmldmfotaadapter.mmp + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/bld/nsmldmfotaadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/bld/nsmldmfotaadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,57 @@ +/* +* 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 Fota Adapter +* +*/ + + + + +#include "defaultcaps.hrh" +#include + +CAPABILITY CAP_GENERAL_DLL +TARGET nsmldmfotaadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F9A08 +VENDORID VID_DEFAULT + +//Default system include paths for app layer modules. +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +SOURCEPATH ../src +SOURCE nsmldmfotaadapter.cpp +SOURCE nsmldmfotaadapterdb.cpp + +START RESOURCE nsmldmfotaadapter.rss +LANGUAGE_IDS +END + + + +LIBRARY euser.lib ecom.lib nsmldebug.lib +LIBRARY efsrv.lib edbms.lib estor.lib +LIBRARY sysutil.lib bafl.lib +LIBRARY fotaengine.lib +LIBRARY syncmlclientapi.lib +LIBRARY nsmlprivateapi.lib +LIBRARY centralrepository.lib +LIBRARY nsmldmtreedbclient.lib +LIBRARY flogger.lib +SMPSAFE diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/conf/fotaadapter.confml Binary file omadmadapters/fota/conf/fotaadapter.confml has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/conf/fotaadapter_101F9A08.crml Binary file omadmadapters/fota/conf/fotaadapter_101F9A08.crml has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/inc/FotaSrvDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/inc/FotaSrvDebug.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,73 @@ +/* +* 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 +* +*/ + + + +#ifndef FOTADEBUG_H +#define FOTADEBUG_H + + // IMPORT_C static TInt Print(TRefByValue aFmt,...); +#if defined (__WINS__) + #define _FOTA_DEBUG + // #define _FOTA_DEBUG_RDEBUG +#else + #define _FOTA_DEBUG +#endif + //#endif + #ifdef _FOTA_DEBUG + + + #include + #include + #include + #include + + _LIT( KLogFile, "fumo.log" ); + _LIT( KLogDir, "fota" ); + + inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + #ifdef _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG RDebug::Print + #else // __GNUC__ + #define FLOG(arg...) RDebug::Print(arg); + #endif // __GNUC__ + #else // _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG FWrite + #else // __GNUC__ + #define FLOG(arg...) FWrite(arg); + #endif // __GNUC__ + #endif // _FOTA_DEBUG_RDEBUG + + #else // _FOTA_DEBUG + #ifndef __GNUC__ + #define FLOG + #else + #define FLOG(arg...) + #endif // __GNUC__ + #endif // _FOTA_DEBUG + +#endif // FOTADEBUG_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/inc/fotaadapterCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/inc/fotaadapterCRKeys.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,35 @@ +/* +* 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: FotaAdapter private CenRep key definitions +* +*/ + + + + +#ifndef FOTAADAPTERCRKEYS_H +#define FOTAADAPTERCRKEYS_H + +// CONSTANTS + +// key uid +const TUid KCRUidFotaAdapter = {0x101F9A08}; + +// Fota adapter is loaded iff key is on +const TUint32 KCRFotaAdapterEnabled = 0x00000001; + + +#endif // FOTAADAPTERCRKEYS_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/inc/nsmldmfotaadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/inc/nsmldmfotaadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,565 @@ +/* +* 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 Fota Adapter +* +*/ + + + + +#ifndef __NSMLDMFOTAADAPTER_H__ +#define __NSMLDMFOTAADAPTER_H__ + +// INCLUDES +#include +#include +#include +#include + +#include "nsmldmfotaadapterdb.h" + + +// CONSTANTS + +const TInt KNSmlDMFotaResultBufferExpandSize = 64; +const TInt KNSmlDMFotaStreamingTreshold = 4096; +const TInt KNSmlDMFotaNullPkgId = -1; + +// final result values +const TInt KNSmlDMFotaUndefinedError = 410; +const TInt KNSmlDMFotaSuccessfullDownload = 202; +const TInt KNSmlDMFotaBadUrl = 502; + +// P&S keys defined & owned by FotaServer for OMA DM large object +// sets the OMA DM large object download status +const TUint32 KFotaLrgObjDl = 0x00000005; +// sets the profile id used for OMA DM large object download +const TUint32 KFotaLrgObjProfileId = 0x00000006; +// literals for DDF structure +_LIT8( KNSmlDMFotaNode, "FUMO" ); +_LIT8( KNSmlDMFotaNodeName, "PkgName" ); +_LIT8( KNSmlDMFotaNodeVersion, "PkgVersion" ); +_LIT8( KNSmlDMFotaNodeDownload, "Download" ); +_LIT8( KNSmlDMFotaNodeDownloadUrl, "PkgURL" ); +_LIT8( KNSmlDMFotaNodeDownloadAndUpdate, "DownloadAndUpdate" ); +_LIT8( KNSmlDMFotaNodeDownloadAndUpdateUrl, "PkgURL" ); +_LIT8( KNSmlDMFotaNodeState, "State" ); + +// descriptions for DDF nodes +_LIT8( KNSmlDMFotaNodeDescription, +"Placeholder for all firmware management objects" ); + +_LIT8( KNSmlDMFotaRunTimeNodeDescription, +"Placeholder for a single firmware management object" ); + +_LIT8( KNSmlDMFotaNodeNameDescription, +"Name of a firmware update package" ); + +_LIT8( KNSmlDMFotaNodeVersionDescription, +"Version of a firmware update package" ); + +_LIT8( KNSmlDMFotaNodeDownloadDescription, +"Execution target for firmware update package download" ); + +_LIT8( KNSmlDMFotaNodeDownloadUrlDescription, +"Url to a location containing binary firmare update package" ); + +_LIT8( KNSmlDMFotaNodeUpdateDescription, +"Execution target for installing update package to device" ); + +_LIT8( KNSmlDMFotaNodeUpdateDataDescription, +"Binary data used in installation" ); + +_LIT8( KNSmlDMFotaNodeDownloadAndUpdateDescription, +"Execution target for downloading firmware update package and installing it" ); + +_LIT8( KNSmlDMFotaNodeDownloadAndUpdateUrlDescription, +"Url to a location containing binary firmare update package" ); + +_LIT8( KNSmlDMFotaNodeStateDescription, +"Current state of firmware update" ); + +// mime types etc +_LIT8( KNSmlDMFotaRunTimeMimeType, +"org.openmobilealliance/1.0/FirmwareUpdateManagementObject" ); + +_LIT8( KNSmlDMFotaTextPlain, "text/plain" ); +_LIT8( KNSmlDMFotaDDFVersion, "1.0" ); + +_LIT8( KNSmlDMFotaUpdateMetaType, +"org.openmobilealliance.dm.firmwareupdate.update" ); + +_LIT8( KNSmlDMFotaDownloadMetaType, +"org.openmobilealliance.dm.firmwareupdate.download" ); + +_LIT8( KNSmlDMFotaDownloadAndUpdateMetaType, +"org.openmobilealliance.dm.firmwareupdate.downloadandupdate" ); + +_LIT8( KNSmlDMFotaMetaFormat, "text/plain" ); + +_LIT8( KNSmlDMFotaRunTimeChildren, +"PkgName/PkgVersion/Download/DownloadAndUpdate/State" ); + +// uri related +_LIT8( KNSmlDMFotaSeparatorDes, "/" ); +_LIT8( KNSmlDMFotaRuntimeMatch, "*FUMO/*" ); +_LIT8( KNSmlDMFotaRootMatch, "*FUMO" ); + + +/** +* CNSmlDmFotaAdapter, the main adapter class of Fota. Provides methods +* to access and modify FUMO objects. +* +* @lib nsmldmfotaadapter.lib +* +*/ +class CNSmlDmFotaAdapter : public CSmlDmAdapter + { + +public: + + /** + * Two-phased constructor. + * @param aDmCallback A pointer to DM Callback, which is used to + * set statuses and results of commands. + * @return A pointer to the newly created adapter. + */ + static CNSmlDmFotaAdapter* NewL( MSmlDmCallback* aDmCallback ); + + /** + * Two-phased constructor. Pushes the pointer onto the CleanupStack. + * @param aDmCallback A pointer to DM Callback, which is used to + * set statuses and results of commands. + * @return A pointer to the newly created adapter. + */ + static CNSmlDmFotaAdapter* NewLC( MSmlDmCallback* aDmCallback ); + + /** + * Destructor. + */ + virtual ~CNSmlDmFotaAdapter(); + +public: + + // from CSmlDmAdapter + + /** + * Sets current version of Fota adapter's DDF structure to aDDFVersion. + * @param aVersion Buffer which on return contains the version. + */ + void DDFVersionL( CBufBase& aDDFVersion ); + + /** + * Fills the DDF structure of firmware management object using the given + * reference as the root of DDF. Also checks if there are any Generic + * Alerts to be sent to current remote DM server. If there are, delegates + * the alerts to SOS Server using Private API. + * @param aDDFObject Reference to root DDF node. + */ + void DDFStructureL( MSmlDmDDFObject& aDDF ); + + /** + * Updates a leaf object in FUMO. Sets ENotFound as status to DM Framework, + * if aURI and/or aLUID is not valid. + * @param aURI Uri which spesifies the leaf to be updated in a firmware + * object. + * @param aLUID Identifier used to identify in which firmware object + * the leaf should be updated. + * @param aObject Data used in the update. + * @param aType Mime type of the data. Ignored in Fota adapter. + * @param aStatusRef Identifier that is used when setting the completion + * status to DM Framework. + */ + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + TInt aStatusRef ); + + /** + * Deletes a firmware object from Fota DB. If aURI does not point to a + * runtime node and/or aLUIDis invalid, ENotFound is set as status for + * this command. + * @param aURI Uri which spesifies a firmware object. + * @param aLUID Identifier used to identify in which firmware object + * should be deleted. + * @param aStatusRef Identifier that is used when setting the completion + * status to DM Framework. + */ + void DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ); + + /** + * Fetches a leaf object in FUMO. Sets ENotFound as status to DM Framework, + * if aURI and/or aLUID is not valid. + * @param aURI Uri which spesifies the leaf to be fetched. + * @param aLUID Identifier used to identify from which firmware object the + * leaf should be fetched. + * @param aType Mime type that server wishes to be used in the returned data. + * Ignored in Fota adapter (but used when setting the result). + * @param aResultRef Identifier that is used when setting the result + * (fetched data) to DM Framework. + * @param aStatusRef Identifier that is used when setting the completion + * status to DM Framework. + */ + void FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ); + + /** + * Forms a list of children of given node (aURI) and sets the list to + * DM Framework as result. + * @param aURI Uri which spesifies the node whose children should be + * listed. In Fota this should point to either to the ./FUMO or ./FUMO/. + * In the first case aPreviousURISegmentList is trusted and the list is + * formed entirely based on it. In the latter case, a hard coded list of + * run time node's children is returned. + * @param aLUID Identifier of aURI. Ignored in Fota adapter. + * @param aPreviousURISegmentList A List of aURI's children formed by + * DM Framework. + * @param aResultRef Identifier that is used when setting the result + * (fetched data) to DM Framework. + * @param aStatusRef Identifier that is used when setting the completion + * status to DM Framework. + */ + void ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ); + + /** + * Adds a firmware object to Fota DB. If aURI does not point to a runtime + * node and/or aLUID is invalid, ENotFound is set as status for this + * command. + * @param aURI Uri which spesifies the firmware object. + * @param aParentLUID Identifier of aURI. If this is a valid ID, then + * the object has already been added and EAlreadyExists is set as status + * for this command. + * @param aStatusRef Identifier that is used when setting the completion + * status to DM Framework. + */ + void AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ); + + /** + * This method is used to update PkgData, which is the only large object + * data in FUMO. Adapter opens a stream to a data (using Fota Engine) + * and sets this stream to aStream after which this method returns. DM Host + * Server then writes the data to the stream piece by piece and finally + * calls StreamCommittedL() when all data is written. + * @param aURI Uri which spesifies the leaf to be updated in a firmware + * object. If this does not point to ./FUMO//Update/PkgData, ENotFound + * is set as status for this command. + * @param aLUID Identifier used to identify in which firmware object the + * data should be updated. + * @param aStream Pointer to a stream, where the opened stream is set. + * @param aType Mime type of the data. Ignored in Fota adapter. + * @param aStatusRef Identifier that is used when setting the completion + * status to DM Framework. + */ + void UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + const TInt aStatusRef ); + + /** + * Fetches the size of leaf object's data in bytes. Sets ENotFound as + * status to DM Framework, if aURI and/or aLUID is not valid. + * @param aURI Uri which spesifies the leaf whose data is measured. + * @param aLUID Identifier used to identify from which firmware object + * the leaf size should be counted. + * @param aType Mime type that server wishes to be used in the returned + * data. Ignored in Fota adapter (but used when setting the result) + * @param aResultRef Identifier that is used when setting the result + * (fetched data) to DM Framework. + * @param aStatusRef Identifier that is used when setting the completion + * status to DM Framework. + */ + void FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ); + + /** + * Executes command targeting Download, DownloadAndUpdate or Update. In any + * other case, ENotFound is set as status for this command. Saves all + * the data needed when reporting the final result of this command in + * the beginning of next DM session, fetches needed data for the command + * and delegates the command to Fota Engine. + * @param aURI Uri which spesifies the target node for the exec command. + * @param aLUID Identifier used to identify the firmware object where the + * target node lies. + * @param aArgument The argument data of the exec command. In Fota this is + * an overloaded feature, and this parameter contains the Correlator of + * the exec command. + * @param aType Mime type of aArgument. Ignored in Fota adapter. + * @param aStatusRef Identifier that is used when setting the completion + * status to DM Framework. + */ + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& aType, + const TInt aStatusRef ); + + /** + * Not supported. + */ + void ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& aType, + const TInt aStatusRef ); + + /** + * Not supported. + */ + void CopyCommandL( const TDesC8& aTargetURI, + const TDesC8& aTargetLUID, + const TDesC8& aSourceURI, + const TDesC8& aSourceLUID, + const TDesC8& aType, + TInt aStatusRef ); + + /** + * Not supported. + */ + void StartAtomicL(); + + /** + * Not supported. + */ + void CommitAtomicL(); + + /** + * Not supported. + */ + void RollbackAtomicL(); + + /** + * Returns whether or not streaming is supported in this adapter. In Fota + * this method is also used to enquire whether or not a large object + * whose size is given in aItemSize fits to disk (OOD check using Fota + * Engine), and to acknowledge that Generic Alerts have been successfully + * sent. If aItemSize is larger that 0, OOD check feature is executed. If + * aItemSize equals KNSmlDMResetGenAlerts, Generic Alerts are marked sent. + * Otherwise aItemSize is set to a treshold value, which is used by DM + * Host Server to determine if streaming should be used (large object) + * or not. + * @param aItemSize If this parameter is larger than zero in the beginning, + * on return it equals KErrNone if the data fits to disk, and KErrNoMemory + * if not. If in the beginning this param equals KNSmlDMResetGenAlerts, + * Generic Alerts are marked sent. Otherwise if in the beginning this param + * is less or equal to zero, on return it equals to the treshold value + * mentioned above. + * @return Whether or not streaming is supported in this adapter + * (ETrue always). + */ + TBool StreamingSupport( TInt& aItemSize ); + + /** + * DM Host Server notifies Fota adapter using this method, when all data + * has been written to the stream opened for streaming in UpdateLeafObjectL + * targeting PkgData. Fota adapter forwards this notification to Fota + * Engine. + */ + void StreamCommittedL(); + + /** + * Not supported. + */ + void CompleteOutstandingCmdsL(); + +private: + + /** + * Check if fota table exists + * @param aLUID ID of the node + * @return whether table exists + */ + TBool TableExistsL(const TDesC8& aLUID) const; + + /** + * Default constructor. + * @param aEcomArguments A pointer to MSmlDmCallback which is received + * through ECom. The pointer is passed on to base class. + */ + CNSmlDmFotaAdapter( TAny* aEcomArguments ); + + /** + * Second phase construction. + */ + void ConstructL(); + + /** + * Fetches the data in firmware object identified by aLUID (object) and + * aURI (leaf). + * @param aURI Identifies the leaf whose data should be fetched. + * @param aLUID Identifies the FW object in which the leaf object is. + * @param aObject Reference to CBufBase to which the fetched data is + * written. + * @return Status code according to the success of the fetch. + */ + CSmlDmAdapter::TError DoFetchObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + CBufBase& aObject ); + + /** + * Gets data needed for Update execution from Fota DB and notifies + * Fota Engine. Note: this method does not wait for Fota Engine to + * execute the command, but immediately returns when Fota Engine has been + * notified. + * @param aLUID The id of the firmware object to which this exec is + * targeted. + * @param aProfile The profile id of the currently running DM session. + * @return Status code according to the success of the method. + */ + CSmlDmAdapter::TError DoExecUpdateL( const TNSmlDmFwObjectId aLUID, + const TSmlProfileId aProfile ); + + /** + * Gets data needed for Download or DownloadAndUpdate execution from + * Fota DB and notifies Fota Engine. Note: this method does not wait + * for Fota Engine to execute the command, but immediately returns when + * Fota Engine has been notified. + * @param aLUID The id of the firmware object to which this exec is + * targeted. + * @param aProfile The profile id of the currently running DM session. + * @param aUpdate If set ETrue, executes DownloadAndUpdate. Otherwise + * executes Download. + * @return Status code according to the success of the method. + */ + CSmlDmAdapter::TError DoExecDownloadL( const TNSmlDmFwObjectId aLUID, + const TSmlProfileId aProfile, + TBool aUpdate ); + + /** + * Saves all the data needed to save before any exec command and returns + * the id of the profile of currently running DM session. + * @param aURI Management uri, which is the target of the exec command. + * @param aLUID Identifies the firm3ware object that is the target of the + * exec command. + * @param aCorrelator Correlator received as an argument in the exec + * command. + * @return Profile id of the currently running DM session. + */ + TSmlProfileId SaveExecInfoL( const TDesC8& aURI, + const TNSmlDmFwObjectId aLUID, + const TDesC8& aCorrelator ); + + /** + * Fetches profile id and server id of the currently running DM session + * using Client API. + * @param aProfId Reference which on succesful return contains the + * profile id. + * @param aServerId Reference which on successful return contains + * the server id. + */ + void GetServerInfoL( TSmlProfileId& aProfId, HBufC8*& aServerId ) const; + + /** + * Checks if there are any firmware objects that have empty final results. + * If there are, checks if any their final result should be reported to + * currently running DM session's remote server using Generic Alert. + * I.e. if the remote server is the same as with any of those firmware + * object's whose execution's final result has not been reported yet, + * uses Private API to generate Generic Alert about them. + */ + void MakeGenericAlertsL(); + + /*** + * Checks existance of predefined node under FUMO and adds it to + * DM Tree + **/ + + void CheckAndAddPredefinedNodeL(); + /*** + * Gets predefined node name to be created under FUMO from cenrep + * + **/ + + void GetPredefinedNodeL(TDes8& aNode); + /** + * Sets final result to all those FW objects that are associated with + * current DM session's remote server, have been a target to an exec + * command and that exec command has been finished. I.e. Generic Alert + * has been successfully sent reporting these final results, and is not + * needed to be sent anymore in next DM session. + */ + void MarkGenericAlertsSentL(); + + /** + * Returns correct meta/type acoording to the execution target aURI. + * @param aURI The target for exec command, e.g. ./FUMO//Update + * @return The meta/type + */ + TPtrC8 GetMetaType( const TDesC8& aURI ) const; + + /** + * Maps a system wide error code to a TError. + * @param aError A system wide error code. + * @return A TError value depending on aError. + */ + CSmlDmAdapter::TError MapErrorToStatus( TInt aError ) const; + + /** + * Parses a numeric value from aLUID. + * @param aLUID A string representation of a signed integer. + * @return TInt value. + */ + TInt DesToInt( const TDesC8& aLUID ) const; + + /** + * Return the last uri segment of the given uri. E.g. in + * ./FUMO//Download last uri segment is "Download" + * @param aURI the uri to be parsed. + * @return The last segment. + */ + TPtrC8 LastURISeg( const TDesC8& aURI ) const; + + /** + * Fills the given information to a DDF Object node. + * @param aNode The node whose data is filled. + * @param aAccTypes The access types of the node. + * @param aOccurance Occurance of the node. + * @param aScope The scope of the node. + * @param aFormat The format of the node's data, i.e. node/chr/bin/... + * @param aDescription Informal description of the node. + */ + void FillNodeInfoL( MSmlDmDDFObject& aNode, + const TSmlDmAccessTypes& aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) const; + + RFotaEngineSession& FotaEngineL(); + +private: + + CNSmlDmFotaAdapterDb* iFotaDb; + RFotaEngineSession iFotaEngine; + + TInt iPkgId; + + }; + +#endif // __NSMLDMFOTAADAPTER_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/inc/nsmldmfotaadapterdb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/inc/nsmldmfotaadapterdb.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,458 @@ +/* +* 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: Fota adapter's DB header file +* +*/ + + + + + +#ifndef __NSMLDMFOTAADAPTERDB_H +#define __NSMLDMFOTAADAPTERDB_H + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +// null final result value +const TInt KNSmlFotaNullResult = 0; + +// Database name & location +const TInt KNSmlFotaAdapterDbDrive = EDriveC; +_LIT( KNSmlFotaAdapterDbName, "c:nsmldmfotaadapter.db" ); + +// Table and column names +_LIT( KNSmlTableFwMgmtObject, "FwMgmtObject" ); +_LIT( KNSmlFwMgmtObjectId, "PkgId" ); +_LIT( KNSmlFwMgmtObjectName, "PkgName" ); +_LIT( KNSmlFwMgmtObjectVersion, "PkgVersion" ); +_LIT( KNSmlFwMgmtObjectUrl, "PkgURL" ); +_LIT( KNSmlFwMgmtObjectMgmtUri, "MgmtURI" ); +_LIT( KNSmlFwMgmtObjectProfileId, "ProfileId" ); +_LIT( KNSmlFwMgmtObjectServerId, "ServerId" ); +_LIT( KNSmlFwMgmtObjectResult, "FinalResult" ); +_LIT( KNSmlFwMgmtObjectCorrelator, "Correlator" ); + +// SQL statements +_LIT( KNSmlCreateFwMgmtObjectTable, "CREATE TABLE FwMgmtObject ( PkgId \ +COUNTER NOT NULL, PkgName CHAR(%d), PkgVersion CHAR(%d), PkgURL LONG VARCHAR, \ +MgmtURI CHAR(%d), ProfileId INTEGER, ServerId CHAR(%d), FinalResult INTEGER, \ +Correlator CHAR(%d) )" ); + +_LIT( KNSmlGetFwMgmtObject, "SELECT * FROM FwMgmtObject WHERE PkgId = %d" ); + +_LIT( KNSmlGetUnfinishedFwMgmtObjects, "SELECT * FROM FwMgmtObject \ +WHERE FinalResult = %d" ); + +_LIT( KNSmlGetUnfinishedFwMgmtObjectByServerId, "SELECT * FROM FwMgmtObject \ +WHERE FinalResult = %d AND ServerId = '%S' AND NOT (MgmtURI = '')" ); + +_LIT( KNSmlDeleteFwMgmtObject,"DELETE FROM FwMgmtObject WHERE PkgId = %d"); + +// Max. lengths of string fields in FwMgmtObject +const TInt KNSmlMaxMgmtUriLength = 60; +const TInt KNSmlMaxServerIdLength = 150; +const TInt KNSmlMaxCorrelatorLength = 150; + +// Estimate of url size used in max row size (OOD checks) +const TInt KNSmlPkgURLLengthEstimate = 350; + +// space needed for above integers in buffer +const TInt KNSmlFwMgmtObjectIntLength = 4; + +// space needed for an integer in buffer +const TInt KNSmlFwMgmtObjectIntegerLength = 10; + +// Size of empty Fota database in bytes (+ additional treshold) +const TInt KNSmlFotaAdapterEmptyDbSize = 350; + +// Estimated maximum size of FwMgmtObject table row (+ additional treshold) +const TInt KNSmlMaxFwMgmtObjectRowSize = KFotaMaxPkgNameLength + + KFotaMaxPkgVersionLength + + KNSmlPkgURLLengthEstimate + + KNSmlMaxMgmtUriLength + + KNSmlMaxServerIdLength + + KNSmlMaxCorrelatorLength + 115; + +// TYPEDEFS +typedef TInt TNSmlDmFwObjectId; +typedef RArray RNSmlDmFwObjectArray; + + + +// CLASS DECLARATION + +/** +* CNSmlDmFotaAdapterDb provides an interface for accessing Fota database. +* +* @lib nsmldmfotaadapter.lib +* +*/ +class CNSmlDmFotaAdapterDb : public CBase + { + +public: + + /** + * Two-phased constructor. + * @return A pointer to the newly created instance. + */ + static CNSmlDmFotaAdapterDb* NewL(); + + /** + * Two-phased constructor. Pushes the pointer onto the CleanupStack. + * @return A pointer to the newly created instance. + */ + static CNSmlDmFotaAdapterDb* NewLC(); + + /** + * Destructor. + */ + virtual ~CNSmlDmFotaAdapterDb(); + + /** + * Adds a new row (i.e. firmware object) to the FwMgmtObject table. + * The values in each column are left NULL, except FinalResult to + * KNSmlFotaNullResult. + * Leaves with KErrDiskFull, if OOD check fails. + * @return The id of the new fw object in Fota database. + */ + TNSmlDmFwObjectId AddFwObjectL(); + + /** + * Deletes a firmware object from FwMgmtObject table. + * @param aId The identifier of the object to be deleted. + * @return KErrNone if the object was successfully deleted, KErrNotFound if + * the object was not found from database. + */ + TInt DeleteFwObjectL( const TNSmlDmFwObjectId aId ); + + /** + * Finds all the firmware objects that have null final result and sets + * the ids of those objetcs to aArray. + * @param aArray that on return contains the ids. + */ + void GetEmptyFinalResultsL( RNSmlDmFwObjectArray& aArray ); + + /** + * Finds all the firmware objects that have null final result, server id + * equals to given server id and mgmt uri is not empty. Sets the ids of + * those objetcs to aArray. + * @param aArray Array that on return contains the ids. + * @param aServerId The id of the server whose empty final result values + * are listed. + */ + void GetEmptyFinalResultsL( RNSmlDmFwObjectArray& aArray, + const TDesC8& aServerId ); + + /** + * Fetches the PkgName field of a firmware object from database. + * @param aId The identifier of the object, whose data should be fetched. + * @return The value in PkgName field of the object, if object was found. + * NULL otherwise. + */ + HBufC8* PkgNameL( const TNSmlDmFwObjectId aId ); + + /** + * Fetches the PkgVersion field of a firmware object from database. + * @param aId The identifier of the object, whose data should be fetched. + * @return The value in PkgVersion field of the object, if object was found. + * NULL otherwise. + */ + HBufC8* PkgVersionL( const TNSmlDmFwObjectId aId ); + + /** + * Fetches the PkgURL field of a firmware object from database. + * @param aId The identifier of the object, whose data should be fetched. + * @return The value in PkgURL field of the object, if object was found. + * NULL otherwise. + */ + HBufC8* PkgUrlL( const TNSmlDmFwObjectId aId ); + + /** + * Fetches the MgmtURI field of a firmware object from database. + * @param aId The identifier of the object, whose data should be fetched. + * @return The value in MgmtURI field of the object, if object was found. + * NULL otherwise. + */ + HBufC8* MgmtUriL( const TNSmlDmFwObjectId aId ); + + /** + * Fetches the ProfileId field of a firmware object from database. + * @param aId The identifier of the object, whose data should be fetched. + * @return The value in ProfileId field of the object, if object was found. + * KErrNotFound otherwise. + */ + TSmlProfileId ProfileIdL( const TNSmlDmFwObjectId aId ); + + /** + * Fetches the ServerId field of a firmware object from database. + * @param aId The identifier of the object, whose data should be fetched. + * @return The value in ServerId field of the object, if object was found. + * NULL otherwise. + */ + HBufC8* ServerIdL( const TNSmlDmFwObjectId aId ); + + /** + * Fetches the FinalResult field of a firmware object from database. + * @param aId The identifier of the object, whose data should be fetched. + * @return The value in FinalResult field of the object, if object was + * found. KErrNotFound otherwise. + */ + TInt FinalResultL( const TNSmlDmFwObjectId aId ); + + /** + * Fetches the Correlator field of a firmware object from database. + * @param aId The identifier of the object, whose data should be fetched. + * @return The value in Correlator field of the object, if object was + * found. NULL otherwise. + */ + HBufC8* CorrelatorL( const TNSmlDmFwObjectId aId ); + + /** + * Sets the value of PkgName field of a firmware object. + * @param aName The new value for the field. + * @param aId The identifier of the object, whose data should be updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. KErrOverflow, if given name is too large for the + * database. + */ + TInt SetPkgNameL( const TDesC8& aName, const TNSmlDmFwObjectId aId ); + + /** + * Sets the value of PkgVersion field of a firmware object. + * @param aVersion The new value for the field. + * @param aId The identifier of the object, whose data should be updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. KErrOverflow, if given version is too large + * for the database. + */ + TInt SetPkgVersionL( const TDesC8& aVersion, const TNSmlDmFwObjectId aId ); + + /** + * Sets the value of PkgURL field of a firmware object. + * @param aUrl The new value for the field. + * @param aId The identifier of the object, whose data should be updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. KErrOverflow, if given url is too large for the + * database. + */ + TInt SetPkgUrlL( const TDesC8& aUrl, const TNSmlDmFwObjectId aId ); + + /** + * Sets the value of MgmtURI field of a firmware object. + * @param aUri The new value for the field. + * @param aId The identifier of the object, whose data should be updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. KErrOverflow, if given uri is too large for the + * database. + */ + TInt SetMgmtUriL( const TDesC8& aUri, const TNSmlDmFwObjectId aId ); + + /** + * Sets the values of ProfileId and ServerId fields of a firmware object. + * @param aProfile The new value for the ProfileId. + * @param aServerId The new value for the ServerId. + * @param aId The identifier of the object, whose data should be updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. KErrOverflow, if given server id is too large + * for the database. + */ + TInt SetServerInfoL( const TSmlProfileId aProfile, + const TDesC8& aServerId, + const TNSmlDmFwObjectId aId ); + + /** + * Sets the value of FinalResult field of a firmware object. + * @param aResult The new value for the field. + * @param aId The identifier of the object, whose data should be updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. + */ + TInt SetFinalResultL( const TInt aResult, const TNSmlDmFwObjectId aId ); + + /** + * Sets the value of Correlator field of a firmware object. + * @param aCorrelator The new value for the field. + * @param aId The identifier of the object, whose data should be updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. KErrOverflow, if given correlator is too large + * for the database. + */ + TInt SetCorrelatorL( const TDesC8& aCorrelator, + const TNSmlDmFwObjectId aId ); + +private: + + /** + * Creates Fota database. + * @param aFullName Name and path of database. + */ + void CreateDatabaseL( const TDesC& aFullName ); + + /** + * Sets new value to a text field in a firmware object. This method is used + * by the public descriptor setters. + * @param aColumn The name of the field to be updated. + * @param aValue The new value for the field. + * @param aObject The identifier of the object, whose data should be + * updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. + */ + TInt SetStrValueL( const TDesC& aColumn, + const TDesC8& aValue, + const TNSmlDmFwObjectId aObject ); + + /** + * Writes using Db streams the new value to a long text field in a + * firmware object. This method is used by the public descriptor + * setters (PkgURL). + * @param aColumn The name of the field to be updated. + * @param aValue The new value for the field. + * @param aObject The identifier of the object, whose data should + * be updated. + * @return KErrNone, if the update was successful. KErrNotFound, if + * the object was not found. + */ + TInt SetLongStrValueL( const TDesC& aColumn, + const TDesC8& aValue, + const TNSmlDmFwObjectId aObject ); + + /** + * Sets new value to a integer field in a firmware object. This method + * is used by the public integer setters. + * @param aColumn The name of the field to be updated. + * @param aValue The new value for the field. + * @param aObject The identifier of the object, whose data should be + * updated. + * @return KErrNone, if the update was successful. KErrNotFound, if the + * object was not found. + */ + TInt SetIntValueL( const TDesC& aColumn, + const TInt aValue, + const TNSmlDmFwObjectId aObject ); + + /** + * Fetches the value in a text field of a firmware object. This method is + * used by the public descriptor getters. + * @param aColumn The name of the field where the data should be fetched. + * @param aObject The identifier of the object, whose data should be + * fetched. + * @return The value in the field, if object was found. NULL otherwise. + */ + HBufC8* StrValueL( const TDesC& aColumn, const TNSmlDmFwObjectId aObject ); + + /** + * Fetches the value in a long text field of a firmware object using Db + * streams. This method is used by the public descriptor getters (PkgURL). + * @param aColumn The name of the field where the data should be fetched. + * @param aObject The identifier of the object, whose data should be + * fetched. + * @return The value in the field, if object was found. NULL otherwise. + */ + HBufC8* LongStrValueL( const TDesC& aColumn, + const TNSmlDmFwObjectId aObject ); + + /** + * Fetches the value in a integer field of a firmware object. This method + * is used by the public integer getters. + * @param aColumn The name of the field where the data should be fetched. + * @param aObject The identifier of the object, whose data should be + * fetched. + * @return The value in the field, if object was found. KErrNotFound + * otherwise. + */ + TInt IntValueL( const TDesC& aColumn, const TNSmlDmFwObjectId aObject ); + + /** + * Prepares iView with read-only access rights to a single firmware object. + * @param aObject The identifier of the object, whose data is about + * to be read. + */ + void FetchRowL( const TNSmlDmFwObjectId aObject ); + + /** + * Prepares iView with update access rights to a single firmware object. + * @param aObject The identifier of the object, whose data is about to + * be updated. + * @return KErrNone, if there were no errors and iView was successfully + * prepared. + * KErrNotFound, if the firmware object was not found. + */ + TInt UpdateRowL( const TNSmlDmFwObjectId aObject ); + + /** + * Makes an SQL query string for getting a row from FwMgmtObject table. + * @param aId The identifier of the object, which is used in the SQL query. + * @return A string containing the formatted SQL query. + */ + HBufC* FwMgmtObjectRowSqlLC( TNSmlDmFwObjectId aId ) const; + + /** + * Closes the view and then prepares it with the given values. + * @param aSql SQL statement defining the view, which is prepared by + * this method. + * @param aAccess Permitted operations for the view. + */ + void PrepareViewL( const TDesC& aSql, RDbRowSet::TAccess aAccess ); + + /** + * Commits update and compacts the database. + */ + void CommitAndCompact(); + + /** + * Converts a 8-bit descriptor to a 16-bit descriptor, which is allocated + * from heap and pushed onto the CleanupStack. + * @param aDes Descriptor to be converted. + * @return A pointer to the newly allocated copy. + */ + HBufC* ConvertTo16BitLC( const TDesC8& aDes ) const; + + /** + * Second phase construction. + */ + void ConstructL(); + + /** + * Constructor. + */ + CNSmlDmFotaAdapterDb(); + +private: + + RDbNamedDatabase iDatabase; + RFs iFsSession; + RDbs iRdbSession; + + RDbTable iFwObjectTable; + CDbColSet* iColSet; + RDbView iView; + + }; + + +#endif // __NSMLDMFOTAADAPTERDB_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/src/101F9A02.SPD Binary file omadmadapters/fota/src/101F9A02.SPD has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/src/nsmldmfotaadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/src/nsmldmfotaadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,1605 @@ +/* +* 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 Fota Adapter +* +*/ + + + + +// INCLUDE FILES +#include // For TImplementationProxy definition +//#ifdef RD_OMADMAPPUI_UI_EVOLUTION +#include +//#endif +#include +#include +#include +#include +#include "fotaadapterCRKeys.h" +#include "NSmlPrivateAPI.h" +#include "nsmldmimpluids.h" +#include "nsmldmfotaadapter.h" +#include "nsmldmconst.h" +#include "nsmldebug.h" +#include "FotaSrvDebug.h" +#include "nsmldmtreedbclient.h" +#include + +// =========================== MEMBER FUNCTIONS ============================== + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter* CNSmlDmFotaAdapter::NewL() +// Creates new instance of CNSmlDmFotaEngine and returns a pointer to it. +// --------------------------------------------------------------------------- +// +CNSmlDmFotaAdapter* CNSmlDmFotaAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmFotaAdapter::NewL(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::NewL >>")); + CNSmlDmFotaAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop( self ); + _DBG_FILE("CNSmlDmFotaAdapter::NewL(): end"); + FLOG(_L("CNSmlDmFotaAdapter::NewL <<")); + return self; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter* CNSmlDmFotaAdapter::NewLC() +// Creates new instance of CNSmlDmFotaEngine and returns a pointer to it. +// Leaves the pointer onto the CleanupStack. +// --------------------------------------------------------------------------- +// +CNSmlDmFotaAdapter* CNSmlDmFotaAdapter::NewLC( MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmFotaAdapter::NewLC(): begin"); + CNSmlDmFotaAdapter* self = new (ELeave) CNSmlDmFotaAdapter( aDmCallback ); + CleanupStack::PushL( self ); + self->ConstructL(); + _DBG_FILE("CNSmlDmFotaAdapter::NewLC(): end"); + return self; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::CNSmlDmFotaAdapter() +// Constructor. +// --------------------------------------------------------------------------- +// +CNSmlDmFotaAdapter::CNSmlDmFotaAdapter( TAny* aEcomArguments ) + : CSmlDmAdapter( aEcomArguments ), iPkgId( KNSmlDMFotaNullPkgId ) + { + _DBG_FILE("CNSmlDmFotaAdapter::CNSmlDmFotaAdapter(): begin"); + _DBG_FILE("CNSmlDmFotaAdapter::CNSmlDmFotaAdapter(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::ConstructL() +// Second phase construction. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::ConstructL() + { + // Check if Fota feature is defined + TInt value( 0 ); + CRepository * rep = CRepository::NewLC( KCRUidFotaAdapter ); + TInt err = rep->Get( KCRFotaAdapterEnabled, value ); + CleanupStack::PopAndDestroy( rep ); + + if ( err != KErrNone || value == 0 ) + { + User::Leave( KErrNotSupported ); + } + + iFotaDb = CNSmlDmFotaAdapterDb::NewL(); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::~CNSmlDmFotaAdapter() +// Destructor. +// --------------------------------------------------------------------------- +// +CNSmlDmFotaAdapter::~CNSmlDmFotaAdapter() + { + _DBG_FILE("CNSmlDmFotaAdapter::~CNSmlDmFotaAdapter(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::~CNSmlDmFotaAdapter >>")); + + if (iFotaEngine.Handle()) + iFotaEngine.Close(); + + delete iFotaDb; + FLOG(_L("CNSmlDmFotaAdapter::~CNSmlDmFotaAdapter <<")); + _DBG_FILE("CNSmlDmFotaAdapter::~CNSmlDmFotaAdapter(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::DDFVersionL() +// Returns the DDF version of the adapter. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + _DBG_FILE("CNSmlDmFotaAdapter::DDFVersionL(TDes& aDDFVersion): begin"); + + aDDFVersion.InsertL( 0, KNSmlDMFotaDDFVersion ); + + _DBG_FILE("CNSmlDmFotaAdapter::DDFVersionL(TDes& aDDFVersion): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::DDFStructureL() +// Builds the DDF structure of adapter. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CNSmlDmFotaAdapter::DDFStructureL(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::DDFStructureL >>")); + TSmlDmAccessTypes accessTypes; + + // fota root + MSmlDmDDFObject& FUMO = aDDF.AddChildObjectL( KNSmlDMFotaNode ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + FillNodeInfoL( FUMO, + accessTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, + KNSmlDMFotaNodeDescription ); + + accessTypes.Reset(); + + // run time node + MSmlDmDDFObject& rtPkg = FUMO.AddChildObjectGroupL(); + rtPkg.AddDFTypeMimeTypeL( KNSmlDMFotaRunTimeMimeType ); + accessTypes.SetAdd(); + accessTypes.SetDelete(); + accessTypes.SetGet(); + //accessTypes.SetReplace(); + FillNodeInfoL( rtPkg, + accessTypes, + MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlDMFotaRunTimeNodeDescription ); + + accessTypes.Reset(); + + // /PkgName + MSmlDmDDFObject& name = rtPkg.AddChildObjectL( KNSmlDMFotaNodeName ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + FillNodeInfoL( name, + accessTypes, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDMFotaNodeNameDescription ); + + // /PkgVersion + MSmlDmDDFObject& version = rtPkg.AddChildObjectL( KNSmlDMFotaNodeVersion ); + FillNodeInfoL( version, + accessTypes, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDMFotaNodeVersionDescription ); + + accessTypes.Reset(); + + // /Download + MSmlDmDDFObject& download = + rtPkg.AddChildObjectL( KNSmlDMFotaNodeDownload ); + + accessTypes.SetGet(); + accessTypes.SetExec(); + FillNodeInfoL( download, + accessTypes, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlDMFotaNodeDownloadDescription ); + + accessTypes.Reset(); + + // /Download/PkgURL + MSmlDmDDFObject& dlUrl = + download.AddChildObjectL( KNSmlDMFotaNodeDownloadUrl ); + + accessTypes.SetGet(); + accessTypes.SetReplace(); + FillNodeInfoL( dlUrl, + accessTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDMFotaNodeDownloadUrlDescription ); + + accessTypes.Reset(); + + + // /DownloadAndUpdate + MSmlDmDDFObject& dlAndUpdate = + rtPkg.AddChildObjectL( KNSmlDMFotaNodeDownloadAndUpdate ); + + accessTypes.SetGet(); + accessTypes.SetExec(); + FillNodeInfoL( dlAndUpdate, + accessTypes, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, + KNSmlDMFotaNodeDownloadAndUpdateDescription ); + + accessTypes.Reset(); + + // /DownloadAndUpdate/PkgURL + MSmlDmDDFObject& dlAndUpdateUrl = + dlAndUpdate.AddChildObjectL( KNSmlDMFotaNodeDownloadAndUpdateUrl ); + + accessTypes.SetGet(); + accessTypes.SetReplace(); + FillNodeInfoL( dlAndUpdateUrl, + accessTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlDMFotaNodeDownloadAndUpdateUrlDescription ); + + accessTypes.Reset(); + + // /State + MSmlDmDDFObject& state = rtPkg.AddChildObjectL( KNSmlDMFotaNodeState ); + accessTypes.SetGet(); + FillNodeInfoL( state, + accessTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, + KNSmlDMFotaNodeStateDescription ); + + + + //Check cenrep for predefined node and add if its not in DB + CheckAndAddPredefinedNodeL(); + + // check if there is need to make generic alert(s), + // and generate them if there are + MakeGenericAlertsL(); + + + // Set ACL for fota root, if not yet set + RNSmlDMCallbackSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL(session); + + CBufBase* acl=CBufFlat::NewL(10); + CleanupStack::PushL( acl ); + session.GetAclL( KNSmlDMFotaNode,*acl,EFalse ); + + if( acl->Size() == 0 ) + { + _LIT8(KACLForAll, "Add=*&Get=*&Delete=*&Exec=*&Replace=*"); + session.UpdateAclL( KNSmlDMFotaNode, KACLForAll); + } + CleanupStack::PopAndDestroy( acl ); + CleanupStack::PopAndDestroy( &session ); + + _DBG_FILE("CNSmlDmFotaAdapter::DDFStructureL(): end"); + FLOG(_L("CNSmlDmFotaAdapter::DDFStructureL <<")); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::UpdateLeafObjectL() +// Updates value of leaf object. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::UpdateLeafObjectL(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::UpdateLeafObjectL >>")); + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + if ( aLUID.Length() > 0 ) + { + TInt res = KErrNotFound; + TNSmlDmFwObjectId id = DesToInt( aLUID ); + + TPtrC8 lastSeg = LastURISeg( aURI ); + if ( lastSeg == KNSmlDMFotaNodeName ) + { + res = iFotaDb->SetPkgNameL( aObject, id ); + } + else if ( lastSeg == KNSmlDMFotaNodeVersion ) + { + res = iFotaDb->SetPkgVersionL( aObject, id ); + } + else if ( lastSeg == KNSmlDMFotaNodeDownloadUrl || + lastSeg == KNSmlDMFotaNodeDownloadAndUpdateUrl ) + { + TInt configFlags( KErrNone ); + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) ); + if ( err == KErrNone && centrep ) + { + configFlags = 2; //means fota operation + centrep->Set( KDevManSessionType, configFlags ); + delete centrep; + centrep = NULL; + } + else + { + User::Leave( err ); + } + res = iFotaDb->SetPkgUrlL( aObject, id ); + } + // map error + status = MapErrorToStatus( res ); + } + else + { + // cannot update, object unknown + status = CSmlDmAdapter::ENotFound; + } +#ifdef __WINS__ +TInt pos=-1; +pos = aURI.Find(KNSmlDMFotaNodeDownload); + +if (status == CSmlDmAdapter::EOk && pos != KErrNotFound) + { + if ( aURI.Find(KNSmlDMFotaNodeDownloadAndUpdate) !=KErrNotFound) + ExecuteCommandL(_L8("./FUMO/FWUpdate/DownloadAndUpdate"),aLUID,aObject,_L8(""),status); + else + ExecuteCommandL(_L8("./FUMO/FWUpdate/Download"),aLUID,aObject,_L8(""),status); + } +#endif + + Callback().SetStatusL( aStatusRef, status ); + + _DBG_FILE("CNSmlDmFotaAdapter::UpdateLeafObjectL(): end"); + FLOG(_L("CNSmlDmFotaAdapter::UpdateLeafObjectL <<")); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::DeleteObjectL() +// Deletes a firmware object from Fota database. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::DeleteLeafObjectL( ): begin"); + FLOG(_L("CNSmlDmFotaAdapter::DeleteObjectL >>")); + + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + if ( ( aURI.Match( KNSmlDMFotaRuntimeMatch ) != KErrNotFound ) && + ( aLUID.Length() > 0 ) ) + { + TBuf8 temp; + GetPredefinedNodeL(temp); + TBuf8 node[4]; + TInt location = temp.LocateReverse(','); + node[0].Copy(temp.Mid(location+1)); + TInt newLocation = (temp.Left(location-1)).LocateReverse(','); + node[1].Copy(temp.Mid(newLocation+1,location-(newLocation+1))); + location = newLocation; + newLocation = (temp.Left(location-1)).LocateReverse(','); + node[2].Copy(temp.Mid(newLocation+1,location-(newLocation+1))); + node[3].Copy(temp.Mid(0,newLocation )); + for(TInt i =0 ; i<4; i++) + { + if (node[i].Length() && aURI.Find( node[i] ) != KErrNotFound) + { + status = CSmlDmAdapter::ENotAllowed; + Callback().SetStatusL( aStatusRef, status ); + return; + } + } + // delete object identified by aLUID + TNSmlDmFwObjectId id = DesToInt( aLUID ); + TInt res = iFotaDb->DeleteFwObjectL( id ); + + if ( res == KErrNone ) + { + // deletion was successful, delete also from Fota Engine + FotaEngineL().DeleteUpdatePackage( id ); + } + else + { + status = MapErrorToStatus( res ); + } + } + else + { + // object unknown + status = CSmlDmAdapter::ENotFound; + } + + Callback().SetStatusL( aStatusRef, status ); + + _DBG_FILE("CNSmlDmFotaAdapter::DeleteLeafObjectL( ): end"); + FLOG(_L("CNSmlDmFotaAdapter::DeleteObjectL <<")); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::FetchLeafObjectL() +// Fetches the values of leaf objects. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::FetchLeafObjectL(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::FetchLeafObjectL >>")); + // buffer for result + CBufBase* result = CBufFlat::NewL( KNSmlDMFotaResultBufferExpandSize ); + CleanupStack::PushL( result ); + + // fetch data + CSmlDmAdapter::TError status = DoFetchObjectL( aURI, aLUID, *result ); + if ( status == CSmlDmAdapter::EOk ) + { + Callback().SetResultsL( aResultsRef, *result, aType ); + } + + CleanupStack::PopAndDestroy( result ); + + Callback().SetStatusL( aStatusRef, status ); + + _DBG_FILE("CNSmlDmFotaAdapter::FetchLeafObjectL(): end"); + FLOG(_L("CNSmlDmFotaAdapter::FetchLeafObjectL <<")); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::ChildURIListL() +// Returns the list of children of a node. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::ChildURIListL(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::ChildURIListL >>")); + + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + TPtrC8 mimeType( KNullDesC8 ); + + // buffer for result + CBufBase* result = CBufFlat::NewL( KNSmlDMFotaResultBufferExpandSize ); + CleanupStack::PushL( result ); + + TPtrC8 lastSeg = LastURISeg( aURI ); + if ( lastSeg == KNSmlDMFotaNodeDownload && aLUID.Length() > 0 ) + { + // target is ./FUMO//Download + result->InsertL( 0, KNSmlDMFotaNodeDownloadUrl ); + } + else if ( lastSeg == KNSmlDMFotaNodeDownloadAndUpdate && aLUID.Length() > 0 ) + { + // target is ./FUMO//DownloadAndUpdate + result->InsertL( 0, KNSmlDMFotaNodeDownloadAndUpdateUrl ); + } + else if ( ( aURI.Match( KNSmlDMFotaRuntimeMatch ) != KErrNotFound ) + && ( TableExistsL( aLUID ) ) ) + { + // target is ./FUMO/ + result->InsertL( 0, KNSmlDMFotaRunTimeChildren ); + mimeType.Set( KNSmlDMFotaRunTimeMimeType ); + } + else if ( aURI.Match( KNSmlDMFotaRootMatch ) != KErrNotFound ) + { + // target is ./FUMO + + // return the children listed in aPreviousURISegmentList + TInt childCount = aPreviousURISegmentList.Count(); + for ( TInt i = 0; i < childCount - 1; ++i ) + { + result->InsertL( result->Size(), aPreviousURISegmentList[i].iURISeg ); + result->InsertL( result->Size(), KNSmlDMFotaSeparatorDes ); + } + + if ( childCount ) + { + // insert last child without separator + result->InsertL( result->Size(), + aPreviousURISegmentList[ childCount - 1 ].iURISeg ); + } + + } + else + { + // invalid target + status = CSmlDmAdapter::ENotFound; + } + + // set result, if it was found + if ( status == CSmlDmAdapter::EOk ) + { + Callback().SetResultsL( aResultsRef, *result, mimeType ); + } + + Callback().SetStatusL( aStatusRef, status ); + + CleanupStack::PopAndDestroy( result ); + + _DBG_FILE("CNSmlDmFotaAdapter::ChildURIListL(): end"); + FLOG(_L("CNSmlDmFotaAdapter::ChildURIListL <<")); + } + + + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::TableExistsL(const TDesC8& aLUID) const +// Checks if table exists +// --------------------------------------------------------------------------- +// +TBool CNSmlDmFotaAdapter::TableExistsL(const TDesC8& aLUID) const + { + TBool ret = EFalse; + if(aLUID.Length()>0) + { + TNSmlDmFwObjectId luid = DesToInt( aLUID ); + TSmlProfileId profileId = iFotaDb->ProfileIdL(luid); + if (profileId!=KErrNotFound) + { + ret = ETrue; + } + } + return ret; + } + +// +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::AddNodeObjectL() +// Adds new row to firmware object table in Fota database. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::AddNodeObjectL(): begin"); + + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + // Luid specified and it's a valid luid => already exists + if ( TableExistsL( aParentLUID ) ) + { + // the object has already been created and mapping set to DM Framework + status = CSmlDmAdapter::EAlreadyExists; + } + else if ( aURI.Match( KNSmlDMFotaRuntimeMatch ) != KErrNotFound ) + { + TInt configFlags( KErrNone ); + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) ); + if ( err == KErrNone && centrep ) + { + configFlags = 2; //means fota operation + centrep->Set( KDevManSessionType, configFlags ); + delete centrep; + centrep = NULL; + } + else + { + User::Leave( err ); + } + + + // add new FW object to db + TNSmlDmFwObjectId newId = KErrNotFound; + TRAP( err, newId = iFotaDb->AddFwObjectL() ); + + if ( err == KErrNone ) + { + // added ok + TBuf8 newLUID; + newLUID.AppendNum( newId ); + + Callback().SetMappingL( aURI, newLUID ); + } + else + { + status = MapErrorToStatus( err ); + } + + } + else + { + // error, invalid uri + status = CSmlDmAdapter::ENotFound; + } + + Callback().SetStatusL( aStatusRef, status ); +// if(status==CSmlDmAdapter::EOk) +// { +// TSmlProfileId profId = KErrNotFound; +// HBufC8* serverId = NULL; +// +// GetServerInfoL( profId, serverId ); +// +// if(serverId) +// { +// CleanupStack::PushL( serverId ); +// +// _LIT( KFotaAclAdd, "Add="); +// _LIT( KFotaAclGet, "Get="); +// _LIT( KFotaAclReplace, "Replace="); +// _LIT( KFotaAclDelete, "Delete="); +// _LIT( KFotaAclExec, "Exec="); +// _LIT( KFotaAclSeparator, "&"); +// _LIT( KFotaAclForAll, "*"); +// +// const TUint length = KFotaAclAdd().Length() + +// KFotaAclGet().Length() + +// KFotaAclReplace().Length() + +// KFotaAclDelete().Length() + +// KFotaAclExec().Length() + +// serverId->Length()*4 + +// 5; /* 4*'&'+ ''*' */ +// +// HBufC8* acl = HBufC8::NewLC(length); +// TPtr8 acltPtr = acl->Des(); +// acltPtr.Append(KFotaAclAdd); +// acltPtr.Append(*serverId); +// acltPtr.Append(KFotaAclSeparator); +// +// acltPtr.Append(KFotaAclGet); +// acltPtr.Append(*serverId); +// acltPtr.Append(KFotaAclSeparator); +// +// acltPtr.Append(KFotaAclReplace); +// acltPtr.Append(*serverId); +// acltPtr.Append(KFotaAclSeparator); +// +// acltPtr.Append(KFotaAclDelete); +// acltPtr.Append(KFotaAclForAll); +// acltPtr.Append(KFotaAclSeparator); +// +// acltPtr.Append(KFotaAclExec); +// acltPtr.Append(*serverId); +// +// RNSmlDMCallbackSession session; +// User::LeaveIfError( session.Connect() ); +// CleanupClosePushL(session); +// session.UpdateAclL(aURI,*acl); +// CleanupStack::PopAndDestroy( &session ); +// CleanupStack::PopAndDestroy( acl ); +// CleanupStack::PopAndDestroy( serverId ); +// } +// } + + _DBG_FILE("CNSmlDmFotaAdapter::AddNodeObjectL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::UpdateLeafObjectL() +// Updates a leaf object using streaming. In Fota adapter this method is used +// only to update PkgData of a firmware object. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + RWriteStream*& aStream, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::UpdateLeafObjectL(stream): begin"); + FLOG(_L("CNSmlDmFotaAdapter::UpdateLeafObjectL >>")); + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + + Callback().SetStatusL( aStatusRef, status ); + + _DBG_FILE("CNSmlDmFotaAdapter::UpdateLeafObjectL(stream): end"); + FLOG(_L("CNSmlDmFotaAdapter::UpdateLeafObjectL <<")); + } + +// --------------------------------------------------------------------------- +// void CNSmlDmFotaAdapter::FetchLeafObjectSizeL() +// Fetches data object and returns its size. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::FetchLeafObjectSizeL(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::FetchLeafObjectSizeL >>")); + // buffer for result + CBufBase* result = CBufFlat::NewL( KNSmlDMFotaResultBufferExpandSize ); + CleanupStack::PushL( result ); + + // fetch data + CSmlDmAdapter::TError status = DoFetchObjectL( aURI, aLUID, *result ); + if ( status == CSmlDmAdapter::EOk ) + { + // get size and form a string representation + TInt size = result->Size(); + TBuf8 sizeStr; + sizeStr.AppendNum( size ); + + // insert size to result + result->Reset(); + result->InsertL( 0, sizeStr ); + + Callback().SetResultsL( aResultsRef, *result, aType ); + } + + CleanupStack::PopAndDestroy( result ); + + Callback().SetStatusL( aStatusRef, status ); + + _DBG_FILE("CNSmlDmFotaAdapter::FetchLeafObjectSizeL(): end"); + FLOG(_L("CNSmlDmFotaAdapter::FetchLeafObjectSizeL <<")); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::ExecuteCommandL() +// Executes Update, Download or DownloadAndUpdate command depending on aURI. +// If aURI does not match to any of these, ENotFound is set as status. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::ExecuteCommandL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aArgument, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::ExecuteCommandL(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::ExecuteCommandL >>")); + //#ifdef RD_OMADMAPPUI_UI_EVOLUTION + TInt configFlags( 0 ); + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) ); + if ( centrep ) + { + centrep->Get( KDevManSessionType, configFlags ); + } + if ( err != KErrNone ) + { + User::Leave( err ); + } + else + { + configFlags = 1; + centrep->Set( KDevManSessionType, configFlags ); + } + if( centrep ) + { + delete centrep; + } + //#endif + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + if ( aLUID.Length() > 0 ) + { + TNSmlDmFwObjectId id = DesToInt( aLUID ); + + // uri should target Update, Download or DownloadAndUpdate + TPtrC8 lastSeg = LastURISeg( aURI ); + if ( lastSeg == KNSmlDMFotaNodeDownload || + lastSeg == KNSmlDMFotaNodeDownloadAndUpdate ) + { + + // save information about the execution and get profile id of + // currently running DM session + TSmlProfileId profId = 0; + TRAPD( err, profId = SaveExecInfoL( aURI, id, aArgument ) ); + + if ( err == KErrNone ) + { + if ( lastSeg == KNSmlDMFotaNodeDownload ) + { + // download + status = DoExecDownloadL( id, profId, EFalse ); + } + else if ( lastSeg == KNSmlDMFotaNodeDownloadAndUpdate ) + { + // download and update + status = DoExecDownloadL( id, profId, ETrue ); + } + + } + else + { + status = MapErrorToStatus( err ); + } + } + + } +#ifndef __WINS__ + Callback().SetStatusL( aStatusRef, status ); +#endif + _DBG_FILE("CNSmlDmFotaAdapter::ExecuteCommandL(): end"); + FLOG(_L("CNSmlDmFotaAdapter::ExecuteCommandL <<")); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::ExecuteCommandL() +// Not supported. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::ExecuteCommandL(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::ExecuteCommandL >>")); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + FLOG(_L("CNSmlDmFotaAdapter::ExecuteCommandL <<")); + _DBG_FILE("CNSmlDmFotaAdapter::ExecuteCommandL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::CopyCommandL() +// Not supported. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, + const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmFotaAdapter::CopyCommandL(): begin"); + + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + + _DBG_FILE("CNSmlDmFotaAdapter::CopyCommandL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::StartAtomicL() +// Not supported. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::StartAtomicL() + { + _DBG_FILE("CNSmlDmFotaAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlDmFotaAdapter::StartAtomicL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::CommitAtomicL() +// Not supported. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::CommitAtomicL() + { + _DBG_FILE("CNSmlDmFotaAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlDmFotaAdapter::CommitAtomicL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::RollbackAtomicL() +// Not supported. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::RollbackAtomicL() + { + _DBG_FILE("CNSmlDmFotaAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlDmFotaAdapter::RollbackAtomicL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::StreamingSupport() +// Returns whether or not streaming is supported in this adapter. +// In Fota this method is also used to enquire whether or not a large object +// whose size is given in aItemSize fits to disk (OOD check using Fota Engine), +// and to acknowledge that Generic Alerts have been sent succesfully to remote +// server. If aItemSize is larger that 0, OOD check feature is executed. +// If aItemSize equals to KNSmlDMResetGenAlerts, Generic Alerts are marked +// sent. Otherwise aItemSize is set to a treshold value, which is used by +// DM Host Server to determineif streaming should be used (large object) +// or not. +// --------------------------------------------------------------------------- +// +TBool CNSmlDmFotaAdapter::StreamingSupport( TInt& aItemSize ) + { + _DBG_FILE("CNSmlDmFotaAdapter::StreamingSupport(): begin"); + FLOG(_L("CNSmlDmFotaAdapter::StreamingSupport, ITEM = %d >>"), aItemSize); + TBool ret (EFalse); + if ( aItemSize == KNSmlDMResetGenAlerts ) + { + // generic alerts have been sent successfully to this server + TRAPD( err, MarkGenericAlertsSentL() ); + if(err) + { + _DBG_FILE("CNSmlDmFotaAdapter::StreamingSupport(): error in MarkGenricAlertSentL()"); + } + ret = ETrue; + } + + _DBG_FILE("CNSmlDmFotaAdapter::StreamingSupport(): end"); + FLOG(_L("CNSmlDmFotaAdapter::StreamingSupport <<")); + return ret; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::StreamCommittedL() +// Notification method used by DM Host Server. All data has been written to +// stream successfully and stream has been committed and closed. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::StreamCommittedL() + { + _DBG_FILE("CNSmlDmFotaAdapter::StreamCommittedL(): begin"); + + _DBG_FILE("CNSmlDmFotaAdapter::StreamCommittedL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::CompleteOutstandingCmdsL() +// Not supported. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::CompleteOutstandingCmdsL() + { + _DBG_FILE("CNSmlDmFotaAdapter::CompleteOutstandingCmdsL(): begin"); + _DBG_FILE("CNSmlDmFotaAdapter::CompleteOutstandingCmdsL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::DoFetchObjectL() +// Fetches the data identified by aURI in FW object aLUID. Writes the data +// to aObject and returns status code according to the success of the fetch. +// --------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CNSmlDmFotaAdapter::DoFetchObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + CBufBase& aObject ) + { + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + if ( aLUID.Length() > 0 ) + { + HBufC8* data = NULL; + TNSmlDmFwObjectId id = DesToInt( aLUID ); + + // get correct data according to the last segment of the uri + TPtrC8 lastSeg = LastURISeg( aURI ); + if ( lastSeg == KNSmlDMFotaNodeName ) + { + data = iFotaDb->PkgNameL( id ); + } + else if ( lastSeg == KNSmlDMFotaNodeVersion ) + { + data = iFotaDb->PkgVersionL( id ); + } + else if ( lastSeg == KNSmlDMFotaNodeDownloadUrl || + lastSeg == KNSmlDMFotaNodeDownloadAndUpdateUrl ) + { + data = iFotaDb->PkgUrlL( id ); + } + else if ( lastSeg == KNSmlDMFotaNodeState ) + { + // state is fetched from fota engine + RFotaEngineSession::TState state = FotaEngineL().GetState( id ); + data = HBufC8::NewL( KNSmlFwMgmtObjectIntegerLength ); + data->Des().AppendNum( state ); + } + + // if data is fetched ok, set results + if ( data ) + { + CleanupStack::PushL( data ); + + aObject.InsertL( 0, *data ); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy( data ); + } + } + + return status; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::DoExecUpdateL() +// Gets needed data for Update from Fota DB and notifies Fota Engine that +// Update should be executed. Returns status according to the success of +// the method. +// --------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CNSmlDmFotaAdapter::DoExecUpdateL( + const TNSmlDmFwObjectId aLUID, + const TSmlProfileId aProfile ) + { + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + // get needed data from db for fota engine + HBufC8* pkgName = iFotaDb->PkgNameL( aLUID ); + CleanupStack::PushL( pkgName ); + + HBufC8* pkgVersion = iFotaDb->PkgVersionL( aLUID ); + CleanupStack::PushL( pkgVersion ); + + TInt error = KErrNone; + + if ( pkgName && pkgVersion ) + { + // notify fota engine to start update + error = FotaEngineL().Update( aLUID, aProfile, *pkgName, *pkgVersion ); + + // if immediate error occured, set final result to corresponding + // value so that generic alert is not sent + if ( error == KErrNotFound ) + { + // binary update package has not been downloaded yet -> not + // possible to update + status = CSmlDmAdapter::ENotFound; + iFotaDb->SetFinalResultL( KNSmlDMFotaUndefinedError, aLUID ); + } + else if ( error != KErrNone ) + { + // other error + status = CSmlDmAdapter::EError; + iFotaDb->SetFinalResultL( KNSmlDMFotaUndefinedError, aLUID ); + } + } + else + { + // fw object was not found + status = CSmlDmAdapter::ENotFound; + } + + CleanupStack::PopAndDestroy( pkgVersion ); + CleanupStack::PopAndDestroy( pkgName ); + + return status; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::DoExecDownloadL() +// Gets needed data for Download or DownloadAndUpdate from Fota DB and +// notifies Fota Engine that Download or DownloadAndUpdate should be executed. +// Returns status according to the success of the method. +// --------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CNSmlDmFotaAdapter::DoExecDownloadL( + const TNSmlDmFwObjectId aLUID, + const TSmlProfileId aProfile, + TBool aUpdate ) + { + CSmlDmAdapter::TError status = CSmlDmAdapter::EOk; + + // get needed data from db for fota engine + HBufC8* url = iFotaDb->PkgUrlL( aLUID ); + CleanupStack::PushL( url ); + + HBufC8* pkgName = iFotaDb->PkgNameL( aLUID ); + CleanupStack::PushL( pkgName ); + + HBufC8* pkgVersion = iFotaDb->PkgVersionL( aLUID ); + CleanupStack::PushL( pkgVersion ); + + TInt error = KErrNone; + + if ( url && pkgName && pkgVersion ) + { + TBool silent (EFalse); + TInt value (ENonSilent); + RProperty::Get(KPSUidNSmlSOSServerKey, KNSmlDMSilentJob, value); + + if (value == ESilent) + { + silent = ETrue; + FLOG(_L("Session type is silent")); + } + if ( aUpdate ) + { + // notify fota engine to start download and update + error = FotaEngineL().DownloadAndUpdate( aLUID, *url, aProfile, *pkgName, *pkgVersion,silent ); + } + else + { + // notify fota engine to start download + error = FotaEngineL().Download( aLUID, *url, aProfile, *pkgName, *pkgVersion, silent ); + } + + // if immediate error occured, set final result to corresponding value so that + // generic alert is not sent + if ( error == KErrArgument ) + { + // url incorrectly formed + status = CSmlDmAdapter::EInvalidObject; + iFotaDb->SetFinalResultL( KNSmlDMFotaBadUrl, aLUID ); + } + else if ( error != KErrNone ) + { + // other error + status = CSmlDmAdapter::EError; + iFotaDb->SetFinalResultL( KNSmlDMFotaUndefinedError, aLUID ); + } + } + else + { + // fw object was not found + status = CSmlDmAdapter::ENotFound; + } + + CleanupStack::PopAndDestroy( pkgVersion ); + CleanupStack::PopAndDestroy( pkgName ); + CleanupStack::PopAndDestroy( url ); + + return status; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::SaveExecInfoL() +// Saves the values needed when starting an exec command. Returns the saved +// profile id. +// --------------------------------------------------------------------------- +// +TSmlProfileId CNSmlDmFotaAdapter::SaveExecInfoL( const TDesC8& aURI, + const TNSmlDmFwObjectId aLUID, + const TDesC8& aCorrelator ) + { + // set final result (null), uri and correlator to fota db + User::LeaveIfError( iFotaDb->SetFinalResultL( KNSmlFotaNullResult, aLUID ) ); + User::LeaveIfError( iFotaDb->SetMgmtUriL( aURI, aLUID ) ); + User::LeaveIfError( iFotaDb->SetCorrelatorL( aCorrelator, aLUID ) ); + + // fetch profile id and server id of the currently running dm session + TSmlProfileId profId = KErrNotFound; + HBufC8* serverId = NULL; + + GetServerInfoL( profId, serverId ); + CleanupStack::PushL( serverId ); + + // save profile id and server id to fota db + User::LeaveIfError( iFotaDb->SetServerInfoL( profId, *serverId, aLUID ) ); + + CleanupStack::PopAndDestroy( serverId ); + + return profId; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::GetServerInfoL() +// Fetches profile id and server id of the currently running dm session. +// Data is fetched using Client API and set to the references given as +// parameters. Reallocates server id to aServerId. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::GetServerInfoL( TSmlProfileId& aProfId, + HBufC8*& aServerId ) const + { + // Open session + RSyncMLSession session; + session.OpenL(); + CleanupClosePushL( session ); + + // get current job's id (and usage type) + TSmlJobId jobId = KErrNotFound; + TSmlUsageType type = ESmlDevMan; + session.CurrentJobL( jobId, type ); + + // open currently running job + RSyncMLDevManJob dmJob; + dmJob.OpenL( session, jobId ); + CleanupClosePushL( dmJob ); + + // get job's profile id + aProfId = dmJob.Profile(); + + // open profile using id in read-only mode + RSyncMLDevManProfile dmProf; + dmProf.OpenL( session, aProfId, ESmlOpenRead ); + CleanupClosePushL( dmProf ); + + // get profile's server id + aServerId = dmProf.ServerId().AllocL(); + + // close handles + CleanupStack::PopAndDestroy( &dmProf ); + CleanupStack::PopAndDestroy( &dmJob ); + CleanupStack::PopAndDestroy( &session ); + } +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::CheckAndAddPredefinedNodeL() +// Checks if predefined node for FUMO is in tree if not add to the tree +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::CheckAndAddPredefinedNodeL() + { + + TBuf8 temp; + GetPredefinedNodeL(temp); + if (temp.Length()) + { + RNSmlDMCallbackSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL(session); + TBuf8 node[4]; + TInt location = temp.LocateReverse(','); + node[0].Copy(temp.Mid(location+1)); + TInt newLocation = (temp.Left(location-1)).LocateReverse(','); + node[1].Copy(temp.Mid(newLocation+1,location-(newLocation+1))); + location = newLocation; + newLocation = (temp.Left(location-1)).LocateReverse(','); + node[2].Copy(temp.Mid(newLocation+1,location-(newLocation+1))); + node[3].Copy(temp.Mid(0,newLocation )); + for(TInt i=0; i<4; i++) + { + TBuf8 temp1; + temp1.Zero(); + temp1.Copy(KNSmlDMFotaNode); + temp1.Append(KNSmlDMFotaSeparatorDes); + temp1.Append(node[i]); + HBufC8* luid = session.GetLuidAllocL( KNSmlDMFotaAdapterImplUid,temp1); + CleanupStack::PushL(luid); + if ( luid->Length() > 0 ) + { + CleanupStack::PopAndDestroy( luid ); + CleanupStack::PopAndDestroy( &session ); + return; + } + else + { + // Add the mapping + TNSmlDmFwObjectId newId = KErrNotFound; + TRAPD( err, newId = iFotaDb->AddFwObjectL() ); + + if ( err == KErrNone ) + { + // added ok + TBuf8 newLUID; + newLUID.AppendNum( newId ); + session.AddMappingInfoL(KNSmlDMFotaAdapterImplUid, temp1, newLUID ); + } + } + CleanupStack::PopAndDestroy( luid ); + } + CleanupStack::PopAndDestroy( &session ); + } + } +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::GetPredefinedNodeL() +// Gets predefined node for FUMO from cenrep +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::GetPredefinedNodeL(TDes8& aNode) + { + CRepository* centrep( NULL); + aNode.Zero(); + centrep = CRepository::NewLC( TUid::Uid(0x101F9A0A) ); + + if ( centrep ) + { + TFullName temp; + + if (centrep->Get( KDevManFUMOPredefinedNodes, temp )==KErrNone && temp.Length() ) + { + temp.Trim(); + aNode.Copy(temp); + } + CleanupStack::PopAndDestroy(centrep); + } + } +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::MakeGenericAlertsL() +// Checks whether or not there are fw objects whose final result should be +// sent to the remote server which is involved with the current DM session. +// If there are such objects, notifies private api using the data needed for +// generic alert generation. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::MakeGenericAlertsL() + { + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL >>")); + // search for fw objects that have empty final result + RNSmlDmFwObjectArray ids; + CleanupClosePushL( ids ); + + iFotaDb->GetEmptyFinalResultsL( ids ); + if ( ids.Count() == 0 ) + { + // none found, no need for generic alerts + CleanupStack::PopAndDestroy( &ids ); + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL 1")); + return; + } + + // get information of the remote DM server + TSmlProfileId profId = 0; + HBufC8* serverId = NULL; + GetServerInfoL( profId, serverId ); + CleanupStack::PushL( serverId ); + + // open handle to private api + RNSmlPrivateAPI privateAPI; + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL 2")); + privateAPI.OpenL(); + CleanupClosePushL( privateAPI ); + + // go through all objects in ids + for ( TInt i = 0; i < ids.Count(); ++i ) + { + // check that server ids match. if not, move to next entry + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL 3")); + HBufC8* fwServerId = iFotaDb->ServerIdL( ids[i] ); + CleanupStack::PushL( fwServerId ); + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL 4")); + if ( *serverId == *fwServerId ) + { + // check that mgmt uri is not empty string. if it is, + // move to next entry + HBufC8* fwMgmtUri = iFotaDb->MgmtUriL( ids[i] ); + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL 5")); + CleanupStack::PushL( fwMgmtUri ); + + if ( *fwMgmtUri != KNullDesC8 ) + { + // check that update has reached its final result + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL 6")); + TInt finalResult = FotaEngineL().GetResult( ids[i] ); + + RFotaEngineSession::TState finalState = FotaEngineL().GetState( ids[i] ); + + if ( finalResult != KErrNotFound && finalState != RFotaEngineSession::EStartingUpdate) + { + // get fw object's correlator + HBufC8* fwCorrelator = iFotaDb->CorrelatorL( ids[i] ); + CleanupStack::PushL( fwCorrelator ); + + // add generic alert to dm message + TPtrC8 metaType = GetMetaType( *fwMgmtUri ); + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL 7")); + privateAPI.AddDMGenericAlertRequestL( *fwMgmtUri, metaType, KNSmlDMFotaMetaFormat, finalResult, *fwCorrelator ); + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL 8")); + CleanupStack::PopAndDestroy( fwCorrelator ); + } + } + + CleanupStack::PopAndDestroy( fwMgmtUri ); + } + + CleanupStack::PopAndDestroy( fwServerId ); + } + + CleanupStack::PopAndDestroy( &privateAPI ); + CleanupStack::PopAndDestroy( serverId ); + CleanupStack::PopAndDestroy( &ids ); + FLOG(_L("CNSmlDmFotaAdapter::MakeGenericAlertsL <<")); + + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::MarkGenericAlertsSentL() +// Puts a final result value to those fw objects, that are +// associated with current DM session's remote server, have +// been a target to an exec command and the exec command has +// finished. I.e. Generic Alert has been sent to remote server +// reporting the results of these exec commands --> not needed to +// send Generic Alert anymore in next DM session. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::MarkGenericAlertsSentL() + { + + FLOG(_L("CNSmlDmFotaAdapter::MarkGenericAlertsSentL >>")); + + // search for fw objects that have empty final result + RNSmlDmFwObjectArray ids; + CleanupClosePushL( ids ); + + // get information of the remote DM server + TSmlProfileId profId = 0; + HBufC8* serverId = NULL; + GetServerInfoL( profId, serverId ); + CleanupStack::PushL( serverId ); + + FLOG(_L("CNSmlDmFotaAdapter::MarkGenericAlertsSentL 1")); + iFotaDb->GetEmptyFinalResultsL( ids, *serverId ); + + // go through all objects in ids + for ( TInt i = 0; i < ids.Count(); ++i ) + { + // check that update has reached its final result + FLOG(_L("CNSmlDmFotaAdapter::MarkGenericAlertsSentL 2")); + TInt finalResult = FotaEngineL().GetResult( ids[i] ); + if ( finalResult != KErrNotFound ) + { + // set final result thus setting generic alert sent + FLOG(_L("CNSmlDmFotaAdapter::MarkGenericAlertsSentL 3")); + iFotaDb->SetFinalResultL( finalResult, ids[i] ); + + // also notify fota engine, that generic alert has been + // successfully sent, thus enabling possible cleanup + FLOG(_L("CNSmlDmFotaAdapter::MarkGenericAlertsSentL, %d"), ids[i]); + FotaEngineL().GenericAlertSentL( ids[i] ); + } + } + + CleanupStack::PopAndDestroy( serverId ); + CleanupStack::PopAndDestroy( &ids ); + FLOG(_L("CNSmlDmFotaAdapter::MarkGenericAlertsSentL <<")); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::GetMetaType() +// Determines by the given uri which meta/type should be used in generic +// alert.Returns the correct type, or KNullDesC8 if uri does not match to +// exec targets. +// --------------------------------------------------------------------------- +// +TPtrC8 CNSmlDmFotaAdapter::GetMetaType( const TDesC8& aURI ) const + { + TPtrC8 lastSeg = LastURISeg( aURI ); + + if ( lastSeg == KNSmlDMFotaNodeDownload ) + { + return KNSmlDMFotaDownloadMetaType(); + } + else if ( lastSeg == KNSmlDMFotaNodeDownloadAndUpdate ) + { + return KNSmlDMFotaDownloadAndUpdateMetaType(); + } + + return KNullDesC8(); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::MapStatusToError() +// Returns a status code corresponding to the system error code given +// as parameter. +// --------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CNSmlDmFotaAdapter::MapErrorToStatus( TInt aError ) const + { + CSmlDmAdapter::TError err = CSmlDmAdapter::EError; + + switch( aError ) + { + case KErrNone: + err = CSmlDmAdapter::EOk; + break; + case KErrNotFound: + err = CSmlDmAdapter::ENotFound; + break; + case KErrDiskFull: + err = CSmlDmAdapter::EDiskFull; + break; + case KErrOverflow: + err = CSmlDmAdapter::ETooLargeObject; + break; + default: + break; + } + + return err; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::DesToInt() +// Converts a 8 bit descriptor to an integer. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapter::DesToInt( const TDesC8& aLUID ) const + { + TLex8 lex( aLUID ); + TInt value = KErrNotFound; + lex.Val( value ); + + return value; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::LastURISeg() +// Returns the last segment of the given uri. +// --------------------------------------------------------------------------- +// +TPtrC8 CNSmlDmFotaAdapter::LastURISeg( const TDesC8& aURI ) const + { + TInt pos = aURI.LocateReverse( KNSmlDMFotaSeparatorDes()[0] ); + if( pos == KErrNotFound ) + { + return aURI; + } + else + { + return aURI.Mid( pos + 1 ); + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::FillNodeInfoL() +// Fills the DDF node info. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + const TSmlDmAccessTypes& aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) const + { + aNode.SetAccessTypesL( aAccTypes ); + aNode.SetOccurenceL( aOccurrence ); + aNode.SetScopeL( aScope ); + aNode.SetDFFormatL( aFormat ); + + if( aFormat != MSmlDmDDFObject::ENode ) + { + aNode.AddDFTypeMimeTypeL( KNSmlDMFotaTextPlain ); + } + + aNode.SetDescriptionL( aDescription ); + } + +RFotaEngineSession& CNSmlDmFotaAdapter::FotaEngineL() + { + FLOG(_L("CNSmlDmFotaAdapter::FotaEngineL >>")); + if (!iFotaEngine.Handle()) + { + FLOG(_L("Opening fota engine...")); + iFotaEngine.OpenL(); + } + + FLOG(_L("CNSmlDmFotaAdapter::FotaEngineL <<")); + return iFotaEngine; + } +// --------------------------------------------------------------------------- +// 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(KNSmlDMFotaAdapterImplUid, CNSmlDmFotaAdapter::NewL) + }; + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// --------------------------------------------------------------------------- +// ImplementationGroupProxy() +// Needed because of ECOM architecture. +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmFotaAdapter: begin"); + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmFotaAdapter: end"); + return ImplementationTable; + } + + +// End of file + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/src/nsmldmfotaadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/src/nsmldmfotaadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,46 @@ +CHARACTER_SET UTF8/* +* 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: Resource data for Fota adapter +* +*/ + + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F9A08; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F9A09; // DM FOTA implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/fota/src/nsmldmfotaadapterdb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/fota/src/nsmldmfotaadapterdb.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,881 @@ +/* +* 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: Fota adapter's DB implementation file +* +*/ + + + + + +// INCLUDE FILES +#include +#include + +#include "nsmldmfotaadapterdb.h" +#include "nsmlconstants.h" +#include "nsmldebug.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 + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::NewL() +// Creates a new instance of CNSmlDmFotaAdapterDb object. +// --------------------------------------------------------------------------- +// +CNSmlDmFotaAdapterDb* CNSmlDmFotaAdapterDb::NewL() + { + _DBG_FILE("CNSmlDmFotaAdapterDb::NewL(): begin"); + + CNSmlDmFotaAdapterDb* self = CNSmlDmFotaAdapterDb::NewLC(); + CleanupStack::Pop( self ); + + _DBG_FILE("CNSmlDmFotaAdapterDb::NewL(): end"); + + return self; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::NewLC() +// Creates a new instance of CNSmlDmFotaAdapterDb object. +// Pushes and leaves new instance onto CleanupStack. +// --------------------------------------------------------------------------- +// +CNSmlDmFotaAdapterDb* CNSmlDmFotaAdapterDb::NewLC() + { + _DBG_FILE("CNSmlDmFotaAdapterDb::NewLC(): begin"); + + CNSmlDmFotaAdapterDb* self = new( ELeave ) CNSmlDmFotaAdapterDb(); + CleanupStack::PushL( self ); + self->ConstructL(); + + _DBG_FILE("CNSmlDmFotaAdapterDb::NewLC(): end"); + + return self; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::ConstructL() +// Second phase constructor. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapterDb::ConstructL() + { + _DBG_FILE("CNSmlDmFotaAdapterDb::ConstructL(): begin"); + + User::LeaveIfError( iFsSession.Connect() ); + User::LeaveIfError( iRdbSession.Connect() ); + iFsSession.SetSessionToPrivate( KNSmlFotaAdapterDbDrive ); + + TParse name; + +#ifdef SYMBIAN_SECURE_DBMS + name.Set( KNSmlFotaAdapterDbName(), NULL, NULL ); +#else + name.Set( KNSmlFotaAdapterDbName(), KNSmlDatabasesNonSecurePath, NULL ); +#endif + + TInt err = iDatabase.Open( iRdbSession, + name.FullName(), + KNSmlDBMSSecureMDHostOneID ); + if ( err == KErrNotFound ) + { + CreateDatabaseL( name.FullName() ); + err = iDatabase.Open( iRdbSession, + name.FullName(), + KNSmlDBMSSecureMDHostOneID ); + User::LeaveIfError( err ); + } + else + { + + if ( ( err == KErrEof ) || ( err == KErrCorrupt ) || + ( err == KErrArgument ) ) + { + // something seriously wrong with the db, delete it and try + // to create new + iRdbSession.DeleteDatabase( name.FullName(), + KNSmlDMHostOnePolicyUID ); + CreateDatabaseL( name.FullName() ); + err = iDatabase.Open( iRdbSession, + name.FullName(), + KNSmlDBMSSecureMDHostOneID ); + } + + User::LeaveIfError( err ); + } + + User::LeaveIfError( iFwObjectTable.Open( iDatabase, + KNSmlTableFwMgmtObject ) ); + iColSet = iFwObjectTable.ColSetL(); + + _DBG_FILE("CNSmlDmFotaAdapterDb::ConstructL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::CNSmlDmFotaAdapterDb() +// Constructor. +// --------------------------------------------------------------------------- +// +CNSmlDmFotaAdapterDb::CNSmlDmFotaAdapterDb() + { + _DBG_FILE("CNSmlDmFotaAdapterDb::CNSmlDmFotaAdapterDb(): begin"); + _DBG_FILE("CNSmlDmFotaAdapterDb::CNSmlDmFotaAdapterDb(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::~CNSmlDmFotaAdapterDb() +// Destructor. +// --------------------------------------------------------------------------- +// +CNSmlDmFotaAdapterDb::~CNSmlDmFotaAdapterDb() + { + _DBG_FILE("CNSmlDmFotaAdapterDb::~CNSmlDmFotaAdapterDb(): begin"); + + iView.Close(); + + delete iColSet; + iFwObjectTable.Close(); + + iDatabase.Close(); + iFsSession.Close(); + iRdbSession.Close(); + + _DBG_FILE("CNSmlDmFotaAdapterDb::~CNSmlDmFotaAdapterDb(): ends"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::AddFwObjectL() +// Inserts new uninitialized row to FwMgmtObject table and returns its id. +// --------------------------------------------------------------------------- +// +TNSmlDmFwObjectId CNSmlDmFotaAdapterDb::AddFwObjectL() + { + _DBG_FILE("CNSmlDmFotaAdapterDb::AddFwObjectL(): begin"); + + // Check OOD before inserting new row into FwMgmtObject table + if ( SysUtil::FFSSpaceBelowCriticalLevelL( &iFsSession, + KNSmlMaxFwMgmtObjectRowSize ) ) + { + User::Leave( KErrDiskFull ); + } + + iDatabase.Begin(); + + // Insert new row, and set finalt result to its null value + iFwObjectTable.InsertL(); + iFwObjectTable.SetColL( iColSet->ColNo( KNSmlFwMgmtObjectResult ), + KNSmlFotaNullResult ); + iFwObjectTable.PutL(); + + CommitAndCompact(); + + _DBG_FILE("CNSmlDmFotaAdapterDb::AddFwObjectL(): end"); + + return iFwObjectTable.ColUint( iColSet->ColNo( KNSmlFwMgmtObjectId ) ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::DeleteFwObjectL() +// Deletes a row from FwMgmtObject table identified by aId. If such row is +// not found, returns KErrNotFound, KErrNone otherwise. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::DeleteFwObjectL( const TNSmlDmFwObjectId aId ) + { + _DBG_FILE("CNSmlDmFotaAdapterDb::DeleteFwObjectL(): begin"); + + HBufC* sql = HBufC::NewL( KNSmlDeleteFwMgmtObject().Length() + + KNSmlFwMgmtObjectIntegerLength ); + sql->Des().Format( KNSmlDeleteFwMgmtObject, aId ); + + iDatabase.Begin(); + TInt result = iDatabase.Execute( *sql ); + CommitAndCompact(); + + delete sql; + + _DBG_FILE("CNSmlDmFotaAdapterDb::DeleteFwObjectL(): end"); + + return ( result == 0 ) ? KErrNotFound : KErrNone; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::GetEmptyFinalResultsL() +// Finds all the rows in FwMgmtObject table that have null final result and +// puts the PkgIds of those rows to aArray. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapterDb::GetEmptyFinalResultsL( RNSmlDmFwObjectArray& aArray ) + { + _DBG_FILE("CNSmlDmFotaAdapterDb::GetEmptyFinalResultsL(): begin"); + + aArray.Reset(); + + HBufC* sql = HBufC::NewLC( KNSmlGetUnfinishedFwMgmtObjects().Length() + + KNSmlFwMgmtObjectIntLength ); + sql->Des().Format( KNSmlGetUnfinishedFwMgmtObjects, KNSmlFotaNullResult ); + + PrepareViewL( *sql, iView.EReadOnly ); + + CleanupStack::PopAndDestroy( sql ); + + while ( iView.NextL() ) + { + // get final result and append it to aArray + iView.GetL(); + aArray.AppendL( iView.ColUint( + iColSet->ColNo( KNSmlFwMgmtObjectId ) ) ); + } + + _DBG_FILE("CNSmlDmFotaAdapterDb::GetEmptyFinalResultsL(): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::GetEmptyFinalResultsL() +// Finds all the rows in FwMgmtObject table that have null final result, +// server id equals to aServerId and management uri is not an empty string. +// Puts the PkgIds of those rows to aArray. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapterDb::GetEmptyFinalResultsL( RNSmlDmFwObjectArray& aArray, + const TDesC8& aServerId ) + { + _DBG_FILE("CNSmlDmFotaAdapterDb::GetEmptyFinalResultsL(serverid): begin"); + + aArray.Reset(); + + HBufC* serverId = ConvertTo16BitLC( aServerId ); + + HBufC* sql = HBufC::NewLC( + KNSmlGetUnfinishedFwMgmtObjectByServerId().Length() + + KNSmlFwMgmtObjectIntLength + + serverId->Length() ); + + sql->Des().Format( KNSmlGetUnfinishedFwMgmtObjectByServerId, + KNSmlFotaNullResult, + serverId ); + + PrepareViewL( *sql, iView.EReadOnly ); + + CleanupStack::PopAndDestroy( sql ); + CleanupStack::PopAndDestroy( serverId ); + + while ( iView.NextL() ) + { + // get final result and append it to aArray + iView.GetL(); + aArray.AppendL( iView.ColUint( + iColSet->ColNo( KNSmlFwMgmtObjectId ) ) ); + } + + _DBG_FILE("CNSmlDmFotaAdapterDb::GetEmptyFinalResultsL( serverid ): end"); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::PkgNameL() +// Returns the PkgName field from FW object identified by aId. If no such +// object is found, returns NULL. +// --------------------------------------------------------------------------- +// +HBufC8* CNSmlDmFotaAdapterDb::PkgNameL( const TNSmlDmFwObjectId aId ) + { + return StrValueL( KNSmlFwMgmtObjectName, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::PkgVersionL() +// Returns the PkgVersion field from FW object identified by aId. If no such +// object is found, returns NULL. +// --------------------------------------------------------------------------- +// +HBufC8* CNSmlDmFotaAdapterDb::PkgVersionL( const TNSmlDmFwObjectId aId ) + { + return StrValueL( KNSmlFwMgmtObjectVersion, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::PkgUrlL() +// Returns the PkgUrl field from FW object identified by aId. If no such +// object is found, returns NULL. +// --------------------------------------------------------------------------- +// +HBufC8* CNSmlDmFotaAdapterDb::PkgUrlL( const TNSmlDmFwObjectId aId ) + { + return LongStrValueL( KNSmlFwMgmtObjectUrl, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::MgmtUriL() +// Returns the MgmtUri field from FW object identified by aId. If no such +// object is found, returns NULL. +// --------------------------------------------------------------------------- +// +HBufC8* CNSmlDmFotaAdapterDb::MgmtUriL( const TNSmlDmFwObjectId aId ) + { + return StrValueL( KNSmlFwMgmtObjectMgmtUri, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::ProfileIdL() +// Returns the ProfileId field from FW object identified by aId. If no such +// object is found, returns KErrNotFound. +// --------------------------------------------------------------------------- +// +TSmlProfileId CNSmlDmFotaAdapterDb::ProfileIdL( const TNSmlDmFwObjectId aId ) + { + return IntValueL( KNSmlFwMgmtObjectProfileId, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::ServerIdL() +// Returns the ServerId field from FW object identified by aId. If no such +// object is found, returns NULL. +// --------------------------------------------------------------------------- +// +HBufC8* CNSmlDmFotaAdapterDb::ServerIdL( const TNSmlDmFwObjectId aId ) + { + return StrValueL( KNSmlFwMgmtObjectServerId, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::FinalResultL() +// Returns the FinalResult field from FW object identified by aId. If no such +// object is found, returns KErrNotFound. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::FinalResultL( const TNSmlDmFwObjectId aId ) + { + return IntValueL( KNSmlFwMgmtObjectResult, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::CorrelatorL() +// Returns the Correlator field from FW object identified by aId. If no such +// object is found, returns NULL. +// --------------------------------------------------------------------------- +// +HBufC8* CNSmlDmFotaAdapterDb::CorrelatorL( const TNSmlDmFwObjectId aId ) + { + return StrValueL( KNSmlFwMgmtObjectCorrelator, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetPkgNameL() +// Sets aName as the value of PkgName in FW object identified by aId. If no +// such object is found, returns KErrNotFound. If name is too large for the +// database, returns KErrOverflow. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetPkgNameL( const TDesC8& aName, + const TNSmlDmFwObjectId aId ) + { + if ( aName.Length() > KFotaMaxPkgNameLength ) + { + return KErrOverflow; + } + + return SetStrValueL( KNSmlFwMgmtObjectName, aName, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetPkgVersionL() +// Sets aVersion as the value of PkgVersion in FW object identified by aId. +// If no such object is found, returns KErrNotFound. If version is too +// large for the database, returns KErrOverflow. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetPkgVersionL( const TDesC8& aVersion, + const TNSmlDmFwObjectId aId ) + { + if ( aVersion.Length() > KFotaMaxPkgVersionLength ) + { + return KErrOverflow; + } + + return SetStrValueL( KNSmlFwMgmtObjectVersion, aVersion, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetPkgUrlL() +// Sets aUrl as the value of PkgURL in FW object identified by aId. If no +// such object is found, returns KErrNotFound. If url is too large for the +// database, returns KErrOverflow. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetPkgUrlL( const TDesC8& aUrl, + const TNSmlDmFwObjectId aId ) + { + if ( aUrl.Length() > KFotaMaxPkgURLLength ) + { + return KErrOverflow; + } + + return SetLongStrValueL( KNSmlFwMgmtObjectUrl, aUrl, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetMgmtUriL() +// Sets aUri as the value of MgmtURI in FW object identified by aId. If no +// such object is found, returns KErrNotFound. If uri is too large for the +// database, returns KErrOverflow. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetMgmtUriL( const TDesC8& aUri, + const TNSmlDmFwObjectId aId ) + { + if ( aUri.Length() > KNSmlMaxMgmtUriLength ) + { + return KErrOverflow; + } + + return SetStrValueL( KNSmlFwMgmtObjectMgmtUri, aUri, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetServerInfoL() +// Sets aProfileId as the value of ProfileId and aServerId as the value of +// ServerId in FW object identified by aId. If no such object is found, +// returns KErrNotFound. If server id is too large for the database, +// returns KErrOverflow. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetServerInfoL( const TSmlProfileId aProfile, + const TDesC8& aServerId, + const TNSmlDmFwObjectId aId ) + { + _DBG_FILE("CNSmlDmFotaAdapterDb::SetServerInfoL(): begin"); + + if ( aServerId.Length() > KNSmlMaxServerIdLength ) + { + return KErrOverflow; + } + + HBufC* serverId = ConvertTo16BitLC( aServerId ); + TInt ret = UpdateRowL( aId ); + + if ( ret == KErrNone ) + { + // do update + iView.SetColL( iColSet->ColNo( KNSmlFwMgmtObjectProfileId ), + aProfile ); + iView.SetColL( iColSet->ColNo( KNSmlFwMgmtObjectServerId ), + *serverId ); + iView.PutL(); + } + + CommitAndCompact(); + + CleanupStack::PopAndDestroy( serverId ); + + _DBG_FILE("CNSmlDmFotaAdapterDb::SetServerInfoL(): end"); + + return ret; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetFinalResultL() +// Sets aResult as the value of FinalResult in FW object identified by aId. +// If no such object is found, returns KErrNotFound. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetFinalResultL( const TInt aResult, + const TNSmlDmFwObjectId aId ) + { + return SetIntValueL( KNSmlFwMgmtObjectResult, aResult, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetCorrelatorL() +// Sets aCorrealtor as the value of Correlator in FW object identified by aId. +// If no such object is found, returns KErrNotFound. If given correlator is +// too large for the database, returns KErrOverflow. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetCorrelatorL( const TDesC8& aCorrelator, + const TNSmlDmFwObjectId aId ) + { + if ( aCorrelator.Length() > KNSmlMaxCorrelatorLength ) + { + return KErrOverflow; + } + + return SetStrValueL( KNSmlFwMgmtObjectCorrelator, aCorrelator, aId ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::CreateDatabaseL() +// Creates Fota database. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapterDb::CreateDatabaseL( const TDesC& aFullName ) + { + _DBG_FILE("CNSmlDmFotaAdapterDb::CreateDatabaseL(): begin"); + + // Check OOD before creating new Fota DB + if ( SysUtil::FFSSpaceBelowCriticalLevelL( &iFsSession, + KNSmlFotaAdapterEmptyDbSize ) ) + { + User::Leave( KErrDiskFull ); + } + + // create sql query string, 5 = amount of length integers used in Format() + HBufC* createFwMgmtTable = HBufC::NewLC( + KNSmlCreateFwMgmtObjectTable().Length() + + KNSmlFwMgmtObjectIntLength*5 ); + + createFwMgmtTable->Des().Format( KNSmlCreateFwMgmtObjectTable, + KFotaMaxPkgNameLength, + KFotaMaxPkgVersionLength, + KNSmlMaxMgmtUriLength, + KNSmlMaxServerIdLength, + KNSmlMaxCorrelatorLength ); + + User::LeaveIfError( iDatabase.Create( iRdbSession, + aFullName, + KNSmlDBMSSecureMDHostOneID ) ); + iDatabase.Begin(); + iDatabase.Execute( *createFwMgmtTable ); + + CommitAndCompact(); + iDatabase.Close(); + + CleanupStack::PopAndDestroy( createFwMgmtTable ); + + _DBG_FILE("CNSmlDmFotaAdapterDb::CreateDatabaseL(): end"); + } + + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetStrValueL() +// Sets aValue as the value of aColumn in FW object identified by aObject. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetStrValueL( const TDesC& aColumn, + const TDesC8& aValue, + const TNSmlDmFwObjectId aObject ) + { + _DBG_FILE("CNSmlDmFotaAdapterDb::SetStrValueL(): begin"); + + HBufC* value = ConvertTo16BitLC( aValue ); + + DBG_ARGS( _S16("CNSmlDmFotaAdapterDb::SetStrValueL(): ('%S', '%S', %d)"), + &aColumn, value, aObject ); + + TInt ret = UpdateRowL( aObject ); + + if ( ret == KErrNone ) + { + // do update + iView.SetColL( iColSet->ColNo( aColumn ), *value ); + iView.PutL(); + } + + CommitAndCompact(); + + CleanupStack::PopAndDestroy( value ); + + _DBG_FILE("CNSmlDmFotaAdapterDb::SetStrValueL(): end"); + + return ret; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetLongStrValueL() +// Streams aValue and its length as the value of aColumn in FW object +// identified by aObject. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetLongStrValueL( const TDesC& aColumn, + const TDesC8& aValue, + const TNSmlDmFwObjectId aObject ) + { + _DBG_FILE("CNSmlDmFotaAdapterDb::SetLongStrValueL(): begin"); + + HBufC* value = ConvertTo16BitLC( aValue ); + + DBG_ARGS( _S16("CNSmlDmFotaAdapterDb::SetStrValueL(): ('%S', '%S', %d)"), + &aColumn, value, aObject ); + + TInt ret = UpdateRowL( aObject ); + + if ( ret == KErrNone ) + { + // do update + + RDbColWriteStream wStream; + wStream.OpenL( iView, iColSet->ColNo( aColumn ) ); + CleanupClosePushL( wStream ); + + wStream.WriteInt32L( value->Length() ); + wStream.WriteL( *value, value->Length() ); + + CleanupStack::PopAndDestroy( &wStream ); + + iView.PutL(); + } + + CommitAndCompact(); + + CleanupStack::PopAndDestroy( value ); + + _DBG_FILE("CNSmlDmFotaAdapterDb::SetLongStrValueL(): end"); + + return ret; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::SetIntValueL() +// Sets aValue as the value of aColumn in FW object identified by aObject. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::SetIntValueL( const TDesC& aColumn, + const TInt aValue, + const TNSmlDmFwObjectId aObject ) + { + _DBG_FILE("CNSmlDmFotaAdapterDb::SetIntValueL(): begin"); + DBG_ARGS( _S16("CNSmlDmFotaAdapterDb::SetIntValueL(): ('%S', %d, %d)"), + &aColumn, aValue, aObject ); + + TInt ret = UpdateRowL( aObject ); + + if ( ret == KErrNone ) + { + // do update + iView.SetColL( iColSet->ColNo( aColumn ), aValue ); + iView.PutL(); + } + + CommitAndCompact(); + + _DBG_FILE("CNSmlDmFotaAdapterDb::SetIntValueL(): end"); + + return ret; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::UpdateRowL() +// Prepares iView when setting a value to one of the rows in DB table. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::UpdateRowL( const TNSmlDmFwObjectId aObject ) + { + TInt ret = KErrNone; + + HBufC* sql = FwMgmtObjectRowSqlLC( aObject ); + PrepareViewL( *sql, iView.EUpdatable ); + iDatabase.Begin(); + + CleanupStack::PopAndDestroy( sql ); + + if ( iView.FirstL() ) + { + // fw object exists + // Get current row for accessing and initiate update + iView.GetL(); + iView.UpdateL(); + } + else + { + // fw object does not exists, cannot update + ret = KErrNotFound; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::StrValueL() +// Returns the value in FW object identified by aObject in column aColumn. +// --------------------------------------------------------------------------- +// +HBufC8* CNSmlDmFotaAdapterDb::StrValueL( const TDesC& aColumn, + const TNSmlDmFwObjectId aObject ) + { + DBG_ARGS( _S16("CNSmlDmFotaAdapterDb::StrValueL('%S', %d): begin"), + &aColumn, aObject ); + + HBufC8* value = NULL; + + FetchRowL( aObject ); + + if ( iView.FirstL() ) + { + // get value + iView.GetL(); + TPtrC res = iView.ColDes( iColSet->ColNo( aColumn ) ); + + // convert to 8-bit + value = HBufC8::NewL( res.Length() ); + value->Des().Copy( res ); + } + + _DBG_FILE("CNSmlDmFotaAdapterDb::StrValueL(): end"); + + return value; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::LongStrValueL() +// Returns the value in FW object identified by aObject in column aColumn. +// --------------------------------------------------------------------------- +// +HBufC8* CNSmlDmFotaAdapterDb::LongStrValueL( const TDesC& aColumn, + const TNSmlDmFwObjectId aObject ) + { + DBG_ARGS( _S16("CNSmlDmFotaAdapterDb::LongStrValueL('%S', %d): begin"), + &aColumn, aObject ); + + HBufC8* value = NULL; + + FetchRowL( aObject ); + + if ( iView.FirstL() ) + { + // get value + iView.GetL(); + + RDbColReadStream rStream; + rStream.OpenL( iView, iColSet->ColNo( aColumn ) ); + CleanupClosePushL( rStream ); + + TInt length = 0; + TRAPD( err, length = rStream.ReadInt32L() ); + + HBufC* buf = HBufC::NewLC( length ); + TPtr bufPtr = buf->Des(); + + if ( err == KErrNone ) + { + rStream.ReadL( bufPtr, length ); + } + + // convert to 8-bit + value = HBufC8::NewL( bufPtr.Length() ); + value->Des().Copy( bufPtr ); + + CleanupStack::PopAndDestroy( buf ); + CleanupStack::PopAndDestroy( &rStream ); + } + + _DBG_FILE("CNSmlDmFotaAdapterDb::LongStrValueL(): end"); + + return value; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::IntValueL() +// Returns the value in FW object identified by aObject in column aColumn. +// --------------------------------------------------------------------------- +// +TInt CNSmlDmFotaAdapterDb::IntValueL( const TDesC& aColumn, + const TNSmlDmFwObjectId aObject ) + { + DBG_ARGS( _S16("CNSmlDmFotaAdapterDb::IntValueL('%S', %d): begin"), + &aColumn, aObject ); + + TInt value = KErrNotFound; + + FetchRowL( aObject ); + + if ( iView.FirstL() ) + { + iView.GetL(); + value = iView.ColInt( iColSet->ColNo( aColumn ) ); + } + + _DBG_FILE("CNSmlDmFotaAdapterDb::IntValueL(): end"); + + return value; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::FetchRowL() +// Prepares iView when getting a single row from DB. +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapterDb::FetchRowL( const TNSmlDmFwObjectId aObject ) + { + HBufC* sql = FwMgmtObjectRowSqlLC( aObject ); + + PrepareViewL( *sql, iView.EReadOnly ); + + CleanupStack::PopAndDestroy( sql ); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::FwMgmtObjectRowSqlLC() +// Returns a buffer containing formatted SQL statement for getting a FW object +// identified by aId. +// --------------------------------------------------------------------------- +// +HBufC* CNSmlDmFotaAdapterDb::FwMgmtObjectRowSqlLC( TNSmlDmFwObjectId aId ) const + { + HBufC* sql = HBufC::NewLC( KNSmlGetFwMgmtObject().Length() + + KNSmlFwMgmtObjectIntegerLength ); + + TPtr sqlPtr = sql->Des(); + sqlPtr.Format( KNSmlGetFwMgmtObject, aId ); + return sql; + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::PrepareViewL() +// Closes and prepares the view +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapterDb::PrepareViewL( const TDesC& aSql, + RDbRowSet::TAccess aAccess ) + { + iView.Close(); + User::LeaveIfError( iView.Prepare( iDatabase, TDbQuery(aSql), aAccess ) ); + + if ( iView.Unevaluated() ) + { + User::LeaveIfError( iView.EvaluateAll() ); + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::CommitAndCompact() +// Commits update and compacts the database +// --------------------------------------------------------------------------- +// +void CNSmlDmFotaAdapterDb::CommitAndCompact() + { + iDatabase.Commit(); + iDatabase.Compact(); + } + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapterDb::ConvertTo16BitLC() +// Returns a pointer to a unicode copy of the given 8-bit descriptor. +// The pointer to the copy is allocated from heap and pushed on the +// CleanupStack. +// --------------------------------------------------------------------------- +// +HBufC* CNSmlDmFotaAdapterDb::ConvertTo16BitLC( const TDesC8& aDes ) const + { + HBufC* buf = HBufC::NewLC( aDes.Length() ); + buf->Des().Copy( aDes ); + + return buf; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/globalwlansettings/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/globalwlansettings/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/globalwlansettings/group/globalwlanadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/globalwlansettings/group/globalwlanadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/globalwlansettings/inc/globalwlanadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/globalwlansettings/inc/globalwlanadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/globalwlansettings/rom/globalwlanadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/globalwlansettings/rom/globalwlanadapter.iby Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/globalwlansettings/src/globalwlanadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/globalwlansettings/src/globalwlanadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/globalwlansettings/src/globalwlanadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/globalwlansettings/src/globalwlanadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/inc/nsmldmimpluids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/inc/nsmldmimpluids.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/bld/nsmldmmmsadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/bld/nsmldmmmsadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/inc/nsmldmmmsadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/inc/nsmldmmmsadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/src/nsmldmmmsadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/src/nsmldmmmsadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/src/nsmldmmmsadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/src/nsmldmmmsadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/bwins/mmstestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/bwins/mmstestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/conf/mmstest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/conf/mmstest.cfg Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/eabi/mmstestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/eabi/mmstestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/group/mmstest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/group/mmstest.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/group/mmstest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/group/mmstest.pkg Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/inc/TestDmDDFObject.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/inc/dmatest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/inc/mmstest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/inc/mmstest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/init/mmstest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/init/mmstest.ini Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/src/TestDmDDFObject.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/src/dmatest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/src/mmstest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/src/mmstest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/mms/tsrc/src/mmstestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/mms/tsrc/src/mmstestBlocks.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/group/nsmldmalwaysonadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/group/nsmldmalwaysonadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/inc/logger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/inc/logger.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonadapter.inl Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonsettingstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/inc/nsmldmalwaysonsettingstore.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/rom/nsmldmalwaysonadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/rom/nsmldmalwaysonadapter.iby Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonsettingstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmalwaysonadapter/src/nsmldmalwaysonsettingstore.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006-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 nsmldmbmadapter +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +nsmldmbmadapter.mmp + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/group/nsmldmbmadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/group/nsmldmbmadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2006 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 nsmldmbmadapter +* +*/ + + +#include +#include + +TARGET nsmldmbmadapter.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x101f6d2f + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE nsmldmbmadapter.cpp +SOURCE nsmldmbmsettingstore.cpp + +START RESOURCE nsmldmbmadapter.rss +END + +//LANG sc + +USERINCLUDE ../inc + +//Default system include paths for middleware layer modules +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib ecom.lib cmmanagerdatabase.lib cmmanager.lib charconv.lib flogger.lib diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/inc/bmadapterlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/inc/bmadapterlogger.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2006 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: Logging functions for the component. +* +*/ + + + +#ifndef BMADAPTERLOGGER_H +#define BMADAPTERLOGGER_H + +#ifndef _DEBUG + +// UREL BUILD: +#define BMADAPTER_LOGGING_METHOD 0 // No logging in UREL builds + +#else + +// UDEB BUILD: +#define BMADAPTER_LOGGING_METHOD 1 // 0 = No logging, + // 1 = Flogger, + // 2 = RDebug +#endif // _DEBUG + + +#if BMADAPTER_LOGGING_METHOD == 1 // Flogger + +#include +_LIT(KBMADAPTERLOGFolder,"NSMLDMBMADAPTER"); +_LIT(KBMADAPTERLOGFile,"NSMLDMBMADAPTER.txt"); + +#define BMADAPTERLOGTEXT(x)\ + {\ + RFileLogger::Write(KBMADAPTERLOGFolder(),KBMADAPTERLOGFile(),EFileLoggingModeAppend,\ + x);\ + } + +#define BMADAPTERLOGSTRING(x)\ + {\ + _LIT8(tempLogDes,x);\ + RFileLogger::Write(KBMADAPTERLOGFolder(),KBMADAPTERLOGFile(),EFileLoggingModeAppend,\ + tempLogDes());\ + } + +#define BMADAPTERLOGSTRING2(x,y)\ + { _LIT8(tempLogDes,x);\ + RFileLogger::WriteFormat(KBMADAPTERLOGFolder(),\ + KBMADAPTERLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),y);\ + } + +#define BMADAPTERLOGSTRING3(x,y,z)\ + { _LIT8(tempLogDes,x);\ + RFileLogger::WriteFormat(KBMADAPTERLOGFolder(),\ + KBMADAPTERLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),y,z);\ + } + +#define BMADAPTERLOGSTRING4(w,x,y,z)\ + { _LIT8(tempLogDes,w);\ + RFileLogger::WriteFormat(KBMADAPTERLOGFolder(),\ + KBMADAPTERLOGFile(),\ + EFileLoggingModeAppend,\ + TRefByValue(tempLogDes()),x,y,z);\ + } + + +#elif BMADAPTER_LOGGING_METHOD == 2 // RDebug + +#include + +#define BMADAPTERLOGSTRING(x) RDebug::Print(x); +#define BMADAPTERLOGSTRING(x) RDebug::Print(_L(x)); +#define BMADAPTERLOGSTRING2(x,y) RDebug::Print(_L(x),y); +#define BMADAPTERLOGSTRING3(x,y,z) RDebug::Print(_L(x),y,z); +#define BMADAPTERLOGSTRING4(w,x,y,z) RDebug::Print(_L(w),x,y,z); + +#else // BMADAPTER_LOGGING_METHOD == 0 or invalid + +#define BMADAPTERLOGSTRING(x) +#define BMADAPTERLOGSTRING(x) +#define BMADAPTERLOGSTRING2(x,y) +#define BMADAPTERLOGSTRING3(x,y,z) +#define BMADAPTERLOGSTRING4(w,x,y,z) + +#endif // BMADAPTER_LOGGING_METHOD + +#endif // BMADAPTERLOGGER_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/inc/nsmldmbmadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/inc/nsmldmbmadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,887 @@ +/* +* Copyright (c) 2006 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 adapter handling bearer management related settings +* +*/ + + + + +#ifndef NSMLDMBMADAPTER_H +#define NSMLDMBMADAPTER_H + +#include + +#include "nsmldmbmsettingstore.h" + +class CSmlDmBmCommandElement; +class CSmlDmBmSettingsElement; +class CNSmlDmBmSettingStore; + +/** The DDF version must be changed if any changes in DDF structure +( built in DDFStructureL() function ) */ +_LIT8( KNSmlDmBMAdapterDDFVersion, "1.1" ); +_LIT8( KNSmlDmBMAdapterTextPlain, "text/plain" ); + +/** Names of the nodes */ +/** When updating KNSmlDmBMAdapterBMURI also update +KNSmlDmBmAdapterURIMaxLength! */ +_LIT8(KNSmlDmBMAdapterBMURI, "./BearerManagementSNAP"); +_LIT8(KNSmlDmBMAdapterBM, "BearerManagementSNAP"); +_LIT8(KNSmlDmBMAdapterName, "Name"); +_LIT8(KNSmlDmBMAdapterIAPPriorityList, "IAPPriorityList"); +_LIT8(KNSmlDmBMAdapterEmbeddedSNAP, "EmbeddedSNAP"); +_LIT8(KNSmlDmBMAdapterMetadata, "Metadata"); +_LIT8(KNSmlDmBMAdapterProtected, "Protected"); +_LIT8(KNSmlDmBMAdapterHidden, "Hidden"); + +/** Descriptions of the nodes */ +_LIT8( KNSmlDmBMAdapterBMDescription, + "BearerManagement provides management of Access Point groups (SNAPs)"); +_LIT8( KNSmlDmBMAdapterDynamicDescription, + "Node presents a group of Access Points (SNAP)"); +_LIT8( KNSmlDmBMAdapterNameDescription, + "Name of the Access Point group"); +_LIT8( KNSmlDmBMAdapterIAPPriorityListDescription, + "Comma separated list of Access Point URIs in priority order."); +_LIT8( KNSmlDmBMAdapterEmbeddedSNAPDescription, + "URI of embedded Access Point group. All Access points of the Embedded \ + SNAP are seen as also belonging to this SNAP"); +_LIT8( KNSmlDmBMAdapterMetadataDescription, + "32 bit integer representing SNAP metadata. Following bitmasks indicate \ + meaning of the individual bits: \n 0x00000001 \t Internet: The SNAP is \ + the Internet SNAP. This may only be set to one SNAP object.\n \ + 0x00000002\tHighlight: SNAP is highlighted in certain UI dialog.\n \ + 0x00000004\tHidden: SNAP is hidden in certain UI dialog."); +_LIT8( KNSmlDmBMAdapterProtectedDescription, + "SNAP is protected with one of the following protection levels. \ + Protected object can not be modified without NetworkControl capability \n \ + 0 \t No protection \n 1 \t SNAP and related objects \n \ + 2 \t SNAP name is protected."); +_LIT8( KNSmlDmBMAdapterHiddenDescription, + "SNAP is set as hidden in the setting store"); + +/** Leaf nodes of snap node */ +_LIT8( KNSmlDmBMAllLeafNodes, + "Name/IAPPriorityList/Metadata/Protected/Hidden/EmbeddedSNAP"); +_LIT8( KNSmlDmBMAllLeafNodesNoEmbedded, + "Name/IAPPriorityList/Metadata/Protected/Hidden"); + +/** URI of for fetching IAP nodes */ +/** When updating KNSmlDmBMAdapterIAPURI also update +KNSmlDmBmAdapterAPURIMaxLength! */ +_LIT8( KNSmlDmBMAdapterIAPURI, "./AP" ); +/** Node name of AP adapter root */ +_LIT8( KNSmlDmBMAdapterIAPNode, "AP" ); +/** URI segment separator */ +/** When updating this literal also update +KNSmlDmBmAdapterAPURIMaxLength and KNSmlDmBmAdapterURIMaxLength! */ +_LIT8( KNSmlDmBmSeparator, "/" ); +/** URI segment separator */ +/** When updating KNSmlDmBMAdapterBMURI also update +KNSmlDmBmAdapterAPURIMaxLength and KNSmlDmBmAdapterURIMaxLength! */ +_LIT8( KNSmlDmBmUriListSeparator, "," ); +/** Prefix in URIs (removed for LUID mapping) */ +_LIT8( KNSmlDmBmAdapterURIPrefix, "./" ); + +/** Name prefix for unnamed snap nodes */ +_LIT8( KNSmlDmBMSNAPNamePrefix, "SNAP" ); +_LIT8( KNSmlDmBMBooleanTrue, "True" ); +_LIT8( KNSmlDmBMBooleanFalse, "False" ); + + +const TInt KNSmlDmBMGranularity = 4; +const TInt KNsmlDmBmSNAPNodeDepth = 2; +const TInt KNSmlDmBmInvalidRef = -1; + +/** Maximum length of snap URI including a separator character in URI List. +Node is not calculated here. KNSmlDmBMAdapterBMURI + KNSmlDmBmSeparator + +KNSmlDmBmUriListSeparator +*/ +const TInt KNSmlDmBmAdapterURIMaxLength = 24; + +/** Maximum length of AP URI including a separator character in URI List. +Node is not calculated here. KNSmlDmBMAdapterIAPURI + KNSmlDmBmSeparator + +KNSmlDmBmUriListSeparator +*/ +const TInt KNSmlDmBmAdapterAPURIMaxLength = 6; + +/** Maximum length of 32bit integer */ +const TInt KMaxLengthOf32bitInteger = 10; + +/** + * Bearer Management device management adapter + * + * Bearer Management device management adapter manages settings + * related to Service Network Access Points (SNAPs) which are + * used for groupin IAPs + * + * @lib nsmldmbmadapter + * @since S60 v3.2 + */ +class CNSmlDmBmAdapter : public CSmlDmAdapter + { + +public: + +/** Possible command types */ +enum TCommandType + { + EAddCmd, + EGetCmd, + EGetSizeCmd, + EDeleteCmd + }; + + /** + * Two-phased constructor. + */ + static CNSmlDmBmAdapter* NewL( MSmlDmCallback* aDmCallback ); + + /** + * Destructor. + */ + virtual ~CNSmlDmBmAdapter(); + + +// from base class CSmlDmAdapter + + /** + * The function returns current version of the DDF. + * + * @since S60 v3.2 + * @param aDDFVersion 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 aDDF 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 aURI URI of the parent object + * @param aLUID 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 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 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(); + + /** + * Function checks if a SNAP with the argument URI is buffered for + * later handling. If so, the function calls iSettingStore object + * to store the SNAP. This function is called by the iSettingStore + * object to check whether EmbeddedSNAP node referenced by a command is + * still in the buffer and needs to be stored first. + * + * @since S60 v3.2 + * @param aURI Descriptor containing the SNAP URI + */ + void StoreSnapIfBufferedL( const TDesC8& aURI ); + + + /** + * Function returns a pointer to a HBufC object containing a SNAP URI + * which correcponds to the argument LUID. + * + * @since S60 v3.2 + * @param aSnapId LUID of SNAP object + * @return Descriptor containing the SNAP URI. + */ + HBufC8* GetSnapUriFromLuidL( const TUint aSnapId ); + + + /** + * Function returns a pointer to HBufC object containing a + * comma separated list of IAP URIs according to the IAP LUIDs + * contained in the argument array. + * + * @since S60 v3.2 + * @param aIdArray Array of IAP LUIDs for which the URI list is formed. + * @return HBufC object containing a comma separated list of IAP URIs + */ + HBufC8* GetIapListL( const RArray& aIdArray ); + + + /** + * Function returns an array containing the LUIDs of IAP URIs listed in + * argument descriptor. + * + * @since S60 v3.2 + * @param aIAPList TDesC object containing a comma separated list of IAP + * URIs + * @return Array of IAP LUIDs that correspond to the argument URI list. + */ + RArray GetIdArrayL( const TDesC8& aIAPList); + + + /** + * 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; + + /** + * Converts 8bit descriptor to a boolean value + * @since S60 v3.2 + * @param aBoolDes The descriptor to be converted + * @param aBool A pointer to a boolean where result is stored + * @return ETrue if conversion was succesful, otherwise EFalse + */ + TBool DesToBool(const TDesC8& aBoolDes, TBool& aBool ) const; + + /** + * Converts boolean value to 8bit descriptor + * @since S60 v3.2 + * @param aBool The boolean value to be converted + * @return The boolean value as a descriptor + */ + HBufC8* BoolToDes8LC( TBool aBool) const; + + + /** + * The function calls the GetLuidAllocL function of the MSmlDmCallback to + * get the LUID which is mapped to aURI. This function LUID is not found, + * the function allocates a null length string, i.e. the function + * allocates memory in every case. + * @since S60 v3.2 + * @param aURI URI of the object. + */ + HBufC8* GetLuidAllocL( const TDesC8& aURI ); + +private: + + /** + * Constructor + */ + CNSmlDmBmAdapter(); + + /** + * Constructor + * @param aDmCallback Callback object to the framework + */ + CNSmlDmBmAdapter( MSmlDmCallback* aDmCallback ); + + /** + * Second phase constructor + */ + void ConstructL(); + + + /** + * Searches the buffer for a SNAP with the parameter mapping name + * @param aMappingName Mapping Name of this SNAP + * @return Pointer to the CSmlDmBmSettingsElement object in buffer. + * The object is owned by the CNSmlDmBmAdapter. + */ + CSmlDmBmSettingsElement* GetSnapIfBuffered( const TDesC8& aMappingName); + + /** + * Returns the first URI from a list of URIs + * @param aURIList Comma separated list of URIs + * @return The first URI + */ + TPtrC8 FirstURI(const TDesC8& aURIList) const; + + /** + * Returns the number of URIs in a list of URIs + * @param aURIList Comma-separated list of URIs + * @return Number of URIs in the list. + */ + TInt NumOfURIs(const TDesC8& aURIList) const; + + + /** + * Removes the first URI from a list of URIs + * @param aURIList Comma separated list of URIs + * @return The first URI + */ + TPtrC8 RemoveFirstURI(const TDesC8& aURI) const; + + /** + * Parses the last URI segment from URI + * @param aURI The whole URI + * @return The last URI segment + */ + TPtrC8 LastURISeg(const TDesC8& aURI) const; + + /** + * Removes the last URI segment from URI + * @param aURI The whole URI + * @return The aURI without the last URI segment + */ + TPtrC8 RemoveLastURISeg(const TDesC8& aURI) const; + + /** + * Calculates the number of URI segments + * @param aURI The whole URI + * @return The number of URI segments + */ + TInt NumOfURISegs(const TDesC8& aURI) const; + + /** + * Checks if the URI refers to predefined SNAP (of format SNAPx) in which + * case operations should be successful even if passed LUID is empty. + * Maps the URI to found id. + * @param aURI The whole URI + * @param aLUID LUID + * @return The SNAP ID if found + */ + TInt MapPredefinedSnapsL( const TDesC8& aURI, const TDesC8& aLUID ); + + /** + * Tries to find predefined URI string (SNAPx) fronm input + * returns the ID. + * @param aURI The whole URI + * @return The SNAP ID if found + */ + TInt GetPredefinedSnapIdFromUri( const TDesC8& aURI ) const; + +private: //data + + /** + * Buffered commands. Contains a CSmlDmBmSettingsElement object + * for each SNAP. THese in turn contain commands for the SNAP. + */ + RPointerArray iBuffer; + + /** + * Setting store object, which is called for managing settings + * in CommsDat. Own. + */ + CNSmlDmBmSettingStore * iSettingStore; + + /** + * CmManager object for SNAP existence checking for + * direct accesses to pre-defined SNAPs + */ + RCmManagerExt iCmManagerExt; + + }; + + +/** + * CSmlDmBmCommandElement + * + * Helper class, which stores a single buffered command for a SNAP. + * @lib nsmldmbmadapter + * @since S60 v3.2 + */ + +class CSmlDmBmCommandElement : public CBase + { + +public: + + /** + * Two-phased constructor. + */ + static CSmlDmBmCommandElement* NewLC( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmBmAdapter::TCommandType aCmdType, + const TDesC8& aLastUriSeg, + const TDesC8& aData ); + + /** + * Destructor. + */ + ~CSmlDmBmCommandElement(); + + /** + * 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 CNSmlDmBmAdapter::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 SetDataL( const TDesC8& aData ); + +private: + + CSmlDmBmCommandElement( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmBmAdapter::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 Snap 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 CNSmlDmBmAdapter::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; + + }; + + +/** + * CSmlDmBmSettingsElement + * + * Helper class which stores information of a single SNAP object + * into buffer. Contains the buffered commands for the + * SNAP as a list of CSmlBmCommandElement objects. + * + * @lib nsmldmbmadapter + * @since S60 v3.2 + */ + +class CSmlDmBmSettingsElement : public CBase + { + +public: + + /** + * Two-phased constructor. + */ + static CSmlDmBmSettingsElement* NewLC( const TDesC8& aMappingName ); + + /** + * Destructor. + */ + ~CSmlDmBmSettingsElement(); + + /** + * Returns a reference to iNodeBuf member. + * @since S60 v3.2 + * @return Reference to iNodeBuf member of the object + */ + inline RPointerArray& NodeBuf(); + + /** + * Returns the iMappingName member value. + * @since S60 v3.2 + * @return The iMappingName member value of the object + */ + inline const HBufC8* MappingName(); + + /** + * Returns the iExecuted member value. + * @since S60 v3.2 + * @return The iExecuted member value of the object + */ + inline TBool Executed(); + + /** + * Sets the iExecuted member value. + * @since S60 v3.2 + * @param aExecuted Value for the iExecuted member of the object + */ + inline void SetExecuted( TBool aExecuted ); + + /** + * Returns the iLuid member value. + * @since S60 v3.2 + * @return The iLuid member value of the object + */ + inline TInt Luid(); + + /** + * Sets the iLuid member value. + * @since S60 v3.2 + * @param aLuid Value for the iLuid member of the object + */ + inline void SetLuid( TInt aLuid ); + + +private: + + CSmlDmBmSettingsElement(); + + void ConstructL( const TDesC8& aMappingName ); + +private: //data + + /** + * Buffer of commands for this SNAP object. Commands + * are added as they come in from the framework and + * executed by the setting store. + */ + RPointerArray iNodeBuf; + + /** + * Indicates whether commands for this SNAP have been executed. + * Set to Erue by CNsmlDmBmSettingStore when object is handled. + */ + TBool iExecuted; + + /** + * LUID (Local UID) is the CommsDat id of the SNAP node. This is + * filled in when SNAP object is created in CommsDat. + */ + TInt iLuid; + + /** + * Mapping name of this SNAP node. This is mapped to the + * iLuid when the Snap is created and has id. + */ + HBufC8* iMappingName; + }; + +#include "nsmldmbmadapter.inl" + +#endif // NSMLDMBMADAPTER_H diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/inc/nsmldmbmadapter.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/inc/nsmldmbmadapter.inl Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2006 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 CSmlDmBmCommandElement::Executed() + { + return iExecuted; + } + +// ----------------------------------------------------------------------------- +// Returns the iStatus member of the object +// ----------------------------------------------------------------------------- +// +CSmlDmAdapter::TError CSmlDmBmCommandElement::Status() + { + return iStatus; + } + +// ----------------------------------------------------------------------------- +// Returns the iLeaf member of the object +// ----------------------------------------------------------------------------- +// +TBool CSmlDmBmCommandElement::Leaf() + { + return iLeaf; + } + +// ----------------------------------------------------------------------------- +// Returns the iStatusRef member of the object +// ----------------------------------------------------------------------------- +// +TInt CSmlDmBmCommandElement::StatusRef() + { + return iStatusRef; + } + +// ----------------------------------------------------------------------------- +// Returns the iResultRef member of the object +// ----------------------------------------------------------------------------- +// +TInt CSmlDmBmCommandElement::ResultRef() + { + return iResultRef; + } + +// ----------------------------------------------------------------------------- +// Returns the iCmdType member of the object +// ----------------------------------------------------------------------------- +// +CNSmlDmBmAdapter::TCommandType CSmlDmBmCommandElement::CmdType() + { + return iCmdType; + } + +// ----------------------------------------------------------------------------- +// Returns the iData member of the object +// ----------------------------------------------------------------------------- +// +const HBufC8* CSmlDmBmCommandElement::Data() + { + return iData; + } + +// ----------------------------------------------------------------------------- +// Returns the iLastUriSeg member of the object +// ----------------------------------------------------------------------------- +// +const HBufC8* CSmlDmBmCommandElement::LastUriSeg() + { + return iLastUriSeg; + } + +// ----------------------------------------------------------------------------- +// Sets the iExecuted member of the object +// ----------------------------------------------------------------------------- +// +void CSmlDmBmCommandElement::SetExecuted( TBool aExecuted ) + { + iExecuted = aExecuted; + } + +// ----------------------------------------------------------------------------- +// Sets the iStatus member of the object +// ----------------------------------------------------------------------------- +// +void CSmlDmBmCommandElement::SetStatus( CSmlDmAdapter::TError aStatus ) + { + iStatus = aStatus; + } + + +// ----------------------------------------------------------------------------- +// Sets the iData member of the object. Ownership of aData argument will be +// transfered to the CSmlDmBmCommandElement +// ----------------------------------------------------------------------------- +// +void CSmlDmBmCommandElement::SetDataL( const TDesC8& aData ) + { + if ( aData.Length() > iData->Length() ) + { + iData = iData->ReAllocL( aData.Length() ); + } + *iData = aData; + } + +//Function definitions for CSmlDmBmSettingsElement +// ----------------------------------------------------------------------------- +// Returns reference to iNodeBuf +// ----------------------------------------------------------------------------- +RPointerArray& CSmlDmBmSettingsElement::NodeBuf() + { + return iNodeBuf; + } + +// ----------------------------------------------------------------------------- +// Returns iMappingName +// ----------------------------------------------------------------------------- +const HBufC8* CSmlDmBmSettingsElement::MappingName() + { + return iMappingName; + } + +// ----------------------------------------------------------------------------- +// Returns iExecuted +// ----------------------------------------------------------------------------- +TBool CSmlDmBmSettingsElement::Executed() + { + return iExecuted; + } + +// ----------------------------------------------------------------------------- +// Sets the iExecuted member value +// ----------------------------------------------------------------------------- +void CSmlDmBmSettingsElement::SetExecuted( TBool aExecuted ) + { + iExecuted = aExecuted; + } + + +// ----------------------------------------------------------------------------- +// Returns iLuid +// ----------------------------------------------------------------------------- +TBool CSmlDmBmSettingsElement::Luid() + { + return iLuid; + } + +// ----------------------------------------------------------------------------- +// Sets the iExecuted member value +// ----------------------------------------------------------------------------- +void CSmlDmBmSettingsElement::SetLuid( TInt aLuid ) + { + iLuid = aLuid; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/inc/nsmldmbmsettingstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/inc/nsmldmbmsettingstore.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2006 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: The class manages snap data in Commsdat using CMManager +* +*/ + + + + +#ifndef NSMLDMBMSETTINGSTORE_H +#define NSMLDMBMSETTINGSTORE_H + +#include + +#include "nsmldmbmadapter.h" + +const TInt KShift8 = 8; + +class CNSmlDmBmAdapter; +class CSmlDmBmCommandElement; +class CSmlDmBmSettingsElement; + +/** + * Setting Store is used for managing settings in CommsDat + * + * The class provides functions for executing commands + * and sets of commands that involve manipulation of + * data in CommsDat. + * + * @lib nsmldmbmadapter + * @since S60 v3.2 + */ +class CNSmlDmBmSettingStore : public CBase + { + +public: + + /** + * Two-phased constructor. + */ + static CNSmlDmBmSettingStore * NewL( CNSmlDmBmAdapter* aAdapter ); + + /** + * Destructor. + */ + virtual ~CNSmlDmBmSettingStore(); + + + /** + * Executes all commands for the argument snap object. + * Executed commands are set as executed and status is filled + * in. For Get commands also fetched data is filled in the command. + * + * @since S60 v3.2 + * @param aSettings Settings object for the SNAP, contains all + * commands to be executed for the SNAP + */ + void StoreSnapL( CSmlDmBmSettingsElement& aSettings ); + + + /** + * Executes the argument command. Checks the node from + * for which the command is intended and calls node specific functions. + * + * @since S60 v3.2 + * @param aCmd Command to be executed + * @param aLuid LUID of the SNAP which command is referring. + */ + void ExecuteCmdL( CSmlDmBmCommandElement& aCmd, TUint aLuid); + + /** + * Fetches all SNAPs and inserts id of each SNAp into the argument array + * + * @since S60 v3.2 + * @param aLUIDArray Array for SNAP ids + */ + void GetSnapsL( RArray& aLUIDArray ); + +private: + + CNSmlDmBmSettingStore( CNSmlDmBmAdapter * aAdapter ); + + void ConstructL(); + +//----------- Commands for managing leaf nodes -------------------// + + /** + * Executes snap commands. The valid commands include + * get and delete. 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 snap + */ + void ExecuteSnapCmdL( CSmlDmBmCommandElement& aCmd, TUint aLuid ); + + /** + * Executes iap list 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 aSnap The snap object + */ + void ExecuteIapsCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + /** + * Executes protection 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 aSnap The snap object + */ + void ExecuteProtectionCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + /** + * Executes hidden 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 aSnap The snap object + */ + void ExecuteHiddenCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + /** + * Executes metadata 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 aSnap The snap object + */ + void ExecuteMetadataCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + /** + * Executes embedded snap commands. The valid commands include + * update, get and delete. 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 aLuid The id of the snap + */ + void ExecuteEmbeddedSnapCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + /** + * 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 aSnap The snap object + */ + void ExecuteNameCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ); + + +private: //data + + /** + * CmManager is used for accessing CommsDat. + */ + RCmManagerExt iCmManagerExt; + + /** + * Pointer to the adapter. This is used for + * querying data from DM framework when necessary + * and using helper functions. Not own. + */ + CNSmlDmBmAdapter* iAdapter; + + }; + + +#endif // NSmlDmBmSettingStore_H diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/rom/nsmldmbmadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/rom/nsmldmbmadapter.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 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 nsmldmbmadapter +* +*/ + + + +#ifndef NSMLDMBMADAPTER_IBY +#define NSMLDMBMADAPTER_IBY + +#include + +#ifdef __SYNCML_DM + +ECOM_PLUGIN( nsmldmbmadapter.dll, nsmldmbmadapter.rsc ) + +#endif // __SYNCML_DM + +#endif // NSMLDMBMADAPTER_IBY diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/src/nsmldmbmadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/src/nsmldmbmadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,1675 @@ +/* +* Copyright (c) 2006 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: Bearer management DM adapter. Provides handling of + Bearer management related settings in Device management +* +*/ + + + +#include +#include + +#include "nsmldmbmadapter.h" +#include "bmadapterlogger.h" + +// ======== MEMBER FUNCTIONS ======== + + +// -------------------------------------------------------------------------- +// Maps plugin UID to its factory function (constructor) +// -------------------------------------------------------------------------- +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101f6d2f, + CNSmlDmBmAdapter::NewL) + }; + +// -------------------------------------------------------------------------- +// For ecom plugin implementation +// ------------------------------------------------------------------------- + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::NewL +// -------------------------------------------------------------------------- +CNSmlDmBmAdapter* CNSmlDmBmAdapter::NewL( MSmlDmCallback* aDmCallback ) + { + BMADAPTERLOGSTRING("CNSmlDmBmAdapter::NewL: Start") + CNSmlDmBmAdapter* self = new (ELeave) CNSmlDmBmAdapter( aDmCallback ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + BMADAPTERLOGSTRING("CNSmlDmBmAdapter::NewL: End") + return self; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::CNSmlDmBmAdapter +// -------------------------------------------------------------------------- + +CNSmlDmBmAdapter::CNSmlDmBmAdapter( MSmlDmCallback* aDmCallback ) + : CSmlDmAdapter( aDmCallback ) + { + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::ConstructL +// -------------------------------------------------------------------------- +void CNSmlDmBmAdapter::ConstructL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CNSmlDmBmAdapter: Start" ) + iSettingStore = CNSmlDmBmSettingStore::NewL( this ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CNSmlDmBmAdapter: End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::~CNSmlDmBmAdapter +// -------------------------------------------------------------------------- +CNSmlDmBmAdapter::~CNSmlDmBmAdapter() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::~CNSmlDmBmAdapter: Start" ) + iBuffer.ResetAndDestroy(); + iBuffer.Close(); + delete iSettingStore; + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::~CNSmlDmBmAdapter: End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DDFVersionL +// Returns ddf version nr +// -------------------------------------------------------------------------- +void CNSmlDmBmAdapter::DDFVersionL( CBufBase& aDDFVersion ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DDFVersionL: Start" ) + aDDFVersion.InsertL( 0, KNSmlDmBMAdapterDDFVersion ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DDFVersionL:End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DDFStructureL +// Constructs the DDF structure +// -------------------------------------------------------------------------- +void CNSmlDmBmAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DDFStructureL: Start" ) + TSmlDmAccessTypes accessTypes; + + // BearerManagementSNAP + MSmlDmDDFObject& bm = aDDF.AddChildObjectL( KNSmlDmBMAdapterBM ); + accessTypes.SetGet(); + accessTypes.SetAdd(); + bm.SetAccessTypesL( accessTypes ); + bm.SetOccurenceL( MSmlDmDDFObject::EOne ); + bm.SetScopeL( MSmlDmDDFObject::EPermanent ); + bm.SetDFFormatL( MSmlDmDDFObject::ENode ); + bm.AddDFTypeMimeTypeL( KNSmlDmBMAdapterTextPlain ); + bm.SetDescriptionL( KNSmlDmBMAdapterBMDescription ); + accessTypes.Reset(); + + + // BearerManagementSNAP/ + MSmlDmDDFObject& dynamic1 = bm.AddChildObjectGroupL(); + accessTypes.SetAdd(); + accessTypes.SetDelete(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + dynamic1.SetAccessTypesL( accessTypes ); + dynamic1.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore ); + dynamic1.SetScopeL( MSmlDmDDFObject::EDynamic ); + dynamic1.SetDFFormatL( MSmlDmDDFObject::ENode ); + dynamic1.AddDFTypeMimeTypeL( KNSmlDmBMAdapterTextPlain ); + dynamic1.SetDescriptionL( KNSmlDmBMAdapterDynamicDescription ); + accessTypes.Reset(); + + + // BearerManagementSNAP//Name + MSmlDmDDFObject& name = dynamic1.AddChildObjectL( KNSmlDmBMAdapterName ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + name.SetAccessTypesL( accessTypes ); + name.SetOccurenceL( MSmlDmDDFObject::EOne ); + name.SetScopeL( MSmlDmDDFObject::EDynamic ); + name.SetDFFormatL( MSmlDmDDFObject::EChr ); + name.SetDescriptionL( KNSmlDmBMAdapterNameDescription ); + accessTypes.Reset(); + + // BearerManagementSNAP//IAPPrioityList + MSmlDmDDFObject& iapList = + dynamic1.AddChildObjectL( KNSmlDmBMAdapterIAPPriorityList ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + iapList.SetAccessTypesL( accessTypes ); + iapList.SetOccurenceL( MSmlDmDDFObject::EOne ); + iapList.SetScopeL( MSmlDmDDFObject::EDynamic ); + iapList.SetDFFormatL( MSmlDmDDFObject::EChr ); + iapList.SetDescriptionL( KNSmlDmBMAdapterIAPPriorityListDescription ); + accessTypes.Reset(); + + // BearerManagementSNAP//EmbeddedSNAP + MSmlDmDDFObject& embedded = + dynamic1.AddChildObjectL( KNSmlDmBMAdapterEmbeddedSNAP ); + accessTypes.SetAdd(); + accessTypes.SetDelete(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + embedded.SetAccessTypesL( accessTypes ); + embedded.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne ); + embedded.SetScopeL( MSmlDmDDFObject::EDynamic ); + embedded.SetDFFormatL( MSmlDmDDFObject::EChr ); + embedded.SetDescriptionL( KNSmlDmBMAdapterEmbeddedSNAPDescription ); + accessTypes.Reset(); + + // BearerManagementSNAP//Metadata + MSmlDmDDFObject& metadata = + dynamic1.AddChildObjectL( KNSmlDmBMAdapterMetadata ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + metadata.SetAccessTypesL( accessTypes ); + metadata.SetOccurenceL( MSmlDmDDFObject::EOne ); + metadata.SetScopeL( MSmlDmDDFObject::EDynamic ); + metadata.SetDFFormatL( MSmlDmDDFObject::EInt ); + metadata.SetDescriptionL( KNSmlDmBMAdapterMetadataDescription ); + accessTypes.Reset(); + + + // BearerManagementSNAP//Protected + MSmlDmDDFObject& protection = + dynamic1.AddChildObjectL( KNSmlDmBMAdapterProtected ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + protection.SetAccessTypesL( accessTypes ); + protection.SetOccurenceL( MSmlDmDDFObject::EOne ); + protection.SetScopeL( MSmlDmDDFObject::EDynamic ); + protection.SetDFFormatL( MSmlDmDDFObject::EInt ); + protection.SetDescriptionL( KNSmlDmBMAdapterProtectedDescription ); + accessTypes.Reset(); + + // BearerManagementSNAP//Hidden + MSmlDmDDFObject& hidden = dynamic1.AddChildObjectL( KNSmlDmBMAdapterHidden ); + accessTypes.SetAdd(); + accessTypes.SetGet(); + accessTypes.SetReplace(); + hidden.SetAccessTypesL( accessTypes ); + hidden.SetOccurenceL( MSmlDmDDFObject::EOne ); + hidden.SetScopeL( MSmlDmDDFObject::EDynamic ); + hidden.SetDFFormatL( MSmlDmDDFObject::EBool ); + hidden.SetDescriptionL( KNSmlDmBMAdapterHiddenDescription ); + accessTypes.Reset(); + + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DDFStructureL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::UpdateLeafObjectL +// Adds or updates leaf node value. If snap object is +// in buffer this command is also buffered. Also if leaf node +// is embedded snap and that snap is buffered, the argument command +// is buffered. +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& /*aType*/, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: Start" ) + BMADAPTERLOGSTRING4( "\tUpdateLeafObjectL \tURI: %S, \n\tLUID: %S,\ + \tobject: %S ", + &aURI, &aLUID, &aObject ) + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + + // Check if parent snap node is found in the buffered settings + CSmlDmBmSettingsElement* snap = + GetSnapIfBuffered( RemoveLastURISeg( aURI ) ); + + // data for buffered SNAP -> Store command into buffer + if ( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EAddCmd, + LastURISeg( aURI ), + aObject); + snap->NodeBuf().AppendL(cmd); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + + } + // updates for an existing SNAP + else + { + + // If setting embedded SNAP node and the embedded SNAP node is still + // buffered -> Buffer also this command + if( !LastURISeg( aURI ).Compare( KNSmlDmBMAdapterEmbeddedSNAP ) ) + { + snap = GetSnapIfBuffered( aObject ); + + // embedded SNAP is buffered + if ( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EAddCmd, + LastURISeg( aURI ), + aObject); + + // buffer this command + CSmlDmBmSettingsElement* setting = + CSmlDmBmSettingsElement::NewLC( RemoveLastURISeg( aURI ) ); + + // Check if SNAP was predefined or not + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + setting->SetLuid( snapId ); + iBuffer.AppendL( setting ); + CleanupStack::Pop( setting ); + setting->NodeBuf().AppendL(cmd); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tEmbedded Snap %S buffered, buffering cmd", + snap->MappingName() ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: End" ) + return; + } + } + // execute command and return status + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EAddCmd, + LastURISeg( aURI ), + aObject); + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\tCmd executed with status: %d", + cmd->Status() ) + Callback().SetStatusL( aStatusRef, cmd->Status() ); + CleanupStack::PopAndDestroy( cmd ); + + } + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: End" ) + } +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DeleteObjectL +// Deletes node or leaf object. If the snap this command relates to is +// buffered, also the delete command is buffered. +// -------------------------------------------------------------------------- + +void CNSmlDmBmAdapter::DeleteObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DeleteObjectL: Start" ) + BMADAPTERLOGSTRING3( "\tDeleteObjectL \tURI: %S, \tLUID: %S", + &aURI, &aLUID ) + + CSmlDmBmCommandElement* cmd; + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + // check if node or leaf object and create command accordingly + // when updating, make sure that cmd is constructed + if ( NumOfURISegs( aURI ) == KNsmlDmBmSNAPNodeDepth ) + { + cmd = CSmlDmBmCommandElement::NewLC( EFalse, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EDeleteCmd, + KNullDesC8, KNullDesC8 ); + } + else if ( ! LastURISeg( aURI ).Compare( KNSmlDmBMAdapterEmbeddedSNAP() ) ) + { + cmd = CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EDeleteCmd, + LastURISeg( aURI ), + KNullDesC8 ); + } + else + { + // unsupported node, framework should check this + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "\tCNSmlDmBmAdapter::DeleteObjectL: \ + Error, unsupported node" ) + return; + } + + // If this SNAP still in buffer -> buffer command for later execution + // Check if SNAP is found in the buffered settings + CSmlDmBmSettingsElement* snap = NULL; + if( cmd->Leaf() ) + { + snap = GetSnapIfBuffered( RemoveLastURISeg( aURI ) ); + } + else + { + snap = GetSnapIfBuffered( aURI ); + } + // when updating make sure that cmd is removed from cleanup + // stack and deleted if necessary + + // if cmd for buffered snap append cmd to buffer + if ( snap ) + { + snap->NodeBuf().AppendL( cmd ); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + } + // if existing node, execute command + else if( aLUID.Length() > 0 || snapId != KErrNotFound ) + { + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\tCmd executed with status: %d ", + cmd->Status() ) + Callback().SetStatusL( aStatusRef, cmd->Status() ); + CleanupStack::PopAndDestroy( cmd ); + } + // unknown node + else + { + BMADAPTERLOGSTRING( "\tUnknown node\n" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + CleanupStack::PopAndDestroy( cmd ); + } + + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::DeleteObjectL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::FetchLeafObjectL +// Fetches leaf object value. If the snap is buffered also this command +// will +// be buffered. +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /*aType*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "NSmlDmBMAdapter::FetchLeafObjectL: Start" ) + BMADAPTERLOGSTRING3( "\tFetchLeafObjectL \tURI: %S, \tLUID: %S,", + &aURI, &aLUID ) + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + + // check if parent snap node is buffered + CSmlDmBmSettingsElement* snap = + GetSnapIfBuffered( RemoveLastURISeg( aURI ) ); + + // data for buffered SNAP -> Store command into buffer + if ( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetCmd, + LastURISeg( aURI ), + KNullDesC8); + snap->NodeBuf().AppendL( cmd ); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + } + // otherwise execute cmd right away + else + { + + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetCmd, + LastURISeg( aURI ), + KNullDesC8); + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\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 ) + { + BMADAPTERLOGSTRING2( "\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 ); + } + + BMADAPTERLOGSTRING( "NSmlDmBMAdapter::FetchLeafObjectL: End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::FetchLeafObjectSizeL +// Fetches leaf object size. If the snap is buffered also this command will +// be buffered. +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& /* aType */, + TInt aResultsRef, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::FetchLeafObjectSizeL: Start" ) + BMADAPTERLOGSTRING3( "\tFetchLeafObjectSizeL \tURI: %S, \tLUID: %S,", + &aURI, &aLUID ) + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + + // check if parent snap node is buffered + CSmlDmBmSettingsElement* snap = + GetSnapIfBuffered( RemoveLastURISeg( aURI ) ); + + // data for buffered SNAP -> Store command into buffer + if ( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetSizeCmd, + LastURISeg( aURI ), + KNullDesC8); + snap->NodeBuf().AppendL( cmd ); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + } + // otherwise execute get size cmd right away + else + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( ETrue, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetSizeCmd, + LastURISeg( aURI ), + KNullDesC8); + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\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 ) + { + BMADAPTERLOGSTRING2( "\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 ); + } + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::FetchLeafObjectSizeL: End" ) + } + +// ------------------------------------------------------------------------ +// CNSmlDmBmAdapter::ChildURIListL +// Fetches child nodes of a node. these may be either all snap nodes +// or leaf nodes under a snap node. +// ------------------------------------------------------------------------ +void CNSmlDmBmAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& + aPreviousURISegmentList, + TInt aResultsRef, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ChildURIListL: Start" ) + BMADAPTERLOGSTRING3( "\tChildURIListL URI: %S, LUID: %S ", + &aURI, &aLUID ) + + TInt snapId = MapPredefinedSnapsL( aURI, aLUID ); + + CBufBase* resultList = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( resultList ); + // get all snap nodes + if ( !aURI.Compare(KNSmlDmBMAdapterBM) ) + { + RArray snaps = RArray( KNSmlDmBMGranularity ); + CleanupClosePushL( snaps ); + iSettingStore->GetSnapsL( snaps ); + TInt currentSNAP( -1 ); + for ( TInt i( 0 ); i < snaps.Count(); i++) + { + currentSNAP = snaps[i]; + BMADAPTERLOGSTRING2( "\tSnap id: %d, ", currentSNAP ) + + // check that not previously mapped + TBool found = EFalse; + + for ( TInt j( 0 ); j < aPreviousURISegmentList.Count(); j++ ) + { + TSmlDmMappingInfo mapping = aPreviousURISegmentList.At( j ); + // snap already has mapping + if ( currentSNAP == DesToIntL( mapping.iURISegLUID ) ) + { + BMADAPTERLOGSTRING2( " URI: %S exists ", &mapping.iURISeg ) + found = ETrue; + // add to result list + resultList->InsertL( resultList->Size(), + mapping.iURISeg); + break; + } + } + if ( !found ) + { + // This is new snap -> create URI and mapping and add + // node name to result + HBufC8* uri = HBufC8::NewLC( aURI.Length() + + KNSmlDmBmSeparator().Length() + + KSmlMaxURISegLen ); + + TPtr8 uriPtr = uri->Des(); + uriPtr.Format( aURI ); + uriPtr.Append( KNSmlDmBmSeparator ); + uriPtr.Append( KNSmlDmBMSNAPNamePrefix ); + HBufC8* luidBuf = IntToDes8L( currentSNAP ); + CleanupStack::PushL( luidBuf ); + uriPtr.Append( *luidBuf ); + + Callback().SetMappingL( uriPtr, *luidBuf ); + resultList->InsertL( resultList->Size(), + LastURISeg( uriPtr ) ); + BMADAPTERLOGSTRING2( "Creating mapping for URI %S ", &uriPtr ) + CleanupStack::PopAndDestroy( luidBuf ); + CleanupStack::PopAndDestroy( uri ); + } + // insert separator if not last + if ( i < snaps.Count() - 1 ) + { + resultList->InsertL( resultList->Size(), + KNSmlDmBmSeparator ); + } + } + CleanupStack::PopAndDestroy( &snaps ); + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + Callback().SetResultsL( aResultsRef, *resultList, KNullDesC8 ); + } + // get child nodes of a snap node + else if ( NumOfURISegs( aURI ) == KNsmlDmBmSNAPNodeDepth ) + { + CSmlDmBmSettingsElement* snap = GetSnapIfBuffered( aURI ); + // if buffered, add this command to buffer + if( snap ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( EFalse, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetCmd, + KNullDesC8, + KNullDesC8 ); + snap->NodeBuf().AppendL( cmd ); + CleanupStack::Pop( cmd ); + BMADAPTERLOGSTRING2( "\tSnap %S found, buffering cmd", + snap->MappingName() ) + } + // existing snap must have luid mapped + else if( aLUID.Length() > 0 || snapId != KErrNotFound ) + { + CSmlDmBmCommandElement* cmd = + CSmlDmBmCommandElement::NewLC( EFalse, + aStatusRef, + aResultsRef, + CNSmlDmBmAdapter::EGetCmd, + KNullDesC8, + KNullDesC8 ); + if( snapId == KErrNotFound ) + { + snapId = DesToIntL( aLUID ); + } + + iSettingStore->ExecuteCmdL( *cmd, snapId ); + BMADAPTERLOGSTRING2( "\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 ); + } + // invalid snap object + else + { + BMADAPTERLOGSTRING( "\tCNSmlDmBmAdapter::ChildURIListL: Error, \ + invalid snap node" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); + } + } + else + { + BMADAPTERLOGSTRING( "\tChildURIListL: Invalid URI" ) + } + CleanupStack::PopAndDestroy( resultList ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ChildURIListL: End" ) + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::AddNodeObjectL +// Adds a snap node. The node is buffered until all data is received. +// -------------------------------------------------------------------------- +void CNSmlDmBmAdapter::AddNodeObjectL( const TDesC8& aURI, + const TDesC8& aParentLUID, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::AddNodeObjectL: Start" ) + BMADAPTERLOGSTRING3( "\tAddNodeObjectL \tURI: %S, \tparent LUID: %S,", + &aURI, &aParentLUID ) + if ( NumOfURISegs( aURI ) == KNsmlDmBmSNAPNodeDepth ) + { + // if same node already exists command fails + CSmlDmBmSettingsElement* setting = GetSnapIfBuffered( aURI ); + if( setting || aParentLUID.Compare( KNullDesC8) ) + { + BMADAPTERLOGSTRING( "\t Snap exists" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); + } + else if ( LastURISeg( aURI ).Length() > KSmlMaxURISegLen ) + { + BMADAPTERLOGSTRING( "\t Node name too long" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + else + { + // Store command in buffer for later processing + setting = CSmlDmBmSettingsElement::NewLC( aURI ); + iBuffer.AppendL( setting ); + CleanupStack::Pop( setting ); + + // store the add node command + CSmlDmBmCommandElement* command = + CSmlDmBmCommandElement::NewLC( EFalse, + aStatusRef, + KNSmlDmBmInvalidRef, + CNSmlDmBmAdapter::EAddCmd, + KNullDesC8, + KNullDesC8 ); + TInt index( iBuffer.Count() - 1 ); + iBuffer[index]->NodeBuf().AppendL( command ); + CleanupStack::Pop( command ); + BMADAPTERLOGSTRING( "\t Cmd buffered" ) + } + } + + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::AddNodeObjectL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::UpdateLeafObjectL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::UpdateLeafObjectL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt /* aStatusRef */ ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::UpdateLeafObjectL: End" ) + } + + + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::ExecuteCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + const TDesC8& /* aArgument */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ExecuteCommandL: Start" ) + Callback().SetStatusL(aStatusRef, CSmlDmAdapter::EError); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ExecuteCommandL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::ExecuteCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::ExecuteCommandL( const TDesC8& /* aURI */, + const TDesC8& /* aLUID */, + RWriteStream*& /* aStream */, + const TDesC8& /* aType */, + TInt aStatusRef ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ExecuteCommandL: Start" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::ExecuteCommandL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::CopyCommandL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::CopyCommandL( const TDesC8& /* aTargetURI */ , + const TDesC8& /* aTargetLUID */ , + const TDesC8& /* aSourceURI */ , + const TDesC8& /* aSourceLUID */, + const TDesC8& /* aType */ , + TInt aStatusRef ) + { + //not supported + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CopyCommandL: Sart" ) + Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CopyCommandL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::StartAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::StartAtomicL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StartAtomicL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StartAtomicL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::CommitAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::CommitAtomicL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CommitAtomicL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CommitAtomicL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::RollbackAtomicL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::RollbackAtomicL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::RollbackAtomicL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::RollbackAtomicL: End" ) + } + +TBool CNSmlDmBmAdapter::StreamingSupport( TInt& /* aItemSize */ ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StreamingSupport: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StreamingSupport: End" ) + return EFalse; + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::StreamCommittedL +// Not supported +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::StreamCommittedL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StreamCommittedL: Start" ) + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StreamCommittedL: End" ) + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::CompleteOutstandingCmdsL +// CNSmlDmBmAdapter::CompleteOutstandingCmdsL +// ------------------------------------------------------------------------- +void CNSmlDmBmAdapter::CompleteOutstandingCmdsL() + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CompleteOutstandingCmdsL: Start" ) + CSmlDmBmSettingsElement* settings( NULL ); + CSmlDmBmCommandElement* cmd( NULL ); + TInt err(0); + // Read through the buffer and execute commands + for ( TInt i(0); i < iBuffer.Count(); ) + { + settings = iBuffer[i]; + if( settings->NodeBuf().Count() ) + { + // the setting may be executed already if it has been an embedded + // snap for another snap + if ( !settings->Executed() ) + { + //execute commands for snap + TRAP( err, iSettingStore->StoreSnapL( *settings )); + } + // if can't recover from error, don't continue processing + // commands + if( err == KErrNoMemory || + err == KErrDiskFull ) + { + BMADAPTERLOGSTRING2( "\tCNSmlDmBmAdapter::\ + CompleteOutstandingCmdsL: Error %d", err ) + User::Leave( err ); + } + // if this is a new snap and created successfully, map luid + if ( !settings->NodeBuf()[0]->Leaf() && + settings->NodeBuf()[0]->CmdType() == CNSmlDmBmAdapter::EAddCmd && + settings->NodeBuf()[0]->Executed() && + settings->NodeBuf()[0]->Status() == CSmlDmAdapter::EOk ) + { + HBufC8* luid = IntToDes8L( settings->Luid() ); + CleanupStack::PushL( luid ); + Callback().SetMappingL( *settings->MappingName(), *luid ); + BMADAPTERLOGSTRING3( "\t Setting mapping %S - %S ", + settings->MappingName(), luid ) + CleanupStack::PopAndDestroy( luid ); + } + // set status for all commands executed and remove the command + for ( TInt j( 0 ); j < settings->NodeBuf().Count(); ) + { + + cmd = settings->NodeBuf()[j]; + + // return status values if executed + if ( cmd->Executed() ) + { + + Callback().SetStatusL( cmd->StatusRef(), + cmd->Status() ); + // for certain errors, don't continue command execution + if( cmd->Status() == CSmlDmAdapter::ENoMemory ) + { + // commands are deleted + iBuffer.ResetAndDestroy(); + BMADAPTERLOGSTRING( "\tCmd failed with CSmlDmAdapter::ENoMemory" ) + User::Leave( KErrNoMemory ); + } + else if( cmd->Status() == CSmlDmAdapter::EDiskFull ) + { + // commands are deleted + iBuffer.ResetAndDestroy(); + BMADAPTERLOGSTRING( "\tCmd failed with CSmlDmAdapter::EDiskFull" ) + User::Leave( KErrDiskFull ); + } + else + { + BMADAPTERLOGSTRING2( + "\tCmd failed with CSmlDmAdapter::%d", + cmd->Status() ) + } + // for get commands, also return the results + if ( cmd->CmdType() == CNSmlDmBmAdapter::EGetCmd || + cmd->CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() ); + CleanupStack::PushL( result ); + result->InsertL( 0, *cmd->Data() ); + Callback().SetResultsL( cmd->ResultRef(), + *result, + KNullDesC8 ); + CleanupStack::PopAndDestroy( result ); + } + } + else + { + Callback().SetStatusL( cmd->StatusRef(), + CSmlDmAdapter::EError ); + } + settings->NodeBuf().Remove( j ); + delete cmd; + } + } + + // delete settings element and remove it from buffer + delete settings; + iBuffer.Remove( i ); + } + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::CompleteOutstandingCmdsL: End" ) + } + + + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::StoreSnapIfBufferedL +// If argument snap is found in the buffer iSettingStore->StoreSNAPL is +// called +// for it and LUID is mapped. SNAP is set as executed. +// This is called when checking if snap has embedded snap reference to +// another +// snap which is stored further in the command buffer. +// All embedded snap commands of this type are buffered and execution only +// happens with CompleteOutstandingCmdsL call. +// ------------------------------------------------------------------------- + +void CNSmlDmBmAdapter::StoreSnapIfBufferedL( const TDesC8& aURI ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StoreSnapIfBufferedL: Start" ) + CSmlDmBmSettingsElement* snap = GetSnapIfBuffered( aURI ); + // if snap is in buffer and is a new snap + if( snap && !snap->Luid() ) + { + iSettingStore->StoreSnapL( *snap ); + // set mapping if succesfully executed + if ( snap->NodeBuf()[0]->Executed() && + snap->NodeBuf()[0]->Status() == CSmlDmAdapter::EOk ) + { + HBufC8* luid = IntToDes8L( snap->Luid() ); + CleanupStack::PushL( luid ); + Callback().SetMappingL( *snap->MappingName(), *luid); + CleanupStack::PopAndDestroy( luid ); + } + } + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::StoreSnapIfBufferedL: End" ) + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetSnapUriFromLuidL +// Returns heap desciptor holding snap node URI matching the argument LUID +// ------------------------------------------------------------------------- +HBufC8* CNSmlDmBmAdapter::GetSnapUriFromLuidL( const TUint aSnapId ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetSnapURIFromLUIDL: Start" ) + HBufC8* uri( NULL ); + MSmlDmAdapter::TError err( MSmlDmAdapter::EOk ); + CBufBase* fetchRes = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( fetchRes ); + // fetch all snap nodes + Callback().FetchLinkL( KNSmlDmBMAdapterBMURI, *fetchRes, err ); + + TPtr8 snapNodes = fetchRes->Ptr( 0 ); + + TInt numSnaps = NumOfURISegs( snapNodes ); + + // get uri-luid mappings for snap nodes + for ( TInt i( 0 ); i < numSnaps; i++ ) + { + TPtrC8 node = LastURISeg( snapNodes ); + + HBufC8* uriSeg = HBufC8::NewLC( KNSmlDmBmAdapterURIMaxLength + + node.Length()); + uriSeg->Des().Append( KNSmlDmBMAdapterBM() ); + uriSeg->Des().Append( KNSmlDmBmSeparator() ); + uriSeg->Des().Append( node ); + + HBufC8* luid = Callback().GetLuidAllocL( *uriSeg ); + CleanupStack::PopAndDestroy( uriSeg ); + CleanupStack::PushL( luid ); + // node may not have luid mapped if it's just created + if( luid->Size() ) + { + TInt id = DesToIntL( *luid ); + CleanupStack::PopAndDestroy( luid ); + if ( aSnapId == id ) + { + uri = HBufC8::NewLC( KNSmlDmBMAdapterBMURI().Size() + + KNSmlDmBmSeparator().Size() + + node.Size() ); + + uri->Des().Append( KNSmlDmBMAdapterBMURI() ); + uri->Des().Append( KNSmlDmBmSeparator() ); + uri->Des().Append( node ); + break; + } + } + else + { + CleanupStack::PopAndDestroy( luid ); + } + snapNodes = RemoveLastURISeg( snapNodes ); + } + + if( uri ) + { + CleanupStack::Pop( uri ); + } + + CleanupStack::PopAndDestroy( fetchRes ); + + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::IdArrayToIAPList: End" ) + return uri; + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetIapListL +// Returns heap desciptor holding a comma separated list of AP node URIs +// matching the luids in the argument array. +// ------------------------------------------------------------------------- +HBufC8* CNSmlDmBmAdapter::GetIapListL( const RArray& aIdArray ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIapListL: Start" ) + HBufC8* iapList = HBufC8::NewLC( aIdArray.Count() * + ( KNSmlDmBmAdapterAPURIMaxLength + + KSmlMaxURISegLen ) ); + MSmlDmAdapter::TError err; + CBufBase* fetchRes = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( fetchRes ); + // fetch dynamic AP nodes, so that LUID mapping is created + Callback().FetchLinkL( KNSmlDmBMAdapterIAPURI, *fetchRes, err ); + + // list of all nodes has a trailing '/' unlike regular uris, remove that + // for further handling + TPtr8 iapNodes = fetchRes->Ptr( 0 ); + if ( iapNodes.Length() > 0 && iapNodes[iapNodes.Length() - 1] == '/') + { + iapNodes = iapNodes.Left( iapNodes.Length() - 1 ); + } + + TInt numAPs = NumOfURISegs( iapNodes ); + + CArrayFixFlat* mappings = + new (ELeave) CArrayFixFlat( numAPs * + sizeof( TSmlDmMappingInfo ) ); + CleanupStack::PushL( mappings ); + + // get uri-luid mappings for all ap nodes + HBufC8* luid = NULL; + for ( TInt i( 0 ); i < numAPs; i++ ) + { + TSmlDmMappingInfo m; + m.iURISeg = LastURISeg( iapNodes ); + + HBufC8* uriSeg = HBufC8::NewLC( KNSmlDmBmAdapterAPURIMaxLength + + m.iURISeg.Length() ); + uriSeg->Des().Replace( 0, + uriSeg->Length(), + KNSmlDmBMAdapterIAPNode() ); + uriSeg->Des().Append( KNSmlDmBmSeparator() ); + uriSeg->Des().Append( m.iURISeg ); + + luid = Callback().GetLuidAllocL( *uriSeg ); + CleanupStack::PopAndDestroy( uriSeg ); + CleanupStack::PushL( luid ); + m.iURISegLUID.Set( *luid ); + mappings->AppendL( m ); + iapNodes = RemoveLastURISeg( iapNodes ); + } + + // find out URIs matching argument IAP ids + for (TInt i(0); i < aIdArray.Count(); i++) + { + TBool found = EFalse; + + for ( TInt j( 0 ); j < mappings->Count(); j++ ) + { + if ( aIdArray[i] == DesToIntL( mappings->At( j ).iURISegLUID ) ) + { + // add to result + iapList->Des().Append( KNSmlDmBMAdapterIAPURI() ); + iapList->Des().Append( KNSmlDmBmSeparator() ); + iapList->Des().Append( mappings->At(j).iURISeg ); + // not last -> add separator + if ( i < aIdArray.Count() - 1 ) + { + iapList->Des().Append( KNSmlDmBmUriListSeparator ); + } + found = ETrue; + break; + } + } + if ( ! found ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIapListL: \ + Error IAP matching id not found" ) + User::Leave( KErrNotFound ); + } + } + + // cleanup each allocated luid + CleanupStack::PopAndDestroy( numAPs ); + CleanupStack::PopAndDestroy( mappings ); + CleanupStack::PopAndDestroy( fetchRes ); + CleanupStack::Pop( iapList ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIapListL: End" ) + return iapList; + } + +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetIdArrayL +// Returns array holding LUIDs matching the AP node in the argument list. +// ------------------------------------------------------------------------- +RArray CNSmlDmBmAdapter::GetIdArrayL( const TDesC8& aIAPList ) + { + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIdArrayL: Start" ) + TPtrC8 uri; + RArray iaps; + CleanupClosePushL( iaps ); + uri.Set( aIAPList ); + // fetch AP nodes so that mappings are created + MSmlDmAdapter::TError err; + CBufBase* fetchRes = CBufFlat::NewL( KSmlMaxURISegLen ); + CleanupStack::PushL( fetchRes ); + // fetch dynamic AP nodes, so that LUID mappings are created + Callback().FetchLinkL( KNSmlDmBMAdapterIAPURI, *fetchRes, err ); + + for ( TInt i(0), n = NumOfURIs( aIAPList ); i < n; i++ ) + { + TPtrC8 thisURI = FirstURI( uri ); + // remove ./ from beginning + TPtrC8 apUri = thisURI.Mid( KNSmlDmBmAdapterURIPrefix().Length() ); + HBufC8* luid = Callback().GetLuidAllocL( apUri ); + CleanupStack::PushL( luid ); + TInt id = DesToIntL( *luid ); + CleanupStack::PopAndDestroy( luid ); + iaps.Append( id ); + uri.Set( RemoveFirstURI( uri ) ); + } + + CleanupStack::PopAndDestroy( fetchRes ); + CleanupStack::Pop( &iaps ); + BMADAPTERLOGSTRING( "CNSmlDmBmAdapter::GetIdArrayL: End" ) + return iaps; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::IntToDes8L +// Converts integer to 8bit descriptor +// -------------------------------------------------------------------------- +HBufC8* CNSmlDmBmAdapter::IntToDes8L( TInt aLuid ) const + { + HBufC8* buf = HBufC8::NewL( KMaxLengthOf32bitInteger ); + TPtr8 ptrBuf = buf->Des(); + + // Unless aLuid is casted as TInt64, PC-Lint reports: + // Significant prototype coercion + // + ptrBuf.Num( TInt64( aLuid ) ); + return buf; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DesToIntL +// Converts 8bit descriptor to int +// -------------------------------------------------------------------------- +TUint CNSmlDmBmAdapter::DesToIntL( const TDesC8& aLuid ) const + { + __UHEAP_MARK; + TLex8 lex( aLuid ); + TUint value( 0 ); + User::LeaveIfError( lex.Val( value ) ); + __UHEAP_MARKEND; + return value; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::DesToBool +// Converts 8bit descriptor to a boolean value +// -------------------------------------------------------------------------- +TBool CNSmlDmBmAdapter::DesToBool(const TDesC8& aBoolDes, TBool& aBool ) const + { + __UHEAP_MARK; + if ( !aBoolDes.Compare( KNSmlDmBMBooleanTrue ) ) + { + aBool = ETrue; + } + else if ( !aBoolDes.Compare( KNSmlDmBMBooleanFalse ) ) + { + aBool = EFalse; + } + else + { + __UHEAP_MARKEND; + return EFalse; + } + __UHEAP_MARKEND; + return ETrue; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::BoolToDes8LC +// Converts boolean value to 8bit descriptor +// -------------------------------------------------------------------------- + +HBufC8* CNSmlDmBmAdapter::BoolToDes8LC( TBool aBool) const + { + HBufC8* ret; + if( aBool ) + { + ret = HBufC8::NewLC( KNSmlDmBMBooleanTrue().Size() ); + ret->Des().Append( KNSmlDmBMBooleanTrue() ); + } + else + { + ret = HBufC8::NewLC( KNSmlDmBMBooleanFalse().Size() ); + ret->Des().Append( KNSmlDmBMBooleanFalse() ); + } + return ret; + } + + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetLuidAllocL +// The function calls the GetLuidAllocL function of the MSmlDmCallback to get +// the LUID which is mapped to aURI. +// -------------------------------------------------------------------------- +HBufC8* CNSmlDmBmAdapter::GetLuidAllocL( const TDesC8& aURI ) + { + return Callback().GetLuidAllocL( aURI ); + } + + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::GetSnapIfBuffered +// Returns a pointer to the snap CSmlDmBmSettingsElement object if found in +// the buffer +// -------------------------------------------------------------------------- +CSmlDmBmSettingsElement* CNSmlDmBmAdapter::GetSnapIfBuffered( const TDesC8& + aMappingName ) + { + CSmlDmBmSettingsElement* settings = NULL; + for ( TInt i( 0 ); iMappingName()->Compare( aMappingName ) ) + { + settings = iBuffer[i]; + break; + } + } + return settings; + } +// ------------------------------------------------------------------------- +// CNSmlDmBmAdapter::FirstURI +// Returns the first URI from a list of URIs +// ------------------------------------------------------------------------- +TPtrC8 CNSmlDmBmAdapter::FirstURI( const TDesC8& aURIList ) const + { + __UHEAP_MARK; + TInt i; + for ( i = 0; i < aURIList.Length(); i++ ) + { + if ( aURIList[i] == ',' ) + { + break; + } + } + if ( i == aURIList.Length() - 1 ) + { + __UHEAP_MARKEND; + return aURIList; + } + else + { + __UHEAP_MARKEND; + return aURIList.Mid( 0, i ); + } + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::NumOfURIs +// Returns the num of uris +// -------------------------------------------------------------------------- +TInt CNSmlDmBmAdapter::NumOfURIs( const TDesC8& aURIList ) const + { + __UHEAP_MARK; + if ( !aURIList.Length() ) + { + return 0; + } + TInt numOfURIs( 1 ); + for ( TInt i(0); i < aURIList.Length(); i++ ) + { + if ( aURIList[i] == ',' ) + { + numOfURIs++; + } + } + __UHEAP_MARKEND; + return numOfURIs; + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::RemoveFirstURI +// extracts first uri an returns the remaining part of the uri list +// -------------------------------------------------------------------------- +TPtrC8 CNSmlDmBmAdapter::RemoveFirstURI( const TDesC8& aURIList ) const + { + __UHEAP_MARK; + TInt i; + for ( i = 0; i < aURIList.Length(); i++ ) + { + if ( aURIList[i] == ',' ) + { + break; + } + } + if ( i < aURIList.Length() ) + { + __UHEAP_MARKEND; + return aURIList.Mid( i + 1 ); + } + else + { + __UHEAP_MARKEND; + return aURIList.Mid( i ); + } + + } +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::LastURISeg +// Returns the last uri segemnt of a uri. +// -------------------------------------------------------------------------- +TPtrC8 CNSmlDmBmAdapter::LastURISeg( const TDesC8& aURI ) const + { + __UHEAP_MARK; + TInt i; + for ( i=aURI.Length()-1; i >= 0; i-- ) + { + if ( aURI[i]=='/' ) + { + break; + } + } + if ( i==0 ) + { + __UHEAP_MARKEND; + return aURI; + } + else + { + __UHEAP_MARKEND; + return aURI.Mid( i + 1 ); + } + } + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::RemoveLastURISeg +// returns parent uri, i.e. removes last uri segment +// -------------------------------------------------------------------------- +TPtrC8 CNSmlDmBmAdapter::RemoveLastURISeg( const TDesC8& aURI ) const + { + __UHEAP_MARK; + TInt i; + for ( i = aURI.Length()-1; i >= 0; i-- ) + { + if ( aURI[i]=='/' ) + { + break; + } + } + if ( i > -1 ) + { + __UHEAP_MARKEND; + return aURI.Left( i ); + } + else + { + __UHEAP_MARKEND; + return aURI; + } + + } + + + +// -------------------------------------------------------------------------- +// CNSmlDmBmAdapter::NumOfURISegs +// Returns the num of uri segs +// -------------------------------------------------------------------------- +TInt CNSmlDmBmAdapter::NumOfURISegs( const TDesC8& aURI ) const + { + __UHEAP_MARK; + TInt numOfURISegs( 1 ); + for ( TInt i(0); i < aURI.Length(); i++ ) + { + if ( aURI[i]=='/' ) + { + numOfURISegs++; + } + } + __UHEAP_MARKEND; + return numOfURISegs; + } + +TInt CNSmlDmBmAdapter::MapPredefinedSnapsL( const TDesC8& aURI, const TDesC8& aLUID ) +{ + TInt snapId( KErrNotFound ); + // If this is an add to pre-defined SNAPs then LUID we get is empty, but we still need + // to handle it. + if( aLUID.Length() == 0 && ( ( snapId = GetPredefinedSnapIdFromUri( aURI ) ) != KErrNotFound ) ) + { + // Check if SNAP with given ID exists (from CmManager) + iCmManagerExt.OpenL(); + TRAPD( err, RCmDestinationExt dest = iCmManagerExt.DestinationL( snapId ) ); + iCmManagerExt.Close(); + + // If exists -> Call SetMapping to set LUID. + if( err == KErrNone ) + { + HBufC8* uri = HBufC8::NewLC( KNSmlDmBMAdapterBM().Length() + + KNSmlDmBmSeparator().Length() + + KSmlMaxURISegLen ); + + TPtr8 uriPtr = uri->Des(); + uriPtr.Format( KNSmlDmBMAdapterBM ); + uriPtr.Append( KNSmlDmBmSeparator ); + uriPtr.Append( KNSmlDmBMSNAPNamePrefix ); + HBufC8* luidBuf = IntToDes8L( snapId ); + CleanupStack::PushL( luidBuf ); + uriPtr.Append( *luidBuf ); + + Callback().SetMappingL( uriPtr, *luidBuf ); + + BMADAPTERLOGSTRING2( "Creating mapping for URI %S ", &uriPtr ) + CleanupStack::PopAndDestroy( luidBuf ); + CleanupStack::PopAndDestroy( uri ); + } + } + return snapId; +} + +TInt CNSmlDmBmAdapter::GetPredefinedSnapIdFromUri( const TDesC8& aURI ) const + { + TInt ret = KErrNotFound; + + // First check that URI starts with BearerManagementSNAP + TInt startIndex = aURI.Find( KNSmlDmBMAdapterBM ); + + if( startIndex == KErrNotFound ) + { + return KErrNotFound; + } + + // Then assume there is separator + startIndex += KNSmlDmBMAdapterBM().Length() + KNSmlDmBmSeparator().Length(); + + if( startIndex >= aURI.Length() ) + { + // No separator. This was an access to ./BearerManagementSNAP + return KErrNotFound; + } + + TPtrC8 predefinedUriStart = aURI.Mid( startIndex ); + + startIndex = predefinedUriStart.Find( KNSmlDmBMSNAPNamePrefix ); + + // Result should be zero ( = start of string) + if( startIndex != 0 ) + { + return KErrNotFound; + } + + startIndex += KNSmlDmBMSNAPNamePrefix().Length(); + + TInt endIndex = 0; + + endIndex = predefinedUriStart.Find( KNSmlDmBmSeparator ); + + + + if ( endIndex == KErrNotFound ) + { + TPtrC8 snapId = predefinedUriStart.Mid( startIndex ); + TRAPD( err, ret = DesToIntL( snapId ) ); + if( err != KErrNone ) + { + ret = KErrNotFound; + } + } + else + { + TPtrC8 snapId = predefinedUriStart.Mid( startIndex, endIndex - startIndex ); + TRAPD( err, ret = DesToIntL( snapId ) ); + if( err != KErrNone ) + { + ret = KErrNotFound; + } + } + return ret; + } + + + +//---------------------- CSmlDmBmCommandElement -------------------------// + +// -------------------------------------------------------------------------- +// CSmlDmBmCommandElement* CSmlDmBmCommandElement::NewLC +// -------------------------------------------------------------------------- + +CSmlDmBmCommandElement* CSmlDmBmCommandElement::NewLC( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmBmAdapter::TCommandType aCmdType, + const TDesC8& aLastUriSeg, + const TDesC8& aData ) + { + CSmlDmBmCommandElement* self = new (ELeave) CSmlDmBmCommandElement( aLeaf, + aStatusRef, + aResultRef, + aCmdType ); + CleanupStack::PushL(self); + self->ConstructL( aLastUriSeg, aData ); + return self; + } + +// -------------------------------------------------------------------------- +// CSmlDmBmCommandElement::~CSmlDmBmCommandElement +// -------------------------------------------------------------------------- +CSmlDmBmCommandElement::~CSmlDmBmCommandElement() + { + delete iLastUriSeg; + delete iData; + } + +// -------------------------------------------------------------------------- +// CSmlDmBmCommandElement::CSmlDmBmCommandElement +// -------------------------------------------------------------------------- +CSmlDmBmCommandElement::CSmlDmBmCommandElement( TBool aLeaf, + TInt aStatusRef, + TInt aResultRef, + CNSmlDmBmAdapter::TCommandType aCmdType ) + : iStatus( CSmlDmAdapter::EError ), + iLeaf( aLeaf ), + iStatusRef( aStatusRef ), + iResultRef( aResultRef ), + iCmdType( aCmdType ), + iData( NULL ) + + { + } + +// -------------------------------------------------------------------------- +// CSmlDmBmCommandElement::ConstructL +// -------------------------------------------------------------------------- +void CSmlDmBmCommandElement::ConstructL( const TDesC8& aLastUriSeg, + const TDesC8& aData ) + { + iLastUriSeg = aLastUriSeg.AllocL(); + iData = aData.AllocL(); + } + +//---------------------- CSmlDmBmSettingsElement -------------------------// + +// -------------------------------------------------------------------------- +// CSmlDmBmSettingsElement* CSmlDmBmSettingsElement::NewLC +// -------------------------------------------------------------------------- +CSmlDmBmSettingsElement* CSmlDmBmSettingsElement::NewLC( const TDesC8& aMappingName ) + { + CSmlDmBmSettingsElement* self = new (ELeave) CSmlDmBmSettingsElement(); + CleanupStack::PushL(self); + self->ConstructL( aMappingName ); + return self; + } +// -------------------------------------------------------------------------- +// CSmlDmBmSettingsElement::~CSmlDmBmSettingsElement +// -------------------------------------------------------------------------- +CSmlDmBmSettingsElement::~CSmlDmBmSettingsElement() + { + // deallocate all elements + iNodeBuf.ResetAndDestroy(); + iNodeBuf.Close(); + delete iMappingName; + } + +// -------------------------------------------------------------------------- +// CSmlDmBmSettingsElement::CSmlDmBmSettingsElement +// -------------------------------------------------------------------------- +CSmlDmBmSettingsElement::CSmlDmBmSettingsElement() + : iExecuted( EFalse ), + iLuid( 0 ), + iMappingName( NULL ) + { + + } +// -------------------------------------------------------------------------- +// CSmlDmBmSettingsElement::ConstructL +// -------------------------------------------------------------------------- +void CSmlDmBmSettingsElement::ConstructL( const TDesC8& aMappingName ) + { + iMappingName = aMappingName.AllocL(); + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/src/nsmldmbmadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/src/nsmldmbmadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,45 @@ +CHARACTER_SET UTF8/* +* Copyright (c) 2006 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 nsmldmbmadapter +* +*/ + + + +#include + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101f6d2f; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x102018B4; //DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101f6d2f; // BM adapter implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldmbmadapter/src/nsmldmbmsettingstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldmbmadapter/src/nsmldmbmsettingstore.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,851 @@ +/* +* Copyright (c) 2006 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 CommsDat. +* +*/ + + + + +#include +#include +#include +#include +#include + +#include "nsmldmbmsettingstore.h" +#include "nsmldmbmadapter.h" +#include "bmadapterlogger.h" + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::NewL +// ----------------------------------------------------------------------------- +CNSmlDmBmSettingStore* CNSmlDmBmSettingStore::NewL( CNSmlDmBmAdapter * aAdapter ) + { + CNSmlDmBmSettingStore* self = new (ELeave) CNSmlDmBmSettingStore( aAdapter ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::CNSmlDmBmSettingStore +// ----------------------------------------------------------------------------- +CNSmlDmBmSettingStore::CNSmlDmBmSettingStore( CNSmlDmBmAdapter * aAdapter ) + : iAdapter( aAdapter ) + { + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ConstructL +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::ConstructL() + { + iCmManagerExt.OpenL(); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::~CNSmlDmBmSettingStore +// ----------------------------------------------------------------------------- +CNSmlDmBmSettingStore::~CNSmlDmBmSettingStore() + { + iCmManagerExt.Close(); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::StoreSnapL +// Stores data related to a snap object. Executes commands for the snap and fills +// in status and for get commands result values. +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::StoreSnapL( CSmlDmBmSettingsElement& aSettings ) + { + // this snap has been handled + aSettings.SetExecuted( ETrue ); + + // error empty settings object + if ( !aSettings.NodeBuf().Count() ) + { + BMADAPTERLOGSTRING( "StoreSnapL: Error, No commands found" ) + return; + } + + TInt nameCmdInd( -1 ); + TInt startInd( 0 ); + RCmDestinationExt snap; + TInt snapId( 0 ); + + // New SNAP to be stored, first command is add node + if( !aSettings.NodeBuf()[0]->Leaf() && + aSettings.NodeBuf()[0]->CmdType() == CNSmlDmBmAdapter::EAddCmd) + { + CSmlDmBmCommandElement* snapCmd( NULL ); + CSmlDmBmCommandElement* nameCmd( NULL ); + + snapCmd = aSettings.NodeBuf()[0]; + startInd = 1; + + // find name command + for ( TInt i( 0 ); i < aSettings.NodeBuf().Count(); i++) + { + if ( aSettings.NodeBuf()[i]->Leaf() && + !aSettings.NodeBuf()[i]->LastUriSeg()->Compare( KNSmlDmBMAdapterName ) ) + { + nameCmd = aSettings.NodeBuf()[i]; + nameCmdInd = i; + break; + } + } + // Snap can be created when name cmd exists + if ( snapCmd && nameCmd ) + { + HBufC* name = HBufC::NewLC( nameCmd->Data()->Size() ); + TPtr namePtr = name->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, *nameCmd->Data() ); + snap = iCmManagerExt.CreateDestinationL( namePtr ); + CleanupStack::PopAndDestroy( name ); + CleanupClosePushL( snap ); + + snap.UpdateL(); + snapCmd->SetStatus( CSmlDmAdapter::EOk ); + nameCmd->SetStatus( CSmlDmAdapter::EOk ); + snapCmd->SetExecuted( ETrue ); + nameCmd->SetExecuted( ETrue ); + aSettings.SetLuid( snap.Id() ); + } + else + { + BMADAPTERLOGSTRING( "StoreSnapL: Error, SNAP doesn't have necessary data and can't be stored" ) + return; + } + } + // existing SNAP + else + { + snap = iCmManagerExt.DestinationL( aSettings.Luid() ); + CleanupClosePushL( snap ); + } + snapId = snap.Id(); + TInt err( KErrNone ); + // execute all remaining commands for the snap + // starting after add node cmd + for ( TInt i( startInd ); i < aSettings.NodeBuf().Count(); i++ ) + { + // name command is already executed -> skipped + if ( i != nameCmdInd ) + { + CSmlDmBmCommandElement* currentCmd = aSettings.NodeBuf()[i]; + // handle leaf commands + // leaves are trapped and if possible + // execution continues with remaining commands + if ( currentCmd->Leaf() ) + { + // name + if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterName() ) ) + { + // name is set more than once within same message + TRAP( err, ExecuteNameCmdL( *currentCmd, snap ) ); + } + // metadata + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterMetadata ) ) + { + TRAP( err, ExecuteMetadataCmdL( *currentCmd, snap ) ); + } + // protected + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterProtected ) ) + { + TRAP( err, ExecuteProtectionCmdL( *currentCmd, snap ) ); + } + // hidden + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterHidden ) ) + { + TRAP( err, ExecuteHiddenCmdL( *currentCmd, snap ) ); + } + // iap list + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterIAPPriorityList ) ) + { + TRAP( err, ExecuteIapsCmdL( *currentCmd, snap ) ); + } + // embedded snap + else if ( !currentCmd->LastUriSeg()->Compare( KNSmlDmBMAdapterEmbeddedSNAP ) ) + { + TRAP( err, ExecuteEmbeddedSnapCmdL( *currentCmd, snap ) ); + } + else + { + // invalid node + BMADAPTERLOGSTRING( "StoreSnapL: Error, Invalid node name" ) + currentCmd->SetStatus( CSmlDmAdapter::ENotFound ); + err = KErrNone; + } + } + // snap node + else + { + TRAP( err, ExecuteSnapCmdL( *currentCmd, snap.Id() ) ); + // no more commands will be executed + // after snap is deleted + if( currentCmd->CmdType() == CNSmlDmBmAdapter::EDeleteCmd ) + { + break; + } + } + + // handle errors, check if execution may continue + if( err != KErrNone ) + { + // cases where not worth continuing + // attempt to return status codes however + if( err == KErrNoMemory ) + { + currentCmd->SetStatus( CSmlDmAdapter::ENoMemory ); + currentCmd->SetExecuted( ETrue ); + break; + } + else if( err == KErrDiskFull ) + { + currentCmd->SetStatus( CSmlDmAdapter::EDiskFull ); + currentCmd->SetExecuted( ETrue ); + break; + } + // cases where command execution continues + else if( err == KErrNotFound ) + { + currentCmd->SetStatus( CSmlDmAdapter::ENotFound ); + } + else if( err == KErrArgument ) + { + currentCmd->SetStatus( CSmlDmAdapter::EInvalidObject ); + } + else + { + currentCmd->SetStatus( CSmlDmAdapter::EError ); + } + // if error occurred, reopen snap to dismis any changes + // continue with rest of buffered commands + CleanupStack::PopAndDestroy( &snap ); + snap = iCmManagerExt.DestinationL( snapId ); + CleanupClosePushL( snap ); + } + // if leaf cmd execution was successful and data written -> update the snap + else if( currentCmd->Leaf() && + currentCmd->Status() == CSmlDmAdapter::EOk && + currentCmd->CmdType() != CNSmlDmBmAdapter::EGetCmd && + currentCmd->CmdType() != CNSmlDmBmAdapter::EGetSizeCmd ) + { + snap.UpdateL(); + } + else + { + BMADAPTERLOGSTRING( + "StoreSnapL: Leaf cmd execution unsuccessful" ) + } + currentCmd->SetExecuted( ETrue ); + + } + } + CleanupStack::PopAndDestroy( &snap ); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteCmdL +// Executes a single command +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::ExecuteCmdL( CSmlDmBmCommandElement& aCmd, TUint aLuid) + { + if( !aCmd.Leaf() ) + { + ExecuteSnapCmdL( aCmd, aLuid ); + } + else + { + // snap can be opened + RCmDestinationExt snap = iCmManagerExt.DestinationL( aLuid ); + CleanupClosePushL( snap ); + // name + if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterName ) ) + { + ExecuteNameCmdL( aCmd, snap ); + } + // iap list + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterIAPPriorityList ) ) + { + ExecuteIapsCmdL( aCmd, snap ); + } + // metadata + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterMetadata ) ) + { + ExecuteMetadataCmdL( aCmd, snap ); + } + // protected + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterProtected ) ) + { + ExecuteProtectionCmdL( aCmd, snap ); + } + // hidden + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterHidden ) ) + { + ExecuteHiddenCmdL( aCmd, snap ); + } + // embedded snap + else if ( !aCmd.LastUriSeg()->Compare( KNSmlDmBMAdapterEmbeddedSNAP ) ) + { + ExecuteEmbeddedSnapCmdL( aCmd, snap ); + } + else + { + // invalid node + BMADAPTERLOGSTRING( "ExecuteCmdL: Error, Invalid node name" ) + aCmd.SetStatus( CSmlDmAdapter::ENotFound ); + } + // update snap if necessary + if( aCmd.Status() == CSmlDmAdapter::EOk && + aCmd.CmdType() != CNSmlDmBmAdapter::EGetCmd && + aCmd.CmdType() != CNSmlDmBmAdapter::EGetSizeCmd) + { + snap.UpdateL(); + } + aCmd.SetExecuted( ETrue ); + CleanupStack::PopAndDestroy( &snap ); + } + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::GetSnapsL +// Fetches all snap ids +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::GetSnapsL( RArray& aLUIDArray ) + { + iCmManagerExt.AllDestinationsL( aLUIDArray); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteSnapCmdL +// Executes a command for snap node. Either delete or get, adds are handled +// in StoreSNAPL +// ----------------------------------------------------------------------------- +void CNSmlDmBmSettingStore::ExecuteSnapCmdL( CSmlDmBmCommandElement& aCmd, TUint aLuid ) + { + RCmDestinationExt snap = iCmManagerExt.DestinationL( aLuid ); + CleanupClosePushL( snap ); + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd ) + { + TBool found( EFalse ); + // get child node list + + // check if snap has embedded snap + for ( TInt i(0), c = snap.ConnectionMethodCount(); i < c; i++ ) + { + RCmConnectionMethodExt cm = snap.ConnectionMethodL( i ); + if ( cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + found = ETrue; + break; + } + } + if( found ) + { + aCmd.SetDataL( KNSmlDmBMAllLeafNodes ); + } + else + { + aCmd.SetDataL( KNSmlDmBMAllLeafNodesNoEmbedded ); + } + + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + CleanupStack::PopAndDestroy( &snap ); + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EDeleteCmd ) + { + snap.DeleteLD(); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + CleanupStack::Pop( &snap ); + } + else + { + BMADAPTERLOGSTRING( "ExecuteSnapCmdL: Error, Invalid cmd type" ) + aCmd.SetStatus( CSmlDmAdapter::EError ); + CleanupStack::PopAndDestroy( &snap ); + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteIapsCmdL +// Executes an iap list command (add or get). +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteIapsCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + // for add command replace the list of iaps with the new one + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + // remove old iaps + for( TInt i(0); i < aSnap.ConnectionMethodCount(); ) + { + RCmConnectionMethodExt cm = aSnap.ConnectionMethodL( i ); + // if iap, remove + if ( !cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + aSnap.RemoveConnectionMethodL( cm ); + } + // otherwise skip the ebedded snap entry + else + { + i++; + } + } + // add new list of iaps + RArray iaps = iAdapter->GetIdArrayL( *aCmd.Data() ); + CleanupClosePushL( iaps ); + TInt wildcard(0); + for ( TInt i( 0 ); i < iaps.Count(); i++ ) + { + RCmConnectionMethodExt cm = iCmManagerExt.ConnectionMethodL( iaps[i] ); + aSnap.AddConnectionMethodL( cm ); + if ( aSnap.PriorityL( cm ) != CMManager::KDataMobilitySelectionPolicyPriorityWildCard ) + { + // set the priority of iap as it's index in the list + // but preceding any iaps with wildcard priority. + aSnap.ModifyPriorityL( cm, i - wildcard ); + } + else + { + wildcard++; + } + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + CleanupStack::PopAndDestroy( &iaps ); + } + // for get command fetch the list of iaps + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + RArray ids; + CleanupClosePushL( ids ); + for ( TInt i(0), c = aSnap.ConnectionMethodCount(); i < c; i++ ) + { + // if not embedded snap or hidden, insert into iap list + // (hidden iaps not handled by internet adapter, so link won't be found) + if( !aSnap.ConnectionMethodL(i).GetBoolAttributeL( CMManager::ECmDestination ) && + !aSnap.ConnectionMethodL(i).GetBoolAttributeL( CMManager::ECmHidden ) ) + { + ids.Insert( aSnap.ConnectionMethodL(i).GetIntAttributeL( + CMManager::ECmIapId ), i ); + } + } + if ( ids.Count() > 0) + { + HBufC8* iapList = iAdapter->GetIapListL( ids ); + CleanupStack::PushL( iapList ); + aCmd.SetDataL( *iapList ); + CleanupStack::PopAndDestroy( iapList ); + } + else + { + aCmd.SetDataL( KNullDesC8 ); + } + CleanupStack::PopAndDestroy( &ids ); + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteIapsCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteProtectionCmdL +// Executes an protected command (add or get). +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteProtectionCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + __UHEAP_MARK; + TInt data( iAdapter->DesToIntL( *aCmd.Data() ) ); + // is proper protection level + if ( data == CMManager::EProtLevel0 ) + { + aSnap.SetProtectionL( CMManager::EProtLevel0 ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( data == CMManager::EProtLevel1 ) + { + aSnap.SetProtectionL( CMManager::EProtLevel1 ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( data == CMManager::EProtLevel2 ) + { + aSnap.SetProtectionL( CMManager::EProtLevel2 ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else + { + aCmd.SetStatus( CSmlDmAdapter::EInvalidObject ); + } + __UHEAP_MARKEND; + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* data = iAdapter->IntToDes8L( aSnap.ProtectionLevel() ); + CleanupStack::PushL( data ); + aCmd.SetDataL( *data ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteProtectionCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteHiddenCmdL +// Executes hidden command (add or get) +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteHiddenCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + __UHEAP_MARK; + TBool data; + if( iAdapter->DesToBool( *aCmd.Data(), data ) ) + { + aSnap.SetHiddenL( data ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else + { + aCmd.SetStatus( CSmlDmAdapter::EInvalidObject ); + } + __UHEAP_MARKEND; + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* data = iAdapter->BoolToDes8LC( aSnap.IsHidden() ); + aCmd.SetDataL( *data ); + CleanupStack::PopAndDestroy( data ); + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteHiddenCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteMetadataCmdL +// Executes metadata command (add or get) +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteMetadataCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + __UHEAP_MARK; + + TInt data( iAdapter->DesToIntL( *aCmd.Data() ) ); + // AND with inversed bit masks to check if data + // has bits set that are not defined for metadata + if( ( data & + ~CMManager::ESnapMetadataHighlight & + ~CMManager::ESnapMetadataHiddenAgent & + ~CMManager::ESnapMetadataPurpose ) ) + { + aCmd.SetStatus( CSmlDmAdapter::EError ); + } + // set value for each metadata bit + else + { + aSnap.SetMetadataL( CMManager::ESnapMetadataHighlight, + CMManager::ESnapMetadataHighlight & data ); + aSnap.SetMetadataL( CMManager::ESnapMetadataHiddenAgent, + CMManager::ESnapMetadataHiddenAgent & data ); + aSnap.SetMetadataL( CMManager::ESnapMetadataPurpose, + ( CMManager::ESnapMetadataPurpose & data ) >> KShift8 ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + __UHEAP_MARKEND; + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + // get all metadata values + TInt metadata(0); + metadata = aSnap.MetadataL( CMManager::ESnapMetadataHighlight ) + + aSnap.MetadataL( CMManager::ESnapMetadataHiddenAgent ) + + ( aSnap.MetadataL( CMManager::ESnapMetadataPurpose ) << KShift8 ); + HBufC8* data = iAdapter->IntToDes8L( metadata ); + CleanupStack::PushL( data ); + aCmd.SetDataL( *data ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteMetadataCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteEmbeddedSnapCmdL +// Executes embedded snap command (add, get or delete) +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteEmbeddedSnapCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + // Remove ./ from beginning of the URI + TPtrC8 embeddedUri = aCmd.Data()->Mid( KNSmlDmBmAdapterURIPrefix().Length() ); + + // if the embedded snap is still in buffer it's stored here + iAdapter->StoreSnapIfBufferedL( embeddedUri ); + // LUID mapping is assumed done by this time + + // get SNAP id for the URI + HBufC8* luid = iAdapter->GetLuidAllocL( embeddedUri ); + CleanupStack::PushL( luid ); + if ( luid->Size() > 0 ) + { + TInt id = iAdapter->DesToIntL( *luid ); + + // open snap with the id + RCmDestinationExt embedded = iCmManagerExt.DestinationL( id ); + CleanupClosePushL( embedded ); + + // check if snap has an existing embedded snap + for ( TInt i(0), c = aSnap.ConnectionMethodCount(); i < c; i++ ) + { + RCmConnectionMethodExt cm = aSnap.ConnectionMethodL( i ); + // remove existing embedded snap before adding new one + if ( cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + aSnap.DeleteConnectionMethodL( cm ); + break; + } + } + aSnap.AddEmbeddedDestinationL( embedded ); + CleanupStack::PopAndDestroy( &embedded ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else + { + // no luid for the uri + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: No LUID found for embedded snap" ) + aCmd.SetStatus( CSmlDmAdapter::EInvalidObject ); + } + aCmd.SetExecuted( ETrue ); + CleanupStack::PopAndDestroy( luid ); + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + // get destination + TInt embeddedId( -1 ); + for ( TInt i( 0 ), c = aSnap.ConnectionMethodCount(); i < c; i++ ) + { + RCmConnectionMethodExt cm = aSnap.ConnectionMethodL( i ); + // check if embedded + if ( cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + // get snap id + embeddedId = cm.GetIntAttributeL( CMManager::ECmId ); + + // CMManager::ECmId returns element id, + // GetSnapUriFromLuidL needs record id + embeddedId = ( embeddedId & KCDMaskShowRecordId ) >> KShift8; + + HBufC8* embeddedUri = iAdapter->GetSnapUriFromLuidL( embeddedId ); + CleanupStack::PushL( embeddedUri ); + + if( !embeddedUri ) + { + embeddedId = -1; + break; + } + aCmd.SetDataL( *embeddedUri ); + CleanupStack::PopAndDestroy( embeddedUri ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + break; + } + } + // if no embedded snap exists return not found + if ( embeddedId < 0 ) + { + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: Get, No embedded snap found" ) + aCmd.SetStatus( CSmlDmAdapter::ENotFound ); + aCmd.SetExecuted( ETrue ); + } + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EDeleteCmd ) + { + TBool found( EFalse); + for ( TInt i( 0 ), c = aSnap.ConnectionMethodCount(); i < c; i++ ) + { + RCmConnectionMethodExt cm = aSnap.ConnectionMethodL( i ); + // find embedded snap and delete it + if ( cm.GetBoolAttributeL( CMManager::ECmDestination ) ) + { + found = ETrue; + aSnap.DeleteConnectionMethodL( cm ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + break; + } + } + if ( !found ) + { + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: Delete, No embedded snap found" ) + aCmd.SetStatus( CSmlDmAdapter::ENotFound ); + aCmd.SetExecuted( ETrue ); + } + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + aCmd.SetExecuted( ETrue ); + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: Error, command not supported" ) + } + } + +// --------------------------------------------------------------------------- +// CNSmlDmBmSettingStore::ExecuteNameCmdL +// Executes name command (add or get ) +// --------------------------------------------------------------------------- +// +void CNSmlDmBmSettingStore::ExecuteNameCmdL( CSmlDmBmCommandElement& aCmd, + RCmDestinationExt& aSnap ) + { + if ( aCmd.CmdType() == CNSmlDmBmAdapter::EAddCmd ) + { + HBufC* name = HBufC::NewLC( aCmd.Data()->Size() ); + TPtr namePtr = name->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8( namePtr, *aCmd.Data() ); + aSnap.SetNameL( namePtr ); + CleanupStack::PopAndDestroy( name ); + aCmd.SetStatus( CSmlDmAdapter::EOk ); + } + else if ( aCmd.CmdType() == CNSmlDmBmAdapter::EGetCmd || + aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC* data = aSnap.NameLC(); + HBufC8* data8 = HBufC8::NewLC( data->Size() ); + TPtr8 toPtr = data8->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( toPtr, *data ); + aCmd.SetDataL( *data8 ); + CleanupStack::PopAndDestroy( data8 ); + CleanupStack::PopAndDestroy( data ); + + // for size command, set the command data to be the + // size of the fetched data + if( aCmd.CmdType() == CNSmlDmBmAdapter::EGetSizeCmd ) + { + HBufC8* size = iAdapter->IntToDes8L( aCmd.Data()->Size() ); + CleanupStack::PushL( size ); + aCmd.SetDataL( *size ); + CleanupStack::PopAndDestroy( size ); + } + aCmd.SetStatus( CSmlDmAdapter::EOk ); + aCmd.SetExecuted( ETrue ); + } + else + { + // unsupported command + // this is checked by framework + aCmd.SetStatus( CSmlDmAdapter::EError ); + BMADAPTERLOGSTRING( "ExecuteEmbeddedSnapCmdL: Error, Only Add, Get and Get size commands supported" ) + } + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,30 @@ +/* +* 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 info file for internet settings adapter +* +*/ + + + +#include + +PRJ_PLATFORMS + +PRJ_EXPORTS + +PRJ_MMPFILES +./nsmlinternetadapter.mmp + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/group/nsmlinternetadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/group/nsmlinternetadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2004-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: InternetAdapter +* +*/ + + + +#include "defaultcaps.hrh" +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET nsmlinternetadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101F6DEA +VENDORID VID_DEFAULT + + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +USERINCLUDE ../inc + +SOURCE NSmlInternetAdapter.cpp + +SOURCE NSmlWLanAdapter.cpp +SOURCE NSmlWlanSettings.cpp + +START RESOURCE NSmlInternetAdapter.rss +END + +LANG sc + +LIBRARY charconv.lib commdb.lib efsrv.lib ecom.lib euser.lib nsmldmclientserverutils.lib +LIBRARY nsmldebug.lib sysutil.lib +LIBRARY inetprotutil.lib +LIBRARY commsdat.lib +LIBRARY cmmanager.lib +LIBRARY cmmanagerdatabase.lib +LIBRARY centralrepository.lib FeatMgr.lib +LIBRARY policyengine.lib +LIBRARY nsmldmtreedbclient.lib +LIBRARY eaptools.lib + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/inc/NSmlInternetAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/inc/NSmlInternetAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,533 @@ +/* + * 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: Internet-settings + * + */ + +#ifndef __NSMLINTERNETADAPTER_H__ +#define __NSMLINTERNETADAPTER_H__ + +// SyncML device management LoginScript +//#define __SYNCML_DM_LSCRIPT 1 +//#define __SYNCML_DM_WLAN 1 +// ------------------------------------------------------------------------------------------------ +// Includes +// ------------------------------------------------------------------------------------------------ +#include +#include +#include +#include +#include "smldmadapter.h" +#include "nsmlconstants.h" + +#include "NSmlWLanAdapter.h" +#include "NSmlWlanSettings.h" + +const TInt KNSmlInternetAdapterFatMinSize = 512; +const TInt KNSmlIncompleteAP = -1; +// Buffering Stuff +const TInt KNSmlAPGranularity = 4; +const TUint8 KNSmlDMUriSeparator = 0x2f; + +const TUint8 KNSmlDMDot = 0x2e; +const TUint8 KNSmlDMAsciiIntStart = 0x30; +const TUint8 KNSmlDMAsciiIntEnd = 0x39; +// Other constants +const TInt KNSmlApDnsLuidUpperBase = 300000; +const TInt KNSmlAp3gpppsLowerBase = 50000; +const TInt KNSmlApProxyLowerBase = 100000; +const TInt KNSmlApProxyUpperBase = 200000; +const TInt KNSmlApWapLowerBase = 9200; +const TInt KNSmlApWapUpperBase = 9203; + +//DDF version number +_LIT8( KNSmlInternetAdapterDDFversion, "1.1"); + +//DDF accepted AP-fieldnames +_LIT8( KNSmlDdfAP, "AP" ); + +_LIT8( KNSmlDdfPx, "Px" ); +_LIT8( KNSmlDdfPxName, "Name" ); +_LIT8( KNSmlDdfPxId, "PxID" ); +_LIT8( KNSmlDdfPxPW, "PxPW" ); +_LIT8( KNSmlDdfPPGAuthTy, "PPGAuthTy" ); +_LIT8( KNSmlDdfDomain, "Domain" ); +_LIT8( KNSmlDdfDomainL, "DomainL" ); +_LIT8( KNSmlDdfPxAddr, "PxAddr" ); +_LIT8( KNSmlDdfToNAPID, "ToNAPID" ); +_LIT8( KNSmlDdfToNAPIDL, "ToNAPIDL" ); +_LIT8( KNSmlDdfStartpg, "Startpg" ); +_LIT8( KNSmlDdfBasAuthId, "BasAuthId" ); +_LIT8( KNSmlDdfBasAuthPW, "BasAuthPW" ); +_LIT8( KNSmlDdfPort, "Port" ); +_LIT8( KNSmlDdfPortNbr, "PortNbr" ); +_LIT8( KNSmlDdfPxAuthTy, "PxAuthTy" ); +_LIT8( KNSmlDdfService, "Service" ); +_LIT8( KNSmlDdfServiceL, "ServiceL" ); +_LIT8( KNSmlDdfUsePTxtLog, "UsePTxtLog" ); + +_LIT8( KNSmlDdfGPRSPDP, "GPRSPDP" ); +_LIT8( KNSmlDdfDefGW, "DefGW" ); +_LIT8( KNSmlDdfNetworkMask, "NetworkMask" ); + +_LIT8( KNSmlDdfPPPComp, "PPPComp" ); + +_LIT8( KNSmlDdfNAPDef, "NAPDef" ); +_LIT8( KNSmlDdfNAPName, "Name" ); +_LIT8( KNSmlDdfNAPLinger, "Linger" ); +_LIT8( KNSmlDdfNAPID, "NAPID" ); +_LIT8( KNSmlDdfBearer, "Bearer" ); +_LIT8( KNSmlDdfBearerL, "BearerL" ); +_LIT8( KNSmlDdfDirection, "Direction" ); +_LIT8( KNSmlDdfInternet, "Internet" ); +_LIT8( KNSmlDdfNAPAddr, "NAPAddr" ); +_LIT8( KNSmlDdfNAPAddrTy, "NAPAddrTy" ); +_LIT8( KNSmlDdfDNSAddr, "DNSAddr" ); +_LIT8( KNSmlDdfDNSAddrL, "DNSAddrL" ); +_LIT8( KNSmlDdfDNSAddrTy, "DNSAddrTy" ); +_LIT8( KNSmlDdfDNSPriority, "DNSPriority" ); +_LIT8( KNSmlDdfNAPAuthInf, "NAPAuthInf" ); +_LIT8( KNSmlDdfAuthName, "AuthName" ); +_LIT8( KNSmlDdfAuthSecr, "AuthSecr" ); +_LIT8( KNSmlDdfPxAuthInf, "PxAuthInf" ); +_LIT8( KNSmlDdfPxAuthId, "PxAuthID" ); +_LIT8( KNSmlDdfPxAuthPW, "PxAuthPW" ); + +_LIT8( KNSmlDdfIPAddrFromServer,"IPAddrFromServer" ); +_LIT8( KNSmlDdfIPAddr, "IPAddr" ); +_LIT8( KNSmlDdfDNSAddrFromServer,"IPDNSAddrFromServer" ); +_LIT8( KNSmlDdfIPv6DNSAddrFromServer,"IPv6DNSAddrFromServer" ); +_LIT8( KNSmlDdfIfNetworks, "IfNetworks" ); +_LIT8( KNSmlDdfIAPService, "IAPService" ); +_LIT8( KNSmlDdfLANService, "LANService" ); + +_LIT8( KNSmlDdfIAPSeamlessness, "Seamlessness" ); +_LIT8( KNSmlDdfIAPMetaData, "MetaData" ); + +_LIT8( KNSmlDdfNoPxFor, "NoPxFor" ); +_LIT8( KNSmlDdfNoPxForL, "NoPxForL" ); + +_LIT8( KNSmlDdfNetworks, "Networks" ); +_LIT8( KNSmlDdfNetworkName, "Name" ); +_LIT8( KNSmlDdfNetworkID, "ID" ); + +//DDF AP-field descriptions +_LIT8( KNSmlDdfAPDesc, "AP (Access Point) node" ); + +_LIT8( KNSmlDdfPxDesc, "Px (Proxy) node" ); +_LIT8( KNSmlDdfPxNameDesc, "Px name description" ); +_LIT8( KNSmlDdfNameDesc, "Displayable name for the Proxy" ); +_LIT8( KNSmlDdfPxIdDesc, "Define one Proxy entity" ); +_LIT8( KNSmlDdfPxPWDesc, "Password for one Proxy entity" ); +_LIT8( KNSmlDdfPPGAuthTyDesc, "Link PxID and PxPW to an authentication method" ); +_LIT8( KNSmlDdfPxAddrDesc, "Proxy-Address" ); +_LIT8( KNSmlDdfToNAPIDDesc, "Parent to all Network Access Point link objects" ); +_LIT8( KNSmlDdfToNAPIDLDesc, "NAPID end" ); +_LIT8( KNSmlDdfStartpgDesc, "The WAP homepage or start page" ); +_LIT8( KNSmlDdfBasAuthIdDesc, "Basic authentication identifier" ); +_LIT8( KNSmlDdfBasAuthPWDesc, "Basic authentication password" ); +_LIT8( KNSmlDdfPortDesc, "Port node" ); +_LIT8( KNSmlDdfPortNbrDesc, "Value of the port number" ); +_LIT8( KNSmlDdfServiceDesc, "Service node" ); +_LIT8( KNSmlDdfServiceLDesc, "ServiceL" ); +_LIT8( KNSmlDdfUsePTxtLogDesc, "Plain Text Login is used or not" ); + +_LIT8( KNSmlDdfGPRSPDPDesc, "GPRS PDP-type" ); +_LIT8( KNSmlDdfDefGWDesc, "Default Gateway" ); +_LIT8( KNSmlDdfNetworkMaskDesc, "Network/Subnet mask" ); + +_LIT8( KNSmlDdfPPPCompDesc, "PPP Compression" ); + +_LIT8( KNSmlDdfNAPDefDesc, "Network Access Point Definition objects parent" ); +_LIT8( KNSmlDdfNAPNameDesc, "Displayable name for the NAP" ); +_LIT8( KNSmlDdfNAPIDDesc, "Used by TO-NAPID link of the Proxy" ); +_LIT8( KNSmlDdfNAPLingerDesc, "Linger value" ); +_LIT8( KNSmlDdfBearerDesc, "Bearer node" ); +_LIT8( KNSmlDdfBearerLDesc, "Bearer valid" ); +_LIT8( KNSmlDdfDirectionDesc, "Direction for network type" ); +_LIT8( KNSmlDdfInternetDesc, "IP-routable network segment" ); +_LIT8( KNSmlDdfNAPAddrDesc, "NAP-Address" ); +_LIT8( KNSmlDdfNAPAddrTyDesc, "NAP-Address-Type" ); +_LIT8( KNSmlDdfDNSAddrDesc, "DNSAddr node" ); +_LIT8( KNSmlDdfDNSAddrLDesc, "Address of a DNS server" ); +_LIT8( KNSmlDdfDNSAddrTyDesc, "Type of DNS address" ); +_LIT8( KNSmlDdfDNSPriorityDesc, "Rank of DNS server" ); +_LIT8( KNSmlDdfNAPAuthInfDesc, "Authentication Info" ); +_LIT8( KNSmlDdfAuthNameDesc, "Loginname" ); +_LIT8( KNSmlDdfAuthSecrDesc, "Loginpassword" ); +_LIT8( KNSmlDdfPxAuthInfDesc, "Proxy Authentication Info" ); +_LIT8( KNSmlDdfPxAuthIdDesc, "Proxy Loginname" ); +_LIT8( KNSmlDdfPxAuthPWDesc, "Proxy Loginpassword" ); + +_LIT8( KNSmlDdfIPAddrFromServerDesc,"Get IP addresses from server?" ); +_LIT8( KNSmlDdfIPAddrDesc, "IP-address" ); +_LIT8( KNSmlDdfDNSAddrFromServerDesc,"Get DNS addresses from server?" ); +_LIT8( KNSmlDdfIPv6DNSAddrFromServerDesc,"Get IPv6 addresses from server?" ); +_LIT8( KNSmlDdfIfNetworksDesc, "Comma separated list of network protocols, e.g. PPP" ); +_LIT8( KNSmlDdfIAPServiceDesc, "IAP service" ); + +_LIT8( KNSmlDdfIAPSeamlessnessDesc, "IAP seamlessness value" ); +_LIT8( KNSmlDdfIAPMetaDataDesc, "IAP meta data value" ); + +_LIT8( KNSmlDdfDomainDesc, "Domain desc" ); +_LIT8( KNSmlDdfDomainLDesc, "Domain, for which the Proxy is responsible" ); + +_LIT8( KNSmlDdfNoPxForDesc, "No proxy for listed AP:s" ); +_LIT8( KNSmlDdfNoPxForLDesc, "No proxy for this AP" ); + +_LIT8( KNSmlDdfNetworksDesc, "Networks" ); +_LIT8( KNSmlDdfNetworkNameDesc, "Network Name" ); +_LIT8( KNSmlDdfNetworkIDDesc, "Network ID" ); + +//Other +_LIT8( KNSmlDNS1, "/DNS1" ); +_LIT8( KNSmlDNS2, "/DNS2" ); +_LIT8( KNSmlDNS3, "/DNS3" ); +_LIT8( KNSmlDNS4, "/DNS4" ); + +_LIT8(KNSmlAPnode, "NAPDef/Px"); + +_LIT8(KNSmlNAPDefGPRSnode, "Name/NAPID/Startpg/Bearer/IPAddr/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/IPDNSAddrFromServer/IPv6DNSAddrFromServer/DNSAddr/NAPAuthInf/DefGW/NetworkMask/PPPComp/UsePTxtLog/GPRSPDP/Networks/IAPService/Seamlessness/MetaData/Linger"); + +//_LIT8(KNSmlNAPDefCSDnode, "Name/NAPID/Bearer/IPAddr/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/CallTy/IPDNSAddrFromServer/IPv6DNSAddrFromServer/DNSAddr/NAPAuthInf/LnkSpeed/DefGW/NetworkMask/PPPComp/UseCB/CBTy/CBNbr/UsePTxtLog/ModemInit/Networks/IAPService"); + +//_LIT8(KNSmlNAPDefGPRSnode, "Name/NAPID/Bearer/IPAddr/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/CallTy/IPDNSAddrFromServer/IPv6DNSAddrFromServer/DNSAddr/NAPAuthInf/LnkSpeed/DefGW/NetworkMask/PPPComp/UsePTxtLog/GPRSPDP/Networks/IAPService"); + +_LIT8(KNSmlPxnode, "Name/PxID/PxAddr/Port/ToNAPID/Startpg/Domain/PxAuthInf/NoPxFor"); + +#ifdef __SYNCML_DM_LSCRIPT +_LIT8(KNSmlLoginscriptnode, "/LoginTW/LoginScriptData"); +#endif + +_LIT8(KNSmlDNSAddrNode, "DNSAddrL/DNSAddrTy/DNSPriority" ); + +_LIT8(KNSmlWLannode, "/WLAN/SSID/UsedSSID/SSIDHidden/UseWPAPSK/NetworkMode/SecurityMode/WEPAuthMode/WPAPreSharedKey/WLANEAPList/WEPKeyIndex/WEPKey/Data/Length/WEPKeyID/Username/Password/EAPType/Realm/UsePseudonym/Encapsulation/VerifyCertRealm/RequireClientAuthentication/SessionValidityTime/CipherSuite/AllowPEAPv0/AllowPEAPv1/AllowPEAPv2/IssuerName/SubjectName/CertType/SerialNumber/SubjectKeyId/Fingerprint"); + +//Default data values +_LIT( KNSmlDefName, "APAdapterIns" ); +_LIT( KNSmlDefAP, "AP" ); +_LIT8( KNSmlFirstDNSPri, "1" ); +_LIT8( KNSmlSecondDNSPri, "2" ); +_LIT8( KNSmlDNSIp, "IP" ); +_LIT8( KNSmlDNSIp6, "IP6" ); +_LIT8( KNSmlEmptyIpv4Address8, "0.0.0.0"); +_LIT( KNSmlEmptyIpv4Address, "0.0.0.0"); +_LIT8( KNSmlMimeTypeTextPlain, "text/plain" ); + +_LIT8( KNSmlDmApValOutgoing, "Outgoing" ); +_LIT8( KNSmlDmApValIncoming, "Incoming" ); +_LIT8( KNSmlDmApVal3Gppps, "3GPPPS" ); +_LIT8( KNSmlDmApValGsmCsd, "GSM-CSD" ); +_LIT8( KNSmlDmApValGsmGprs, "GSM-GPRS" ); +_LIT8( KNSmlDmApValGsmHscsd, "GSM-HSCSD" ); +_LIT8( KNSmlDmApValVpn, "VPN" ); +_LIT8( KNSmlDmApValWlan, "WLAN" ); +_LIT8( KNSmlDmApValFSlash, "/" ); +_LIT8( KNSmlDmApValAnalog, "ANALOG-MODEM" ); +_LIT8( KNSmlDmApValV110, "V.110" ); +_LIT8( KNSmlDmApValV120, "V.120" ); + +_LIT8( KNSmlDmApValAuto, "Auto" ); +_LIT8( KNSmlDmApVal2400, "2400" ); +_LIT8( KNSmlDmApVal4800, "4800" ); +_LIT8( KNSmlDmApVal9600, "9600" ); +_LIT8( KNSmlDmApVal14400, "14400" ); +_LIT8( KNSmlDmApVal19200, "19200" ); +_LIT8( KNSmlDmApVal28800, "28800" ); +_LIT8( KNSmlDmApVal32000, "32000" ); +_LIT8( KNSmlDmApVal33600, "33600" ); +_LIT8( KNSmlDmApVal38400, "38400" ); +_LIT8( KNSmlDmApVal43200, "43200" ); +_LIT8( KNSmlDmApVal48000, "48000" ); +_LIT8( KNSmlDmApVal56000, "56000" ); +_LIT8( KNSmlDmApVal57600, "57600" ); +_LIT8( KNSmlDmApVal64000, "64000" ); +_LIT8( KNSmlDmApValExtended, "Extended" ); +_LIT8( KNSmlDmApValIpv4, "IPv4" ); +_LIT8( KNSmlDmApValIpv6, "IPv6" ); +_LIT8( KNSmlDmApValTrue, "True" ); +_LIT8( KNSmlDmApValFalse, "False" ); + +//class forwards +class CNSmlWLanAdapter; + +struct TNSmlAPAddElement + { + HBufC8 *iUri; + HBufC8 *iData; + TInt iStatusRef; + HBufC8* iLuid; + TBool iLeaf; + TBool iDone; + }; + +enum TNSmlAPLeafType + { + EDMUpdate, EDMAdd, EDMDelete, EDMUnset + }; + +struct TNSmlAPBufferElement + { + CArrayFixFlat *iNodeBuf; + CArrayFixFlat *iWlanNodeBuf; + HBufC8* iMappingName; + HBufC8* iName; + TBool iExecuted; + TInt iLuid; + TBool iBearer; + TBool iDirection; + TBool iNameReceived; + TBool iDnsUpdateBuf; + }; +// +// ------------------------------------------------------------------------------------------------ +// CNSmlInternetAdapter +// ------------------------------------------------------------------------------------------------ +class CNSmlInternetAdapter : public CSmlDmAdapter + { +public: + + enum TNSmlAPFieldType + { + EStr, EInt, EBin, EBool, ESpec, EWap, EWrong + }; + static CNSmlInternetAdapter* NewL(MSmlDmCallback* aDmCallback); + static CNSmlInternetAdapter* NewLC(MSmlDmCallback* aDmCallback); + + virtual ~CNSmlInternetAdapter(); + + // 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: + void ConstructL(); + CNSmlInternetAdapter(TAny* aEcomArguments); + TDesC8& SetIntObjectLC(const TInt& aObject); + TInt SetField(const TDesC8& aSource); + TInt GetIntObject8(const TDesC8& aObject); + TInt IntLUID(const TDesC8& aLUID); + + void AddNodeBufferL(const TDesC8& aURI, const TDesC8& aParentLUID, + const TInt aStatusRef, const TBool aDontAppend, + const TBool aWlan = EFalse); + + void AddLeafBufferL(const TDesC8& aURI, const TDesC8& aParentLUID, + const TDesC8& aObject, const TDesC8& aType, + const TInt aStatusRef, const TBool aWlan = EFalse); + + CSmlDmAdapter::TError FetchLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aType, CBufBase& aObject); + TPtrC8 LastURISeg(const TDesC8& aURI); + TPtrC8 FirstURISeg(const TDesC8& aURI); + TPtrC8 GetDynamicAPNodeUri(const TDesC8& aURI); + void ExecuteBufferL(const TDesC8& aURI, const TBool aCompleting = EFalse); + TPtrC8 GetAddURISeg(const TDesC8& aURI, const TDesC8& aName); + + CNSmlInternetAdapter::TNSmlAPFieldType + GetAPFieldType(const TDesC8& aURI) const; + TBool GetAPField(TPtrC& aTableName, TPtrC& aColumn) const; + TBool NotValidStrLenght(const TDesC& aSource); + + TDesC8& ConvertTo8LC(const TDesC& aSource); + TDesC16& ConvertTo16LC(const TDesC8& aSource); + + TInt InitializeGPRSL(CCommsDbTableView* aTable); + TInt InitializeProxyL(CCommsDbTableView* aTable); + + TInt InitializeWAPIAPL(CCommsDbTableView* aTable, const TDesC8& aName); + TInt InitializeWAPL(CCommsDbTableView* aTable); + TInt InitializeLANServiceL(CCommsDbTableView* aTable); + TInt InitializeVPNServiceL(CCommsDbTableView* aTable); + TBool IsValidNameL(const TDesC8& aName); + TBool IsValidIPv4AddressL(const TDesC8& aNapAddr); + void NextAPNameL(const TDesC8& aName); + + TUint32 GetIAPSeamlessnessL(TUint32 aId); + TUint32 GetIAPMetaDataL(TUint32 aId); + void + SetIAPSeamlessnessL(TUint32 apMetaID, TUint32 aSeam, + TInt aStatusRef); + void SetIAPMetaDataL(TUint32 apMetaID, TUint32 aMeta, TInt aStatusRef); + + TBool CheckEnforcementL(); + TBool CheckWLANEnforcementL(); + TInt UnprotectWLANAPItemL(TUint32 aId); + TInt DoProtectWAPTablesL(TBool aProtect); + void DoLockIAPTablesL(TBool aLock); + + TBool IsIAPRecordLockedL(TUint32 aRecord); + TInt DoProtectIAPRecordL(TUint32 aRecord, TBool aProtect); + TBool IsProxyRecordLockedL(TUint32 aRecord); + TInt DoProtectProxyRecordL(TUint32 aRecord, TBool aProtect); + TBool IsServiceRecordLockedL(TUint32 aRecord); + TInt DoProtectServiceRecordL(TUint32 aRecord, TBool aProtect); + TBool IsWAPAccessPointRecordLockedL(TUint32 aRecord); + TInt DoProtectWAPAccessRecordL(TUint32 aRecord, TBool aProtect); + + TBool IsWLANfield(const TDesC8& aURI); + TBool IsWlanL(const TDesC8& aURI); + TBool GetLanBearerL(TUint32& aId); + + void SaveIAPDataL(const TDesC8& aURI); + TBool GetModemBearerL(TUint32& aId); + TBool IsInsertAllowedL(); + TUint32 GetMaxIdL(); + TBool GetProxyIdL(const TDesC8& aURI); + + TBool APExistsL(TUint32 aId); + TBool NAPDefExistsL(TUint32 aId); + TBool PxExistsL(TUint32 aId); + TBool WapAPExistsL(TUint32 aId); + TBool NetworkExistsL(TUint32 aId); + TBool NetworkNameExistsL(TUint32& aId, const TDesC8& aObject); + TBool AddNetworkL(TUint32& aId, const TDesC8& aObject); + + TBool DeleteAPL(TUint32 aId); + TBool DeleteNAPDefL(TUint32 aId); + TBool DeleteProxyL(TUint32 aId); + TBool DeleteWapAPL(TUint32 aId); + + TUint32 GetAPIdFromURIL(const TDesC8& aURI); + void IsWapPort(const TDesC8& aObject); + void FillNodeInfoL(MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, const TDesC8& aDescription); + + TInt UpdateIAPnameL(TUint32 aId, const TDesC8& aObject); + TUint32 GetLocationL(); + + TBool + InitializeDNSParamsFromBuffL(const TPtrC8 aParentUri, + TInt& aDnsPri); + TInt + DnsToLuid(const UriUtils::TUriHostType aType, + const TInt aPriority) const; + TInt LuidToDns(UriUtils::TUriHostType& aType, TInt& aPriority, + const TInt aLuid) const; + TPtrC8 RemoveLastSeg(const TDesC8& aURI) const; + + void ClearBuffer(CArrayFixFlat* aBuffer); + void LingerValueL(const TDesC8& aObject); + void AddLingerL(const TInt aIapId, const TInt aLingerInterval); + void UpdateLingerL(const TInt aIapId, const TInt aLingerInterval); + void GetLingerL(const TInt aIapId, TInt& aLingerInterval); + void DeleteLingerL(const TInt aIapId); + TBool Notalpha(const TDesC& aValue); + TUint32 ConstructTreeL(const TDesC8& aURI); + TBool IsAPUriFormatMatchPredefined(const TDesC8 & aURI); + +private: + MSmlDmCallback* iCallBack; + + CNSmlWLanAdapter* iWlanAdapter; + + TInt iLUID; + TInt iParentLUID; + TInt iObject; + TBool iWapPort; + TInt iDirection; + TBool iStaleMapUpdate; + HBufC8* iField; + TNSmlAPLeafType iLeafType; + + TBuf8 iWAPAccessPoint; + TUint32 iWapId; + TBuf iWapBearer; + TBuf8 iWapName; + TBuf8 iWapUserName; + TBuf8 iWapPassword; + + CArrayFixFlat *iBuffer; + TBool i3GPPPS; + +private: + // data + CCommsDatabase* iDatabase; + + TBool iIAPExists; + + TInt iDnsIpv4Pri; // 1 or 2 + TInt iDnsIpv6Pri; + TInt iExecutionIndex; + TBool iExecutingBuffer; + TBool iDnsUpdate; + + TBuf8 iIAPName; + + TUint32 iIAPId; + + TUint32 iISPId; + + TUint32 iProxyId; + TUint32 iProxyISP; + + TBuf iProxyServiceType; + TBuf8 iProxyServerName; + + HBufC8* iPrevURI; + TInt iPrevLUID; + + TBuf iBearer; + + TUint32 iBearerType; + TInt iNetworkId; + TInt iLingerValue; + TBool iLingerFlag; + TBool iTransactionCommitted; + TBool iWAPRelock; + RArray iLockTableList; + + TBool iWlanSupported; + TBool isAdd; + }; + +#endif // __NSMLINTERNETADAPTER_H__ +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/inc/NSmlWLanAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/inc/NSmlWLanAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,397 @@ +/* + * 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: Wlan adapter + * + */ + +#ifndef __NSMLWLANADAPTER_H__ +#define __NSMLWLANADAPTER_H__ + +// ----------------------------------------------------------------------------------------------- +// Includes +// ----------------------------------------------------------------------------------------------- +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include "smldmadapter.h" +#include "nsmlconstants.h" +#include "NSmlWlanSettings.h" + +// ----------------------------------------------------------------------------------------------- +// Constants +// ----------------------------------------------------------------------------------------------- +const TInt KNSmlWepKeyGranularity = 4; +const TInt KNSmlMaxURISegLen = 32; +const TInt KExpandedEAPIdLength = 8; +const TInt KNsmlSubjectKeyIdLength = 255; +const TInt KIdentifierLength = 20; +const TUint KMaxLengthOfEapList = 50; + +_LIT8( KNSmlWLanAdapterDDFversion, "1.0" ); +_LIT16( KNSmlWLanServiceTable, "WLANServiceTable" ); +_LIT8( KNSmlWLanId, "Id" ); +_LIT8( KNSmlWLanName, "Name" ); +_LIT8( KNSmlWLanHidden, "Hidden" ); +_LIT8( KNSmlWLanReadOnly, "ReadOnly" ); +_LIT8( KNSmlWLanServiceId, "ServiceID" ); +_LIT8( KNSmlWLanNetworkMode, "NetworkMode" ); +_LIT8( KNSmlWLanConnectionMode, "WlanConnectionMode" ); +_LIT8( KNSmlWLanSsid, "SSID" ); +_LIT8( KNSmlWLanUsedSsid, "UsedSSID" ); +_LIT8( KNSmlWLanSsidHidden, "SSIDHidden" ); +_LIT8( KNSmlWLanUseWPAPSK, "UseWPAPSK" ); +_LIT8( KNSmlWLanEnablePSK, "EnablePSK" ); +_LIT8( KNSmlWLanWepKey1, "WEPKey1InHex" ); +_LIT8( KNSmlWLanWepKey2, "WEPKey2InHex" ); +_LIT8( KNSmlWLanWepKey3, "WEPKey3InHex" ); +_LIT8( KNSmlWLanWepKey4, "WEPKey4InHex" ); +_LIT8( KNSmlWLanWepIndex, "WEPKeyIndex" ); +_LIT8( KNSmlWLanWepKey, "WEPKey" ); +_LIT8( KNSmlWLanSecurityMode, "SecurityMode" ); +_LIT8( KNSmlWLanWpaAuthMode, "WPAAuthMode" ); +_LIT8( KNSmlWLanWpaPreSharedKey, "WPAPreSharedKey" ); +_LIT8( KNSmlWLanEapList, "WLANEAPList" ); +_LIT8( KNSmlWLanAuthMode, "WEPAuthMode" ); +_LIT8( KNSmlWLanWepKeyId, "WEPKeyID" ); +_LIT8( KNSmlWLanWepKeyData, "Data" ); +_LIT8( KNSmlWLanNodeName, "WLAN" ); + +_LIT8( KNSmlEmpty, "" ); +#define KNSmlWLanDefaultSSID _S("Net1") + +_LIT8( KNSmlWLan, "/WLAN" ); +_LIT8( KNSmlNAPDefWlanNode,"Name/NAPID/Bearer/IPAddrFromServer/IfNetworks/NAPAddr/NAPAddrTy/IPDNSAddrFromServer/DNSAddr/DefGW/NetworkMask/Networks/IAPService"); + +_LIT8( KNSmlWLanListOfLeafs, "SSID/UsedSSID/SSIDHidden/NetworkMode/SecurityMode/WPAPreSharedKey/UseWPAPSK/WEPKey/WEPKeyIndex/WLANEAPList/WEPAuthMode/EAP/SecondarySSID" ); + +_LIT8( KNSmlWLanListOfSecondaryLeafs, "SSID/UsedSSID" ); +_LIT8( KNSmlWLanListOfWepKeys, "1/2/3/4" ); +_LIT8( KNSmlWLanListOfWepKeyLeafs, "WEPKeyID/Data" ); +_LIT8( KNSmlWLanAllowUnsecure8, "allow unsecure" ); +_LIT8( KNSmlWLanWep8, "WEP" ); +_LIT8( KNSmlWLan8021x8, "802.1X" ); +_LIT8( KNSmlWLanWpa8, "WPA" ); +_LIT8( KNSmlWLanWpa28, "WPA2" ); +_LIT8( KNSmlWLanWpaPreSharedKey8, "WPA pre-shared key" ); +_LIT8( KNSmlWLanAdHoc8, "ADHOC" ); +_LIT8( KNSmlWLanInfrastructure8, "Infrastructure" ); +_LIT8( KNSmlMimeType, "text/plain" ); + +#ifdef FF_WLAN_EXTENSIONS +_LIT8( KNSmlWLanListOfEAPLeafs, "EAPType/Username/Password/Realm/UsePseudonym/VerifyCertRealm/RequireClientAuthentication/SessionValidityTime/CipherSuite/AllowPEAPv0/AllowPEAPv1/AllowPEAPv2/Certificate/AuthProvMode/UnauthProvMode/PACGroupRef/WarnADHPNoPAC/WarnADHPNoMatchPAC/WarnNotDefaultSrv" ); +#else +_LIT8( KNSmlWLanListOfEAPLeafs, "EAPType/Username/Password/Realm/UsePseudonym/VerifyCertRealm/RequireClientAuthentication/SessionValidityTime/CipherSuite/AllowPEAPv0/AllowPEAPv1/AllowPEAPv2/Certificate" ); +#endif + +_LIT8( KNSmlWLanListOfCertificateLeafs, "IssuerName/SubjectName/CertType/SerialNumber/SubjectKeyId/Fingerprint" ); + +_LIT8( KNSmlWLanSecSsid, "SecondarySSID" ); +_LIT8( KNSmlWLanEap, "EAP" ); +_LIT8( KNSmlWLanEapType, "EAPType" ); +_LIT8( KNSmlWLanUsername, "Username" ); +_LIT8( KNSmlWLanPassword, "Password" ); +_LIT8( KNSmlWLanRealm, "Realm" ); +_LIT8( KNSmlWLanUsePseudonym, "UsePseudonym" ); +_LIT8( KNSmlWLanEncapsulation, "Encapsulation" ); +_LIT8( KNSmlWLanVerifyCertRealm, "VerifyCertRealm" ); +_LIT8( KNSmlWLanRequireClientAuthentication, "RequireClientAuthentication" ); +_LIT8( KNSmlWLanSessionValidityTime, "SessionValidityTime" ); +_LIT8( KNSmlWLanCipherSuite, "CipherSuite" ); +_LIT8( KNSmlWLanAllowPEAPv0, "AllowPEAPv0" ); +_LIT8( KNSmlWLanAllowPEAPv1, "AllowPEAPv1" ); +_LIT8( KNSmlWLanAllowPEAPv2, "AllowPEAPv2" ); +#ifdef FF_WLAN_EXTENSIONS +_LIT8( KNSmlWLanAuthProvMode, "AuthProvMode" ); +_LIT8( KNSmlWLanUnauthProvMode, "UnauthProvMode" ); +_LIT8( KNSmlWLanPACGroupRef, "PACGroupRef" ); +_LIT8( KNSmlWLanWarnADHPNoPAC, "WarnADHPNoPAC" ); +_LIT8( KNSmlWLanWarnADHPNoMatchPAC, "WarnADHPNoMatchPAC" ); +_LIT8( KNSmlWLanWarnNotDefaultSrv, "WarnNotDefaultSrv" ); +#endif +_LIT8( KNSmlWLanCertificate, "Certificate" ); +_LIT8( KNSmlWLanIssuerName, "IssuerName" ); +_LIT8( KNSmlWLanSubjectName, "SubjectName" ); +_LIT8( KNSmlWLanCertType, "CertType" ); +_LIT8( KNSmlWLanSerialNumber, "SerialNumber" ); +_LIT8( KNSmlWLanSubjectKeyId, "SubjectKeyId" ); +_LIT8( KNSmlWLanFingerprint, "Fingerprint" ); + +_LIT8(KTrue, "True"); +_LIT8(KFalse, "False"); +_LIT8(KTtrue, "true"); +_LIT8(KFfalse, "false"); +_LIT8(KSlash, "/"); +_LIT8(KDash, "-"); +_LIT8(KNSmlWLanEapId, "EAPId" ); + +_LIT8(KSuitesDefault, "-010,-022,-019,-047,-050,-051,-004,-005"); + +const TUint RSA_3DES_SHA = 10; +const TUint DHE_RSA_3DES_SHA = 22; +const TUint DHE_DSS_3DES_SHA = 19; +const TUint RSA_AES_SHA = 47; // ? +const TUint DHE_RSA_AES_SHA = 50; // ? +const TUint DHE_DSS_AES_SHA = 51; // ? +const TUint RSA_RC4_MD5 = 4; +const TUint RSA_RC4_SHA = 5; +const TUint NUMBER_OF_CIPHERSUITES = 8; +const TUint KExpandedEapIdLength = 8; +const TUint8 KEapPlus = '+'; + +_LIT8(KEAPSIM, "EAP-SIM"); +_LIT8(KEAPAKA, "EAP-AKA"); +_LIT8(KEAPTLS, "EAP-TLS"); +_LIT8(KEAPPEAP, "EAP-PEAP"); +_LIT8(KEAPTTLS, "EAP-TTLS"); +_LIT8(KEAPLEAP, "EAP-LEAP"); +_LIT8(KEAPMSCHAPV2, "EAP-MSCHAPV2"); +_LIT8(KMSCHAPV2, "MSCHAPV2"); +_LIT8(KEAPGTC, "EAP-GTC"); +_LIT8(KEAPFAST, "EAP-FAST"); +_LIT8(KEAPTTLSPAP, "EAP-TTLSPAP"); + +_LIT8(KEapAll,"-017,-018,-023,-013,-025,-021,-043" ); + +const TUint8 KEapNoneId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; +const TUint8 KEapTlsTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d + }; +const TUint8 KEapGtcTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06 + }; +const TUint8 KEapLeapTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11 + }; +const TUint8 KEapSimTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12 + }; +const TUint8 KEapTtlsTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15 + }; +const TUint8 KEapAkaTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17 + }; +const TUint8 KEapPeapTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19 + }; +const TUint8 KEapMschapv2TypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A + }; +const TUint8 KEapSecuridTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 + }; +const TUint8 KEapFastTypeId[] = + { + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B + }; +const TUint8 KMschapv2TypeId[] = + { + 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63 + }; +const TUint8 KTtlspapTypeId[] = + { + 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x62 + }; +const TUint8 KNotInsidePEAP = 0x04; +const TUint8 KNotOutsidePEAP = 0x08; +const TUint8 KNotInsideTTLS = 0x10; + +//Forward Declarations +class TEapExpandedType; + +// ----------------------------------------------------------------------------------------------- +// Structures +// ----------------------------------------------------------------------------------------------- +struct TNSmlWepKeyBufferElement + { + HBufC8* iUri; + HBufC8* iData; + TInt iWepKeyId; + TInt iIdStatusRef; + //TInt iUseWPAPSK; + TInt iDataStatusRef; + TInt iNodeStatusRef; + TInt iLengthStatusRef; + TBool iExecuted; + TBool iDataSet; + TInt iLuid; + }; + +struct TNSmlSecondarySSIDBufferElement + { + HBufC8* iUri; + TBuf ScannedId; + TBuf UsedId; + TInt wlanLuid; + TBool iExecuted; + }; + +struct TNSmlEAPBufferElement + { + EAPSettings* iEAPSettings; + TEapExpandedType iEncapsulatingExpandedEapId; + RArray iStatusRefArray; + TInt iWLANServiceId; + TBuf8 iEapTypeString; + TBuf8 iEncapsulatingString; + }; + +// ----------------------------------------------------------------------------------------------- +// Enumerations +// ----------------------------------------------------------------------------------------------- +enum TConnectionMode + { + EAdhoc = 0, EInfrastructure = 1 + }; + +enum TWLanSecurityMode + { + EAllowUnsecure = 1, EWep = 2, EWlan8021x = 4, EWpa = 8, EWpa2 = 16 + }; + +enum TWepAuthenticationMode + { + EOpen = 0, EShared = 1 + }; + +enum TNsmlWLANAdapterEapType + { + EEapNone = 0, + EEapGtc = 6, + EEapTls = 13, + EEapLeap = 17, + EEapSim = 18, + EEapTtls = 21, + EEapAka = 23, + EEapPeap = 25, + EEapMschapv2 = 26, + EEapSecurid = 32, + EEapFast = 43, + ETtlsPlainPap = 98, + EPlainMschapv2 = 99 + }; +// ------------------------------------------------------------------------------------------------ +// CNSmlWLanAdapter +// ------------------------------------------------------------------------------------------------ +class CNSmlWLanAdapter : public CSmlDmAdapter + { +public: + static CNSmlWLanAdapter* NewL(MSmlDmCallback* aDmCallback, + CCommsDatabase& aDatabase); + static CNSmlWLanAdapter* NewLC(MSmlDmCallback* aDmCallback, + CCommsDatabase& aDatabase); + void ConstructL(CCommsDatabase& aDatabase); + virtual ~CNSmlWLanAdapter(); + + // 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(); + CSmlDmAdapter::TError FetchLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aType, CBufBase& aObject); + +private: + CNSmlWLanAdapter(TAny* aEcomArguments, CCommsDatabase& aDatabase); + void FillNodeInfoL(MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, const TDesC8& aDescription); + HBufC* IntToDesLC(const TInt aLuid); + HBufC8* IntToDes8LC(const TInt aLuid); + TInt DesToInt(const TDesC8& aLuid); + TInt GetIdFromLuid(const TDesC8& aLuid); + TUint32 GetSecSSIDFromUriL(const TDesC8& aUri); + TInt GetEAPIdFromUri(const TDesC8& aUri); + TInt GetCertificateIdFromUri(const TDesC8& aUri); + TInt GetWepKeyIdFromLuid(const TDesC8& aLuid); + TInt GetWepKeyIdFromUri(const TDesC8& aUri); + TInt NumOfUriSegs(const TDesC8& aUri); + TPtrC8 GetLastUriSeg(const TDesC8& aURI); + TPtrC8 RemoveLastUriSeg(const TDesC8& aURI); + void ExecuteBufferL(TBool aFinal = EFalse); + TDesC8& ConvertTo8LC(const TDesC& aSource); + TDesC16& ConvertTo16LC(const TDesC8& aSource); + void DesToBufferL(CBufBase& aTo, const TDesC& aFrom); + void FillCipherSuiteBufferL(CBufBase& aBuffer); + void FillCipherSuitesL(const TDesC8& aObject, const TInt aLuid); + void ConvertEAPStringToIds(TDes8& aEAPString, TEapExpandedType& aId); + TInt GetServiceIdFromUriL(const TDesC8& aURI); + TInt GetEncapsEAPIdFromUri(const TDesC8& aUri); + void ResetEAPStructL(); + void DeleteEAPStructL(); + void GetExpandedType(const TInt aEapType, const TInt aTunnelingType, + TEapExpandedType& aExpanedId, TEapExpandedType& aExpanedEncapsId); + + MSmlDmCallback* iCallBack; + CWlanSettings* iWlanSettings; + CArrayFixFlat *iBuffer; + TWlanSettings *iSettings; + EAPSettings* iEAPSettings; + RPointerArray iSecondaryBuffer; + RPointerArray iEAPBuffer; + CCommsDatabase& iDatabase; + + }; + +#endif __NSMLWLANADAPTER_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/inc/NSmlWlanSettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/inc/NSmlWlanSettings.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,133 @@ +/* + * 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: Wlan Adapter commsDB handler + * + */ + +#ifndef __NSMLWLANSETTINGS_H__ +#define __NSMLWLANSETTINGS_H__ + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include + +const TInt KMaxPSKLength = 63; +const TInt KMinPSKLength = 8; + +// ========================================================================== +// Class forwards +// ========================================================================== +// +class CWlanSettings; + +class TWlanSettings + { +public: + TBuf Name; + TUint32 Id; + TUint32 ServiceID; + TUint32 ConnectionMode; // Infrastructure / adhoc + TBuf SSID; + TBuf8 WepKey1; + TBuf8 WepKey2; + TBuf8 WepKey3; + TBuf8 WepKey4; + TUint32 WepIndex; + TUint32 SecurityMode; // SecurityMode (Allow unsecure, wep, 802.1xs, wpa) enum EWlanSecurityMode + TUint32 WPAMode; // enum EWpaMode + TUint32 UseWPAPSK; // CR ID: TMVI-5Y49AS + TBuf8 WPAPreSharedKey; + TUint32 AuthMode; + TBuf UsedSSID; + TUint32 ScanSSID; + TBuf EapList; + TBool SecondarySSIDsExisting; + // TBuf SecondarySSID; + // TBuf UsedSecondarySSID; + + }; + +class TSecondarySSID + { +public: + TUint32 Id; + TBuf ScannedId; + TBuf UsedId; + }; + +// ----------------------------------------------------------------------------------------------- +// Defines +// ----------------------------------------------------------------------------------------------- + +class CWlanSettings : public CBase + { +public: + static CWlanSettings* NewL(CCommsDatabase& aDatabase); + void ConstructL(); + ~CWlanSettings(); + + TInt GetWlanSettings(TUint32 aLuid, TWlanSettings& aWlanSettings); + TInt DeleteWlanSettings(TUint32 aLuid); + TInt WriteWlanSettings(TWlanSettings& aWlanSettings); + void ConnectToDatabaseL(); + TInt RecordExists(TUint32 aLuid); + TInt PerformLockWLANTablesL(TBool aProtect); + TBool CheckEnforcementL(); + TBool CheckAPEnforcementL(); + TBool iWLANRelock; + + TInt GetEAPSettings(const TInt aId, TEapExpandedType& aExpandedId, + TEapExpandedType& aEncapsId, EAPSettings& aEapSettings); + TInt DeleteEAPSettings(TInt aId); + void DeleteWlanEapSettingsL(TInt aWlanId); + TInt DeleteSecondarySSIDsL(TUint32 aWLANId); + TInt DeleteOneSecondarySSIDL(TUint32 aWLANId, TUint32 asecId); + TInt WriteEAPSettings(EAPSettings& aEapSettings); + TInt WriteSecondarySSIDL(TUint32 aWlanID, TSecondarySSID& aSettings, + TBool aNew); + void GetSecondarySSIDListL(TUint32 aLuid, + RArray& aSecondarySSIDs); + void GetEAPInterfaceL(const TInt aId, TEapExpandedType& aEncapsId, + TEapExpandedType& aExpandedId); + TInt InstalledEAPsL(CBufBase& aEAPList); + +private: + + CWlanSettings(CCommsDatabase& aDatabase); + TInt GoToRecord(TUint32 aId); + void GetDataFromRecordL(TWlanSettings* aWlanSettings); + void WriteDataToRecordL(TWlanSettings* aWlanSettings); + void InitialiseRecordL(); + void SetSecondaryViewToRecordL(TUint32 aId); + + TDesC8& ConvertTo8LC(const TDesC& aSource); + TDesC16& ConvertTo16LC(const TDesC8& aSource); + TBool IsDisallowedInsideTTLS(const CImplementationInformation& aImplInfo); + TBool IsDisallowedInsidePEAP(const CImplementationInformation& aImplInfo); + TBool + IsDisallowedOutsidePEAP( + const CImplementationInformation& aImplInfo); + + CCommsDatabase& iDatabase; + CCommsDbTableView* iTableView; + CCommsDbTableView* iSecondaryView; + CEapType* iEapType; + TUint32 iServiceID; + TBool iExpandedEAPTypeFieldsUsed; + }; + +#endif __NSMLWLANSETTINGS_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/rom/nsmlinternetadapter.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/rom/nsmlinternetadapter.iby Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,36 @@ +/* +* 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 InternetAdapter +* +*/ + + + +REM SyncML Device Management internet adapter + +#include + +#ifndef __NSMLINTERNETADAPTER_IBY__ +#define __NSMLINTERNETADAPTER_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected +#ifndef FF_DM_CONNMO_ADAPTER // nothing should be installed from this .iby file if this flag is specified. + // ConnMO is used in that case for access point provisioning. + +ECOM_PLUGIN(nsmlinternetadapter.dll,nsmlinternetadapter.rsc) + +#endif // FF_DM_CONNMO_ADAPTER +#endif //__SYNCML_DM + +#endif //__NSMLINTERNETADAPTER_IBY__ diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/src/NSmlInternetAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/src/NSmlInternetAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,9651 @@ +/* + * 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: Internet-settings + * + */ + +#include +#include +#include // CommsDB columname defs +#include // For TImplementationProxy definition +#include +#include // ISP enumerations +#include // GPRS ProtocolType +#include // CallbackType +#include // GPRS enumeration +#include // WAP enumeration +#include // OOD checking +#include // ipv4 + ipv6 checking +#include +#include "NSmlInternetAdapter.h" +#include "NSmlWLanAdapter.h" +#include "nsmldebug.h" +#include "nsmldmtreedbclient.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +const TUint KNSmlInternetAdapterImplUid = 0x101F6DE2; + +const TUint KIapColumn = 0x00000100; +const TUint KLingerColumn = 0x00000200; +const TUint KColumnMask = 0xFFFFFF00; +const TUint KRowMask = 0x000000FF; + +#include // VSettingEnforcementInfo +class CNSmlWLanAdapter; + +_LIT( KDaemonManagerName, "NetCfgExtnDhcp" ); +_LIT( KConfigDaemonName, "!DhcpServ" ); + +#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 TInt KBeginTransRetryDelay = 1000000; // Delay for comms db begintransaction retry (microseconds) +const TInt KBeginTransRetryCount = 7; // Maximum number of retries +//----------------------------------------------------------------------------- +// CSmlInternetAdapter* CSmlInternetAdapter::NewL( ) +//----------------------------------------------------------------------------- + +CNSmlInternetAdapter* CNSmlInternetAdapter::NewL(MSmlDmCallback* aDmCallback) + { + _DBG_FILE("CNSmlInternetAdapter::NewL(): begin"); + + CNSmlInternetAdapter* self = NewLC(aDmCallback); + CleanupStack::Pop(); + + _DBG_FILE("CNSmlInternetAdapter::NewL(): end"); + return self; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter* CNSmlInternetAdapter::NewLC( ) +//------------------------------------------------------------------------------ +CNSmlInternetAdapter* CNSmlInternetAdapter::NewLC(MSmlDmCallback* aDmCallback) + { + _DBG_FILE("CNSmlInternetAdapter::NewLC(): begin"); + CNSmlInternetAdapter* self = new (ELeave) CNSmlInternetAdapter( + aDmCallback); + CleanupStack::PushL(self); + + self->iCallBack = aDmCallback; + self->ConstructL(); + + _DBG_FILE("CNSmlInternetAdapter::NewLC(): end"); + return self; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::CNSmlInternetAdapter() +//------------------------------------------------------------------------------ +CNSmlInternetAdapter::CNSmlInternetAdapter(TAny* aEcomArguments) : + CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CNSmlInternetAdapter::CNSmlInternetAdapter(): begin"); + _DBG_FILE("CNSmlInternetAdapter::CNSmlInternetAdapter(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::~CNSmlInternetAdapter(TAny* aEcomArguments) +//------------------------------------------------------------------------------ +CNSmlInternetAdapter::~CNSmlInternetAdapter() + { + _DBG_FILE("CNSmlInternetAdapter::~CNSmlInternetAdapter(): begin"); + + delete iField; + + delete iPrevURI; + + // Command buffer cleaning if leave happend + if (iBuffer) + { + for (TInt i = 0; i < iBuffer->Count(); i++) + { + delete iBuffer->At(i).iMappingName; + delete iBuffer->At(i).iName; + + ClearBuffer(iBuffer->At(iExecutionIndex).iNodeBuf); + delete iBuffer->At(i).iNodeBuf; + + ClearBuffer(iBuffer->At(iExecutionIndex).iWlanNodeBuf); + delete iBuffer->At(i).iWlanNodeBuf; + } + + iBuffer->Reset(); + delete iBuffer; + } + + if (iWlanSupported) + { + delete iWlanAdapter; + } + + delete iDatabase; + FeatureManager::UnInitializeLib(); + _DBG_FILE("CNSmlInternetAdapter::~CNSmlInternetAdapter(): end"); + } + +//============================================= +// CNSmlInternetAdapter::ConstructL() +// Second phase constructor. +//============================================= +void CNSmlInternetAdapter::ConstructL() + { + FeatureManager::InitializeLibL(); + iField = HBufC8::NewL(KNSmlMaxURLLength); + + iPrevURI = HBufC8::NewL(KNSmlMaxURLLength); + + iDatabase = CCommsDatabase::NewL(); + // iDatabase->BeginTransaction(); //+++ + iTransactionCommitted = ETrue; + i3GPPPS = EFalse; + + iLeafType = EDMUnset; // Default for leaf handling + + // Reset identification data + + iDirection = ECommDbConnectionDirectionUnknown; + + // + // Command buffering used for AddNode + AddLeaf + // + iBuffer = new (ELeave) CArrayFixFlat ( + KNSmlAPGranularity); + + // checks if Wlan feature is supported + iWlanSupported = FeatureManager::FeatureSupported(KFeatureIdProtocolWlan); + + // WlanAdapter + // + if (iWlanSupported) + { + iWlanAdapter = CNSmlWLanAdapter::NewL(iCallBack, *iDatabase); + } + + iNetworkId = KErrNotFound; + iLingerValue = NULL; + iLingerFlag = ETrue; + isAdd = EFalse; + } + +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::DDFVersionL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + aDDFVersion.InsertL(0, KNSmlInternetAdapterDDFversion); + } +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::DDFStructureL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::DDFStructureL(MSmlDmDDFObject& aDDF) + { + _DBG_FILE("CNSmlInternetAdapter::DDFStructureL(): begin"); + + // + // Set rest acceptable operations for data itself + // + + TSmlDmAccessTypes aclTypesAddGetDel; + aclTypesAddGetDel.SetGet(); + aclTypesAddGetDel.SetAdd(); + aclTypesAddGetDel.SetDelete(); + + TSmlDmAccessTypes aclTypesAddGet; + aclTypesAddGet.SetGet(); + aclTypesAddGet.SetAdd(); + + TSmlDmAccessTypes aclTypesNoDelete; + aclTypesNoDelete.SetGet(); + aclTypesNoDelete.SetReplace(); + aclTypesNoDelete.SetAdd(); + + TSmlDmAccessTypes aclTypesNoGet; + aclTypesNoGet.SetReplace(); + aclTypesNoGet.SetAdd(); + aclTypesNoGet.SetDelete(); + + TSmlDmAccessTypes aclTypesAddReplace; + aclTypesAddReplace.SetReplace(); + aclTypesAddReplace.SetAdd(); + + TSmlDmAccessTypes aclTypesOnlyGet; + aclTypesOnlyGet.SetGet(); + + TSmlDmAccessTypes aclTypesAll; + aclTypesAll.SetGet(); + aclTypesAll.SetReplace(); + aclTypesAll.SetAdd(); + aclTypesAll.SetDelete(); + + MSmlDmDDFObject* ddfRoot = &aDDF; + MSmlDmDDFObject& ddf = ddfRoot->AddChildObjectL(KNSmlDdfAP); + + _LIT8(KDescription, "AP-Settings DDF description"); + _LIT8(KDFTitle, "AP-settings title"); + + FillNodeInfoL(ddf, aclTypesOnlyGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, KDescription); + + ddf.SetDFTitleL(KDFTitle); + ddf.SetDefaultValueL(KNullDesC8); + + MSmlDmDDFObject& nApDDF = ddf.AddChildObjectGroupL(); // For AP/ + + FillNodeInfoL(nApDDF, aclTypesAll, MSmlDmDDFObject::EZeroOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nNAPDefRootDDF = nApDDF.AddChildObjectL(KNSmlDdfNAPDef); // NAPDef + FillNodeInfoL(nNAPDefRootDDF, aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, // EZeroOrMore + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nNAPDefDDF = nNAPDefRootDDF.AddChildObjectGroupL(); // For NAPDef + FillNodeInfoL(nNAPDefDDF, aclTypesAddGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nPxRootDDF = nApDDF.AddChildObjectL(KNSmlDdfPx); // Px + FillNodeInfoL(nPxRootDDF, aclTypesAddGet, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nPxDDF = nPxRootDDF.AddChildObjectGroupL(); // For Px + FillNodeInfoL(nPxDDF, + aclTypesAddGetDel,//aclTypesAddGet + MSmlDmDDFObject::EOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNullDesC8); + // + // NAPDef-node fields + // + MSmlDmDDFObject& nNameDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPName); // Name + FillNodeInfoL(nNameDDF, aclTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfNAPNameDesc); + + MSmlDmDDFObject& nNAPIDDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPID); // NAPID + FillNodeInfoL(nNAPIDDDF, aclTypesOnlyGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfNAPIDDesc); + + MSmlDmDDFObject& nNAPLingerDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfNAPLinger); // Linger + FillNodeInfoL(nNAPLingerDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, KNSmlDdfNAPLingerDesc); + + MSmlDmDDFObject& nNAPStartpgDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfStartpg); // Startpg + FillNodeInfoL(nNAPStartpgDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfStartpgDesc); + + MSmlDmDDFObject& nBearerRootDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfBearer); // Bearer + FillNodeInfoL(nBearerRootDDF, aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nBearerDDF = nBearerRootDDF.AddChildObjectGroupL(); // Bearer/ + FillNodeInfoL(nBearerDDF, aclTypesAddGet, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nBearerLDDF = + nBearerDDF.AddChildObjectL(KNSmlDdfBearerL); // BearerL + FillNodeInfoL(nBearerLDDF, aclTypesAddGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfBearerLDesc); + + MSmlDmDDFObject& nDirectionDDF = nBearerDDF.AddChildObjectL( + KNSmlDdfDirection); // Direction + FillNodeInfoL(nDirectionDDF, aclTypesAddGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfDirectionDesc); + + MSmlDmDDFObject& nNAPAddrDDF = + nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPAddr); // NAPAddr + FillNodeInfoL(nNAPAddrDDF, aclTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfNAPAddrDesc); + + MSmlDmDDFObject& nNAPAddrTyDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfNAPAddrTy); // NAPAddrTy + FillNodeInfoL(nNAPAddrTyDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfNAPAddrTyDesc); + + MSmlDmDDFObject& nDNSAddrRootDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfDNSAddr); // DNSAddr + FillNodeInfoL(nDNSAddrRootDDF, aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nDNSAddrDDF = nDNSAddrRootDDF.AddChildObjectGroupL(); // DNSAddr/ + FillNodeInfoL(nDNSAddrDDF, aclTypesAddGet, MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nDNSAddrLDDF = nDNSAddrDDF.AddChildObjectL( + KNSmlDdfDNSAddrL); // DNSAddrL + FillNodeInfoL(nDNSAddrLDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfDNSAddrLDesc); + + MSmlDmDDFObject& nDNSAddrTyDDF = nDNSAddrDDF.AddChildObjectL( + KNSmlDdfDNSAddrTy); // DNSAddrTy + FillNodeInfoL(nDNSAddrTyDDF, aclTypesOnlyGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfDNSAddrTyDesc); + + MSmlDmDDFObject& nDNSPriorityDDF = nDNSAddrDDF.AddChildObjectL( + KNSmlDdfDNSPriority); // DNSAddrPriority + FillNodeInfoL(nDNSPriorityDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfDNSPriorityDesc); + + MSmlDmDDFObject& nNAPAuthInfRootDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfNAPAuthInf); // NAPAuthInf + FillNodeInfoL(nNAPAuthInfRootDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nNAPAuthInfDDF = + nNAPAuthInfRootDDF.AddChildObjectGroupL(); // NAPAuthInf/ + FillNodeInfoL(nNAPAuthInfDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nAuthNameDDF = nNAPAuthInfDDF.AddChildObjectL( + KNSmlDdfAuthName); // AuthName + FillNodeInfoL(nAuthNameDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfAuthNameDesc); + + MSmlDmDDFObject& nAuthSecrDDF = nNAPAuthInfDDF.AddChildObjectL( + KNSmlDdfAuthSecr); // AuthSecr + FillNodeInfoL(nAuthSecrDDF, aclTypesAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfAuthSecrDesc); + + MSmlDmDDFObject& nDefGWDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfDefGW); // DefGW + FillNodeInfoL(nDefGWDDF, aclTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfDefGWDesc); + + MSmlDmDDFObject& nNetworkMaskDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfNetworkMask); // NetworkMask + FillNodeInfoL(nNetworkMaskDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfNetworkMaskDesc); + + MSmlDmDDFObject& nUsePTxtLogDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfUsePTxtLog); // UsePTxtLog + FillNodeInfoL(nUsePTxtLogDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlDdfUsePTxtLogDesc); + + MSmlDmDDFObject& nNetworksRootDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfNetworks); // Networks + FillNodeInfoL(nNetworksRootDDF, aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nNetworksDDF = nNetworksRootDDF.AddChildObjectGroupL(); // Networks/ + FillNodeInfoL(nNetworksDDF, aclTypesAddGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nNetworkNameDDF = nNetworksDDF.AddChildObjectL( + KNSmlDdfNetworkName); // NetworkName + FillNodeInfoL(nNetworkNameDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfNetworkNameDesc); + + MSmlDmDDFObject& nNetworkIDDDF = nNetworksDDF.AddChildObjectL( + KNSmlDdfNetworkID); // NetworkID + FillNodeInfoL(nNetworkIDDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, + KNSmlDdfNetworkIDDesc); + + MSmlDmDDFObject& nPPPCompDDF = + nNAPDefDDF.AddChildObjectL(KNSmlDdfPPPComp); // PPPComp + FillNodeInfoL(nPPPCompDDF, aclTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EBool, + KNSmlDdfPPPCompDesc); + + MSmlDmDDFObject& nGPRSPDPDDF = + nNAPDefDDF.AddChildObjectL(KNSmlDdfGPRSPDP); // GPRSPDP + FillNodeInfoL(nGPRSPDPDDF, aclTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfGPRSPDPDesc); + + MSmlDmDDFObject& nIPAddrFromServerDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfIPAddrFromServer); // IPAddrFromServer + FillNodeInfoL(nIPAddrFromServerDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlDdfIPAddrFromServerDesc); + + MSmlDmDDFObject& nIPAddrDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIPAddr); // IPAddr + FillNodeInfoL(nIPAddrDDF, aclTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfIPAddrDesc); + + MSmlDmDDFObject& nDNSAddrFromServerDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfDNSAddrFromServer); // DNSAddrFromServer + FillNodeInfoL(nDNSAddrFromServerDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlDdfDNSAddrFromServerDesc); + + MSmlDmDDFObject& nIPv6DNSAddrFromServerDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfIPv6DNSAddrFromServer); // IPv6DNSAddrFromServer + FillNodeInfoL(nIPv6DNSAddrFromServerDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlDdfIPv6DNSAddrFromServerDesc); + + MSmlDmDDFObject& nIfNetworksDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfIfNetworks); // IfNetworks + FillNodeInfoL(nIfNetworksDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfIfNetworksDesc); + + MSmlDmDDFObject& nIAPServiceDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfIAPService); // IAPService + FillNodeInfoL(nIAPServiceDDF, aclTypesOnlyGet, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfIAPServiceDesc); + + MSmlDmDDFObject& nIAPSeamlessnessDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfIAPSeamlessness); // IAPService + FillNodeInfoL(nIAPSeamlessnessDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, KNSmlDdfIAPSeamlessnessDesc); + MSmlDmDDFObject& nIAPMetaDataDDF = nNAPDefDDF.AddChildObjectL( + KNSmlDdfIAPMetaData); // IAPService + FillNodeInfoL(nIAPMetaDataDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, KNSmlDdfIAPMetaDataDesc); + + if (iWlanSupported) + { + iWlanAdapter->DDFStructureL(nNAPDefDDF); // Adds WLAN fields to DDF + } + + // + // Px-node fields + // + MSmlDmDDFObject& nPxNameDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxName); // Name + FillNodeInfoL(nPxNameDDF, aclTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlDdfPxDesc); + + MSmlDmDDFObject& nPxIdDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxId); // PxId + FillNodeInfoL(nPxIdDDF, aclTypesOnlyGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfPxIdDesc); + + MSmlDmDDFObject& nDomainRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfDomain); // Domain + FillNodeInfoL(nDomainRootDDF, aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNSmlDdfDomainDesc); + + MSmlDmDDFObject& nDomainDDF = nDomainRootDDF.AddChildObjectGroupL(); // Domain + FillNodeInfoL(nDomainDDF, aclTypesAddGet, MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nDomainLDDF = + nDomainDDF.AddChildObjectL(KNSmlDdfDomainL); // DomainL (Get) + FillNodeInfoL(nDomainLDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfDomainLDesc); + + MSmlDmDDFObject& nPxPWDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxPW); // PxPW + FillNodeInfoL(nPxPWDDF, aclTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfPxPWDesc); + + MSmlDmDDFObject& nPxAddrDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxAddr); // PxAddr + FillNodeInfoL(nPxAddrDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfPxAddrDesc); + + MSmlDmDDFObject& nPortRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfPort); // Port + FillNodeInfoL(nPortRootDDF, aclTypesAddGet, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, + KNSmlDdfPortDesc); + + MSmlDmDDFObject& nPortDDF = nPortRootDDF.AddChildObjectGroupL(); // Port + FillNodeInfoL(nPortDDF, aclTypesAddGet, MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nPortNbrDDF = nPortDDF.AddChildObjectL(KNSmlDdfPortNbr); // PortNbr (Get) + FillNodeInfoL(nPortNbrDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, + KNSmlDdfPortNbrDesc); + + MSmlDmDDFObject& nToNAPIDRootDDF = + nPxDDF.AddChildObjectL(KNSmlDdfToNAPID); // ToNAPID + FillNodeInfoL(nToNAPIDRootDDF, aclTypesOnlyGet, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNSmlDdfToNAPIDDesc); + + MSmlDmDDFObject& nToNAPIDDDF = nToNAPIDRootDDF.AddChildObjectGroupL(); // ToNAPID + FillNodeInfoL(nToNAPIDDDF, aclTypesOnlyGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nToNAPIDLDDF = nToNAPIDDDF.AddChildObjectL( + KNSmlDdfToNAPIDL); // ToNAPIDL (Get) + FillNodeInfoL(nToNAPIDLDDF, aclTypesOnlyGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfToNAPIDLDesc); + + MSmlDmDDFObject& nPxStartpgDDF = nPxDDF.AddChildObjectL(KNSmlDdfStartpg); // Startpg + FillNodeInfoL(nPxStartpgDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfStartpgDesc); + + MSmlDmDDFObject& nPxAuthInfRootDDF = nPxDDF.AddChildObjectL( + KNSmlDdfPxAuthInf); // PxAuthInf + FillNodeInfoL(nPxAuthInfRootDDF, aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nPxAuthInfDDF = nPxAuthInfRootDDF.AddChildObjectGroupL(); // PxAuthInf/ + FillNodeInfoL(nPxAuthInfDDF, aclTypesAddGet, MSmlDmDDFObject::EOneOrMore, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nPxAuthIdDDF = nPxAuthInfDDF.AddChildObjectL( + KNSmlDdfPxAuthId); // PxAuthId + FillNodeInfoL(nPxAuthIdDDF, aclTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfPxAuthIdDesc); + + MSmlDmDDFObject& nPxAuthPWDDF = nPxAuthInfDDF.AddChildObjectL( + KNSmlDdfPxAuthPW); // PxAuthPW + FillNodeInfoL(nPxAuthPWDDF, aclTypesAddReplace, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlDdfPxAuthPWDesc); + + MSmlDmDDFObject& nNoPxForRootDDF = + nPxDDF.AddChildObjectL(KNSmlDdfNoPxFor); // NoPxFor + FillNodeInfoL(nNoPxForRootDDF, aclTypesAddGet, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNSmlDdfNoPxForDesc); + + MSmlDmDDFObject& nNoPxForDDF = nNoPxForRootDDF.AddChildObjectGroupL(); // NoPxFor + FillNodeInfoL(nNoPxForDDF, aclTypesAddGet, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNullDesC8); + + MSmlDmDDFObject& nNoPxForLDDF = nNoPxForDDF.AddChildObjectL( + KNSmlDdfNoPxForL); // NoPxForL (Get) + FillNodeInfoL(nNoPxForLDDF, aclTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, + KNSmlDdfNoPxForLDesc); + + _DBG_FILE("CNSmlInternetAdapter::DDFStructureL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::LingerValueL() +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::LingerValueL(const TDesC8& aObject) + { + + TBuf<100> desObj; + CnvUtfConverter::ConvertToUnicodeFromUtf8(desObj, aObject); + TInt err(KErrNone); + //const TDesC& value = desObj; + if (!Notalpha(desObj)) + { + TLex lex(desObj); + TUint Linger = 0; + TInt lingerint; + err = lex.Val(Linger, EDecimal); + if (err == KErrNone) + { + lingerint = Linger; + if (lingerint >= 0) + { + iLingerValue = lingerint; + iLingerFlag = EFalse; + } + } + } + } + +// ----------------------------------------------------------------------------- +// CWPAPNapdef::UdateligerValueL +// +// ----------------------------------------------------------------------------- +// +TBool CNSmlInternetAdapter::Notalpha(const TDesC& aValue) + { + TBool NotAlpha = EFalse; + TChar character; + for (TInt i = 0; i < aValue.Length(); i++) + { + character = aValue[i]; + NotAlpha = character.IsAlpha(); + if (NotAlpha) + break; + } + + return NotAlpha; + } +// CNSmlInternetAdapter::AddLeafObjectL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::AddLeafObjectL(const TDesC8& aURI, + const TDesC8& aParentLUID, const TDesC8& aObject, + const TDesC8& aType, const TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): begin"); + DBG_ARGS8(_S8("AP:add aURI AddLeafObjectL - %S - %S"), &aURI, + &aParentLUID); + DBG_ARGS8(_S8("AP:Object %S"), &aObject); + + isAdd = ETrue; + + TInt parentLUID(0); + if (aParentLUID.Length() <= 0) + { + if (aURI.Match(_L8("AP/*/Px/*")) != KErrNotFound) + { + if (!GetProxyIdL(aURI)) + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return; + } + } + if (!iLUID) + iLUID = IntLUID(aParentLUID); + parentLUID = GetAPIdFromURIL(aURI); + if (parentLUID == 0) + { + if (IsAPUriFormatMatchPredefined(aURI)) + { + iLUID = ConstructTreeL(aURI); + parentLUID = GetAPIdFromURIL(aURI); + } + } + + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): PParentLUID set to parentLUID"); + parentLUID = IntLUID(aParentLUID); + } + // Always buffer DNSAddr//* + if ((parentLUID == 0 || aURI.Find(KNSmlDdfDNSPriority) >= 0 || aURI.Find( + KNSmlDdfDNSAddrL) >= 0) && !iExecutingBuffer) + // Update as add + { + iLeafType = EDMUnset; // Default for leaf handling + AddLeafBufferL(aURI, aParentLUID, aObject, aType, aStatusRef); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); + return; + } + + if (parentLUID == KNSmlIncompleteAP) + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + + //check if Stale and add leaf buffer + if (parentLUID > 0 && !iExecutingBuffer) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): parentLUID > 0 && !iExecutingBuffer"); + TUint32 apID = GetAPIdFromURIL(aURI); + if (!APExistsL(apID)) + { + AddLeafBufferL(aURI, aParentLUID, aObject, aType, aStatusRef); + iStaleMapUpdate = ETrue; + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); + return; + } + } + TInt pushed = 0; + // + // Check which field going to be handled + // + SetField(aURI); + if ((iField->Compare(KNSmlDdfNAPLinger) == 0)) + { + TUint32 apID = GetAPIdFromURIL(aURI); + if (aObject.Size() == 0) + { + DeleteLingerL(apID); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + return; + } + LingerValueL(aObject); + + if (!iLingerFlag) + { + iLingerFlag = ETrue; + TRAPD(error, AddLingerL(apID, iLingerValue)); + if (error == !KErrNone) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + return; + } + + // + // On leaf handling and add, must be checked that value not set before + // + if (iLeafType != EDMUpdate && iLeafType != EDMDelete) + { + iLeafType = EDMAdd; + } + if (iStaleMapUpdate) + { + iLeafType = EDMAdd; + } + + TPtrC qTable = TPtrC(KNullDesC); + TPtrC qColumn = TPtrC(KNullDesC); + TPtrC qDB = TPtrC(COMMDB_ID); + + if (aURI.Find(KNSmlDdfPortNbr) >= 0) + { + IsWapPort(aObject); + } + // + // Get Database field type + // + + if (parentLUID > 0) + { + // Get IAP nbr for servicetype + TUint32 iapIDs = GetAPIdFromURIL(aURI); + + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL(): checkluid is %d and iapId %d "), + parentLUID, iapIDs); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* iapViews = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iapIDs); + + TBuf serviceType; + + TInt errorCode = iapViews->GotoFirstRecord(); + + // Read iapService from (IAP) + if (errorCode == KErrNone) + { + iapViews->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + CleanupStack::PopAndDestroy(); // iapViews + qTable.Set(serviceType); + } + else + { + CleanupStack::PopAndDestroy(); // iapViews + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): ENotFound 1 end"); + return; + } + } + + if (iWlanSupported) + { + TBool wLANfield = IsWLANfield(aURI); + if (wLANfield) + { + iWlanAdapter->AddLeafObjectL(aURI, aParentLUID, aObject, aType, + aStatusRef); + CleanupStack::PopAndDestroy(pushed); + return; + } + } + + TInt fType = GetAPFieldType(aURI); + if (fType == EWrong) // Error if leaf not supported + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + + TBool fieldOK = GetAPField(qTable, qColumn); + if (!fieldOK) // OK if column for table not supported + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + return; + } + + iISPId = parentLUID; + if (aURI.Match(_L8("AP/*/Px/*/*")) != KErrNotFound) + { + if (iProxyId == 0) + iProxyId = parentLUID; + } + + if ((fType == CNSmlInternetAdapter::EStr) || (fType + == CNSmlInternetAdapter::EInt && aURI.Find(KNSmlDdfGPRSPDP) >= 0) + || // KNSmlDdfNAPAddrTy + (fType == CNSmlInternetAdapter::EInt && aURI.Find( + KNSmlDdfNAPAddrTy) >= 0)) // KNSmlDdfNAPAddrTy + { // Name + NAPAddr + DNSAddr + Networks/*/Name + + if (aURI.Match(_L8("AP/*/Networks/*/Name")) != KErrNotFound) + { + TUint32 checkLUID = 0; + TUint32 iapID1 = GetAPIdFromURIL(aURI); + + // IAP-table NetworkId Update + CCommsDbTableView* iapUpdate = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iapID1); + TInt iapExists = iapUpdate->GotoFirstRecord(); + + if (iapExists == KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL, Get network id"); + iapUpdate->ReadUintL(TPtrC(IAP_NETWORK), checkLUID); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL(): networks is %d"), + checkLUID); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL, IAP exists"); + if (checkLUID > 0) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL, network id > 0"); + //check if network exist in NETWORK TABLE + CCommsDbTableView* checknetView; + checknetView = iDatabase->OpenViewMatchingUintLC(TPtrC( + NETWORK), TPtrC(COMMDB_ID), checkLUID); + TInt error = checknetView->GotoFirstRecord(); + if (error == KErrNotFound) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL: Network does not exist, create it"); + AddNetworkL(checkLUID, aObject); + if (checkLUID > 0) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL: network generation ok"); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL(): network id is %d"), + checkLUID); + //iapUpdate->WriteUintL(TPtrC(IAP_NETWORK),checkLUID); + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): network generation failed"); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + return; + } + } + // Network was found, update the name to the given name. + else + { + if (checknetView->UpdateRecord() == KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL: network found, update name"); + checknetView->WriteTextL(TPtrC(COMMDB_NAME), + ConvertTo16LC(aObject)); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL: network name updated"); + checknetView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + // writing failed for some reason + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): network generation failed"); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + return; + } + } + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL: network ok"); + CleanupStack::PopAndDestroy(); //checknetView + } + } + // IAP does not exist yet, create network, network id will be updated later using checkLUID + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL: network does not exist, creation 2"); + AddNetworkL(checkLUID, aObject); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL(): network id is %d"), + checkLUID); + } + CleanupStack::PopAndDestroy(); // iapUpdate + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL: network addition handled"); + + // IAP-table NetworkId Update + CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iapID1); + TInt iapFound = iapView->GotoFirstRecord(); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL: network id update begin"); + if (iapFound == KErrNone) + { + TBool iapReLock = EFalse; + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TBool apEnforce = EFalse; + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if (eError == KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + ((CCommsDbProtectTableView*) iapView)->UnprotectRecord(); + iWAPRelock = ETrue; + } + } + + if (IsIAPRecordLockedL(iapID1)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt + reclockerr = + ((CCommsDbProtectTableView*) iapView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + + if (iapView->UpdateRecord() == KErrNone) + { + iapView->WriteUintL(TPtrC(IAP_NETWORK), checkLUID); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObject(): checkLUID is %d"), + checkLUID); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObject, IAP_NETWORK set to checkLUID "); + iapView->PutRecordChanges(); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObject, iap found, set iNetworkId to checkLUID"); + iNetworkId = checkLUID; + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + ((CCommsDbProtectTableView*) iapView)->ProtectRecord(); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID1, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,Protecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + } + else if (iapFound == KErrNotFound) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObject, iap not found, set iNetworkId"); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObject(): checkLUID is %d"), + checkLUID); + iNetworkId = checkLUID; + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, iap found"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + + CleanupStack::PopAndDestroy(); // iapView + CleanupStack::PopAndDestroy(pushed); + + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): OK end"); + return; + } + + else if (((aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound || // ProxyName + aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound || // ProxyAddr + aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound) // DomainL (PROXY_PROTOCOL_NAME) + && iLeafType == EDMUpdate) + || ((aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound + || aURI.Match(_L8("AP/*/Px/*/DomainL")) + != KErrNotFound) && iLeafType == EDMAdd)) + { + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + TPtrC(PROXIES), TPtrC(COMMDB_ID), iProxyId); + TBool proxyReLock = EFalse; + if (IsProxyRecordLockedL(iProxyId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): proxy record is LOCKED"); + TInt + reclockerr = + ((CCommsDbProtectTableView*) tableView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + proxyReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + + TInt errorCode = tableView->GotoFirstRecord(); + if (errorCode == KErrNone) + { + if (tableView->UpdateRecord() == KErrNone) + { + if (aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound) + { + tableView->WriteLongTextL(TPtrC(PROXY_SERVER_NAME), + ConvertTo16LC(aObject)); + pushed++; + } + else if (aURI.Match(_L8("AP/*/Px/*/DomainL")) + != KErrNotFound) + { + // Accepted values are (http, https, ftp, ftps) + _LIT8(KProxyProtocol, "http, https, ftp, ftps"); + + TInt protocolFound = 0; + if (aObject.Length() > 0) + { + protocolFound = KProxyProtocol().Find(aObject); + } + if (protocolFound == KErrNotFound && aObject.Length() + > 0) + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + if (aObject.Length() == 0) + { + tableView->SetNullL(TPtrC(PROXY_PROTOCOL_NAME)); + } + else + { + tableView->WriteTextL(TPtrC(PROXY_PROTOCOL_NAME), + ConvertTo16LC(aObject)); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + } + tableView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + if (proxyReLock) + { + TInt reclockerr = DoProtectProxyRecordL(iProxyId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + proxyReLock = EFalse; + } + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); + return; + } + + if (iLeafType == EDMUpdate || (iLeafType == EDMAdd && (aURI.Find( + KNSmlDdfNAPName) >= 0 && aURI.Find(KNSmlDdfNAPDef) >= 0) + || aURI.Find(KNSmlDdfNAPAddr) >= 0 || aURI.Find( + KNSmlDdfGPRSPDP) >= 0 || aURI.Find(KNSmlDdfDNSAddrL) >= 0 + || aURI.Find(KNSmlDdfAuthSecr) >= 0 || aURI.Find( + KNSmlDdfDefGW) >= 0 || aURI.Find(KNSmlDdfNetworkMask) >= 0 + || aURI.Find(KNSmlDdfIPAddr) >= 0 || aURI.Find( + KNSmlDdfNAPAddrTy) >= 0)) + { + // Get IAP nbr for servicetype + + TUint32 iapID2 = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView + * serviceView = iDatabase->OpenViewMatchingUintLC(TPtrC( + IAP), qDB, iapID2); + + TBuf serviceType; + + TInt errorCode = serviceView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if (errorCode == KErrNone) + { + serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), + iProxyServiceType); // for locking + + serviceView->ReadUintL(TPtrC(IAP_SERVICE), iISPId); + + CleanupStack::PopAndDestroy(); // serviceView + } + else + { + CleanupStack::PopAndDestroy(); // serviceView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + qTable.Set(serviceType); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + serviceType, qDB, iISPId); + + errorCode = tableView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + TBool serviceReLock = EFalse; + if (IsServiceRecordLockedL(iISPId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt + reclockerr = + ((CCommsDbProtectTableView*) tableView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + serviceReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + + if (tableView->UpdateRecord() != KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + if (fType == CNSmlInternetAdapter::EInt) + { + TUint32 object32; + if (aURI.Find(KNSmlDdfGPRSPDP) >= 0 || /* GPRSPDP handling */ + aURI.Find(KNSmlDdfNAPAddrTy) >= 0) /* NAPAddrTy handling */ + { + if (aObject.MatchF(KNSmlDmApValIpv4) != KErrNotFound) + { + object32 = RPacketContext::EPdpTypeIPv4; + } + else if (aObject.MatchF(KNSmlDmApValIpv6) + != KErrNotFound) + { + object32 = RPacketContext::EPdpTypeIPv6; + } + else if (aObject.MatchF(_L8("PPP")) != KErrNotFound) + { + object32 = RPacketContext::EPdpTypePPP; + } + else + { // NotValid value + tableView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + } + else + { + object32 = GetIntObject8(aObject); + } + + tableView->WriteUintL(qColumn, object32); + } + else + { + // This should be executed only when executing buffered cmds + if (aURI.Find(KNSmlDdfDNSAddrL) >= 0) + // DNS address + { + TPtrC8 parentUri = RemoveLastSeg(aURI); + TInt dnsPri = 0; + TBool found = InitializeDNSParamsFromBuffL(parentUri, + dnsPri); + UriUtils::TUriHostType dnsAddrTy = + UriUtils::HostType(aObject); + + if (!found) + { + UriUtils::TUriHostType dnsLuidType; + TInt dnsLuidPriority; + if (LuidToDns(dnsLuidType, dnsLuidPriority, + parentLUID) != KErrNone) + { + if (dnsAddrTy == UriUtils::EIPv4Host) + { + iDnsIpv4Pri = (iDnsIpv4Pri % 2) + 1; + dnsPri = iDnsIpv4Pri; + } + else if (dnsAddrTy == UriUtils::EIPv6Host) + { + iDnsIpv6Pri = (iDnsIpv6Pri % 2) + 1; + dnsPri = iDnsIpv6Pri; + } + } + else + { + // update + dnsPri = dnsLuidPriority; + } + + } + if (dnsPri != 0) + { + if (dnsPri == 1) + { + if (dnsAddrTy == UriUtils::EIPv4Host) + { + qColumn.Set( + TPtrC(SERVICE_IP_NAME_SERVER1)); + } + else + { + qColumn.Set(TPtrC( + SERVICE_IP6_NAME_SERVER1)); + + } + } + else + { + if (dnsAddrTy == UriUtils::EIPv4Host) + { + qColumn.Set( + TPtrC(SERVICE_IP_NAME_SERVER2)); + } + else + { + qColumn.Set(TPtrC( + SERVICE_IP6_NAME_SERVER2)); + + } + } + tableView->WriteTextL(qColumn, ConvertTo16LC( + aObject)); + pushed++; + TInt dnsLuid = DnsToLuid(dnsAddrTy, dnsPri); + iCallBack->SetMappingL(parentUri, SetIntObjectLC( + dnsLuid)); + pushed++; + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + + } + + else + { + if ((serviceType == TPtrC(LAN_SERVICE)) + && (iField->Compare(KNSmlDdfNAPAddr) == 0)) + { + if (!IsValidIPv4AddressL(aObject)) + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EInvalidObject); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EInvalidObject end"); + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + return; + } + + } + tableView->WriteTextL(qColumn, ConvertTo16LC(aObject)); + pushed++; + + } + // DNSAddrL <> 0.0.0.0 or empty => + if (aURI.Find(KNSmlDdfDNSAddrL) >= 0) /* DNS serviceFlag handling */ + { + if (aObject.Match(_L8("fec0:0:0:ffff::1")) + == KErrNotFound || aObject.Match(_L8( + "fec0:0:0:ffff::2")) == KErrNotFound) + { + tableView->WriteBoolL(TPtrC( + SERVICE_IP6_DNS_ADDR_FROM_SERVER), EFalse); + } + else + { + tableView->WriteBoolL(TPtrC( + SERVICE_IP6_DNS_ADDR_FROM_SERVER), ETrue); + } + + } + } + TInt putOk = tableView->PutRecordChanges(); + if (putOk != KErrNone) + { + TInt retry = KBeginTransRetryCount; + while (retry > 0 && putOk == KErrLocked) + { + User::After(KBeginTransRetryDelay); + putOk = tableView->PutRecordChanges(); + retry--; + } + if (putOk != KErrNone) + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + DBG_ARGS( + _S16( + "CNSmlInternetAdapter::AddLeafObjectL(): Update failed with Code %d"), + putOk); + return; + } + } + if (aURI.Find(KNSmlDdfNAPName) >= 0 && aURI.Find( + KNSmlDdfAuthName) <= 0) /* NAPName */ + { + if (UpdateIAPnameL(iapID2, aObject) != KErrNone) + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + } + } + if (serviceReLock) + { + TInt reclockerr = DoProtectServiceRecordL(iISPId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + serviceReLock = EFalse; + } + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + + CleanupStack::PopAndDestroy(); // tableView + } + + } + else if (fType == CNSmlInternetAdapter::EBool) + { // UseCB + UseIPSec + TUint32 iapID3 = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* boolView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iapID3); + TInt errorCode = boolView->GotoFirstRecord(); + + TBuf serviceType; + + errorCode = boolView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if (errorCode == KErrNone) + { + boolView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + boolView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); // for locking + boolView->ReadUintL(TPtrC(IAP_SERVICE), iISPId); + } + else + { + CleanupStack::PopAndDestroy(); // boolView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + + CleanupStack::PopAndDestroy(); // boolView + + qTable.Set(serviceType); + TBool ret = GetAPField(qTable, qColumn); + if (!ret) + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EInvalidObject); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EInvalidObject end"); + return; + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + serviceType, TPtrC(COMMDB_ID), iISPId); + + errorCode = tableView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + TBool serviceReLock = EFalse; + if (IsServiceRecordLockedL(iISPId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt + reclockerr = + ((CCommsDbProtectTableView*) tableView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + serviceReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + if (tableView->UpdateRecord() != KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + TBool tObject = EFalse; + + if (aObject.CompareF(KNSmlDmApValTrue) == 0) + { + tObject = ETrue; + } + if (aURI.Right(10).Compare(KNSmlDdfUsePTxtLog) == 0) + { + tObject = !tObject; + } + if (qColumn.Match(TPtrC(SERVICE_IP_ADDR_FROM_SERVER)) + != KErrNotFound) + { + if (serviceType == TPtrC(LAN_SERVICE)) // Is WLAN service + { + if (tObject) + { + tableView->WriteTextL(TPtrC( + SERVICE_CONFIG_DAEMON_MANAGER_NAME), + KDaemonManagerName); + tableView->WriteTextL(TPtrC( + SERVICE_CONFIG_DAEMON_NAME), + KConfigDaemonName); + } + else + { + tableView->WriteTextL(TPtrC( + SERVICE_CONFIG_DAEMON_MANAGER_NAME), + KNullDesC); + tableView->WriteTextL(TPtrC( + SERVICE_CONFIG_DAEMON_NAME), KNullDesC); + } + } + } // Is WLAN service + + tableView->WriteBoolL(qColumn, tObject); + tableView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + if (serviceReLock) + { + TInt reclockerr = DoProtectServiceRecordL(iISPId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ServiceRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + serviceReLock = EFalse; + } + } + else + { + tableView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else if (fType == CNSmlInternetAdapter::EInt) + { // UsePTxtLog + PortNbr + seamlessness and metadata + iObject = GetIntObject8(aObject); + + if (aURI.Find(KNSmlDdfIAPSeamlessness) >= 0) + { + // TUint32 setSeam = GetIntObject8(aObject); + TUint32 apMetaID = GetAPIdFromURIL(aURI); + SetIAPSeamlessnessL(apMetaID, iObject, aStatusRef); + return; + } + + else if (aURI.Find(KNSmlDdfIAPMetaData) >= 0) + { + // TUint32 setMeta = GetIntObject8(aObject); + TUint32 apMetaID = GetAPIdFromURIL(aURI); + SetIAPMetaDataL(apMetaID, iObject, aStatusRef); + return; + } + + if (aURI.Find(KNSmlDdfUsePTxtLog) >= 0) + { + TUint32 iapID4 = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* iapView4 = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iapID4); + TInt errorCode = iapView4->GotoFirstRecord(); + + TBuf serviceType; + + errorCode = iapView4->GotoFirstRecord(); + + // Read serviceType from (IAP) + if (errorCode == KErrNone) + { + iapView4->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + iapView4->ReadTextL(TPtrC(IAP_SERVICE_TYPE), + iProxyServiceType); // for locking + iapView4->ReadUintL(TPtrC(IAP_SERVICE), iISPId); + CleanupStack::PopAndDestroy(); // iapView4 + } + else + { + CleanupStack::PopAndDestroy(); // iapView4 + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); + return; + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + serviceType, TPtrC(COMMDB_ID), iISPId); + + errorCode = tableView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + TBool serviceReLock = EFalse; + if (IsServiceRecordLockedL(iISPId)) + { + + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt + reclockerr = + ((CCommsDbProtectTableView*) tableView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + serviceReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + if (tableView->UpdateRecord() != KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + TBool tObject = EFalse; + if (iObject) + { + tObject = ETrue; // <> 0 + } + tableView->WriteBoolL(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH), + tObject); + tableView->PutRecordChanges(); + if (serviceReLock) + { + DoProtectIAPRecordL(iapID4, ETrue); + TInt reclockerr = DoProtectServiceRecordL(iISPId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ServiceRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + serviceReLock = EFalse; + } + CleanupStack::PopAndDestroy(); // tableView + } + else + { + tableView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else if (aURI.Find(KNSmlDdfPortNbr) >= 0) + { + if (GetProxyIdL(aURI)) + { + iProxyISP = GetAPIdFromURIL(aURI); + + CCommsDbTableView* tableView = + iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), + TPtrC(COMMDB_ID), iProxyId); + TInt errorCode = tableView->GotoFirstRecord(); + TBool proxyReLock = EFalse; + // Read all columns needed. + if (errorCode == KErrNone) + { + if (IsProxyRecordLockedL(iProxyId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): proxy record is LOCKED"); + TInt + reclockerr = + ((CCommsDbProtectTableView*) tableView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy Record returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + proxyReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + if (tableView->UpdateRecord() != KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); + return; + } + iObject = GetIntObject8(aObject); + + tableView->WriteUintL(TPtrC(PROXY_PORT_NUMBER), iObject); + } + tableView->PutRecordChanges(); + if (proxyReLock) + { + TInt reclockerr = DoProtectProxyRecordL(iProxyId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy Record returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + proxyReLock = EFalse; + } + CleanupStack::PopAndDestroy(); // tableView + } + else + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): PortNbr Error end"); + return; + } + } + else + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): PortNbr Error end"); + return; + } + + } + + else if (fType == CNSmlInternetAdapter::EWap) + { // Startpg + PxAuthId + PxAuthPW (WAP-settings) (BasAuthId + BasAuthPW) + TUint32 iapID5 = GetAPIdFromURIL(aURI); + // + // Without iapID5 no insert possible, set on buffer + // + if (iapID5 < 1) + { + AddLeafBufferL(aURI, aParentLUID, aObject, aType, aStatusRef); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); + return; + } + + GetAPField(qTable, qColumn); + if (WapAPExistsL(iapID5)) + { // Update handled + TBool iapReLock = EFalse; + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TBool apEnforce = EFalse; + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if (eError == KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + if (IsIAPRecordLockedL(iapID5)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = DoProtectIAPRecordL(iapID5, EFalse); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + CCommsDbTableView* wapView; + TBool wapaccesspointTableLocked = EFalse; + + if (qColumn == TPtrC(WAP_START_PAGE)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): record to be added WAP_START_PAGE, check for lock status"); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL Get WapAccessPoint record access for ID = %d"), + iWapId); + if (IsWAPAccessPointRecordLockedL(iWapId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record is LOCKED"); + TInt reclockerr = DoProtectWAPAccessRecordL(iWapId, + EFalse); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + wapaccesspointTableLocked = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record is not write protected"); + } + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC( + WAP_ACCESS_POINT), TPtrC(COMMDB_ID), iWapId); + pushed++; + } + else // Other WAP-data + { + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC( + WAP_IP_BEARER), TPtrC(WAP_ACCESS_POINT_ID), iWapId); + pushed++; + } + + TInt errorCode = wapView->GotoFirstRecord(); + + // Read all columns needed. + if (errorCode == KErrNone) + { + if (wapView->UpdateRecord() != KErrNone) + { + //database locked + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): Wapview Update failed end"); + if (wapaccesspointTableLocked) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record to be locked again "); + DoProtectWAPAccessRecordL(iWapId, ETrue); + wapaccesspointTableLocked = EFalse; + } + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + return; + } + + if (qColumn == TPtrC(WAP_PROXY_PORT)) + { + TBool security = EFalse; // => 9200 + 9201, ETrue 9202 + 9203 + TUint32 object32; + TPtrC object16 = ConvertTo16LC(aObject); + pushed++; + if (object16.Match(KWappPort9200) != KErrNotFound) + { + object32 = KWAPP_PORT_9200; // wappdef.h + } + else if (object16.Match(KWappPort9201) != KErrNotFound) + { + object32 = KWAPP_PORT_9201; + } + else if (object16.Match(KWappPort9202) != KErrNotFound) + { + object32 = KWAPP_PORT_9202; + security = ETrue; + } + else if (object16.Match(KWappPort9203) != KErrNotFound) + { + object32 = KWAPP_PORT_9203; + security = ETrue; + } + else + { + wapView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5, + ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + return; + } + wapView->WriteUintL(qColumn, object32); + wapView->WriteBoolL(TPtrC(WAP_SECURITY), security); + } + else + { + wapView->WriteTextL(TPtrC(qColumn), + ConvertTo16LC(aObject)); + pushed++; + } + } + wapView->PutRecordChanges(); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record Changes DONE successfully "); + if (wapaccesspointTableLocked) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record to be locked again "); + TInt reclockerr = DoProtectWAPAccessRecordL(iWapId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,Protecting WAPAccessRecord %d , returned code = %d"), + iWapId, reclockerr); + wapaccesspointTableLocked = EFalse; + } + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + CleanupStack::PopAndDestroy(pushed); + pushed = 0; + } + else + { // Insert handled + CCommsDbTableView* insView; + TInt wapInitOK = KErrCancel; + TBool iapReLock = EFalse; + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TBool apEnforce = EFalse; + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if (eError == KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + insView = iDatabase->OpenTableLC(TPtrC(WAP_ACCESS_POINT)); + iWapId = 0; + wapInitOK = insView->InsertRecord(iWapId); + if (wapInitOK == KErrNone) + { + iWAPAccessPoint.Zero(); + iWapUserName.Zero(); + iWapPassword.Zero(); + + if (qColumn == TPtrC(WAP_START_PAGE)) + { + iWAPAccessPoint = aObject; + } + else if (qColumn == TPtrC(WAP_PROXY_LOGIN_NAME)) + { + iWapUserName = aObject; + } + else if (qColumn == TPtrC(WAP_PROXY_LOGIN_PASS)) + { + iWapPassword = aObject; + } + + iWapBearer = TPtrC(WAP_IP_BEARER); + iWapName = FirstURISeg(aURI); // Name needed !!! + + wapInitOK = InitializeWAPIAPL(insView, iIAPName); + if (wapInitOK == KErrNone) + { + insView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); // insView + + CCommsDbTableView* updView; + TUint32 iWapId2 = 0; + iISPId = iapID5; // IAP number set + updView = iDatabase->OpenTableLC(TPtrC(WAP_IP_BEARER)); + if (updView->InsertRecord(iWapId2) == KErrNone) + { + wapInitOK = InitializeWAPL(updView); + } + else + { + wapInitOK = KErrGeneral; + } + if (wapInitOK == KErrNone) + { + if (!PxExistsL(iapID5)) + { + + // Set mapping-data + + TPtrC8 addURI = GetAddURISeg(aURI, + KNSmlDdfStartpg); + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, iapID5); + iCallBack->SetMappingL(addURI, addLUID); + } + else if (!NAPDefExistsL(iapID5)) + { + + // Set mapping-data + + TPtrC8 addURI = GetAddURISeg(aURI, + KNSmlDdfStartpg); + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, iapID5); + iCallBack->SetMappingL(addURI, addLUID); + } + + updView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); // updView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5, + ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); + return; + } + else + { + CleanupStack::PopAndDestroy(); // updView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5, + ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else + { + insView->CancelRecordChanges(); + CleanupStack::PopAndDestroy(); // insView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + else + { + CleanupStack::PopAndDestroy(); // insView + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iapID5, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + } + } + else if (fType == CNSmlInternetAdapter::ESpec) + { // BearerL + NoPxForL + IAPService + Direction + if (aURI.Find(KNSmlDdfDirection) >= 0) + { + _LIT8(KDirection, "Outgoing"); + if (KDirection().Find(aObject) != KErrNotFound) + { + iDirection = ECommDbConnectionDirectionOutgoing; + } + else + { + iDirection = ECommDbConnectionDirectionIncoming; + if (iBearer == TPtrC(OUTGOING_GPRS)) + { + iBearer = TPtrC(INCOMING_GPRS); + } + } + } + else if (aURI.Find(KNSmlDdfIAPService) >= 0) + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + else if (aURI.Find(KNSmlDdfNoPxForL) >= 0) /* No proxies used field handling */ + { + TBool proxyFound = GetProxyIdL(aURI); + if (!proxyFound) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + CleanupStack::PopAndDestroy(pushed); + return; + } + + CCommsDbTableView* specView = iDatabase->OpenViewMatchingUintLC( + TPtrC(PROXIES), TPtrC(COMMDB_ID), iProxyId); + TInt errorCode = specView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + TBool proxyReLock = EFalse; + if (IsProxyRecordLockedL(iProxyId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt + reclockerr = + ((CCommsDbProtectTableView*) specView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + proxyReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + if (specView->UpdateRecord() == KErrNone) + { + //database not locked + specView->WriteLongTextL(TPtrC(PROXY_EXCEPTIONS), + ConvertTo16LC(aObject)); + specView->PutRecordChanges(); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + CleanupStack::PopAndDestroy(); // ConvertTo16LC + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + if (proxyReLock) + { + TInt reclockerr = DoProtectProxyRecordL(iProxyId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + proxyReLock = EFalse; + } + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + CleanupStack::PopAndDestroy(); // specView + + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + else if (aURI.Find(KNSmlDdfBearerL) >= 0) /* Bearer handling */ + { + if (aObject.Match(KNSmlDmApValGsmGprs) != KErrNotFound) + { + if (iDirection == ECommDbConnectionDirectionIncoming) + { + iBearer = TPtrC(INCOMING_GPRS); + } + else + { + iBearer = TPtrC(OUTGOING_GPRS); + } + } + + else if (aObject.Match(KNSmlDmApVal3Gppps) != KErrNotFound) + { + i3GPPPS = ETrue; + if (iDirection == ECommDbConnectionDirectionIncoming) + { + iBearer = TPtrC(INCOMING_GPRS); + } + else + { + iBearer = TPtrC(OUTGOING_GPRS); + } + } + else if (aObject.Match(KNSmlDmApValVpn) != KErrNotFound) + { + iBearer = TPtrC(VPN_SERVICE); + } + else if ((aObject.Match(KNSmlDmApValWlan) != KErrNotFound) + && iWlanSupported) + { + iBearer = TPtrC(LAN_SERVICE); + } + else + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): UNKNOWN Bearer Error end"); + return; + } + } + else if (aURI.Find(KNSmlDdfNAPName) >= 0) + { + iIAPName.Copy(aObject); + TUint32 iapID2 = GetAPIdFromURIL(aURI); + if (iapID2 > 0 && UpdateIAPnameL(iapID2, aObject) != KErrNone) + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + } + } + + CleanupStack::PopAndDestroy(pushed); + pushed = 0; + + // Update CommsDB IAP + insert iBearer Table + + if (IsInsertAllowedL() && iLeafType == EDMAdd && fType + == CNSmlInternetAdapter::ESpec) //iIAPExists + { + TInt initOK = KErrCancel; + + iISPId = GetMaxIdL() + 1; // For new data + + SaveIAPDataL(aURI); // Level 1 Mapping inside + + CCommsDbTableView* newAPView; + + newAPView = iDatabase->OpenTableLC(iBearer); + // 3GPPPS = OUTGOING/INCOMING_GPRS + if (iBearer == TPtrC(OUTGOING_GPRS) || iBearer + == TPtrC(INCOMING_GPRS)) + { + if (newAPView->InsertRecord(iISPId) == KErrNone) + { + initOK = InitializeGPRSL(newAPView); + } + else + { + initOK = KErrGeneral; + } + } + + else if (iBearer == TPtrC(VPN_SERVICE)) + { + if (newAPView->InsertRecord(iISPId) == KErrNone) + { + initOK = InitializeVPNServiceL(newAPView); + } + else + { + initOK = KErrGeneral; + } + } + else if ((iBearer == TPtrC(LAN_SERVICE)) && iWlanSupported) + { + if (newAPView->InsertRecord(iISPId) == KErrNone) + { + initOK = InitializeLANServiceL(newAPView); + } + else + { + initOK = KErrGeneral; + } + } + else + { + initOK = KErrCancel; + } + + if (initOK == KErrNone) + { + TUint32 newId = 0; + newAPView->PutRecordChanges(); + newAPView->ReadUintL(TPtrC(COMMDB_ID), newId); + + // To update right Id + + iISPId = newId; + + SaveIAPDataL(aURI); + + TUint32 iapID2 = GetAPIdFromURIL(aURI); + UpdateIAPnameL(iapID2, iIAPName); + // + // Set mapping-data (levels 2 and 3 ) + // + TPtrC8 addURI = GetAddURISeg(aURI, KNSmlDdfNAPDef); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, newId); + + // Also NAPDef (level 2) + iCallBack->SetMappingL(addURI, addLUID); + DBG_ARGS8(_S8("AP:level2 URI - <%S> <%S> <%d>"), &addURI, + &addLUID, newId); + + // Also BearerL (level 3) + TPtrC8 addURI2 = GetAddURISeg(aURI, KNSmlDdfBearer); + if (i3GPPPS) + { + newId = KNSmlAp3gpppsLowerBase + newId; + addLUID.Format(KFormat, newId); + i3GPPPS = EFalse; + } + iCallBack->SetMappingL(addURI2, addLUID); + DBG_ARGS8(_S8("AP:level3 URI - <%S> <%S> <%d>"), &addURI2, + &addLUID, newId); + } + else + { + if (initOK == KErrCancel) + { + newAPView->CancelRecordChanges(); + } + CleanupStack::PopAndDestroy(newAPView); + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); + return; + } + + CleanupStack::PopAndDestroy(newAPView); + } + else if (IsInsertAllowedL() && iLeafType == EDMAdd && aURI.Find( + KNSmlDdfBearerL) >= 0) + + { + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EAlreadyExists); + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): EAlreadyExists BearerL end"); + return; + } + CleanupStack::PopAndDestroy(pushed); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): OK end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::UpdateLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType, + const TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): begin"); + + DBG_ARGS8(_S8("AP:update aURI UpdateLeafObjectL - %S - %S"), &aURI, + &aLUID); + DBG_ARGS8(_S8("AP:Object %S"), &aObject); + if (iTransactionCommitted) + { + TInt dberr = iDatabase->BeginTransaction(); + if (dberr == KErrLocked) + { + _DBG_FILE("UpdateLeafObjectL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && dberr == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("UpdateLeafObjectL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if (dberr != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(dberr); + } + } + iTransactionCommitted = EFalse; + } + if ((aURI.Match(_L8("*/WLAN*")) != KErrNotFound) && iWlanSupported) + { + AddLeafBufferL(aURI, aLUID, aObject, aType, aStatusRef, ETrue); + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): WLAN end"); + + return; + } + // + // No direct update allowed only update as add + // + if (aLUID.Length() > 0 && aURI.Find(KNSmlDdfNAPDef) >= 0) + /*( aURI.Find(KNSmlDdfBearerL) >= 0 || + aURI.Find(KNSmlDdfDirection) >= 0 || + aURI.Find(KNSmlDdfNAPName) >= 0 ) */ + { + _DBG_FILE( + "Bearer | direction CNSmlInternetAdapter::UpdatelaefObject ( ): EError end"); + + AddLeafBufferL(aURI, aLUID, aObject, aType, aStatusRef, EFalse); + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + return; + } + + iLeafType = EDMUpdate; + + TRAP_IGNORE(AddLeafObjectL(aURI, aLUID, aObject, aType, aStatusRef)); + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + // + // If try to update field that has value which is not default errorvalue should be returned + // + iLeafType = EDMUnset; + + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): end"); + + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::UpdateLeafObjectL(const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(RWriteStream): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(RWriteStream): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::DeleteObjectL( const TDesC& aURI, const TDesC& aLUID, +// const TInt aStatusRef ) +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::DeleteObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): begin"); + if (iTransactionCommitted) + { + TInt dberr = iDatabase->BeginTransaction(); + if (dberr == KErrLocked) + { + _DBG_FILE("DeleteObjectL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && dberr == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteObjectL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if (dberr != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(dberr); + } + } + iTransactionCommitted = EFalse; + } + + if ((aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) != KErrNotFound) + && iWlanSupported) + { + iWlanAdapter->DeleteObjectL(aURI, aLUID, aStatusRef); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): end"); + return; + } + + // + // Check which field going to be handled + // + SetField(aURI); + + iLUID = IntLUID(aLUID); + + TUint32 checkLUID = IntLUID(aLUID); + // + // Check which kind node to be deleted (Leaf delete not supported) + // + if (aURI.Match(_L8("AP/*")) != KErrNotFound && aURI.Match(_L8("AP/*/*")) + == KErrNotFound) + { + // Check if AP exists + if (!APExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); + return; + } + if (DeleteAPL(checkLUID)) + { + iPrevURI->Des().Format(KNullDesC8); + iPrevLUID = 0; + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); + return; + } + else + { + iPrevURI->Des().Format(KNullDesC8); + iPrevLUID = 0; + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EError end"); + return; + } + } + + if (aURI.Match(_L8("AP/*/Px/*/Startpg")) != KErrNotFound) //Key for WAP-delete + { + // Check if WAPAp exists + if (!WapAPExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); + return; + } + if (DeleteWapAPL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); + return; + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EError end"); + return; + } + } + + if (aURI.Match(_L8("AP/*/NAPDef/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/NAPDef/*/*")) == KErrNotFound) + { + // Check if NAPDef exists + if (!NAPDefExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); + return; + } + if (DeleteNAPDefL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); + return; + } + } + + if (aURI.Match(_L8("AP/*/Px/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/Px/*/*")) == KErrNotFound) + { + // Check if PX exists + if (!PxExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); + return; + } + if (DeleteProxyL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); + return; + } + } + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::FetchLeafObjectSizeL() +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::FetchLeafObjectSizeL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, + TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectSizeL(): begin"); + + DBG_ARGS8(_S8("AP:Fetch aURI - %S - %S"), &aURI, &aLUID); + CBufBase *lObject = CBufFlat::NewL(128); + CleanupStack::PushL(lObject); + + // call to internal fetchleafobj. + CSmlDmAdapter::TError status = FetchLeafObjectL(aURI, aLUID, aType, + *lObject); + + if (status == CSmlDmAdapter::EOk) + { + lObject->Compress(); + TBuf8<8> size; + size.Num(lObject->Size()); + lObject->Reset(); + lObject->InsertL(0, size); + iCallBack->SetResultsL(aResultsRef, *lObject, aType); + } + iCallBack->SetStatusL(aStatusRef, status); + + CleanupStack::PopAndDestroy(lObject); + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectSizeL(): end"); + + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::FetchLeafObjectL() +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::FetchLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef, + const TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(): begin"); + + DBG_ARGS8(_S8("AP:Fetch aURI - %S - %S"), &aURI, &aLUID); + CBufBase *lObject = CBufFlat::NewL(128); + CleanupStack::PushL(lObject); + + // Add call to internal fetchleafobj + CSmlDmAdapter::TError status = FetchLeafObjectL(aURI, aLUID, aType, + *lObject); + if (status == CSmlDmAdapter::EOk) + { + iCallBack->SetResultsL(aResultsRef, *lObject, aType); + } + iCallBack->SetStatusL(aStatusRef, status); + + CleanupStack::PopAndDestroy(); //lObject + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(): end"); + return; + } + +//------------------------------------------------------------------------------ +// CSmlDmInternetAdapter::FetchLeafObjectL() +//------------------------------------------------------------------------------ + +CSmlDmAdapter::TError CNSmlInternetAdapter::FetchLeafObjectL( + const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, + CBufBase& aObject) + { + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)(): begin"); + + TInt pushed = 0; + TUint32 iapID = 0; + TBool treeConstructed(EFalse); + // + // If no proxy no fetch allowed + // + if (aURI.Match(_L8("AP/*/Px/*")) != KErrNotFound) + { + if (!GetProxyIdL(aURI)) + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + if (!iLUID) + iLUID = IntLUID(aLUID); + + iapID = GetAPIdFromURIL(aURI); + + if (iapID == 0) + { + if (IsAPUriFormatMatchPredefined(aURI)) + { + iLUID = ConstructTreeL(aURI); + iapID = GetAPIdFromURIL(aURI); + treeConstructed = ETrue; + } + + } + // Check if values for Given LUID + if (!iLUID && (!IsWLANfield(aURI) || !iWlanSupported)) + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + // + // Check which field going to be handled + // + SetField(aURI); + + aObject.Reset(); + + //Linger value + if ((iField->Compare(KNSmlDdfNAPLinger) == 0)) + { + TInt lingerInterval; + TRAPD(err, GetLingerL(iapID, lingerInterval)); + if (err == KErrNotFound) + { + + return CSmlDmAdapter::ENotFound; + } + else if (err != KErrNone) + { + + return CSmlDmAdapter::EError; + + } + else + { + TBuf<10> slinger; + slinger.AppendNum(lingerInterval); + + aObject.InsertL(aObject.Size(), ConvertTo8LC(slinger)); + CleanupStack::PopAndDestroy(); + return CSmlDmAdapter::EOk; + } + } + TPtrC qTable = TPtrC(KNullDesC); + TPtrC qColumn = TPtrC(KNullDesC); + TPtrC qDB = TPtrC(COMMDB_ID); + + if (aURI.Find(KNSmlDdfPortNbr) >= 0) // Check if WAP or PROXY port asked + { + _LIT8(KWap, "/WAP"); + if (aURI.Find(KWap) >= 0) + { + iWapPort = ETrue; + } + else + { + iWapPort = EFalse; + } + } + + if (iWlanSupported) + { + TBool wLANfield = IsWLANfield(aURI); + if (wLANfield) + { + // + // WLAN-adapter handles all WLAN fields + // + return iWlanAdapter->FetchLeafObjectL(aURI, aLUID, aType, aObject); + } + } + + // + // Get Database field type + // + TInt fType = GetAPFieldType(aURI); + + if (fType == EWrong) + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); + return CSmlDmAdapter::EError; + } + // + iISPId = iLUID; + // + // IAP-table search serviceType (=Bearer) + + CCommsDbTableView* serviceView = iDatabase->OpenViewMatchingUintLC(TPtrC( + IAP), qDB, iapID); + + TBuf serviceType; + TUint32 serviceId = 0; + + TInt errorCode = serviceView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if (errorCode == KErrNone) + { + serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + serviceView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); + CleanupStack::PopAndDestroy(); // serviceView + } + else + { + CleanupStack::PopAndDestroy(); // serviceView + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + qTable.Set(serviceType); + + TBool allowed = GetAPField(qTable, qColumn); + + if (!allowed) + { + if (aURI.Find(KNSmlDdfNAPAddrTy) >= 0) /* NAPAddrTy handling */ + { + if (serviceType == TPtrC(OUTGOING_GPRS) || serviceType == TPtrC( + INCOMING_GPRS)) + { + _LIT8(KApn, "APN"); + aObject.InsertL(aObject.Size(), KApn); + + } + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + + } + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): FieldNot allowed"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EError; + } + + if (fType == CNSmlInternetAdapter::EStr) + { // Name + NAPAddr + DNSAddrL + if (aURI.Match(_L8("AP/*/Networks/*/Name")) != KErrNotFound) // Networks-name + { + // TUint32 iapID8 = IntLUID(aLUID); + + // IAP-table NetworkId Fetch + CCommsDbTableView* networkView = + iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC( + COMMDB_ID), iapID); + networkView->GotoFirstRecord(); + TRAPD(leavecode, networkView->ReadUintL(TPtrC(IAP_NETWORK), + iISPId)); + CleanupStack::PopAndDestroy(); // networkView + if (leavecode != 0) + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + TPtrC(NETWORK), TPtrC(COMMDB_ID), iISPId); + + errorCode = tableView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + TBuf columnValue; + + tableView->ReadTextL(qColumn, columnValue); + + aObject.InsertL(aObject.Size(), ConvertTo8LC(columnValue)); + pushed++; + } + else + { + CleanupStack::PopAndDestroy(); // tableView + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + } + else if (aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound || // ProxyName + aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound || // ProxyAddr + aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound) // DomainL (PROXY_PROTOCOL_NAME) + { + CCommsDbTableView* proxyView = iDatabase->OpenViewMatchingUintLC( + TPtrC(PROXIES), TPtrC(COMMDB_ID), iProxyId); + + errorCode = proxyView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + if (aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound) + { + TBuf columnValue; + + proxyView->ReadTextL(TPtrC(PROXY_PROTOCOL_NAME), + columnValue); + + aObject.InsertL(aObject.Size(), ConvertTo8LC(columnValue)); + pushed++; + } + + else if (aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound) + { + HBufC* serverName = proxyView->ReadLongTextLC(TPtrC( + PROXY_SERVER_NAME)); + pushed++; + + aObject.InsertL(aObject.Size(), ConvertTo8LC(*serverName)); + pushed++; + } + } + else + { + CleanupStack::PopAndDestroy(); // proxyView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + else + { + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + serviceType, qDB, serviceId); + + errorCode = tableView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + if (aURI.Find(KNSmlDdfDNSPriority) >= 0) /* DNSPriority */ + { + UriUtils::TUriHostType theType; + TInt dnsPri; + + // This resets iLUID to match aLUID, which is needed in this case. + // Otherwise iLUID has a different value + if (!treeConstructed) + iLUID = IntLUID(aLUID); + + if (LuidToDns(theType, dnsPri, iLUID) == KErrNone) + { + if (dnsPri == 1) + { + aObject.InsertL(aObject.Size(), KNSmlFirstDNSPri); + } + else + { + aObject.InsertL(aObject.Size(), KNSmlSecondDNSPri); + } + } + else + { + CleanupStack::PopAndDestroy(tableView); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + else if (aURI.Find(KNSmlDdfDNSAddrTy) >= 0) /* DNSAddrTy */ + { + UriUtils::TUriHostType theType; + TInt dnsPri; + // This resets iLUID to match aLUID, which is needed in this case. + // Otherwise iLUID has a different value + if (!treeConstructed) + iLUID = IntLUID(aLUID); + if (LuidToDns(theType, dnsPri, iLUID) == KErrNone) + { + if (theType == UriUtils::EIPv4Host) + { + aObject.InsertL(aObject.Size(), KNSmlDNSIp); + } + else + { + aObject.InsertL(aObject.Size(), KNSmlDNSIp6); + } + } + else + { + CleanupStack::PopAndDestroy(tableView); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + else + { + TBuf columnValue; + if (aURI.Find(KNSmlDdfDNSAddrL) >= 0) + { + UriUtils::TUriHostType theType; + TInt dnsPri; + + // This resets iLUID to match aLUID, which is needed in this case. + // Otherwise iLUID has a different value + if (!treeConstructed) + iLUID = IntLUID(aLUID); + if (LuidToDns(theType, dnsPri, iLUID) == KErrNone) + { + if (dnsPri == 1) + { + if (theType == UriUtils::EIPv4Host) + { + qColumn.Set( + TPtrC(SERVICE_IP_NAME_SERVER1)); + } + else + { + qColumn.Set(TPtrC( + SERVICE_IP6_NAME_SERVER1)); + + } + } + else + { + if (theType == UriUtils::EIPv4Host) + { + qColumn.Set( + TPtrC(SERVICE_IP_NAME_SERVER2)); + } + else + { + qColumn.Set(TPtrC( + SERVICE_IP6_NAME_SERVER2)); + + } + } + } + else + { + CleanupStack::PopAndDestroy(tableView); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + TRAPD(leavecode, tableView->ReadTextL(qColumn, + columnValue)); + if (leavecode != 0) + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + aObject.InsertL(aObject.Size(), ConvertTo8LC(columnValue)); + pushed++; + } + } + else + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + CleanupStack::PopAndDestroy(); // tableView + } + else if (fType == CNSmlInternetAdapter::EBool) + { // UseCB + CCommsDbTableView* boolView = iDatabase->OpenViewMatchingUintLC( + serviceType, qDB, serviceId); + + errorCode = boolView->GotoFirstRecord(); + + TBool objectBool = EFalse; + if (errorCode == KErrNone) + { + TRAPD(leavecode, boolView->ReadBoolL(qColumn, objectBool)); + if (leavecode == KErrUnknown) // value is null + { + } + } + else + { + CleanupStack::PopAndDestroy(); // boolView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); + return CSmlDmAdapter::EError; + } + + if (objectBool) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValTrue); + } + else + { + aObject.InsertL(aObject.Size(), KNSmlDmApValFalse); + } + + CleanupStack::PopAndDestroy(); // boolView + } + else if (fType == CNSmlInternetAdapter::EInt) + { // NAPId +Bearer + NAPAddrTy + PxID + PortNbr + UsePTxtLog + // CBTy + LnkSpeed + + if (aURI.Match(_L8("AP/*/Px/*/PxID")) != KErrNotFound) + { + aObject.InsertL(aObject.Size(), SetIntObjectLC(iISPId)); + pushed++; + } + + else if (aURI.Find(KNSmlDdfIAPSeamlessness) >= 0) /* Seamlessness handling */ + { + TInt seam = GetIAPSeamlessnessL(iapID); + aObject.InsertL(aObject.Size(), SetIntObjectLC(seam)); + pushed++; + } + else if (aURI.Find(KNSmlDdfIAPMetaData) >= 0) + { + TInt meta = GetIAPMetaDataL(iapID); + aObject.InsertL(aObject.Size(), SetIntObjectLC(meta)); + pushed++; + } + + else if (aURI.Match(_L8("AP/*/Networks/*/ID")) != KErrNotFound) + { + + iISPId = IntLUID(aLUID); + + CCommsDbTableView* nwidView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iISPId); + nwidView->GotoFirstRecord(); + nwidView->ReadUintL(TPtrC(IAP_NETWORK), iISPId); + CleanupStack::PopAndDestroy(); // nwidView + + aObject.InsertL(aObject.Size(), SetIntObjectLC(iISPId)); + pushed++; + } + else if (aURI.Match(_L8("AP/*/Px/*/PortNbr")) != KErrNotFound) + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): PortNbr"); + DBG_ARGS8(_S8("iISPId = %d "), iISPId); + DBG_ARGS8(_S8("proxyid = %d "), iProxyId); + CCommsDbTableView* portView = iDatabase->OpenViewMatchingUintLC( + TPtrC(PROXIES), TPtrC(COMMDB_ID), iProxyId); + + errorCode = portView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): Portview opened"); + TUint32 object32 = 0; + + TRAPD(leavecode, portView->ReadUintL(qColumn, object32)); + if (leavecode == KErrNone) + { + aObject.InsertL(aObject.Size(), SetIntObjectLC(object32)); + pushed++; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): db read failed"); + CleanupStack::PopAndDestroy(); // portView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); + return CSmlDmAdapter::EError; + } + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): Portview opening failed"); + CleanupStack::PopAndDestroy(); // portView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + CleanupStack::PopAndDestroy(); // portView + } + else if (aURI.Match(_L8("AP/*/NAPID")) != KErrNotFound || aURI.Match( + _L8("AP/*/ToNAPIDL")) != KErrNotFound) + { + iObject = iapID; + TPtrC8 napidUri = FirstURISeg(aURI); + aObject.InsertL(aObject.Size(), napidUri); + + } + else + { + iObject = 0; + + CCommsDbTableView* colView = iDatabase->OpenViewMatchingUintLC( + serviceType, qDB, serviceId); + + errorCode = colView->GotoFirstRecord(); + + TUint32 object32 = 0; + if (errorCode == KErrNone) + { + if (aURI.Find(KNSmlDdfUsePTxtLog) >= 0) + { + TBool objectBool = EFalse; + TRAPD(leavecode, colView->ReadBoolL(qColumn, objectBool)); + errorCode = leavecode; + object32 = objectBool; + } + else + { + TRAPD(leavecode, colView->ReadUintL(qColumn, object32)); + errorCode = leavecode; + } + } + + if (errorCode == KErrNone) + { + + if (aURI.Find(KNSmlDdfNAPAddrTy) >= 0 || /* NAPAddrTy handling */ + aURI.Find(KNSmlDdfGPRSPDP) >= 0) /* NAPAddrTy handling */ + { + if (object32 == RPacketContext::EPdpTypeIPv4) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValIpv4); + } + else if (object32 == RPacketContext::EPdpTypeIPv6) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValIpv6); + } + else if (object32 == RPacketContext::EPdpTypePPP) + { + _LIT8(KPpp, "PPP"); + aObject.InsertL(aObject.Size(), KPpp); + } + else + { + aObject.InsertL(aObject.Size(), KNullDesC8); + } + } + else + { + aObject.InsertL(aObject.Size(), SetIntObjectLC(object32)); + pushed++; + } + } + else + { + CleanupStack::PopAndDestroy(); // colView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + CleanupStack::PopAndDestroy(); // colView + } + } + + else if (fType == CNSmlInternetAdapter::EWap) + { // Startpg + PxAuthId + PxAuthPW + PortNbr (BasAuthId + BasAuthPW) + CCommsDbTableView* wapView = iDatabase->OpenViewMatchingUintLC(TPtrC( + WAP_IP_BEARER), TPtrC(WAP_IAP), iapID); + + errorCode = wapView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + TBuf columnValue; + + if (qColumn == TPtrC(WAP_START_PAGE)) + { + TRAPD(leavecode, wapView->ReadUintL( + TPtrC(WAP_ACCESS_POINT_ID), iWapId)); + CleanupStack::PopAndDestroy(); // wapView + if (leavecode != KErrNone) + { + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); + return CSmlDmAdapter::EError; + + } + + CCommsDbTableView* wapView2 = + iDatabase->OpenViewMatchingUintLC(TPtrC( + WAP_ACCESS_POINT), TPtrC(COMMDB_ID), iWapId); + + errorCode = wapView2->GotoFirstRecord(); + if (errorCode != KErrNone) + { + CleanupStack::PopAndDestroy(); // wapView2 + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + + HBufC* tmpVal = wapView2->ReadLongTextLC(qColumn); + + aObject.InsertL(aObject.Size(), ConvertTo8LC(tmpVal->Des())); + CleanupStack::PopAndDestroy(); // ReadLongTextLC + CleanupStack::PopAndDestroy(); // wapView2 + pushed++; + } + else + { + if (qColumn == TPtrC(WAP_PROXY_PORT)) + { + TUint32 object32; + wapView->ReadUintL(qColumn, object32); + if (object32 == KWAPP_PORT_9200) // wappdef.h + { + aObject.InsertL(aObject.Size(), ConvertTo8LC( + KWappPort9200)); + } + else if (object32 == KWAPP_PORT_9201) + { + aObject.InsertL(aObject.Size(), ConvertTo8LC( + KWappPort9201)); + } + else if (object32 == KWAPP_PORT_9202) + { + aObject.InsertL(aObject.Size(), ConvertTo8LC( + KWappPort9202)); + } + else if (object32 == KWAPP_PORT_9203) + { + aObject.InsertL(aObject.Size(), ConvertTo8LC( + KWappPort9203)); + } + else + { + CleanupStack::PopAndDestroy(); // wapView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + + pushed++; + } + else + { + wapView->ReadTextL(qColumn, columnValue); + aObject.InsertL(aObject.Size(), ConvertTo8LC(columnValue)); + pushed++; + } + CleanupStack::PopAndDestroy(); // wapView + } + } + else + { + CleanupStack::PopAndDestroy(); // wapView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + } + else if (fType == CNSmlInternetAdapter::ESpec) + { + // name + if (aURI.Find(KNSmlDdfNAPName) >= 0) + { + TUint32 iapID10 = IntLUID(aLUID); + /* CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, + qDB, + serviceId);*/ + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iapID); + + errorCode = tableView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + TBuf columnValue; + TRAPD(leavecode, tableView->ReadTextL(TPtrC(COMMDB_NAME), + columnValue)); + if (leavecode != 0) + { + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + return CSmlDmAdapter::ENotFound; + } + aObject.InsertL(aObject.Size(), ConvertTo8LC(columnValue)); + pushed++; + } + CleanupStack::PopAndDestroy(); // tableView + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + } + // BearerL + NoPxForL + IAPService + else if (aURI.Find(KNSmlDdfIAPService) >= 0) + { + aObject.InsertL(aObject.Size(), SetIntObjectLC(serviceId)); + pushed++; + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EOk end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + } + else if (aURI.Find(KNSmlDdfNoPxForL) >= 0) /* No proxies used handling */ + { + TBool proxyFound = GetProxyIdL(aURI); + if (!proxyFound) + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + + CCommsDbTableView* exeptionView = + iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), TPtrC( + COMMDB_ID), iProxyId); + errorCode = exeptionView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + HBufC* proxyExceptions = exeptionView->ReadLongTextLC(TPtrC( + PROXY_EXCEPTIONS)); + pushed++; + + aObject.InsertL(aObject.Size(), + ConvertTo8LC(*proxyExceptions)); + pushed++; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + CleanupStack::PopAndDestroy(); // exeptionView + + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EOk end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + } + + if (aURI.Find(KNSmlDdfDirection) >= 0) + { + if (serviceType == TPtrC(OUTGOING_GPRS)) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValOutgoing); + } + else if (serviceType == TPtrC(INCOMING_GPRS)) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValIncoming); + } + else if (serviceType == TPtrC(LAN_SERVICE)) // Wlan ADD + { + aObject.InsertL(aObject.Size(), KNSmlDmApValOutgoing); + } + else if (serviceType == TPtrC(VPN_SERVICE)) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValOutgoing); + } + else + { + _LIT8(KDirectionUnk, "DirectionUnknown"); + aObject.InsertL(aObject.Size(), KDirectionUnk); + } + } + else + { + if (serviceType == TPtrC(OUTGOING_GPRS) || serviceType == TPtrC( + INCOMING_GPRS)) + { + if (i3GPPPS) + { + aObject.InsertL(aObject.Size(), KNSmlDmApVal3Gppps); + i3GPPPS = EFalse; + } + else + { + aObject.InsertL(aObject.Size(), KNSmlDmApValGsmGprs); + } + + } + + else if (serviceType == TPtrC(OUTGOING_GPRS) || serviceType + == TPtrC(INCOMING_GPRS)) + { + if (i3GPPPS) + { + aObject.InsertL(aObject.Size(), KNSmlDmApVal3Gppps); + i3GPPPS = EFalse; + } + else + { + aObject.InsertL(aObject.Size(), KNSmlDmApValGsmGprs); + } + + } + else if (serviceType == TPtrC(VPN_SERVICE)) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValVpn); + } + + else if ((serviceType == TPtrC(LAN_SERVICE) && iWlanSupported)) + { + aObject.InsertL(aObject.Size(), KNSmlDmApValWlan); + } + else + { + _LIT8(KUnkBearer, "Unknown Bearer"); + aObject.InsertL(aObject.Size(), KUnkBearer); + } + } + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::FetchLeafObjectL(internal)(): ENotFound end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::ENotFound; + } + + _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)(): end"); + CleanupStack::PopAndDestroy(pushed); + return CSmlDmAdapter::EOk; + + } + +//------------------------------------------------------------------------------ +// CSmlDmAdapter::ChildURIListL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::ChildURIListL(const TDesC8& aURI, + const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): begin"); + DBG_ARGS8(_S8("AP:ChildURIListL URI - <%S> <%S>"), &aURI, &aLUID); + + CBufBase* currentURISegmentList = CBufFlat::NewL(128); + CleanupStack::PushL(currentURISegmentList); + + TUint32 checkLUID = IntLUID(aLUID); + + // If this is command to proxy node we'll need to make sure that + // the LUID is for proxy node and not AP node. + // If this command comes to predefined AP node then + // the LUID passed is inherited from that node and is not + // proper proxy node. + if (aURI.Match(_L8("AP/*/Px/*")) != KErrNotFound) + { + TLex8 lex(aLUID); + TUint tempLUID; + if (!((lex.Val(tempLUID) == KErrNone) && (tempLUID + > KNSmlApProxyLowerBase) + && (tempLUID < KNSmlApProxyUpperBase))) + { + // Non-proxy LUID + checkLUID = 0; + } + } + + // Fetch all data for child + if (!checkLUID && (!IsWLANfield(aURI) || !iWlanSupported)) + { + if (aURI.Match(KNSmlDdfAP) == KErrNotFound) // Not for AP + { + CleanupStack::PopAndDestroy(); // currentURISegmentList + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + } + + TUint32 apId = GetAPIdFromURIL(aURI); + + if (aURI.Match(_L8("AP/*")) != KErrNotFound && !APExistsL(apId)) + { + if (aLUID.Length() > 0) + { + // Stale data, remove mapping. + TInt ret = iCallBack->RemoveMappingL(KNSmlInternetAdapterImplUid, + GetDynamicAPNodeUri(aURI), ETrue); + } + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE( + "CNSmlInternetAdapter::ChildURIListL(): AP doesn't exist: ENotFound end"); + return; + } + + if (aURI.Match(_L8("AP/*")) != KErrNotFound && aURI.Match(_L8("AP/*/*")) + == KErrNotFound) + { + // Check if AP exists + if (!APExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + currentURISegmentList->InsertL(0, KNSmlAPnode); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); + return; + } + + // Check that queried proxy exists + if (aURI.Match(_L8("AP/*/Px/*")) != KErrNotFound && !PxExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + + if (aURI.Match(_L8("AP/*/Px/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/Px/*/*")) == KErrNotFound) + { + // Check if PX exists + if (!PxExistsL(checkLUID)) + { + // Only WAP-data + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + // List all Px + currentURISegmentList->InsertL(0, KNSmlPxnode); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): OK end"); + return; + } + + if (aURI.Match(_L8("AP/*/NAPDef/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/NAPDef/*/*")) == KErrNotFound) + { + // Check if IAP has luid mapped + HBufC8* iapIdBuf = iCallBack->GetLuidAllocL(RemoveLastSeg(aURI)); + TInt iapIdInt = GetIntObject8(iapIdBuf->Des()); + + delete iapIdBuf; + iapIdBuf = NULL; + + if (iapIdInt > 0) + { + CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iapIdInt); + TInt error = iapView->GotoFirstRecord(); + TBuf serviceType; + if (error == KErrNone) + { + iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + } + CleanupStack::PopAndDestroy(iapView); + + // Check if NAPDef exists + if (!NAPDefExistsL(checkLUID)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE( + "CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); + return; + } + // List all NAPDef + if (IsWlanL(aURI) && iWlanSupported) + { + iWlanAdapter->ChildURIListL(aURI, aLUID, + aPreviousURISegmentList, aResultsRef, aStatusRef); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): WLAN end"); + return; + } + _LIT(KGprs, "*GPRS*"); + _LIT(K3gppps, "*3GPPPS*"); + if (serviceType.Match(KGprs) != KErrNotFound + || serviceType.Match(K3gppps) != KErrNotFound) + { + currentURISegmentList->InsertL(0, KNSmlNAPDefGPRSnode); + } + +#ifdef __SYNCML_DM_LSCRIPT + currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlLoginscriptnode); +#endif + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); + return; + } + + if ((aURI.Match(_L8("AP/*/WLAN")) != KErrNotFound || aURI.Match(_L8( + "AP/*/WLAN/*")) != KErrNotFound) && iWlanSupported) + { + iWlanAdapter->ChildURIListL(aURI, aLUID, aPreviousURISegmentList, + aResultsRef, aStatusRef); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): WLAN end"); + return; + } + // + // Get all AP numbers from IAP-table + // + if (aURI.Match(KNSmlDdfAP) != KErrNotFound) + { + TBool inDatabase = EFalse; + + CCommsDbTableView* apView = iDatabase->OpenTableLC(TPtrC(IAP)); + + TInt errorCode = apView->GotoFirstRecord(); + + while (errorCode == KErrNone) + { + TUint32 lValue; + TBool validService = EFalse; + TInt lLine(0); + apView->ReadUintL(TPtrC(COMMDB_ID), lValue); + + TBuf serviceType; + apView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + TUint32 bearerId = 0; + apView->ReadUintL(TPtrC(IAP_BEARER), bearerId); + // + // Skip other service types than GSM outgoing + // + if (serviceType == TPtrC(OUTGOING_GPRS) || serviceType == TPtrC( + INCOMING_GPRS)) + { + validService = ETrue; + } + + else if (serviceType == TPtrC(LAN_SERVICE) && bearerId > 1) + { + validService = ETrue; + } + else if (serviceType == TPtrC(VPN_SERVICE)) + { + validService = ETrue; + } + else if ((serviceType == TPtrC(LAN_SERVICE)) && iWlanSupported) + { + validService = ETrue; + } + + if (validService) + { + // Skip others + // + // Check if in aPreviousURISegmentList + // + while (!inDatabase && lLine < aPreviousURISegmentList.Count()) + { + TUint32 list = GetIntObject8(aPreviousURISegmentList.At( + lLine).iURISegLUID); + if (list == lValue) + { + inDatabase = ETrue; + } + else + { + lLine++; + } + } + + if (inDatabase) + { + currentURISegmentList->InsertL( + currentURISegmentList->Size(), + aPreviousURISegmentList.At(lLine).iURISeg); + currentURISegmentList->InsertL( + currentURISegmentList->Size(), KNSmlDmApValFSlash); + inDatabase = EFalse; + DBG_ARGS8(_S8("InList: Id = %d Name %S"), lValue, + &aPreviousURISegmentList.At(lLine).iURISeg); + + } + else + { + _LIT8(Kprev, "APId"); + TBuf8<9> addNAME(Kprev); // APIdnnn , nnn = profileid + addNAME.AppendNumFixedWidth(lValue, EDecimal, 3); + + currentURISegmentList->InsertL( + currentURISegmentList->Size(), addNAME); + currentURISegmentList->InsertL( + currentURISegmentList->Size(), KNSmlDmApValFSlash); + DBG_ARGS8(_S8("NotInList: Id = %d Name %S"), lValue, + &addNAME); + + // KNSmlDMStart includes start text for URISeg + TBuf8<20> addURI; // AP/APIdnnn , nnn = profileid + addURI.Append(_L8("AP/APId")); + addURI.AppendNumFixedWidth(lValue, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, lValue); + + // Also added to mapping + iCallBack->SetMappingL(addURI, addLUID); + } + } // Skip + errorCode = apView->GotoNextRecord(); + } + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(2); // apView, currentURISegmentList + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); + return; + } + + iISPId = IntLUID(aLUID); + + // + // Get all NAPDef numbers + // + if (aURI.Match(_L8("AP/*/NAPDef")) != KErrNotFound) + { + TBool inDatabase = EFalse; + TBuf serviceType; + TUint32 serviceId; + + CCommsDbTableView* napdefView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iISPId); + + TInt errorCode = napdefView->GotoFirstRecord(); + + if (errorCode != KErrNone) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::ChildURIListL(): NAPDef error end"); + CleanupStack::PopAndDestroy(2); // napdefView, currentURISegmentList + return; + } + else + { + napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + napdefView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); // ID + CleanupStack::PopAndDestroy(); // napdefView + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + serviceType, TPtrC(COMMDB_ID), serviceId); + + errorCode = tableView->GotoFirstRecord(); + + while (errorCode == KErrNone) + { + TUint32 lValue; + TInt lLine(0); + tableView->ReadUintL(TPtrC(COMMDB_ID), lValue); + // + // Check if in aPreviousURISegmentList + // + while (!inDatabase && lLine < aPreviousURISegmentList.Count()) + { + TUint32 list = GetIntObject8( + aPreviousURISegmentList.At(lLine).iURISegLUID); + if (list == lValue) + { + inDatabase = ETrue; + } + else + { + lLine++; + } + } + + if (inDatabase) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + aPreviousURISegmentList.At(lLine).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + inDatabase = EFalse; + } + else + { + _LIT8(Kprev, "NAPId"); + TBuf8<15> addNAME(Kprev); // APIdnnn , nnn = profileid + addNAME.AppendNumFixedWidth(lValue, EDecimal, 3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(), + addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + + _LIT8(Kprev2, "/NAPId"); + TBuf8<80> addURI; // AP/xxx/NAPDef/NAPIdnnn , nnn = id nbr + addURI.Append(aURI); + addURI.Append(Kprev2); + addURI.AppendNumFixedWidth(lValue, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, lValue); + + // Also added to mapping + iCallBack->SetMappingL(addURI, addLUID); + } + errorCode = tableView->GotoNextRecord(); + } + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); + return; + } + + // Get all Px numbers + // Check also AP-nbr + serviceType and nbr for Proxy + // To get right data for AP + // + if (aURI.Match(_L8("AP/*/Px")) != KErrNotFound) + { + TBool inDatabase = EFalse; + TBuf serviceType; + TUint32 ServiceIsp; + + CCommsDbTableView* pxView = iDatabase->OpenViewMatchingUintLC(TPtrC( + IAP), TPtrC(COMMDB_ID), iISPId); + + TInt errorCode = pxView->GotoFirstRecord(); + + if (errorCode != KErrNone) + { + CleanupStack::PopAndDestroy(2); // pxView, currentURISegmentList + _DBG_FILE( + "CNSmlInternetAdapter::ChildURIListL(): NAPDef error end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + else + { + pxView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); // Type + pxView->ReadUintL(TPtrC(IAP_SERVICE), ServiceIsp); // ID + CleanupStack::PopAndDestroy(); // pxView + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingTextLC( + TPtrC(PROXIES), TPtrC(PROXY_SERVICE_TYPE), serviceType); + + errorCode = tableView->GotoFirstRecord(); + + TBool proxyFound(false); + while (errorCode == KErrNone) + { + TUint32 lProxyIspId; + TUint32 lProxyId; + TInt lLine(0); + tableView->ReadUintL(TPtrC(PROXY_ISP), lProxyIspId); + tableView->ReadUintL(TPtrC(COMMDB_ID), lProxyId); + if (lProxyIspId == ServiceIsp) // Right value ISP + { + proxyFound = true; + tableView->ReadUintL(TPtrC(COMMDB_ID), lProxyId); + // + // Check if in aPreviousURISegmentList + // + while (!inDatabase && lLine < aPreviousURISegmentList.Count()) + { + TUint32 list = GetIntObject8(aPreviousURISegmentList.At( + lLine).iURISegLUID) - KNSmlApProxyLowerBase; + if (list == lProxyId) + { + inDatabase = ETrue; + } + else + { + lLine++; + } + } + + if (inDatabase) + { + currentURISegmentList->InsertL( + currentURISegmentList->Size(), + aPreviousURISegmentList.At(lLine).iURISeg); + currentURISegmentList->InsertL( + currentURISegmentList->Size(), KNSmlDmApValFSlash); + inDatabase = EFalse; + DBG_ARGS8(_S8("InList: Id = %d Name %S"), lProxyId + + KNSmlApProxyLowerBase, + &aPreviousURISegmentList.At(lLine).iURISeg); + } + else + { + _LIT8(Kprev, "PXId"); + TBuf8<9> addNAME(Kprev); // PXIdnnn , nnn = profileid + addNAME.AppendNumFixedWidth(lProxyId, EDecimal, 3); + + currentURISegmentList->InsertL( + currentURISegmentList->Size(), addNAME); + currentURISegmentList->InsertL( + currentURISegmentList->Size(), KNSmlDmApValFSlash); + DBG_ARGS8(_S8("NotInList: Id = %d Name %S"), lProxyId, + &addNAME); + TBuf8<80> addURI; // AP/xxx/Px/PXIdnnn , nnn = id nbr + addURI.Append(aURI); + _LIT8(KPxid, "/PXId"); + addURI.Append(KPxid); + addURI.AppendNumFixedWidth(lProxyId, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, KNSmlApProxyLowerBase + lProxyId); // 100000 + lProxyId + + // Also added to mapping + iCallBack->SetMappingL(addURI, addLUID); + } + } + errorCode = tableView->GotoNextRecord(); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); + if (proxyFound) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + } + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/Bearer/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/Bearer/*/*")) == KErrNotFound) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), (_L8( + "BearerL/Direction"))); // Direction + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): BearerL end"); + return; + } + + if (aURI.Match(_L8("AP/*/Bearer")) != KErrNotFound) + { + if (aPreviousURISegmentList.Count() > 0) // Allready mapped + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + aPreviousURISegmentList.At(0).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + } + else + { + _LIT8(Kprev, "BId"); + TBuf8<9> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(), + addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/NapDef/Bearer/BIdn , n=aLUID + addURI.Append(aURI); + _LIT8(KBid, "/BId"); + addURI.Append(KBid); + addURI.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, checkLUID); + + // Also added to mapping + iCallBack->SetMappingL(addURI, addLUID); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Bearer end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/DNSAddr/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/DNSAddr/*/*")) == KErrNotFound) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDNSAddrNode); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddrL end"); + return; + } + + if (aURI.Match(_L8("AP/*/DNSAddr")) != KErrNotFound) + { + + TBuf ServType; + TUint32 servId; + + CCommsDbTableView* napdefView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iISPId); + + TInt errorCode = napdefView->GotoFirstRecord(); + + if (errorCode != KErrNone) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::ChildURIListL(): DNSAddr error end"); + CleanupStack::PopAndDestroy(2); // napdefView, currentURISegmentList + return; + } + else + { + napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), ServType); + napdefView->ReadUintL(TPtrC(IAP_SERVICE), servId); // ID + CleanupStack::PopAndDestroy(napdefView); // napdefView + } + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + ServType, TPtrC(COMMDB_ID), servId); + + errorCode = tableView->GotoFirstRecord(); + + if (errorCode != KErrNone) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::ChildURIListL(): DNSAddr error end"); + CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList + return; + } + else + { + // Now we can read DNSAddrL values + TInt leavecode; + TBuf columnValue; + TBuf8<16> addLUID; + TBuf8<80> addURI; // AP/xxx/NAPDef/DNSAddr/DNSx + _LIT8(KFormat, "%d"); + TRAP(leavecode, tableView->ReadTextL(TPtrC( + SERVICE_IP_NAME_SERVER1), columnValue)); + if ((leavecode == KErrNone) && (columnValue.Length() > 0)) + { + addURI.Append(aURI); + addURI.Append(KNSmlDNS1); + _LIT8(KDns1, "DNS1"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KDns1); + addLUID.Format(KFormat, DnsToLuid(UriUtils::EIPv4Host, 1)); + iCallBack->SetMappingL(addURI, addLUID); + addURI.Zero(); + } + + TRAP(leavecode, tableView->ReadTextL(TPtrC( + SERVICE_IP_NAME_SERVER2), columnValue)); + if (leavecode == KErrNone && (columnValue.Length() > 0)) + { + if (currentURISegmentList->Size() > 0) + { + currentURISegmentList->InsertL( + currentURISegmentList->Size(), KNSmlDmApValFSlash); + } + addURI.Append(aURI); + addURI.Append(KNSmlDNS2); + _LIT8(KDns2, "DNS2"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KDns2); + addLUID.Format(KFormat, DnsToLuid(UriUtils::EIPv4Host, 2)); + iCallBack->SetMappingL(addURI, addLUID); + addURI.Zero(); + } + + TRAP(leavecode, tableView->ReadTextL(TPtrC( + SERVICE_IP6_NAME_SERVER1), columnValue)); + if (leavecode == KErrNone && (columnValue.Length() > 0)) + { + if (currentURISegmentList->Size() > 0) + { + currentURISegmentList->InsertL( + currentURISegmentList->Size(), KNSmlDmApValFSlash); + } + addURI.Append(aURI); + addURI.Append(KNSmlDNS3); + _LIT8(KDns3, "DNS3"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KDns3); + addLUID.Format(KFormat, DnsToLuid(UriUtils::EIPv6Host, 1)); + iCallBack->SetMappingL(addURI, addLUID); + addURI.Zero(); + } + + TRAP(leavecode, tableView->ReadTextL(TPtrC( + SERVICE_IP6_NAME_SERVER2), columnValue)); + if (leavecode == KErrNone && (columnValue.Length() > 0)) + { + if (currentURISegmentList->Size() > 0) + { + currentURISegmentList->InsertL( + currentURISegmentList->Size(), KNSmlDmApValFSlash); + } + addURI.Append(aURI); + addURI.Append(KNSmlDNS4); + _LIT8(KDns4, "DNS4"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KDns4); + addLUID.Format(KFormat, DnsToLuid(UriUtils::EIPv6Host, 2)); + iCallBack->SetMappingL(addURI, addLUID); + } + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddr end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(tableView); + CleanupStack::PopAndDestroy(currentURISegmentList); // currentURISegmentList + } + return; + } + + if (aURI.Match(_L8("AP/*/Port/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/Port/*/*")) == KErrNotFound) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDdfPortNbr); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Port end"); + return; + } + + if (aURI.Match(_L8("AP/*/Port")) != KErrNotFound) + { + + TUint32 iapID10 = GetAPIdFromURIL(aURI); + + if (WapAPExistsL(iapID10)) // WapPort + { + TBuf8<80> addURI; // AP/xxx/Px/Port/WAP + addURI.Append(aURI); + _LIT8(KWap, "/WAP"); + addURI.Append(KWap); + _LIT8(KWap2, "WAP/"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KWap2); + } + + if (PxExistsL(checkLUID)) // ProxyPort + { + TBuf8<80> addURI; // AP/xxx/Px/Port/PROXY + addURI.Append(aURI); + _LIT8(KProxy, "/PROXY"); + addURI.Append(KProxy); + _LIT8(KProxy2, "PROXY/"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KProxy2); + } + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Port end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/NAPAuthInf/*")) != KErrNotFound && aURI.Match( + _L8("AP/*/NAPAuthInf/*/*")) == KErrNotFound) + { + _LIT8(KAuthFields, "AuthName/AuthSecr"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + (KAuthFields)); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInfL end"); + return; + } + + if (aURI.Match(_L8("AP/*/NAPAuthInf")) != KErrNotFound) + { + _LIT8(Kprev, "AUId"); + TBuf8<9> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(), addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/NapDef/NAPAuthInf/AUIdn , n=aLUID + addURI.Append(aURI); + _LIT8(KAuid, "/AUId"); + addURI.Append(KAuid); + addURI.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, checkLUID); + + // Also added to mapping + iCallBack->SetMappingL(addURI, addLUID); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInf end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/PxAuthInf/*")) != KErrNotFound && aURI.Match( + _L8("AP/*/PxAuthInf/*/*")) == KErrNotFound) + { + _LIT8(KPxAuthFields, "PxAuthId/PxAuthPW"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + (KPxAuthFields)); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInfL end"); + return; + } + + if (aURI.Match(_L8("AP/*/PxAuthInf")) != KErrNotFound) + { + _LIT8(Kprev, "AUPxId"); + TBuf8<11> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(), addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/Px/PxAuthInf/AUPxIdn , n=aLUID + addURI.Append(aURI); + _LIT8(KAupxid, "/AUPxId"); + addURI.Append(KAupxid); + addURI.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInf end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/ToNAPID/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/ToNAPID/*/*")) == KErrNotFound) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + (KNSmlDdfToNAPIDL)); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ToNAPIDL end"); + return; + } + + if (aURI.Match(_L8("AP/*/ToNAPID")) != KErrNotFound) + { + _LIT8(Kprev, "TId"); + TBuf8<9> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(), addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/NapDef/ToNAPID/TIdn , n=aLUID + addURI.Append(aURI); + _LIT8(KTid, "/TId"); + addURI.Append(KTid); + addURI.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ToNAPID end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/Networks/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/Networks/*/*")) == KErrNotFound) + { + _LIT8(KNameId, "Name/ID"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + (KNameId)); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Networks end"); + return; + } + + if (aURI.Match(_L8("AP/*/Networks")) != KErrNotFound) + { + checkLUID = GetAPIdFromURIL(aURI); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), checkLUID); + + TInt errorCode = tableView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + TUint32 nwLUID = 0; + tableView->ReadUintL(TPtrC(IAP_NETWORK), nwLUID); // Networks luid + if (!NetworkExistsL(nwLUID)) + { + errorCode = KErrNotFound; + } + } + + CleanupStack::PopAndDestroy(); // tableView + + if (errorCode != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter::ChildURIListL(): Networks error end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + CleanupStack::PopAndDestroy(); // currentURISegmentList + return; + } + + if (aPreviousURISegmentList.Count() > 0) // Allready mapped + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + aPreviousURISegmentList.At(0).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + } + else + { + _LIT8(Kprev, "NwId"); + TBuf8<9> addNAME(Kprev); // Id + addNAME.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + currentURISegmentList->InsertL(currentURISegmentList->Size(), + addNAME); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + + TBuf8<80> addURI; // AP/xxx/NapDef/Networks/NwIdn , n=aLUID + addURI.Append(aURI); + _LIT8(KNwid, "/NwId"); + addURI.Append(KNwid); + addURI.AppendNumFixedWidth(checkLUID, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, checkLUID); + + // Also added to mapping + iCallBack->SetMappingL(addURI, addLUID); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Networks end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/NoPxFor/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/NoPxFor/*/*")) == KErrNotFound) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + (KNSmlDdfNoPxForL)); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NoPxFor end"); + return; + } + + if (aURI.Match(_L8("AP/*/NoPxFor")) != KErrNotFound) + { + if (aPreviousURISegmentList.Count() > 0) // Allready mapped + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + aPreviousURISegmentList.At(0).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + } + else + { + _LIT8(KexepPrev, "eXC"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KexepPrev); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NoPxFor end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + if (aURI.Match(_L8("AP/*/Domain/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/Domain/*/*")) == KErrNotFound) + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + (KNSmlDdfDomainL)); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + CleanupStack::PopAndDestroy(); // currentURISegmentList + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Domain end"); + return; + } + + if (aURI.Match(_L8("AP/*/Domain")) != KErrNotFound) + { + if (aPreviousURISegmentList.Count() > 0) // Allready mapped + { + currentURISegmentList->InsertL(currentURISegmentList->Size(), + aPreviousURISegmentList.At(0).iURISeg); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KNSmlDmApValFSlash); + } + else + { + _LIT8(KexepPrev, "dOM"); + currentURISegmentList->InsertL(currentURISegmentList->Size(), + KexepPrev); + } + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Domain end"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, + KNullDesC8); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, KNullDesC8); + _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); + + CleanupStack::PopAndDestroy(); // currentURISegmentList + + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::AddNodeBufferL() +// Inserts new AP-data to database +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::AddNodeBufferL(const TDesC8& aURI, + const TDesC8& /*aParentLUID*/, const TInt aStatusRef, + const TBool aDnsUpd, const TBool aWlan) + { + TInt index = -1; + + for (TInt i = 0; i < iBuffer->Count(); i++) + { + TPtrC8 parentUri = FirstURISeg(aURI); + if (iBuffer->At(i).iMappingName->Compare(parentUri) == 0) + { + index = i; + break; + } + } + + if (index < 0) + { + TNSmlAPBufferElement newNode; + newNode.iMappingName = aURI.AllocLC(); + + NextAPNameL(*LastURISeg(aURI).AllocLC()); + CleanupStack::PopAndDestroy(); + + newNode.iName = iIAPName.AllocLC(); + newNode.iNodeBuf = new (ELeave) CArrayFixFlat ( + KNSmlAPGranularity); + newNode.iWlanNodeBuf + = new (ELeave) CArrayFixFlat ( + KNSmlAPGranularity); + newNode.iExecuted = EFalse; + newNode.iBearer = EFalse; + newNode.iDirection = EFalse; + newNode.iNameReceived = EFalse; + if (aDnsUpd) + { + newNode.iDnsUpdateBuf = ETrue; + } + else + { + newNode.iDnsUpdateBuf = EFalse; + } + newNode.iLuid = 0; + iBuffer->AppendL(newNode); + CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName + + index = iBuffer->Count() - 1; + } + + if (!aDnsUpd) + { + TNSmlAPAddElement newCommand; + newCommand.iUri = aURI.AllocLC(); + newCommand.iData = 0; + newCommand.iStatusRef = aStatusRef; + newCommand.iLeaf = EFalse; + newCommand.iDone = EFalse; + + TPtrC8 parentUri = FirstURISeg(aURI); + newCommand.iLuid = iCallBack->GetLuidAllocL(parentUri); + + if (aWlan) + { + iBuffer->At(index).iWlanNodeBuf->AppendL(newCommand); + } + else + { + iBuffer->At(index).iNodeBuf->AppendL(newCommand); + } + CleanupStack::Pop(); //newCommand.iUri + } + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::AddLeafBufferL() +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::AddLeafBufferL(const TDesC8& aURI, + const TDesC8& aParentLUID, const TDesC8& aObject, + const TDesC8& /*aType*/, const TInt aStatusRef, const TBool aWlan) + { + TInt index = -1; + + for (TInt i = 0; i < iBuffer->Count(); i++) + { + TPtrC8 parentUri = FirstURISeg(aURI); + if (iBuffer->At(i).iMappingName->Compare(parentUri) == 0) + { + index = i; + break; + } + } + + if (index < 0) + { + if (aParentLUID.Length() < 0) + { + DBG_ARGS8(_S8("AP:AddLeafBufferL URI - <%S> <%S> NOTFOUND"), + &aURI, &aParentLUID); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + else + { + // this means update to DNSAddr/ + TPtrC8 apURI = FirstURISeg(aURI); + HBufC8* luid = iCallBack->GetLuidAllocL(apURI); + CleanupStack::PushL(luid); + + AddNodeBufferL(apURI, luid->Des(), -2, ETrue); + iDnsIpv4Pri = 0; + iDnsIpv6Pri = 0; + + CleanupStack::PopAndDestroy(luid); + index = 0; + } + } + + TNSmlAPAddElement newCommand; + + newCommand.iUri = aURI.AllocLC(); //aURI.AllocLC(); + newCommand.iData = aObject.AllocLC(); + newCommand.iStatusRef = aStatusRef; + newCommand.iLuid = aParentLUID.AllocLC(); + newCommand.iLeaf = ETrue; + newCommand.iDone = EFalse; + + if (aWlan) + { + iBuffer->At(index).iWlanNodeBuf->AppendL(newCommand); + } + else + { + iBuffer->At(index).iNodeBuf->AppendL(newCommand); + } + + CleanupStack::Pop(3); //newCommand.iLastUriSeg, newCommand.iData, newCommand.iLuid + + if (aURI.Find(KNSmlDdfBearerL) >= 0) // Bearer added + { + if (aObject.Match(KNSmlDmApValGsmGprs) != KErrNotFound) + { + iBuffer->At(index).iBearer = ETrue; + } + + else if (aObject.Match(KNSmlDmApVal3Gppps) != KErrNotFound + || aObject.Match(KNSmlDmApValVpn) != KErrNotFound) + { + iBuffer->At(index).iBearer = ETrue; + } + if ((aObject.Match(KNSmlDmApValWlan) != KErrNotFound) + && iWlanSupported) // Valid Bearer + { + iBuffer->At(index).iBearer = ETrue; + } + } + + if (aURI.Find(KNSmlDdfDirection) >= 0) // Direction added + { + iBuffer->At(index).iDirection = ETrue; + } + + if (aURI.Match(_L8("AP/*/NAPDef/*/*")) != KErrNotFound && aURI.Match(_L8( + "AP/*/NAPDef/*/*/*")) == KErrNotFound + && LastURISeg(aURI).Compare(KNSmlDdfNAPName) == 0) + { + iIAPExists = EFalse; + iBuffer->At(index).iNameReceived = ETrue; + + delete iBuffer->At(index).iName; + iBuffer->At(index).iName = 0; + + iBuffer->At(index).iName = aObject.AllocLC(); + iIAPName.Copy(aObject); + CleanupStack::Pop(); + + // Check if Name and LUID match + TPtrC qTable = TPtrC(IAP); // Check if IAP-table free + TPtrC qDB = TPtrC(COMMDB_ID); + TPtrC8 parentUri = FirstURISeg(aURI); + HBufC8* luid = iCallBack->GetLuidAllocL(parentUri); + CleanupStack::PushL(luid); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + qTable, qDB, IntLUID(*luid)); + + TInt errorCode = tableView->GotoFirstRecord(); + if (errorCode != KErrNotFound) + { + // Check the name + TBuf8 name; + tableView->ReadTextL(TPtrC(COMMDB_NAME), name); + if (name.Compare(aObject) != 0) + { + // Not correct name + // Remove all mappings from AP/xxx level + if (isAdd) + { + TInt ret = iCallBack->RemoveMappingL( + KNSmlInternetAdapterImplUid, GetDynamicAPNodeUri( + aURI), ETrue); + iPrevURI->Des().Format(KNullDesC8); + iPrevLUID = 0; + } + else + { + iIAPExists = ETrue; + iLeafType = EDMUpdate; + } + + } + else + { + iIAPExists = ETrue; + iLeafType = EDMUpdate; + } + } + CleanupStack::PopAndDestroy(tableView); + CleanupStack::PopAndDestroy(luid); + } + // + + // If Bearer data + Direction + name => add is possible for AP + // + if (iBuffer->At(index).iDirection && iBuffer->At(index).iBearer + && iBuffer->At(index).iNameReceived && !iExecutingBuffer) + { + iBearer.Zero(); + iDirection = ECommDbConnectionDirectionUnknown; + ExecuteBufferL(aURI); + + } + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::AddNodeObjectL() +// Inserts new AP-data to database +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::AddNodeObjectL(const TDesC8& aURI, + const TDesC8& aParentLUID, const TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): begin"); + + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddNodeObjectL(): aURI=<%S>, aParentLUID=<%S>"), + &aURI, &aParentLUID); + + if (iLeafType == EDMUpdate && iExecutingBuffer) + { + // This is an update to an old IAP. All node additions return KErrAlreadyExists. + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EAlreadyExists); // EError + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); + return; + } + + // Save LUID to local variable to be able to reset the value, if needed. + TBuf8 parentLUID; + parentLUID.Zero(); + parentLUID = aParentLUID; + + TUint32 apId = GetAPIdFromURIL(aURI); + + if (parentLUID.Length() > 0 && IntLUID(parentLUID) > 0 + && !APExistsL(apId)) + { + // AP has been deleted. Handle as new data. + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): parentLUID.Length() > 0 && !APExistsL() -> Remove mapping "); + TInt ret = iCallBack->RemoveMappingL(KNSmlInternetAdapterImplUid, + GetDynamicAPNodeUri(aURI), ETrue); + if (ret) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + parentLUID.Zero(); + iPrevURI->Des().Format(KNullDesC8); + iPrevLUID = 0; + } + + if (parentLUID.Length() <= 0) + { + // Check OOD before saving new + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + if (SysUtil::FFSSpaceBelowCriticalLevelL(&fs, + KNSmlInternetAdapterFatMinSize)) + { + CleanupStack::PopAndDestroy(); // fs + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EDiskFull); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): DISK FULL end"); + return; + // do not write + } + CleanupStack::PopAndDestroy(); //fs + } + // + // Check if AP-add + // + if ((aURI.Match(_L8("AP/*")) != KErrNotFound && aURI.Match(_L8("AP/*/*")) + == KErrNotFound) || (aURI.Match(_L8("AP/*/NAPDef/*")) + != KErrNotFound && aURI.Match(_L8("AP/*/NAPDef/*/*")) + == KErrNotFound) || aURI.Match(_L8("AP/*/NAPDef")) + != KErrNotFound || aURI.Match(_L8("AP/*/NAPDef/*/Bearer")) + != KErrNotFound || (aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*")) + != KErrNotFound && aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*/*")) + == KErrNotFound) || aURI.Match(_L8("*/WLAN*")) != KErrNotFound) + { + if ((parentLUID.Length() <= 0) && (aURI.Match(_L8("*/WLAN*")) + != KErrNotFound)) + { + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse, ETrue); + return; + } + if (parentLUID.Length() <= 0) + { + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + return; + } + + if (iTransactionCommitted && !iDatabase->InTransaction()) + { + + _DBG_FILE( + "CNSmlInternetAdapter::AddNode object, begin commsdb transaction "); + TInt codeBegin = iDatabase->BeginTransaction(); + TInt retry = KBeginTransRetryCount; + if (codeBegin == KErrNone) + { + iTransactionCommitted = EFalse; + } + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddNode object iDatabase->Begintransaction start of addobjectL return code = %d"), + codeBegin); + if (codeBegin == KErrLocked) + { + _DBG_FILE( + "CNSmlInternetAdapter::Addnodeobject Database->Begintransaction has returned KErrLocked"); + while (retry > 0 && codeBegin == KErrLocked) + { + User::After(KBeginTransRetryDelay); + codeBegin = iDatabase->BeginTransaction(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddNode object iDatabase->Begintransaction after 2 seconds of wait of addobjectL return code = %d"), + codeBegin); + retry--; + } + + if (codeBegin == KErrNone) + { + iTransactionCommitted = EFalse; + _DBG_FILE( + "CNSmlInternetAdapter::AddNode object transaction commited is false "); + } + + } + + } + if ((aURI.Match(_L8("*/WLAN*")) != KErrNotFound) && iWlanSupported) + { + DBG_ARGS8( + _S8( + "To WlanAdapter::AddNodeObjectL - uri: <%S> to parentLUID: <%S>"), + &aURI, &parentLUID); + iWlanAdapter->AddNodeObjectL(aURI, parentLUID, aStatusRef); + return; + } + + TInt pluid = IntLUID(parentLUID); + + if (pluid < 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + iIAPId = pluid; + + TPtrC qTable = TPtrC(IAP); // Check if IAP-table free + TPtrC qDB = TPtrC(COMMDB_ID); + + //Check if URI is /AP/*/NAPDef/* then it should be check IAP ID in DB not IAPService + if ((iIAPId >= 0) + && ((aURI.Match(_L8("AP/*/NAPDef/*")) != KErrNotFound) + || (aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*")) + != KErrNotFound) || (aURI.Match(_L8("AP/*")) + != KErrNotFound) || (aURI.Match(_L8("AP/*/NAPDef")) + != KErrNotFound))) + { + //Get parent UID and check if that exist if not add + iIAPId = GetAPIdFromURIL(aURI); + + } + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + qTable, qDB, iIAPId); + + TInt errorCode = tableView->GotoFirstRecord(); + + CleanupStack::PopAndDestroy(tableView); + + // Node allready exists => No adding possible + if (errorCode == KErrNone) + { + if (!iExecutingBuffer) + { + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + } + else + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EAlreadyExists); // EError + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); + } + return; + } + else if (iIAPId == 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): ENotFound end"); + return; + } + else if (iIAPId > 0 && errorCode == KErrNotFound) // Stale data, needs update + { + + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): stale data Add to buffer"); + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + iStaleMapUpdate = ETrue; + return; + } + + } + else if (aURI.Match(_L8("AP/*/Px/*")) != KErrNotFound && // How to check if already added + aURI.Match(_L8("AP/*/Px/*/*")) == KErrNotFound) // dm-tree knows last LUID + { + if (parentLUID.Length() <= 0) + { + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + return; + } + + // Check if already exists on database (=> only One possible for AP) + if (GetProxyIdL(aURI)) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EAlreadyExists); + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); + return; + } + + TUint32 iapID = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC(TPtrC( + IAP), TPtrC(COMMDB_ID), iapID); + + TInt errorCode = iapView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if (errorCode == KErrNone) + { + iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); + iapView->ReadUintL(TPtrC(IAP_SERVICE), iProxyISP); + CleanupStack::PopAndDestroy(); // iapView + } + else if (iapID > 0 && errorCode == KErrNotFound) // Stale data, needs update + { + + CleanupStack::PopAndDestroy(); // iapViewv + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + iStaleMapUpdate = ETrue; + return; + } + else + { + CleanupStack::PopAndDestroy(); // iapView + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): ENotFound end"); + return; + } + + CCommsDbTableView* proxyTable; + + proxyTable = iDatabase->OpenTableLC(TPtrC(PROXIES)); + + TInt initOK = proxyTable->InsertRecord(iapID); + + TInt retry = KBeginTransRetryCount; + while (retry > 0 && initOK != KErrNone) + { + User::After(KBeginTransRetryDelay); + initOK = proxyTable->InsertRecord(iapID); + retry--; + } + + if (initOK == KErrNone) + { + iProxyServerName = LastURISeg(aURI); // Name from URI + initOK = InitializeProxyL(proxyTable); + + User::After(KBeginTransRetryDelay); + if (initOK == KErrNone) + { + TUint32 newId = 0; + initOK = proxyTable->PutRecordChanges(); + + retry = KBeginTransRetryCount; + while (retry > 0 && initOK != KErrNone) + { + User::After(KBeginTransRetryDelay); + initOK = proxyTable->PutRecordChanges(); + retry--; + } + + proxyTable->ReadUintL(TPtrC(COMMDB_ID), newId); + // + // Set mapping-data + // + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, KNSmlApProxyLowerBase + newId); // 100000 + lProxyId + + // Also added to mapping + iCallBack->SetMappingL(aURI, addLUID); + } + else + { + proxyTable->CancelRecordChanges(); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): EError end"); + } + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): EError end Insert failed"); + } + CleanupStack::PopAndDestroy(); // proxyTable + + } + else if (aURI.Match(_L8("AP/*/Px/*/*")) != KErrNotFound) + { + if (parentLUID.Length() <= 0) + { + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + + TInt pluid = IntLUID(parentLUID); + + if (pluid < 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + else + { + TUint32 apID = GetAPIdFromURIL(aURI); + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), apID); + TInt errorCode = tableView->GotoFirstRecord(); + CleanupStack::PopAndDestroy(tableView); + if (apID > 0 && errorCode == KErrNotFound) // Stale data, needs update + { + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + iStaleMapUpdate = ETrue; + return; + } + + } + } + + else if (aURI.Match(_L8("AP/*/Px")) != KErrNotFound) + { + if (parentLUID.Length() <= 0) + { + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + return; + } + + TInt pluid = IntLUID(parentLUID); + + if (pluid < 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + else if (pluid == 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EError"); + return; + } + else + { + TUint32 apID = GetAPIdFromURIL(aURI); + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), apID); + TInt errorCode = tableView->GotoFirstRecord(); + CleanupStack::PopAndDestroy(tableView); + if (apID > 0 && errorCode == KErrNotFound) // Stale data, needs update + { + _DBG_FILE( + "CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); + AddNodeBufferL(aURI, parentLUID, aStatusRef, EFalse); + iStaleMapUpdate = ETrue; + return; + } + } + } + + else if (aURI.Match(_L8("AP/*/Networks/*")) != KErrNotFound + && aURI.Match(_L8("AP/*/Networks/*/*")) == KErrNotFound) + { + iIAPId = IntLUID(parentLUID); + } + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); + return; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::ExecuteCommandL +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::ExecuteCommandL(const TDesC8&/* aURI*/, + const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::ExecuteCommandL ( .. RWriteStream ..) +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::ExecuteCommandL(const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, TInt aStatusref) + { + _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): begin"); + iCallBack->SetStatusL(aStatusref, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::CopyCommandL +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::CopyCommandL(const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/, + TInt aStatusRef) + { + _DBG_FILE("CNSmlInternetAdapter::CopyCommandL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlInternetAdapter::CopyCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::StartAtomicL +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::StartAtomicL() + { + _DBG_FILE("CNSmlInternetAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlInternetAdapter::StartAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::CommitAtomicL +// not supported +//------------------------------------------------------------------------------ + + +void CNSmlInternetAdapter::CommitAtomicL() + { + _DBG_FILE("CNSmlInternetAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlInternetAdapter::CommitAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::RollbackAtomicL +// not supported +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::RollbackAtomicL() + { + _DBG_FILE("CNSmlInternetAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlInternetAdapter::RollbackAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::StreamingSupport +// returns EFalse +//------------------------------------------------------------------------------ + +TBool CNSmlInternetAdapter::StreamingSupport(TInt& /*aItemSize*/) + { + _DBG_FILE("CNSmlInternetAdapter::StreamingSupport(): begin"); + _DBG_FILE("CNSmlInternetAdapter::StreamingSupport(): end"); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::StreamCommittedL +// not used in this adapter +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::StreamCommittedL() + { + _DBG_FILE("CNSmlInternetAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CNSmlInternetAdapter::StreamCommittedL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::CompleteOutstandingCmdsL +// +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::CompleteOutstandingCmdsL() + { + + _DBG_FILE("CNSmlInternetAdapter::CompleteOutstandingCmdsL(): begin"); + // + // Handle possible unhandled buffered nodes + // + if (!iDatabase->InTransaction()) + { + _DBG_FILE("CompleteOutstandingCmds: Try first begintransaction."); + TInt err = iDatabase->BeginTransaction(); + if (err == KErrLocked) + { + _DBG_FILE("CompleteOutstandingCmds: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && err == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE( + "CompleteOutstandingCmds: Slept 1 second. Try again"); + err = iDatabase->BeginTransaction(); + retry--; + } + if (err != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(err); + } + } + } + _DBG_FILE("CompleteOutstandingCmds: BeginTransaction was successful"); + + iDnsIpv4Pri = 0; + iDnsIpv6Pri = 0; + _LIT8(KDummy, "/Dummy"); + for (TInt h = iBuffer->Count() - 1; h >= 0; h--) // Through buffers + { + TBuf8<80> commandURI; + commandURI.Append(iBuffer->At(h).iMappingName->Des()); + commandURI.Append(KDummy); // Removed on execution + ExecuteBufferL(commandURI, ETrue); + } + iDnsUpdate = EFalse; + iDnsIpv4Pri = 0; + iDnsIpv6Pri = 0; + iBuffer->Reset(); + + if (iWlanSupported) + { + iWlanAdapter->CompleteOutstandingCmdsL(); // Execute possible unhandled WLAN commands + } + + iNetworkId = KErrNotFound; + + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + _DBG_FILE("CNSmlInternetAdapter::CompleteOutstandingCmdsL(): end"); + } + +//============================================= +// CNSmlInternetAdapter::GetAPField() +// Match URI fieldname to +// CommsDb table and column +// +//============================================= +TBool CNSmlInternetAdapter::GetAPField(TPtrC& aTableName, TPtrC& aColumn) const + { + _DBG_FILE("CNSmlInternetAdapter::GetAPField(): Start"); + + TBool fRet = EFalse; + + aColumn.Set(TPtrC(KNullDesC)); + + if (iField->Compare(KNSmlDdfAuthName) == 0) + { + if (aTableName == TPtrC(OUTGOING_GPRS) || aTableName == TPtrC( + INCOMING_GPRS)) + { + aColumn.Set(TPtrC(SERVICE_IF_AUTH_NAME)); + } + else + { + return fRet; + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNAPName) == 0) + { + aColumn.Set(TPtrC(COMMDB_NAME)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfToNAPIDL) == 0) + { + aColumn.Set(TPtrC(COMMDB_ID)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNAPID) == 0) + { + aColumn.Set(TPtrC(COMMDB_ID)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPxId) == 0) + { + aColumn.Set(TPtrC(COMMDB_ID)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPxAddr) == 0) + { + aTableName.Set(TPtrC(PROXIES)); + aColumn.Set(TPtrC(PROXY_SERVER_NAME)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNAPAddrTy) == 0) // Is valid + { + return fRet; + } + else if (iField->Compare(KNSmlDdfDNSAddrL) == 0) + { + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDNSPriority) == 0) + { + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDNSAddrTy) == 0) + { + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNAPAddr) == 0) + { + if (aTableName == TPtrC(OUTGOING_GPRS) || aTableName == TPtrC( + INCOMING_GPRS)) + { + aColumn.Set(TPtrC(GPRS_APN)); // GPRS_PDP_ADDRESS + } + else if (aTableName == TPtrC(LAN_SERVICE)) // Wlan ADD + { + aColumn.Set(TPtrC(ISP_IP_ADDR)); + // Leni: Should this be LAN_IP_ADDR ?? + } + else + { + return fRet; + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfBearerL) == 0) + { + aTableName.Set(TPtrC(IAP)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDirection) == 0) + { + aTableName.Set(TPtrC(IAP)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfAuthSecr) == 0) + { + if (aTableName == TPtrC(OUTGOING_GPRS) || aTableName == TPtrC( + INCOMING_GPRS)) + { + aColumn.Set(TPtrC(SERVICE_IF_AUTH_PASS)); + } + else + { + return fRet; // NotValid + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPortNbr) == 0) + { + if (iWapPort) + { + aTableName.Set(TPtrC(WAP_IP_BEARER)); + aColumn.Set(TPtrC(WAP_PROXY_PORT)); + } + else + { + aTableName.Set(TPtrC(PROXIES)); + aColumn.Set(TPtrC(PROXY_PORT_NUMBER)); + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfStartpg) == 0) + { + aTableName.Set(TPtrC(WAP_ACCESS_POINT)); + aColumn.Set(TPtrC(WAP_START_PAGE)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPxAuthId) == 0) // No KNSmlDdfBasAuthId + { + aTableName.Set(TPtrC(WAP_IP_BEARER)); + aColumn.Set(TPtrC(WAP_PROXY_LOGIN_NAME)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPxAuthPW) == 0) // No KNSmlDdfBasAuthPW + { + aTableName.Set(TPtrC(WAP_IP_BEARER)); + aColumn.Set(TPtrC(WAP_PROXY_LOGIN_PASS)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfUsePTxtLog) == 0) + { + if (aTableName == TPtrC(OUTGOING_GPRS) || aTableName == TPtrC( + INCOMING_GPRS)) + { + aColumn.Set(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH)); + fRet = ETrue; + } + else + { + return fRet; // NotValid + } + } + else if (iField->Compare(KNSmlDdfDefGW) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_GATEWAY)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNetworkMask) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_NETMASK)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNetworkID) == 0) + { + aColumn.Set(TPtrC(COMMDB_ID)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfPPPComp) == 0) + { + if (aTableName == TPtrC(OUTGOING_GPRS) || aTableName == TPtrC( + INCOMING_GPRS)) + { + aColumn.Set(TPtrC(GPRS_DATA_COMPRESSION)); + } + else + { + return fRet; // NotValid + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfGPRSPDP) == 0) + { + if (aTableName == TPtrC(OUTGOING_GPRS) || aTableName == TPtrC( + INCOMING_GPRS)) + { + aColumn.Set(TPtrC(GPRS_PDP_TYPE)); + } + else + { + return fRet; // NotValid + } + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfNoPxForL) == 0) + { + aColumn.Set(TPtrC(PROXY_EXCEPTIONS)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDomainL) == 0) + { + aColumn.Set(TPtrC(PROXY_PROTOCOL_NAME)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIPAddrFromServer) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_ADDR_FROM_SERVER)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIPAddr) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_ADDR)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfDNSAddrFromServer) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP_DNS_ADDR_FROM_SERVER)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIPv6DNSAddrFromServer) == 0) + { + aColumn.Set(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIfNetworks) == 0) + { + aColumn.Set(TPtrC(SERVICE_IF_NETWORKS)); + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIAPService) == 0) + { + aColumn.Set(TPtrC(IAP_SERVICE)); + fRet = ETrue; + } + + else if (iField->Compare(KNSmlDdfIAPSeamlessness) == 0) + { + fRet = ETrue; + } + else if (iField->Compare(KNSmlDdfIAPMetaData) == 0) + { + fRet = ETrue; + } + + DBG_ARGS(_S16("GetAPField: aURI - %S - %S - %S"), &aTableName, + &aColumn, &*iField); + + _DBG_FILE("CNSmlInternetAdapter::GetAPField(): EOk"); + + return fRet; + } + +//============================================= +// CNSmlInternetAdapter::GetAPFieldType() +// Match fieldtype to Commsdb-database +// +//============================================= +CNSmlInternetAdapter::TNSmlAPFieldType CNSmlInternetAdapter::GetAPFieldType( + const TDesC8& aURI) const + { + if (iField->Compare(KNSmlDdfBearerL) == 0) + { + return CNSmlInternetAdapter::ESpec; + } + else if (iField->Compare(KNSmlDdfDirection) == 0) + { + return CNSmlInternetAdapter::ESpec; + } + else if (iField->Compare(KNSmlDdfBearer) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfToNAPIDL) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfNAPID) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfPxId) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfAuthName) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfNAPName) == 0 || iField->Compare( + KNSmlDdfPxName) == 0 || iField->Compare(KNSmlDdfNetworkName) == 0) + { + if (aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound || aURI.Match( + _L8("AP/*/Networks/*/Name")) != KErrNotFound) + { + return CNSmlInternetAdapter::EStr; + } + else + { + return CNSmlInternetAdapter::ESpec; // For NAPName + } + } + else if (iField->Compare(KNSmlDdfNAPAddrTy) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfNAPAddr) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfStartpg) == 0) + { + return CNSmlInternetAdapter::EWap; + } + else if (iField->Compare(KNSmlDdfPxAuthId) == 0) + { + return CNSmlInternetAdapter::EWap; + } + else if (iField->Compare(KNSmlDdfPxAuthPW) == 0) + { + return CNSmlInternetAdapter::EWap; + } + else if (iField->Compare(KNSmlDdfPxAddr) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfDNSAddrFromServer) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfIPv6DNSAddrFromServer) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfDNSAddrL) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfDNSAddrTy) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfDNSPriority) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfPxName) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfAuthSecr) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfPxId) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfPxPW) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfPortNbr) == 0) + { + if (iWapPort) // Different handlig for WAP and Proxy PortNbr + { + return CNSmlInternetAdapter::EWap; + } + else + { + return CNSmlInternetAdapter::EInt; + } + } + else if (iField->Compare(KNSmlDdfUsePTxtLog) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfDefGW) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfNetworkMask) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfNetworkID) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfPPPComp) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfGPRSPDP) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfDomainL) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfNoPxForL) == 0) + { + return CNSmlInternetAdapter::ESpec; + } + else if (iField->Compare(KNSmlDdfIPAddrFromServer) == 0) + { + return CNSmlInternetAdapter::EBool; + } + else if (iField->Compare(KNSmlDdfIPAddr) == 0) + { + return EStr; + } + else if (iField->Compare(KNSmlDdfIfNetworks) == 0) + { + return CNSmlInternetAdapter::EStr; + } + else if (iField->Compare(KNSmlDdfIAPService) == 0) + { + return CNSmlInternetAdapter::ESpec; + } + + else if (iField->Compare(KNSmlDdfIAPSeamlessness) == 0) + { + return CNSmlInternetAdapter::EInt; + } + else if (iField->Compare(KNSmlDdfIAPMetaData) == 0) + { + return CNSmlInternetAdapter::EInt; + } + + _DBG_FILE("CNSmlInternetAdapter::GetAPFieldType(): Error"); + + return EWrong; + } + +//------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------ +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x101F6DE2, CNSmlInternetAdapter::NewL) + }; + +//------------------------------------------------------------------------------ +// TImplementationProxy* ImplementationGroupProxy() +//------------------------------------------------------------------------------ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlInternetAdapter: begin"); + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + _DBG_FILE("ImplementationGroupProxy() for CNSmlInternetAdapter: end"); + return ImplementationTable; + } + +//============================================= +// CNSmlInternetAdapter::IntLUID() +// Returns IntValue for aLUID +//============================================= +TInt CNSmlInternetAdapter::IntLUID(const TDesC8& aLUID) + { + TLex8 lex(aLUID); + + if (lex.Val(iLUID) == KErrNone) + { + if ((iLUID > KNSmlApProxyUpperBase) && (iLUID + < KNSmlApDnsLuidUpperBase)) + { + iLUID = iLUID - KNSmlApProxyUpperBase; + } + else if ((iLUID > KNSmlApProxyLowerBase) && (iLUID + < KNSmlApProxyUpperBase)) + { + iProxyId = iLUID - KNSmlApProxyLowerBase; // Proxy + iLUID = iProxyId; + } + else if ((iLUID > KNSmlAp3gpppsLowerBase) && (iLUID + <= KNSmlApProxyLowerBase)) + { + iLUID = iLUID - KNSmlAp3gpppsLowerBase; + i3GPPPS = ETrue; + } + else + { + iProxyId = 0; + } + return iLUID; + } + else + { + return 0; + } + } + +//============================================= +// CNSmlInternetAdapter::GetIntObject8() +// Returns IntValue for aObject +//============================================= +TInt CNSmlInternetAdapter::GetIntObject8(const TDesC8& aObject) + { + TLex8 lex(aObject); + + TInt lValue = 0; + + if (lex.Val(lValue) == KErrNone) + { + return lValue; + } + else + { + return lValue; + } + } +//============================================= +// CNSmlInternetAdapter::SetIntObjectLC() +// Returns IntValue for aObject +//============================================= +TDesC8& CNSmlInternetAdapter::SetIntObjectLC(const TInt& aObject) + { + HBufC8* buf = HBufC8::NewLC(8); + TPtr8 ptrBuf = buf->Des(); + + ptrBuf.Num(aObject); + + return *buf; + } + +//============================================= +// CNSmlInternetAdapter::NotValidStrLenght() +// False if datalength is valid +//============================================= +TBool CNSmlInternetAdapter::NotValidStrLenght(const TDesC& aSource) + { + TInt len = aSource.Length(); + TBool theBool = EFalse; + + if (len > KCommsDbSvrMaxFieldLength) + { + theBool = ETrue; + } + return theBool; + } + +//============================================= +// CNSmlInternetAdapter::SetField() +// String after last '/' is returned +// +//============================================= +TInt CNSmlInternetAdapter::SetField(const TDesC8& aSource) + { + if (aSource.LocateReverse('/') == KErrNotFound) + { + iField->Des().Format(aSource); + } + else + { + iField->Des().Format(aSource.Mid(aSource.LocateReverse('/') + 1)); + } + + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::ConvertTo8LC() +// Converts string value to 8-bit +// +//============================================= +TDesC8& CNSmlInternetAdapter::ConvertTo8LC(const TDesC& aSource) + { + HBufC8* buf = HBufC8::NewLC(aSource.Length() * 2); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8(bufPtr, aSource); + + return *buf; + } + +//============================================= +// CNSmlInternetAdapter::ConvertTo16LC() +// Converts string value to 16-bit +// +//============================================= +TDesC16& CNSmlInternetAdapter::ConvertTo16LC(const TDesC8& aSource) + { + HBufC16* buf16 = HBufC16::NewLC(aSource.Length()); + TPtr bufPtr16 = buf16->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8(bufPtr16, aSource); + + return *buf16; + } + +//============================================= +// CNSmlInternetAdapter::InitializeGPRSL() +// Initialize GPRS-data before insert +// +//============================================= +TInt CNSmlInternetAdapter::InitializeGPRSL(CCommsDbTableView* aTable) + { + TBuf user; + TBuf pass; + + _LIT(Kdns6Address, "0:0:0:0:0:0:0:0"); + _LIT(KgifNetworks, "ip"); + + // COMMON DATA + aTable->WriteBoolL(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH), EFalse); + + aTable->WriteTextL(TPtrC(GPRS_IF_NETWORKS), KgifNetworks); + + aTable->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(iIAPName)); // Same as IAP + CleanupStack::PopAndDestroy(); //ConvertTo16LC + + aTable->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), EFalse); + aTable->WriteTextL(TPtrC(GPRS_IF_AUTH_NAME), user); + aTable->WriteTextL(TPtrC(GPRS_IF_AUTH_PASS), pass); + + aTable->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue); + aTable->WriteTextL(TPtrC(GPRS_IP_ADDR), KNSmlEmptyIpv4Address); + + aTable->WriteBoolL(TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER), ETrue); + aTable->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER1), KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER2), KNSmlEmptyIpv4Address); + + aTable->WriteBoolL(TPtrC(GPRS_IP6_DNS_ADDR_FROM_SERVER), ETrue); + aTable->WriteTextL(TPtrC(GPRS_IP6_NAME_SERVER1), Kdns6Address); + aTable->WriteTextL(TPtrC(GPRS_IP6_NAME_SERVER2), Kdns6Address); + // GPRS DATA + + aTable->WriteTextL(TPtrC(GPRS_APN), ConvertTo16LC(iIAPName)); // Same as IAP + CleanupStack::PopAndDestroy(); //ConvertTo16LC + + aTable->WriteUintL(TPtrC(GPRS_REQ_PRECEDENCE), 0); + aTable->WriteUintL(TPtrC(GPRS_REQ_DELAY), 0); + aTable->WriteUintL(TPtrC(GPRS_REQ_RELIABILITY), 0); + aTable->WriteUintL(TPtrC(GPRS_REQ_PEAK_THROUGHPUT), 0); + aTable->WriteUintL(TPtrC(GPRS_REQ_MEAN_THROUGHPUT), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_PRECEDENCE), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_DELAY), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_RELIABILITY), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_PEAK_THROUGHPUT), 0); + aTable->WriteUintL(TPtrC(GPRS_MIN_MEAN_THROUGHPUT), 0); + + aTable->WriteUintL(TPtrC(GPRS_IF_AUTH_RETRIES), 0); + + aTable->WriteBoolL(TPtrC(GPRS_DATA_COMPRESSION), EFalse); + aTable->WriteUintL(TPtrC(GPRS_PDP_TYPE), RPacketContext::EPdpTypeIPv4); // IPV4 + + aTable->WriteBoolL(TPtrC(GPRS_ENABLE_LCP_EXTENSIONS), EFalse); + aTable->WriteBoolL(TPtrC(GPRS_ANONYMOUS_ACCESS), EFalse); + aTable->WriteBoolL(TPtrC(GPRS_HEADER_COMPRESSION), EFalse); + + aTable->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue); + aTable->WriteTextL(TPtrC(GPRS_IP_GATEWAY), KNSmlEmptyIpv4Address); + + aTable->WriteTextL(TPtrC(GPRS_IP_ADDR), KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(GPRS_IF_PARAMS), KNullDesC); + aTable->WriteTextL(TPtrC(GPRS_IP_NETMASK), KNullDesC); + + aTable->WriteUintL(TPtrC(GPRS_QOS_WARNING_TIMEOUT), 0xffffffff); + + aTable->WriteUintL(TPtrC(GPRS_AP_TYPE), (TUint32) EIspTypeInternetAndWAP); + + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::InitializeProxyL() +// Initialize Proxy-data before insert +// +//============================================= +TInt CNSmlInternetAdapter::InitializeProxyL(CCommsDbTableView* aTable) + { + _LIT(KprotocolName, "http"); // http, https, ftp, ftps + const TUint32 KPortNumber(80); + + aTable->WriteUintL(TPtrC(PROXY_ISP), iProxyISP); // ISP with which these proxies are associated + + aTable->WriteTextL(TPtrC(PROXY_SERVICE_TYPE), iProxyServiceType); // Type ISP/GPRS + aTable->WriteBoolL(TPtrC(PROXY_USE_PROXY_SERVER), ETrue); + + TPtr proxyName16 = HBufC::NewLC(iProxyServerName.Length())->Des(); + CnvUtfConverter::ConvertToUnicodeFromUtf8(proxyName16, iProxyServerName); + + aTable->WriteLongTextL(TPtrC(PROXY_SERVER_NAME), proxyName16); // Name of the proxy server + aTable->WriteTextL(TPtrC(PROXY_PROTOCOL_NAME), KprotocolName); // also https + ftps + + aTable->WriteUintL(TPtrC(PROXY_PORT_NUMBER), KPortNumber); + + aTable->WriteLongTextL(TPtrC(PROXY_EXCEPTIONS), KNullDesC); + + CleanupStack::PopAndDestroy(); //proxyName16 + return KErrNone; + } + +// CNSmlInternetAdapter::IsInsertAllowedL +// Check if possible to Add new AP +// +//============================================= +TBool CNSmlInternetAdapter::IsInsertAllowedL() + { + TBool theBool = EFalse; + // + // Id + Name + Bearer needed for Insert + // + if (iIAPName.Length() > 0 && iBearer.Length() > 0 && iDirection + != ECommDbConnectionDirectionUnknown) + { + theBool = ETrue; + } + // + // Should check also if Name or iISPId in USE !!! + // + if (theBool) + { + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingTextLC( + iBearer, TPtrC(COMMDB_NAME), iIAPName); + TInt errorCode = tableView->GotoFirstRecord(); + + // Node allready exists => No adding possible + if (errorCode == KErrNone) + { + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::NODE NAME <%S> ALLREADY(): error"), + &iIAPName); + theBool = EFalse; + } + CleanupStack::PopAndDestroy(tableView); + } + return theBool; + } + +//============================================= +// CNSmlInternetAdapter::SaveIAPDataL +// Saves data to IAP-table +// +//============================================= +void CNSmlInternetAdapter::SaveIAPDataL(const TDesC8& aURI) + { + TInt errorCode; + CCommsDbTableView* tableView; + + TBool apEnforce = EFalse; + TBool iapReLock = EFalse; + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::SaveIAPDataL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if (eError == KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + if (iIAPExists) + { + tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC( + COMMDB_ID), iIAPId); + if (IsIAPRecordLockedL(iIAPId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt + reclockerr = + ((CCommsDbProtectTableView*) tableView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + + errorCode = tableView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + // if enforcement is on and rec exists, it needs to be unprotected + if (apEnforce) + { + ((CCommsDbProtectTableView*) tableView)->UnprotectRecord(); + } + } + errorCode = tableView->UpdateRecord(); + } + } + else + { + tableView = iDatabase->OpenTableLC(TPtrC(IAP)); + + errorCode = tableView->InsertRecord(iIAPId); + } + + if (errorCode == KErrNone) + { + TUint32 modemISPId = 1; // Default + TBuf modemBearer = TPtrC(MODEM_BEARER); + if (iBearer == TPtrC(LAN_SERVICE)) + { + modemBearer = TPtrC(LAN_BEARER); + } + else if (iBearer == TPtrC(VPN_SERVICE)) + { + modemBearer = TPtrC(VIRTUAL_BEARER); + } + else + { + modemBearer = TPtrC(MODEM_BEARER); + } + + if (modemBearer == TPtrC(MODEM_BEARER)) + { + GetModemBearerL(modemISPId); + } + else if (modemBearer == TPtrC(VIRTUAL_BEARER)) + { + modemISPId = 1; + } + else if (iWlanSupported) + { + GetLanBearerL(modemISPId); + } + tableView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(iIAPName)); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + + // ISP id must be written + tableView->WriteUintL(TPtrC(IAP_SERVICE), iISPId); + tableView->WriteTextL(TPtrC(IAP_SERVICE_TYPE), iBearer); + + tableView->WriteUintL(TPtrC(IAP_BEARER), modemISPId); + tableView->WriteTextL(TPtrC(IAP_BEARER_TYPE), modemBearer); + if (iNetworkId != KErrNotFound) + { + tableView->WriteUintL(TPtrC(IAP_NETWORK), iNetworkId); // First name on network table + } + tableView->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0); + tableView->WriteUintL(TPtrC(IAP_LOCATION), 2); // Minimum=2 + + + errorCode = tableView->PutRecordChanges(); + } + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + ((CCommsDbProtectTableView*) tableView)->ProtectRecord(); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(iIAPId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + + if (errorCode == KErrNone) + { + if (!iIAPExists) + { + TUint32 lValue; + tableView->ReadUintL(TPtrC(COMMDB_ID), lValue); + + // Add AP + TPtrC8 addURI = GetAddURISeg(aURI, KNSmlDdfAP); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, lValue); + + // Also added to mapping + iCallBack->SetMappingL(addURI, addLUID); + DBG_ARGS8(_S8("AP:level1 URI - <%S> <%S> <%d>"), &addURI, + &addLUID, lValue); + } + + iIAPExists = ETrue; + } + + if (apEnforce) + apEnforce = EFalse; // to rget rid of warnings + + CleanupStack::PopAndDestroy(); // tableView + User::LeaveIfError(errorCode); + } + +//============================================= +// CNSmlInternetAdapter::GetMaxIdL +// Get max id from given bearer +// +//============================================= +TUint32 CNSmlInternetAdapter::GetMaxIdL() + { + CCommsDbTableView* checkView; + TUint32 maxGPRS(0); + checkView = iDatabase->OpenTableLC(iBearer); + TInt errorCodem = checkView->GotoFirstRecord(); + while (errorCodem == KErrNone) + { + TUint32 lValue; + checkView->ReadUintL(TPtrC(COMMDB_ID), lValue); + if (lValue > maxGPRS) + { + maxGPRS = lValue; + } + errorCodem = checkView->GotoNextRecord(); + } + + CleanupStack::PopAndDestroy(); // checkView + + return (maxGPRS); + } + +//============================================= +// CNSmlInternetAdapter::GetProxyIdL +// Get proxy id for given IAP +// +//============================================= +TBool CNSmlInternetAdapter::GetProxyIdL(const TDesC8& aURI) + { + TBool proxyFound = EFalse; + + CCommsDbTableView* checkView; + + // Get servicetype for IAP nbr + + TUint32 iapID = GetAPIdFromURIL(aURI); + if (iapID == 0) + { + if (IsAPUriFormatMatchPredefined(aURI)) + { + iLUID = ConstructTreeL(aURI); + iapID = GetAPIdFromURIL(aURI); + } + + } + // IAP-table search serviceType + serviceId + CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), iapID); + + TBuf serviceType; + TUint32 serviceId; + + TInt errorCode = iapView->GotoFirstRecord(); + + // Read serviceType from (IAP) + if (errorCode == KErrNone) + { + iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + iapView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); + CleanupStack::PopAndDestroy(); // iapView + } + else + { + CleanupStack::PopAndDestroy(); // iapView + return proxyFound; + } + + checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), TPtrC( + PROXY_SERVICE_TYPE), serviceType); + + TInt errorCodem = checkView->GotoFirstRecord(); + + while (errorCodem == KErrNone) + { + TUint32 lValue; + checkView->ReadUintL(TPtrC(PROXY_ISP), lValue); + if (lValue == serviceId) + { + checkView->ReadUintL(TPtrC(COMMDB_ID), iProxyId); + proxyFound = ETrue; + break; + } + errorCodem = checkView->GotoNextRecord(); + } + + CleanupStack::PopAndDestroy(); // checkView + + return proxyFound; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::APExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::APExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), + TPtrC(COMMDB_ID), aId); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // checkView + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::NetworkExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::NetworkExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK), TPtrC( + COMMDB_ID), aId); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // checkView + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::NetworkNameExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::NetworkNameExistsL(TUint32& aId, + const TDesC8& aObject) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(NETWORK), TPtrC( + COMMDB_NAME), ConvertTo16LC(aObject)); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + checkView->ReadUintL(TPtrC(COMMDB_ID), aId); + ret = ETrue; + } + + CleanupStack::PopAndDestroy(2); // checkView ConvertTo16LC + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::AddNetworkL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::AddNetworkL(TUint32& aId, const TDesC8& aObject) + { + TBool ret = EFalse; + TUint32 newId; + CCommsDbTableView* networkView = iDatabase->OpenTableLC(TPtrC(NETWORK)); + + if (networkView->InsertRecord(newId) == KErrNone) + { + networkView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); + if (networkView->PutRecordChanges() == KErrNone) + { + networkView->ReadUintL(TPtrC(COMMDB_ID), aId); // New networks Id + ret = ETrue; + } + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + CleanupStack::PopAndDestroy(); // networkView + DBG_ARGS8(_S8("NsmlInternetAdapter: AddNetworkL:networkId %d"), aId); + + return ret; + } +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::NAPDefExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::NAPDefExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC( + IAP_SERVICE), aId); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + TBuf serviceType; + + checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + serviceType, TPtrC(COMMDB_ID), aId); + error = tableView->GotoFirstRecord(); + + if (error == KErrNone) + { + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // tableView + } + + CleanupStack::PopAndDestroy(); // checkView + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::PxExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::PxExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* pxView; + + pxView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), TPtrC( + COMMDB_ID), aId); + + TInt errorCode = pxView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // pxView + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::WapAPExistsL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::WapAPExistsL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* wapView; + + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_IP_BEARER), TPtrC( + WAP_IAP), aId); + + TInt errorCode = wapView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + wapView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId); + ret = ETrue; + } + CleanupStack::PopAndDestroy(); // wapView + + return ret; + } + +//------------------------------------------------------------------------------ +// TUint32 CNSmlInternetAdapter::GetAPIdFromURIL(const TDesC8& aURI) +// Get AP luid for given aURI +//------------------------------------------------------------------------------ +TUint32 CNSmlInternetAdapter::GetAPIdFromURIL(const TDesC8& aURI) + { + HBufC8* apURI = HBufC8::NewLC(aURI.Length()); + + _DBG_FILE("CNSmlInternetAdapter::GetAPIdFromURIL(): begin"); + DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL - %S "), &aURI); + // + // Second slash after AP + // + TInt i = 0; + for (i = aURI.Find(KNSmlDdfAP) + 3; i < aURI.Length(); i++) + { + if (aURI[i] == '/') + { + break; + } + } + DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL i is %d "), i); + if (i > 0) + { + apURI->Des().Format(aURI.Left(i)); + } + // + // Same profile as previous + // + if (iPrevURI->Match(*apURI) != KErrNotFound) + { + _DBG_FILE("CNSmlInternetAdapter::GetAPIdFromURIL(): previous uri"); + CleanupStack::PopAndDestroy(); // apURI + return iPrevLUID; + } + // + // Fetch AP-id for URI + // + HBufC8* apLUID = iCallBack->GetLuidAllocL(*apURI); + CleanupStack::PushL(apLUID); + + TUint32 resLUID = IntLUID(*apLUID); + DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL luidallocation is %d "), + resLUID); + + if (resLUID > 0) + { + iPrevURI->Des().Format(*apURI); + iPrevLUID = resLUID; + } + + CleanupStack::PopAndDestroy(2); // apURI, apLUID + + return resLUID; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DeleteProxyL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::DeleteProxyL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* pxView; + + pxView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), TPtrC( + COMMDB_ID), aId); + + TInt errorCode = pxView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + errorCode = pxView->DeleteRecord(); + if (errorCode == KErrNone) + { + ret = ETrue; + } + } + + CleanupStack::PopAndDestroy(); // pxView + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DeleteWapAPL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::DeleteWapAPL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* wapView; + + TUint32 wapId = 0; + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool apEnforce = EFalse; + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::DeleteWAPAPL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if (eError == KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_IP_BEARER), TPtrC( + WAP_IAP), aId); + + TInt errorCode = wapView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + wapView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), wapId); // WapIAP id + errorCode = wapView->DeleteRecord(); + if (errorCode == KErrNone) + { + ret = ETrue; + } + } + + if (ret) + { + CCommsDbTableView* wapApView = iDatabase->OpenViewMatchingUintLC( + TPtrC(WAP_ACCESS_POINT), TPtrC(COMMDB_ID), wapId); + + errorCode = wapApView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + errorCode = wapApView->DeleteRecord(); + if (errorCode == KErrNone) + { + ret = ETrue; + } + } + CleanupStack::PopAndDestroy(); // wapApView + } + + CleanupStack::PopAndDestroy(); // wapView + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DeleteNAPDefL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::DeleteNAPDefL(TUint32 aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + TBool apEnforce = EFalse; + TBool iapReLock = EFalse; + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TRAPD( eError,apEnforce=CheckEnforcementL() ) + DBG_ARGS8(_S8("CNSmlInternetAdapter::DeleteNAPDefL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if (eError == KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC( + IAP_SERVICE), aId); + if (IsIAPRecordLockedL(aId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = + ((CCommsDbProtectTableView*) checkView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + TBuf serviceType; + + checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + + CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC( + serviceType, TPtrC(COMMDB_ID), aId); + error = tableView->GotoFirstRecord(); + + if (error == KErrNone) + { + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (apEnforce) + { + ((CCommsDbProtectTableView*) tableView)->UnprotectRecord(); + } + } + + error = tableView->DeleteRecord(); + if (error == KErrNone) + { + ret = ETrue; + } + } + CleanupStack::PopAndDestroy(); // tableView + } + + CleanupStack::PopAndDestroy(); // checkView + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(aId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + if (apEnforce) + apEnforce = EFalse; // to get rid of warnings + + return ret; + } + +// --------------------------------------------------------------------------- +// Removes iapID and linger interval from CentralRepository +// --------------------------------------------------------------------------- +// +void CNSmlInternetAdapter::DeleteLingerL(const TInt aIapId) + { + TInt err(KErrNone); + + // Open repository + CRepository* repository = CRepository::NewLC(KCRUidPDPContextManager); + + // Find if an entry for "iapId" already exists in CentRep + RArray foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL(KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys); // found keys + + if (err == KErrNone) + { + if (foundKeys.Count() > 0) + { + TInt arrayCount(0); + + // Get number of iapId&linger entries in Centrep + err = repository->Get(KPdpContextManagerLingerArrayCount, + arrayCount); + + if (err == KErrNone) + { + TInt32 row = foundKeys[0] & KRowMask; + + // Shift existing entries one position left + for (TInt i = row + 1; i <= arrayCount; i++) + { + TInt iapId(0); + TInt linger(0); + + err = repository->Get((KIapColumn | i), iapId); + + if (err == KErrNone) + { + err = repository->Get((KLingerColumn | i), linger); + } + + if (err == KErrNone) + { + err = repository->Set((KIapColumn | (i - 1)), iapId); + } + + if (err == KErrNone) + { + err = repository->Set((KLingerColumn | (i - 1)), + linger); + } + } + + // Remove the last entry on row arrayCount + if (err == KErrNone) + { + TUint32 errorKey(0); + + err = repository->Delete((KIapColumn | arrayCount), + 0xFFFFFFFF, errorKey); + + if (err == KErrNone) + { + err = repository->Delete( + (KLingerColumn | arrayCount), 0xFFFFFFFF, + errorKey); + arrayCount--; + } + } + + // Update number of iapId&linger entries in Centrep + err = repository->Set(KPdpContextManagerLingerArrayCount, + arrayCount); + } + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy(repository); + + } +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DeleteAPL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::DeleteAPL(TUint32 aId) + { + TBool ret = EFalse; + + //Check MIP IAP first then go forward + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool apEnforce = EFalse; + TBool wlanEnforce = EFalse; + TInt wError = KErrNone; + TRAP(wError, wlanEnforce = CheckWLANEnforcementL());TRAPD( eError,apEnforce=CheckEnforcementL() ) + if( wlanEnforce) + { + UnprotectWLANAPItemL(aId); + } + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DeleteAPL(): EError %d , APEnforcement is %d"), + eError, apEnforce); + if (eError == KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + } + + if (iDatabase->InTransaction()) + iDatabase->CommitTransaction(); + RCmManagerExt cmManagerExt; + cmManagerExt.OpenL(); + RCmConnectionMethodExt cmConMethodExt; + TRAPD(err, cmConMethodExt = cmManagerExt.ConnectionMethodL(aId)); + CleanupClosePushL(cmConMethodExt); + if (err == KErrNone) + { + TRAPD(dError, cmConMethodExt.DeleteL()); + if (dError == KErrNone) + { + DeleteLingerL(aId); + ret = ETrue; + } + } + + CleanupStack::PopAndDestroy(); + cmManagerExt.Close(); + if (!iDatabase->InTransaction()) + { + TInt dberr = iDatabase->BeginTransaction(); + if (dberr == KErrLocked) + { + _DBG_FILE("DeleteAPL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && dberr == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteAPL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if (dberr != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(dberr); + } + } + } + + //The following code is kept under #ifndef , so that it can be removed + //after RD_DM_APPLICATION_LEVEL_ROAMING_SUPPORT becomes stable. + + /* #ifndef RD_DM_APPLICATION_LEVEL_ROAMING_SUPPORT + CCommsDbTableView* checkView; + CCommsDbTableView* proxyView; + + checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), aId); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + // + // Remove possible NAPDef-data first if ONLY IAP + // + TBuf serviceType; + TUint32 serviceId; + + checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + checkView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); + + + CCommsDbTableView* tableView; + tableView= iDatabase->OpenViewMatchingUintLC(serviceType, TPtrC(COMMDB_ID), serviceId); + error = tableView->GotoFirstRecord(); + if (error == KErrNone ) + { + error = tableView->DeleteRecord(); + } + CleanupStack::PopAndDestroy(); // tableView + + // + // Delete Proxies for AP also + // + proxyView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), + TPtrC(PROXY_SERVICE_TYPE), + serviceType); + + TInt errorProxy = proxyView->GotoFirstRecord(); + + while (errorProxy == KErrNone) + { + TUint32 lValue; + proxyView->ReadUintL(TPtrC(PROXY_ISP),lValue); + if(lValue == serviceId) + { + proxyView->ReadUintL(TPtrC(COMMDB_ID),iProxyId); + DBG_ARGS8(_S8("DeleteAPL:Delete ServiceId=%d ProxyId=%d"),lValue, iProxyId); + error = proxyView->DeleteRecord(); + } + errorProxy = proxyView->GotoNextRecord(); + } + + CleanupStack::PopAndDestroy(); // proxyView + + error = checkView->DeleteRecord(); + if( error == KErrNone ) + { + ret = ETrue; + } + + // Delete WAP also + if(WapAPExistsL(aId)) + { + DeleteWapAPL(aId); + } + } + + CleanupStack::PopAndDestroy(); // checkView + #endif + */ + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + return ret; + } + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlInternetAdapter::LastURISeg(const TDesC8& aURI) +// Returns only the last uri segment +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::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 CNSmlInternetAdapter::FirstURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::FirstURISeg(const TDesC8& aURI) + { + TInt j = 0; + for (TInt 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; + } + } + return aURI.Left(j); + } + +//------------------------------------------------------------------------------ +// TPtrC8 CNSmlInternetAdapter::GetDynamicAPNodeUri( const TDesC8& aURI ) +// returns AP/xxx URI +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::GetDynamicAPNodeUri(const TDesC8& aURI) + { + _DBG_FILE("CNSmlInternetAdapter::GetDynamicAPNodeUri(): begin"); + DBG_ARGS8(_S8("CNSmlInternetAdapter::GetDynamicAPNodeUri() - <%S> "), + &aURI); + + TInt i = 0; + for (i = aURI.Find(KNSmlDdfAP) + 3; i < aURI.Length(); i++) + { + if (aURI[i] == '/') + { + break; + } + } + + _DBG_FILE("CNSmlInternetAdapter::GetDynamicAPNodeUri(): end"); + + return aURI.Left(i); + } + +//------------------------------------------------------------------------------ +// CNSmlInternetAdapter::ExecuteBufferL(const TDesC8& aURI) +// Executes commands for AP after Bearer-data is set +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::ExecuteBufferL(const TDesC8& aURI, + const TBool aCompleting) + { + // + // Choose AP according to aURI + // + iExecutingBuffer = ETrue; + for (TInt i = 0; i < iBuffer->Count(); i++) + { + TPtrC8 parentUri = FirstURISeg(aURI); + if (iBuffer->At(i).iMappingName->Compare(parentUri) == 0) + { + iExecutionIndex = i; + break; + } + } + + if ((iExecutionIndex < 0) || (iExecutionIndex >= iBuffer->Count())) + { + return; + } + + iISPId = 0; + // + // Execute all commands for One AP NAPDef + // + if (iBuffer->At(iExecutionIndex).iDnsUpdateBuf) + { + iDnsUpdate = ETrue; + } + + for (TInt cmd = iBuffer->At(iExecutionIndex).iNodeBuf->Count() - 1; cmd + >= 0; cmd--) + { + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + + if (iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Match(_L8( + "AP/*/Px*")) != 0) + { + + if (!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iLeaf) + { + addLUID.Format(KFormat, 0); + if (iBuffer->At(iExecutionIndex).iLuid > 0) + { + addLUID.Format(KFormat, -1); // Used for Status return + } + AddNodeObjectL( + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Des(), + addLUID, iBuffer->At(iExecutionIndex).iNodeBuf->At( + cmd).iStatusRef); + + iBuffer->At(iExecutionIndex).iExecuted = ETrue; + } + else + { + if (iBuffer->At(iExecutionIndex).iDnsUpdateBuf) + { + addLUID.Zero(); + addLUID.Append(iBuffer->At(iExecutionIndex).iNodeBuf->At( + cmd).iLuid->Des()); + } + else + { + addLUID.Format(KFormat, + iBuffer->At(iExecutionIndex).iLuid); + if (!iBuffer->At(iExecutionIndex).iDirection || // The three values has to be set + !iBuffer->At(iExecutionIndex).iBearer + || !iBuffer->At(iExecutionIndex).iNameReceived) // before new AP set + { + addLUID.Format(KFormat, KNSmlIncompleteAP); // (-1) Used for error + } // Status return + } + //iIAPName = iBuffer->At(iExecutionIndex).iName->Des(); + + AddLeafObjectL( + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Des(), + addLUID, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iData->Des(), + KNSmlMimeTypeTextPlain, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iStatusRef); + + if (iBuffer->At(iExecutionIndex).iLuid == 0) // After BearerL + iBuffer->At(iExecutionIndex).iLuid = iISPId; + } + + TInt uidValue = IntLUID(addLUID); + if ((iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Des().Match( + _L8("AP/*/NAPDef/*/NAPAddr")) != KErrNotFound) + && (uidValue == KErrNone)) + { + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iDone = EFalse; + } + else + { + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iDone = ETrue; + } + + } + + } + // + // Execute all commands for One AP Px + // + for (TInt cmd2 = 0; cmd2 < iBuffer->At(iExecutionIndex).iNodeBuf->Count(); cmd2++) + { + TBuf8<16> addLUID2; + _LIT8(KFormat, "%d"); + if (!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iDone) + { + if (!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iLeaf) + { + addLUID2.Format(KFormat, 0); + if (iBuffer->At(iExecutionIndex).iLuid > 0) + { + addLUID2.Format(KFormat, -1); // Used for Status return + } + AddNodeObjectL( + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri->Des(), + addLUID2, iBuffer->At(iExecutionIndex).iNodeBuf->At( + cmd2).iStatusRef); + + iBuffer->At(iExecutionIndex).iExecuted = ETrue; + } + else + { + addLUID2.Format(KFormat, iBuffer->At(iExecutionIndex).iLuid); + iIAPName = iBuffer->At(iExecutionIndex).iName->Des(); + if (!iBuffer->At(iExecutionIndex).iDirection || // Allvalues has to be set + !iBuffer->At(iExecutionIndex).iBearer + || !iBuffer->At(iExecutionIndex).iName) // before new AP set + { + addLUID2.Format(KFormat, KNSmlIncompleteAP); // (-1) Used for error + } // Status return + + AddLeafObjectL( + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri->Des(), + addLUID2, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData->Des(), + KNSmlMimeTypeTextPlain, + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iStatusRef); + + if (iBuffer->At(iExecutionIndex).iLuid == 0) // After BearerL + iBuffer->At(iExecutionIndex).iLuid = iISPId; + } + } //++ + + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iDone = ETrue; + + delete iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri; + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri = NULL; + + if (iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData) + { + delete iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData; + iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData = NULL; + } + } + + // Wlan buffer execution only when called from CompleteOutstandingCmdsL (= aCompleting) + for (TInt i = 0; aCompleting && i + < iBuffer->At(iExecutionIndex).iWlanNodeBuf->Count(); ++i) + { + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + + if (!iBuffer->At(iExecutionIndex).iWlanNodeBuf->At(i).iLeaf) + { + addLUID.Format(KFormat, 0); + + if (iBuffer->At(iExecutionIndex).iLuid > 0) + { + addLUID.Format(KFormat, iBuffer->At(iExecutionIndex).iLuid); + } + + AddNodeObjectL( + iBuffer->At(iExecutionIndex).iWlanNodeBuf->At(i).iUri->Des(), + addLUID, + iBuffer->At(iExecutionIndex).iWlanNodeBuf->At(i).iStatusRef); + + iBuffer->At(iExecutionIndex).iExecuted = ETrue; + } + else + { + addLUID.Zero(); + addLUID.Append( + iBuffer->At(iExecutionIndex).iWlanNodeBuf->At(i).iLuid->Des()); + + iIAPName = iBuffer->At(iExecutionIndex).iName->Des(); + + AddLeafObjectL( + iBuffer->At(iExecutionIndex).iWlanNodeBuf->At(i).iUri->Des(), + addLUID, + iBuffer->At(iExecutionIndex).iWlanNodeBuf->At(i).iData->Des(), + KNSmlMimeTypeTextPlain, + iBuffer->At(iExecutionIndex).iWlanNodeBuf->At(i).iStatusRef); + + if (iBuffer->At(iExecutionIndex).iLuid == 0) // After BearerL + { + iBuffer->At(iExecutionIndex).iLuid = iISPId; + } + + } + + iBuffer->At(iExecutionIndex).iWlanNodeBuf->At(i).iDone = ETrue; + } + + // + // Remove data from handled AP-commands + // + + ClearBuffer(iBuffer->At(iExecutionIndex).iNodeBuf); + + if (aCompleting) + { + delete iBuffer->At(iExecutionIndex).iNodeBuf; + + ClearBuffer(iBuffer->At(iExecutionIndex).iWlanNodeBuf); + delete iBuffer->At(iExecutionIndex).iWlanNodeBuf; + + if (iBuffer->At(iExecutionIndex).iMappingName) + { + delete iBuffer->At(iExecutionIndex).iMappingName; + iBuffer->At(iExecutionIndex).iMappingName = NULL; + } + + if (iBuffer->At(iExecutionIndex).iName) + { + delete iBuffer->At(iExecutionIndex).iName; + iBuffer->At(iExecutionIndex).iName = NULL; + } + + iBuffer->Delete(iExecutionIndex); + iBuffer->Compress(); + } + + iExecutingBuffer = EFalse; + iStaleMapUpdate = EFalse; + } + +//------------------------------------------------------------------------------ +// TPtrC16 CNSmlInternetAdapter::GetAddURISeg(const TDesC8& aURI,const TDesC8 aName) +// Returns uri segment until the next segment after given aName +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::GetAddURISeg(const TDesC8& aURI, + const TDesC8& aName) + { + TInt lStrt = aURI.Find(aName); + if (lStrt == KErrNotFound) + { + return aURI; + } + + lStrt += 1; + TInt i = 0; + for (i = lStrt + aName.Length(); i <= aURI.Length() - 1; i++) + { + if (aURI[i] == '/') + { + break; + } + } + if (i == 0) + { + return aURI; + } + else + { + return aURI.Left(i); + } + } + +//============================================= +// CNSmlInternetAdapter::InitializeWAPAIPL() +// Initialize WAP IAP-data before insert +// +//============================================= +TInt CNSmlInternetAdapter::InitializeWAPIAPL(CCommsDbTableView* aTable, + const TDesC8& aName) + { + aTable->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aName)); // Same as IAP + + + aTable->WriteTextL(TPtrC(WAP_CURRENT_BEARER), iWapBearer); + aTable->WriteLongTextL(TPtrC(WAP_START_PAGE), ConvertTo16LC( + iWAPAccessPoint)); + CleanupStack::PopAndDestroy(2); //ConvertTo16LC + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::InitializeWAPL() +// Initialize WAP IP Bearer-data before insert +// +//============================================= +TInt CNSmlInternetAdapter::InitializeWAPL(CCommsDbTableView* aTable) + { + TUint32 wapPortNumber = 0; + + aTable->WriteUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId); + aTable->WriteTextL(TPtrC(WAP_GATEWAY_ADDRESS), KNSmlEmptyIpv4Address); + + aTable->WriteUintL(TPtrC(WAP_WSP_OPTION), EWapWspOptionConnectionOriented); // EWapWspOptionConnectionless + aTable->WriteBoolL(TPtrC(WAP_SECURITY), EFalse); // if 9200 => false + + aTable->WriteUintL(TPtrC(WAP_IAP), iISPId); + aTable->WriteUintL(TPtrC(WAP_PROXY_PORT), wapPortNumber); + + aTable->WriteTextL(TPtrC(WAP_PROXY_LOGIN_NAME), ConvertTo16LC( + iWapUserName)); + aTable->WriteTextL(TPtrC(WAP_PROXY_LOGIN_PASS), ConvertTo16LC( + iWapPassword)); + + CleanupStack::PopAndDestroy(2); //ConvertTo16LC + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::IsWapPort() +// Check if portnbr for proxy or wap +// +//============================================= +void CNSmlInternetAdapter::IsWapPort(const TDesC8& aObject) + { + iWapPort = EFalse; + TInt portNbr = GetIntObject8(aObject); + if (portNbr >= KNSmlApWapLowerBase && portNbr <= KNSmlApWapUpperBase) + { + iWapPort = ETrue; + } + } + +// ------------------------------------------------------------------------------------- +// CNSmlInternetAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CNSmlInternetAdapter::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); + } + +//======================================================= +// CNSmlInternetAdapter::UpdateIAPnameL() +// Update IAP-table name add Network-table if needed +// Add/update WAP-table name also +// +//======================================================= +TInt CNSmlInternetAdapter::UpdateIAPnameL(TUint32 aId, const TDesC8& aObject) + { + + TUint32 nwId = 0; + TInt ret = KErrNone; + TBool iapReLock = EFalse; + + TBool apEnforce = EFalse; + TRAPD( eError,apEnforce=CheckEnforcementL() ) + DBG_ARGS8(_S8("CNSmlInternetAdapter::UpdateIAPNAme(): EError %d , APEnforcement is %d"),eError,apEnforce); + if (eError == KErrNone && apEnforce) + { + DoLockIAPTablesL(EFalse); + iWAPRelock = ETrue; + } + + CCommsDbTableView* iapUpdate = iDatabase->OpenViewMatchingUintLC(TPtrC( + IAP), TPtrC(COMMDB_ID), aId); + if (IsIAPRecordLockedL(aId)) + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); + TInt reclockerr = + ((CCommsDbProtectTableView*) iapUpdate)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = ETrue; + } + else + { + _DBG_FILE( + "CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); + } + TInt error = iapUpdate->GotoFirstRecord(); + if (error == KErrNone) + { + _DBG_FILE("CNSmlInternetAdapter::UpdateIAPName, IAP_NETWORK set"); + TRAPD(err, iapUpdate->ReadUintL(TPtrC(IAP_NETWORK), nwId)); + + if (iapUpdate->UpdateRecord() == KErrNone) + { + iapUpdate->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); + + if (err != KErrNone) // Network entry not yet created + { + AddNetworkL(nwId, aObject); + if (nwId > 0) + { + _DBG_FILE( + "CNSmlInternetAdapter::UpdateIAPName, IAP_NETWORK set"); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::UpdateIAPName(): networks is %d"), + nwId); + iapUpdate->WriteUintL(TPtrC(IAP_NETWORK), nwId); + } + else + { + ret = KErrGeneral; + } + } + iapUpdate->PutRecordChanges(); + } + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + CleanupStack::PopAndDestroy(); // iapUpdate + + + if (WapAPExistsL(aId)) + { // Update handled + CCommsDbTableView* wapView; + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), + TPtrC(COMMDB_ID), iWapId); + TInt errorCode = wapView->GotoFirstRecord(); + + // Read all columns needed. + if (errorCode == KErrNone) + { + if (wapView->UpdateRecord() == KErrNone) + { + wapView->WriteTextL(TPtrC(COMMDB_NAME), + ConvertTo16LC(aObject)); + wapView->PutRecordChanges(); + CleanupStack::PopAndDestroy(); //ConvertTo16LC + } + } + CleanupStack::PopAndDestroy(); // wapView + } + else + { // Insert handled + CCommsDbTableView* insView; + TInt wapInitOK = KErrCancel; + + insView = iDatabase->OpenTableLC(TPtrC(WAP_ACCESS_POINT)); + iWapId = 0; + wapInitOK = insView->InsertRecord(iWapId); + if (wapInitOK == KErrNone) + { + iWAPAccessPoint.Zero(); + iWapUserName.Zero(); + iWapPassword.Zero(); + iWapBearer = TPtrC(WAP_IP_BEARER); + + wapInitOK = InitializeWAPIAPL(insView, aObject); + wapInitOK = insView->PutRecordChanges(); + + if (wapInitOK == KErrNone) + { + CCommsDbTableView* updView; + TUint32 iWapId2 = 0; + iISPId = aId; // IAP number set + updView = iDatabase->OpenTableLC(TPtrC(WAP_IP_BEARER)); + if (updView->InsertRecord(iWapId2) == KErrNone) + { + InitializeWAPL(updView); + updView->PutRecordChanges(); + } + CleanupStack::PopAndDestroy(); // updView + } + } + else + { + ret = KErrGeneral; + } + CleanupStack::PopAndDestroy(); // insView + } + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (iWAPRelock) + { + DoLockIAPTablesL(ETrue); + iWAPRelock = EFalse; + } + } + if (iapReLock) + { + TInt reclockerr = DoProtectIAPRecordL(aId, ETrue); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"), + reclockerr); + if (reclockerr == KErrNone) + iapReLock = EFalse; + } + return ret; + } + +//============================================= +// CNSmlInternetAdapter::InitializeVPNServiceL() +// Initialize VPNService-data before insert +//============================================= +TInt CNSmlInternetAdapter::InitializeVPNServiceL(CCommsDbTableView* aTable) + { + _LIT(KdefPolicy, "Home"); + + aTable->WriteTextL(TPtrC(COMMDB_NAME), iIAPName); // Same as IAP + + aTable->WriteTextL(TPtrC(VPN_SERVICE_POLICY), KdefPolicy); + aTable->WriteUintL(TPtrC(VPN_SERVICE_IAP), 1); + aTable->WriteUintL(TPtrC(VPN_SERVICE_NETWORKID), 1); + + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::InitializeLANServiceL() +// Initialize LANService-data before insert +//============================================= +TInt CNSmlInternetAdapter::InitializeLANServiceL(CCommsDbTableView* aTable) + { + if (!iWlanSupported) + { + _DBG_FILE( + "CNSmlInternetAdapter::InitializeLANServiceL, WLAN not supported."); + return KErrNotSupported; + } + _LIT(KgifNetworks, "ip,ip6"); + _LIT(Kdns6Address, "0:0:0:0:0:0:0:0"); + _LIT(KdefaultNetmask, "255.255.255.0"); + + aTable->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(iIAPName)); // Same as IAP + aTable->WriteTextL(TPtrC(LAN_IF_NETWORKS), KgifNetworks); + aTable->WriteBoolL(TPtrC(SERVICE_IP_ADDR_FROM_SERVER), ETrue); // DHCP by default. + aTable->WriteTextL(TPtrC(SERVICE_IP_ADDR), KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(SERVICE_IP_NETMASK), KdefaultNetmask); + aTable->WriteBoolL(TPtrC(SERVICE_IP_DNS_ADDR_FROM_SERVER), ETrue); + aTable->WriteTextL(TPtrC(SERVICE_IP_NAME_SERVER1), KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(SERVICE_IP_NAME_SERVER2), KNSmlEmptyIpv4Address); + aTable->WriteTextL(TPtrC(SERVICE_IP_GATEWAY), KNSmlEmptyIpv4Address); + + aTable->WriteBoolL(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER), ETrue); + aTable->WriteTextL(TPtrC(SERVICE_IP6_NAME_SERVER1), Kdns6Address); + aTable->WriteTextL(TPtrC(SERVICE_IP6_NAME_SERVER2), Kdns6Address); + aTable->WriteTextL(TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), + KDaemonManagerName); + aTable->WriteTextL(TPtrC(SERVICE_CONFIG_DAEMON_NAME), KConfigDaemonName); + + CleanupStack::PopAndDestroy(); //ConvertTo16LC + return KErrNone; + } + +//============================================= +// CNSmlInternetAdapter::IsWLANfield() +// Check if handled by WLAN-adapter +//============================================= +TBool CNSmlInternetAdapter::IsWLANfield(const TDesC8& aURI) + { + TBool ret(EFalse); + + SetField(aURI); + + if (KNSmlDdfNetworkID().Match(*iField) == 0) // ID not valid + { + return ret; + } + if (KNSmlDdfAP().Match(*iField) == 0) // AP not valid + { + return ret; + } + if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) != KErrNotFound) + { + DBG_ARGS8(_S8("AP:IsWLANfield URI - <%S> <%S> FOUND"), &aURI, iField); + ret = ETrue; + } + + return ret; + } + +//============================================= +// CNSmlInternetAdapter::IsWlanL() +// Check if WLAN accesspoint +//============================================= +TBool CNSmlInternetAdapter::IsWlanL(const TDesC8& aURI) + { + TBool ret(EFalse); + + if (!iWlanSupported) + { + _DBG_FILE("CNSmlInternetAdapter::IsWlanL, WLAN not supported."); + return ret; + } + + TBuf serviceType; + + // Get IAP nbr for servicetype + TUint32 apWlan = GetAPIdFromURIL(aURI); + + // IAP-table search serviceType (=Bearer) + CCommsDbTableView* iapViews = iDatabase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), apWlan); + + TInt errorCode = iapViews->GotoFirstRecord(); + + // Read iapService from (IAP) + if (errorCode == KErrNone) + { + iapViews->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + if (serviceType == TPtrC(LAN_SERVICE)) + { + ret = ETrue; + } + } + CleanupStack::PopAndDestroy(); // iapViews + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::GetLanBearerL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::GetLanBearerL(TUint32& aId) + { + TBool ret = EFalse; + + if (!iWlanSupported) + { + _DBG_FILE("CNSmlInternetAdapter::GetLanBearerL, WLAN not supported."); + return ret; + } + + CCommsDbTableView* checkView; + + HBufC* bName = HBufC::NewLC(15); + TPtr bNamePtr = bName->Des(); + _LIT(KWlanBearer, "WLANBearer"); + bNamePtr.Format(KWlanBearer); + + checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(LAN_BEARER), TPtrC( + COMMDB_NAME), bNamePtr); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + checkView->ReadUintL(TPtrC(COMMDB_ID), aId); + ret = ETrue; + } + else + { + aId = 1; // Default modem + } + DBG_ARGS8(_S8("CNSmlInternetAdapter:GetLanBearerL %d"), aId); + + CleanupStack::PopAndDestroy(2); // checkView bName + + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::GetModemBearerL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::GetModemBearerL(TUint32& aId) + { + TBool ret = EFalse; + CCommsDbTableView* checkView; + + HBufC* bName = HBufC::NewLC(15); + TPtr bNamePtr = bName->Des(); + + if (iBearer == TPtrC(OUTGOING_GPRS) || iBearer == TPtrC(INCOMING_GPRS)) + { + _LIT(KGprsModem, "GPRS Modem"); + bNamePtr.Format(KGprsModem); + } + + checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(MODEM_BEARER), TPtrC( + COMMDB_NAME), bNamePtr); + TInt error = checkView->GotoFirstRecord(); + if (error == KErrNone) + { + checkView->ReadUintL(TPtrC(COMMDB_ID), aId); + ret = ETrue; + } + else + { + aId = 5; // Default modem 1->5 ??? + } + DBG_ARGS8(_S8("CNSmlInternetAdapter:GetModemBearerL %d"), aId); + + CleanupStack::PopAndDestroy(2); // checkView bName + + return ret; + } + +// --------------------------------------------------------- +// NextAPNameL() +// Generates new AP name. +// --------------------------------------------------------- +void CNSmlInternetAdapter::NextAPNameL(const TDesC8& aName) + { + // generate name candidate + HBufC8* nameCandidate = HBufC8::NewLC(aName.Length() + 12); + TPtr8 candidatePtr = nameCandidate->Des(); + + // loop while valid name is found + TBool validName; + + // loop while valid name is found + TInt i = 0; + do + { + validName = ETrue; + candidatePtr.Format(aName); + if (i > 0) + { + _LIT(KLeftBrace, "("); + _LIT(KRightBrace, ")"); + HBufC* buf = HBufC::NewLC(10); //10 = max length of 32bit integer + TPtr ptrBuf = buf->Des(); + ptrBuf.Num(i); + candidatePtr.Append(KLeftBrace); + candidatePtr.Append(ptrBuf); + candidatePtr.Append(KRightBrace); + CleanupStack::PopAndDestroy(); //buf + } + i++; + if (!IsValidNameL(candidatePtr)) + { + validName = EFalse; + } + } + while (!validName); + + iIAPName = candidatePtr; + + CleanupStack::PopAndDestroy(); //nameCandidate + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::IsValidNameL() +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::IsValidNameL(const TDesC8& aName) + { + TBool ret = ETrue; + CCommsDbTableView* nameView; + + nameView = iDatabase->OpenViewMatchingTextLC(TPtrC(IAP), TPtrC( + COMMDB_NAME), aName); + + TInt errorCode = nameView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + ret = EFalse; // If found error returned + } + + CleanupStack::PopAndDestroy(); // nameView + return ret; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::InitializeDNSParamsFromBuffL(const TPtrC8 aParentUri, +// TInt& aDnsPri ) +// Finds parameters needed in updating DNSAddrL from buffer +//------------------------------------------------------------------------------ +TBool CNSmlInternetAdapter::InitializeDNSParamsFromBuffL( + const TPtrC8 aParentUri, TInt& aDnsPri) + { + TInt cmd(0); + TBool found(EFalse); + + TNSmlAPBufferElement& thisElem = iBuffer->At(0); + + // Parse URI to match + CBufBase* buf = CBufFlat::NewL(150); + CleanupStack::PushL(buf); + buf->InsertL(0, aParentUri); + buf->InsertL(buf->Size(), KNSmlDmApValFSlash); + buf->InsertL(buf->Size(), KNSmlDdfDNSPriority); + TBuf8<150> tmp; + buf->Read(0, tmp, buf->Size()); + + cmd = thisElem.iNodeBuf->Count() - 1; + // check if the DNSPriority is sent for DNSAddr/ + while (cmd >= 0) + { + if (thisElem.iNodeBuf->At(cmd).iUri->Match(tmp) != KErrNotFound) + { + TLex8 lex(thisElem.iNodeBuf->At(cmd).iData->Des()); + lex.Val(aDnsPri); + thisElem.iNodeBuf->At(cmd).iDone = ETrue; + found = ETrue; + } + cmd--; + } + CleanupStack::PopAndDestroy(buf); + return found; + } + +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::DnsToLuid(const UriUtils::TUriHostType aType,) +// const TInt aPriority ) const +// Encodes special luid for DNSAddr/ +//------------------------------------------------------------------------------ +TInt CNSmlInternetAdapter::DnsToLuid(const UriUtils::TUriHostType aType, + const TInt aPriority) const + { + return KNSmlApDnsLuidUpperBase + static_cast (aType) * 10 + + aPriority; + } +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::LuidToDns(UriUtils::TUriHostType& aType,) +// TInt& aPriority, const TInt aLuid ) const +// Decodes DNAddr/ type from LUID +//------------------------------------------------------------------------------ +TInt CNSmlInternetAdapter::LuidToDns(UriUtils::TUriHostType& aType, + TInt& aPriority, const TInt aLuid) const + { + TInt err = KErrNone; + if (aLuid < KNSmlApDnsLuidUpperBase) + { + err = KErrGeneral; + } + else + { + aPriority = (aLuid - KNSmlApDnsLuidUpperBase) % 10; + if ((aPriority > 0) && (aPriority < 3)) + { + TInt type = (aLuid - KNSmlApDnsLuidUpperBase - aPriority) / 10; + if ((type >= 0) && (type < 2)) + { + aType = static_cast (type); + } + else + { + err = KErrGeneral; + } + } + else + { + err = KErrGeneral; + } + } + return err; + } +//------------------------------------------------------------------------------ +// TBool CNSmlInternetAdapter::RemoveLastSeg(const TDesC8& aURI) +// Returns URI without its last segment +//------------------------------------------------------------------------------ +TPtrC8 CNSmlInternetAdapter::RemoveLastSeg(const TDesC8& aURI) const + { + 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(); + } + } + +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::ClearBuffer() +// Deletes all dynamically allocated data from given array's each element +// and resets the buffer. +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::ClearBuffer( + CArrayFixFlat* aBuffer) + { + 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(); + } + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::IsValidIPv4AddressL(const TDesC8& aNapAddr) +//Checks if the string is of correct IPV4 address format x.x.x.x and +//numbers are within the range 0-255 +//returns true on sucess and false on failure. +//---------------------------------------------------------------------- +TBool CNSmlInternetAdapter::IsValidIPv4AddressL(const TDesC8& aNapAddr) + { + TInt digitLen(0); + TBool ret = EFalse; + _LIT8(KNSmlDMV4Format, "*.*.*.*"); + + if (aNapAddr.Match(KNSmlDMV4Format) != KErrNotFound) + { + TInt pos = 0; + TInt numDots = 0; + TInt maxIP = 255; + TInt minIP = 0; + for (TInt i = 0; i < aNapAddr.Length(); i++) + { + digitLen++; + //Check if aNapAddr contain any characters other than + // 0 - 9 and ".", If yes return from the function. + if (aNapAddr[i] != KNSmlDMDot && (aNapAddr[i] + < KNSmlDMAsciiIntStart || aNapAddr[i] + > KNSmlDMAsciiIntEnd)) + { + ret = EFalse; + break; + } + if (aNapAddr[i] == KNSmlDMDot) + { + ret = ETrue; + if (i > 0) + { + TInt digit; + TPtrC8 ptrOneDigit = aNapAddr.Mid(pos, digitLen - 1); + TLex8 lexint(ptrOneDigit); + if (lexint.Val(digit) != KErrNone || digit >= maxIP + || digit < minIP) + { + ret = EFalse; + break; + } + } // end of if i > 0 + pos = i + 1; + numDots++; + digitLen = 0; + } // end of if + } //End of for + if (numDots == 3 && ret) + { + ret = ETrue; + } + else + { + ret = EFalse; + } + } // end of outer if, format check + return ret; + } + +TBool CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(): BEGIN"); + TBool ret = EFalse; + CCommsDbTableView* wapView; + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::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( + "CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL():wap record exists, check for access type"); + TInt err = (((CCommsDbProtectTableView*) wapView)->GetRecordAccess( + aAccess)); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"), + err, aAccess); + CleanupStack::PopAndDestroy(wapView); + if (aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect wapaccesspoint record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlInternetAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord, + TBool aProtect) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): BEGIN"); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::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( + "CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): wap record exists"); + if (!aProtect) + { + err = ((CCommsDbProtectTableView*) wapView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectWAPAccessRecordL ,error code of Unprotectrecord = %d"), + err); + } + + else + { + err = ((CCommsDbProtectTableView*) wapView)->ProtectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectWAPAccessRecordL ,error code of ProtectRecord = %d"), + err); + } + + CleanupStack::PopAndDestroy(wapView); + } + + _DBG_FILE("CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): END"); + return err; + } + +//------------------------------------------------------------------------------ +// TUint32 CNSmlInternetAdapter::GetIAPSeamlessnessL(TUint32 aId) +// Gets the seamlessness value from the IAPMetadata table though the cmmanager API +//------------------------------------------------------------------------------ + +TUint32 CNSmlInternetAdapter::GetIAPSeamlessnessL(TUint32 aId) + { + _DBG_FILE("CNSmlInternetAdapter::GetIAPSeamlessnessL(): begin"); + //Deleting iDatabase, Required since CommsDB has one view open for reading and commsdat API would + //return KErrLocked if this is not done + TBool reopenTransaction(EFalse); + if (iDatabase->InTransaction()) + { + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + reopenTransaction = ETrue; + } + + RCmManagerExt cmManagerExt; + cmManagerExt.OpenL(); + RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL(aId); + CleanupClosePushL(cm); + TUint32 smless = cm.GetIntAttributeL(CMManager::ECmSeamlessnessLevel); + CleanupStack::PopAndDestroy(); + cmManagerExt.Close(); + + //Recreate reference to CommsDB since other tables + //are manipulated with Commsdb + if (reopenTransaction) + { + TInt dberr = iDatabase->BeginTransaction(); + if (dberr == KErrLocked) + { + _DBG_FILE("GetIAPSeamlessnessL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && dberr == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("GetIAPSeamlessnessL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if (dberr != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(dberr); + } + } + } + + _DBG_FILE("CNSmlInternetAdapter::GetIAPSeamlessnessL(): End"); + return smless; + + } + +//------------------------------------------------------------------------------ +// TUint32 CNSmlInternetAdapter::GetIAPMetaDataL(TUint32 aId) +// Gets the metadata value from the IAPMetadata table though the cmmanager API +//-------------------------------------------------------------------------- + +TUint32 CNSmlInternetAdapter::GetIAPMetaDataL(TUint32 aId) + { + _DBG_FILE("CNSmlInternetAdapter::GetIAPMetaDataL(): begin"); + //Deleting iDatabase, Required since CommsDB has one view open for reading and commsdat API would + //return KErrLocked if this is not done + TBool reopenTransaction(EFalse); + if (iDatabase->InTransaction()) + { + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + reopenTransaction = ETrue; + } + + TUint32 metadata, highlight, hidden; + RCmManagerExt cmManagerExt; + + cmManagerExt.OpenL(); + RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL(aId); + CleanupClosePushL(cm); + + TBool metaHidden = cm.GetBoolAttributeL(CMManager::ECmMetaHiddenAgent); + TBool metaHL = cm.GetBoolAttributeL(CMManager::ECmMetaHighlight); + highlight = EMetaHighlight & metaHL; + hidden = EMetaHiddenAgent & metaHidden; + metadata = highlight | hidden; + + CleanupStack::PopAndDestroy(); + cmManagerExt.Close(); + //Recreate reference to CommsDB since other tables + //are manipulated with Commsdb + if (reopenTransaction) + { + TInt dberr = iDatabase->BeginTransaction(); + if (dberr == KErrLocked) + { + _DBG_FILE("GetIAPMetaDataL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && dberr == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("GetIAPMetaDataL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if (dberr != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(dberr); + } + } + } + + _DBG_FILE("CNSmlInternetAdapter::GetIAPMetaDataL(): end"); + return metadata; + + } +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::SetIAPSeamlessnessL(TUint32 apMetaID,TUint32 aSeam,TInt aStatusRef) +// Sets the seamlessness value to the IAPMetadata table though the cmmanager API +//------------------------------------------------------------------------------ +void CNSmlInternetAdapter::SetIAPSeamlessnessL(TUint32 apMetaID, + TUint32 aSeam, TInt aStatusRef) + { + + _DBG_FILE("CNSmlInternetAdapter::SetIAPSeamlessnessL(): begin"); + TBool reopenTransaction(EFalse); + if (iDatabase->InTransaction()) + { + iDatabase->CommitTransaction(); + iTransactionCommitted = ETrue; + reopenTransaction = ETrue; + } + + RCmManagerExt cmManagerExt; + cmManagerExt.OpenL(); + RCmConnectionMethodExt cm; + TInt cmerror = KErrNone; + TRAP(cmerror, cm = cmManagerExt.ConnectionMethodL(apMetaID)); + CleanupClosePushL(cm);TRAPD(sErr,cm.SetIntAttributeL( CMManager::ECmSeamlessnessLevel,aSeam )) + if(sErr == KErrNone) + { + cm.UpdateL(); + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); + } + + CleanupStack::PopAndDestroy(); + + cmManagerExt.Close(); + // iDatabase = CCommsDatabase::NewL(); + if (reopenTransaction) + { + TInt dberr = iDatabase->BeginTransaction(); + if (dberr == KErrLocked) + { + _DBG_FILE("SetIAPSeamlessnessL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && dberr == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("SetIAPSeamlessnessL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if (dberr != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(dberr); + } + } + } + + _DBG_FILE("CNSmlInternetAdapter::SetIAPSeamlessnessL(): end"); + } + +//------------------------------------------------------------------------------ +// void CNSmlInternetAdapter::SetIAPMetaDataL(TUint32 apMetaID,TUint32 aMeta,TInt aStatusRef) +// Sets the metadata value to the IAPMetadata table though the cmmanager API +//------------------------------------------------------------------------------ + +void CNSmlInternetAdapter::SetIAPMetaDataL(TUint32 apMetaID, TUint32 aMeta, + TInt aStatusRef) + { + + _DBG_FILE("CNSmlInternetAdapter::SetIAPMetaDataL(): begin"); + TInt hMHLErr = KErrNone; + TInt hMHAErr = KErrNone; + if (iDatabase) + { + iDatabase->CommitTransaction(); + // delete iDatabase; + } + RCmManagerExt cmManagerExt; + cmManagerExt.OpenL(); + RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL(apMetaID); + CleanupClosePushL(cm); + + if (aMeta & EMetaHighlight) + { + TRAP(hMHLErr, + cm.SetBoolAttributeL(CMManager::ECmMetaHighlight, ETrue)); + } + else + { + TRAP(hMHLErr, cm.SetBoolAttributeL(CMManager::ECmMetaHighlight, + EFalse)); + } + + if (aMeta & EMetaHiddenAgent) + { + TRAP(hMHAErr, cm.SetBoolAttributeL(CMManager::ECmMetaHiddenAgent, + ETrue)); + } + else + { + TRAP(hMHAErr, cm.SetBoolAttributeL(CMManager::ECmMetaHiddenAgent, + EFalse)); + } + if ((hMHAErr == KErrNone) && (hMHLErr == KErrNone)) + { + cm.UpdateL(); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + + CleanupStack::PopAndDestroy(); + + cmManagerExt.Close(); + TInt dberr = iDatabase->BeginTransaction(); + if (dberr == KErrLocked) + { + _DBG_FILE("SetIAPMetaDataL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && dberr == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("SetIAPMetaDataL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if (dberr != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(dberr); + } + } + + _DBG_FILE("CNSmlInternetAdapter::SetIAPMetaDataL(): end"); + } + +void CNSmlInternetAdapter::AddLingerL(const TInt aIapId, + const TInt aLingerInterval) + { + TInt err(KErrNone); + + // Open repository + CRepository* repository = CRepository::NewLC(KCRUidPDPContextManager); + + // Find if an entry for "iapId" already exists in CentRep + RArray foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL(KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys); // found keys + + if (err == KErrNone || err == KErrNotFound) + { + if (foundKeys.Count() == 0) + { + // Add a new entry + TInt arrayCount(0); + + // Get number of iapId&linger entries in Centrep + err = repository->Get(KPdpContextManagerLingerArrayCount, + arrayCount); + + if (err == KErrNone) + { + arrayCount++; + + err = repository->Create((KIapColumn | arrayCount), aIapId); + + if (err == KErrNone) + { + err = repository->Create((KLingerColumn | arrayCount), + aLingerInterval); + } + + if (err == KErrNone) + { + // Update number of iapId&linger entries in Centrep + err = repository->Set(KPdpContextManagerLingerArrayCount, + arrayCount); + } + } + } + else + { + // Update existing entry on current row + TInt32 row = foundKeys[0] & KRowMask; + + err = repository->Set((KLingerColumn | row), aLingerInterval); + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy(repository); + + User::LeaveIfError(err); + } + +void CNSmlInternetAdapter::UpdateLingerL(const TInt aIapId, + const TInt aLingerInterval) + { + TInt err(KErrNone); + + // Open repository + CRepository* repository = CRepository::NewLC(KCRUidPDPContextManager); + + // Find if an entry for "iapId" already exists in CentRep + RArray foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL(KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys); // found keys + + if (err == KErrNone || err == KErrNotFound) + { + + if (foundKeys.Count() == 0) + { + // Add a new entry + TInt arrayCount(0); + + // Get number of iapId&linger entries in Centrep + err = repository->Get(KPdpContextManagerLingerArrayCount, + arrayCount); + + if (err == KErrNone) + { + arrayCount++; + + err = repository->Create((KIapColumn | arrayCount), aIapId); + + if (err == KErrNone) + { + err = repository->Create((KLingerColumn | arrayCount), + aLingerInterval); + } + + if (err == KErrNone) + { + // Update number of iapId&linger entries in Centrep + err = repository->Set(KPdpContextManagerLingerArrayCount, + arrayCount); + } + } + } + else + { + // Update existing entry on currebt row + TInt32 row = foundKeys[0] & KRowMask; + + err = repository->Set((KLingerColumn | row), aLingerInterval); + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy(repository); + + User::LeaveIfError(err); + } +void CNSmlInternetAdapter::GetLingerL(const TInt aIapId, + TInt& aLingerInterval) + { + TInt err(KErrNone); + + // Open repository + CRepository* repository = CRepository::NewLC(KCRUidPDPContextManager); + + // Find if an entry for "iapId" already exists in CentRep + RArray foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL(KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys); // found keys + + if (err == KErrNone) + { + if (foundKeys.Count() > 0) + { + // Find linger interval for the iap id on current row + TInt32 row = foundKeys[0] & KRowMask; + + err = repository->Get((KLingerColumn | row), aLingerInterval); + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy(repository); + + User::LeaveIfError(err); + } + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::CheckEnforcementL() +// If AP policy is enforced true is returned else false +//---------------------------------------------------------------------- +TBool CNSmlInternetAdapter::CheckEnforcementL() + { + CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); + CleanupStack::PushL(info); + TBool enforceActive(EFalse); + User::LeaveIfError(info->EnforcementActive(EAPEnforcement, enforceActive)); + CleanupStack::PopAndDestroy(info); + return enforceActive; + } + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::CheckWLANEnforcementL() +// If WLAN AP policy is enforced true is returned else false +//---------------------------------------------------------------------- +TBool CNSmlInternetAdapter::CheckWLANEnforcementL() + { + CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); + CleanupStack::PushL(info); + TBool enforceActive(EFalse); + User::LeaveIfError(info->EnforcementActive(EWLANEnforcement, + enforceActive)); + CleanupStack::PopAndDestroy(info); + return enforceActive; + } + +//---------------------------------------------------------------------- +//TInt CNSmlInternetAdapter::DoProtectWAPTablesL(TBool aProtect) +// if aProtect is true , tables are locked otherwise tables are unlocked. +//---------------------------------------------------------------------- + +TInt CNSmlInternetAdapter::DoProtectWAPTablesL(TBool aProtect) + { + TInt err = KErrNone; + CCommsDatabaseProtect* dbprotect = CCommsDatabaseProtect::NewL(); + CleanupStack::PushL(dbprotect); + for (TInt i(0); i < iLockTableList.Count(); i++) + { + if (!aProtect) + { + err = dbprotect->UnProtectTable(iLockTableList[i]); + } + else + { + err = dbprotect->ProtectTable(iLockTableList[i]); + } + + } + CleanupStack::PopAndDestroy(dbprotect); + return err; + } +//---------------------------------------------------------------------- +//void CNSmlInternetAdapter::DoLockIAPTablesL(TBool aProtect) +// if aProtect is true , tables are locked otherwise tables are unlocked. +//---------------------------------------------------------------------- + +void CNSmlInternetAdapter::DoLockIAPTablesL(TBool aLock) + { + TInt protError = KErrNone; + TInt err = KErrNone; + iDatabase->CommitTransaction(); + iLockTableList.AppendL(TPtrC(WAP_ACCESS_POINT)); + iLockTableList.AppendL(TPtrC(WAP_IP_BEARER)); + iLockTableList.AppendL(TPtrC(IAP)); + + TRAP(err, protError = DoProtectWAPTablesL(aLock)); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoLockIAPTablesL(): Table protect error %d , leave error %d "), + protError, err); + + if (protError != KErrNone) // To remove the warnings + { + protError = KErrNone; + } + TInt dberr = iDatabase->BeginTransaction(); + if (dberr == KErrLocked) + { + _DBG_FILE("DoLockIAPTablesL: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && dberr == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DoLockIAPTablesL: Slept 1 second. Try again"); + dberr = iDatabase->BeginTransaction(); + retry--; + } + if (dberr != KErrNone) + { + _DBG_FILE( + "CNSmlInternetAdapter: BeginTransaction failed completely."); + User::Leave(dberr); + } + } + } +//-------------------------------------------------------------------- +//TInt UnprotectWLANAPItemL(TUint32 aId) +//Unprotect the wlan AP if only wlan enforcement is on +//------------------------------------------------------------------- +TInt CNSmlInternetAdapter::UnprotectWLANAPItemL(TUint32 aId) + { + _DBG_FILE("CNSmlInternetAdapter::UnprotectWLANAPItemL(): BEGIN"); + CCommsDbTableView* wapView; + + TInt errorCode = KErrNone; + TBuf serviceType; + + //check if its WLAN AP being deleted + wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), + aId); + + errorCode = wapView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + wapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + if (serviceType != TPtrC(LAN_SERVICE)) + { + CleanupStack::PopAndDestroy(); // wapView + return KErrNone; + } + } + + ((CCommsDbProtectTableView*) wapView)->UnprotectRecord(); + + CleanupStack::PopAndDestroy(); // wapView + + _DBG_FILE("CNSmlInternetAdapter::UnprotectWLANAPItemL(): END"); + return errorCode; + } + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::IsIAPRecordLockedL(TUint32 aRecord) +//check for wap access point record lock status +//---------------------------------------------------------------------- + +TBool CNSmlInternetAdapter::IsIAPRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlInternetAdapter::IsIAPRecordLockedL(): BEGIN"); + TBool ret = EFalse; + CCommsDbTableView* apView; + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::IsIAPRecordLockedL record being checked = %d"), + aRecord); + apView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), + aRecord); + + TInt aAccess(0); + if (apView != NULL) + { + _DBG_FILE( + "CNSmlInternetAdapter::IsIAPRecordLockedL():wap record exists, check for access type"); + TInt err = (((CCommsDbProtectTableView*) apView)->GetRecordAccess( + aAccess)); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::IsIAPRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"), + err, aAccess); + CleanupStack::PopAndDestroy(apView); + if (aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlInternetAdapter::IsIAPRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::DoProtectIAPRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect wapaccesspoint record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlInternetAdapter::DoProtectIAPRecordL(TUint32 aRecord, + TBool aProtect) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectIAPRecordL(): BEGIN"); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectIAPRecordL , record and protect value =%d = %d"), + aRecord, aProtect); + TInt err = KErrNone; + + CCommsDbTableView* apView; + apView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), + aRecord); + if (apView != NULL) + { + _DBG_FILE( + "CNSmlInternetAdapter::DoProtectIAPRecordL(): wap record exists"); + if (!aProtect) + { + err = ((CCommsDbProtectTableView*) apView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectIAPAccessRecordL ,error code of Unprotectrecord = %d"), + err); + } + + else + { + err = ((CCommsDbProtectTableView*) apView)->ProtectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectIAPRecordL ,error code of ProtectRecord = %d"), + err); + } + + CleanupStack::PopAndDestroy(apView); + } + + _DBG_FILE("CNSmlInternetAdapter::DoProtectIAPRecordL(): END"); + return err; + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::IsProxyRecordLockedL(TUint32 aRecord) +//check for proxy record lock status +//---------------------------------------------------------------------- + +TBool CNSmlInternetAdapter::IsProxyRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): BEGIN"); + TBool ret = EFalse; + CCommsDbTableView* proxyView; + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::IsProxyRecordLockedL record being checked = %d"), + aRecord); + proxyView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), TPtrC( + COMMDB_ID), aRecord); + + TInt aAccess(0); + if (proxyView != NULL) + { + _DBG_FILE( + "CNSmlInternetAdapter::IsProxyRecordLockedL():wap record exists, check for access type"); + TInt err = (((CCommsDbProtectTableView*) proxyView)->GetRecordAccess( + aAccess)); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::IsProxyRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"), + err, aAccess); + CleanupStack::PopAndDestroy(proxyView); + if (aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect proxy record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord, + TBool aProtect) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): BEGIN"); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectProxyRecordL , record and protect value =%d = %d"), + aRecord, aProtect); + TInt err = KErrNone; + + CCommsDbTableView* proxyView; + proxyView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), TPtrC( + COMMDB_ID), aRecord); + if (proxyView != NULL) + { + _DBG_FILE( + "CNSmlInternetAdapter::DoProtectProxyRecordL(): wap record exists"); + if (!aProtect) + { + err = ((CCommsDbProtectTableView*) proxyView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of Unprotectrecord = %d"), + err); + } + + else + { + err = ((CCommsDbProtectTableView*) proxyView)->ProtectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of ProtectRecord = %d"), + err); + } + + CleanupStack::PopAndDestroy(proxyView); + } + + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): END"); + return err; + } + +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::IsServiceRecordLockedL(TUint32 aRecord) +//check for proxy record lock status +//---------------------------------------------------------------------- + +TBool CNSmlInternetAdapter::IsServiceRecordLockedL(TUint32 aRecord) + { + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): BEGIN"); + TBool ret = EFalse; + CCommsDbTableView* serviceView; + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::IsProxyRecordLockedL record being checked = %d"), + aRecord); + serviceView = iDatabase->OpenViewMatchingUintLC(iProxyServiceType, TPtrC( + COMMDB_ID), aRecord); + + TInt aAccess(0); + if (serviceView != NULL) + { + _DBG_FILE( + "CNSmlInternetAdapter::IsProxyRecordLockedL():wap record exists, check for access type"); + TInt err = + (((CCommsDbProtectTableView*) serviceView)->GetRecordAccess( + aAccess)); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::IsProxyRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"), + err, aAccess); + CleanupStack::PopAndDestroy(serviceView); + if (aAccess == RDbRowSet::EReadOnly) + ret = ETrue; + } + + _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): END"); + return ret; + + } +//---------------------------------------------------------------------- +//TBool CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect) +// protect or unprotect proxy record of access point being altered +//---------------------------------------------------------------------- + + +TInt CNSmlInternetAdapter::DoProtectServiceRecordL(TUint32 aRecord, + TBool aProtect) + { + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): BEGIN"); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectProxyRecordL , record and protect value =%d = %d"), + aRecord, aProtect); + TInt err = KErrNone; + + CCommsDbTableView* serviceView; + serviceView = iDatabase->OpenViewMatchingUintLC(iProxyServiceType, TPtrC( + COMMDB_ID), aRecord); + if (serviceView != NULL) + { + _DBG_FILE( + "CNSmlInternetAdapter::DoProtectProxyRecordL(): wap record exists"); + if (!aProtect) + { + err + = ((CCommsDbProtectTableView*) serviceView)->UnprotectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of Unprotectrecord = %d"), + err); + } + + else + { + err = ((CCommsDbProtectTableView*) serviceView)->ProtectRecord(); + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of ProtectRecord = %d"), + err); + } + + CleanupStack::PopAndDestroy(serviceView); + } + + _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): END"); + return err; + } +//-------------------------------------------------------------------- +//TInt CNSmlInternetAdapter::IsAPUriFormatMatchPredefined(const TDesC8 & aURI) +// +//------------------------------------------------------------------- + + +TBool CNSmlInternetAdapter::IsAPUriFormatMatchPredefined(const TDesC8 & aURI) + { + if (aURI.Match(_L8("AP/APId*")) != KErrNotFound || aURI.Match(_L8( + "AP/APId*/NAPDef/NAPId*")) != KErrNotFound) + { + return ETrue; + } + else + { + return EFalse; + } + + } +//-------------------------------------------------------------------- +//TInt CNSmlInternetAdapter::ConstructTreeL(const TDesC8& aURI) +// +//------------------------------------------------------------------- + + +TUint32 CNSmlInternetAdapter::ConstructTreeL(const TDesC8& aURI) + { + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): AP begin"); + TUint32 returnLuid = 0; // IAP doesn't exist + + CCommsDbTableView* apView = iDatabase->OpenTableLC(TPtrC(IAP)); + + TInt errorCode = apView->GotoFirstRecord(); + + while (errorCode == KErrNone) + { + TUint32 lValue; + TBool validService = EFalse; + apView->ReadUintL(TPtrC(COMMDB_ID), lValue); + + TBuf serviceType; + apView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + TUint32 bearerId = 0; + apView->ReadUintL(TPtrC(IAP_BEARER), bearerId); + // + // Skip other service types than GSM outgoing + // + if (serviceType == TPtrC(OUTGOING_GPRS) || serviceType == TPtrC( + INCOMING_GPRS)) + { + validService = ETrue; + } + + else if (serviceType == TPtrC(LAN_SERVICE) && bearerId > 0) + { + validService = ETrue; + } + else if (serviceType == TPtrC(VPN_SERVICE)) + { + validService = ETrue; + } + + if (validService) + { + // Skip others + // + // Check if in aPreviousURISegmentList + // + TBool skipToNextIAP = EFalse; + // KNSmlDMStart includes start text for URISeg + TBuf8<20> addAPURI; // AP/APIdnnn , nnn = profileid + addAPURI.Append(_L8("AP/APId")); + addAPURI.AppendNumFixedWidth(lValue, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, lValue); + + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addAPURI); + CleanupStack::PushL(mapInfo); + if (mapInfo->Length() == 0) + { + iCallBack->SetMappingL(addAPURI, addLUID); + if (aURI.Find(addAPURI) >= 0) + { + returnLuid = lValue; + iPrevLUID = lValue; + } + } + else + { + skipToNextIAP = ETrue; + } + CleanupStack::PopAndDestroy(mapInfo); + + if (!skipToNextIAP) + { + // Add the NAPDef also + + TBuf serviceType; + TUint32 serviceId(NULL); + + CCommsDbTableView* napdefView = + iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC( + COMMDB_ID), lValue); + + errorCode = napdefView->GotoFirstRecord(); + if (errorCode == KErrNone) + { + napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), + serviceType); + napdefView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); // ID + } + + CCommsDbTableView* tableView = + iDatabase->OpenViewMatchingUintLC(serviceType, TPtrC( + COMMDB_ID), serviceId); + + errorCode = tableView->GotoFirstRecord(); + + while (errorCode == KErrNone) + { + TUint32 lValue; + tableView->ReadUintL(TPtrC(COMMDB_ID), lValue); + // + // Check if in aPreviousURISegmentList + // + + _LIT8(Kprev, "NAPId"); + TBuf8<15> addNAME(Kprev); // APIdnnn , nnn = profileid + addNAME.AppendNumFixedWidth(lValue, EDecimal, 3); + + _LIT8(Kprev2, "/NAPDef/NAPId"); + TBuf8<80> addURI; // AP/xxx/NAPDef/NAPIdnnn , nnn = id nbr + addURI.Append(addAPURI); + addURI.Append(Kprev2); + addURI.AppendNumFixedWidth(lValue, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, lValue); + + HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI); + CleanupStack::PushL(mapInfo); + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addURI, addLUID); + if (aURI.Find(addURI) >= 0) + returnLuid = lValue; + _DBG_FILE( + "CNSmlInternetAdapter::ConstructTreeL(): Set NAPDef Mapping "); + + TBuf columnValue; + TBuf8<16> addDNSLUID; + TBuf8<80> addDNSURI; // AP/xxx/NAPDef/DNSAddr/DNSx + _LIT8(KFormat, "%d"); + tableView->ReadTextL(TPtrC(SERVICE_IP_NAME_SERVER1), + columnValue); + + if ((columnValue.Length() > 0)) + { + _LIT8(Kprev2, "/DNSAddr/DNS1"); + addDNSURI.Append(addURI); + addDNSURI.Append(Kprev2); + addLUID.Format(KFormat, DnsToLuid( + UriUtils::EIPv4Host, 1)); + iCallBack->SetMappingL(addDNSURI, addLUID); + if (aURI.Find(addDNSURI) >= 0) + returnLuid + = DnsToLuid(UriUtils::EIPv4Host, 1); + addDNSURI.Zero(); + } + + tableView->ReadTextL(TPtrC(SERVICE_IP_NAME_SERVER2), + columnValue); + if (columnValue.Length() > 0) + { + _LIT8(Kprev2, "/DNSAddr/DNS2"); + addDNSURI.Append(addURI); + addDNSURI.Append(Kprev2); + addLUID.Format(KFormat, DnsToLuid( + UriUtils::EIPv4Host, 2)); + iCallBack->SetMappingL(addDNSURI, addLUID); + if (aURI.Find(addDNSURI) >= 0) + returnLuid + = DnsToLuid(UriUtils::EIPv4Host, 2); + addDNSURI.Zero(); + } + + tableView->ReadTextL(TPtrC(SERVICE_IP6_NAME_SERVER1), + columnValue); + if (columnValue.Length() > 0) + { + _LIT8(Kprev2, "/DNSAddr/DNS3"); + addDNSURI.Append(addURI); + addDNSURI.Append(Kprev2); + addLUID.Format(KFormat, DnsToLuid( + UriUtils::EIPv6Host, 1)); + iCallBack->SetMappingL(addDNSURI, addLUID); + if (aURI.Find(addDNSURI) >= 0) + returnLuid + = DnsToLuid(UriUtils::EIPv6Host, 1); + addDNSURI.Zero(); + } + tableView->ReadTextL(TPtrC(SERVICE_IP6_NAME_SERVER2), + columnValue); + if (columnValue.Length() > 0) + { + _LIT8(Kprev2, "/DNSAddr/DNS4"); + addDNSURI.Append(addURI); + addDNSURI.Append(Kprev2); + addLUID.Format(KFormat, DnsToLuid( + UriUtils::EIPv6Host, 2)); + iCallBack->SetMappingL(addDNSURI, addLUID); + if (aURI.Find(addDNSURI) >= 0) + returnLuid + = DnsToLuid(UriUtils::EIPv6Host, 2); + addDNSURI.Zero(); + } + _DBG_FILE( + "CNSmlInternetAdapter::ConstructTreeL(): Set DNS Mapping "); + + TUint32 nwID = 0; + napdefView->ReadUintL(TPtrC(IAP_NETWORK), nwID); // Networks luid + + CCommsDbTableView* nwView = + iDatabase->OpenViewMatchingUintLC(TPtrC( + NETWORK), TPtrC(COMMDB_ID), nwID); + + errorCode = nwView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + _LIT8(Kprev2, "/Networks/NwId"); + TBuf8<80> addNwURI; // AP/xxx/NAPDef/xxx/Networks/NwIdnnn , nnn = id nbr + addNwURI.Append(addURI); + addNwURI.Append(Kprev2); + addNwURI.AppendNumFixedWidth(nwID, EDecimal, 3); + TBuf8<16> addNwLUID; + _LIT8(KFormat, "%d"); + addNwLUID.Format(KFormat, nwID); + HBufC8* mapInfo = iCallBack->GetLuidAllocL( + addNwURI); + CleanupStack::PushL(mapInfo); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addNwURI, addNwLUID); + if (aURI.Find(addNwURI) >= 0) + returnLuid = nwID; + _DBG_FILE( + "CNSmlInternetAdapter::ConstructTreeL(): Set Networks Mapping "); + } + CleanupStack::PopAndDestroy(mapInfo); + } + CleanupStack::PopAndDestroy(); // nwView + + if (iWlanSupported) + { + // Check WLAN node + if (serviceType == TPtrC(LAN_SERVICE)) + { + TUint32 wlanID = serviceId; + _LIT8(Kprev2, "/WLAN/WLId"); + TBuf8<80> addWlanURI; // AP/xxx/NAPDef/xxx/WLAN/WLIdnnn , nnn = id nbr + addWlanURI.Append(addURI); + addWlanURI.Append(Kprev2); + addWlanURI.AppendNumFixedWidth(wlanID, + EDecimal, 3); + TBuf8<16> addWlanLUID; + _LIT8(KFormat, "%d"); + addWlanLUID.Format(KFormat, wlanID); + HBufC8* mapInfo = iCallBack->GetLuidAllocL( + addWlanURI); + CleanupStack::PushL(mapInfo); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addWlanURI, + addWlanLUID); + if (aURI.Find(addWlanURI) >= 0) + returnLuid = wlanID; + _DBG_FILE( + "CNSmlInternetAdapter::ConstructTreeL(): Set WLAN Mapping "); + + TBuf value; + TBuf8<16> addWkLUID; + TBuf8<80> addWkURI; // AP/xxx/NAPDef/xxx/WLAN/xxx/WEPKey/WKIdn, n = id nbr + + for (TInt value = 1; value <= 4; value++) + { + _LIT8(Kprev2, "/WEPKey/WKId"); + addWkURI.Append(addWlanURI); + addWkURI.Append(Kprev2); + addWkURI.AppendNumFixedWidth(value, + EDecimal, 1); + _LIT8(KFormat, "%d"); + addWkLUID.Format(KFormat, (1000 + * value) + value); + iCallBack->SetMappingL(addWkURI, + addWkLUID); + if (aURI.Find(addWkURI) >= 0) + returnLuid = (1000 * value) + + value; + addWkURI.Zero(); + } + } + CleanupStack::PopAndDestroy(mapInfo); + } + } + + //Check Bearer node + + CCommsDbTableView* bView = + iDatabase->OpenViewMatchingUintLC(TPtrC( + NETWORK), TPtrC(COMMDB_ID), lValue); + errorCode = bView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + _LIT8(Kprev2, "/Bearer/BId"); + TBuf8<80> addbURI; // AP/xxx/NAPDef/xxx/Bearer/BIdnnn , nnn = id nbr + addbURI.Append(addURI); + addbURI.Append(Kprev2); + addbURI.AppendNumFixedWidth(lValue, EDecimal, 3); + TBuf8<16> addbLUID; + _LIT8(KFormat, "%d"); + addbLUID.Format(KFormat, lValue); + HBufC8* mapInfo = iCallBack->GetLuidAllocL( + addbURI); + CleanupStack::PushL(mapInfo); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addbURI, addbLUID); + if (aURI.Find(addbURI) >= 0) + returnLuid = lValue; + _DBG_FILE( + "CNSmlInternetAdapter::ConstructTreeL(): Set Bearer Mapping "); + } + CleanupStack::PopAndDestroy(mapInfo); + } + CleanupStack::PopAndDestroy(); // bView + + //Check NAPAuthInf node NAPAuthInf/AUId + + CCommsDbTableView* authView = + iDatabase->OpenViewMatchingUintLC(TPtrC( + NETWORK), TPtrC(COMMDB_ID), lValue); + + errorCode = authView->GotoFirstRecord(); + + if (errorCode == KErrNone) + { + _LIT8(Kprev2, "/Bearer/BId"); + TBuf8<80> addauthURI; // AP/xxx/NAPDef/xxx/Bearer/BIdnnn , nnn = id nbr + addauthURI.Append(addURI); + addauthURI.Append(Kprev2); + addauthURI.AppendNumFixedWidth(lValue, EDecimal, + 3); + TBuf8<16> addauthLUID; + _LIT8(KFormat, "%d"); + addauthLUID.Format(KFormat, lValue); + HBufC8* mapInfo = iCallBack->GetLuidAllocL( + addauthURI); + CleanupStack::PushL(mapInfo); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addauthURI, + addauthLUID); + if (aURI.Find(addauthURI) >= 0) + returnLuid = lValue; + _DBG_FILE( + "CNSmlInternetAdapter::ConstructTreeL(): Set NAPAuthInf Mapping "); + } + CleanupStack::PopAndDestroy(mapInfo); + } + CleanupStack::PopAndDestroy(); // authView + + //Check Proxy node + + CCommsDbTableView* pxView = + iDatabase->OpenViewMatchingTextLC(TPtrC( + PROXIES), TPtrC(PROXY_SERVICE_TYPE), + serviceType); + + errorCode = pxView->GotoFirstRecord(); + if (errorCode == KErrNone) + { + while (errorCode == KErrNone) + { + TUint32 lProxyIspId; + TUint32 lProxyId; + pxView->ReadUintL(TPtrC(PROXY_ISP), + lProxyIspId); + if (lProxyIspId == serviceId) //ServiceIsp) // Right value ISP + { + pxView->ReadUintL(TPtrC(COMMDB_ID), + lProxyId); + + _LIT8(Kprev2, "/Px/PXId"); + TBuf8<80> addURI; // AP/xxx/Px/PXIdnnn , nnn = id nbr + addURI.Append(addAPURI); + addURI.Append(Kprev2); + addURI.AppendNumFixedWidth(lProxyId, + EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, + KNSmlApProxyLowerBase + lProxyId); // 100000 + lProxyId + HBufC8* mapInfo = + iCallBack->GetLuidAllocL(addURI); + CleanupStack::PushL(mapInfo); + + if (mapInfo->Length() == 0) + { + // Also added to mapping + iCallBack->SetMappingL(addURI, + addLUID); + if (aURI.Find(addURI) >= 0) + returnLuid + = KNSmlApProxyLowerBase + + lProxyId; + _DBG_FILE( + "CNSmlInternetAdapter::ConstructTreeL(): Set Proxy Mapping "); + _LIT8(KProxy, "/Port/PROXY"); + TBuf8<80> addPortURI; // AP/xxx/Px/Port/PROXY + addPortURI.Append(addURI); + addPortURI.Append(KProxy); + TBuf8<16> addPortLUID; + _LIT8(KFormat, "%d"); + addPortLUID.Format(KFormat, 1); + iCallBack->SetMappingL(addPortURI, + addPortLUID); + if (aURI.Find(addPortURI) >= 0) + returnLuid = 1; + } + CleanupStack::PopAndDestroy(mapInfo); + } + errorCode = pxView->GotoNextRecord(); + } + } + CleanupStack::PopAndDestroy();//Pxview + } + CleanupStack::PopAndDestroy(mapInfo); + errorCode = tableView->GotoNextRecord(); + } + CleanupStack::PopAndDestroy();//tableview + CleanupStack::PopAndDestroy();//napdefview + } + } + errorCode = apView->GotoNextRecord(); + } + CleanupStack::PopAndDestroy(); // apView + _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): AP end"); + return returnLuid; + } +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/src/NSmlInternetAdapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/src/NSmlInternetAdapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,45 @@ +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: Internet-settings resources +* +*/ + + + + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x101F6DEA; //The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F6DE2; // DM Internet Adapter + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/src/NSmlWLanAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/src/NSmlWLanAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,4379 @@ +/* + * Copyright (c) 2002-2006 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: Wlan Adapter + * + */ + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "NSmlWLanAdapter.h" +#include "NSmlWlanSettings.h" +#include "nsmldebug.h" +#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 TInt KMaxBuf = 255; +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::NewL( ) +//----------------------------------------------------------------------------- +CNSmlWLanAdapter* CNSmlWLanAdapter::NewL(MSmlDmCallback* aDmCallback, + CCommsDatabase& aDatabase) + { + _DBG_FILE("CNSmlWLanAdapter::NewL(): begin"); + + CNSmlWLanAdapter* self = NewLC(aDmCallback, aDatabase); + CleanupStack::Pop(self); + + _DBG_FILE("CNSmlWLanAdapter::NewL(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::NewLC( ) +//----------------------------------------------------------------------------- +CNSmlWLanAdapter* CNSmlWLanAdapter::NewLC(MSmlDmCallback* aDmCallback, + CCommsDatabase& aDatabase) + { + _DBG_FILE("CNSmlWLanAdapter::NewLC(): begin"); + + CNSmlWLanAdapter* self = new (ELeave) CNSmlWLanAdapter(aDmCallback, + aDatabase); + CleanupStack::PushL(self); + + self->iCallBack = aDmCallback; + self->ConstructL(aDatabase); + + _DBG_FILE("CNSmlWLanAdapter::NewLC(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// void CNSmlWLanAdapter::ConstructL( ) +// Second phase constructor +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::ConstructL(CCommsDatabase& aDatabase) + { + _DBG_FILE("CNSmlWLanAdapter::ConstructL(): begin"); + + iWlanSettings = CWlanSettings::NewL(aDatabase); + iBuffer = new (ELeave) CArrayFixFlat ( + KNSmlWepKeyGranularity); + iSettings = new (ELeave) TWlanSettings; + iEAPSettings = new (ELeave) EAPSettings; + + _DBG_FILE("CNSmlWLanAdapter::ConstructL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter::CNSmlWLanAdapter( ) +// Constructor +//----------------------------------------------------------------------------- +CNSmlWLanAdapter::CNSmlWLanAdapter(TAny* aEcomArguments, + CCommsDatabase& aDatabase) : + CSmlDmAdapter(aEcomArguments), iDatabase(aDatabase) + { + _DBG_FILE("CNSmlWLanAdapter::CNSmlWLanAdapter(): begin"); + _DBG_FILE("CNSmlWLanAdapter::CNSmlWLanAdapter(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter::~CNSmlWLanAdapter( ) +// Destructor +//----------------------------------------------------------------------------- +CNSmlWLanAdapter::~CNSmlWLanAdapter() + { + _DBG_FILE("CNSmlWLanAdapter::~CNSmlWLanAdapter(): begin"); + + if (iBuffer) + { + + for (TInt index = 0; index < iBuffer->Count(); index++) + { + delete iBuffer->At(index).iUri; + delete iBuffer->At(index).iData; + + iBuffer->Delete(index); + } + + iBuffer->Reset(); + delete iBuffer; + + } + delete iWlanSettings; + delete iSettings; + + TRAP_IGNORE(DeleteEAPStructL()); + + for (TInt i = 0; i < iEAPBuffer.Count(); i++) + { + iEAPBuffer[i]->iStatusRefArray.Close(); + iEAPBuffer[i]->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Close(); + iEAPBuffer[i]->iEAPSettings->iDisabledEncapsulatedEAPExpandedTypes.Close(); + iEAPBuffer[i]->iEAPSettings->iCipherSuites.Close(); + delete iEAPBuffer[i]->iEAPSettings; + iEAPBuffer[i]->iEAPSettings = NULL; + } + iEAPBuffer.ResetAndDestroy(); + + TInt count = iSecondaryBuffer.Count(); + for (TInt index = 0; index < count; index++) + { + delete iSecondaryBuffer[index]; + } + + iSecondaryBuffer.Reset(); + + _DBG_FILE("CNSmlWLanAdapter::~CNSmlWLanAdapter(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::DDFVersionL( CBufBase& aDDFVersion ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + _DBG_FILE("CNSmlWLanAdapter::DDFVersionL(): begin"); + + aDDFVersion.InsertL(0, KNSmlWLanAdapterDDFversion); + + _DBG_FILE("CNSmlWLanAdapter::DDFVersionL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::DDFStructureL(MSmlDmDDFObject& aDDF) + { + _DBG_FILE("CNSmlWLanAdapter::DDFStructureL(): begin"); + + TSmlDmAccessTypes *aclTypes = new (ELeave) TSmlDmAccessTypes(); + CleanupStack::PushL(aclTypes); + // + // Set Get as acceptable operations + // + aclTypes->SetGet(); + aclTypes->SetAdd(); // 041208 Added + aclTypes->SetDelete(); + aclTypes->SetReplace(); + + TSmlDmAccessTypes accessTypesAll; + accessTypesAll.SetGet(); + accessTypesAll.SetDelete(); + accessTypesAll.SetAdd(); + accessTypesAll.SetReplace(); + + TSmlDmAccessTypes accessTypesNoDelete; + accessTypesNoDelete.SetGet(); + accessTypesNoDelete.SetAdd(); + accessTypesNoDelete.SetReplace(); + + TSmlDmAccessTypes accessTypesGetAdd; + accessTypesGetAdd.SetGet(); + accessTypesGetAdd.SetAdd(); + + TSmlDmAccessTypes accessTypesGetAddDel; + accessTypesGetAddDel.SetGet(); + accessTypesGetAddDel.SetAdd(); + accessTypesGetAddDel.SetDelete(); + //WLAN + MSmlDmDDFObject& rootNode = aDDF.AddChildObjectL(KNSmlWLanNodeName); + FillNodeInfoL(rootNode, accessTypesGetAdd, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN/ + MSmlDmDDFObject& wlanNode = rootNode.AddChildObjectGroupL(); + FillNodeInfoL(wlanNode, accessTypesGetAddDel, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//SSID + MSmlDmDDFObject& ssid = wlanNode.AddChildObjectL(KNSmlWLanSsid); + FillNodeInfoL(ssid, accessTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//UsedSSID + MSmlDmDDFObject& usedSsid = wlanNode.AddChildObjectL(KNSmlWLanUsedSsid); + FillNodeInfoL(usedSsid, accessTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//SSIDHidden + MSmlDmDDFObject& ssidHidden = wlanNode.AddChildObjectL( + KNSmlWLanSsidHidden); + FillNodeInfoL(ssidHidden, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlEmpty); + + //WLAN//NetworkMode + MSmlDmDDFObject& networkMode = wlanNode.AddChildObjectL( + KNSmlWLanNetworkMode); + FillNodeInfoL(networkMode, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//SecurityMode + MSmlDmDDFObject& securityMode = wlanNode.AddChildObjectL( + KNSmlWLanSecurityMode); + FillNodeInfoL(securityMode, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//UseWPAPSK + MSmlDmDDFObject& useWPAPSK = wlanNode.AddChildObjectL(KNSmlWLanUseWPAPSK); + FillNodeInfoL(useWPAPSK, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlEmpty); + + //WLAN//WPAPreSharedKey + MSmlDmDDFObject& wpaPreSharedKey = wlanNode.AddChildObjectL( + KNSmlWLanWpaPreSharedKey); + FillNodeInfoL(wpaPreSharedKey, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBin, KNSmlEmpty); + + //WLAN//WLANEAPList + MSmlDmDDFObject& wlanEapList = wlanNode.AddChildObjectL(KNSmlWLanEapList); + FillNodeInfoL(wlanEapList, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//WEPKeyIndex + MSmlDmDDFObject& wepKeyIndex = + wlanNode.AddChildObjectL(KNSmlWLanWepIndex); + FillNodeInfoL(wepKeyIndex, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, KNSmlEmpty); + + //WLAN//WEPAuthMode + MSmlDmDDFObject& wlanWepAuthMode = wlanNode.AddChildObjectL( + KNSmlWLanAuthMode); + FillNodeInfoL(wlanWepAuthMode, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EInt, KNSmlEmpty); + + //WLAN//WEPKey/ + MSmlDmDDFObject& wepKeyRoot = wlanNode.AddChildObjectL(KNSmlWLanWepKey); + FillNodeInfoL(wepKeyRoot, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//WEPKey/ + MSmlDmDDFObject& wepKey = wepKeyRoot.AddChildObjectGroupL(); + FillNodeInfoL(wepKey, accessTypesGetAdd, MSmlDmDDFObject::EOneOrN, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//WEPKey//WEPKeyID + MSmlDmDDFObject& wepKeyId = wepKey.AddChildObjectL(KNSmlWLanWepKeyId); + FillNodeInfoL(wepKeyId, accessTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, KNSmlEmpty); + + //WLAN//WEPKey//Data + MSmlDmDDFObject& data = wepKey.AddChildObjectL(KNSmlWLanWepKeyData); + FillNodeInfoL(data, accessTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EBin, KNSmlEmpty); + + //WLAN//SecondarySSID/ + MSmlDmDDFObject& secondarySSidRoot = wlanNode.AddChildObjectL( + KNSmlWLanSecSsid); + FillNodeInfoL(secondarySSidRoot, accessTypesGetAdd, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//SecondarySSID/ + MSmlDmDDFObject& secondarySSid = secondarySSidRoot.AddChildObjectGroupL(); + FillNodeInfoL(secondarySSid, accessTypesGetAddDel, + MSmlDmDDFObject::EOneOrN, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//SecondarySSID//SSID + MSmlDmDDFObject& secSsidId = secondarySSid.AddChildObjectL(KNSmlWLanSsid); + FillNodeInfoL(secSsidId, accessTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//SecondarySSID//UsedSSID + MSmlDmDDFObject& secUsedSsidId = secondarySSid.AddChildObjectL( + KNSmlWLanUsedSsid); + FillNodeInfoL(secUsedSsidId, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP/ + MSmlDmDDFObject& eapRoot = wlanNode.AddChildObjectL(KNSmlWLanEap); + FillNodeInfoL(eapRoot, accessTypesGetAdd, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//EAP/ + MSmlDmDDFObject& eap = eapRoot.AddChildObjectGroupL(); + FillNodeInfoL(eap, accessTypesGetAdd, MSmlDmDDFObject::EOneOrN, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//EAP//EAPType + MSmlDmDDFObject& eapType = eap.AddChildObjectL(KNSmlWLanEapType); + FillNodeInfoL(eapType, accessTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//Username + MSmlDmDDFObject& eapUsername = eap.AddChildObjectL(KNSmlWLanUsername); + FillNodeInfoL(eapUsername, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//Password + MSmlDmDDFObject& eapPassword = eap.AddChildObjectL(KNSmlWLanPassword); + FillNodeInfoL(eapPassword, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//Realm + MSmlDmDDFObject& eapRealm = eap.AddChildObjectL(KNSmlWLanRealm); + FillNodeInfoL(eapRealm, accessTypesNoDelete, MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//UsePseudonym + MSmlDmDDFObject& eapPseudo = eap.AddChildObjectL(KNSmlWLanUsePseudonym); + FillNodeInfoL(eapPseudo, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlEmpty); + + //WLAN//EAP//Encapsulation + // Encapsulation is not supported using this parameter. It is done + // with */EAP/EAPIdxxx-yyy/* where xxx is the encapsulated and yyy the encapsulating method. + /*MSmlDmDDFObject& eapEncapsulation = eap.AddChildObjectL( KNSmlWLanEncapsulation ); + FillNodeInfoL( eapEncapsulation, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); */ + + //WLAN//EAP//VerifyCertRealm + MSmlDmDDFObject& eapVerifyCertRealm = eap.AddChildObjectL( + KNSmlWLanVerifyCertRealm); + FillNodeInfoL(eapVerifyCertRealm, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlEmpty); + + //WLAN//EAP//RequireClientAuthentication + MSmlDmDDFObject& eapRequireClientAuthentication = eap.AddChildObjectL( + KNSmlWLanRequireClientAuthentication); + FillNodeInfoL(eapRequireClientAuthentication, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlEmpty); + + //WLAN//EAP//SessionValidityTime + MSmlDmDDFObject& eapSessionValidityTime = eap.AddChildObjectL( + KNSmlWLanSessionValidityTime); + FillNodeInfoL(eapSessionValidityTime, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//CipherSuite + MSmlDmDDFObject& eapCipherSuite = eap.AddChildObjectL( + KNSmlWLanCipherSuite); + FillNodeInfoL(eapCipherSuite, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//AllowPEAPv0 + MSmlDmDDFObject& eapAllowPEAPv0 = eap.AddChildObjectL( + KNSmlWLanAllowPEAPv0); + FillNodeInfoL(eapAllowPEAPv0, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlEmpty); + + //WLAN//EAP//AllowPEAPv1 + MSmlDmDDFObject& eapAllowPEAPv1 = eap.AddChildObjectL( + KNSmlWLanAllowPEAPv1); + FillNodeInfoL(eapAllowPEAPv1, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlEmpty); + + //WLAN//EAP//AllowPEAPv2 + MSmlDmDDFObject& eapAllowPEAPv2 = eap.AddChildObjectL( + KNSmlWLanAllowPEAPv2); + FillNodeInfoL(eapAllowPEAPv2, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, KNSmlEmpty); + +#ifdef FF_WLAN_EXTENSIONS + + //WLAN//EAP//AuthProvModeAllowed + MSmlDmDDFObject& authProvMode = eap.AddChildObjectL( KNSmlWLanAuthProvMode ); + FillNodeInfoL( authProvMode, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//UnauthProvModeAllowed + MSmlDmDDFObject& unauthProvMode = eap.AddChildObjectL( KNSmlWLanUnauthProvMode ); + FillNodeInfoL( unauthProvMode, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//PACGroupReference + MSmlDmDDFObject& pacGroupRef = eap.AddChildObjectL( KNSmlWLanPACGroupRef ); + FillNodeInfoL( pacGroupRef, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, + KNSmlEmpty ); + + //WLAN//EAP//WarnADHPNoPAC + MSmlDmDDFObject& warnADHPNoPAC = eap.AddChildObjectL( KNSmlWLanWarnADHPNoPAC ); + FillNodeInfoL( warnADHPNoPAC, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//WarnADHPNoMatchingPAC + MSmlDmDDFObject& warnADHPNoMatchingPAC = eap.AddChildObjectL( KNSmlWLanWarnADHPNoMatchPAC ); + FillNodeInfoL( warnADHPNoMatchingPAC, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + + //WLAN//EAP//WarnNotDefaultServer + MSmlDmDDFObject& warnNoDefServ = eap.AddChildObjectL( KNSmlWLanWarnNotDefaultSrv ); + FillNodeInfoL( warnNoDefServ, + accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, + MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EBool, + KNSmlEmpty ); + +#endif + + //WLAN//EAP//Certificate + MSmlDmDDFObject& eapCertificateRoot = eap.AddChildObjectL( + KNSmlWLanCertificate); + FillNodeInfoL(eapCertificateRoot, accessTypesGetAdd, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//EAP//Certificate/ + MSmlDmDDFObject& eapCertificate = + eapCertificateRoot.AddChildObjectGroupL(); + FillNodeInfoL(eapCertificate, accessTypesGetAdd, + MSmlDmDDFObject::EOneOrMore, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::ENode, KNSmlEmpty); + + //WLAN//EAP//Certificate//IssuerName + MSmlDmDDFObject& eapIssuerName = eapCertificate.AddChildObjectL( + KNSmlWLanIssuerName); + FillNodeInfoL(eapIssuerName, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//Certificate//SubjectName + MSmlDmDDFObject& eapSubjectName = eapCertificate.AddChildObjectL( + KNSmlWLanSubjectName); + FillNodeInfoL(eapSubjectName, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//Certificate//CertType + MSmlDmDDFObject& eapCertType = eapCertificate.AddChildObjectL( + KNSmlWLanCertType); + FillNodeInfoL(eapCertType, accessTypesNoDelete, MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//Certificate//SerialNumber + MSmlDmDDFObject& eapSerialNumber = eapCertificate.AddChildObjectL( + KNSmlWLanSerialNumber); + FillNodeInfoL(eapSerialNumber, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//Certificate//SubjectKeyId + MSmlDmDDFObject& eapSubjectKeyId = eapCertificate.AddChildObjectL( + KNSmlWLanSubjectKeyId); + FillNodeInfoL(eapSubjectKeyId, accessTypesNoDelete, + MSmlDmDDFObject::EOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + //WLAN//EAP//Certificate//Fingerprint + MSmlDmDDFObject& eapFingerprint = eapCertificate.AddChildObjectL( + KNSmlWLanFingerprint); + FillNodeInfoL(eapFingerprint, accessTypesNoDelete, + MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic, + MSmlDmDDFObject::EChr, KNSmlEmpty); + + CleanupStack::PopAndDestroy(); //aclTypes + + _DBG_FILE("CNSmlWLanAdapter::DDFStructureL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::AddLeafObjectL( const TDesC& aURI,const +// TDesC& aParentLUID, const TDesC8& aObject, const TDesC& aType, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::AddLeafObjectL(const TDesC8& aURI, + const TDesC8& aParentLUID, const TDesC8& aObject, + const TDesC8& /*aType*/, const TInt aStatusRef) + { + DBG_ARGS8(_S8("CNSmlWLanAdapter::AddLeafObjectL - <%S> <%S> <%S>"), + &aURI, &aParentLUID, &aObject); + + TInt uriSegs = NumOfUriSegs(aURI); + TInt luid = GetIdFromLuid(aParentLUID); + TInt err(KErrNone); + TPtrC8 lastUriSeg = GetLastUriSeg(aURI); + + TInt eapIndex(0); + + TInt eapId = GetEAPIdFromUri(aURI); + if (eapId == KErrNotFound) + { + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): Non-EAP setting."); + if (luid == KErrNotFound) + { + return; + } + err = iWlanSettings->GetWlanSettings(luid, *iSettings); + } + else + { + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): EAP setting."); + TInt encapsEapId = GetEncapsEAPIdFromUri(aURI); + if (encapsEapId == KErrNotFound) + { + _DBG_FILE( + "CNSmlWLanAdapter::AddLeafObjectL(): Does not have encapsulation id xx-xx."); + encapsEapId = EEapNone; + } + // append it to the appropriate list ('+' enabled, '-' disabled) + _LIT8(KPadding, "\xFE\0\0\0\0\0\0"); + _LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); + const TInt KPlainMsChapV2ImplUid = 99; + + TBuf8 cmpbuf; + if (eapId == KPlainMsChapV2ImplUid) + { + cmpbuf.Append(KMsChapV2Padding); + } + else + { + cmpbuf.Append(KPadding); + } + cmpbuf.Append(eapId); + TEapExpandedType expandedTypecmbuf(cmpbuf); + + TBuf8 encapscmpbuf; + if (encapsEapId == KPlainMsChapV2ImplUid) + { + encapscmpbuf.Append(KMsChapV2Padding); + } + else + { + encapscmpbuf.Append(KPadding); + } + encapscmpbuf.Append(encapsEapId); + TEapExpandedType expandedTypeencapscmbuf(encapscmpbuf); + + TInt i(0); + // This is EAP addition. Check if the buffer for this EAP already exists + for (i = 0; i < iEAPBuffer.Count(); i++) + { + if ((expandedTypecmbuf.Compare( + iEAPBuffer[i]->iEAPSettings->iEAPExpandedType) == 0) + && (expandedTypeencapscmbuf.Compare( + iEAPBuffer[i]->iEncapsulatingExpandedEapId) == 0)) + { + // The correct buffer was found. + _DBG_FILE( + "CNSmlWLanAdapter::AddLeafObjectL(): Found existing buffer."); + eapIndex = i; + break; + } + } + if (i == iEAPBuffer.Count()) + { + DBG_ARGS8( + _S8( + "CNSmlWLanAdapter::AddLeafObjectL(): No buffer found. Create new: <%d>-<%d>"), + eapId, encapsEapId); + // Buffer was not found. Create new. + TInt WLANServiceId = GetServiceIdFromUriL(aURI); + + if (WLANServiceId == KErrNotFound) + { + _DBG_FILE( + "CNSmlWLanAdapter::AddLeafObjectL(): Could not find WLAN service ID from URI."); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + + TNSmlEAPBufferElement* buffer = + new (ELeave) TNSmlEAPBufferElement; + CleanupStack::PushL(buffer); + + buffer->iEAPSettings = new (ELeave) EAPSettings; + CleanupStack::PushL(buffer->iEAPSettings); + + // append it to the appropriate list ('+' enabled, '-' disabled) + _LIT8(KPadding, "\xFE\0\0\0\0\0\0"); + _LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); + const TInt KPlainMsChapV2ImplUid = 99; + + TBuf8 tempbuf; + if (eapId == KPlainMsChapV2ImplUid) + { + tempbuf.Append(KMsChapV2Padding); + } + else + { + tempbuf.Append(KPadding); + } + tempbuf.Append(eapId); + + buffer->iEAPSettings->iEAPExpandedType = tempbuf; + buffer->iWLANServiceId = WLANServiceId; + TBuf8 encapsTempbuf; + if (encapsEapId == KPlainMsChapV2ImplUid) + { + encapsTempbuf.Append(KMsChapV2Padding); + } + else + { + encapsTempbuf.Append(KPadding); + } + encapsTempbuf.Append(encapsEapId); + + buffer->iEncapsulatingExpandedEapId = encapsTempbuf; + iEAPBuffer.AppendL(buffer); + + CleanupStack::Pop(buffer->iEAPSettings); + CleanupStack::Pop(buffer); + + eapIndex = iEAPBuffer.Count() - 1; + } + } + if (err != KErrNone) + { + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"), + err); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*/*")) + != KErrNotFound && uriSegs == 9) + { + TInt wepKeyId = GetWepKeyIdFromLuid(aParentLUID); + + if (wepKeyId != KErrNotFound) + { + if (lastUriSeg.Match(KNSmlWLanWepKeyData) != KErrNotFound) + { + switch (wepKeyId) + { + case 1: + iSettings->WepKey1 = aObject; + break; + case 2: + iSettings->WepKey2 = aObject; + break; + case 3: + iSettings->WepKey3 = aObject; + break; + case 4: + iSettings->WepKey4 = aObject; + break; + default: + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::ENotFound); + return; + } + } + else if (lastUriSeg.Match(KNSmlWLanWepKeyId) != KErrNotFound) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + return; + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + } + + else + { + TInt index = -1; + + for (TInt i = 0; i < iBuffer->Count(); i++) + { + if (aURI.Find(iBuffer->At(i).iUri->Des()) != KErrNotFound) + { + index = i; + break; + } + } + if (index < 0) + { + wepKeyId = GetWepKeyIdFromUri(aURI); + + TBuf8<80> addLUID; // AP//NapDef//WLAN//WEPKey/WKIdnnn + addLUID.AppendNum(wepKeyId); + addLUID.AppendNumFixedWidth(luid, EDecimal, 3); + + DBG_ARGS8( + _S8( + "WLanAdapter::AddleafObject - mapping uri: <%S> to luid: <%S>"), + &aURI, &addLUID); + DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID); + iCallBack->SetMappingL(aURI, addLUID); + if (lastUriSeg.Match(KNSmlWLanWepKeyData) != KErrNotFound) + { + switch (wepKeyId) + { + case 1: + iSettings->WepKey1 = aObject; + break; + case 2: + iSettings->WepKey2 = aObject; + break; + case 3: + iSettings->WepKey3 = aObject; + break; + case 4: + iSettings->WepKey4 = aObject; + break; + default: + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::ENotFound); + return; + } + } + else if (lastUriSeg.Match(KNSmlWLanWepKeyId) != KErrNotFound) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + return; + } + else + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::ENotFound); + return; + } + } + else + { + //Add WepKeyId and execute buffer + if (lastUriSeg.Match(KNSmlWLanWepKeyId) != KErrNotFound) + { + iBuffer->At(index).iWepKeyId = DesToInt(aObject); + iBuffer->At(index).iIdStatusRef = aStatusRef; + + // ExecuteBufferL( ); (JPLA-6M29NR caused error in WEPkey Data if buffer is executed here) + return; + } + + else if (lastUriSeg.Match(KNSmlWLanWepKeyData) + != KErrNotFound) + { + iBuffer->At(index).iData = aObject.AllocLC(); + iBuffer->At(index).iDataSet = ETrue; + CleanupStack::Pop(); //iBuffer->At(index).iData + iBuffer->At(index).iDataStatusRef = aStatusRef; + return; + } + else + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::ENotFound); + return; + } + } + } + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/*")) != KErrNotFound + && uriSegs == 7) + { + if (lastUriSeg.Compare(KNSmlWLanSsid) == 0) + { + TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iSettings->SSID, aObject); + DBG_ARGS(_S16("WLanAdapter::ssid convert: <%D>"), returnValue); + if (returnValue != KErrNone) + { + // setting the default value to the network name + iSettings->SSID = TPtrC(KNSmlWLanDefaultSSID); + DBG_ARGS( + _S16( + "CNSmlWLanAdapter::AddLeafObjectL SSID - ErrorCode <%D>"), + returnValue); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + } + + else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0) + { + TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iSettings->UsedSSID, aObject); + DBG_ARGS(_S16("WLanAdapter::usedSsid convert: <%D>"), returnValue); + } + + else if (lastUriSeg.Compare(KNSmlWLanSsidHidden) == 0) + { + if (aObject.MatchF(_L8("True")) != KErrNotFound) + { + iSettings->ScanSSID = 1; + } + else + { + iSettings->ScanSSID = 0; + } + } + + else if (lastUriSeg.Compare(KNSmlWLanNetworkMode) == 0) + { + if (aObject.MatchF(_L8("ADHOC")) != KErrNotFound) + { + iSettings->ConnectionMode = EAdhoc; + } + + else if (aObject.MatchF(_L8("Infrastructure")) != KErrNotFound) + { + iSettings->ConnectionMode = EInfrastructure; + } + else + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EInvalidObject); + return; + } + } + + else if (lastUriSeg.Compare(KNSmlWLanSecurityMode) == 0) + { + if (aObject.MatchF(_L8("NONE")) != KErrNotFound) + { + iSettings->SecurityMode = EAllowUnsecure; + } + else if (aObject.MatchF(_L8("WEP")) != KErrNotFound) + { + iSettings->SecurityMode = EWep; + } + else if (aObject.MatchF(_L8("8021X")) != KErrNotFound) + { + iSettings->SecurityMode = EWlan8021x; + } + else if (aObject.MatchF(_L8("WPA")) != KErrNotFound) + { + iSettings->SecurityMode = EWpa; + } + else if (aObject.MatchF(_L8("WPA2")) != KErrNotFound) + { + iSettings->SecurityMode = EWpa2; + } + else + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EInvalidObject); + return; + } + } + + else if (lastUriSeg.Compare(KNSmlWLanUseWPAPSK) == 0) + { + if (aObject.MatchF(_L8("True")) != KErrNotFound) + { + iSettings->UseWPAPSK = 1; + } + else + { + iSettings->UseWPAPSK = 0; + } + } + + else if (lastUriSeg.Compare(KNSmlWLanWpaPreSharedKey) == 0) + { + if (aObject.Length() > KMaxPSKLength) + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::ETooLargeObject); + return; + } + /*else if(aObject.Length() < KMinPSKLength) + { + iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + }*/ + else + { + iSettings->WPAPreSharedKey = aObject; + } + } + + else if (lastUriSeg.Compare(KNSmlWLanEapList) == 0) + { + TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iSettings->EapList, aObject); + DBG_ARGS(_S16("WLanAdapter::EapList convert: <%D>"), returnValue); + } + + else if (lastUriSeg.Compare(KNSmlWLanAuthMode) == 0) + { + if (aObject.MatchF(_L8("1")) != KErrNotFound) + { + iSettings->AuthMode = EShared; + } + else + { + iSettings->AuthMode = EOpen; + } + } + + else if (lastUriSeg.Compare(KNSmlWLanWepIndex) == 0) + { + TInt32 actualIndex = DesToInt(aObject); + if (actualIndex < 4 && actualIndex >= 0) + { + iSettings->WepIndex = actualIndex; + } + else + { + if (actualIndex > 3) + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::ETooLargeObject); + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + return; + } + } + + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*/*")) + != KErrNotFound && uriSegs == 9) + { + TSecondarySSID ssid; + ssid.Id = 0; + TUint32 id = GetSecSSIDFromUriL(aURI); + RArray secondaryList; + CleanupClosePushL(secondaryList); + iWlanSettings->GetSecondarySSIDListL(luid, secondaryList); + TInt count = secondaryList.Count(); + for (TInt i = 0; i < count; i++) + { + if (id == secondaryList[i].Id) + { + ssid = secondaryList[i]; + break; + } + } + CleanupStack::PopAndDestroy(&secondaryList); + if (ssid.Id == 0) + { + + _DBG_FILE("CNSmlWLanAdapter::Coming to check buffer "); + + //Check if its buffered here - Divya + TInt index = -1; + + for (TInt i = 0; i < iSecondaryBuffer.Count(); i++) + { + if (aURI.Find(iSecondaryBuffer[i]->iUri->Des()) + != KErrNotFound) + { + index = i; + _DBG_FILE("CNSmlWLanAdapter::one indexis matched :-)"); + break; + } + } + if (index < 0) + { + _DBG_FILE("CNSmlWLanAdapter::one indexis matched :-)"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + else + { + DBG_ARGS8( + _S8( + "CWlanadaptes::Execute Buffer - copying in buffer instead of giving 404 uri: object id : <%S>"), + &aObject); + + if (lastUriSeg.Compare(KNSmlWLanSsid) == 0) + { + if (aObject.Length() <= KMaxTextLength) + { + iSecondaryBuffer[index]->ScannedId.Copy(aObject); + } + else + { + _DBG_FILE( + "CNSmlWLanAdapter::AddLeafObject - SecondarySSID too long"); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EError); + return; + } + + } + else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0) + { + iSecondaryBuffer[index]->UsedId.Copy(aObject); + } + + } + + } + + else + { + + if (lastUriSeg.Compare(KNSmlWLanSsid) == 0) + { + ssid.ScannedId.Copy(aObject); + } + else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0) + { + ssid.UsedId.Copy(aObject); + } + TInt retval = iWlanSettings->WriteSecondarySSIDL(luid, ssid, + EFalse); + if (retval == KErrNone) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + } + } + } + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/*")) != KErrNotFound + && uriSegs == 9) + { + DBG_ARGS8(_S8("CNSmlWLanAdapter::AddLeafObjectL - EAP index: <%d>"), + eapIndex); + + if (lastUriSeg.Compare(KNSmlWLanEapType) == 0) + { + TInt eapid = GetEAPIdFromUri(aURI); + // append it to the appropriate list ('+' enabled, '-' disabled) + _LIT8(KPadding, "\xFE\0\0\0\0\0\0"); + _LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); + const TInt KPlainMsChapV2ImplUid = 99; + TBuf8 tempbuf; + if (eapid == KPlainMsChapV2ImplUid) + { + tempbuf.Append(KMsChapV2Padding); + } + else + { + tempbuf.Append(KPadding); + } + tempbuf.Append(eapid); + // Get EAP ID from URI instead of the value because the server gives the value + // incorrectly as the textual representation of the EAP method instead of the IANA number. + iEAPBuffer[eapIndex]->iEAPSettings->iEAPExpandedType = tempbuf; + } + else if (lastUriSeg.Compare(KNSmlWLanUsername) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iEAPBuffer[eapIndex]->iEAPSettings->iUsername, aObject); + if (retval == KErrNone) + { + iEAPBuffer[eapIndex]->iEAPSettings->iUsernamePresent = ETrue; + } + else + { + iEAPBuffer[eapIndex]->iEAPSettings->iUsername.Zero(); + DBG_ARGS( + _S16( + "CNSmlWLanAdapter::AddLeafObjectL EAP username - ErrorCode <%D>"), + retval); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + + } + else if (lastUriSeg.Compare(KNSmlWLanPassword) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iEAPBuffer[eapIndex]->iEAPSettings->iPassword, aObject); + if (retval == KErrNone) + { + iEAPBuffer[eapIndex]->iEAPSettings->iPasswordPresent = ETrue; + } + else + { + iEAPBuffer[eapIndex]->iEAPSettings->iPassword.Zero(); + DBG_ARGS( + _S16( + "CNSmlWLanAdapter::AddLeafObjectL EAP password - ErrorCode <%D>"), + retval); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + } + else if (lastUriSeg.Compare(KNSmlWLanRealm) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + iEAPBuffer[eapIndex]->iEAPSettings->iRealm, aObject); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iRealmPresent = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanUsePseudonym) == 0) + { + if ((aObject == KTrue) || (aObject == KTtrue)) + iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonyms = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonyms = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonymsPresent = ETrue; + } + else if (lastUriSeg.Compare(KNSmlWLanEncapsulation) == 0) + { + TBuf8 dummy; + //ConvertEAPStringToIds( aObject, dummy, iEAPBuffer[eapIndex]->iEncapsulatingExpandedEapId ); + } + else if (lastUriSeg.Compare(KNSmlWLanVerifyCertRealm) == 0) + { + if ((aObject == KTrue) || (aObject == KTtrue)) + iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealm + = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealm + = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealmPresent + = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanRequireClientAuthentication) + == 0) + { + if ((aObject == KTrue) || (aObject == KTtrue)) + iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthentication + = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthentication + = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthenticationPresent + = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanSessionValidityTime) == 0) + { + TLex8 lex(aObject); + TUint newVal; + TInt sesValErr = lex.Val(newVal); + // Check whether the conversion went ok + if (sesValErr == KErrNone) + { + iEAPBuffer[eapIndex]->iEAPSettings->iSessionValidityTime + = newVal; + iEAPBuffer[eapIndex]->iEAPSettings->iSessionValidityTimePresent + = ETrue; + } + else + { + // there were errors, let's leave the function and update status + DBG_ARGS( + _S16( + "CNSmlWLanAdapter::AddLeafObjectL SessionValidityTime - ErrorCode <%D>"), + sesValErr); + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EInvalidObject); + return; + } + } + else if (lastUriSeg.Compare(KNSmlWLanCipherSuite) == 0) + { + FillCipherSuitesL(aObject, eapIndex); + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv0) == 0) + { + if ((aObject == KTrue) || (aObject == KTtrue)) + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv0Allowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv0Allowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue; + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv1) == 0) + { + if ((aObject == KTrue) || (aObject == KTtrue)) + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv1Allowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv1Allowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue; + + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv2) == 0) + { + if ((aObject == KTrue) || (aObject == KTtrue)) + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv2Allowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv2Allowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue; + } + +#ifdef FF_WLAN_EXTENSIONS + else if (lastUriSeg.Compare(KNSmlWLanAuthProvMode) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowedPresent = ETrue; + } + + else if (lastUriSeg.Compare(KNSmlWLanUnauthProvMode) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowed = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowed = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowedPresent = ETrue; + } + + else if (lastUriSeg.Compare(KNSmlWLanPACGroupRef) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( iEAPBuffer[eapIndex]->iEAPSettings->iPACGroupReference, aObject ); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iPACGroupReferencePresent = ETrue; + + } + + else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoPAC) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPAC = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPAC = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPACPresent = ETrue; + } + + else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoMatchPAC) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPAC = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPAC = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPACPresent = ETrue; + } + + else if (lastUriSeg.Compare(KNSmlWLanWarnNotDefaultSrv) == 0) + { + if ( (aObject == KTrue) || (aObject == KTtrue) ) + iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServer = ETrue; + else + iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServer = EFalse; + + iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServerPresent = ETrue; + } + +#endif + + // Save the status reference + iEAPBuffer[eapIndex]->iStatusRefArray.AppendL(aStatusRef); + return; + } + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*/*")) + != KErrNotFound && uriSegs == 11) + { + TPtrC8 ptr = NSmlDmURI::ParentURI(aURI); + + TBuf certBuffer; + + // Get the LUID from ptr2 + HBufC8* certLuid = iCallBack->GetLuidAllocL(ptr); + + TInt certIndex = GetIdFromLuid(*certLuid); + + delete certLuid; + + DBG_ARGS8( + _S8( + "CNSmlWLanAdapter::AddLeafObjectL - cert index: <%d>, cert count: <%d>"), + certIndex, + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count()); + + if (iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count() - 1 + < certIndex) + { + _DBG_FILE( + "CNSmlWLanAdapter::AddLeafObject - Certificate buffer does not exist. Create it."); + // The certificate buffer does not exist. Create a new one + EapCertificateEntry *entry = new (ELeave) EapCertificateEntry; + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Append(entry); + iEAPBuffer[eapIndex]->iEAPSettings->iCertificatesPresent = ETrue; + + certIndex + = iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count() + - 1; + + TBuf8<2> newLuid; + newLuid.Num(certIndex); + + DBG_ARGS8( + _S8( + "WLanAdapter::AddLeafObjectL - mapping uri: <%S> to luid: <%S>"), + &aURI, &newLuid); + iCallBack->SetMappingL(aURI, newLuid); + } + + if (lastUriSeg.Compare(KNSmlWLanIssuerName) == 0) + { + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + certBuffer, aObject); + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetIssuerName( + certBuffer); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetIssuerNamePresent(); + } + else if (lastUriSeg.Compare(KNSmlWLanSubjectName) == 0) + { + certBuffer.FillZ(); + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + certBuffer, aObject); + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSubjectName( + certBuffer); + + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSubjectNamePresent(); + } + else if (lastUriSeg.Compare(KNSmlWLanCertType) == 0) + { + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetCertType( + (EapCertificateEntry::TCertType) DesToInt(aObject)); + } + else if (lastUriSeg.Compare(KNSmlWLanSerialNumber) == 0) + { + certBuffer.FillZ(); + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + certBuffer, aObject); + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSerialNumber( + certBuffer); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSerialNumberPresent(); + + } + else if (lastUriSeg.Compare(KNSmlWLanSubjectKeyId) == 0) + { + + // Define literals to search the subject key for possible 0X/0x beginning + _LIT(KHexIdLC, "0x"); + _LIT(KHexIdUC, "0X"); + TBuf<2> hexIdBuf; + // The lenght of the key given as input + TInt keyLen = aObject.Length(); + + // setting the given key to the key buffer + TBuf8 origKey = aObject; + origKey.SetLength(keyLen); + TBuf8 key; + TLex8 tmpByte; + TUint16 byte; + + // Remove possible spaces from the beginning + origKey.TrimLeft(); + + // the key should be atleast two chars long + if (origKey.Length() >= 2) + { + // Copy the two left most characters in to the buffer + hexIdBuf.Copy(origKey.Left(2)); + + // If the first characters are 0x or 0X, then thet should be ignored + if (hexIdBuf.Compare(KHexIdLC) == 0 || hexIdBuf.Compare( + KHexIdUC) == 0) + { + // delete two characters + origKey.Delete(0, 2); + } + } + + // looping the subject key through, removing whitespaces + for (TInt i = 0; i < keyLen; i++) + { + // removing white spaces from the left side of the key + origKey.TrimLeft(); + // check that there are characters left + if (origKey.Length() >= 2) + { + // pick the two left most bytes from the key + tmpByte = origKey.Left(2); + // convert byte into binary format + err = tmpByte.Val(byte, EHex); + + // check whether conversion to decimal went ok + if (err != KErrNone) + { + // if there are problems, then leave the loop + break; + } + + // store the appended byte into the key variable + key.Append(byte); + // delete two characters from the left side of the character array in the buffer + origKey.Delete(0, 2); + } + else if (origKey.Length() == 1) + { + // pick the left most byte from the key + tmpByte = origKey.Left(1); + // convert byte into binary format + err = tmpByte.Val(byte, EHex); + + // check whether conversion to decimal went ok + if (err != KErrNone) + { + // if there are problems, then leave the loop + break; + } + + // store the appended byte into the key variable + key.Append(byte); + // delete two characters from the left side of the character array in the buffer + origKey.Delete(0, 1); + } + else + { + // leave the loop, no characters are left + break; + } + } + // store key value only if no errors occurred + if (err == KErrNone) + { + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSubjectKeyId( + key); + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); + } + else + { + // there were errors, let's leave the function and update status + DBG_ARGS(_S16( + "CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"), + err); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + } + else if (lastUriSeg.Compare(KNSmlWLanFingerprint) == 0) + { + certBuffer.FillZ(); + TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( + certBuffer, aObject); + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetThumbprint( + certBuffer); + if (retval == KErrNone) + iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetThumbprintPresent(); + } + // Save the status reference + iEAPBuffer[eapIndex]->iStatusRefArray.AppendL(aStatusRef); + + return; + } + + if (eapId == KErrNotFound) + { + err = iWlanSettings->WriteWlanSettings(*iSettings); + } + + if (err != KErrNone) + { + DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"), + err); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + + _DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::UpdateLeafObjectL( const TDesC& aURI, +// const TDesC& aLUID, const TDesC8& aObject, const TDesC& aType, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::UpdateLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType, + const TInt aStatusRef) + { + _DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): begin"); + DBG_ARGS8(_S8("WLanAdapter::UpdateLeafObjectL - <%S> <%S> <%S>"), &aURI, + &aLUID, &aObject); + + AddLeafObjectL(aURI, aLUID, aObject, aType, aStatusRef); + + _DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::UpdateLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) +//------------------------------------------------------------------------------ + +void CNSmlWLanAdapter::UpdateLeafObjectL(const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, TInt aStatusRef) + { + _DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::DeleteObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::DeleteObjectL(const TDesC8& aURI, const TDesC8& aLUID, + const TInt aStatusRef) + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): begin"); + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + if (aLUID.Length() == 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): end"); + return; + } + + TInt luid = GetIdFromLuid(aLUID); + + if ((NumOfUriSegs(aURI) < 6) || (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) + != KErrNotFound && NumOfUriSegs(aURI) == 6)) + { + if (luid == KErrNotFound) + { + return; + } + TInt ret = iWlanSettings->DeleteWlanSettings(luid); + + if (ret == KErrNone) + { + status = CSmlDmAdapter::EOk; + } + else + { + status = CSmlDmAdapter::EError; + } + + } + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey")) != KErrNotFound + && NumOfUriSegs(aURI) == 7) + { + // Individual WLAN settings cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*")) + != KErrNotFound && NumOfUriSegs(aURI) == 8) + { + _DBG_FILE( + "CNSmlWLanAdapter::DeleteObjectL(): matching SecondarySSID/*"); + //Check if the secondary SSID is present , if so delete that + TUint32 secid = GetSecSSIDFromUriL(aURI); + TInt retvalue(KErrNone); + _DBG_FILE( + "CNSmlWLanAdapter::DeleteObjectL() before call to DeleteOneSecondarySSIDL "); + TRAPD(ssidError, retvalue = iWlanSettings->DeleteOneSecondarySSIDL( + luid, secid)); + _DBG_FILE( + "CNSmlWLanAdapter::DeleteObjectL() After call to DeleteOneSecondarySSIDL "); + DBG_ARGS8(_S8( + "TRAP ERROR ssidError : Id = %d and retvalue eror = %d"), + ssidError, retvalue); + + if (ssidError == KErrNone) + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() SSID trap KERRONONE"); + if (retvalue == KErrNone) + { + _DBG_FILE( + "CNSmlWLanAdapter::DeleteObjectL() retvalue also KERRONONE, so its deleted"); + status = CSmlDmAdapter::EOk; + } + + else if (retvalue == KErrNotFound) + { + status = CSmlDmAdapter::ENotFound; + _DBG_FILE( + "CNSmlWLanAdapter::DeleteObjectL() retvalue KErrNotFound :-("); + } + + else + { + _DBG_FILE( + "CNSmlWLanAdapter::DeleteObjectL() retvalue some error :-("); + status = CSmlDmAdapter::EError; + } + + } + else + { + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() trap error :-( "); + status = CSmlDmAdapter::EError; + } + + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/*")) != KErrNotFound + && NumOfUriSegs(aURI) == 7) + { + // Individual WLAN settings cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*")) != KErrNotFound + && NumOfUriSegs(aURI) == 8) + { + // Individual WEP keys cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*/Data")) + != KErrNotFound && NumOfUriSegs(aURI) == 9) + { + // Individual WEP keys cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound + && NumOfUriSegs(aURI) == 8) + { + // Individual EAP settings cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/*")) != KErrNotFound + && NumOfUriSegs(aURI) == 9) + { + // Individual EAP settings cannot be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*")) + != KErrNotFound && NumOfUriSegs(aURI) == 10) + { + // Individual certificates are not allowed to be deleted and this case should never happen + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + + } + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*/*")) + != KErrNotFound && NumOfUriSegs(aURI) == 11) + { + // Individual certificate fields are not allowed to be deleted and this case should never happen. + // These are deleted through WLAN parent nodes. + status = CSmlDmAdapter::EError; + } + + iCallBack->SetStatusL(aStatusRef, status); + + _DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +// not used. +//----------------------------------------------------------------------------- + +void CNSmlWLanAdapter::FetchLeafObjectSizeL(const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, const TDesC8& /*aType*/, + TInt /*aResultsRef*/, TInt /*aStatusRef*/) + { + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectSizeL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectSizeL(): end"); + return; + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::FetchLeafObjectL(const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, const TDesC8& /*aType*/, + const TInt /*aResultsRef*/, const TInt /*aStatusRef*/) + { + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): end"); + + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC& aURI, +// const TDesC& aLUID, const TDesC& aType, +// const TInt aResultsRef, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlWLanAdapter::FetchLeafObjectL(const TDesC8& aURI, + const TDesC8& aLUID, const TDesC8& aType, CBufBase& aObject) + { + + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): begin"); + DBG_ARGS8(_S8("WLanAdapter::FetchLeafObjectL - <%S> <%S> <%S>"), &aURI, + &aLUID, &aType); + + if (aLUID.Length() == 0) + { + + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): ENotFound"); + return CSmlDmAdapter::ENotFound; + } + + CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound; + + // This luid is the service table id (Found from EAP node and parents) + TInt luid; + if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound) + { + luid = GetServiceIdFromUriL(aURI); + } + else + { + // The luid supplied is ok + luid = GetIdFromLuid(aLUID); + } + + TPtrC8 lastUriSeg = GetLastUriSeg(aURI); + + if (luid == KErrNotFound) + { + return; + } + + TInt err = iWlanSettings->GetWlanSettings(luid, *iSettings); + + if (err == KErrNotFound) + { + + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): ENotFound"); + return CSmlDmAdapter::ENotFound; + } + + if (lastUriSeg.Compare(KNSmlWLanSsid) == 0) + { + + if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*")) + != KErrNotFound) + { + RArray secondarySSIDs; + CleanupClosePushL(secondarySSIDs); + iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs); + TSecondarySSID ssid; + ssid.Id = 0; + TUint32 id = GetSecSSIDFromUriL(aURI); + TInt count = secondarySSIDs.Count(); + for (TInt i = 0; i < count; i++) + { + if (id == secondarySSIDs[i].Id) + { + ssid = secondarySSIDs[i]; + break; + } + } + CleanupStack::PopAndDestroy(&secondarySSIDs); + if (ssid.Id == 0) + { + status = CSmlDmAdapter::ENotFound; + } + else + { + HBufC* data = ssid.ScannedId.AllocLC(); + HBufC8* data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8, + data->Des()); + + aObject.InsertL(0, dataPtr8); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy(2); //data, data8 + } + } + else + { + + HBufC* data = iSettings->SSID.AllocLC(); + HBufC8* data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8, data->Des()); + + aObject.InsertL(0, dataPtr8); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy(2); //data, data8 + + } + + } + + else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0) + { + + if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*")) + != KErrNotFound) + { + RArray secondarySSIDs; + CleanupClosePushL(secondarySSIDs); + iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs); + TSecondarySSID ssid; + ssid.Id = 0; + TUint32 id = GetSecSSIDFromUriL(aURI); + TInt count = secondarySSIDs.Count(); + for (TInt i = 0; i < count; i++) + { + if (id == secondarySSIDs[i].Id) + { + ssid = secondarySSIDs[i]; + break; + } + } + CleanupStack::PopAndDestroy(&secondarySSIDs); + if (ssid.Id == 0) + { + status = CSmlDmAdapter::ENotFound; + } + else + { + HBufC* data = ssid.UsedId.AllocLC(); + HBufC8* data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8, + data->Des()); + + aObject.InsertL(0, dataPtr8); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy(2); //data, data8 + } + } + else + { + + HBufC* data = iSettings->UsedSSID.AllocLC(); + HBufC8* data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8, data->Des()); + + aObject.InsertL(0, dataPtr8); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy(2); //data, data8 + + } + + } + + else if (lastUriSeg.Compare(KNSmlWLanSsidHidden) == 0) + { + if (iSettings->ScanSSID == 1) + { + aObject.InsertL(0, _L8("True")); + } + else + { + aObject.InsertL(0, _L8("False")); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanNetworkMode) == 0) + { + status = CSmlDmAdapter::EOk; + + switch (iSettings->ConnectionMode) + { + case 0: + aObject.InsertL(0, KNSmlWLanAdHoc8); + break; + case 1: + aObject.InsertL(0, KNSmlWLanInfrastructure8); + break; + default: + status = CSmlDmAdapter::ENotFound; + break; + } + } + else if (lastUriSeg.Compare(KNSmlWLanSecurityMode) == 0) + { + status = CSmlDmAdapter::EOk; + + switch (iSettings->SecurityMode) + { + case EAllowUnsecure: + aObject.InsertL(0, KNSmlWLanAllowUnsecure8); + break; + case EWep: + aObject.InsertL(0, KNSmlWLanWep8); + break; + case EWlan8021x: + aObject.InsertL(0, KNSmlWLan8021x8); + break; + case EWpa: + aObject.InsertL(0, KNSmlWLanWpa8); + break; + case EWpa2: + aObject.InsertL(0, KNSmlWLanWpa28); + break; + default: + status = CSmlDmAdapter::ENotFound; + break; + } + } + + else if (lastUriSeg.Compare(KNSmlWLanWpaPreSharedKey) == 0) + { + aObject.InsertL(0, iSettings->WPAPreSharedKey); + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanUseWPAPSK) == 0) + { + if (iSettings->UseWPAPSK == 1) + { + aObject.InsertL(0, _L8("True")); + } + else + { + aObject.InsertL(0, _L8("False")); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanWepIndex) == 0) + { + HBufC8* data = IntToDes8LC(iSettings->WepIndex); + aObject.InsertL(0, data->Des()); + + CleanupStack::PopAndDestroy(data); //data + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanEapList) == 0) + { + HBufC* data = iSettings->EapList.AllocLC(); + HBufC8* data8 = HBufC8::NewLC(data->Size()); + TPtr8 dataPtr8 = data8->Des(); + //FFS + CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8, data->Des()); + + aObject.InsertL(0, dataPtr8); + status = CSmlDmAdapter::EOk; + + CleanupStack::PopAndDestroy(2); //data, data8 + + } + + else if (lastUriSeg.Compare(KNSmlWLanAuthMode) == 0) + { + HBufC8* data = IntToDes8LC(iSettings->AuthMode); + aObject.InsertL(0, data->Des()); + + CleanupStack::PopAndDestroy(data); //data + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanWepKeyData) == 0) + { + TInt wepKeyIndex = GetWepKeyIdFromLuid(aLUID); + if (wepKeyIndex == KErrNotFound) + { + wepKeyIndex = GetWepKeyIdFromUri(aURI); + TBuf8<80> addLUID; // AP//NapDef//WLAN//WEPKey/WKIdnnn + addLUID.AppendNum(wepKeyIndex); + addLUID.AppendNumFixedWidth(luid, EDecimal, 3); + DBG_ARGS8( + _S8( + "WLanAdapter::Fetchleaf object, set mapping uri: <%S> to luid: <%S>"), + &aURI, &addLUID); + DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID); + iCallBack->SetMappingL(aURI, addLUID); + + } + status = CSmlDmAdapter::EOk; + switch (wepKeyIndex) + { + case 1: + aObject.InsertL(0, iSettings->WepKey1); + break; + case 2: + aObject.InsertL(0, iSettings->WepKey2); + break; + case 3: + aObject.InsertL(0, iSettings->WepKey3); + break; + case 4: + aObject.InsertL(0, iSettings->WepKey4); + break; + default: + status = CSmlDmAdapter::EError; + } + } + else if (lastUriSeg.Compare(KNSmlWLanWepKeyId) == 0) + { + TInt wepKeyIndex = GetWepKeyIdFromLuid(aLUID); + if (wepKeyIndex == KErrNotFound) + { + wepKeyIndex = GetWepKeyIdFromUri(aURI); + TBuf8<80> addLUID; // AP//NapDef//WLAN//WEPKey/WKIdnnn + addLUID.AppendNum(wepKeyIndex); + addLUID.AppendNumFixedWidth(luid, EDecimal, 3); + DBG_ARGS8( + _S8( + "WLanAdapter::Fetchleaf object, set mapping uri: <%S> to luid: <%S>"), + &aURI, &addLUID); + DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID); + iCallBack->SetMappingL(aURI, addLUID); + } + if (wepKeyIndex > 0) + { + HBufC8* data = IntToDes8LC(wepKeyIndex); + aObject.InsertL(0, data->Des()); + CleanupStack::PopAndDestroy(data); //data + status = CSmlDmAdapter::EOk; + } + else + { + status = CSmlDmAdapter::EError; + } + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound) + { + TInt eapId = GetEAPIdFromUri(aURI); + + // Check if the id contains encapsulating type as well + TInt encapsEapId = GetEncapsEAPIdFromUri(aURI); + if (encapsEapId == KErrNotFound) + { + encapsEapId = EEapNone; + } + + ResetEAPStructL(); + TEapExpandedType expandedTypecmbuf; + TEapExpandedType expandedTypeencapscmbuf; + + GetExpandedType(eapId, encapsEapId, expandedTypecmbuf, + expandedTypeencapscmbuf); + TInt err = iWlanSettings->GetEAPSettings(luid, expandedTypecmbuf, + expandedTypeencapscmbuf, *iEAPSettings); + + if (err != KErrNone || iEAPSettings == NULL) + { + status = CSmlDmAdapter::EError; + } + else if (lastUriSeg.Compare(KNSmlWLanEapType) == 0) + { + aObject.InsertL(0, *IntToDes8LC(eapId)); + CleanupStack::PopAndDestroy(); // IntToDes8LC + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanUsername) == 0) + { + if (iEAPSettings->iUsernamePresent) + { + DesToBufferL(aObject, iEAPSettings->iUsername); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanPassword) == 0) + { + if (iEAPSettings->iPasswordPresent) + { + DesToBufferL(aObject, iEAPSettings->iPassword); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanRealm) == 0) + { + if (iEAPSettings->iRealmPresent) + { + DesToBufferL(aObject, iEAPSettings->iRealm); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanUsePseudonym) == 0) + { + if (iEAPSettings->iUsePseudonymsPresent + && iEAPSettings->iUsePseudonyms) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanEncapsulation) == 0) + { + if (encapsEapId == EEapPeap) + { + aObject.InsertL(0, KEAPPEAP); + } + else if (encapsEapId == EEapTtls) + { + aObject.InsertL(0, KEAPTTLS); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanVerifyCertRealm) == 0) + { + if (iEAPSettings->iVerifyServerRealmPresent + && iEAPSettings->iVerifyServerRealm) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanRequireClientAuthentication) + == 0) + { + if (iEAPSettings->iRequireClientAuthenticationPresent + && iEAPSettings->iRequireClientAuthentication) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanSessionValidityTime) == 0) + { + if (iEAPSettings->iSessionValidityTimePresent) + { + aObject.InsertL(0, *IntToDes8LC( + (TInt) iEAPSettings->iSessionValidityTime)); + CleanupStack::PopAndDestroy(); // IntToDes8LC + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanCipherSuite) == 0) + { + FillCipherSuiteBufferL(aObject); + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv0) == 0) + { + if (iEAPSettings->iPEAPVersionsPresent + && iEAPSettings->iPEAPv0Allowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv1) == 0) + { + if (iEAPSettings->iPEAPVersionsPresent + && iEAPSettings->iPEAPv1Allowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv2) == 0) + { + if (iEAPSettings->iPEAPVersionsPresent + && iEAPSettings->iPEAPv2Allowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + +#ifdef FF_WLAN_EXTENSIONS + else if (lastUriSeg.Compare(KNSmlWLanAuthProvMode) == 0) + { + if (iEAPSettings->iAuthProvModeAllowedPresent && iEAPSettings->iAuthProvModeAllowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanUnauthProvMode) == 0) + { + if (iEAPSettings->iUnauthProvModeAllowedPresent && iEAPSettings->iUnauthProvModeAllowed) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanPACGroupRef) == 0) + { + if (iEAPSettings->iPACGroupReferencePresent) + { + DesToBufferL(aObject, iEAPSettings->iPACGroupReference); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoPAC) == 0) + { + if (iEAPSettings->iWarnADHPNoPACPresent && iEAPSettings->iWarnADHPNoPAC) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoMatchPAC) == 0) + { + if (iEAPSettings->iWarnADHPNoMatchingPACPresent && iEAPSettings->iWarnADHPNoMatchingPAC) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + + else if (lastUriSeg.Compare(KNSmlWLanWarnNotDefaultSrv) == 0) + { + if (iEAPSettings->iWarnNotDefaultServerPresent && iEAPSettings->iWarnNotDefaultServer) + { + aObject.InsertL(0, KTrue); + } + else + { + aObject.InsertL(0, KFalse); + } + status = CSmlDmAdapter::EOk; + } + +#endif + + else if (lastUriSeg.Compare(KNSmlWLanIssuerName) == 0) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if (iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound) + { + if (iEAPSettings->iCertificates[certId - 1]->GetIssuerNamePresent()) + { + aObject.InsertL(0, + ConvertTo8LC(*(iEAPSettings->iCertificates[certId + - 1]->GetIssuerName()))); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + else if (lastUriSeg.Compare(KNSmlWLanSubjectName) == 0) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if (iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound) + { + if (iEAPSettings->iCertificates[certId - 1]->GetSubjectNamePresent()) + { + aObject.InsertL(0, + ConvertTo8LC(*(iEAPSettings->iCertificates[certId + - 1]->GetSubjectName()))); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + else if (lastUriSeg.Compare(KNSmlWLanCertType) == 0) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if (iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound) + { + aObject.InsertL( + 0, + *IntToDes8LC( + iEAPSettings->iCertificates[certId - 1]->GetCertType())); + CleanupStack::PopAndDestroy(); // IntToDes8LC + status = CSmlDmAdapter::EOk; + } + } + else if (lastUriSeg.Compare(KNSmlWLanSerialNumber) == 0) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if (iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound) + { + if (iEAPSettings->iCertificates[certId - 1]->GetSerialNumberPresent()) + { + aObject.InsertL(0, + ConvertTo8LC(*(iEAPSettings->iCertificates[certId + - 1]->GetSerialNumber()))); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + else if (lastUriSeg.Compare(KNSmlWLanSubjectKeyId) == 0) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if (iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound) + { + if (iEAPSettings->iCertificates[certId - 1]->GetSubjectKeyIdPresent()) + { + _DBG_FILE( + "CNSmlWLanAdapter::FetchLeafObject - Fetch subject key."); + // check the lenght of the given subjectKeyId, if it is longer that 20, then we + // update the status with error and will not go through the key + if ((iEAPSettings->iCertificates[certId - 1]->GetSubjectKeyId().Length()) + > KKeyIdentifierLength) + { + status = CSmlDmAdapter::EError; + } + else + { + _DBG_FILE( + "CNSmlWLanAdapter::FetchLeafObject - key is under max lenght"); + TBuf8 + binKey = iEAPSettings->iCertificates[certId + - 1]->GetSubjectKeyId(); + TBuf8<2> idBuf; + TBuf8 key; + TUint8 byte; + + // hexadecimal representation + _LIT8(KFormat, "%02x"); + + // looping the subject key through + for (TInt i = 0; i < binKey.Length(); i++) + { + _DBG_FILE( + "CNSmlWLanAdapter::FetchLeafObject - Loop the key through."); + // pick the next value from the buffer + byte = binKey[i]; + // convert the value into hexadecimal format + idBuf.Format(KFormat, byte); + // store the hexa value into the key variable + key.Append(idBuf); + } + // Copy the key to the aObject variable + aObject.InsertL(0, key); + status = CSmlDmAdapter::EOk; + } + } + } + } + else if (lastUriSeg.Compare(KNSmlWLanFingerprint) == 0) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if (iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound) + { + if (iEAPSettings->iCertificates[certId - 1]->GetThumbprintPresent()) + { + aObject.InsertL(0, + ConvertTo8LC(*(iEAPSettings->iCertificates[certId + - 1]->GetThumbprint()))); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + else if (lastUriSeg.Compare(KNSmlWLanSerialNumber) == 0) + { + status = CSmlDmAdapter::ENotFound; + + TInt certId = GetCertificateIdFromUri(aURI); + + if (iEAPSettings->iCertificatesPresent + && iEAPSettings->iCertificates.Count() >= certId + && certId != KErrNotFound) + { + if (iEAPSettings->iCertificates[certId - 1]->GetSerialNumberPresent()) + { + aObject.InsertL(0, + ConvertTo8LC(*(iEAPSettings->iCertificates[certId + - 1]->GetSerialNumber()))); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + status = CSmlDmAdapter::EOk; + } + } + } + } + + DBG_ARGS(_S16("CNSmlWLanAdapter::FetchLeafObjectL - Status <%D>"), status); + _DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): end"); + return status; + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::ChildURIListL( const TDesC& aURI, +// const TDesC& aLUID, const CArrayFix& aPreviousURISegmentList, +// const TInt aResultsRef, const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::ChildURIListL(const TDesC8& aURI, const TDesC8& aLUID, + const CArrayFix& aPreviousURISegmentList, + const TInt aResultsRef, const TInt aStatusRef) + { + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): begin"); + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL - <%S> <%S>"), &aURI, &aLUID); + CBufBase* currentUriSegmentList = CBufFlat::NewL(128); + CleanupStack::PushL(currentUriSegmentList); + + TInt uriSegs = NumOfUriSegs(aURI); + TInt luid = GetIdFromLuid(aLUID); + + //AP//NAPDef// + if (aURI.Match(_L8("AP/*/NAPDef/*")) != KErrNotFound && uriSegs == 4) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->NAPDef - <%S> <%S>"), + &aURI, &aLUID); + if (luid == KErrNotFound) + { + return; + } + if (iWlanSettings->RecordExists(luid) < 0) + { + currentUriSegmentList->InsertL(0, KNSmlNAPDefWlanNode); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + else + { + currentUriSegmentList->InsertL(0, KNSmlNAPDefWlanNode); + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + KNSmlWLan); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + + //AP//NAPDef//WLAN + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN")) != KErrNotFound && uriSegs + == 5) + { + if (aPreviousURISegmentList.Count() > 0) + { + HBufC8 *uriSeg = HBufC8::NewLC(KNSmlMaxURISegLen); + TPtr8 uriSegPtr = uriSeg->Des(); + uriSegPtr = aPreviousURISegmentList.At(0).iURISeg; + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + uriSegPtr); + CleanupStack::PopAndDestroy(uriSeg); //uriSeg + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + else + { + if (luid == KErrNotFound) + { + return; + } + if (iWlanSettings->RecordExists(luid) < 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE( + "CNSmlWLanAdapter::ChildURIListL(): status: Not found"); + } + else + { + _LIT8(Kprev, "WLId"); + TBuf8<9> addNAME(Kprev); // WLId + addNAME.AppendNumFixedWidth(luid, EDecimal, 3); + + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + addNAME); + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + _L8("/")); + + TBuf8<80> addURI; // AP//NapDef//WLAN/WLIdnnn , n=aLUID + addURI.Append(aURI); + addURI.Append(_L8("/WLId")); + addURI.AppendNumFixedWidth(luid, EDecimal, 3); + + TBuf8<16> addLUID; + _LIT8(KFormat, "%d"); + addLUID.Format(KFormat, luid); + + // Also added to mapping + DBG_ARGS8( + _S8( + "WLanAdapter::ChildURIListL - mapping uri: <%S> to luid: <%S>"), + &addURI, &addLUID); + DBG_ARGS8(_S8("Parameters - <%S> <%S>"), &aURI, &aLUID); + iCallBack->SetMappingL(addURI, addLUID); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + } + + //AP//NAPDef//WLAN/ + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) != KErrNotFound + && uriSegs == 6) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->NAPDef - <%S> <%S>"), + &aURI, &aLUID); + if (luid == KErrNotFound) + { + return; + } + if (iWlanSettings->RecordExists(luid) < 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + KNSmlWLanListOfLeafs); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + + //AP//NAPDef//WLAN//WEPKey + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey")) != KErrNotFound + && uriSegs == 7) + { + DBG_ARGS8(_S8( + "WLanAdapter::ChildURIListL->WEPKey - <%S> <%S> <%D> <%D>"), + &aURI, &aLUID, aResultsRef, aStatusRef); + + for (TInt i = 0; i < 4; i++) + { + if (aPreviousURISegmentList.Count() > i) + { + HBufC8 *uriSeg = HBufC8::NewLC(KNSmlMaxURISegLen); + TPtr8 uriSegPtr = uriSeg->Des(); + uriSegPtr = aPreviousURISegmentList.At(i).iURISeg; + + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + uriSegPtr); + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + _L8("/")); + CleanupStack::PopAndDestroy(); //uriSeg + } + else + { + TBuf8<25> addNAME; + addNAME.Append(_L8("WKId")); + addNAME.AppendNum(i + 1); + addNAME.Append(_L8("/")); + + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + addNAME); + } + } + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + + //AP//NAPDef//WEPKey/ + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*")) != KErrNotFound + && uriSegs == 8) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->WEPKey/* - <%S> <%D>"), + &aURI, luid); + if (luid == KErrNotFound) + { + return; + } + if (iWlanSettings->RecordExists(luid) < 0) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + TInt wepKeyId = GetWepKeyIdFromLuid(aLUID); + if (wepKeyId == KErrNotFound) + { + wepKeyId = GetWepKeyIdFromUri(aURI); + + TBuf8<80> addLUID; // AP//NapDef//WLAN//WEPKey/WKIdnnn + addLUID.AppendNum(wepKeyId); + addLUID.AppendNumFixedWidth(luid, EDecimal, 3); + + DBG_ARGS8( + _S8( + "WLanAdapter::ChildURIListL - mapping uri: <%S> to luid: <%S>"), + &aURI, &addLUID); + DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID); + iCallBack->SetMappingL(aURI, addLUID); + } + + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + KNSmlWLanListOfWepKeyLeafs); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + + //AP//NAPDef//WLAN//SecondarySSID/ + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID")) + != KErrNotFound && uriSegs == 7) + { + DBG_ARGS8( + _S8("WLanAdapter::ChildURIListL->EAP - <%S> <%S> <%D> <%D>"), + &aURI, &aLUID, aResultsRef, aStatusRef); + if (aPreviousURISegmentList.Count() > 0) + { + HBufC8 *uriSeg = HBufC8::NewLC(KNSmlMaxURISegLen); + TPtr8 uriSegPtr = uriSeg->Des(); + uriSegPtr = aPreviousURISegmentList.At(0).iURISeg; + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + uriSegPtr); + CleanupStack::PopAndDestroy(uriSeg); //uriSeg + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + else + { + if (luid == KErrNotFound) + { + return; + } + if (iWlanSettings->RecordExists(luid) < 0) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE( + "CNSmlWLanAdapter::ChildURIListL(): status: Not found"); + } + else + { + RArray secondarySSIDs; + CleanupClosePushL(secondarySSIDs); + iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs); + TInt count = secondarySSIDs.Count(); + _LIT8(KPrefixSSID, "SecSSID"); + TBuf8<5> addNAME; // number + for (TInt i = 0; i < count; i++) + { + if (i != 0) // Don't do it in first iteration, but with all the following + { + currentUriSegmentList->InsertL( + currentUriSegmentList->Size(), _L8("/")); + } + currentUriSegmentList->InsertL( + currentUriSegmentList->Size(), KPrefixSSID); + addNAME.Zero(); + addNAME.AppendNumFixedWidth(secondarySSIDs[i].Id, + EDecimal, 3); + currentUriSegmentList->InsertL( + currentUriSegmentList->Size(), addNAME); + } + CleanupStack::PopAndDestroy(&secondarySSIDs); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + } + //AP//NAPDef//WLAN//SecondarySSID/* + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*")) + != KErrNotFound && uriSegs == 8) + { + DBG_ARGS8(_S8( + "WLanAdapter::ChildURIListL->SecondarySSID/* - <%S> <%D>"), + &aURI, luid); + if (luid == KErrNotFound) + { + return; + } + if (iWlanSettings->RecordExists(luid) < 0) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + KNSmlWLanListOfSecondaryLeafs); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + //AP//NAPDef//WLAN//EAP + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP")) != KErrNotFound + && uriSegs == 7) + { + DBG_ARGS8( + _S8("WLanAdapter::ChildURIListL->EAP - <%S> <%S> <%D> <%D>"), + &aURI, &aLUID, aResultsRef, aStatusRef); + + // Need to get the service id from parent node + luid = GetServiceIdFromUriL(aURI); + + if (luid == KErrNotFound) + { + return; + } + if (iWlanSettings->RecordExists(luid) < 0) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + iWlanSettings->InstalledEAPsL(*currentUriSegmentList); + + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + //AP//NAPDef//WLAN//EAP/ + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound + && uriSegs == 8) + { + // Need to get the service id from parent node + luid = GetServiceIdFromUriL(aURI); + + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->EAP/* - <%S> <%D>"), + &aURI, luid); + if (iWlanSettings->RecordExists(luid) < 0) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + KNSmlWLanListOfEAPLeafs); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + //AP//NAPDef//WLAN//EAP//Certificate + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate")) + != KErrNotFound && uriSegs == 9) + { + luid = GetServiceIdFromUriL(aURI); + + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->Certificate - <%S> <%D>"), + &aURI, luid); + if (iWlanSettings->RecordExists(luid) < 0) + { + //wlan settings not found for aLUID + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + TInt eapId = GetEAPIdFromUri(aURI); + + // Check if the id contains encapsulating type as well + TInt encapsEapId = GetEncapsEAPIdFromUri(aURI); + if (encapsEapId == KErrNotFound) + { + encapsEapId = EEapNone; + } + + ResetEAPStructL(); + TEapExpandedType expandedTypecmbuf; + TEapExpandedType expandedTypeencapscmbuf; + + GetExpandedType(eapId, encapsEapId, expandedTypecmbuf, + expandedTypeencapscmbuf); + + TInt err = iWlanSettings->GetEAPSettings(luid, expandedTypecmbuf, + expandedTypeencapscmbuf, *iEAPSettings); + if (err != KErrNone || !iEAPSettings->iCertificatesPresent) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + TInt certCount = iEAPSettings->iCertificates.Count(); + HBufC8* pBuf = HBufC8::NewLC(KNSmlMaxURISegLen); + TPtr8 ptrCerts = pBuf->Des(); + for (TInt i = 0; i < certCount; i++) + { + ptrCerts.Append(_L8("CertId")); + ptrCerts.AppendNumFixedWidth(i + 1, EDecimal, 3); + ptrCerts.Append(_L8("/")); + } + + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + ptrCerts); + CleanupStack::PopAndDestroy(pBuf); // pBuf + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + } + //AP//NAPDef//WLAN//EAP//Certificate/ + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*")) + != KErrNotFound && uriSegs == 10) + { + DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->EAP/* - <%S> <%D>"), + &aURI, luid); + TInt eapId = GetEAPIdFromUri(aURI); + // Check if the id contains encapsulating type as well + TInt encapsEapId = GetEncapsEAPIdFromUri(aURI); + if (encapsEapId == KErrNotFound) + { + encapsEapId = EEapNone; + } + + ResetEAPStructL(); + TEapExpandedType expandedTypecmbuf; + TEapExpandedType expandedTypeencapscmbuf; + + GetExpandedType(eapId, encapsEapId, expandedTypecmbuf, + expandedTypeencapscmbuf); + + TInt err = iWlanSettings->GetEAPSettings(luid, expandedTypecmbuf, + expandedTypeencapscmbuf, *iEAPSettings); + if (err != KErrNone || !iEAPSettings->iCertificatesPresent) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end"); + } + else + { + currentUriSegmentList->InsertL(currentUriSegmentList->Size(), + KNSmlWLanListOfCertificateLeafs); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList, + KNullDesC8); + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok"); + } + } + + CleanupStack::PopAndDestroy(currentUriSegmentList); + + _DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): end"); + } + +//----------------------------------------------------------------------------- +// void CNSmlWLanAdapter::AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID, +// const TInt aStatusRef ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::AddNodeObjectL(const TDesC8& aURI, + const TDesC8& aParentLUID, const TInt aStatusRef) + { + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): begin"); + DBG_ARGS8(_S8( + "WLanAdapter::AddNodeObjectL - uri: <%S> to aParentLuid: <%S>"), + &aURI, &aParentLUID); + + TInt uriSegs = NumOfUriSegs(aURI); + if ((aURI.Match(_L8("AP/*/NAPDef/*/WLAN")) != KErrNotFound && uriSegs + == 5) || (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP")) + != KErrNotFound && uriSegs == 7) || (aURI.Match(_L8( + "AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate")) != KErrNotFound + && uriSegs == 9)) + { + iCallBack->SetMappingL(aURI, aParentLUID); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + return; + } + + //Add new wlan settings + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) != KErrNotFound + && NumOfUriSegs(aURI) == 6) + { + TBuf serviceType; + TUint32 serviceId(NULL); + TUint32 lValue; + CCommsDbTableView* napdefView = iDatabase.OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), DesToInt(aParentLUID)); + TInt errorCode = napdefView->GotoFirstRecord(); + if (errorCode == KErrNone) + { + napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + napdefView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); // ID + } + CCommsDbTableView* tableView = iDatabase.OpenViewMatchingUintLC( + serviceType, TPtrC(COMMDB_ID), serviceId); + errorCode = tableView->GotoFirstRecord(); + if (errorCode == KErrNone) + { + tableView->ReadUintL(TPtrC(COMMDB_ID), lValue); + } + CleanupStack::PopAndDestroy();//tableview + CleanupStack::PopAndDestroy();//napdefview + + iSettings->Id = 0; + iSettings->ServiceID = lValue; + iSettings->ConnectionMode = 0; + iSettings->SSID = TPtrC(KNSmlWLanDefaultSSID); + iSettings->UsedSSID = _L(""); + iSettings->ScanSSID = 0; + iSettings->WepKey1 = _L8(""); + iSettings->WepKey2 = _L8(""); + iSettings->WepKey3 = _L8(""); + iSettings->WepKey4 = _L8(""); + iSettings->WepIndex = 0; + iSettings->SecurityMode = EAllowUnsecure; + iSettings->WPAPreSharedKey = _L8(""); + iSettings->UseWPAPSK = 0; + iSettings->EapList = _L(""); + iSettings->AuthMode = 0; + + TInt err = iWlanSettings->WriteWlanSettings(*iSettings); + if (err != KErrNone) + { + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + return; + } + + DBG_ARGS8( + _S8( + "WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"), + &aURI, &aParentLUID); + iCallBack->SetMappingL(aURI, aParentLUID); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey")) != KErrNotFound + && uriSegs == 7) + { + if (iWlanSettings->RecordExists(DesToInt(aParentLUID))) + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); + else + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); + return; + } + + //Add wep key for existing record + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*")) != KErrNotFound + && uriSegs == 8) + { + for (TInt i = 0; i < iBuffer->Count(); i++) + { + if (iBuffer->At(i).iUri->Match(aURI) != KErrNotFound) + { + iCallBack->SetStatusL(aStatusRef, + CSmlDmAdapter::EAlreadyExists); + + _DBG_FILE( + "CNSmlWLanAdapter::AddNodeObjectL(): EAlreadyExists"); + return; + } + } + DBG_ARGS8(_S8( + "WLanAdapter::Bufferiin - uri: <%S> to aParentLuid: <%S>"), + &aURI, &aParentLUID); + + TNSmlWepKeyBufferElement newNode; + newNode.iUri = aURI.AllocLC(); + newNode.iData = 0; + newNode.iWepKeyId = 0; + //newNode.iUseWPAPSK = 0; + newNode.iIdStatusRef = 0; + newNode.iDataStatusRef = 0; + newNode.iLengthStatusRef = 0; + newNode.iNodeStatusRef = aStatusRef; + newNode.iExecuted = EFalse; + newNode.iDataSet = EFalse; + newNode.iLuid = DesToInt(aParentLUID); + iBuffer->AppendL(newNode); + + CleanupStack::Pop(); //newNode.iUri + + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): end"); + return; + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*")) + != KErrNotFound && NumOfUriSegs(aURI) == 8) + { + /* + TSecondarySSID ssid; + ssid.ScannedId = KNullDesC; + ssid.UsedId = KNullDesC; + TInt luid = GetIdFromLuid( aParentLUID ); + TInt retval = iWlanSettings->WriteSecondarySSIDL(luid, ssid, ETrue);*/ + + TNSmlSecondarySSIDBufferElement *newSecNode = + new (ELeave) TNSmlSecondarySSIDBufferElement; + ; + newSecNode->iUri = aURI.AllocLC(); + newSecNode->ScannedId = KNullDesC; + newSecNode->UsedId = KNullDesC; + newSecNode->iExecuted = EFalse; + newSecNode->wlanLuid = GetIdFromLuid(aParentLUID); + iSecondaryBuffer.AppendL(newSecNode); + CleanupStack::Pop(); //newNode.iUri + return; + } + + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound + && NumOfUriSegs(aURI) == 8) + { + TInt eapTypeId = GetEAPIdFromUri(aURI); + TInt encapsEapId = GetEncapsEAPIdFromUri(aURI); + if (encapsEapId == KErrNotFound) + { + encapsEapId = EEapNone; + } + + TInt WLANServiceId = GetServiceIdFromUriL(aURI); + + if (WLANServiceId == KErrNotFound) + { + _DBG_FILE( + "CNSmlWLanAdapter::AddNodeObjectL(): Could not find WLAN service ID from URI."); + User::Leave(KErrNotFound); + } + // append it to the appropriate list ('+' enabled, '-' disabled) + _LIT8(KPadding, "\xFE\0\0\0\0\0\0"); + _LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); + const TInt KPlainMsChapV2ImplUid = 99; + + TBuf8 cmpbuf; + if (eapTypeId == KPlainMsChapV2ImplUid) + { + cmpbuf.Append(KMsChapV2Padding); + } + else + { + cmpbuf.Append(KPadding); + } + cmpbuf.Append(eapTypeId); + TEapExpandedType expandedTypecmbuf(cmpbuf); + + TBuf8 encapscmpbuf; + if (encapsEapId == KPlainMsChapV2ImplUid) + { + encapscmpbuf.Append(KMsChapV2Padding); + } + else + { + encapscmpbuf.Append(KPadding); + } + encapscmpbuf.Append(encapsEapId); + TEapExpandedType expandedTypeencapscmbuf(encapscmpbuf); + + TInt i(0); + // Check if the buffer for this EAP already exists + for (i = 0; i < iEAPBuffer.Count(); i++) + { + if ((expandedTypecmbuf.Compare( + iEAPBuffer[i]->iEAPSettings->iEAPExpandedType) == 0) + && (expandedTypeencapscmbuf.Compare( + iEAPBuffer[i]->iEncapsulatingExpandedEapId) == 0)) + { + // The correct buffer was found. + _DBG_FILE( + "CNSmlWLanAdapter::AddNodeObjectL(): Found existing buffer."); + break; + } + } + // buffer did not exist. Update the existing buffer + if (i == iEAPBuffer.Count()) + { + TNSmlEAPBufferElement* buffer = + new (ELeave) TNSmlEAPBufferElement; + CleanupStack::PushL(buffer); + + buffer->iEAPSettings = new (ELeave) EAPSettings; + CleanupStack::PushL(buffer->iEAPSettings); + + TBuf8 tempbuf; + if (eapTypeId == KPlainMsChapV2ImplUid) + { + tempbuf.Append(KMsChapV2Padding); + } + else + { + tempbuf.Append(KPadding); + } + tempbuf.Append(eapTypeId); + + buffer->iEAPSettings->iEAPExpandedType = tempbuf; + buffer->iStatusRefArray.AppendL(aStatusRef); + buffer->iWLANServiceId = WLANServiceId; + ConvertEAPStringToIds(buffer->iEapTypeString, + buffer->iEAPSettings->iEAPExpandedType); + TBuf8 encapsTempbuf; + if (encapsEapId == KPlainMsChapV2ImplUid) + { + encapsTempbuf.Append(KMsChapV2Padding); + } + else + { + encapsTempbuf.Append(KPadding); + } + encapsTempbuf.Append(encapsEapId); + buffer->iEncapsulatingExpandedEapId = encapsTempbuf; + if (buffer->iEncapsulatingExpandedEapId + != (*EapExpandedTypeNone.GetType())) + { + ConvertEAPStringToIds(buffer->iEncapsulatingString, + buffer->iEncapsulatingExpandedEapId); + } + iEAPBuffer.AppendL(buffer); + + CleanupStack::Pop(buffer->iEAPSettings); + CleanupStack::Pop(buffer); + } + + // Set the mapping luid to be the index to the iEAPBuffer + TBuf8<2> luid; + luid.Num(iEAPBuffer.Count() - 1); + DBG_ARGS8( + _S8( + "WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"), + &aURI, &luid); + iCallBack->SetMappingL(aURI, luid); + + } + else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*")) + != KErrNotFound && NumOfUriSegs(aURI) == 10) + { + TPtrC8 ptr = NSmlDmURI::ParentURI(aURI); + TPtrC8 ptr2 = NSmlDmURI::ParentURI(ptr); + + HBufC8* eapLuidBuf = iCallBack->GetLuidAllocL(ptr2); + + TInt index = GetIdFromLuid(*eapLuidBuf); + + delete eapLuidBuf; + + EapCertificateEntry *entry = new (ELeave) EapCertificateEntry; + iEAPBuffer[index]->iEAPSettings->iCertificates.Append(entry); + iEAPBuffer[index]->iEAPSettings->iCertificatesPresent = ETrue; + iEAPBuffer[index]->iStatusRefArray.AppendL(aStatusRef); + + TBuf8<2> luid; + luid.Num(iEAPBuffer[index]->iEAPSettings->iCertificates.Count() - 1); + + DBG_ARGS8( + _S8( + "WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"), + &aURI, &luid); + iCallBack->SetMappingL(aURI, luid); + } + _DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::ExecuteCommandL +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::ExecuteCommandL(const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, + const TDesC8& /*aType*/, TInt aStatusRef) + { + _DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::ExecuteCommandL ( .. RWriteStream ..) +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::ExecuteCommandL(const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, TInt aStatusref) + { + _DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): begin"); + iCallBack->SetStatusL(aStatusref, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::CopyCommandL +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::CopyCommandL(const TDesC8& /*aTargetURI*/, + const TDesC8& /*aTargetLUID*/, const TDesC8& /* aSourceURI*/, + const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/, + TInt aStatusRef) + { + _DBG_FILE("CNSmlWLanAdapter::CopyCommandL(): begin"); + iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); + _DBG_FILE("CNSmlWLanAdapter::CopyCommandL(): end"); + } +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::StartAtomicL +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::StartAtomicL() + { + _DBG_FILE("CNSmlWLanAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::StartAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::CommitAtomicL +// not supported +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::CommitAtomicL() + { + _DBG_FILE("CNSmlWLanAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::CommitAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::RollbackAtomicL +// returns EError +//------------------------------------------------------------------------------ +void CNSmlWLanAdapter::RollbackAtomicL() + { + _DBG_FILE("CNSmlWLanAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::RollbackAtomicL(): end"); + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::StreamingSupport +// returns EFalse +//------------------------------------------------------------------------------ + +TBool CNSmlWLanAdapter::StreamingSupport(TInt& /*aItemSize*/) + { + _DBG_FILE("CNSmlWLanAdapter::StreamingSupport(): begin"); + _DBG_FILE("CNSmlWLanAdapter::StreamingSupport(): end"); + return EFalse; + } + +//------------------------------------------------------------------------------ +// CNSmlWLanAdapter::StreamCommittedL +// not used in this adapter +//------------------------------------------------------------------------------ + +void CNSmlWLanAdapter::StreamCommittedL() + { + _DBG_FILE("CNSmlWLanAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CNSmlWLanAdapter::StreamCommittedL(): end"); + } + +//----------------------------------------------------------------------------- +// CNSmlWLanAdapter* CNSmlWLanAdapter::CompleteOutstandingCmdsL( ) +//----------------------------------------------------------------------------- +void CNSmlWLanAdapter::CompleteOutstandingCmdsL() + { + _DBG_FILE("CNSmlWLanAdapter::CompleteOutStandingCmdsL(): begin"); + + ExecuteBufferL(ETrue); + + _DBG_FILE("CNSmlWLanAdapter::CompleteOutStandingCmdsL(): end"); + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC8 CNSmlWLanAdapter::GetLastUriSeg(const TDesC8& aURI) +// Returns only the last uri segemnt +// ------------------------------------------------------------------------------------------------ +TPtrC8 CNSmlWLanAdapter::GetLastUriSeg(const TDesC8& aURI) + { + _DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): begin"); + + TInt i; + for (i = aURI.Length() - 1; i >= 0; i--) + { + if (aURI[i] == '/') + { + break; + } + } + + if (i == 0) + { + _DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): end"); + return aURI; + } + else + { + _DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): end"); + return aURI.Mid(i + 1); + } + } + +// ------------------------------------------------------------------------------------------------ +// TPtrC16 CNSmlWLanAdapter::RemoveLastURISeg(const TDesC8& aURI) +// returns parent uri, i.e. removes last uri segment +// ------------------------------------------------------------------------------------------------ +TPtrC8 CNSmlWLanAdapter::RemoveLastUriSeg(const TDesC8& aURI) + { + _DBG_FILE("CNSmlWLanAdapter::RemoveLastUriSeg(): begin"); + + TInt i; + for (i = aURI.Length() - 1; i >= 0; i--) + { + if (aURI[i] == '/') + { + break; + } + } + + _DBG_FILE("CNSmlWLanAdapter::RemoveLastUriSeg(): end"); + return aURI.Left(i); + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::DesToInt( const TDesC8& aLuid ) +// Returns aLuid as integer value +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::DesToInt(const TDesC8& aLuid) + { + _DBG_FILE("CNSmlWLanAdapter::DesToInt(): begin"); + + TLex8 lex(aLuid); + TInt value = 0; + lex.Val(value); + + DBG_ARGS8(_S8("WLanAdapter::DesToInt() - Des: <%S> Int: <%D>"), &aLuid, + value); + _DBG_FILE("CNSmlWLanAdapter::DesToInt(): end"); + return value; + } + +// ------------------------------------------------------------------------------------------------ +// HBufC* CNSmlWLanAdapter::IntToDesLC(const TInt aLuid) +// ------------------------------------------------------------------------------------------------ +HBufC* CNSmlWLanAdapter::IntToDesLC(const TInt aLuid) + { + _DBG_FILE("CNSmlWLanAdapter::IntToDesLC(): begin"); + + HBufC* buf = HBufC::NewLC(10); + TPtr ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + + _DBG_FILE("CNSmlWLanAdapter::IntToDesLC(): end"); + return buf; + } + +// ------------------------------------------------------------------------------------------------ +// HBufC8* CNSmlWLanAdapter::IntToDes8LC(const TInt aLuid) +// ------------------------------------------------------------------------------------------------ +HBufC8* CNSmlWLanAdapter::IntToDes8LC(const TInt aLuid) + { + _DBG_FILE("CNSmlWLanAdapter::IntToDes8LC(): begin"); + + HBufC8* buf = HBufC8::NewLC(10); + TPtr8 ptrBuf = buf->Des(); + ptrBuf.Num(aLuid); + + _DBG_FILE("CNSmlWLanAdapter::IntToDes8LC(): end"); + return buf; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::NumOfUriSegs( const TDesC8& aUri ) +// Return count of URI segments of aUri +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::NumOfUriSegs(const TDesC8& aUri) + { + _DBG_FILE("CNSmlWLanAdapter::NumOfUriSegs(): begin"); + + TInt count = 1; + for (TInt i = 0; i < aUri.Length(); i++) + { + if (aUri[i] == '/') + count++; + } + + _DBG_FILE("CNSmlWLanAdapter::NumOfUriSegs(): end"); + return count; + } + +// ------------------------------------------------------------------------------------- +// CNSmlWLanAdapter::FillNodeInfoL() +// Fills the node info in ddf structure +// ------------------------------------------------------------------------------------- +void CNSmlWLanAdapter::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); + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetEAPIdFromUri( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetEAPIdFromUri(const TDesC8& aUri) + { + DBG_ARGS8(_S8("WLanAdapter::GetEAPIdFromUri - <%S>"), &aUri); + + if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) == KErrNotFound) + { + return KErrNotFound; + } + + TInt begin = aUri.Find(_L8("/EAPId")) + 6; + if (begin == KErrNotFound) + { + return KErrNotFound; + } + + TInt eapId = DesToInt(aUri.Mid(begin, 3)); + + return eapId; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetEncapsEAPIdFromUri( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetEncapsEAPIdFromUri(const TDesC8& aUri) + { + DBG_ARGS8(_S8("WLanAdapter::GetEncapsEAPIdFromUri - <%S>"), &aUri); + + if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/EAPId*-*")) == KErrNotFound) + { + return KErrNotFound; + } + + TInt begin = aUri.Find(_L8("/EAPId")) + 9; + if (aUri[begin] != '-') + { + return KErrNotFound; + } + begin++; + TInt end = -1; + TInt count; + + for (count = 0; count + begin < aUri.Length(); count++) + { + if (aUri[begin + count] == '/') + { + end = begin + count; + break; + } + else if (aUri.Length() == begin + count + 1) + { + count++; + end = begin + count; + break; + } + } + + if (end > 0) + { + TInt eapId = DesToInt(aUri.Mid(begin, count)); + return eapId; + } + return KErrNotFound; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetEAPIdFromUriL( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetServiceIdFromUriL(const TDesC8& aURI) + { + DBG_ARGS8(_S8("WLanAdapter::GetServiceIdFromUriL - <%S>"), &aURI); + + if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP*")) == KErrNotFound) + { + return KErrNotFound; + } + + TInt end = aURI.Find(_L8("/EAP")) + 4; + + if (end > 0) + { + + HBufC8* luidBuf = iCallBack->GetLuidAllocL(aURI.Left(end)); + + TInt serviceId = GetIdFromLuid(*luidBuf); + + delete luidBuf; + + return serviceId; + } + return KErrNotFound; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetSecSSIDFromUriL( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TUint32 CNSmlWLanAdapter::GetSecSSIDFromUriL(const TDesC8& aUri) + { + DBG_ARGS8(_S8("WLanAdapter::GetSecSSIDFromUriL - <%S>"), &aUri); + + if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*")) + == KErrNotFound) + { + User::Leave(KErrNotFound); + } + _LIT8(KSSIDString, "/SecondarySSID/SecSSID"); + TInt begin = aUri.Find(KSSIDString) + KSSIDString().Length(); + TInt end = -1; + TInt count; + + for (count = 0; count + begin < aUri.Length(); count++) + { + if (aUri[begin + count] == '/') + { + end = begin + count; + break; + } + else if (aUri.Length() == begin + count + 1) + { + count++; + end = begin + count; + break; + } + } + + if (end > 0) + { + TLex8 lex(aUri.Mid(begin, count)); + TUint32 value = 0; + lex.Val(value, EDecimal); + return value; + } + else + { + User::Leave(KErrNotFound); + } + return 0; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetEAPIdFromUri( const TDesC8& aUri ) +// Return WLan ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetCertificateIdFromUri(const TDesC8& aUri) + { + DBG_ARGS8(_S8("WLanAdapter::GetCertificateIdFromUri - <%S>"), &aUri); + + if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*")) + == KErrNotFound) + { + return KErrNotFound; + } + _LIT8(KCertString, "/Certificate/CertId"); + + TInt begin = aUri.Find(KCertString); + if (begin == KErrNotFound) + { + return KErrNotFound; + } + + begin += KCertString().Length(); + + TInt end = -1; + TInt count; + + for (count = 0; count + begin < aUri.Length(); count++) + { + if (aUri[begin + count] == '/') + { + end = begin + count; + break; + } + else if (aUri.Length() == begin + count + 1) + { + count++; + end = begin + count; + break; + } + } + + if (end > 0) + { + TInt certId = DesToInt(aUri.Mid(begin, count)); + return certId; + } + return KErrNotFound; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetWepKeyIdFromUri( const TDesC8& aUri ) +// Returns WepKey ID number from URI +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetWepKeyIdFromUri(const TDesC8& aUri) + { + if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*")) == KErrNotFound) + { + return KErrNotFound; + } + + TInt begin = aUri.Find(_L8("WEPKey/WKId")) + 11; + TInt end = -1; + TInt count; + + for (count = 0; count < aUri.Length() - 11; count++) + { + if (aUri[begin + count] == '/') + { + end = begin + count; + break; + } + + else if (aUri.Length() == begin + count + 1) + { + count++; + end = begin + count; + break; + } + } + + if (end > 0) + { + TInt wlanId = DesToInt(aUri.Mid(begin, count)); + return wlanId; + } + return KErrNotFound; + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetWepKeyIdFromLuid( const TDesC8& aLuid ) +// Return id number of wepkey +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetWepKeyIdFromLuid(const TDesC8& aLuid) + { + TLex8 iLex(aLuid); + + TInt luid; + if (iLex.Val(luid) == KErrNone) + { + if (luid > 1000) + { + return luid / 1000; + } + else + { + return KErrNotFound; + } + } + else + { + return KErrNotFound; + } + } + +// ------------------------------------------------------------------------------------------------ +// TInt CNSmlWLanAdapter::GetIdFromLuid( const TDesC& aLuid ) +// Return luid of wlan node +// ------------------------------------------------------------------------------------------------ +TInt CNSmlWLanAdapter::GetIdFromLuid(const TDesC8& aLuid) + { + TLex8 iLex(aLuid); + + TInt luid; + if (iLex.Val(luid) == KErrNone) + { + if (luid < 1000) + { + return luid; + } + else + { + TInt tmp = luid / 1000 * 1000; //First number of luid > 1000 + return luid - tmp; + } + } + else + { + return KErrNotFound; + } + } + +// ------------------------------------------------------------------------------------------------ +// void CNSmlWLanAdapter::ExecuteBufferL( TBool aFinal ) +// Executes buffered commands from iBuffer +// ------------------------------------------------------------------------------------------------ +void CNSmlWLanAdapter::ExecuteBufferL(TBool aFinal) + { + for (TInt index = 0; index < iBuffer->Count(); index++) + { + DBG_ARGS8(_S8( + "WLanAdapter::ExecuteBuffer(): Buf count: <%D> index: <%D>"), + iBuffer->Count(), index); + + if (iBuffer->At(index).iExecuted) + { + continue; + } + TInt err = 0; + + TInt luid = iBuffer->At(index).iLuid; + TInt wepKeyId = iBuffer->At(index).iWepKeyId; + if (!wepKeyId && !aFinal) + { + continue; + } + + if (wepKeyId > 4 || !wepKeyId && aFinal) + { + if (iBuffer->At(index).iDataStatusRef) + iCallBack->SetStatusL(iBuffer->At(index).iDataStatusRef, + CSmlDmAdapter::EError); + if (iBuffer->At(index).iNodeStatusRef) + iCallBack->SetStatusL(iBuffer->At(index).iNodeStatusRef, + CSmlDmAdapter::EError); + if (iBuffer->At(index).iLengthStatusRef) + iCallBack->SetStatusL(iBuffer->At(index).iLengthStatusRef, + CSmlDmAdapter::EError); + + iBuffer->At(index).iIdStatusRef = 0; + iBuffer->At(index).iNodeStatusRef = 0; + iBuffer->At(index).iDataStatusRef = 0; + iBuffer->At(index).iLengthStatusRef = 0; + iBuffer->At(index).iExecuted = ETrue; + + continue; + } + + if (iBuffer->At(index).iDataSet && iBuffer->At(index).iWepKeyId > 0) + { + iWlanSettings->GetWlanSettings(luid, *iSettings); + + switch (wepKeyId) + { + case 1: + iSettings->WepKey1 = iBuffer->At(index).iData->Des(); + break; + case 2: + iSettings->WepKey2 = iBuffer->At(index).iData->Des(); + break; + case 3: + iSettings->WepKey3 = iBuffer->At(index).iData->Des(); + break; + case 4: + iSettings->WepKey4 = iBuffer->At(index).iData->Des(); + break; + default: + continue; + } + + err = iWlanSettings->WriteWlanSettings(*iSettings); + if (err == KErrNone) + { + iCallBack->SetStatusL(iBuffer->At(index).iDataStatusRef, + CSmlDmAdapter::EOk); + } + else + { + iCallBack->SetStatusL(iBuffer->At(index).iDataStatusRef, + CSmlDmAdapter::EError); + } + + iBuffer->At(index).iDataStatusRef = 0; + } + + TBuf8<5> addLUID; + addLUID.AppendNum(wepKeyId); + addLUID.AppendNumFixedWidth(luid, EDecimal, 3); + + iCallBack->SetMappingL(iBuffer->At(index).iUri->Des(), addLUID); + if (iBuffer->At(index).iIdStatusRef) + iCallBack->SetStatusL(iBuffer->At(index).iIdStatusRef, + CSmlDmAdapter::EOk); + if (iBuffer->At(index).iNodeStatusRef) + iCallBack->SetStatusL(iBuffer->At(index).iNodeStatusRef, + CSmlDmAdapter::EOk); + if (iBuffer->At(index).iLengthStatusRef) + iCallBack->SetStatusL(iBuffer->At(index).iLengthStatusRef, + CSmlDmAdapter::EOk); + + iBuffer->At(index).iIdStatusRef = 0; + iBuffer->At(index).iNodeStatusRef = 0; + iBuffer->At(index).iLengthStatusRef = 0; + iBuffer->At(index).iExecuted = ETrue; + } + + //Clean executed command from buffer + for (TInt i = 0; i < iBuffer->Count(); i++) + { + if (iBuffer->At(i).iExecuted) + { + if (iBuffer->At(i).iUri) + { + delete iBuffer->At(i).iUri; + iBuffer->At(i).iUri = 0; + } + if (iBuffer->At(i).iData) + { + delete iBuffer->At(i).iData; + iBuffer->At(i).iData = 0; + } + iBuffer->Delete(i); + iBuffer->Compress(); + } + } + // Secondary SSID Buffer + for (TInt index = 0; index < iSecondaryBuffer.Count(); index++) + { + DBG_ARGS8(_S8( + "WLanAdapter::ExecuteBuffer(): Buf count: <%D> index: <%D>"), + iBuffer->Count(), index); + + if (iSecondaryBuffer[index]->iExecuted) + { + continue; + } + + TSecondarySSID ssid; + ssid.ScannedId = iSecondaryBuffer[index]->ScannedId; + ssid.UsedId = iSecondaryBuffer[index]->UsedId; + + DBG_ARGS8( + _S8( + "CWlanadaptes::Execute Buffer - WLAN_SEC_SSID_SCANNED_SSID uri: <%S> ad WLAN_SEC_SSID_USED_SSID : <%S>"), + &iSecondaryBuffer[index]->ScannedId, + &iSecondaryBuffer[index]->UsedId); + + TInt retval = iWlanSettings->WriteSecondarySSIDL( + iSecondaryBuffer[index]->wlanLuid, ssid, ETrue); + iSecondaryBuffer[index]->iExecuted = ETrue; + + } + TBuf eapList; + eapList.Copy(KEapAll); + // EAP settings + for (TInt i = 0; i < iEAPBuffer.Count(); i++) + { + + // Save EAP list + if (iEAPBuffer[i]->iEapTypeString.Length() > 0 + && iEAPBuffer[i]->iEncapsulatingString.Length() == 0) // AND method is not encapsulated + { + + TBuf8<3> buf; + _LIT8(KFormat, "%d"); + // pick the last byte from the array + buf.Format(KFormat, + iEAPBuffer[i]->iEapTypeString[KExpandedEapIdLength - 1]); + // search for the correct offset for the eap type from the KEapAll literal + TInt index = KEapAll().Find(buf); + + const TUint8 offset = 2; //length = f "-0" string + // Add '+' to the correct offset, so that the eap is repsesented activated in the list + if (index >= offset) + { + eapList[index - offset] = KEapPlus; + } + + } + + // Check if this method has encapsulated methods + for (TInt j = 0; j < iEAPBuffer.Count(); j++) + { + if (iEAPBuffer[i]->iEAPSettings->iEAPExpandedType + == iEAPBuffer[j]->iEncapsulatingExpandedEapId) + { + // j is encapsulated inside i + iEAPBuffer[i]->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( + iEAPBuffer[j]->iEAPSettings->iEAPExpandedType); + iEAPBuffer[i]->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypesPresent + = ETrue; + } + } + + TRAPD(err, iWlanSettings->GetEAPInterfaceL( + iEAPBuffer[i]->iWLANServiceId, + iEAPBuffer[i]->iEncapsulatingExpandedEapId, + iEAPBuffer[i]->iEAPSettings->iEAPExpandedType)); + if (err == KErrNone) + { + err = iWlanSettings->WriteEAPSettings( + *iEAPBuffer[i]->iEAPSettings); + } + + MSmlDmAdapter::TError status; + switch (err) + { + case KErrNotFound: + { + status = CSmlDmAdapter::ENotFound; + break; + } + case KErrNone: + { + status = CSmlDmAdapter::EOk; + break; + } + default: + { + status = CSmlDmAdapter::EError; + } + } + + for (TInt j = 0; j < iEAPBuffer[i]->iStatusRefArray.Count(); j++) + { + iCallBack->SetStatusL(iEAPBuffer[i]->iStatusRefArray[j], status); + } + } + + // Expanded EAP types in use. Write the eap list to the new columns. + + // generate appropriate entries in the new enabled and disabled list, + // overwriting those values + + // count the + and - signs to determine the size of enabled and + // disabled descriptors + + TLex lex(eapList); + TInt numPlus = 0; + TInt numMinus = 0; + TChar ch; + while (!lex.Eos()) + { + ch = lex.Get(); + if (ch == '+') + ++numPlus; + else if (ch == '-') + ++numMinus; + } + // load general EAP settings If + CEapGeneralSettings* genSettings; + genSettings = CEapGeneralSettings::NewL(ELan, iSettings->ServiceID); + CleanupStack::PushL(genSettings); + + // get lists of enabled/disabled EAPs for the IAP + + RArray enabledEapMethods; + RArray disabledEapMethods; + + enabledEapMethods.Reset(); + disabledEapMethods.Reset(); + + lex.Assign(eapList); + + while (!lex.Eos()) + { + // beginning of implementation UID + TInt16 implUid = 0; + + if (lex.Val(implUid) != KErrNone || !implUid) + { + break; + } + + // append it to the appropriate list ('+' enabled, '-' disabled) + _LIT8(KPadding, "\xFE\0\0\0\0\0\0"); + _LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); + const TInt KPlainMsChapV2ImplUid = 99; + + if (implUid > 0) + { + TBuf8 tempbuf; + if (Abs(implUid) == KPlainMsChapV2ImplUid) + { + tempbuf.Append(KMsChapV2Padding); + } + else + { + tempbuf.Append(KPadding); + } + tempbuf.Append(Abs(implUid)); + TEapExpandedType expandedTypebuf(tempbuf); + enabledEapMethods.Append(expandedTypebuf); + } + + // swallow the delimiter (',') + lex.Get(); + } + + if (numPlus != NULL) + { + genSettings->SetEapMethods(enabledEapMethods, disabledEapMethods); + } + + CleanupStack::PopAndDestroy(genSettings); + + for (TInt i = 0; i < iEAPBuffer.Count(); i++) + { + iEAPBuffer[i]->iStatusRefArray.Close(); + iEAPBuffer[i]->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Close(); + iEAPBuffer[i]->iEAPSettings->iDisabledEncapsulatedEAPExpandedTypes.Close(); + iEAPBuffer[i]->iEAPSettings->iCipherSuites.Close(); + delete iEAPBuffer[i]->iEAPSettings; + iEAPBuffer[i]->iEAPSettings = NULL; + } + iEAPBuffer.ResetAndDestroy(); + } + +//============================================= +// CNSmlWLanAdapter::ConvertTo8LC() +// Converts string value to 8-bit +// +//============================================= +TDesC8& CNSmlWLanAdapter::ConvertTo8LC(const TDesC& aSource) + { + HBufC8* buf = HBufC8::NewLC(aSource.Length() * 2); + TPtr8 bufPtr = buf->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8(bufPtr, aSource); + + return *buf; + } + +//============================================= +// CNSmlWLanAdapter::ConvertTo16LC() +// Converts string value to 16-bit +// +//============================================= +TDesC16& CNSmlWLanAdapter::ConvertTo16LC(const TDesC8& aSource) + { + HBufC16* buf16 = HBufC16::NewLC(aSource.Length()); + TPtr bufPtr16 = buf16->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8(bufPtr16, aSource); + + return *buf16; + } + +void CNSmlWLanAdapter::ResetEAPStructL() + { + DeleteEAPStructL(); + iEAPSettings = new (ELeave) EAPSettings; + } + +void CNSmlWLanAdapter::DeleteEAPStructL() + { + if (iEAPSettings != NULL) + { + if (iEAPSettings->iCertificatesPresent) + { + iEAPSettings->iCertificates.Reset(); + } + iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Close(); + iEAPSettings->iDisabledEncapsulatedEAPExpandedTypes.Close(); + iEAPSettings->iCipherSuites.Close(); + + delete iEAPSettings; + iEAPSettings = NULL; + } + } + +void CNSmlWLanAdapter::DesToBufferL(CBufBase& aTo, const TDesC& aFrom) + { + aTo.InsertL(0, ConvertTo8LC(aFrom)); + CleanupStack::PopAndDestroy(); // ConvertTo8LC + } + +void CNSmlWLanAdapter::FillCipherSuiteBufferL(CBufBase& aBuffer) + { + if (iEAPSettings == NULL || !iEAPSettings->iCipherSuitesPresent) + { + return; + } + // 0 5 10 15 20 25 30 35 + _LIT8(KPlus, "+"); + aBuffer.InsertL(0, KSuitesDefault); + TInt count = iEAPSettings->iCipherSuites.Count(); + for (TInt i = count - 1; i >= 0; --i) + { + switch (iEAPSettings->iCipherSuites[i]) + { + case RSA_3DES_SHA: + { + aBuffer.Write(0, KPlus); + break; + } + case DHE_RSA_3DES_SHA: + { + aBuffer.Write(5, KPlus); + break; + } + case DHE_DSS_3DES_SHA: + { + aBuffer.Write(10, KPlus); + break; + } + case RSA_AES_SHA: + { + aBuffer.Write(15, KPlus); + break; + } + case DHE_RSA_AES_SHA: + { + aBuffer.Write(20, KPlus); + break; + } + case DHE_DSS_AES_SHA: + { + aBuffer.Write(25, KPlus); + break; + } + case RSA_RC4_MD5: + { + aBuffer.Write(30, KPlus); + break; + } + case RSA_RC4_SHA: + { + aBuffer.Write(35, KPlus); + break; + } + default: + { + break; + } + + } + } + + } + +void CNSmlWLanAdapter::FillCipherSuitesL(const TDesC8& aObject, + const TInt aLuid) + { + if (iEAPBuffer[aLuid] == NULL) + { + return; + } + iEAPBuffer[aLuid]->iEAPSettings->iCipherSuites.Reset(); + iEAPBuffer[aLuid]->iEAPSettings->iCipherSuitesPresent = EFalse; // init to EFalse + + TChar plus('+'); + + TInt length = aObject.Length(); + for (TInt i = 0; i + 3 < length; i += 5) + { + if (aObject[i] == plus) + { + TLex8 lex(aObject.Mid(i + 1, 3)); + TUint suite; + lex.Val(suite); + iEAPBuffer[aLuid]->iEAPSettings->iCipherSuites.Append(suite); + iEAPBuffer[aLuid]->iEAPSettings->iCipherSuitesPresent = ETrue; + } + } + } + +void CNSmlWLanAdapter::ConvertEAPStringToIds(TDes8& aEAPString, + TEapExpandedType& aId) + { + if (aId.Compare(*EapExpandedTypeSim.GetType()) == 0) + { + aEAPString.Copy(KEapSimTypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypeAka.GetType()) == 0) + { + aEAPString.Copy(KEapAkaTypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypeTtls.GetType()) == 0) + { + aEAPString.Copy(KEapTlsTypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypePeap.GetType()) == 0) + { + aEAPString.Copy(KEapPeapTypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypeTtls.GetType()) == 0) + { + aEAPString.Copy(KEapTtlsTypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypeLeap.GetType()) == 0) + { + aEAPString.Copy(KEapLeapTypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypeMsChapv2.GetType()) == 0) + { + aEAPString.Copy(KEapMschapv2TypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedPlainMsChapv2.GetType()) == 0) + { + aEAPString.Copy(KMschapv2TypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypeGtc.GetType()) == 0) + { + aEAPString.Copy(KEapGtcTypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypeFast.GetType()) == 0) + { + aEAPString.Copy(KEapFastTypeId, KExpandedEAPIdLength); + } + else if (aId.Compare(*EapExpandedTypeTtlsPap.GetType()) == 0) + { + aEAPString.Copy(KTtlspapTypeId, KExpandedEAPIdLength); + } + else + { + aEAPString.Copy(KEapNoneId, KExpandedEAPIdLength); + } + + } + +void CNSmlWLanAdapter::GetExpandedType(const TInt aEapType, + const TInt aTunnelingType, TEapExpandedType& aExpanedId, + TEapExpandedType& aExpanedEncapsId) + { + + // append it to the appropriate list ('+' enabled, '-' disabled) + _LIT8(KPadding, "\xFE\0\0\0\0\0\0"); + _LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); + const TInt KPlainMsChapV2ImplUid = 99; + + TBuf8 cmpbuf; + if (aEapType == KPlainMsChapV2ImplUid) + { + cmpbuf.Append(KMsChapV2Padding); + } + else + { + cmpbuf.Append(KPadding); + } + cmpbuf.Append(aEapType); + aExpanedId = cmpbuf; + + TBuf8 encapscmpbuf; + if (aTunnelingType == KPlainMsChapV2ImplUid) + { + encapscmpbuf.Append(KMsChapV2Padding); + } + else + { + encapscmpbuf.Append(KPadding); + } + encapscmpbuf.Append(aTunnelingType); + aExpanedEncapsId = encapscmpbuf; + + } + +// end of file diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/nsmldminternet/src/NSmlWlanSettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/nsmldminternet/src/NSmlWlanSettings.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,1721 @@ +/* + * Copyright (c) 2002-2006 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: Wlan Adapter DB handler + * + */ + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include "NSmlWlanSettings.h" +#include "NSmlWLanAdapter.h" +#include "nsmldebug.h" +#include +#include // vsettingenforcementinfo +#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 KEAPListBufferSize = 128; +const TUint KLengthOfOldStyleEAPListEntry = 5; // "+xxx," + +const TInt KBeginTransRetryDelay = 1000000; // Delay for comms db begintransaction retry (microseconds) +const TInt KBeginTransRetryCount = 7; // Maximum number of retries +//----------------------------------------------------------------------------- +// CWlanAdapter::CWlanSettings( CCommsDatabase& aDatabase ) +//----------------------------------------------------------------------------- +CWlanSettings::CWlanSettings(CCommsDatabase& aDatabase) : + iDatabase(aDatabase), iExpandedEAPTypeFieldsUsed(ETrue) + { + _DBG_FILE("CWlanSettings::CWlanSettings(): begin"); + + iTableView = 0; + iEapType = NULL; + iSecondaryView = NULL; + + _DBG_FILE("CWlanSettings::CWlanSettings(): end"); + } + +//----------------------------------------------------------------------------- +// CWlanAdapter::~CWlanSettings( ) +//----------------------------------------------------------------------------- +CWlanSettings::~CWlanSettings() + { + + delete iEapType; + delete iSecondaryView; + delete iTableView; + } + +//----------------------------------------------------------------------------- +// CWlanSettings* CWlanSettings::NewL( CCommsDatabase& aDatabase ) +//----------------------------------------------------------------------------- +CWlanSettings* CWlanSettings::NewL(CCommsDatabase& aDatabase) + { + _DBG_FILE("CWlanSettings::NewL(): begin"); + + CWlanSettings* self = new (ELeave) CWlanSettings(aDatabase); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + _DBG_FILE("CWlanSettings::NewL(): end"); + return self; + } + +//----------------------------------------------------------------------------- +// void CWlanSettings::ConstructL( ) +//----------------------------------------------------------------------------- +void CWlanSettings::ConstructL() + { + _DBG_FILE("CWlanSettings::ConstructL(): begin"); + _DBG_FILE("CWlanSettings::ConstructL(): end"); + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::GetWlanSettings( TUint32 aLuid, TWlanSettings& aWlanSettings ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::GetWlanSettings(TUint32 aLuid, + TWlanSettings& aWlanSettings) + { + _DBG_FILE("CWlanSettings::GetWlanSettings(): begin"); + + TRAPD(err, ConnectToDatabaseL()); + if (err == KErrNone) + { + err = GoToRecord(aLuid); + + if (err == KErrNone) + { + TRAP(err, GetDataFromRecordL(&aWlanSettings)); + } + } + + _DBG_FILE("CWlanSettings::GetWlanSettings(): end"); + return err; + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::GetEapSettings( TInt aId, TWlanSettings& aWlanSettings ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::GetEAPSettings(const TInt aId, + TEapExpandedType& aExpandedId, TEapExpandedType& aEncapsId, + EAPSettings& aEapSettings) + { + _DBG_FILE("CWlanSettings::GetEapSettings(): begin"); + + TRAPD(err, GetEAPInterfaceL(aId, aEncapsId, aExpandedId)); + DBG_ARGS(_S16("GetEAPInterfaceL leaved with %d"), err); + if (err == KErrNone) + { + TRAP(err, iEapType->GetConfigurationL(aEapSettings)); + DBG_ARGS(_S16("iEapType->GetConfigurationL leaved with %d"), err); + } + + _DBG_FILE("CWlanSettings::GetEAPSettings(): end"); + return err; + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::DeleteWlanSettings( TUint32 aLuid ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::DeleteWlanSettings(TUint32 aLuid) + { + _DBG_FILE("CWlanSettings::DeleteWlanSettings(): begin"); + TBool wlanEnforce = EFalse; + TInt tableLockError = KErrNone; + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TInt enError = KErrNone; + TRAP(enError, wlanEnforce = CheckEnforcementL()); + DBG_ARGS( + _S16( + "CWlanSettings::DeleteWLANSettings, check enforcement failed. error: <%D>"), + enError); + if (wlanEnforce) + { + _DBG_FILE( + "CWlanSettings::WriteWlanSettings(): wlan enforce is ON "); + TRAPD(lockError, tableLockError = PerformLockWLANTablesL(EFalse)); + if (lockError == KErrNone && tableLockError == KErrNone) + { + _DBG_FILE( + "CWlanSettings::WriteWlanSettings(): Table unlcoked successfully "); + iWLANRelock = ETrue; + } + } + } + + TRAPD(err, ConnectToDatabaseL()); + if (err == KErrNone) + { + err = GoToRecord(aLuid); + if (err == KErrNone) + { + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (wlanEnforce) + { + ((CCommsDbProtectTableView*) iTableView)->UnprotectRecord(); + } + } + + TInt err = iTableView->UpdateRecord(); + if (err == KErrLocked) + { + _DBG_FILE("DeleteWlanSettings: UpdateRecord was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && err == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteWlanSettings: Slept 1 second. Try again"); + err = iTableView->UpdateRecord(); + retry--; + } + if (err != KErrNone) + { + _DBG_FILE( + "DeleteWlanSettings: UpdateRecord was unsuccessful"); + } + else + { + _DBG_FILE( + "DeleteWlanSettings: UpdateRecord was successful"); + } + } + + if (err == KErrNone) + { + TRAP(err, iTableView->WriteUintL(TPtrC(WLAN_SERVICE_ID), 0)); + if (err != KErrNone) + { + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TInt tableLockError = KErrNone; + if (iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError, tableLockError + = PerformLockWLANTablesL(ETrue)); + ((CCommsDbProtectTableView*) iTableView)->ProtectRecord(); + DBG_ARGS( + _S16( + "CWlanSettings::DeleteWLANSettings, WLAN table Lock error. error: <%D>, <%D> "), + lockError, tableLockError); + iWLANRelock = EFalse; + } + if (tableLockError != KErrNone) // to remove warnings + { + tableLockError = KErrNone; + } + } + return err; + } + } + err = iTableView->PutRecordChanges(); + if (err == KErrLocked) + { + _DBG_FILE("DeleteWlanSettings: PutRecordChanges was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && err == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteWlanSettings: Slept 1 second. Try again"); + err = iTableView->PutRecordChanges(); + retry--; + } + if (err != KErrNone) + { + _DBG_FILE( + "DeleteWlanSettings: PutRecordChanges was unsuccessful"); + } + else + { + _DBG_FILE( + "DeleteWlanSettings: PutRecordChanges was successful"); + } + } + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TInt tableLockError = KErrNone; + if (iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError, tableLockError = PerformLockWLANTablesL( + ETrue)); + DBG_ARGS( + _S16( + "CWlanSettings::DeleteWLANSettings, WLAN table Lock error. error: <%D>, <%D> "), + lockError, tableLockError); + ((CCommsDbProtectTableView*) iTableView)->ProtectRecord(); + iWLANRelock = EFalse; + } + if (tableLockError != KErrNone) // to remove warnings + { + tableLockError = KErrNone; + } + } + + if (err == KErrNone) + { + // Ignore err on purpose + TRAP(err, DeleteSecondarySSIDsL(aLuid)); + + TRAP(err, DeleteWlanEapSettingsL(aLuid)); + } + } + } + + _DBG_FILE("CWlanSettings::DeleteWlanSettings(): end"); + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError, tableLockError = PerformLockWLANTablesL(ETrue)); + DBG_ARGS( + _S16( + "CWlanSettings::DeleteWLANSettings, WLAN table Lock error. error: <%D>, <%D> "), + lockError, tableLockError); + ((CCommsDbProtectTableView*) iTableView)->ProtectRecord(); + iWLANRelock = EFalse; + } + } + + if (wlanEnforce) + wlanEnforce = EFalse; // to get rid of warnings + return err; + } + +TInt CWlanSettings::DeleteOneSecondarySSIDL(TUint32 aWLANId, TUint32 asecId) + { + + TInt retval = KErrNone; + SetSecondaryViewToRecordL(aWLANId); + retval = iSecondaryView->GotoFirstRecord(); + + while (retval == KErrNone) + { + TSecondarySSID ssid; + TRAP(retval, iSecondaryView->ReadUintL(TPtrC(WLAN_SEC_SSID_ID), + ssid.Id)); + if (ssid.Id == asecId) + { + //retval = iSecondaryView->UpdateRecord(); + //if( retval==KErrNone ) + // { + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TBool wlanEnforce = EFalse; + TInt enError = KErrNone; + TRAP(enError, wlanEnforce = CheckEnforcementL()); + DBG_ARGS( + _S16( + "CWlanSettings::DeleteWLANSettings, check enforcement failed. error: <%D>"), + enError); + if (wlanEnforce) + { + ((CCommsDbProtectTableView*) iSecondaryView)->UnprotectRecord(); + } + } + + retval = iSecondaryView->DeleteRecord(); + if (retval == KErrLocked) + { + _DBG_FILE("DeleteOneSecondarySSIDL: DeleteRecord was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && retval == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE( + "DeleteOneSecondarySSIDL: Slept 1 second. Try again"); + retval = iSecondaryView->DeleteRecord(); + retry--; + } + if (retval != KErrNone) + { + _DBG_FILE( + "DeleteOneSecondarySSIDL: DeleteRecord was unsuccessful"); + } + else + { + _DBG_FILE( + "DeleteOneSecondarySSIDL: DeleteRecord was successful"); + } + } + DBG_ARGS( + _S16( + "CWlanSettings::DeleteOneSecondarySSIDL, Secondaryssid delete error: <%D> "), + retval); + + // iTableView->PutRecordChanges( ); + //} + + break; + } + + retval = iSecondaryView->GotoNextRecord(); + } + + return retval; + } + +TInt CWlanSettings::DeleteSecondarySSIDsL(TUint32 aWLANId) + { + TInt retVal(KErrNone); + if (iSecondaryView == NULL) + { + SetSecondaryViewToRecordL(aWLANId); + } + else + { + retVal = iSecondaryView->GotoFirstRecord(); + TUint32 secId = 0; + if (retVal == KErrNone) + { + iSecondaryView->ReadUintL(TPtrC(WLAN_SEC_SSID_SERVICE_ID), secId); + } + if (secId != aWLANId) + { + SetSecondaryViewToRecordL(aWLANId); + } + } + + TInt err = iSecondaryView->GotoFirstRecord(); + while (err == KErrNone) + { + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TBool wlanEnforce = EFalse; + TInt enError = KErrNone; + TRAP(enError, wlanEnforce = CheckEnforcementL()); + DBG_ARGS( + _S16( + "CWlanSettings::DeleteSecondarySSIDsL, check enforcement failed. error: <%D>"), + enError); + if (wlanEnforce) + { + ((CCommsDbProtectTableView*) iSecondaryView)->UnprotectRecord(); + } + } + retVal = iSecondaryView->DeleteRecord(); + if (retVal == KErrLocked) + { + _DBG_FILE("DeleteSecondarySSIDsL: DeleteRecord was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && retVal == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("DeleteSecondarySSIDsL: Slept 1 second. Try again"); + retVal = iSecondaryView->DeleteRecord(); + retry--; + } + if (retVal != KErrNone) + { + _DBG_FILE( + "DeleteSecondarySSIDsL: DeleteRecord was unsuccessful"); + } + else + { + _DBG_FILE( + "DeleteSecondarySSIDsL: DeleteRecord was successful"); + } + } + DBG_ARGS( + _S16( + "CWlanSettings::DeleteSecondarySSIDsL, Secondaryssid delete error: <%D> "), + retVal); + + err = iSecondaryView->GotoNextRecord(); + } + + return retVal; + } +//----------------------------------------------------------------------------- +// TInt CWlanSettings::DeleteEapSettings( TInt aWlanId ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::DeleteEAPSettings(TInt aWlanId) + { + _DBG_FILE("CWlanSettings::DeleteEAPSettings(): begin"); + + TInt err(KErrNone); + + TRAP(err, iEapType->DeleteConfigurationL()); + if (err != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::DeleteEAPSettings, delete failed, error: <%D> "), + err); + return err; + } + + _DBG_FILE("CWlanSettings::DeleteEAPSettings(): end"); + return err; + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::DeleteWlanEapSettings( TInt aWlanId ) +// Deletes all EAPs from a Wlan +//----------------------------------------------------------------------------- +void CWlanSettings::DeleteWlanEapSettingsL(TInt aWlanId) + { + _DBG_FILE("CWlanSettings::DeleteWlanEapSettings(): begin"); + TInt err(KErrNone); + err = DeleteEAPSettings(aWlanId); + User::LeaveIfError(err); + + _DBG_FILE("CWlanSettings::DeleteWlanEapSettings(): end"); + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::WriteWlanSettings( TWlanSettings& aWlanSettings ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::WriteWlanSettings(TWlanSettings& aWlanSettings) + { + _DBG_FILE("CWlanSettings::WriteWlanSettings(): begin"); + + TInt err = 0; + TInt enError = KErrNone; + iServiceID = aWlanSettings.ServiceID; + TBool wlanEnforce = EFalse; + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TRAP(enError, wlanEnforce = CheckEnforcementL()); + DBG_ARGS( + _S16( + "CWlanSettings::WriteWlanSettings, check enforcement . error: <%D>"), + enError); + if (wlanEnforce) + { + TRAPD(lockError, enError = PerformLockWLANTablesL(EFalse)); + if (lockError == KErrNone && enError == KErrNone) + { + iWLANRelock = ETrue; + } + } + } + + if (RecordExists(aWlanSettings.ServiceID) <= 0) + { + err = iTableView->InsertRecord(aWlanSettings.Id); + if (err == KErrLocked) + { + _DBG_FILE("WriteWlanSettings InsertRecord: CommsDat was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && err == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteWlanSettings: Slept 1 second. Try again"); + err = iTableView->InsertRecord(aWlanSettings.Id); + retry--; + } + } + + if (err != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::WriteWlanSettings(): - InsertRecord failed. error: <%D>"), + err); + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TInt tableLockError = KErrNone; + if (iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError, tableLockError = PerformLockWLANTablesL( + ETrue)); + DBG_ARGS( + _S16( + "CWlanSettings::WriteWlanSettings, WLAN table Lock error. error: <%D>, <%D> "), + lockError, tableLockError); + iWLANRelock = EFalse; + } + if (tableLockError != KErrNone) // to remove warnings + { + tableLockError = KErrNone; + } + } + return err; + } + TRAP(err, InitialiseRecordL()); + if (err != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::WriteWlanSettings(): - InitialiseRecord failed. error: <%D>"), + err); + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TInt tableLockError = KErrNone; + if (iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError, tableLockError = PerformLockWLANTablesL( + ETrue)); + DBG_ARGS( + _S16( + "CWlanSettings::WriteWlanSettings, WLAN table Lock error. error: <%D>, <%D> "), + lockError, tableLockError); + iWLANRelock = EFalse; + } + if (tableLockError != KErrNone) // to remove warnings + { + tableLockError = KErrNone; + } + } + return err; + } + } + else + { + err = GoToRecord(aWlanSettings.ServiceID); + if (err == KErrNone) + { + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + if (wlanEnforce) + { + _DBG_FILE( + "CWlanSettings::WriteWlanSettings(): unprotect wlan"); + ((CCommsDbProtectTableView*) iTableView)->UnprotectRecord(); + } + } + + err = iTableView->UpdateRecord(); + if (err == KErrLocked) + { + _DBG_FILE("WriteWlanSettings: UpdateRecord was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && err == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteWlanSettings: Slept 1 second. Try again"); + err = iTableView->UpdateRecord(); + retry--; + } + if (err != KErrNone) + { + _DBG_FILE( + "WriteWlanSettings: UpdateRecord was unsuccessful"); + } + else + { + _DBG_FILE( + "WriteWlanSettings: UpdateRecord was successful"); + } + } + + if (err != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::WriteWlanSettings(): - UpdateRecord failed. error: <%D>"), + err); + + if (FeatureManager::FeatureSupported( + KFeatureIdSapPolicyManagement)) + { + TInt tableLockError = KErrNone; + if (iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError, tableLockError + = PerformLockWLANTablesL(ETrue)); + DBG_ARGS( + _S16( + "CWlanSettings::WriteWlanSettings, WLAN table Lock error. error: <%D>, <%D> "), + lockError, tableLockError); + ((CCommsDbProtectTableView*) iTableView)->ProtectRecord(); + iWLANRelock = EFalse; + } + if (tableLockError != KErrNone) // to remove warnings + { + tableLockError = KErrNone; + } + } + return err; + } + } + } + + TRAP(err, WriteDataToRecordL(&aWlanSettings)); + + if (err == KErrNone) + { + _DBG_FILE("CWlanSettings::WriteWlanSettings(): PutRecordChanges"); + err = iTableView->PutRecordChanges(); + if (err == KErrLocked) + { + _DBG_FILE("WriteWlanSettings: PutRecordChanges was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && err == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteWlanSettings: Slept 1 second. Try again"); + err = iTableView->PutRecordChanges(); + retry--; + } + } + if (err != KErrNone) + { + _DBG_FILE("WriteWlanSettings: PutRecordChanges was unsuccessful"); + } + else + { + _DBG_FILE("WriteWlanSettings: PutRecordChanges was successful"); + } + } + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (iWLANRelock) + { + TInt lockError = KErrNone; + TRAP(lockError, enError = PerformLockWLANTablesL(ETrue)); + DBG_ARGS( + _S16( + "CWlanSettings::WriteWlanSettings, WLAN table Lock error. error: <%D>, <%D> "), + lockError, enError); + iWLANRelock = EFalse; + } + } + DBG_ARGS(_S16("CWlanSettings::WriteWlanSettings(): end. err: <%D>"), err); + return err; + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::WriteWlanSettings( TWlanSettings& aWlanSettings ) +//----------------------------------------------------------------------------- +TInt CWlanSettings::WriteSecondarySSIDL(TUint32 aWlanID, + TSecondarySSID& aSettings, TBool aNew) + { + + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): begin"); + + TUint32 id = 0; + delete iSecondaryView; + iSecondaryView = NULL; + + TInt retval = KErrNone; + TInt reLock = EFalse; + TBool apEnforce = EFalse; + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + TRAPD(eError,apEnforce=CheckEnforcementL()) + DBG_ARGS8(_S8("CNSmlInternetAdapter::WriteSecondarySSIDL(): EError %d , APEnforcement is %d"),eError,apEnforce); + if (eError == KErrNone && apEnforce) + { + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): set db protect"); + TInt enError = KErrNone; + TInt lockError = KErrNone; + TRAP(lockError, enError = PerformLockWLANTablesL(EFalse)); + reLock = ETrue; + if (enError != KErrNone) // to remove warnings + { + enError = KErrNone; + } + } + } + + if (aNew) + { + _DBG_FILE("CWlanSettings::WriteSecondarySSIDL(): new table inserted"); + iSecondaryView = iDatabase.OpenTableLC(TPtrC(WLAN_SECONDARY_SSID)); + CleanupStack::Pop(iSecondaryView); // iSecondaryView + retval = iSecondaryView->InsertRecord(id); + + if (retval == KErrLocked) + { + _DBG_FILE("WriteSecondarySSIDL: InsertRecord was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && retval == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteSecondarySSIDL: Slept 1 second. Try again"); + retval = iSecondaryView->InsertRecord(id); + retry--; + } + } + if (retval != KErrNone) + { + _DBG_FILE("WriteSecondarySSIDL: InsertRecord was unsuccessful"); + } + else + { + _DBG_FILE("WriteSecondarySSIDL: InsertRecord was successful"); + } + + DBG_ARGS8( + _S8( + "CNSmlInternetAdapter::WriteSecondarySSIDL(): Add record, error %d"), + retval); + if (retval == KErrNone) + { + _DBG_FILE( + "CWlanSettings::WriteSecondarySSIDL(): table insertion went ok"); + iSecondaryView->WriteUintL(TPtrC(WLAN_SEC_SSID_SERVICE_ID), + aWlanID); + iSecondaryView->WriteUintL(TPtrC(WLAN_SEC_SSID_ID), id); + } + } + else + { + _DBG_FILE( + "CWlanSettings::WriteSecondarySSIDL(): table exists, find it"); + iSecondaryView = iDatabase.OpenViewMatchingUintLC(TPtrC( + WLAN_SECONDARY_SSID), TPtrC(WLAN_SEC_SSID_ID), aSettings.Id); + CleanupStack::Pop(iSecondaryView); // iSecondaryView + TInt err = iSecondaryView->GotoFirstRecord(); + if (err != KErrNone) + { + _DBG_FILE( + "CWlanSettings::WriteSecondarySSIDL(): go to first record failed"); + // most likely KErrNotFound, something wrong with the URI parsing probably + return err; + } + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (apEnforce) + { + ((CCommsDbProtectTableView*) iSecondaryView)->UnprotectRecord(); + } + } + retval = iSecondaryView->UpdateRecord(); + if (retval == KErrLocked) + { + _DBG_FILE("WriteSecondarySSIDL: UpdateRecord was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && retval == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteSecondarySSIDL: Slept 1 second. Try again"); + retval = iSecondaryView->UpdateRecord(); + retry--; + } + } + if (retval != KErrNone) + { + _DBG_FILE("WriteSecondarySSIDL: UpdateRecord was unsuccessful"); + } + else + { + _DBG_FILE("WriteSecondarySSIDL: UpdateRecord was successful"); + } + } + if (retval == KErrNone) + { + DBG_ARGS8( + _S8( + "CWlanSettings::writesecondaryssids - WLAN_SEC_SSID_SCANNED_SSID uri: <%S> ad WLAN_SEC_SSID_USED_SSID : <%S>"), + &aSettings.ScannedId, &aSettings.UsedId); + iSecondaryView->WriteTextL(TPtrC(WLAN_SEC_SSID_SCANNED_SSID), + aSettings.ScannedId); + iSecondaryView->WriteTextL(TPtrC(WLAN_SEC_SSID_USED_SSID), + aSettings.UsedId); + + retval = iSecondaryView->PutRecordChanges(); + if (retval == KErrLocked) + { + _DBG_FILE("WriteSecondarySSIDL: PutRecordChanges was locked."); + TInt retry = KBeginTransRetryCount; + while (retry > 0 && retval == KErrLocked) + { + User::After(KBeginTransRetryDelay); + _DBG_FILE("WriteSecondarySSIDL: Slept 1 second. Try again"); + retval = iSecondaryView->PutRecordChanges(); + retry--; + } + } + if (retval != KErrNone) + { + _DBG_FILE( + "WriteSecondarySSIDL: PutRecordChanges was unsuccessful"); + } + else + { + _DBG_FILE("WriteSecondarySSIDL: PutRecordChanges was successful"); + } + } + + if (FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) + { + if (reLock) + { + TInt enError = KErrNone; + TInt lockError = KErrNone; + TRAP(lockError, enError = PerformLockWLANTablesL(ETrue)); + if (iSecondaryView != NULL) + { + ((CCommsDbProtectTableView*) iSecondaryView)->ProtectRecord(); + } + if (enError != KErrNone) // to remove warnings + { + enError = KErrNone; + } + } + } + + // This makes sure that there will be no calling to GotoFirstRecord() + // before secondaryview is reinitialized, (causes a panic if that would happen) + delete iSecondaryView; + iSecondaryView = NULL; + + if (reLock && apEnforce) + { + reLock = EFalse; // to get rid of warnings + apEnforce = EFalse; + } + + return retval; + + } + +TInt CWlanSettings::WriteEAPSettings(EAPSettings& aEapSettings) + { + TRAPD(err, iEapType->SetConfigurationL(aEapSettings)); + return err; + } + +//----------------------------------------------------------------------------- +// void CWlanSettings::ConnectToDatabaseL( ) +//----------------------------------------------------------------------------- +void CWlanSettings::ConnectToDatabaseL() + { + _DBG_FILE("CWlanSettings::ConnectToDatabaseL(): begin"); + + if (!iTableView) + { + iTableView = iDatabase.OpenTableLC(TPtrC(WLAN_SERVICE)); + + if (iTableView == NULL) + { + _DBG_FILE( + "CWlanSettings::ConnectToDatabaseL(): could not open table"); + User::Leave(KErrCouldNotConnect); + } + + CleanupStack::Pop(iTableView); //iTableView + } + + _DBG_FILE("CWlanSettings::ConnectToDatabaseL(): end"); + } + +void CWlanSettings::GetEAPInterfaceL(const TInt aId, + TEapExpandedType& aEncapsId, TEapExpandedType& aExpandedId) + { + if (aId < 0) + { + // Illegal input + User::Leave(KErrArgument); + } + + if (iEapType) + { + delete iEapType; + iEapType = NULL; + } + TInt err = KErrNone; + TRAP(err, iEapType = CEapType::NewL(ELan, aId, aExpandedId)); + + if (err == KErrNone) + { + if (aEncapsId != (*EapExpandedTypeNone.GetType())) + { + iEapType->SetTunnelingType(aEncapsId); + } + } + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::GoToRecord( TUint32 aId ) +// Moves iTableView to point record whose id-number equals to aId +//----------------------------------------------------------------------------- +TInt CWlanSettings::GoToRecord(TUint32 aId) + { + _DBG_FILE("CWlanSettings::GoToRecord(): begin"); + DBG_ARGS( + _S16("CWlanSettings::GoToRecord(): begin Search record id: <%D>"), + aId); + + TInt err = iTableView->GotoFirstRecord(); + if (err != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GoToRecord(): end, GotoFirstRecord. err: <%D>"), + err); + return err; + } + + TUint32 id = 0; + TRAP(err, iTableView->ReadUintL(TPtrC(WLAN_SERVICE_ID), id)); + if (err != KErrNone) + { + DBG_ARGS(_S16( + "CWlanSettings::GoToRecord(): end, ReadUintL. err: <%D>"), + err); + return err; + } + + while (aId != id) + { + err = iTableView->GotoNextRecord(); + if (err != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GoToRecord(): end, GotoNextRecord. err: <%D>"), + err); + return err; + } + + TRAP(err, iTableView->ReadUintL(TPtrC(WLAN_SERVICE_ID), id)); + + if (err == KErrNone) + { + DBG_ARGS(_S16( + "CWlanSettings::GoToRecord(): Found service id: <%D>"), + id); + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::GoToRecord(): end, ReadUintL next. err: <%D>"), + err); + return err; + } + } + + TRAP(err, SetSecondaryViewToRecordL(aId)); + + DBG_ARGS(_S16("CWlanSettings::GoToRecord(): end. Final record id: <%D>"), + id); + + return err; + } + +void CWlanSettings::SetSecondaryViewToRecordL(TUint32 aId) + { + // optional secondarySSID + if (iSecondaryView) + { + delete iSecondaryView; + iSecondaryView = NULL; + } + + // first open a view to secondary ssid table, with all the rows with service id + // matching the wlan service id (count can be zero) + iSecondaryView = iDatabase.OpenViewMatchingUintLC(TPtrC( + WLAN_SECONDARY_SSID), TPtrC(WLAN_SEC_SSID_SERVICE_ID), aId); + if (iSecondaryView == NULL) + { + // this should not happen in a normal situation + User::Leave(KErrCouldNotConnect); + } + CleanupStack::Pop(iSecondaryView); + } + +//----------------------------------------------------------------------------- +// void CWlanSettings::GetDataFromRecordL( TWlanSettings* aWlanSettings ) +// Read settings from database to aWlanSettings structure +//----------------------------------------------------------------------------- +void CWlanSettings::GetDataFromRecordL(TWlanSettings* aWlanSettings) + { + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): begin"); + + TInt leavecode = 0; + + aWlanSettings->ServiceID = 0; + aWlanSettings->ConnectionMode = 0; + aWlanSettings->SSID = _L(""); + aWlanSettings->UsedSSID = _L(""); + aWlanSettings->ScanSSID = 0; + aWlanSettings->WepKey1 = _L8(""); + aWlanSettings->WepKey2 = _L8(""); + aWlanSettings->WepKey3 = _L8(""); + aWlanSettings->WepKey4 = _L8(""); + aWlanSettings->WepIndex = 0; + aWlanSettings->SecurityMode = EAllowUnsecure; + aWlanSettings->WPAPreSharedKey = _L8(""); + aWlanSettings->UseWPAPSK = 0; + aWlanSettings->EapList = _L(""); + aWlanSettings->AuthMode = 0; + + TRAP(leavecode, iTableView->ReadUintL(TPtrC(WLAN_SERVICE_ID), + aWlanSettings->ServiceID)); + if (leavecode != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): WLAN_SERVICE_ID read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadUintL(TPtrC(WLAN_CONNECTION_MODE), + aWlanSettings->ConnectionMode)); + if (leavecode != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): WLAN_CONNECTION_MODE read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadUintL(TPtrC(NU_WLAN_AUTHENTICATION_MODE), + aWlanSettings->AuthMode)); + if (leavecode != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): NU_WLAN_AUTHENTICATION_MODE read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadUintL(TPtrC(WLAN_WEP_INDEX), + aWlanSettings->WepIndex)); + if (leavecode != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): WLAN_WEP_INDEX read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadUintL(TPtrC(WLAN_SECURITY_MODE), + aWlanSettings->SecurityMode)); + if (leavecode != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): WLAN_SECURITY_MODE read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadUintL(TPtrC(WLAN_ENABLE_WPA_PSK), + aWlanSettings->UseWPAPSK)); + if (leavecode != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): WLAN_ENABLE_WPA_PSK read error: <%D>"), + leavecode); + } + + TBuf8 columnValue8; + TRAP(leavecode, iTableView->ReadTextL(TPtrC(NU_WLAN_WEP_KEY1), + columnValue8)); + if ((leavecode == KErrNone) && (columnValue8.Length() > 0)) + { + aWlanSettings->WepKey1 = columnValue8; + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): NU_WLAN_WEP_KEY1 read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadTextL(TPtrC(NU_WLAN_WEP_KEY2), + columnValue8)); + if ((leavecode == KErrNone) && (columnValue8.Length() > 0)) + { + aWlanSettings->WepKey2 = columnValue8; + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): NU_WLAN_WEP_KEY2 read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadTextL(TPtrC(NU_WLAN_WEP_KEY3), + columnValue8)); + if ((leavecode == KErrNone) && (columnValue8.Length() > 0)) + { + aWlanSettings->WepKey3 = columnValue8; + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): NU_WLAN_WEP_KEY3 read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadTextL(TPtrC(NU_WLAN_WEP_KEY4), + columnValue8)); + if ((leavecode == KErrNone) && (columnValue8.Length() > 0)) + { + aWlanSettings->WepKey4 = columnValue8; + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): NU_WLAN_WEP_KEY4 read error: <%D>"), + leavecode); + } + + TBuf8 precolumnValue8; + TBuf columnValue; + + _DBG_FILE( + "CWlanSettings::GetDataFromRecordL(): Before getting WLAN_WPA_PRE_SHARED_KEY "); + TRAP(leavecode, iTableView->ReadTextL(TPtrC(WLAN_WPA_PRE_SHARED_KEY), + precolumnValue8)); + DBG_ARGS( + _S16( + "CWlanSettings::ReadTextL( TPtrC(WLAN_WPA_PRE_SHARED_KEY ),length of key: <%D>"), + precolumnValue8.Length()); + if ((leavecode == KErrNone) && (precolumnValue8.Length() > 0)) + { + aWlanSettings->WPAPreSharedKey = precolumnValue8; + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): WLAN_WPA_PRE_SHARED_KEY read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadTextL(TPtrC(NU_WLAN_SSID), columnValue)); + if ((leavecode == KErrNone) && (columnValue.Length() > 0)) + { + aWlanSettings->SSID = columnValue; + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): NU_WLAN_SSID read error: <%D>"), + leavecode); + } + + TRAP(leavecode, iTableView->ReadTextL(TPtrC(WLAN_USED_SSID), columnValue)); + if ((leavecode == KErrNone) && (columnValue.Length() > 0)) + { + aWlanSettings->UsedSSID = columnValue; + _DBG_FILE( + "CWlanSettings::GetDataFromRecordL(): WLAN_USED_SSID reading ok"); + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): WLAN_USED_SSID read error: <%D>"), + leavecode); + } + + iTableView->ReadTextL(TPtrC(WLAN_USED_SSID), aWlanSettings->UsedSSID); + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): WLAN_USED_SSID"); + + TRAP(leavecode, iTableView->ReadUintL(TPtrC(WLAN_SCAN_SSID), + aWlanSettings->ScanSSID)); + if (leavecode != KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::GetDataFromRecordL(): WLAN_SCAN_SSID read error: <%D>"), + leavecode); + } + + TInt retval = iSecondaryView->GotoFirstRecord(); + if (retval == KErrNone) + { + aWlanSettings->SecondarySSIDsExisting = ETrue; + } + else + { + aWlanSettings->SecondarySSIDsExisting = EFalse; + } + + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): WLAN_EAPS"); + + _DBG_FILE("CWlanSettings::GetDataFromRecordL(): end"); + } + +//----------------------------------------------------------------------------- +// void CWlanSettings::GetSecondarySSIDListL(TUint32 aId, RArray& aSecondarySSIDs) +// Fills the array with secondarySSIDs, which are associated with given WLANID +//----------------------------------------------------------------------------- +void CWlanSettings::GetSecondarySSIDListL(TUint32 aWlanId, RArray< + TSecondarySSID>& aSecondarySSIDs) + { + if (iSecondaryView == NULL) + { + // views haven't been initialized, in case of incorrect usage + User::Leave(KErrNotReady); + } + + // set the view pointer into the first record + TInt retval = iSecondaryView->GotoFirstRecord(); + if (retval != KErrNone) + { + return; + } + + // check that given id matches the current rowset. If not, then reinitialize + TUint32 id; + TInt err(KErrNone); + TRAP(err, iSecondaryView->ReadUintL(TPtrC(WLAN_SEC_SSID_SERVICE_ID), id)); + if (id != aWlanId) + { + SetSecondaryViewToRecordL(aWlanId); + retval = iSecondaryView->GotoFirstRecord(); + } + + TBuf columnValue; + + while (retval == KErrNone) + { + TSecondarySSID ssid; + TRAP(retval, iSecondaryView->ReadUintL(TPtrC(WLAN_SEC_SSID_ID), + ssid.Id)); + TRAP(retval, iSecondaryView->ReadTextL(TPtrC( + WLAN_SEC_SSID_SCANNED_SSID), ssid.ScannedId)); + TRAP(retval, iSecondaryView->ReadTextL( + TPtrC(WLAN_SEC_SSID_USED_SSID), ssid.UsedId)); + aSecondarySSIDs.Append(ssid); + retval = iSecondaryView->GotoNextRecord(); + } + } + +//----------------------------------------------------------------------------- +// void CWlanSettings::WriteDataToRecordL( TWlanSettings* aWlanSettings ) +// Writes settings to database from aWlanSettings structure +//----------------------------------------------------------------------------- +void CWlanSettings::WriteDataToRecordL(TWlanSettings* aWlanSettings) + { + _DBG_FILE("CWlanSettings::WriteDataToRecordL(): begin"); + + iTableView->WriteUintL(TPtrC(WLAN_SERVICE_ID), aWlanSettings->ServiceID); + iTableView->WriteUintL(TPtrC(WLAN_CONNECTION_MODE), + aWlanSettings->ConnectionMode); + iTableView->WriteUintL(TPtrC(WLAN_WEP_INDEX), aWlanSettings->WepIndex); + iTableView->WriteUintL(TPtrC(WLAN_SECURITY_MODE), + aWlanSettings->SecurityMode); + iTableView->WriteUintL(TPtrC(WLAN_ENABLE_WPA_PSK), + aWlanSettings->UseWPAPSK); + iTableView->WriteUintL(TPtrC(NU_WLAN_AUTHENTICATION_MODE), + aWlanSettings->AuthMode); + iTableView->WriteTextL(TPtrC(NU_WLAN_SSID), aWlanSettings->SSID); + iTableView->WriteTextL(TPtrC(WLAN_USED_SSID), aWlanSettings->UsedSSID); + iTableView->WriteUintL(TPtrC(WLAN_SCAN_SSID), aWlanSettings->ScanSSID); + + iTableView->WriteTextL(TPtrC(NU_WLAN_WEP_KEY1), aWlanSettings->WepKey1); + iTableView->WriteTextL(TPtrC(NU_WLAN_WEP_KEY2), aWlanSettings->WepKey2); + iTableView->WriteTextL(TPtrC(NU_WLAN_WEP_KEY3), aWlanSettings->WepKey3); + iTableView->WriteTextL(TPtrC(NU_WLAN_WEP_KEY4), aWlanSettings->WepKey4); + iTableView->WriteUintL(TPtrC(WLAN_WEP_KEY1_FORMAT), 1); // 0 = Eascii, 1 = EHexadecimal + iTableView->WriteUintL(TPtrC(WLAN_WEP_KEY2_FORMAT), 1); + iTableView->WriteUintL(TPtrC(WLAN_WEP_KEY3_FORMAT), 1); + iTableView->WriteUintL(TPtrC(WLAN_WEP_KEY4_FORMAT), 1); + + iTableView->WriteTextL(TPtrC(WLAN_WPA_PRE_SHARED_KEY), + aWlanSettings->WPAPreSharedKey); + iTableView->WriteUintL(TPtrC(WLAN_WPA_KEY_LENGTH), + aWlanSettings->WPAPreSharedKey.Length()); + + _DBG_FILE("CWlanSettings::WriteDataToRecordL(): end"); + } + +//----------------------------------------------------------------------------- +// TInt CWlanSettings::RecordExists( TUint32 aLuid ) +// Returns ETrue if record exists in database +//----------------------------------------------------------------------------- +TInt CWlanSettings::RecordExists(TUint32 aLuid) + { + _DBG_FILE("CWlanSettings::RecordExists(): begin"); + + TInt err = KErrNone; + TRAP(err, ConnectToDatabaseL()); + + // If the connection went ok, then we can go to the record + if (err == KErrNone) + { + err = GoToRecord(aLuid); + } + + if (err == KErrNone) + { + DBG_ARGS( + _S16( + "CWlanSettings::RecordExists(): end. GoToRecord OK err: <%D>"), + err); + return ETrue; + } + else + { + DBG_ARGS( + _S16( + "CWlanSettings::RecordExists(): end. GoToRecord error err: <%D>"), + err); + return err; + } + } + +//----------------------------------------------------------------------------- +// void CWlanSettings::InitialiseRecordL( ) +// Inserts mandatory values for commsdb +//----------------------------------------------------------------------------- +void CWlanSettings::InitialiseRecordL() + { + _DBG_FILE("CWlanSettings::InitialiseRecordL(): begin"); + + iTableView->WriteUintL(TPtrC(WLAN_WPA_KEY_LENGTH), 0); + iTableView->WriteUintL(TPtrC(NU_WLAN_AUTHENTICATION_MODE), 0); + + _DBG_FILE("CWlanSettings::InitialiseRecordL(): end"); + } + +TInt CWlanSettings::InstalledEAPsL(CBufBase& aEAPList) + { + _DBG_FILE("CWlanSettings::InstalledEAPsL(): begin"); + + RImplInfoPtrArray ecomInfoArray; + REComSession::ListImplementationsL(KEapTypeInterfaceUid, ecomInfoArray); + + TUint eapId(0); + + // First sort the EAPIds + for (TInt i = 0; i < ecomInfoArray.Count(); i++) + { + if (ecomInfoArray[i]->DataType().Length() == KExpandedEAPIdLength) + { + // The EAP ID is in expanded type format + // Only handle the vendor type of 0 + if ((ecomInfoArray[i]->DataType()[1] != 0 + || ecomInfoArray[i]->DataType()[2] != 0 + || ecomInfoArray[i]->DataType()[3] != 0) + && ((ecomInfoArray[i]->DataType()[7] + != KMschapv2TypeId[7]) + && (ecomInfoArray[i]->DataType()[7] + != KTtlspapTypeId[7]))) + { + // This is some other vendor type than IETF + continue; + } + eapId = ecomInfoArray[i]->DataType()[7]; + _DBG_FILE( + "CWlanSettings::InstalledEAPsL(): Expanded EAP id found."); + } + else + { + // The EAP ID is in old 8-bit format (as string) + TLex8 lex(ecomInfoArray[i]->DataType()); + if (lex.Val(eapId) != KErrNone) + { + // Unsupported format. Ignore this. + _DBG_FILE( + "CWlanSettings::InstalledEAPsL(): Unsupported EAP id found."); + continue; + } + _DBG_FILE( + "CWlanSettings::InstalledEAPsL(): Old style EAP id found."); + } + + if (!IsDisallowedOutsidePEAP(*ecomInfoArray[i])) + { + aEAPList.InsertL(aEAPList.Size(), KNSmlWLanEapId); // EAPId + TBuf8<3> cue; // Max EAPId == 255 + cue.AppendNumFixedWidth(eapId, EDecimal, 3); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KSlash); + } + + // Check if the method is allowed inside PEAP + if (!IsDisallowedInsidePEAP(*ecomInfoArray[i])) + { + aEAPList.InsertL(aEAPList.Size(), KNSmlWLanEapId); // EAPId + TBuf8<3> cue; // Max EAPId == 255 + cue.AppendNumFixedWidth(eapId, EDecimal, 3); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KDash); + cue.Zero(); + cue.AppendNumFixedWidth(KEapPeapTypeId[7], EDecimal, 3); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KSlash); + +#ifdef FF_WLAN_EXTENSIONS + // same additions for EAP-FAST + aEAPList.InsertL(aEAPList.Size(), KNSmlWLanEapId); // EAPId + cue.Zero(); // Max EAPId == 255 + cue.AppendNumFixedWidth( eapId, EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KDash); + cue.Zero(); + cue.AppendNumFixedWidth( KEapFastTypeId[7], EDecimal, 3 ); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KSlash); +#endif + } + // Check if the method is allowed inside TTLS + if (!IsDisallowedInsideTTLS(*ecomInfoArray[i])) + { + aEAPList.InsertL(aEAPList.Size(), KNSmlWLanEapId); // EAPId + TBuf8<3> cue; // Max EAPId == 255 + cue.AppendNumFixedWidth(eapId, EDecimal, 3); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KDash); + cue.Zero(); + cue.AppendNumFixedWidth(KEapTtlsTypeId[7], EDecimal, 3); + aEAPList.InsertL(aEAPList.Size(), cue); + aEAPList.InsertL(aEAPList.Size(), KSlash); + } + } + // ECOM array is no longer needed. + ecomInfoArray.ResetAndDestroy(); + + // Cut the last slash + aEAPList.ResizeL(aEAPList.Size() - 1); + + _DBG_FILE("CWlanSettings::InstalledEAPsL(): end"); + return KErrNone; + } + +//----------------------------------------------------------------------------- +// TBool CWlanSettings::CheckEnforcementL( ) +// Checks if wlan enforcement is On or Off +//----------------------------------------------------------------------------- +TBool CWlanSettings::CheckEnforcementL() + { + CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); + CleanupStack::PushL(info); + TBool enforceWLANActive(EFalse); + User::LeaveIfError(info->EnforcementActive(EWLANEnforcement, + enforceWLANActive)); + CleanupStack::PopAndDestroy(info); + return (enforceWLANActive); + } + +//----------------------------------------------------------------------------- +// TBool CWlanSettings::CheckAPEnforcementL( ) +// Checks if AP enforcement is On or Off +//----------------------------------------------------------------------------- + +TBool CWlanSettings::CheckAPEnforcementL() + { + CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); + CleanupStack::PushL(info); + TBool enforceAPActive(EFalse); + User::LeaveIfError(info->EnforcementActive(EAPEnforcement, + enforceAPActive)); + CleanupStack::PopAndDestroy(info); + return (enforceAPActive); + } +//----------------------------------------------------------------------------- +// TInt CWlanSettings::PerformLockWLANTablesL( ) +// Locks or unlocks the wlan tables depending on the +// aProtect value +//----------------------------------------------------------------------------- +TInt CWlanSettings::PerformLockWLANTablesL(TBool aProtect) + { + + _DBG_FILE("CWlanSettings::PerformLockWLANTablesL(): BEGIN "); + CCommsDatabaseProtect* dbprotect = CCommsDatabaseProtect::NewL(); + CleanupStack::PushL(dbprotect); + RArray wlanTableList; + CleanupClosePushL(wlanTableList); + TBuf serviceType; + TBool apEnforce = EFalse; + TInt err = KErrNone; + + TRAP_IGNORE(apEnforce = CheckAPEnforcementL()); + if (apEnforce) + { + _DBG_FILE( + "CWlanSettings::PerformLockWLANTablesL(): AP enforcement is TRUE"); + wlanTableList.AppendL(TPtrC(WAP_ACCESS_POINT)); + wlanTableList.AppendL(TPtrC(WAP_IP_BEARER)); + wlanTableList.AppendL(TPtrC(IAP)); + //condition when only ap is enforced and not wlan then its not + //necessary to add wlanservice table + RDbRowSet::TAccess checkAccessType; + checkAccessType = dbprotect->GetTableAccessL(TPtrC( + WLAN_DEVICE_SETTINGS)); + switch (checkAccessType) + { + case RDbRowSet::EReadOnly: + { + wlanTableList.AppendL(TPtrC(WLAN_SERVICE)); + wlanTableList.AppendL(TPtrC(WLAN_SECONDARY_SSID)); + } + default: + { + break; + } + } + + } + else + { + _DBG_FILE( + "CWlanSettings::PerformLockWLANTablesL() Only wlan enforcement is ON"); + wlanTableList.AppendL(TPtrC(WLAN_SERVICE)); + wlanTableList.AppendL(TPtrC(WLAN_SECONDARY_SSID)); + } + + iDatabase.CommitTransaction(); + + for (TInt i(0); i < wlanTableList.Count(); i++) + { + if (!aProtect) + { + err = dbprotect->UnProtectTable(wlanTableList[i]); + DBG_ARGS( + _S16( + "CWlanSettings::PerformLockWLANTablesL(): Unprotect error %D"), + err); + //Check if current AP is locked , if yes , unprotect + // lock = EFalse; + } + else + { + err = dbprotect->ProtectTable(wlanTableList[i]); + //Check if current ServiceID is not locked , if yes , protect + // lock = ETrue; + } + } //for loop + + CleanupStack::PopAndDestroy(&wlanTableList); + CleanupStack::PopAndDestroy(dbprotect); + CCommsDatabase* commsDataBase = CCommsDatabase::NewL(); + CleanupStack::PushL(commsDataBase); + + // Open the IAP from IAP Table and protect + + TUint32 apIAPID = 0; + CCommsDbTableView* iapViews = commsDataBase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(IAP_SERVICE), iServiceID); + err = iapViews->GotoFirstRecord(); + // Service ID can be same for GPRS or WLAN, hence check service type and get the iAPID + while (err == KErrNone) + { + iapViews->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); + if (serviceType == TPtrC(LAN_SERVICE)) + { + iapViews->ReadUintL(TPtrC(COMMDB_ID), apIAPID); + DBG_ARGS(_S16( + "CWlanSettings::PerformLockWLANTablesL(): IAPId %D"), + apIAPID); + break; + } + err = iapViews->GotoNextRecord(); + } + + //iapViews->ReadUintL(TPtrC(COMMDB_ID), apIAPID); + DBG_ARGS( + _S16( + "CWlanSettings::PerformLockWLANTablesL(): end. IAP ID being locked %d "), + apIAPID); + if (err == KErrNone) + { + CCommsDbTableView* iapUpdate = commsDataBase->OpenViewMatchingUintLC( + TPtrC(IAP), TPtrC(COMMDB_ID), apIAPID); + TInt iapExists = iapUpdate->GotoFirstRecord(); + + if (!aProtect) + { + ((CCommsDbProtectTableView*) iapViews)->UnprotectRecord(); + if (iapExists) + { + ((CCommsDbProtectTableView*) iapUpdate)->UnprotectRecord(); + } + } + else + { + ((CCommsDbProtectTableView*) iapViews)->ProtectRecord(); + if (iapExists) + { + ((CCommsDbProtectTableView*) iapUpdate)->ProtectRecord(); + } + } + CleanupStack::PopAndDestroy(); // iapUpdate + } + + CleanupStack::PopAndDestroy(iapViews); + CleanupStack::PopAndDestroy(commsDataBase); + + iDatabase.BeginTransaction(); + return err; + } + +TBool CWlanSettings::IsDisallowedOutsidePEAP( + const CImplementationInformation& aImplInfo) + { + + const TUint8 pluginOpaqueData = *(aImplInfo.OpaqueData().Ptr()); + + if (pluginOpaqueData & KNotOutsidePEAP) + { + return ETrue; + } + return EFalse; + + } + +TBool CWlanSettings::IsDisallowedInsidePEAP( + const CImplementationInformation& aImplInfo) + { + const TUint8 pluginOpaqueData = *(aImplInfo.OpaqueData().Ptr()); + + if (pluginOpaqueData & KNotInsidePEAP) + { + return ETrue; + } + return EFalse; + + } + +TBool CWlanSettings::IsDisallowedInsideTTLS( + const CImplementationInformation& aImplInfo) + { + const TUint8 pluginOpaqueData = *(aImplInfo.OpaqueData().Ptr()); + + if (pluginOpaqueData & KNotInsideTTLS) + { + return ETrue; + } + return EFalse; + } + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/rom/omadmadapters.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/rom/omadmadapters.iby Thu Jul 22 16:30:53 2010 +0100 @@ -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 +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 +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 +ECOM_PLUGIN(nsmldmfotaadapter.dll,nsmldmfotaadapter.rsc) +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 +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 + +ECOM_PLUGIN( nsmldmbmadapter.dll, nsmldmbmadapter.rsc ) + +#ifdef FF_RUNTIME_DEVICE_CAPABILITY_CONFIGURATION +ECOM_PLUGIN(dcmodmadapter.dll,dcmodmadapter.rsc) +#endif + +#endif //__SYNCML_DM + +#endif //__OMADMADAPTERS_IBY__ diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/streamingadapter/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/streamingadapter/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,34 @@ +/* +* ============================================================================== +* Name : bld.inf +* Part of : OMA DM Adapter +* +* 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: build info file for streaming adapter +* +*/ + +#include + +PRJ_EXPORTS + +../conf/streamingadapter.confml APP_LAYER_CONFML(streamingadapter.confml) +../conf/streamingadapter_20024310.crml APP_LAYER_CRML(streamingadapter_20024310.crml) + +PRJ_MMPFILES +nsmlstreamingadapter.mmp + + + + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/streamingadapter/bld/nsmlstreamingadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/streamingadapter/bld/nsmlstreamingadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,58 @@ +/* +* ============================================================================== +* Name : nsmldmstreamingadapter.mmp +* Part of : nsmldmstreamingadapter +* +* 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. +* +*/ + + +#include "defaultcaps.hrh" +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET nsmldmstreamingadapter.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20024310 +VENDORID VID_DEFAULT + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom +SOURCEPATH ../src + +USERINCLUDE ../inc + + +SOURCE nsmlstreamingadapter.cpp + +START RESOURCE nsmldmstreamingadapter.rss +TARGET nsmldmstreamingadapter.rsc +LANGUAGE_IDS +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY nsmldebug.lib +LIBRARY nsmlagentcommon.lib +LIBRARY centralrepository.lib +LIBRARY commdb.lib +LIBRARY nsmldmiapmatcher.lib +LIBRARY mpsettengine.lib + + + +SMPSAFE diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/streamingadapter/conf/streamingadapter.confml Binary file omadmadapters/streamingadapter/conf/streamingadapter.confml has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/streamingadapter/conf/streamingadapter_20024310.crml Binary file omadmadapters/streamingadapter/conf/streamingadapter_20024310.crml has changed diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/streamingadapter/inc/nsmlstreamingadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/streamingadapter/inc/nsmlstreamingadapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,238 @@ +/* +* Name : nsmldmstreamingadapter.h +* Part of : nsmldmstreamingadapter +* +* 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. +* +*/ + + +#ifndef __NSMLDMSTREAMINGADAPTER_H__ +#define __NSMLDMSTREAMINGADAPTER_H__ + +// INCLUDES +#include +#include +#include "nsmldmconstants.h" + +const TInt KMaxLengthStreamingName = 255; +const TInt KMaxLengthToProxy = 255; +const TInt KMaxLengthNetInfo = 255; +const TInt KMaxLengthTempInfo = 10; + +const TInt KMinPort = 1024; +const TInt KMaxPort = 65535; +const TInt KPortDiff = 5; +const TUint KNSmlDMStreamingAdapterImplUid = 0x20024311; + +const TInt KMnMaxBwGPRS = 9050; +const TInt KMxMaxBwGPRS = 40200; +const TInt KMnSusBwGPRS = 6335; +const TInt KMxSusBwGPRS = 28140; + +const TInt KMnMaxBwEGPRS = 44800; +const TInt KMxMaxBwEGPRS = 108800; +const TInt KMnSusBwEGPRS = 26880; +const TInt KMxSusBwEGPRS = 65280; + +const TInt KMnMaxBwWCDMA = 64000; +const TInt KMxMaxBwWCDMA = 384000; +const TInt KMnSusBwWCDMA = 44800; +const TInt KMxSusBwWCDMA = 268800; + +const TInt KMnMaxBwHSDPA = 600000; +const TInt KMxMaxBwHSDPA = 3600000; +const TInt KMnSusBwHSDPA = 420000; +const TInt KMxSusBwHSDPA = 2520000; + +const TInt KMnMaxBwWLAN = 64000; +const TInt KMxMaxBwWLAN = 3000000; +const TInt KMnSusBwWLAN = 44800; +const TInt KMxSusBwWLAN = 2100000; + +const TInt KMnMaxBwCDMA = 9050; +const TInt KMxMaxBwCDMA = 40200; +const TInt KMnSusBwCDMA = 6335; +const TInt KMxSusBwCDMA = 28140; + +const TInt KMnMaxBwCDMA2000 = 9050; +const TInt KMxMaxBwCDMA2000 = 40200; +const TInt KMnSusBwCDMA2000 = 6335; +const TInt KMxSusBwCDMA2000 = 28140; + + +/* +const TInt KMnMaxBw = 5000; + +const TInt KMnMaxBwGPRS = 99995; // < +const TInt KMnMaxBw3G = 1920001; // < +const TInt KMnMaxBwEGPRS = 199995; // < +const TInt KMnMaxBwWLAN = 4300001; // < +const TInt KMnMaxBwHSDPA = 3999995; // < +const TInt KMnMaxBwCDMA = 99995; // < +const TInt KMnMaxBwCDMA2000 = 153601; // < */ + + + + +// MACROS + +class CMPSettingsModel; + +// the DDF version must be changed if any changes in DDF structure +// ( built in DDFStructureL() function ) +_LIT8( KNSmlDMStreamingAdapterDDFVersion, "1.0" ); + +_LIT8 (KNSmlURISeparator ,"/"); + +_LIT8( KNSmlDMStreamingAdapterTextPlain, "text/plain" ); +_LIT8( KNSmlDMStreamingAdapterNodeName, "Streaming" ); +_LIT8( KNSmlDMStreamingAdapterDescription, "The parent object holding all Streaming Settings" ); + +_LIT8( KNSmlDMStreamingAdapterVal, "Name/To-Proxy/To-NapID/NetInfo/MIN-UDP-PORT/MAX-UDP-PORT" ); +_LIT8( KNSmlDMStreamingAdapterName, "Name" ); +_LIT8( KNSmlDMStreamingAdapterNameDescription, "Streaming configuration name" ); +_LIT8( KNSmlDMStreamingAdapterToProxy, "To-Proxy" ); +_LIT8( KNSmlDMStreamingAdapterToProxyDescription, "Streaming proxy server ID" ); +_LIT8( KNSmlDMStreamingAdapterToNapID, "To-NapID" ); +_LIT8( KNSmlDMStreamingAdapterToNapIDDescription, "The APN that is used for Streaming" ); +_LIT8( KNSmlDMStreamingAdapterNetInfo, "NetInfo" ); +_LIT8( KNSmlDMStreamingAdapterNetInfoVal, "GPRS/EGPRS/WCDMA/CDMA/CDMA2000/WLAN/HSDPA" ); + +_LIT8( KNSmlDMStreamingAdapterNetInfoGPRS, "GPRS" ); +_LIT8( KNSmlDMStreamingAdapterNetInfoEGPRS, "EGPRS" ); +_LIT8( KNSmlDMStreamingAdapterNetInfoWCDMA, "WCDMA" ); +_LIT8( KNSmlDMStreamingAdapterNetInfoCDMA2000, "CDMA2000" ); +_LIT8( KNSmlDMStreamingAdapterNetInfoWLAN, "WLAN" ); +_LIT8( KNSmlDMStreamingAdapterNetInfoCDMA, "CDMA" ); +_LIT8( KNSmlDMStreamingAdapterNetInfoHSDPA, "HSDPA" ); + +_LIT8( KNSmlDMStreamingAdapterNetInfoDescription, "The parameter which contains networks information" ); +_LIT8( KNSmlDMStreamingAdapterMinUdpPort, "MIN-UDP-PORT" ); +_LIT8( KNSmlDMStreamingAdapterMinUdpPortDescription, "The min port number used for streaming" ); +_LIT8( KNSmlDMStreamingAdapterMaxUdpPort, "MAX-UDP-PORT" ); +_LIT8( KNSmlDMStreamingAdapterMaxUdpPortDescription, "The max port number used for streaming" ); + +_LIT8( KCommaSep,","); + + + +// CLASS DECLARATION +class CNSmlDmStreamingAdapter : public CSmlDmAdapter + { +public: // constructors and destructor + static CNSmlDmStreamingAdapter* NewL(MSmlDmCallback* aDmCallback ); + static CNSmlDmStreamingAdapter* NewLC(MSmlDmCallback* aDmCallback ); + + virtual ~CNSmlDmStreamingAdapter(); + +//private: ///new functions +public: ///new functions + + void SetNetInfoL(const TDesC8& aObject,const TDesC8 &aDes,TDataBearer aBearer,const TInt aStatusRef,const TInt aMnMaxBw, const TInt aMxMaxBw,const TInt aMnSusBw, const TInt aMxSusBw); + + CSmlDmAdapter::TError GetNetInfoL(CBufBase& aObject,TDataBearer aBearer,const TDesC8 &aDes); + + void SetLeafPropertiesL( MSmlDmDDFObject& aObject, + const TSmlDmAccessTypes& aAccessTypes, + const TDesC8& aDescription ) const; + CNSmlDmStreamingAdapter(TAny* aEcomArguments); + /** + * Two-phased constructor. + */ + void ConstructL(); + CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, CBufBase& aObject ); + + void SetMinUDPPortL(const TDesC8& aObject,const TInt aStatusRef); + + void SetMaxUDPPortL(const TDesC8& aObject,const TInt aStatusRef); + + void SetDefaultApL(const TDesC8& aObject,const TInt aStatusRef); + + CSmlDmAdapter::TError GetDefaultApL(CBufBase& aObject); + +//private: // from base classes +public: // 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(); + + static void Cleanup( TAny* aAny ); + + /** + * Fills the given information to a DDF Object node. + * @param aNode The node whose data is filled. + * @param aAccTypes The access types of the node. + * @param aOccurance Occurance of the node. + * @param aScope The scope of the node. + * @param aFormat The format of the node's data, i.e. node/chr/bin/... + * @param aDescription Informal description of the node. + */ + void FillNodeInfoL( MSmlDmDDFObject& aNode, + const TSmlDmAccessTypes& aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) const; + +private: + MSmlDmCallback* iDmCallback; + + CMPSettingsModel* iModel; + + }; + +#endif // __NSMLDMSTREAMINGADAPTER_H__ diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/streamingadapter/inc/streamingadapterCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/streamingadapter/inc/streamingadapterCRKeys.h Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Name : streamingadapterCRKeys.h +* Part of : streamingadapter +* +* 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. +* +*/ + +#ifndef STREAMINGADAPTERCRKEYS_H +#define STREAMINGADAPTERCRKEYS_H + +// CONSTANTS + +// key uid +const TUid KCRUidStreamingAdapter = {0x20024310}; + +// Configuration Name for Streaming Adapter +const TUint32 KStreamingConfigurationName = 0x00000001; + + +#endif // STREAMINGADAPTERCRKEYS_H + +// End of File diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/streamingadapter/src/nsmldmstreamingadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/streamingadapter/src/nsmldmstreamingadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,49 @@ +/* +* ============================================================================ +* Name : nsmlstreaming.rss +* Part of : streaming adapter +* +* 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 + +#include +#include "nsmldmconstants.h" + +RESOURCE REGISTRY_INFO theRegistryInfo + { + dll_uid = 0x20024310;//The DLL's 3rd UID. + interfaces = + { + INTERFACE_INFO + { + interface_uid = KNSmlDMInterfaceUid; // DM interface UID + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x20024311; // DM browser implementation UID + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/streamingadapter/src/nsmlstreamingadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/streamingadapter/src/nsmlstreamingadapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,1380 @@ +/* +* Name : nsmldmstreamingadapter.cpp +* Part of : nsmldmstreamingadapter +* Interface : ecom / SmlDmAdapter +* +* 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. +* +*/ + + +//INCLUDE FILES +#include // For TImplementationProxy definition +#include +#include +#include // CommsDB columname defs +#include +#include +#include +#include +#include + + +#include "nsmldebug.h" +#include "nsmlconstants.h" +#include "nsmldmconst.h" +#include "nsmlstreamingadapter.h" +#include "nsmldmiapmatcher.h" +#include "streamingadapterCRKeys.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 + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewL( ) +// ----------------------------------------------------------------------------- +CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewL(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::NewL(): begin"); + CNSmlDmStreamingAdapter* self = NewLC( aDmCallback ); + CleanupStack::Pop(); + _DBG_FILE("CNSmlDmStreamingAdapter::NewL(): end"); + return self; + } + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewLC( ) +// ----------------------------------------------------------------------------- +CNSmlDmStreamingAdapter* CNSmlDmStreamingAdapter::NewLC(MSmlDmCallback* aDmCallback ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::NewLC(): begin"); + CNSmlDmStreamingAdapter* self = new (ELeave) CNSmlDmStreamingAdapter(aDmCallback); + CleanupStack::PushL(self); + self->ConstructL(); + self->iDmCallback = aDmCallback; + _DBG_FILE("CNSmlDmStreamingAdapter::NewLC(): end"); + return self; + } + + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter() +// ----------------------------------------------------------------------------- +CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter() + { + _DBG_FILE("CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter(): begin"); + if(iModel) + delete iModel; + _DBG_FILE("CNSmlDmStreamingAdapter::~CNSmlDmStreamingAdapter(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter() +// ----------------------------------------------------------------------------- + +CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(TAny* aEcomArguments):CSmlDmAdapter(aEcomArguments) + { + _DBG_FILE("CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(aEcomArguments): begin"); + _DBG_FILE("CNSmlDmStreamingAdapter::CNSmlDmStreamingAdapter(aEcomArguments): end"); + } + + +void CNSmlDmStreamingAdapter::ConstructL() + { + _DBG_FILE("CNSmlDmStreamingAdapter::ConstructL: begin"); + if ( !iModel ) + { + RImplInfoPtrArray impl; + CleanupStack::PushL( TCleanupItem( Cleanup, &impl ) ); + CMPSettingsModel::ListImplementationsL( impl ); + if( impl.Count() > 0 ) + { + _DBG_FILE("CStreamingAdapter::ConstructL: Creating CMPSettingsModel"); + // using the first available implementation + iModel= CMPSettingsModel::NewL( impl[0]->ImplementationUid() ); + _DBG_FILE("CStreamingAdapter::ConstructL: Creating CMPSettingsModel Done" ); + } + CleanupStack::PopAndDestroy(); // implArray + // Load default values + //iModel->LoadSettingsL(EConfigDefault); + if(iModel) + iModel->LoadSettingsL(EConfigUser); + } + _DBG_FILE("CNSmlDmStreamingAdapter::ConstructL: end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::SetLeafPropertiesL() +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::SetLeafPropertiesL( MSmlDmDDFObject& aObject, + const TSmlDmAccessTypes& aAccessTypes, + const TDesC8& aDescription ) const + { + aObject.SetAccessTypesL( aAccessTypes ); + aObject.SetScopeL( MSmlDmDDFObject::EPermanent ); + aObject.SetDFFormatL( MSmlDmDDFObject::EChr ); + aObject.AddDFTypeMimeTypeL( KNSmlDMStreamingAdapterTextPlain ); + aObject.SetDescriptionL( aDescription ); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::DDFVersionL() +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::DDFVersionL(CBufBase& aDDFVersion) + { + _DBG_FILE("CNSmlDmStreamingAdapter::DDFVersionL(TDes& aDDFVersion): begin"); + aDDFVersion.InsertL(0,KNSmlDMStreamingAdapterDDFVersion); + _DBG_FILE("CNSmlDmStreamingAdapter::DDFVersionL(TDes& aDDFVersion): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::DDFStructureL() +// +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): begin"); + + TSmlDmAccessTypes accessTypes; + accessTypes.SetGet(); + + TSmlDmAccessTypes accessNoDeleteTypes; + accessNoDeleteTypes.SetGet(); + accessNoDeleteTypes.SetReplace(); + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNodeName"); + MSmlDmDDFObject& dmStreamingAdap = aDDF.AddChildObjectL( KNSmlDMStreamingAdapterNodeName ); + dmStreamingAdap.SetAccessTypesL( accessTypes ); + dmStreamingAdap.SetScopeL( MSmlDmDDFObject::EPermanent ); + dmStreamingAdap.SetDescriptionL( KNSmlDMStreamingAdapterDescription ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterName"); + MSmlDmDDFObject& confName = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterName); + FillNodeInfoL( confName, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterNameDescription ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterToProxy"); + MSmlDmDDFObject& toProxyID = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterToProxy); + FillNodeInfoL( toProxyID, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterToProxyDescription ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterToNapID"); + MSmlDmDDFObject& toNapID = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterToNapID); + FillNodeInfoL( toNapID, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterToNapIDDescription ); + + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfo"); + MSmlDmDDFObject& netInfo = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterNetInfo); + FillNodeInfoL( netInfo, + accessTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::ENode, + KNSmlDMStreamingAdapterNetInfo ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoGPRS"); + MSmlDmDDFObject& netInfoGPRS = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoGPRS); + FillNodeInfoL( netInfoGPRS, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterNetInfo ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoEGPRS"); + MSmlDmDDFObject& netInfoEGPRS = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoEGPRS); + FillNodeInfoL( netInfoEGPRS, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterNetInfo ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoWCDMA"); + MSmlDmDDFObject& netInfoWCDMA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoWCDMA); + FillNodeInfoL( netInfoWCDMA, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterNetInfo ); + + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoCDMA2000"); + MSmlDmDDFObject& netInfoCDMA2000 = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoCDMA2000); + FillNodeInfoL( netInfoCDMA2000, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterNetInfo ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoWLAN"); + MSmlDmDDFObject& netInfoWLAN = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoWLAN); + FillNodeInfoL( netInfoWLAN, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterNetInfo ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoCDMA"); + MSmlDmDDFObject& netInfoCDMA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoCDMA); + FillNodeInfoL( netInfoCDMA, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterNetInfo ); + + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterNetInfoHSDPA"); + MSmlDmDDFObject& netInfoHSDPA = netInfo.AddChildObjectL(KNSmlDMStreamingAdapterNetInfoHSDPA); + FillNodeInfoL( netInfoHSDPA, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EChr, + KNSmlDMStreamingAdapterNetInfo ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterMinUdpPort"); + MSmlDmDDFObject& minUdpPort = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterMinUdpPort); + FillNodeInfoL( minUdpPort, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EInt, + KNSmlDMStreamingAdapterMinUdpPortDescription ); + + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): Creating Node KNSmlDMStreamingAdapterMaxUdpPort"); + MSmlDmDDFObject& maxUdpPort = dmStreamingAdap.AddChildObjectL(KNSmlDMStreamingAdapterMaxUdpPort); + FillNodeInfoL( maxUdpPort, + accessNoDeleteTypes, + MSmlDmDDFObject::EOne, + MSmlDmDDFObject::EPermanent, + MSmlDmDDFObject::EInt, + KNSmlDMStreamingAdapterMaxUdpPortDescription ); + + _DBG_FILE("CNSmlDmStreamingAdapter::DDFStructureL(): end"); + } + +void CNSmlDmStreamingAdapter::SetNetInfoL(const TDesC8& aObject,const TDesC8 &aDes,TDataBearer aBearer,const TInt aStatusRef,const TInt aMnMaxBw, const TInt aMxMaxBw,const TInt aMnSusBw,const TInt aMxSusBw) + { + TInt aSusBw; + TInt aMaxBw; + TLex8 aConv; + TInt err; + //aConv = aObject; + TInt ret = aObject.Locate(KCommaSep()[0]); + TInt ret1 = aObject.LocateReverse(KCommaSep()[0]); + + TInt len = aObject.Length() - (ret1 + 1); + TPtrC8 segment1 = aObject.Right( len ); + aConv = segment1; + + TPtrC8 firstSeg = aObject.Left( ret ); + if(firstSeg.Compare(aDes)) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in SetMaxBandwidth"), aBearer); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject); + return; + } + + + err = aConv.Val(aMaxBw); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in Conversion"), aBearer); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + if(aMaxBw > 0) + { + err = iModel->SetMaxBandwidth(aMaxBw,aBearer); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxBandwidth"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in SetMaxBandwidth"), aBearer); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + //return retValue; + } + + + TBuf8 aSusBf; + for(TInt i = (ret+1); i < (ret1); i++) + { + aSusBf.Append(aObject[i]); + } + aConv = aSusBf; + err = aConv.Val(aSusBw); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in Conversion"), aBearer); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + if(aSusBw > 0) + { + err = iModel->SetSustainBandwidth(aSusBw,aBearer); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetSustainBandwidth"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error in SetSustainBandwidth"), aBearer); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + if(aMaxBw > aMxMaxBw || aMaxBw < aMnMaxBw) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error Invalid aMaxBw"), aBearer); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + if(aSusBw > aMxSusBw || aSusBw < aMnSusBw) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::SetNetInfoL() - %d: Error Invalid aSusBw"), aBearer); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + iModel->StoreSettingsL(); + + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::UpdateLeafObjectL( const TDesC8& aURI, + const TDesC8& aLUID, + const TDesC8& aObject, + const TDesC8& aType, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin"); + + //CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]); + if ( ret == KErrNotFound ) + { + //retValue = CSmlDmAdapter::EError; + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + else + { + //iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + TInt len = aURI.Length() - (ret + 1); + TPtrC8 segment = aURI.Right( len ); + + if(segment == KNSmlDMStreamingAdapterName) + { + // Set for Streaming Configuration Name + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterName"); + TBuf aBuf; + TInt aErr; + CRepository* centrep( NULL); + aBuf.Zero(); + if(aObject.Length() <= KMaxLengthStreamingName) + { + aBuf.Copy(aObject); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in KMaxLengthStreamingName"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject); + return; + } + + centrep = CRepository::NewLC( KCRUidStreamingAdapter ); + if ( centrep ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Inside Cenrep Get"); + aErr = centrep->Set( KStreamingConfigurationName, aBuf ); + if(aErr != KErrNone) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in CenRep Get"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + CleanupStack::PopAndDestroy(centrep); + return; + } + CleanupStack::PopAndDestroy(centrep); + iModel->StoreSettingsL(); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in Creating the cenrep"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + } + } + else if(segment == KNSmlDMStreamingAdapterToProxy) + { + // Set for Streaming settings proxy address + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterToProxy"); + TBuf aBuf; + if(aObject.Length() <= KMaxLengthToProxy) + { + aBuf.Copy(aObject); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in KMaxLengthToProxy"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject); + return; + } + ret = iModel->SetProxyHostNameL(aBuf); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetProxyHostNameL %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + return; + } + iModel->StoreSettingsL(); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + else if(segment == KNSmlDMStreamingAdapterToNapID) + { + SetDefaultApL(aObject,aStatusRef); + /* + TInt aNap; + TUint32 aNapId; + TLex8 aConv; + aConv = aObject; + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + + aNap = iapmatch->IAPIdFromURIL(aObject); + + if(aNap == KErrNotFound) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in IAPIdFromURIL %d"), aNap); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + + aNapId = aNap; + CleanupStack::PopAndDestroy(); // iapMatch + + TInt ret;// = aConv.Val(aNapId,EDecimal); + ret = iModel->SetDefaultAp(aNapId); + if(ret == KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): SetDefaultAp success %d"), ret); + iModel->StoreSettingsL(); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + else + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetDefaultAp %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + }*/ + } + else if(segment == KNSmlDMStreamingAdapterNetInfoGPRS) + { + // Set for the netwrok information when Databearer is GPRS + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoGPRS"); + SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoGPRS,EBearerGPRS,aStatusRef,KMnMaxBwGPRS,KMxMaxBwGPRS,KMnSusBwGPRS,KMxSusBwGPRS); + } + else if(segment == KNSmlDMStreamingAdapterNetInfoEGPRS) + { + // Set for the netwrok information when Databearer is EGPRS + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoEGPRS"); + SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoEGPRS,EBearerEGPRS,aStatusRef,KMnMaxBwEGPRS,KMxMaxBwEGPRS,KMnSusBwEGPRS,KMxSusBwEGPRS); + } + else if(segment == KNSmlDMStreamingAdapterNetInfoWCDMA) + { + // Set for the netwrok information when Databearer is WCDMA + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWCDMA"); + SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoWCDMA,EBearerWCDMA,aStatusRef,KMnMaxBwWCDMA,KMxMaxBwWCDMA,KMnSusBwWCDMA,KMxSusBwWCDMA); + } + else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA2000) + { + // Set for the netwrok information when Databearer is CDMA2000 + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA2000"); + SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoCDMA2000,EBearerCDMA2000,aStatusRef,KMnMaxBwCDMA2000,KMxMaxBwCDMA2000,KMnSusBwCDMA2000,KMxSusBwCDMA2000); + } + else if(segment == KNSmlDMStreamingAdapterNetInfoWLAN) + { + // Set for the netwrok information when Databearer is WLAN + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWLAN"); + SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoWLAN,EBearerWLAN,aStatusRef,KMnMaxBwWLAN,KMxMaxBwWLAN,KMnSusBwWLAN,KMxSusBwWLAN); + } + else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA) + { + // Set for the netwrok information when Databearer is CDMA + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA"); + SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoCDMA,EBearerCDMA,aStatusRef,KMnMaxBwCDMA,KMxMaxBwCDMA,KMnSusBwCDMA,KMxSusBwCDMA); + } + else if(segment == KNSmlDMStreamingAdapterNetInfoHSDPA) + { + // Set for the netwrok information when Databearer is HSDPA + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterNetInfoHSDPA"); + SetNetInfoL(aObject,KNSmlDMStreamingAdapterNetInfoHSDPA,EBearerHSDPA,aStatusRef,KMnMaxBwHSDPA,KMxMaxBwHSDPA,KMnSusBwHSDPA,KMxSusBwHSDPA); + } + else if(segment == KNSmlDMStreamingAdapterMinUdpPort) + { + // Set for the min udp port for streaming settings + SetMinUDPPortL(aObject,aStatusRef); + /* + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterMinUdpPort"); + TInt aMinPort; + TInt aMaxPort; + TLex8 aConv; + TInt ret = KErrNone; + aConv = aObject; + ret = iModel->GetMaxUDPPort(aMaxPort); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMaxUDPPort: %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + ret = aConv.Val(aMinPort); + if(ret != KErrNone) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + + if(aMinPort < (aMaxPort - KPortDiff) && aMinPort >= KMinPort && aMinPort < KMaxPort) + { + ret = iModel->SetMinUDPPort(aMinPort); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMinUDPPort: %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + iModel->StoreSettingsL(); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject); + } + */ + } + else if(segment == KNSmlDMStreamingAdapterMaxUdpPort) + { + SetMaxUDPPortL(aObject,aStatusRef); + // Set for the max udp port for streaming settings + /* + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin"); + TInt aMaxPort; + TInt aMinPort; + TLex8 aConv; + TInt ret = KErrNone; + aConv = aObject; + ret = iModel->GetMinUDPPort(aMinPort); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMinUDPPort: %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + ret = aConv.Val(aMaxPort); + if(ret != KErrNone) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + if(aMaxPort > (aMinPort + KPortDiff) && aMaxPort >= KMinPort && aMaxPort <= KMaxPort ) + { + ret = iModel->SetMaxUDPPort(aMaxPort); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxUDPPort: %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + iModel->StoreSettingsL(); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject); + } */ + } + } + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): end"); + } + + void CNSmlDmStreamingAdapter::SetDefaultApL(const TDesC8& aObject,const TInt aStatusRef) + { + TInt aNap; + TUint32 aNapId; + TLex8 aConv; + aConv = aObject; + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + + aNap = iapmatch->IAPIdFromURIL(aObject); + + if(aNap == KErrNotFound) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in IAPIdFromURIL %d"), aNap); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + return; + } + + aNapId = aNap; + CleanupStack::PopAndDestroy(); // iapMatch + + TInt ret;// = aConv.Val(aNapId,EDecimal); + ret = iModel->SetDefaultAp(aNapId); + if(ret == KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): SetDefaultAp success %d"), ret); + iModel->StoreSettingsL(); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); + } + else + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetDefaultAp %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); + } + } + + void CNSmlDmStreamingAdapter::SetMinUDPPortL(const TDesC8& aObject,const TInt aStatusRef) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): KNSmlDMStreamingAdapterMinUdpPort"); + TInt aMinPort; + TInt aMaxPort; + TLex8 aConv; + TInt ret = KErrNone; + aConv = aObject; + ret = iModel->GetMaxUDPPort(aMaxPort); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMaxUDPPort: %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + ret = aConv.Val(aMinPort); + if(ret != KErrNone) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + + if(aMinPort < (aMaxPort - KPortDiff) && aMinPort >= KMinPort && aMinPort < KMaxPort) + { + ret = iModel->SetMinUDPPort(aMinPort); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMinUDPPort: %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + iModel->StoreSettingsL(); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject); + } + } + + void CNSmlDmStreamingAdapter::SetMaxUDPPortL(const TDesC8& aObject,const TInt aStatusRef) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): begin"); + TInt aMaxPort; + TInt aMinPort; + TLex8 aConv; + TInt ret = KErrNone; + aConv = aObject; + ret = iModel->GetMinUDPPort(aMinPort); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in GetMinUDPPort: %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + ret = aConv.Val(aMaxPort); + if(ret != KErrNone) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in conversion"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + + if(aMaxPort > (aMinPort + KPortDiff) && aMaxPort >= KMinPort && aMaxPort <= KMaxPort ) + { + ret = iModel->SetMaxUDPPort(aMaxPort); + if(ret != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Error in SetMaxUDPPort: %d"), ret); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError); + return; + } + iModel->StoreSettingsL(); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): Invalid Port value"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject); + } + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::DeleteObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::DeleteObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::DeleteLeafObjectL( ): begin"); + _DBG_FILE("CNSmlDmStreamingAdapter::DeleteLeafObjectL( ): end"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed ); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, +// const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::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("CNSmlDmStreamingAdapter::FetchLeafObjectL(): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::ChildURIListL( const TDesC& aURI, +// const TDesC& aParentLUID, const CArrayFix& aPreviousURISegmentList, +// const TInt aResultsRef, const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::ChildURIListL( const TDesC8& aURI, + const TDesC8& /*aParentLUID*/, + const CArrayFix& /*aPreviousURISegmentList*/, + const TInt aResultsRef, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin"); + CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + CBufBase* currentURISegmentList = CBufFlat::NewL( 1 ); + CleanupStack::PushL( currentURISegmentList ); + TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]); + if ( ret == KErrNotFound ) + { + ret = -1; + } + TInt len = aURI.Length() - ( ret + 1 ); + TPtrC8 segment = aURI.Right( len ); + + if ( segment == KNSmlDMStreamingAdapterNodeName ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin"); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMStreamingAdapterVal() ); + } + else if ( segment == KNSmlDMStreamingAdapterNetInfo ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): begin"); + currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMStreamingAdapterNetInfoVal() ); + } + + else + { + retValue = CSmlDmAdapter::EError; + } + iDmCallback->SetStatusL( aStatusRef, retValue ); + iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); + CleanupStack::PopAndDestroy(); //currentURISegmentList + _DBG_FILE("CNSmlDmStreamingAdapter::ChildURIListL(): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::AddNodeObjectL( const TDesC8& aURI, +// const TDesC8& aParentLUID, const TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::AddNodeObjectL(): begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::ENotAllowed ); + _DBG_FILE("CNSmlDmStreamingAdapter::AddNodeObjectL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::UpdateLeafObjectL() +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, + const TDesC8& /*aLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): stream: begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmStreamingAdapter::UpdateLeafObjectL(): stream: end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, +// const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, + const TDesC8& /*aLUID*/, + const TDesC8& aType, + const TInt aResultsRef, + const TInt aStatusRef ) + { + + _DBG_FILE("CNSmlDmStreamingAdapter::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("CNSmlDmStreamingAdapter::FetchLeafObjectSizeL(): end"); + } + + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, +// const TDesC8& aParentLUID, TDesC8& aArgument, const TDesC8& aType, TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aArgument, const TDesC8& aType, const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& aURI, +// const TDesC8& aParentLUID, RWriteStream*& aStream, const TDesC8& aType, +// TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, + const TDesC8& /*aParentLUID*/, + RWriteStream*& /*aStream*/, + const TDesC8& /*aType*/, + const TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): stream: begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmStreamingAdapter::ExecuteCommandL(): stream: end"); + } + +// ----------------------------------------------------------------------------- +// CNSmlDmStreamingAdapter::CopyCommandL( const TDesC8& aTargetURI, const TDesC8& +// aSourceURI, const TDesC8& aSourceLUID, const TDesC8& /*aType*/, TInt aStatusRef ) +// ----------------------------------------------------------------------------- +void CNSmlDmStreamingAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& + /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, + const TDesC8& /*aSourceLUID*/, + const TDesC8& /*aType*/, TInt aStatusRef ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::CopyCommandL(): begin"); + iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); + _DBG_FILE("CNSmlDmStreamingAdapter::CopyCommandL(): end"); + } + +// -------------------------------------- +// CNSmlDmStreamingAdapter::StartAtomicL() +// -------------------------------------- +void CNSmlDmStreamingAdapter::StartAtomicL() + { + _DBG_FILE("CNSmlDmStreamingAdapter::StartAtomicL(): begin"); + _DBG_FILE("CNSmlDmStreamingAdapter::StartAtomicL(): end"); + } + +// --------------------------------------- +// CNSmlDmStreamingAdapter::CommitAtomicL() +// --------------------------------------- +void CNSmlDmStreamingAdapter::CommitAtomicL() + { + _DBG_FILE("CNSmlDmStreamingAdapter::CommitAtomicL(): begin"); + _DBG_FILE("CNSmlDmStreamingAdapter::CommitAtomicL(): end"); + } + +// ----------------------------------------- +// CNSmlDmStreamingAdapter::RollbackAtomicL() +// ----------------------------------------- +void CNSmlDmStreamingAdapter::RollbackAtomicL() + { + _DBG_FILE("CNSmlDmStreamingAdapter::RollbackAtomicL(): begin"); + _DBG_FILE("CNSmlDmStreamingAdapter::RollbackAtomicL(): end"); + } + +// ----------------------------------------------------------- +// CNSmlDmStreamingAdapter::StreamingSupport( TInt& aItemSize ) +// ----------------------------------------------------------- +TBool CNSmlDmStreamingAdapter::StreamingSupport( TInt& /*aItemSize*/ ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::StreamingSupport(): begin"); + _DBG_FILE("CNSmlDmStreamingAdapter::StreamingSupport(): end"); + return EFalse; + } + +// ------------------------------------------ +// CNSmlDmStreamingAdapter::StreamCommittedL() +// ------------------------------------------ +void CNSmlDmStreamingAdapter::StreamCommittedL() + { + _DBG_FILE("CNSmlDmStreamingAdapter::StreamCommittedL(): begin"); + _DBG_FILE("CNSmlDmStreamingAdapter::StreamCommittedL(): end"); + } + +// -------------------------------------------------- +// CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL() +// -------------------------------------------------- +void CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL() + { + _DBG_FILE("CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL(): begin"); + _DBG_FILE("CNSmlDmStreamingAdapter::CompleteOutstandingCmdsL(): end"); + } + + +CSmlDmAdapter::TError CNSmlDmStreamingAdapter::GetNetInfoL(CBufBase& aObject,TDataBearer aBearer,const TDesC8 &aDes) + { + TBuf8 aNetInfoBuf; + CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + TInt err; + aNetInfoBuf.Append(aDes); + aNetInfoBuf.Append(KCommaSep); + + TInt aSusBw = 0; + err = iModel->GetSustainBandwidth(aSusBw,aBearer); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::GetNetInfoL() - %d: Error in GetSustainBandwidth: %d"),aBearer,err); + retValue = CSmlDmAdapter::EError; + return retValue; + } + TBuf8 aSusBwBuf; + aSusBwBuf.Num(aSusBw); + aNetInfoBuf.Append(aSusBwBuf); + aNetInfoBuf.Append(KCommaSep); + //aObject.InsertL(0,aSusBwBuf); + + + TInt aMaxBw; + err = iModel->GetMaxBandwidth(aMaxBw,aBearer); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::GetNetInfoL() - %d: Error in GetMaxBandwidth: %d"),aBearer,err); + retValue = CSmlDmAdapter::EError; + return retValue; + } + TBuf8 aMaxBwBuf; + aMaxBwBuf.Num(aMaxBw); + aNetInfoBuf.Append(aMaxBwBuf); + + aObject.InsertL(0,aNetInfoBuf); + retValue= CSmlDmAdapter::EOk; + return retValue; + } +// ----------------------------------------------------------------------------- +// CNSmlDmDevDetailAdapter::FetchLeafObjectL() +// ----------------------------------------------------------------------------- +CSmlDmAdapter::TError CNSmlDmStreamingAdapter::FetchLeafObjectL( const TDesC8& aURI, + CBufBase& aObject ) + { + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): begin"); + CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + TInt ret = aURI.LocateReverse(KNSmlURISeparator()[0]); + TInt err = KErrNone; + if ( ret == KErrNotFound ) + { + retValue = CSmlDmAdapter::EError; + } + else + { + TInt len = aURI.Length() - (ret + 1); + TPtrC8 segment = aURI.Right( len ); + + if(segment == KNSmlDMStreamingAdapterName) + { + // Get for Streaming Configuration Setting name(It is not displayed for the user). + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterName"); + TBuf8 aName; + CRepository* centrep( NULL); + aName.Zero(); + centrep = CRepository::NewLC( KCRUidStreamingAdapter ); + + if ( centrep ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in CenRep"); + TFullName temp; + + if (centrep->Get( KStreamingConfigurationName, temp )==KErrNone && temp.Length() ) + { + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Cenrep Get"); + temp.Trim(); + aName.Copy(temp); + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in Cenrep Get"); + retValue = CSmlDmAdapter::EError; + CleanupStack::PopAndDestroy(centrep); + return retValue; + } + CleanupStack::PopAndDestroy(centrep); + } + aObject.InsertL(0,aName); + retValue= CSmlDmAdapter::EOk; + } + else if(segment == KNSmlDMStreamingAdapterToProxy) + { + // Get for Proxy Address of the streaming settings. + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterToProxy"); + TBuf uri; + err = iModel->GetProxyHostName(uri); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in GetProxyHostName: %d"), err); + retValue = CSmlDmAdapter::EError; + return retValue; + } + TPtr8 ptr = uri.Collapse(); + aObject.InsertL(0,ptr); + retValue= CSmlDmAdapter::EOk; + } + else if(segment == KNSmlDMStreamingAdapterToNapID) + { + // Get for Access Point that is set in the streaming settings + retValue = GetDefaultApL(aObject); + retValue = CSmlDmAdapter::EOk; // even if no AP set return with null value + return retValue; + /* + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterToNapID"); + TUint32 aNapId; + err = iModel->GetDefaultAp(aNapId); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in GetDefaultAp: %d"), err); + retValue = CSmlDmAdapter::EError; + return retValue; + } + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + + HBufC8* uri8 = iapmatch->URIFromIAPIdL( aNapId ); + + if( uri8 ) + { + CleanupStack::PushL(uri8); + aObject.InsertL(0,uri8->Des()); + retValue= CSmlDmAdapter::EOk; + CleanupStack::PopAndDestroy(); // uri8 + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in URIFromIAPIdL:ENotFound"); + retValue= CSmlDmAdapter::ENotFound; + } + CleanupStack::PopAndDestroy(); // iapMatch */ + + } + else if(segment == KNSmlDMStreamingAdapterNetInfoHSDPA) + { + // Get for network information when data bearer is HSDPA + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoHSDPA"); + retValue = GetNetInfoL(aObject,EBearerHSDPA,KNSmlDMStreamingAdapterNetInfoHSDPA); + return retValue; + + + } + else if(segment == KNSmlDMStreamingAdapterNetInfoGPRS) + { + // Get for network information when data bearer is GPRS + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoGPRS"); + retValue = GetNetInfoL(aObject,EBearerGPRS,KNSmlDMStreamingAdapterNetInfoGPRS); + return retValue; + } + else if(segment == KNSmlDMStreamingAdapterNetInfoEGPRS) + { + // Get for network information when data bearer is EGPRS + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoEGPRS"); + retValue = GetNetInfoL(aObject,EBearerEGPRS,KNSmlDMStreamingAdapterNetInfoEGPRS); + return retValue; + } + else if(segment == KNSmlDMStreamingAdapterNetInfoWCDMA) + { + // Get for network information when data bearer is WCDMA + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWCDMA"); + retValue = GetNetInfoL(aObject,EBearerWCDMA,KNSmlDMStreamingAdapterNetInfoWCDMA); + return retValue; + } + else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA) + { + // Get for network information when data bearer is CDMA + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA"); + retValue = GetNetInfoL(aObject,EBearerCDMA,KNSmlDMStreamingAdapterNetInfoCDMA); + return retValue; + } + else if(segment == KNSmlDMStreamingAdapterNetInfoCDMA2000) + { + // Get for network information when data bearer is CDMA2000 + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoCDMA2000"); + retValue = GetNetInfoL(aObject,EBearerCDMA2000,KNSmlDMStreamingAdapterNetInfoCDMA2000); + return retValue; + } + else if(segment == KNSmlDMStreamingAdapterNetInfoWLAN) + { + // Get for network information when data bearer is WLAN + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterNetInfoWLAN"); + retValue = GetNetInfoL(aObject,EBearerWLAN,KNSmlDMStreamingAdapterNetInfoWLAN); + return retValue; + } + else if(segment == KNSmlDMStreamingAdapterMinUdpPort) + { + // Get for Min UDP port of streaming settings + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterMinUdpPort"); + TInt aMinPort; + err = iModel->GetMinUDPPort(aMinPort); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmInfoAdapter::FetchLeafObjectL(): Error in GetMinUDPPort: %d"), err); + retValue = CSmlDmAdapter::EError; + return retValue; + } + TBuf8<10> aMinPortBuf; + aMinPortBuf.Num(aMinPort); + aObject.InsertL(0,aMinPortBuf); + retValue= CSmlDmAdapter::EOk; + } + else if(segment == KNSmlDMStreamingAdapterMaxUdpPort) + { + // Get for Max UDP port of streaming settings + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterMaxUdpPort"); + TInt aMaxPort; + err = iModel->GetMaxUDPPort(aMaxPort); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmInfoAdapter::FetchLeafObjectL(): Error in GetMaxUDPPort: %d"), err); + retValue= CSmlDmAdapter::EError; + return retValue; + } + TBuf8<10> aMaxPortBuf; + aMaxPortBuf.Num(aMaxPort); + aObject.InsertL(0,aMaxPortBuf); + retValue= CSmlDmAdapter::EOk; + } + } + _DBG_FILE("CNSmlDmInfoAdapter::FetchLeafObjectL(): end"); + return retValue; + } + + + CSmlDmAdapter::TError CNSmlDmStreamingAdapter::GetDefaultApL(CBufBase& aObject) + { + CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): KNSmlDMStreamingAdapterToNapID"); + TUint32 aNapId; + TInt err; + err = iModel->GetDefaultAp(aNapId); + if(err != KErrNone) + { + DBG_ARGS8(_S8("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in GetDefaultAp: %d"), err); + retValue = CSmlDmAdapter::EError; + return retValue; + } + CNSmlDMIAPMatcher* iapmatch = CNSmlDMIAPMatcher::NewL( &Callback() ); + CleanupStack::PushL(iapmatch); + + HBufC8* uri8 = iapmatch->URIFromIAPIdL( aNapId ); + + if( uri8 ) + { + CleanupStack::PushL(uri8); + aObject.InsertL(0,uri8->Des()); + retValue= CSmlDmAdapter::EOk; + CleanupStack::PopAndDestroy(); // uri8 + } + else + { + _DBG_FILE("CNSmlDmStreamingAdapter::FetchLeafObjectL(): Error in URIFromIAPIdL:ENotFound"); + retValue= CSmlDmAdapter::ENotFound; + } + CleanupStack::PopAndDestroy(); // iapMatch + return retValue; + } + + +// --------------------------------------------------------------------------- +// CNSmlDmFotaAdapter::FillNodeInfoL() +// Fills the DDF node info. +// --------------------------------------------------------------------------- +// +void CNSmlDmStreamingAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, + const TSmlDmAccessTypes& aAccTypes, + MSmlDmDDFObject::TOccurence aOccurrence, + MSmlDmDDFObject::TScope aScope, + MSmlDmDDFObject::TDFFormat aFormat, + const TDesC8& aDescription ) const + { + _DBG_FILE("CNSmlDmInfoAdapter::FillNodeInfoL(): end"); + aNode.SetAccessTypesL( aAccTypes ); + aNode.SetOccurenceL( aOccurrence ); + aNode.SetScopeL( aScope ); + aNode.SetDFFormatL( aFormat ); + + if( aFormat != MSmlDmDDFObject::ENode ) + { + aNode.AddDFTypeMimeTypeL( KNSmlDMStreamingAdapterTextPlain ); + } + + aNode.SetDescriptionL( aDescription ); + _DBG_FILE("CNSmlDmInfoAdapter::FillNodeInfoL(): end"); + } + +/* + +TInt CNSmlDmStreamingAdapter::ThreadFunction(TAny* aStarted) + { + _DBG_FILE("CNSmlDmInfoAdapter::ThreadFunction(): Start"); + CTrapCleanup* cleanup = CTrapCleanup::New(); + _DBG_FILE("CNSmlDmInfoAdapter::CTrapCleanup New"); + RMsgQueueBase& aMsgQ= *(RMsgQueueBase*) aStarted; + CNetworkInfo * aNetInfo; + TRAPD(err,aNetInfo = CNetworkInfo::NewL()); + _DBG_FILE("CNSmlDmInfoAdapter::CNetworkInfo New"); + TRAP(err,aNetInfo->GetNetworkInfoL(aMsgQ)); + _DBG_FILE("CNSmlDmInfoAdapter::ThreadFunction(): End"); + delete aNetInfo; + delete cleanup; + } +*/ + +// ----------------------------------------------------------------------------- +// CStreamingAdapter::Cleanup +// ----------------------------------------------------------------------------- +// +void CNSmlDmStreamingAdapter::Cleanup( TAny* aAny ) + { + RImplInfoPtrArray* implArray = + reinterpret_cast< RImplInfoPtrArray*> ( aAny ); + implArray->ResetAndDestroy(); + implArray->Close(); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +#ifndef IMPLEMENTATION_PROXY_ENTRY +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KNSmlDMStreamingAdapterImplUid, CNSmlDmStreamingAdapter::NewL) + }; + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmStreamingAdapter: begin"); + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + _DBG_FILE("ImplementationGroupProxy() for CNSmlDmStreamingAdapter: end"); + return ImplementationTable; + } + +// End of file + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/bld/nsmldmsettingsadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/bld/nsmldmsettingsadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/inc/NSmlDMSettingsAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/inc/NSmlDMSettingsAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/src/NSmlDmSettingsAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/src/NSmlDmSettingsAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/src/nsmldmsettingsadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/src/nsmldmsettingsadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/bwins/syncmldmtestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/bwins/syncmldmtestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/conf/syncmldmtest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/conf/syncmldmtest.cfg Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/eabi/syncmldmtestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/eabi/syncmldmtestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/group/syncmldmtest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/group/syncmldmtest.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/group/syncmldmtest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/group/syncmldmtest.pkg Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/inc/TestDmDDFObject.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/inc/dmatest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/inc/syncmldmtest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/inc/syncmldmtest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/init/syncmldmtest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/init/syncmldmtest.ini Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/src/TestDmDDFObject.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/src/dmatest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/src/syncmldmtest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/src/syncmldmtest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm/tsrc/src/syncmldmtestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm/tsrc/src/syncmldmtestBlocks.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/bld/nsmldmsettingsadapter12.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/bld/nsmldmsettingsadapter12.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/inc/NSmlDMSettingsAdapter12.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 >= 0 ) + { + 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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/src/nsmldmsettingsadapter12.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/src/nsmldmsettingsadapter12.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/bwins/syncmldm12testu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/bwins/syncmldm12testu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/conf/syncmldm12test.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/conf/syncmldm12test.cfg Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/eabi/syncmldm12testu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/eabi/syncmldm12testu.def Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/group/syncmldm12test.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/group/syncmldm12test.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/group/syncmldm12test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/group/syncmldm12test.pkg Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/inc/TestDmDDFObject.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/inc/dmatest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/inc/syncmldm12test.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/inc/syncmldm12test.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/init/syncmldm12test.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/init/syncmldm12test.ini Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/src/TestDmDDFObject.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/src/dmatest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/src/syncmldm12test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/src/syncmldm12test.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmldm12/tsrc/src/syncmldm12testBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmldm12/tsrc/src/syncmldm12testBlocks.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/bld/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/bld/nsmldssettingsadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/bld/nsmldssettingsadapter.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/inc/NSmlDSSettingsAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/inc/NSmlDSSettingsAdapter.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/src/NSmlDsSettingsAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/src/NSmlDsSettingsAdapter.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/src/nsmldssettingsadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/src/nsmldssettingsadapter.rss Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/bwins/syncmldstestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/bwins/syncmldstestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/conf/syncmldstest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/conf/syncmldstest.cfg Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/eabi/syncmldstestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/eabi/syncmldstestu.def Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/group/bld.inf Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/group/syncmldstest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/group/syncmldstest.mmp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/group/syncmldstest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/group/syncmldstest.pkg Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/inc/TestDmDDFObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/inc/TestDmDDFObject.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/inc/dmatest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/inc/dmatest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/inc/syncmldstest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/inc/syncmldstest.h Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/init/syncmldstest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/init/syncmldstest.ini Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/src/TestDmDDFObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/src/TestDmDDFObject.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/src/dmatest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/src/dmatest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/src/syncmldstest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/src/syncmldstest.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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 7d88c1eb7da3 -r 751cd8585b82 omadmadapters/syncmlds/tsrc/src/syncmldstestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadmadapters/syncmlds/tsrc/src/syncmldstestBlocks.cpp Thu Jul 22 16:30:53 2010 +0100 @@ -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