os/kernelhwsrv/halservices/hal/inc/hal.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // hal\inc\hal.h
    15 // 
    16 // WARNING: This file contains some APIs which are internal and are subject
    17 //          to change without notice. Such APIs should therefore not be used
    18 //          outside the Kernel and Hardware Services package.
    19 //
    20 
    21 #ifndef __HAL_H__
    22 #define __HAL_H__
    23 
    24 #include <e32def.h>
    25 #include <hal_data.h>
    26 #include <e32property.h>
    27 
    28 
    29 
    30 
    31 /**
    32 @publishedPartner
    33 @released
    34 
    35 A set of static functions to get and set hardware attributes.
    36 
    37 @see HALData
    38 */
    39 class HAL : public HALData
    40 	{
    41 public:
    42 
    43     /**
    44     Synonyms for the attribute properties
    45     HALData::TAttributeProperty, and used in SEntry.
    46     */
    47 	enum TEntryProperty
    48 		{
    49 		/**		
    50 		When set, means that an attribute is meaningful on this device.
    51 		*/
    52 		EEntryValid=0x1,
    53 		
    54 		
    55 		/**
    56 		When set, means that an attribute is modifiable.
    57 		*/
    58 		EEntryDynamic=0x2,
    59 		};
    60 
    61     
    62     /**
    63     Defines an entry in the array that is returned in a call to HAL::GetAll().
    64     */
    65 	struct SEntry
    66 		{
    67 		/**
    68 		The properties of the attribute.
    69 		
    70 		@see HAL::TEntryProperty
    71 		*/
    72 		TInt iProperties;
    73 		
    74 		/**
    75 		The attribute value.
    76 		
    77 		@see HALData::TAttribute
    78 		*/
    79 		TInt iValue;
    80 		};
    81 public:
    82     /**
    83     Gets the value of the specified HAL attribute.
    84 
    85     @param aAttribute The HAL attribute.
    86     @param aValue	On successful return, contains the attribute value.
    87 					Some attributes may accept aValue as an input as well, to select
    88 					one of several alternate values. See the documentation for the
    89 					individual HAL attributes for details of this.
    90 
    91     @return  KErrNone, if successful;
    92              KErrNotSupported, if the attribute is not defined in the list
    93              of attributes, or is not meaningful for this device.
    94 			 KErrArgument, if aValue was invalid (for attributes
    95 			 which take an argument). 
    96          
    97     @see HALData::TAttribute
    98     @see HALData::TAttributeProperty
    99     */
   100 	IMPORT_C static TInt Get(TAttribute aAttribute, TInt& aValue);
   101 
   102 	
   103 	/**
   104     Sets the specified HAL attribute.
   105 
   106     @param aAttribute The HAL attribute.
   107     @param aValue      The attribute value.
   108 
   109     @return  KErrNone, if successful;
   110              KErrNotSupported, if the attribute is not defined in the list
   111              of attributes, or is not meaningful for this device, or is
   112              not settable.
   113          
   114     @see HALData::TAttribute
   115     @see HALData::TAttributeProperty
   116 
   117     @capability WriteDeviceData or other capability specified
   118     for individual attributes in TAttribute
   119     */
   120 	IMPORT_C static TInt Set(TAttribute aAttribute, TInt aValue);
   121 
   122 
   123     /**
   124     Gets all HAL attributes, and their properties.
   125 
   126     For attributes that are not meaningful on this device (ie. those which have
   127 	not been defined in the config.hcf file),
   128 	the attribute value and its associated property value are set to zero in
   129 	the returned array.
   130 
   131 	Attributes for which multiple values can be retrieved
   132 	ie. EDisplayIsPalettized, EDisplayBitsPerPixel, EDisplayOffsetToFirstPixel,
   133 	EDisplayOffsetBetweenLines, and EDisplayPaletteEntry will also be zero in
   134 	the returned array.
   135 
   136     @param aNumEntries On successful return, contains the total number
   137                        of HAL attributes.
   138                        If the function returns KErrNoMemory, this value is set
   139                        to zero.
   140     @param aData       On successful return, contains a pointer to an array
   141                        of SEntry objects, each of which contains an attribute value
   142                        and its property value. Note that the property value is
   143                        defined by the HAL::TEntry synonym.
   144                        If the function returns KErrNoMemory, this pointer is set
   145                        to NULL.
   146 
   147     @return KErrNone, if succesful;
   148             KErrNoMemory, if there is insufficient memory. 
   149     */
   150 	IMPORT_C static TInt GetAll(TInt& aNumEntries, SEntry*& aData);
   151 
   152 	
   153     /**
   154     Gets the value of the specified HAL attribute.
   155 
   156     @param aDeviceNumber The device number. (eg: screen number)
   157     @param aAttribute The HAL attribute.
   158     @param aValue	On successful return, contains the attribute value.
   159 					Some attributes may accept aValue as an input as well, to select
   160 					one of several alternate values. See the documentation for the
   161 					individual HAL attributes for details of this.
   162 
   163 
   164     @return  KErrNone, if successful;
   165              KErrNotSupported, if the attribute is not defined in the list
   166              of attributes, or is not meaningful for this device.
   167 			 KErrArgument, if aValue was invalid (for attributes
   168 			 which take an argument). 
   169          
   170     @see HALData::TAttribute
   171     @see HALData::TAttributeProperty
   172     */
   173 	IMPORT_C static TInt Get(TInt aDeviceNumber, TAttribute aAttribute, TInt& aValue);
   174 	
   175 	
   176     /**
   177     Sets the specified HAL attribute.
   178 
   179     @param aDeviceNumber The device number. (eg: screen number)
   180     @param aAttribute The HAL attribute.
   181     @param aValue      The attribute value.
   182 
   183     @return  KErrNone, if successful;
   184              KErrNotSupported, if the attribute is not defined in the list
   185              of attributes, or is not meaningful for this device, or is
   186              not settable.
   187          
   188     @see HALData::TAttribute
   189     @see HALData::TAttributeProperty
   190 
   191     @capability WriteDeviceData or other capability specified
   192     for individual attributes in TAttribute
   193     */
   194 	IMPORT_C static TInt Set(TInt aDeviceNumber, TAttribute aAttribute, TInt aValue);
   195 	};
   196 
   197 
   198 /**
   199 @internalComponent
   200 */
   201 static const TInt32 KUidHalPropertyKeyBase = 0x1020E306;
   202 
   203 __ASSERT_COMPILE(HAL::ENumHalAttributes<256); // only 256 UIDs allocated for HAL property keys
   204 
   205 
   206 
   207 #endif