sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // hal\inc\hal.h sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without notice. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: #ifndef __HAL_H__ sl@0: #define __HAL_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A set of static functions to get and set hardware attributes. sl@0: sl@0: @see HALData sl@0: */ sl@0: class HAL : public HALData sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Synonyms for the attribute properties sl@0: HALData::TAttributeProperty, and used in SEntry. sl@0: */ sl@0: enum TEntryProperty sl@0: { sl@0: /** sl@0: When set, means that an attribute is meaningful on this device. sl@0: */ sl@0: EEntryValid=0x1, sl@0: sl@0: sl@0: /** sl@0: When set, means that an attribute is modifiable. sl@0: */ sl@0: EEntryDynamic=0x2, sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Defines an entry in the array that is returned in a call to HAL::GetAll(). sl@0: */ sl@0: struct SEntry sl@0: { sl@0: /** sl@0: The properties of the attribute. sl@0: sl@0: @see HAL::TEntryProperty sl@0: */ sl@0: TInt iProperties; sl@0: sl@0: /** sl@0: The attribute value. sl@0: sl@0: @see HALData::TAttribute sl@0: */ sl@0: TInt iValue; sl@0: }; sl@0: public: sl@0: /** sl@0: Gets the value of the specified HAL attribute. sl@0: sl@0: @param aAttribute The HAL attribute. sl@0: @param aValue On successful return, contains the attribute value. sl@0: Some attributes may accept aValue as an input as well, to select sl@0: one of several alternate values. See the documentation for the sl@0: individual HAL attributes for details of this. sl@0: sl@0: @return KErrNone, if successful; sl@0: KErrNotSupported, if the attribute is not defined in the list sl@0: of attributes, or is not meaningful for this device. sl@0: KErrArgument, if aValue was invalid (for attributes sl@0: which take an argument). sl@0: sl@0: @see HALData::TAttribute sl@0: @see HALData::TAttributeProperty sl@0: */ sl@0: IMPORT_C static TInt Get(TAttribute aAttribute, TInt& aValue); sl@0: sl@0: sl@0: /** sl@0: Sets the specified HAL attribute. sl@0: sl@0: @param aAttribute The HAL attribute. sl@0: @param aValue The attribute value. sl@0: sl@0: @return KErrNone, if successful; sl@0: KErrNotSupported, if the attribute is not defined in the list sl@0: of attributes, or is not meaningful for this device, or is sl@0: not settable. sl@0: sl@0: @see HALData::TAttribute sl@0: @see HALData::TAttributeProperty sl@0: sl@0: @capability WriteDeviceData or other capability specified sl@0: for individual attributes in TAttribute sl@0: */ sl@0: IMPORT_C static TInt Set(TAttribute aAttribute, TInt aValue); sl@0: sl@0: sl@0: /** sl@0: Gets all HAL attributes, and their properties. sl@0: sl@0: For attributes that are not meaningful on this device (ie. those which have sl@0: not been defined in the config.hcf file), sl@0: the attribute value and its associated property value are set to zero in sl@0: the returned array. sl@0: sl@0: Attributes for which multiple values can be retrieved sl@0: ie. EDisplayIsPalettized, EDisplayBitsPerPixel, EDisplayOffsetToFirstPixel, sl@0: EDisplayOffsetBetweenLines, and EDisplayPaletteEntry will also be zero in sl@0: the returned array. sl@0: sl@0: @param aNumEntries On successful return, contains the total number sl@0: of HAL attributes. sl@0: If the function returns KErrNoMemory, this value is set sl@0: to zero. sl@0: @param aData On successful return, contains a pointer to an array sl@0: of SEntry objects, each of which contains an attribute value sl@0: and its property value. Note that the property value is sl@0: defined by the HAL::TEntry synonym. sl@0: If the function returns KErrNoMemory, this pointer is set sl@0: to NULL. sl@0: sl@0: @return KErrNone, if succesful; sl@0: KErrNoMemory, if there is insufficient memory. sl@0: */ sl@0: IMPORT_C static TInt GetAll(TInt& aNumEntries, SEntry*& aData); sl@0: sl@0: sl@0: /** sl@0: Gets the value of the specified HAL attribute. sl@0: sl@0: @param aDeviceNumber The device number. (eg: screen number) sl@0: @param aAttribute The HAL attribute. sl@0: @param aValue On successful return, contains the attribute value. sl@0: Some attributes may accept aValue as an input as well, to select sl@0: one of several alternate values. See the documentation for the sl@0: individual HAL attributes for details of this. sl@0: sl@0: sl@0: @return KErrNone, if successful; sl@0: KErrNotSupported, if the attribute is not defined in the list sl@0: of attributes, or is not meaningful for this device. sl@0: KErrArgument, if aValue was invalid (for attributes sl@0: which take an argument). sl@0: sl@0: @see HALData::TAttribute sl@0: @see HALData::TAttributeProperty sl@0: */ sl@0: IMPORT_C static TInt Get(TInt aDeviceNumber, TAttribute aAttribute, TInt& aValue); sl@0: sl@0: sl@0: /** sl@0: Sets the specified HAL attribute. sl@0: sl@0: @param aDeviceNumber The device number. (eg: screen number) sl@0: @param aAttribute The HAL attribute. sl@0: @param aValue The attribute value. sl@0: sl@0: @return KErrNone, if successful; sl@0: KErrNotSupported, if the attribute is not defined in the list sl@0: of attributes, or is not meaningful for this device, or is sl@0: not settable. sl@0: sl@0: @see HALData::TAttribute sl@0: @see HALData::TAttributeProperty sl@0: sl@0: @capability WriteDeviceData or other capability specified sl@0: for individual attributes in TAttribute sl@0: */ sl@0: IMPORT_C static TInt Set(TInt aDeviceNumber, TAttribute aAttribute, TInt aValue); sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: static const TInt32 KUidHalPropertyKeyBase = 0x1020E306; sl@0: sl@0: __ASSERT_COMPILE(HAL::ENumHalAttributes<256); // only 256 UIDs allocated for HAL property keys sl@0: sl@0: sl@0: sl@0: #endif