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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
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.
26 #include <e32property.h>
35 A set of static functions to get and set hardware attributes.
39 class HAL : public HALData
44 Synonyms for the attribute properties
45 HALData::TAttributeProperty, and used in SEntry.
50 When set, means that an attribute is meaningful on this device.
56 When set, means that an attribute is modifiable.
63 Defines an entry in the array that is returned in a call to HAL::GetAll().
68 The properties of the attribute.
70 @see HAL::TEntryProperty
77 @see HALData::TAttribute
83 Gets the value of the specified HAL attribute.
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.
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).
97 @see HALData::TAttribute
98 @see HALData::TAttributeProperty
100 IMPORT_C static TInt Get(TAttribute aAttribute, TInt& aValue);
104 Sets the specified HAL attribute.
106 @param aAttribute The HAL attribute.
107 @param aValue The attribute value.
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
114 @see HALData::TAttribute
115 @see HALData::TAttributeProperty
117 @capability WriteDeviceData or other capability specified
118 for individual attributes in TAttribute
120 IMPORT_C static TInt Set(TAttribute aAttribute, TInt aValue);
124 Gets all HAL attributes, and their properties.
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
131 Attributes for which multiple values can be retrieved
132 ie. EDisplayIsPalettized, EDisplayBitsPerPixel, EDisplayOffsetToFirstPixel,
133 EDisplayOffsetBetweenLines, and EDisplayPaletteEntry will also be zero in
136 @param aNumEntries On successful return, contains the total number
138 If the function returns KErrNoMemory, this value is set
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
147 @return KErrNone, if succesful;
148 KErrNoMemory, if there is insufficient memory.
150 IMPORT_C static TInt GetAll(TInt& aNumEntries, SEntry*& aData);
154 Gets the value of the specified HAL attribute.
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.
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).
170 @see HALData::TAttribute
171 @see HALData::TAttributeProperty
173 IMPORT_C static TInt Get(TInt aDeviceNumber, TAttribute aAttribute, TInt& aValue);
177 Sets the specified HAL attribute.
179 @param aDeviceNumber The device number. (eg: screen number)
180 @param aAttribute The HAL attribute.
181 @param aValue The attribute value.
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
188 @see HALData::TAttribute
189 @see HALData::TAttributeProperty
191 @capability WriteDeviceData or other capability specified
192 for individual attributes in TAttribute
194 IMPORT_C static TInt Set(TInt aDeviceNumber, TAttribute aAttribute, TInt aValue);
201 static const TInt32 KUidHalPropertyKeyBase = 0x1020E306;
203 __ASSERT_COMPILE(HAL::ENumHalAttributes<256); // only 256 UIDs allocated for HAL property keys