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