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