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