diff -r 000000000000 -r 4e1aa6a622a0 sysstatemgmt/ssmcustcmds/ssmsystemcmds/src/ssmsystemcommandsbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysstatemgmt/ssmcustcmds/ssmsystemcmds/src/ssmsystemcommandsbase.cpp Tue Feb 02 00:53:00 2010 +0200 @@ -0,0 +1,105 @@ +/* +* 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 CSsmSystemCommandsBase class. +* +*/ + +#include "ssmsystemcommandsbase.h" +#include "ssmmapperutility.h" +#include "trace.h" + +#include +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// CSsmSystemCommandsBase::~CSsmSystemCommandsBase +// --------------------------------------------------------------------------- +// +CSsmSystemCommandsBase::~CSsmSystemCommandsBase() + { + FUNC_LOG; + delete iMapperUtility; + } + + +// --------------------------------------------------------------------------- +// CSsmSystemCommandsBase::CSsmSystemCommandsBase +// --------------------------------------------------------------------------- +// +CSsmSystemCommandsBase::CSsmSystemCommandsBase() + { + + } + +// --------------------------------------------------------------------------- +// CSsmSystemCommandsBase::DefineL +// --------------------------------------------------------------------------- +// +void CSsmSystemCommandsBase::DefineL( + TUid aCategory, + TUint aKey, + const TSecurityPolicy& aReadPolicy, + const TSecurityPolicy& aWritePolicy ) + { + FUNC_LOG; + + INFO_2( "Defining key 0x%08x::0x%08x", aCategory, aKey ); + + TInt errorCode = RProperty::Define( MapperUtilityL().PsUid( aCategory ), + aKey, + RProperty::EInt, + aReadPolicy, + aWritePolicy ); + if ( errorCode == KErrAlreadyExists ) + { + INFO_2( "Key 0x%08x::0x%08x already defined", aCategory, aKey ); + errorCode = KErrNone; + } + + ERROR_2( errorCode, "Failed to define PS key 0x%08x::0x%08x", aCategory, + aKey ); + User::LeaveIfError( errorCode ); + } + +// --------------------------------------------------------------------------- +// CSsmSystemCommandsBase::DefineL +// --------------------------------------------------------------------------- +// +void CSsmSystemCommandsBase::SetL( TUid aCategory, TUint aKey, TInt aValue ) + { + FUNC_LOG; + INFO_3( "Setting key 0x%08x::0x%08x value %d", aCategory, aKey, aValue ); + + TInt errorCode = RProperty::Set( MapperUtilityL().PsUid( aCategory ), + aKey, + aValue ); + ERROR_2( errorCode, "Failed to set PS key 0x%08x::0x%08x", aCategory, + aKey ); + User::LeaveIfError( errorCode ); + } +// --------------------------------------------------------------------------- +// CSsmSystemCommandsBase::MapperUtilityL +// --------------------------------------------------------------------------- +// +CSsmMapperUtility& CSsmSystemCommandsBase::MapperUtilityL() + { + FUNC_LOG; + if ( !iMapperUtility ) + { + iMapperUtility = CSsmMapperUtility::NewL(); + } + return *iMapperUtility; + }