1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/halservices/hal/inc/hal.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,207 @@
1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// hal\inc\hal.h
1.18 +//
1.19 +// WARNING: This file contains some APIs which are internal and are subject
1.20 +// to change without notice. Such APIs should therefore not be used
1.21 +// outside the Kernel and Hardware Services package.
1.22 +//
1.23 +
1.24 +#ifndef __HAL_H__
1.25 +#define __HAL_H__
1.26 +
1.27 +#include <e32def.h>
1.28 +#include <hal_data.h>
1.29 +#include <e32property.h>
1.30 +
1.31 +
1.32 +
1.33 +
1.34 +/**
1.35 +@publishedPartner
1.36 +@released
1.37 +
1.38 +A set of static functions to get and set hardware attributes.
1.39 +
1.40 +@see HALData
1.41 +*/
1.42 +class HAL : public HALData
1.43 + {
1.44 +public:
1.45 +
1.46 + /**
1.47 + Synonyms for the attribute properties
1.48 + HALData::TAttributeProperty, and used in SEntry.
1.49 + */
1.50 + enum TEntryProperty
1.51 + {
1.52 + /**
1.53 + When set, means that an attribute is meaningful on this device.
1.54 + */
1.55 + EEntryValid=0x1,
1.56 +
1.57 +
1.58 + /**
1.59 + When set, means that an attribute is modifiable.
1.60 + */
1.61 + EEntryDynamic=0x2,
1.62 + };
1.63 +
1.64 +
1.65 + /**
1.66 + Defines an entry in the array that is returned in a call to HAL::GetAll().
1.67 + */
1.68 + struct SEntry
1.69 + {
1.70 + /**
1.71 + The properties of the attribute.
1.72 +
1.73 + @see HAL::TEntryProperty
1.74 + */
1.75 + TInt iProperties;
1.76 +
1.77 + /**
1.78 + The attribute value.
1.79 +
1.80 + @see HALData::TAttribute
1.81 + */
1.82 + TInt iValue;
1.83 + };
1.84 +public:
1.85 + /**
1.86 + Gets the value of the specified HAL attribute.
1.87 +
1.88 + @param aAttribute The HAL attribute.
1.89 + @param aValue On successful return, contains the attribute value.
1.90 + Some attributes may accept aValue as an input as well, to select
1.91 + one of several alternate values. See the documentation for the
1.92 + individual HAL attributes for details of this.
1.93 +
1.94 + @return KErrNone, if successful;
1.95 + KErrNotSupported, if the attribute is not defined in the list
1.96 + of attributes, or is not meaningful for this device.
1.97 + KErrArgument, if aValue was invalid (for attributes
1.98 + which take an argument).
1.99 +
1.100 + @see HALData::TAttribute
1.101 + @see HALData::TAttributeProperty
1.102 + */
1.103 + IMPORT_C static TInt Get(TAttribute aAttribute, TInt& aValue);
1.104 +
1.105 +
1.106 + /**
1.107 + Sets the specified HAL attribute.
1.108 +
1.109 + @param aAttribute The HAL attribute.
1.110 + @param aValue The attribute value.
1.111 +
1.112 + @return KErrNone, if successful;
1.113 + KErrNotSupported, if the attribute is not defined in the list
1.114 + of attributes, or is not meaningful for this device, or is
1.115 + not settable.
1.116 +
1.117 + @see HALData::TAttribute
1.118 + @see HALData::TAttributeProperty
1.119 +
1.120 + @capability WriteDeviceData or other capability specified
1.121 + for individual attributes in TAttribute
1.122 + */
1.123 + IMPORT_C static TInt Set(TAttribute aAttribute, TInt aValue);
1.124 +
1.125 +
1.126 + /**
1.127 + Gets all HAL attributes, and their properties.
1.128 +
1.129 + For attributes that are not meaningful on this device (ie. those which have
1.130 + not been defined in the config.hcf file),
1.131 + the attribute value and its associated property value are set to zero in
1.132 + the returned array.
1.133 +
1.134 + Attributes for which multiple values can be retrieved
1.135 + ie. EDisplayIsPalettized, EDisplayBitsPerPixel, EDisplayOffsetToFirstPixel,
1.136 + EDisplayOffsetBetweenLines, and EDisplayPaletteEntry will also be zero in
1.137 + the returned array.
1.138 +
1.139 + @param aNumEntries On successful return, contains the total number
1.140 + of HAL attributes.
1.141 + If the function returns KErrNoMemory, this value is set
1.142 + to zero.
1.143 + @param aData On successful return, contains a pointer to an array
1.144 + of SEntry objects, each of which contains an attribute value
1.145 + and its property value. Note that the property value is
1.146 + defined by the HAL::TEntry synonym.
1.147 + If the function returns KErrNoMemory, this pointer is set
1.148 + to NULL.
1.149 +
1.150 + @return KErrNone, if succesful;
1.151 + KErrNoMemory, if there is insufficient memory.
1.152 + */
1.153 + IMPORT_C static TInt GetAll(TInt& aNumEntries, SEntry*& aData);
1.154 +
1.155 +
1.156 + /**
1.157 + Gets the value of the specified HAL attribute.
1.158 +
1.159 + @param aDeviceNumber The device number. (eg: screen number)
1.160 + @param aAttribute The HAL attribute.
1.161 + @param aValue On successful return, contains the attribute value.
1.162 + Some attributes may accept aValue as an input as well, to select
1.163 + one of several alternate values. See the documentation for the
1.164 + individual HAL attributes for details of this.
1.165 +
1.166 +
1.167 + @return KErrNone, if successful;
1.168 + KErrNotSupported, if the attribute is not defined in the list
1.169 + of attributes, or is not meaningful for this device.
1.170 + KErrArgument, if aValue was invalid (for attributes
1.171 + which take an argument).
1.172 +
1.173 + @see HALData::TAttribute
1.174 + @see HALData::TAttributeProperty
1.175 + */
1.176 + IMPORT_C static TInt Get(TInt aDeviceNumber, TAttribute aAttribute, TInt& aValue);
1.177 +
1.178 +
1.179 + /**
1.180 + Sets the specified HAL attribute.
1.181 +
1.182 + @param aDeviceNumber The device number. (eg: screen number)
1.183 + @param aAttribute The HAL attribute.
1.184 + @param aValue The attribute value.
1.185 +
1.186 + @return KErrNone, if successful;
1.187 + KErrNotSupported, if the attribute is not defined in the list
1.188 + of attributes, or is not meaningful for this device, or is
1.189 + not settable.
1.190 +
1.191 + @see HALData::TAttribute
1.192 + @see HALData::TAttributeProperty
1.193 +
1.194 + @capability WriteDeviceData or other capability specified
1.195 + for individual attributes in TAttribute
1.196 + */
1.197 + IMPORT_C static TInt Set(TInt aDeviceNumber, TAttribute aAttribute, TInt aValue);
1.198 + };
1.199 +
1.200 +
1.201 +/**
1.202 +@internalComponent
1.203 +*/
1.204 +static const TInt32 KUidHalPropertyKeyBase = 0x1020E306;
1.205 +
1.206 +__ASSERT_COMPILE(HAL::ENumHalAttributes<256); // only 256 UIDs allocated for HAL property keys
1.207 +
1.208 +
1.209 +
1.210 +#endif