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