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