os/security/cryptomgmtlibs/securityutils/source/secsettings/secsettingsclient/rsecsettingssession.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptomgmtlibs/securityutils/source/secsettings/secsettingsclient/rsecsettingssession.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,107 @@
     1.4 +/*
     1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* RSecSettingsSession implementation.	 See class and function definitions
    1.19 +* for more detail.
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +/**
    1.25 + @file
    1.26 +*/
    1.27 +
    1.28 +
    1.29 +#include <secsettings/secsettingsclient.h>
    1.30 +#include <e32property.h>
    1.31 +#include <e32debug.h>
    1.32 +#include "secsettingscommon.h"
    1.33 +
    1.34 +namespace SecuritySettingsServer
    1.35 +	{
    1.36 +
    1.37 +
    1.38 +EXPORT_C RSecSettingsSession::RSecSettingsSession()
    1.39 +/**
    1.40 +	This constructor provides a single point of definition from
    1.41 +	which the superclass constructor is called.
    1.42 + */
    1.43 +:	RScsClientBase()
    1.44 +	{
    1.45 +	// empty.
    1.46 +	}
    1.47 +
    1.48 +EXPORT_C TInt RSecSettingsSession::Connect()
    1.49 +/**
    1.50 +	Connect to the SecSettings server.
    1.51 +
    1.52 +	The thread which calls this function must be the same one which later calls Close().
    1.53 +
    1.54 +	@return					Symbian OS error code where KErrNone indicates
    1.55 +							success and any other value indicates failure.
    1.56 + */
    1.57 +	{
    1.58 +	TVersion v = SecuritySettingsServer::Version();
    1.59 +	TUidType serverFullUid = SecuritySettingsServer::ServerImageFullUid();
    1.60 +
    1.61 +	TInt r = RScsClientBase::Connect(
    1.62 +	        SecuritySettingsServer::KSecSettingsServerName, v, SecuritySettingsServer::KServerImageName, serverFullUid);
    1.63 +	
    1.64 +
    1.65 +	if(r != KErrNone)
    1.66 +		{
    1.67 +		Close();
    1.68 +		}
    1.69 +	
    1.70 +	return r;
    1.71 +	}
    1.72 +	
    1.73 +
    1.74 +	
    1.75 +
    1.76 +EXPORT_C void RSecSettingsSession::Close()
    1.77 +/**
    1.78 +Frees the configuration object and calls RScsClientBase::Close
    1.79 +
    1.80 +This function MUST be called by the same thread which Connect().
    1.81 +*/
    1.82 +	{
    1.83 +	RScsClientBase::Close();
    1.84 +	}
    1.85 +
    1.86 +
    1.87 +EXPORT_C TInt RSecSettingsSession::SettingValueL(TUid aUidRepository, TUint32 aKey)
    1.88 +/**
    1.89 + * Retrieves the value of the setting from the repository.
    1.90 + *
    1.91 + * @param	aUidRepository		UID of the Central Repository.
    1.92 + * @param	aKey				32-bit unsigned Key identifying the setting. 
    1.93 + * @return						Value of the setting.
    1.94 + */
    1.95 +    {    	
    1.96 +    TPckgBuf<TInt> p;
    1.97 +    TIpcArgs args(aUidRepository.iUid, aKey, &p);  
    1.98 +        
    1.99 +    User::LeaveIfError(CallSessionFunction(ESettingValue, args));
   1.100 +
   1.101 +    TInt Value = p();
   1.102 +    
   1.103 +    return Value;
   1.104 +    }
   1.105 +
   1.106 +
   1.107 +	} // End of namespace SecuritySettingsServer.
   1.108 +
   1.109 +// End of file
   1.110 +