epoc32/include/hal.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of the License "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// hal\inc\hal.h
williamr@2
    15
// 
williamr@4
    16
// WARNING: This file contains some APIs which are internal and are subject
williamr@4
    17
//          to change without notice. Such APIs should therefore not be used
williamr@4
    18
//          outside the Kernel and Hardware Services package.
williamr@2
    19
//
williamr@2
    20
williamr@2
    21
#ifndef __HAL_H__
williamr@2
    22
#define __HAL_H__
williamr@2
    23
williamr@2
    24
#include <e32def.h>
williamr@2
    25
#include <hal_data.h>
williamr@2
    26
#include <e32property.h>
williamr@2
    27
williamr@2
    28
williamr@2
    29
williamr@2
    30
williamr@2
    31
/**
williamr@2
    32
@publishedPartner
williamr@2
    33
@released
williamr@2
    34
williamr@2
    35
A set of static functions to get and set hardware attributes.
williamr@2
    36
williamr@2
    37
@see HALData
williamr@2
    38
*/
williamr@2
    39
class HAL : public HALData
williamr@2
    40
	{
williamr@2
    41
public:
williamr@2
    42
williamr@2
    43
    /**
williamr@2
    44
    Synonyms for the attribute properties
williamr@2
    45
    HALData::TAttributeProperty, and used in SEntry.
williamr@2
    46
    */
williamr@2
    47
	enum TEntryProperty
williamr@2
    48
		{
williamr@2
    49
		/**		
williamr@2
    50
		When set, means that an attribute is meaningful on this device.
williamr@2
    51
		*/
williamr@2
    52
		EEntryValid=0x1,
williamr@2
    53
		
williamr@2
    54
		
williamr@2
    55
		/**
williamr@2
    56
		When set, means that an attribute is modifiable.
williamr@2
    57
		*/
williamr@2
    58
		EEntryDynamic=0x2,
williamr@2
    59
		};
williamr@2
    60
williamr@2
    61
    
williamr@2
    62
    /**
williamr@2
    63
    Defines an entry in the array that is returned in a call to HAL::GetAll().
williamr@2
    64
    */
williamr@2
    65
	struct SEntry
williamr@2
    66
		{
williamr@2
    67
		/**
williamr@2
    68
		The properties of the attribute.
williamr@2
    69
		
williamr@2
    70
		@see HAL::TEntryProperty
williamr@2
    71
		*/
williamr@2
    72
		TInt iProperties;
williamr@2
    73
		
williamr@2
    74
		/**
williamr@2
    75
		The attribute value.
williamr@2
    76
		
williamr@2
    77
		@see HALData::TAttribute
williamr@2
    78
		*/
williamr@2
    79
		TInt iValue;
williamr@2
    80
		};
williamr@2
    81
public:
williamr@2
    82
    /**
williamr@2
    83
    Gets the value of the specified HAL attribute.
williamr@2
    84
williamr@2
    85
    @param aAttribute The HAL attribute.
williamr@2
    86
    @param aValue	On successful return, contains the attribute value.
williamr@2
    87
					Some attributes may accept aValue as an input as well, to select
williamr@2
    88
					one of several alternate values. See the documentation for the
williamr@2
    89
					individual HAL attributes for details of this.
williamr@2
    90
williamr@2
    91
    @return  KErrNone, if successful;
williamr@2
    92
             KErrNotSupported, if the attribute is not defined in the list
williamr@2
    93
             of attributes, or is not meaningful for this device.
williamr@2
    94
			 KErrArgument, if aValue was invalid (for attributes
williamr@2
    95
			 which take an argument). 
williamr@2
    96
         
williamr@2
    97
    @see HALData::TAttribute
williamr@2
    98
    @see HALData::TAttributeProperty
williamr@2
    99
    */
williamr@2
   100
	IMPORT_C static TInt Get(TAttribute aAttribute, TInt& aValue);
williamr@2
   101
williamr@2
   102
	
williamr@2
   103
	/**
williamr@2
   104
    Sets the specified HAL attribute.
williamr@2
   105
williamr@2
   106
    @param aAttribute The HAL attribute.
williamr@2
   107
    @param aValue      The attribute value.
williamr@2
   108
williamr@2
   109
    @return  KErrNone, if successful;
williamr@2
   110
             KErrNotSupported, if the attribute is not defined in the list
williamr@2
   111
             of attributes, or is not meaningful for this device, or is
williamr@2
   112
             not settable.
williamr@2
   113
         
williamr@2
   114
    @see HALData::TAttribute
williamr@2
   115
    @see HALData::TAttributeProperty
williamr@2
   116
williamr@2
   117
    @capability WriteDeviceData or other capability specified
williamr@2
   118
    for individual attributes in TAttribute
williamr@2
   119
    */
williamr@2
   120
	IMPORT_C static TInt Set(TAttribute aAttribute, TInt aValue);
williamr@2
   121
williamr@2
   122
williamr@2
   123
    /**
williamr@2
   124
    Gets all HAL attributes, and their properties.
williamr@2
   125
williamr@2
   126
    For attributes that are not meaningful on this device (ie. those which have
williamr@2
   127
	not been defined in the config.hcf file),
williamr@2
   128
	the attribute value and its associated property value are set to zero in
williamr@2
   129
	the returned array.
williamr@2
   130
williamr@2
   131
	Attributes for which multiple values can be retrieved
williamr@2
   132
	ie. EDisplayIsPalettized, EDisplayBitsPerPixel, EDisplayOffsetToFirstPixel,
williamr@2
   133
	EDisplayOffsetBetweenLines, and EDisplayPaletteEntry will also be zero in
williamr@2
   134
	the returned array.
williamr@2
   135
williamr@2
   136
    @param aNumEntries On successful return, contains the total number
williamr@2
   137
                       of HAL attributes.
williamr@2
   138
                       If the function returns KErrNoMemory, this value is set
williamr@2
   139
                       to zero.
williamr@2
   140
    @param aData       On successful return, contains a pointer to an array
williamr@2
   141
                       of SEntry objects, each of which contains an attribute value
williamr@2
   142
                       and its property value. Note that the property value is
williamr@2
   143
                       defined by the HAL::TEntry synonym.
williamr@2
   144
                       If the function returns KErrNoMemory, this pointer is set
williamr@2
   145
                       to NULL.
williamr@2
   146
williamr@2
   147
    @return KErrNone, if succesful;
williamr@2
   148
            KErrNoMemory, if there is insufficient memory. 
williamr@2
   149
    */
williamr@2
   150
	IMPORT_C static TInt GetAll(TInt& aNumEntries, SEntry*& aData);
williamr@2
   151
williamr@2
   152
	
williamr@2
   153
    /**
williamr@2
   154
    Gets the value of the specified HAL attribute.
williamr@2
   155
williamr@2
   156
    @param aDeviceNumber The device number. (eg: screen number)
williamr@2
   157
    @param aAttribute The HAL attribute.
williamr@2
   158
    @param aValue	On successful return, contains the attribute value.
williamr@2
   159
					Some attributes may accept aValue as an input as well, to select
williamr@2
   160
					one of several alternate values. See the documentation for the
williamr@2
   161
					individual HAL attributes for details of this.
williamr@2
   162
williamr@2
   163
williamr@2
   164
    @return  KErrNone, if successful;
williamr@2
   165
             KErrNotSupported, if the attribute is not defined in the list
williamr@2
   166
             of attributes, or is not meaningful for this device.
williamr@2
   167
			 KErrArgument, if aValue was invalid (for attributes
williamr@2
   168
			 which take an argument). 
williamr@2
   169
         
williamr@2
   170
    @see HALData::TAttribute
williamr@2
   171
    @see HALData::TAttributeProperty
williamr@2
   172
    */
williamr@2
   173
	IMPORT_C static TInt Get(TInt aDeviceNumber, TAttribute aAttribute, TInt& aValue);
williamr@2
   174
	
williamr@2
   175
	
williamr@2
   176
    /**
williamr@2
   177
    Sets the specified HAL attribute.
williamr@2
   178
williamr@2
   179
    @param aDeviceNumber The device number. (eg: screen number)
williamr@2
   180
    @param aAttribute The HAL attribute.
williamr@2
   181
    @param aValue      The attribute value.
williamr@2
   182
williamr@2
   183
    @return  KErrNone, if successful;
williamr@2
   184
             KErrNotSupported, if the attribute is not defined in the list
williamr@2
   185
             of attributes, or is not meaningful for this device, or is
williamr@2
   186
             not settable.
williamr@2
   187
         
williamr@2
   188
    @see HALData::TAttribute
williamr@2
   189
    @see HALData::TAttributeProperty
williamr@2
   190
williamr@2
   191
    @capability WriteDeviceData or other capability specified
williamr@2
   192
    for individual attributes in TAttribute
williamr@2
   193
    */
williamr@2
   194
	IMPORT_C static TInt Set(TInt aDeviceNumber, TAttribute aAttribute, TInt aValue);
williamr@2
   195
	};
williamr@2
   196
williamr@2
   197
williamr@2
   198
/**
williamr@2
   199
@internalComponent
williamr@2
   200
*/
williamr@2
   201
static const TInt32 KUidHalPropertyKeyBase = 0x1020E306;
williamr@2
   202
williamr@2
   203
__ASSERT_COMPILE(HAL::ENumHalAttributes<256); // only 256 UIDs allocated for HAL property keys
williamr@2
   204
williamr@2
   205
williamr@2
   206
williamr@2
   207
#endif