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