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