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