os/kernelhwsrv/kernel/eka/include/drivers/hcr.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/hcr.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,530 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Hardware Configuration Respoitory Platform Independent Layer (PIL)
    1.18 +//
    1.19 +
    1.20 +
    1.21 +/** 
    1.22 +@file hcr.h
    1.23 +Kernel side client API for Hardware Configuration Repository (HCR). 
    1.24 +The HCR service provides access to hardware settings defined for the base port. 
    1.25 +This API is used by kernel side components such as PDDs, hardware service 
    1.26 +providers and other kernel extensions.
    1.27 +
    1.28 +@publishedPartner
    1.29 +@prototype
    1.30 +*/
    1.31 +
    1.32 +
    1.33 +
    1.34 +#ifndef HCR_H
    1.35 +#define HCR_H
    1.36 +
    1.37 +
    1.38 +// -- INCLUDES ----------------------------------------------------------------
    1.39 +
    1.40 +
    1.41 +#include <e32err.h>
    1.42 +#include <e32def.h> 
    1.43 +#include <e32cmn.h> 
    1.44 +#include <e32des8.h>
    1.45 +
    1.46 +
    1.47 +// -- CLASSES -----------------------------------------------------------------
    1.48 +
    1.49 +/**
    1.50 +The HCR namespace contains all the types and APIs that make up the
    1.51 +client API of the Kernel Hardware Configuration Repository (HCR).
    1.52 +It provides accessor functions to retrieve settings held by the HCR and may be 
    1.53 +called by kernel components from with in thread context. 
    1.54 +
    1.55 +The _published_ Setting IDs available for use with this API can be found
    1.56 +in the BSP exported header 'hcrconfig.h'. This provides the top-level header
    1.57 +that clients can include to gain access to all IDs for the BSP. IDs for settings
    1.58 +that are internal to a component and not used by others are defined in a file
    1.59 +private to that component.
    1.60 +
    1.61 +The HCR supports a number of setting repositories and searches them in a defined
    1.62 +order, always returns the first setting found matching the ID or criteria.
    1.63 +This allows setting values to be overriden by more recent repositories created
    1.64 +during platform development and product creation.
    1.65 +*/
    1.66 +namespace HCR
    1.67 +    {
    1.68 +
    1.69 +    /** Maximum length of a large setting type, in bytes */     
    1.70 +    static const TInt KMaxSettingLength = 512;
    1.71 +
    1.72 +
    1.73 +    /** Setting category identifier type */
    1.74 +    typedef TUint32 TCategoryUid;
    1.75 +    
    1.76 +    /** Setting element identifier type */
    1.77 +    typedef TUint32 TElementId;
    1.78 +        
    1.79 +    /** The setting Identifier structure. Used to create static initialised
    1.80 +    arrys for use with multiple setting retrieval calls.	
    1.81 +	*/    
    1.82 +    struct SSettingId
    1.83 +	    {
    1.84 +        TCategoryUid iCat;		//!< Allocated UID for setting category
    1.85 +        TElementId iKey;		//!< Element indetifier for setting in category
    1.86 +		};
    1.87 +		
    1.88 +    /** The setting Identifier type. A class used to uniquely identify a 
    1.89 +    setting in the HCR. Used in calls to HCR API to retrieve one setting. 
    1.90 +	*/
    1.91 +    class TSettingId : public SSettingId
    1.92 +    	{
    1.93 +    public:
    1.94 +    	TSettingId ()
    1.95 +		 { iCat = iKey = 0; };
    1.96 +    	TSettingId (TCategoryUid aCat, TElementId aKey)
    1.97 +    	 { iCat = aCat; iKey = aKey; };
    1.98 +    	TSettingId (const SSettingId& aId)
    1.99 +    	 { iCat = aId.iCat; iKey = aId.iKey; };
   1.100 +		TSettingId& operator= (const SSettingId& rhs)
   1.101 +		 { iCat = rhs.iCat; iKey = rhs.iKey; return *this; }
   1.102 +
   1.103 +    	};
   1.104 +    
   1.105 +    /** The setting types supported. The types are shown in two groups: Word 
   1.106 +    size - a maximum of 4 bytes; and ii) Large size - types exceeding 4 bytes 
   1.107 +    in size.
   1.108 +	*/
   1.109 +    enum TSettingType
   1.110 +    	{
   1.111 +        ETypeUndefined  = 0,            //!< Type unknown/not set
   1.112 +        
   1.113 +        // Word size settings
   1.114 +        ETypeInt32      = 0x00000001,   //!< 32bit signed integer
   1.115 +        ETypeInt16      = 0x00000002,   //!< 16bit signed integer
   1.116 +        ETypeInt8       = 0x00000004,   //!< 8bit signed integer
   1.117 +        ETypeBool       = 0x00000008,   //!< 32bit boolean value
   1.118 +        ETypeUInt32     = 0x00000010,   //!< 32bit unsigned integer
   1.119 +        ETypeUInt16     = 0x00000020,   //!< 16bit unsigned integer
   1.120 +        ETypeUInt8      = 0x00000040,   //!< 8bit unsigned integer
   1.121 +        ETypeLinAddr    = 0x00000100,   //!< 32bit virtual address
   1.122 +        
   1.123 +        // Large settings
   1.124 +        ETypeBinData   		= 0x00010000,   //!< Raw binary data (TUint8 array)
   1.125 +        ETypeText8     		= 0x00020000,   //!< String data (TText8 array) 
   1.126 +		ETypeArrayInt32 	= 0x00040000,	//!< 32bit signed integer array   
   1.127 +		ETypeArrayUInt32	= 0x00080000,	//!< 32bit unsigned integer array
   1.128 +        ETypeInt64     		= 0x01000000,   //!< 64bit signed integer
   1.129 +        ETypeUInt64    		= 0x02000000,   //!< 64bit unsigned integer    
   1.130 +     	};
   1.131 +
   1.132 +
   1.133 +	/**
   1.134 +    Retrieve a word size integer setting value from the HCR.
   1.135 +    On error aValue is undefined.
   1.136 +        
   1.137 +    @param aId     in: The setting identifier
   1.138 +    @param aValue  out: The retrieved setting data value  
   1.139 +    
   1.140 +	@return	KErrNone if successful, output parameters valid
   1.141 +            KErrNotFound if aId is not a known setting ID
   1.142 +            KErrArgument if the setting identified is not the correct type
   1.143 +            KErrNotReady if the HCR is used before it has been initialised
   1.144 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.145 +            KErrGeneral if an internal failure occurs, see trace.
   1.146 +            Otherwise one of the other system-wide error codes. 
   1.147 +
   1.148 +	@pre    Call from thread context, during Init1 or later
   1.149 +	*/
   1.150 +	IMPORT_C TInt GetInt(const TSettingId& aId, TInt8& aValue);
   1.151 +	IMPORT_C TInt GetInt(const TSettingId& aId, TInt16& aValue);
   1.152 +	IMPORT_C TInt GetInt(const TSettingId& aId, TInt32& aValue);
   1.153 +    IMPORT_C TInt GetInt(const TSettingId& aId, TInt64& aValue);
   1.154 +	
   1.155 +	/**
   1.156 +    Retrieve a boolean setting value from the HCR.
   1.157 +    On error aValue is undefined.
   1.158 +    
   1.159 +    @param aId     in: The setting identifier
   1.160 +    @param aValue  out: The retrieved setting data value  
   1.161 +    
   1.162 +	@return	KErrNone if successful, output parameters valid
   1.163 +            KErrNotFound if aId is not a known setting ID
   1.164 +            KErrArgument if the setting identified is not the correct type
   1.165 +            KErrNotReady if the HCR is used before it has been initialised
   1.166 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.167 +            KErrGeneral if an internal failure occurs, see trace.
   1.168 +            Otherwise one of the other system-wide error codes. 
   1.169 +
   1.170 +	@pre    Call from thread context, during Init1 or later
   1.171 +	*/
   1.172 +	IMPORT_C TInt GetBool(const TSettingId& aId, TBool& aValue);
   1.173 +	
   1.174 +	/**
   1.175 +    Retrieve an word size unsigned integer setting value from the HCR.
   1.176 +    On error aValue is undefined.
   1.177 +        
   1.178 +    @param aId     in: The setting identifier
   1.179 +    @param aValue  out: The retrieved setting data value  
   1.180 +    
   1.181 +	@return	KErrNone if successful, output parameters valid
   1.182 +            KErrNotFound if aId is not a known setting ID
   1.183 +            KErrArgument if the setting identified is not the correct type
   1.184 +            KErrNotReady if the HCR is used before it has been initialised
   1.185 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.186 +            KErrGeneral if an internal failure occurs, see trace.
   1.187 +            Otherwise one of the other system-wide error codes. 
   1.188 +
   1.189 +	@pre    Call from thread context, during Init1 or later
   1.190 +	*/
   1.191 +	IMPORT_C TInt GetUInt(const TSettingId& aId, TUint8& aValue);
   1.192 +    IMPORT_C TInt GetUInt(const TSettingId& aId, TUint16& aValue);
   1.193 +    IMPORT_C TInt GetUInt(const TSettingId& aId, TUint32& aValue);
   1.194 +    IMPORT_C TInt GetUInt(const TSettingId& aId, TUint64& aValue);
   1.195 +
   1.196 +	/**
   1.197 +    Retrieve a word size linear address setting value from the HCR.
   1.198 +    On error aValue is undefined.
   1.199 +        
   1.200 +    @param aId     in: The setting identifier
   1.201 +    @param aValue  out: The retrieved setting data value  
   1.202 +    
   1.203 +	@return	KErrNone if successful, output parameters valid
   1.204 +            KErrNotFound if aId is not a known setting ID
   1.205 +            KErrArgument if the setting identified is not the correct type
   1.206 +            KErrNotReady if the HCR is used before it has been initialised
   1.207 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.208 +            KErrGeneral if an internal failure occurs, see trace.
   1.209 +            Otherwise one of the other system-wide error codes. 
   1.210 +
   1.211 +	@pre    Call from thread context, during Init1 or later
   1.212 +	*/
   1.213 +    IMPORT_C TInt GetLinAddr(const TSettingId& aId, TLinAddr& aValue);
   1.214 +    
   1.215 +    
   1.216 +	/**
   1.217 +    Retrieve a large binary data setting value from the HCR. The value
   1.218 +	is copied into the supplied descriptor buffer. 
   1.219 +	On error the descriptor and output arguments have undefined values.
   1.220 +
   1.221 +    @param aId     in: The setting identifier
   1.222 +    @param aValue  inout: A pre-allocated descriptor to hold the value
   1.223 +    
   1.224 +	@return	KErrNone if successful and aValue has been set
   1.225 +            KErrNotFound if aId is not a known setting ID
   1.226 +            KErrArgument if the setting identified is not the correct type
   1.227 +            KErrNotReady if the HCR is used before it has been initialised
   1.228 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.229 +            KErrTooBig if the setting is larger than the supplied buffer
   1.230 +            KErrGeneral if an internal failure occurs, see trace
   1.231 +            Otherwise one of the other system-wide error codes.
   1.232 +
   1.233 +	@pre    Call from thread context, during Init1 or later
   1.234 +	*/
   1.235 +    IMPORT_C TInt GetData(const TSettingId& aId, TDes8& aValue);
   1.236 +    
   1.237 +	/**
   1.238 +    Retrieve a large binary data setting value from the HCR. The value is copied
   1.239 +	into the supplied byte array buffer. 
   1.240 +	On error the buffer and output arguments have undefined values.
   1.241 +
   1.242 +    @param aId     in: The setting identifier
   1.243 +    @param aMaxLen in: The maximum value length that can be stored in the buffer
   1.244 +    @param aValue  inout: The address of a pre-allocated buffer to hold the value
   1.245 +    @param aLen    out: Contains the length of the setting value written
   1.246 +    
   1.247 +	@return	KErrNone if successful and aValue has been set
   1.248 +            KErrNotFound if aId is not a known setting ID
   1.249 +            KErrArgument if the setting identified is not the correct type
   1.250 +            KErrNotReady if the HCR is used before it has been initialised
   1.251 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.252 +            KErrTooBig if the setting is larger than the supplied buffer
   1.253 +            KErrGeneral if an internal failure occurs, see trace
   1.254 +            Otherwise one of the other system-wide error codes.
   1.255 +
   1.256 +	@pre    Call from thread context, during Init1 or later
   1.257 +	*/
   1.258 +    IMPORT_C TInt GetData(const TSettingId& aId, TUint16 aMaxLen, 
   1.259 +                                    TUint8* aValue, TUint16& aLen);   
   1.260 +									     
   1.261 +	/**	
   1.262 +    Retrieve an 8 bit character string setting from the HCR.  The value
   1.263 +	is copied into the supplied descriptor buffer. Note the string is not zero
   1.264 +	terminated. 
   1.265 +	On error the descriptor and output arguments have undefined values.
   1.266 +    
   1.267 +    @param aId     in: The setting identifier
   1.268 +    @param aValue  inout: A pre-allocated descriptor to hold the value
   1.269 +
   1.270 +	@return	KErrNone if successful and aValue has been set
   1.271 +            KErrNotFound if aId is not a known setting ID
   1.272 +            KErrArgument if the setting identified is not the correct type
   1.273 +            KErrNotReady if the HCR is used before it has been initialised
   1.274 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.275 +            KErrTooBig if the setting is larger than the supplied buffer
   1.276 +            KErrGeneral if an internal failure occurs, see trace
   1.277 +            Otherwise one of the other system-wide error codes.
   1.278 +
   1.279 +	@pre    Call from thread context, during Init1 or later
   1.280 +	*/
   1.281 +    IMPORT_C TInt GetString(const TSettingId& aId, TDes8& aValue);
   1.282 +									     
   1.283 +	/**	
   1.284 +    Retrieve an 8 bit character string setting from the HCR.  The value
   1.285 +	is copied into the byte array buffer. Note the string is not zero
   1.286 +	terminated. 
   1.287 +	On error the descriptor and output arguments have undefined values.
   1.288 +    
   1.289 +    @param aId     in: The setting identifier
   1.290 +    @param aMaxLen in: The maximum value length that can be stored in the buffer
   1.291 +    @param aValue  inout: The address of a pre-allocated buffer to hold the value
   1.292 +	@param aLen    out: Contains the length of the setting value written    
   1.293 +
   1.294 +	@return	KErrNone if successful and aValue has been set
   1.295 +            KErrNotFound if aId is not a known setting ID
   1.296 +            KErrArgument if the setting identified is not the correct type
   1.297 +            KErrNotReady if the HCR is used before it has been initialised
   1.298 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.299 +            KErrTooBig if the setting is larger than the supplied buffer
   1.300 +            KErrGeneral if an internal failure occurs, see trace
   1.301 +            Otherwise one of the other system-wide error codes.
   1.302 +
   1.303 +	@pre    Call from thread context, during Init1 or later
   1.304 +	*/
   1.305 +    IMPORT_C TInt GetString(const TSettingId& aId, TUint16 aMaxLen, 
   1.306 +                                    TText8* aValue, TUint16& aLen);
   1.307 +                                                                        
   1.308 +	/**
   1.309 +    Retrieve an array of signed integers from the HCR. The value
   1.310 +	is copied into the byte array buffer. 
   1.311 +	On error the descriptor and output arguments have undefined values.
   1.312 +
   1.313 +    @param aId     in: The setting identifier
   1.314 +    @param aMaxLen in: The maximum value length that can be stored in the buffer
   1.315 +    @param aValue  inout: The address of a pre-allocated word array to hold the value
   1.316 +    @param aLen    out: Contains the length, in bytes of the setting value written
   1.317 +    
   1.318 +	@return	KErrNone if successful and aValue has been set
   1.319 +            KErrNotFound if aId is not a known setting ID
   1.320 +            KErrArgument if the setting identified is not the correct type
   1.321 +            KErrNotReady if the HCR is used before it has been initialised
   1.322 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.323 +            KErrTooBig if the setting is larger than the supplied buffer
   1.324 +            KErrGeneral if an internal failure occurs, see trace
   1.325 +            Otherwise one of the other system-wide error codes.
   1.326 +
   1.327 +	@pre    Call from thread context, during Init1 or later
   1.328 +	*/
   1.329 +    IMPORT_C TInt GetArray(const TSettingId& aId, TUint16 aMaxLen, 
   1.330 +                                    TInt32* aValue, TUint16& aLen);        
   1.331 +    IMPORT_C TInt GetArray(const TSettingId& aId, TUint16 aMaxLen, 
   1.332 +                                    TUint32* aValue, TUint16& aLen);   
   1.333 +									     
   1.334 +    /**
   1.335 +    Retrieve multiple word sized settings from the Hardware Configuration 
   1.336 +    Repository in one call. This method can be used for all settings of size 4 
   1.337 +    bytes or less (i.e those with a type less than 0x0000ffff).
   1.338 +    The caller is responsible for pre-allocating the arrays supplied. Note the
   1.339 +    array of setting IDs (aIds) supplied by the client must be ordered with 
   1.340 +	aIds[0] containing the lowest and aIds[aNum-1] the highest. Undefined 
   1.341 +	behaviour will result if this pre-condition is not met.
   1.342 +	
   1.343 +	On successful return the client will need to check the number found (return
   1.344 +	value) matches their needs and cast each value in the aValues
   1.345 +	array to the correct type before use. The correct type is either known at 
   1.346 +	compile time by the caller or determined from aTypes, if supplied.
   1.347 +	
   1.348 +   	When an overall error is returned from the function the output arrays have 
   1.349 +	undefined values.
   1.350 +
   1.351 +    @param aNum     in: The number of settings to retrieve. It is also the 
   1.352 +                    size of the arrays in the following arguments
   1.353 +    @param aIds     in:  An ordered array of setting identifiers to retrieve
   1.354 +    @param aValues  inout: An array of values, populated on exit
   1.355 +    @param aTypes   inout: An optional array of type enumerations, populated on
   1.356 +					exit describing the type of each setting found. 
   1.357 +					May be 0 if client is not interested
   1.358 +    @param aErrors  inout: An array of search errors for each setting populated 
   1.359 +					on exit. If no error found for the setting then KErrNone
   1.360 +					is written. Possible error codes:
   1.361 +                    KErrArgument     the setting is not of a suitable type
   1.362 +                    KErrNotFound     the setting is not found
   1.363 +                    KErrNone         when setting found
   1.364 +                       
   1.365 +    
   1.366 +	@return	Zero or positive number of settings found, -ve on error
   1.367 +            KErrArgument    if some parameters are wrong(i.e. aErrors is a null
   1.368 +                            pointer, aNum is negative and so on)
   1.369 +            KErrCorrupt     if HCR finds a repository to be corrupt
   1.370 +            KErrGeneral     if an internal failure occurs, see trace
   1.371 +            KErrNotReady    if the HCR is used before it has been initialised
   1.372 +            KErrNoMemory    if the memory allocation within this function failed
   1.373 +            Otherwise one of the other system-wide error codes.
   1.374 +                
   1.375 +	@pre    Call from thread context, during Init1 or later
   1.376 +	*/   
   1.377 +    IMPORT_C TInt GetWordSettings(TInt aNum, const SSettingId aIds[], 
   1.378 +            TInt32 aValues[], TSettingType aTypes[], TInt aErrors[]);
   1.379 +    
   1.380 +
   1.381 +    /**
   1.382 +    Retrieve the type and size of a HCR setting. Can be used by clients to 
   1.383 +    obtain the setting size should a buffer need to be allocated.
   1.384 +    On error the output arguments are undefined.    
   1.385 +    
   1.386 +    @param aId     in: The setting identifier
   1.387 +    @param aType   out: The type enumeration of the found setting
   1.388 +    @param aLen    out: The length in bytes of the found setting
   1.389 +        
   1.390 +	@return	KErrNone if successful, output parameters valid
   1.391 +            KErrNotFound if aId is not a known setting ID
   1.392 +            KErrNotReady if the HCR is used before it has been initialised
   1.393 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.394 +            KErrGeneral if an internal failure occurs, see trace
   1.395 +            Otherwise one of the other system-wide error codes.
   1.396 +
   1.397 +	@pre    Call from thread context, during Init1 or later
   1.398 +    */    
   1.399 +    IMPORT_C TInt GetTypeAndSize(const TSettingId& aId, 
   1.400 +                                        TSettingType& aType, TUint16& aLen);
   1.401 +                                        
   1.402 +    /**
   1.403 +    Retrieve the number of unique ettings held in the HCR for one particular 
   1.404 +	category. It allows a client to perpare buffers for other calls to the HCR 
   1.405 +	to retrieve these settings. 
   1.406 +	The method carries out a search to return the total number of unique setting
   1.407 +	records found across all HCR repositories for a given category. It does not 
   1.408 +	count settings that are duplicate from being redefined in different 
   1.409 +	repositories.
   1.410 +	The function is particularly useful for open-ended categories were the 
   1.411 +	run-time client can not predict the number of settings prvisioned. 
   1.412 +	
   1.413 +    @param aCatUid	in: The setting identifier category to use in the search
   1.414 +        
   1.415 +	@return	Zero or positive number of settings found in category, -ve on error
   1.416 +            KErrNotReady if the HCR is used before it has been initialised
   1.417 +            KErrCorrupt if HCR finds a repository to be corrupt
   1.418 +            KErrGeneral if an internal failure occurs, see trace
   1.419 +            Otherwise one of the other system-wide error codes.
   1.420 +
   1.421 +	@pre    Call from thread context, during Init1 or later
   1.422 +    */ 
   1.423 +	IMPORT_C TInt FindNumSettingsInCategory (TCategoryUid aCatUid);
   1.424 +	
   1.425 +	/**
   1.426 +    Retrieve details of all the settings (ids, types and sizes) in one 
   1.427 +	particular category. This function can be used by clients to obtain the 
   1.428 +	number of, ids, sizes and types of all the settings in a category. 
   1.429 +	It allows a client to alloc buffers for other calls to the HCR to retrieve 
   1.430 +	the values of these settings.
   1.431 +	
   1.432 +   	On successful return the client will need to check the number found (return
   1.433 +	value) matches the expected number. When there are more defined in
   1.434 +	the category than was able to be returned, i.e. when number found 
   1.435 +	exceeded aMaxNum then aMaxNum is returned.
   1.436 +	
   1.437 +   	When an overall error is returned from the function the output arrays have 
   1.438 +	undefined values.
   1.439 +
   1.440 +    @param aCat  	 in: The setting category to search for
   1.441 +    @param aMaxNum   in: The maximum number of settings to return. It is also 
   1.442 +                         the size of the arrays in the following arguments 
   1.443 +    @param aKeyIds   inout: Client supplied array populated on exit. Large
   1.444 +						    enough to hold all elements in category.
   1.445 +    @param aTypes	 inout: Client supplied array populated with setting types 
   1.446 +						    enumerations on exit. Array address may be 0 if 
   1.447 +                            client is not interested.
   1.448 +    @param aLens  	 inout: Client supplied array populated with setting lengths
   1.449 +						    on exit for those settings with a type > 0x0000ffff. 
   1.450 +							When less than this 0 is set in the aLens array element. 
   1.451 +							Array address may be 0 if client is not interested.
   1.452 +        
   1.453 +	@return	Zero or positive number of settings found in category, -ve on error
   1.454 +			KErrArgument if some parameters are wrong(i.e. aErrors is a null
   1.455 +                            pointer, aNum is negative and so on)
   1.456 +			KErrNotReady if the HCR is used before it has been initialised
   1.457 +            KErrCorrupt  if HCR finds a repository to be corrupt
   1.458 +            KErrGeneral  if an internal failure occurs, see trace
   1.459 +            Otherwise one of the other system-wide error codes.
   1.460 +
   1.461 +	@pre    Call from thread context, during Init1 or later
   1.462 +    */ 
   1.463 +    IMPORT_C TInt FindSettings(TCategoryUid aCatUid, TInt aMaxNum,
   1.464 +					TElementId aKeyIds[], TSettingType aTypes[], TUint16 aLens[]);
   1.465 +                                       
   1.466 +    /** 
   1.467 +    Retrieve details of all the settings (ids, types and sizes) in one 
   1.468 +	particular category who's key ID matches the supplied bit pattern/mask.
   1.469 +	This function can be used by clients to obtain the number of, ids, sizes 
   1.470 +	and types of all the settings in a category. It allows a client to alloc 
   1.471 +	buffers for other calls to the HCR to retrieve the values of these settings. 
   1.472 +	
   1.473 +	This search method allows categories to contain structured settings 
   1.474 +	i.e. row/column structured or record based categories as might be used
   1.475 +	for configuration data of a hardware service provider.
   1.476 +        
   1.477 +    The caller supplies the category to search, a setting key ID mask and the 
   1.478 +    pattern to match. Setting keys that satisfy this logic are returned:
   1.479 +    ((elementID & aElementMask) == (aPattern & aElementMask))
   1.480 +    
   1.481 +    For example, a set of driver capability structures might be encoded into
   1.482 +    an element ID where the 24 MSb are the row/record number and the 8 LSb 
   1.483 +    are the column/field index. Thus to retrieve all fields in row 2 supply: 
   1.484 +        aElemMask = 0xffffff00, aPattern = 0x000002** 
   1.485 +    to retrieve key fields of all records supply:
   1.486 +        aElemMask = 0x000000ff, aPattern = 0x******01
   1.487 +    (* = dont care)
   1.488 +    
   1.489 +   	On successful return the client will need to check the number found (return
   1.490 +	value) matches the expected number. When there are more defined in
   1.491 +	the category than was able to be returned, i.e. when number found 
   1.492 +	exceeded aMaxNum then aMaxNum is returned.
   1.493 +	
   1.494 +   	When an overall error is returned from the function the output arrays have 
   1.495 +	undefined values.
   1.496 +   
   1.497 +    @param aCat      in: The category to retrieve settings for
   1.498 +    @param aMaxNum   in: The maximum number of settings to retrieve. It is also 
   1.499 +                         the size of the arrays in the following arguments   
   1.500 +    @param aMask     in: The bits in the Element ID to be checked against 
   1.501 +                         aPattern
   1.502 +    @param aPattern  in: Identified the bits that must be set for a 
   1.503 +                         setting to be returned in the search
   1.504 +    @param aKeyIds   inout: Client supplied array populated on exit. Large
   1.505 +						    enough to hold aMaxNum element ids.
   1.506 +    @param aTypes	 inout: Client supplied array populated with setting types 
   1.507 +						    enumerations on exit. Array address may be 0 if 
   1.508 +                            client is not interested.
   1.509 +    @param aLens  	 inout: Client supplied array populated with setting lengths
   1.510 +						    on exit for those settings with a type > 0x0000ffff. 
   1.511 +							When less than this 0 is set in the aLens array element. 
   1.512 +							Array address may be 0 if client is not interested.
   1.513 +    
   1.514 +	@return	Zero or positive number of settings found in category, -ve on error
   1.515 +            KErrArgument if some parameters are wrong(i.e. aErrors is a null
   1.516 +                            pointer, aNum is negative and so on) 
   1.517 +            KErrNotReady if the HCR is used before it has been initialised
   1.518 +            KErrCorrupt  if HCR finds a repository to be corrupt
   1.519 +            KErrGeneral  if an internal failure occurs, see trace
   1.520 +            KErrNoMemory if the memory allocation within this function failed
   1.521 +            Otherwise one of the other system-wide error codes.
   1.522 +            
   1.523 +         
   1.524 +	@pre    Call from thread context, during Init1 or later
   1.525 +	*/    
   1.526 +    IMPORT_C TInt FindSettings(TCategoryUid aCat, TInt aMaxNum, 
   1.527 +					TUint32 aMask, TUint32 aPattern, TElementId aKeyIds[], 
   1.528 +					TSettingType aTypes[], TUint16 aLens[]);
   1.529 +     
   1.530 +}
   1.531 +
   1.532 +#endif // HCR_H
   1.533 +