os/security/cryptomgmtlibs/securityutils/source/secsettings/secsettingsclient/rsecsettingssession.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* RSecSettingsSession implementation.	 See class and function definitions
sl@0
    16
* for more detail.
sl@0
    17
*
sl@0
    18
*/
sl@0
    19
sl@0
    20
sl@0
    21
/**
sl@0
    22
 @file
sl@0
    23
*/
sl@0
    24
sl@0
    25
sl@0
    26
#include <secsettings/secsettingsclient.h>
sl@0
    27
#include <e32property.h>
sl@0
    28
#include <e32debug.h>
sl@0
    29
#include "secsettingscommon.h"
sl@0
    30
sl@0
    31
namespace SecuritySettingsServer
sl@0
    32
	{
sl@0
    33
sl@0
    34
sl@0
    35
EXPORT_C RSecSettingsSession::RSecSettingsSession()
sl@0
    36
/**
sl@0
    37
	This constructor provides a single point of definition from
sl@0
    38
	which the superclass constructor is called.
sl@0
    39
 */
sl@0
    40
:	RScsClientBase()
sl@0
    41
	{
sl@0
    42
	// empty.
sl@0
    43
	}
sl@0
    44
sl@0
    45
EXPORT_C TInt RSecSettingsSession::Connect()
sl@0
    46
/**
sl@0
    47
	Connect to the SecSettings server.
sl@0
    48
sl@0
    49
	The thread which calls this function must be the same one which later calls Close().
sl@0
    50
sl@0
    51
	@return					Symbian OS error code where KErrNone indicates
sl@0
    52
							success and any other value indicates failure.
sl@0
    53
 */
sl@0
    54
	{
sl@0
    55
	TVersion v = SecuritySettingsServer::Version();
sl@0
    56
	TUidType serverFullUid = SecuritySettingsServer::ServerImageFullUid();
sl@0
    57
sl@0
    58
	TInt r = RScsClientBase::Connect(
sl@0
    59
	        SecuritySettingsServer::KSecSettingsServerName, v, SecuritySettingsServer::KServerImageName, serverFullUid);
sl@0
    60
	
sl@0
    61
sl@0
    62
	if(r != KErrNone)
sl@0
    63
		{
sl@0
    64
		Close();
sl@0
    65
		}
sl@0
    66
	
sl@0
    67
	return r;
sl@0
    68
	}
sl@0
    69
	
sl@0
    70
sl@0
    71
	
sl@0
    72
sl@0
    73
EXPORT_C void RSecSettingsSession::Close()
sl@0
    74
/**
sl@0
    75
Frees the configuration object and calls RScsClientBase::Close
sl@0
    76
sl@0
    77
This function MUST be called by the same thread which Connect().
sl@0
    78
*/
sl@0
    79
	{
sl@0
    80
	RScsClientBase::Close();
sl@0
    81
	}
sl@0
    82
sl@0
    83
sl@0
    84
EXPORT_C TInt RSecSettingsSession::SettingValueL(TUid aUidRepository, TUint32 aKey)
sl@0
    85
/**
sl@0
    86
 * Retrieves the value of the setting from the repository.
sl@0
    87
 *
sl@0
    88
 * @param	aUidRepository		UID of the Central Repository.
sl@0
    89
 * @param	aKey				32-bit unsigned Key identifying the setting. 
sl@0
    90
 * @return						Value of the setting.
sl@0
    91
 */
sl@0
    92
    {    	
sl@0
    93
    TPckgBuf<TInt> p;
sl@0
    94
    TIpcArgs args(aUidRepository.iUid, aKey, &p);  
sl@0
    95
        
sl@0
    96
    User::LeaveIfError(CallSessionFunction(ESettingValue, args));
sl@0
    97
sl@0
    98
    TInt Value = p();
sl@0
    99
    
sl@0
   100
    return Value;
sl@0
   101
    }
sl@0
   102
sl@0
   103
sl@0
   104
	} // End of namespace SecuritySettingsServer.
sl@0
   105
sl@0
   106
// End of file
sl@0
   107