sl@0: /* sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * RSecSettingsSession implementation. See class and function definitions sl@0: * for more detail. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "secsettingscommon.h" sl@0: sl@0: namespace SecuritySettingsServer sl@0: { sl@0: sl@0: sl@0: EXPORT_C RSecSettingsSession::RSecSettingsSession() sl@0: /** sl@0: This constructor provides a single point of definition from sl@0: which the superclass constructor is called. sl@0: */ sl@0: : RScsClientBase() sl@0: { sl@0: // empty. sl@0: } sl@0: sl@0: EXPORT_C TInt RSecSettingsSession::Connect() sl@0: /** sl@0: Connect to the SecSettings server. sl@0: sl@0: The thread which calls this function must be the same one which later calls Close(). sl@0: sl@0: @return Symbian OS error code where KErrNone indicates sl@0: success and any other value indicates failure. sl@0: */ sl@0: { sl@0: TVersion v = SecuritySettingsServer::Version(); sl@0: TUidType serverFullUid = SecuritySettingsServer::ServerImageFullUid(); sl@0: sl@0: TInt r = RScsClientBase::Connect( sl@0: SecuritySettingsServer::KSecSettingsServerName, v, SecuritySettingsServer::KServerImageName, serverFullUid); sl@0: sl@0: sl@0: if(r != KErrNone) sl@0: { sl@0: Close(); sl@0: } sl@0: sl@0: return r; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: EXPORT_C void RSecSettingsSession::Close() sl@0: /** sl@0: Frees the configuration object and calls RScsClientBase::Close sl@0: sl@0: This function MUST be called by the same thread which Connect(). sl@0: */ sl@0: { sl@0: RScsClientBase::Close(); sl@0: } sl@0: sl@0: sl@0: EXPORT_C TInt RSecSettingsSession::SettingValueL(TUid aUidRepository, TUint32 aKey) sl@0: /** sl@0: * Retrieves the value of the setting from the repository. sl@0: * sl@0: * @param aUidRepository UID of the Central Repository. sl@0: * @param aKey 32-bit unsigned Key identifying the setting. sl@0: * @return Value of the setting. sl@0: */ sl@0: { sl@0: TPckgBuf p; sl@0: TIpcArgs args(aUidRepository.iUid, aKey, &p); sl@0: sl@0: User::LeaveIfError(CallSessionFunction(ESettingValue, args)); sl@0: sl@0: TInt Value = p(); sl@0: sl@0: return Value; sl@0: } sl@0: sl@0: sl@0: } // End of namespace SecuritySettingsServer. sl@0: sl@0: // End of file sl@0: