-rw-r--r-- | libopie2/opiecore/device/odevice.h | 1 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 28 |
2 files changed, 22 insertions, 7 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h index 96a41fc..c434216 100644 --- a/libopie2/opiecore/device/odevice.h +++ b/libopie2/opiecore/device/odevice.h | |||
@@ -1,378 +1,379 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ODEVICE_H_ | 30 | #ifndef ODEVICE_H_ |
31 | #define ODEVICE_H_ | 31 | #define ODEVICE_H_ |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odevicebutton.h> | 34 | #include <opie2/odevicebutton.h> |
35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ | 35 | #include <qpe/qpeapplication.h> /* for Transformation enum.. */ |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qnamespace.h> | 38 | #include <qnamespace.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | 41 | ||
42 | 42 | ||
43 | #include <qstrlist.h> | 43 | #include <qstrlist.h> |
44 | #include <qwindowsystem_qws.h> | 44 | #include <qwindowsystem_qws.h> |
45 | 45 | ||
46 | 46 | ||
47 | class Sound; | 47 | class Sound; |
48 | 48 | ||
49 | namespace Opie{ | 49 | namespace Opie{ |
50 | namespace Core{ | 50 | namespace Core{ |
51 | 51 | ||
52 | class ODeviceData; | 52 | class ODeviceData; |
53 | /** | 53 | /** |
54 | * The available devices | 54 | * The available devices |
55 | */ | 55 | */ |
56 | enum OModel { | 56 | enum OModel { |
57 | Model_Unknown, // = 0 | 57 | Model_Unknown, // = 0 |
58 | 58 | ||
59 | Model_Series_Mask = 0xff000000, | 59 | Model_Series_Mask = 0xff000000, |
60 | 60 | ||
61 | Model_iPAQ = ( 1 << 24 ), | 61 | Model_iPAQ = ( 1 << 24 ), |
62 | 62 | ||
63 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), | 63 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), | 64 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), | 65 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), | 66 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | 67 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), |
68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | 68 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), |
69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), | 69 | Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), |
70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), | 70 | Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), |
71 | 71 | ||
72 | Model_Jornada = ( 6 << 24 ), | 72 | Model_Jornada = ( 6 << 24 ), |
73 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), | 73 | Model_Jornada_56x = ( Model_Jornada | 0x000001 ), |
74 | Model_Jornada_720 = ( Model_Jornada | 0x000002 ), | ||
74 | 75 | ||
75 | Model_Zaurus = ( 2 << 24 ), | 76 | Model_Zaurus = ( 2 << 24 ), |
76 | 77 | ||
77 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 78 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
78 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 79 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
79 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 80 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
80 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 81 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
81 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), | 82 | Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), |
82 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), | 83 | Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), |
83 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ), | 84 | Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x000007 ), |
84 | 85 | ||
85 | Model_SIMpad = ( 3 << 24 ), | 86 | Model_SIMpad = ( 3 << 24 ), |
86 | 87 | ||
87 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 88 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
88 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 89 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
89 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 90 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
90 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 91 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
91 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 92 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
92 | 93 | ||
93 | Model_Ramses = ( 4 << 24 ), | 94 | Model_Ramses = ( 4 << 24 ), |
94 | 95 | ||
95 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), | 96 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), |
96 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), | 97 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), |
97 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), | 98 | Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ), |
98 | 99 | ||
99 | Model_Yopy = ( 5 << 24 ), | 100 | Model_Yopy = ( 5 << 24 ), |
100 | 101 | ||
101 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), | 102 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), |
102 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), | 103 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), |
103 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), | 104 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), |
104 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), | 105 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), |
105 | 106 | ||
106 | Model_Beagle = ( 6 << 24 ), | 107 | Model_Beagle = ( 6 << 24 ), |
107 | 108 | ||
108 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), | 109 | Model_Beagle_All = ( Model_Beagle | 0xffffff ), |
109 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), | 110 | Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), |
110 | 111 | ||
111 | Model_GenuineIntel = ( 7 << 24 ) | 112 | Model_GenuineIntel = ( 7 << 24 ) |
112 | 113 | ||
113 | }; | 114 | }; |
114 | 115 | ||
115 | /** | 116 | /** |
116 | * The vendor of the device | 117 | * The vendor of the device |
117 | */ | 118 | */ |
118 | enum OVendor { | 119 | enum OVendor { |
119 | Vendor_Unknown, | 120 | Vendor_Unknown, |
120 | 121 | ||
121 | Vendor_HP, | 122 | Vendor_HP, |
122 | Vendor_Sharp, | 123 | Vendor_Sharp, |
123 | Vendor_SIEMENS, | 124 | Vendor_SIEMENS, |
124 | Vendor_MundN, | 125 | Vendor_MundN, |
125 | Vendor_GMate, | 126 | Vendor_GMate, |
126 | Vendor_MasterIA, | 127 | Vendor_MasterIA, |
127 | Vendor_GenuineIntel | 128 | Vendor_GenuineIntel |
128 | }; | 129 | }; |
129 | 130 | ||
130 | /** | 131 | /** |
131 | * The System used | 132 | * The System used |
132 | */ | 133 | */ |
133 | enum OSystem { | 134 | enum OSystem { |
134 | System_Unknown, | 135 | System_Unknown, |
135 | 136 | ||
136 | System_Familiar, | 137 | System_Familiar, |
137 | System_Zaurus, | 138 | System_Zaurus, |
138 | System_OpenZaurus, | 139 | System_OpenZaurus, |
139 | System_Linupy, | 140 | System_Linupy, |
140 | System_OpenEmbedded, | 141 | System_OpenEmbedded, |
141 | System_PC | 142 | System_PC |
142 | }; | 143 | }; |
143 | 144 | ||
144 | typedef struct { | 145 | typedef struct { |
145 | OSystem system; | 146 | OSystem system; |
146 | char* sysstr; | 147 | char* sysstr; |
147 | char* sysvfile; | 148 | char* sysvfile; |
148 | } ODistribution; | 149 | } ODistribution; |
149 | 150 | ||
150 | extern ODistribution distributions[]; | 151 | extern ODistribution distributions[]; |
151 | 152 | ||
152 | 153 | ||
153 | enum OLedState { | 154 | enum OLedState { |
154 | Led_Off, | 155 | Led_Off, |
155 | Led_On, | 156 | Led_On, |
156 | Led_BlinkSlow, | 157 | Led_BlinkSlow, |
157 | Led_BlinkFast | 158 | Led_BlinkFast |
158 | }; | 159 | }; |
159 | 160 | ||
160 | enum OLed { | 161 | enum OLed { |
161 | Led_Mail, | 162 | Led_Mail, |
162 | Led_Power, | 163 | Led_Power, |
163 | Led_BlueTooth | 164 | Led_BlueTooth |
164 | }; | 165 | }; |
165 | 166 | ||
166 | enum OHardKey { | 167 | enum OHardKey { |
167 | HardKey_Datebook = Qt::Key_F9, | 168 | HardKey_Datebook = Qt::Key_F9, |
168 | HardKey_Contacts = Qt::Key_F10, | 169 | HardKey_Contacts = Qt::Key_F10, |
169 | HardKey_Menu = Qt::Key_F11, | 170 | HardKey_Menu = Qt::Key_F11, |
170 | HardKey_Home = Qt::Key_F12, | 171 | HardKey_Home = Qt::Key_F12, |
171 | HardKey_Mail = Qt::Key_F13, | 172 | HardKey_Mail = Qt::Key_F13, |
172 | HardKey_Record = Qt::Key_F24, | 173 | HardKey_Record = Qt::Key_F24, |
173 | HardKey_Suspend = Qt::Key_F34, | 174 | HardKey_Suspend = Qt::Key_F34, |
174 | HardKey_Backlight = Qt::Key_F35, | 175 | HardKey_Backlight = Qt::Key_F35, |
175 | HardKey_Action = Qt::Key_F10, | 176 | HardKey_Action = Qt::Key_F10, |
176 | HardKey_OK = Qt::Key_F11, | 177 | HardKey_OK = Qt::Key_F11, |
177 | HardKey_End = Qt::Key_F12, | 178 | HardKey_End = Qt::Key_F12, |
178 | }; | 179 | }; |
179 | 180 | ||
180 | enum ODirection { | 181 | enum ODirection { |
181 | CW = 0, | 182 | CW = 0, |
182 | CCW = 1, | 183 | CCW = 1, |
183 | Flip = 2, | 184 | Flip = 2, |
184 | }; | 185 | }; |
185 | 186 | ||
186 | enum OHingeStatus { | 187 | enum OHingeStatus { |
187 | CASE_CLOSED = 3, | 188 | CASE_CLOSED = 3, |
188 | CASE_PORTRAIT = 2, | 189 | CASE_PORTRAIT = 2, |
189 | CASE_LANDSCAPE = 0, | 190 | CASE_LANDSCAPE = 0, |
190 | CASE_UNKNOWN = 1, | 191 | CASE_UNKNOWN = 1, |
191 | }; | 192 | }; |
192 | 193 | ||
193 | /* default button for qvfb or such | 194 | /* default button for qvfb or such |
194 | * see odevice.cpp for details. | 195 | * see odevice.cpp for details. |
195 | * hint: manage a user defined button for qvfb? | 196 | * hint: manage a user defined button for qvfb? |
196 | * alwin | 197 | * alwin |
197 | */ | 198 | */ |
198 | struct default_button { | 199 | struct default_button { |
199 | Qt::Key code; | 200 | Qt::Key code; |
200 | char *utext; | 201 | char *utext; |
201 | char *pix; | 202 | char *pix; |
202 | char *fpressedservice; | 203 | char *fpressedservice; |
203 | char *fpressedaction; | 204 | char *fpressedaction; |
204 | char *fheldservice; | 205 | char *fheldservice; |
205 | char *fheldaction; | 206 | char *fheldaction; |
206 | }; | 207 | }; |
207 | 208 | ||
208 | /** | 209 | /** |
209 | * A singleton which gives informations about device specefic option | 210 | * A singleton which gives informations about device specefic option |
210 | * like the Hardware used, LEDs, the Base Distribution and | 211 | * like the Hardware used, LEDs, the Base Distribution and |
211 | * hardware key mappings. | 212 | * hardware key mappings. |
212 | * | 213 | * |
213 | * @short A small class for device specefic options | 214 | * @short A small class for device specefic options |
214 | * @see QObject | 215 | * @see QObject |
215 | * @author Robert Griebl | 216 | * @author Robert Griebl |
216 | * @version 1.0 | 217 | * @version 1.0 |
217 | */ | 218 | */ |
218 | class ODevice : public QObject | 219 | class ODevice : public QObject |
219 | { | 220 | { |
220 | Q_OBJECT | 221 | Q_OBJECT |
221 | 222 | ||
222 | private: | 223 | private: |
223 | /* disable copy */ | 224 | /* disable copy */ |
224 | ODevice ( const ODevice & ); | 225 | ODevice ( const ODevice & ); |
225 | 226 | ||
226 | protected: | 227 | protected: |
227 | ODevice(); | 228 | ODevice(); |
228 | virtual void init(const QString&); | 229 | virtual void init(const QString&); |
229 | virtual void initButtons(); | 230 | virtual void initButtons(); |
230 | static void sendSuspendmsg(); | 231 | static void sendSuspendmsg(); |
231 | 232 | ||
232 | ODeviceData *d; | 233 | ODeviceData *d; |
233 | 234 | ||
234 | public: | 235 | public: |
235 | // sandman do we want to allow destructions? -zecke? | 236 | // sandman do we want to allow destructions? -zecke? |
236 | virtual ~ODevice(); | 237 | virtual ~ODevice(); |
237 | 238 | ||
238 | static ODevice *inst(); | 239 | static ODevice *inst(); |
239 | 240 | ||
240 | // information | 241 | // information |
241 | 242 | ||
242 | QString modelString() const; | 243 | QString modelString() const; |
243 | OModel model() const; | 244 | OModel model() const; |
244 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } | 245 | inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } |
245 | 246 | ||
246 | QString vendorString() const; | 247 | QString vendorString() const; |
247 | OVendor vendor() const; | 248 | OVendor vendor() const; |
248 | 249 | ||
249 | QString systemString() const; | 250 | QString systemString() const; |
250 | OSystem system() const; | 251 | OSystem system() const; |
251 | 252 | ||
252 | QString systemVersionString() const; | 253 | QString systemVersionString() const; |
253 | 254 | ||
254 | virtual Transformation rotation() const; | 255 | virtual Transformation rotation() const; |
255 | virtual ODirection direction() const; | 256 | virtual ODirection direction() const; |
256 | 257 | ||
257 | // system | 258 | // system |
258 | virtual bool suspend(); | 259 | virtual bool suspend(); |
259 | 260 | ||
260 | virtual bool setDisplayStatus ( bool on ); | 261 | virtual bool setDisplayStatus ( bool on ); |
261 | virtual bool setDisplayBrightness ( int brightness ); | 262 | virtual bool setDisplayBrightness ( int brightness ); |
262 | virtual int displayBrightnessResolution() const; | 263 | virtual int displayBrightnessResolution() const; |
263 | virtual bool setDisplayContrast ( int contrast ); | 264 | virtual bool setDisplayContrast ( int contrast ); |
264 | virtual int displayContrastResolution() const; | 265 | virtual int displayContrastResolution() const; |
265 | 266 | ||
266 | // don't add new virtual methods, use this: | 267 | // don't add new virtual methods, use this: |
267 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 268 | // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
268 | // and in your subclass do overwrite | 269 | // and in your subclass do overwrite |
269 | // protected virtual int virtual_hook(int, void *) | 270 | // protected virtual int virtual_hook(int, void *) |
270 | // which is defined below | 271 | // which is defined below |
271 | 272 | ||
272 | // input / output | 273 | // input / output |
273 | virtual void playAlarmSound(); | 274 | virtual void playAlarmSound(); |
274 | virtual void playKeySound(); | 275 | virtual void playKeySound(); |
275 | virtual void playTouchSound(); | 276 | virtual void playTouchSound(); |
276 | 277 | ||
277 | virtual QValueList <OLed> ledList() const; | 278 | virtual QValueList <OLed> ledList() const; |
278 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 279 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
279 | virtual OLedState ledState ( OLed led ) const; | 280 | virtual OLedState ledState ( OLed led ) const; |
280 | virtual bool setLedState ( OLed led, OLedState st ); | 281 | virtual bool setLedState ( OLed led, OLedState st ); |
281 | 282 | ||
282 | virtual bool hasLightSensor() const; | 283 | virtual bool hasLightSensor() const; |
283 | virtual int readLightSensor(); | 284 | virtual int readLightSensor(); |
284 | virtual int lightSensorResolution() const; | 285 | virtual int lightSensorResolution() const; |
285 | 286 | ||
286 | virtual bool hasHingeSensor() const; | 287 | virtual bool hasHingeSensor() const; |
287 | virtual OHingeStatus readHingeSensor(); | 288 | virtual OHingeStatus readHingeSensor(); |
288 | 289 | ||
289 | const QStrList &allowedCpuFrequencies() const; | 290 | const QStrList &allowedCpuFrequencies() const; |
290 | bool setCurrentCpuFrequency(uint index); | 291 | bool setCurrentCpuFrequency(uint index); |
291 | 292 | ||
292 | /** | 293 | /** |
293 | * Returns the available buttons on this device. The number and location | 294 | * Returns the available buttons on this device. The number and location |
294 | * of buttons will vary depending on the device. Button numbers will be assigned | 295 | * of buttons will vary depending on the device. Button numbers will be assigned |
295 | * by the device manufacturer and will be from most preferred button to least preffered | 296 | * by the device manufacturer and will be from most preferred button to least preffered |
296 | * button. Note that this list only contains "user mappable" buttons. | 297 | * button. Note that this list only contains "user mappable" buttons. |
297 | * | 298 | * |
298 | * @todo Make method const and take care of calling initButtons or make that const too | 299 | * @todo Make method const and take care of calling initButtons or make that const too |
299 | * | 300 | * |
300 | */ | 301 | */ |
301 | const QValueList<ODeviceButton> &buttons(); | 302 | const QValueList<ODeviceButton> &buttons(); |
302 | 303 | ||
303 | /** | 304 | /** |
304 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 305 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
305 | * returns 0L | 306 | * returns 0L |
306 | */ | 307 | */ |
307 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 308 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
308 | 309 | ||
309 | /** | 310 | /** |
310 | * Reassigns the pressed action for \a button. To return to the factory | 311 | * Reassigns the pressed action for \a button. To return to the factory |
311 | * default pass an empty string as \a qcopMessage. | 312 | * default pass an empty string as \a qcopMessage. |
312 | */ | 313 | */ |
313 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 314 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
314 | 315 | ||
315 | /** | 316 | /** |
316 | * Reassigns the held action for \a button. To return to the factory | 317 | * Reassigns the held action for \a button. To return to the factory |
317 | * default pass an empty string as \a qcopMessage. | 318 | * default pass an empty string as \a qcopMessage. |
318 | */ | 319 | */ |
319 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 320 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
320 | 321 | ||
321 | /** | 322 | /** |
322 | * How long (in ms) you have to press a button for a "hold" action | 323 | * How long (in ms) you have to press a button for a "hold" action |
323 | */ | 324 | */ |
324 | uint buttonHoldTime() const; | 325 | uint buttonHoldTime() const; |
325 | 326 | ||
326 | signals: | 327 | signals: |
327 | void buttonMappingChanged(); | 328 | void buttonMappingChanged(); |
328 | 329 | ||
329 | private slots: | 330 | private slots: |
330 | void systemMessage ( const QCString &, const QByteArray & ); | 331 | void systemMessage ( const QCString &, const QByteArray & ); |
331 | void playingStopped(); | 332 | void playingStopped(); |
332 | 333 | ||
333 | protected: | 334 | protected: |
334 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); | 335 | void addPreHandler(QWSServer::KeyboardFilter*aFilter); |
335 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); | 336 | void remPreHandler(QWSServer::KeyboardFilter*aFilter); |
336 | void reloadButtonMapping(); | 337 | void reloadButtonMapping(); |
337 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); | 338 | void changeMixerForAlarm( int mixer, const char* file, Sound *snd); |
338 | 339 | ||
339 | /* ugly virtual hook */ | 340 | /* ugly virtual hook */ |
340 | virtual void virtual_hook( int id, void* data ); | 341 | virtual void virtual_hook( int id, void* data ); |
341 | }; | 342 | }; |
342 | 343 | ||
343 | class ODeviceData { | 344 | class ODeviceData { |
344 | 345 | ||
345 | public: | 346 | public: |
346 | QString m_vendorstr; | 347 | QString m_vendorstr; |
347 | OVendor m_vendor; | 348 | OVendor m_vendor; |
348 | 349 | ||
349 | QString m_modelstr; | 350 | QString m_modelstr; |
350 | OModel m_model; | 351 | OModel m_model; |
351 | 352 | ||
352 | QString m_systemstr; | 353 | QString m_systemstr; |
353 | OSystem m_system; | 354 | OSystem m_system; |
354 | 355 | ||
355 | QString m_sysverstr; | 356 | QString m_sysverstr; |
356 | 357 | ||
357 | Transformation m_rotation; | 358 | Transformation m_rotation; |
358 | ODirection m_direction; | 359 | ODirection m_direction; |
359 | 360 | ||
360 | QValueList <ODeviceButton> *m_buttons; | 361 | QValueList <ODeviceButton> *m_buttons; |
361 | uint m_holdtime; | 362 | uint m_holdtime; |
362 | QStrList *m_cpu_frequencies; | 363 | QStrList *m_cpu_frequencies; |
363 | bool m_initializedButtonQcop : 1; | 364 | bool m_initializedButtonQcop : 1; |
364 | 365 | ||
365 | /* values for changeMixerForAlarm */ | 366 | /* values for changeMixerForAlarm */ |
366 | int m_sound, m_vol, m_mixer; | 367 | int m_sound, m_vol, m_mixer; |
367 | }; | 368 | }; |
368 | 369 | ||
369 | extern bool isQWS(); | 370 | extern bool isQWS(); |
370 | extern QCString makeChannel ( const char *str ); | 371 | extern QCString makeChannel ( const char *str ); |
371 | } | 372 | } |
372 | } | 373 | } |
373 | 374 | ||
374 | 375 | ||
375 | 376 | ||
376 | 377 | ||
377 | #endif | 378 | #endif |
378 | 379 | ||
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp index 7d080ba..c7ed4bc 100644 --- a/libopie2/opiecore/device/odevice_jornada.cpp +++ b/libopie2/opiecore/device/odevice_jornada.cpp | |||
@@ -1,184 +1,198 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_jornada.h" | 30 | #include "odevice_jornada.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | /* KERNEL */ | 56 | /* KERNEL */ |
57 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 57 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
58 | 58 | ||
59 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 59 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
60 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 60 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
61 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 61 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
62 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 62 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
63 | 63 | ||
64 | typedef struct { | 64 | typedef struct { |
65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
66 | unsigned char TotalTime; /* Units of 5 seconds */ | 66 | unsigned char TotalTime; /* Units of 5 seconds */ |
67 | unsigned char OnTime; /* units of 100m/s */ | 67 | unsigned char OnTime; /* units of 100m/s */ |
68 | unsigned char OffTime; /* units of 100m/s */ | 68 | unsigned char OffTime; /* units of 100m/s */ |
69 | } LED_IN; | 69 | } LED_IN; |
70 | 70 | ||
71 | typedef struct { | 71 | typedef struct { |
72 | unsigned char mode; | 72 | unsigned char mode; |
73 | unsigned char pwr; | 73 | unsigned char pwr; |
74 | unsigned char brightness; | 74 | unsigned char brightness; |
75 | } FLITE_IN; | 75 | } FLITE_IN; |
76 | 76 | ||
77 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 77 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
78 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 78 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
79 | 79 | ||
80 | using namespace Opie::Core; | 80 | using namespace Opie::Core; |
81 | using namespace Opie::Core::Internal; | 81 | using namespace Opie::Core::Internal; |
82 | 82 | ||
83 | struct j_button jornada56x_buttons [] = { | 83 | struct j_button jornada56x_buttons [] = { |
84 | { Model_Jornada_56x, | 84 | { Model_Jornada_56x, |
85 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 85 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
86 | "devicebuttons/jornada56x_calendar", | 86 | "devicebuttons/jornada56x_calendar", |
87 | "datebook", "nextView()", | 87 | "datebook", "nextView()", |
88 | "today", "raise()" }, | 88 | "today", "raise()" }, |
89 | { Model_Jornada_56x, | 89 | { Model_Jornada_56x, |
90 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 90 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
91 | "devicebuttons/jornada56x_contact", | 91 | "devicebuttons/jornada56x_contact", |
92 | "addressbook", "raise()", | 92 | "addressbook", "raise()", |
93 | "addressbook", "beamBusinessCard()" }, | 93 | "addressbook", "beamBusinessCard()" }, |
94 | { Model_Jornada_56x, | 94 | { Model_Jornada_56x, |
95 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Todo Button"), | 95 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Todo Button"), |
96 | "devicebuttons/jornada56x_todo", | 96 | "devicebuttons/jornada56x_todo", |
97 | "todolist", "raise()", | 97 | "todolist", "raise()", |
98 | "todolist", "create()" }, | 98 | "todolist", "create()" }, |
99 | { Model_Jornada_56x, | 99 | { Model_Jornada_56x, |
100 | Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Home Button"), | 100 | Qt::Key_F8, QT_TRANSLATE_NOOP("Button", "Home Button"), |
101 | "devicebuttons/jornada56x_home", | 101 | "devicebuttons/jornada56x_home", |
102 | "QPE/Launcher", "home()", | 102 | "QPE/Launcher", "home()", |
103 | "buttonsettings", "raise()" }, | 103 | "buttonsettings", "raise()" }, |
104 | { Model_Jornada_56x, | 104 | { Model_Jornada_56x, |
105 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), | 105 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Record Button"), |
106 | "devicebuttons/jornada56x_record", | 106 | "devicebuttons/jornada56x_record", |
107 | "QPE/VMemo", "toggleRecord()", | 107 | "QPE/VMemo", "toggleRecord()", |
108 | "sound", "raise()" }, | 108 | "sound", "raise()" }, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | void Jornada::init(const QString&) | 111 | void Jornada::init(const QString& cpu_info) |
112 | { | 112 | { |
113 | d->m_vendorstr = "HP"; | 113 | d->m_vendorstr = "HP"; |
114 | d->m_vendor = Vendor_HP; | 114 | d->m_vendor = Vendor_HP; |
115 | d->m_modelstr = "Jornada 56x"; | 115 | |
116 | d->m_model = Model_Jornada_56x; | 116 | QString model; |
117 | d->m_rotation = Rot0; | 117 | int loc = cpu_info.find( ":" ); |
118 | if ( loc != -1 ) | ||
119 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | ||
120 | else | ||
121 | model = cpu_info; | ||
122 | |||
123 | if ( model == "HP Jornada 56x" ) { | ||
124 | d->m_modelstr = "Jornada 56x"; | ||
125 | d->m_model = Model_Jornada_56x; | ||
126 | } else if ( model == "HP Jornada 720" ) { | ||
127 | d->m_modelstr = "Jornada 720"; | ||
128 | d->m_model = Model_Jornada_720; | ||
129 | } | ||
130 | |||
131 | d->m_rotation = Rot0; //all Jornadas need this rotation | ||
118 | //Distribution detecting code is now in base class | 132 | //Distribution detecting code is now in base class |
119 | } | 133 | } |
120 | 134 | ||
121 | void Jornada::initButtons() | 135 | void Jornada::initButtons() |
122 | { | 136 | { |
123 | if ( d->m_buttons ) | 137 | if ( d->m_buttons ) |
124 | return; | 138 | return; |
125 | 139 | ||
126 | d->m_buttons = new QValueList <ODeviceButton>; | 140 | d->m_buttons = new QValueList <ODeviceButton>; |
127 | 141 | ||
128 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { | 142 | for ( uint i = 0; i < ( sizeof( jornada56x_buttons ) / sizeof( j_button )); i++ ) { |
129 | j_button *ib = jornada56x_buttons + i; | 143 | j_button *ib = jornada56x_buttons + i; |
130 | ODeviceButton b; | 144 | ODeviceButton b; |
131 | 145 | ||
132 | if (( ib->model & d->m_model ) == d->m_model ) { | 146 | if (( ib->model & d->m_model ) == d->m_model ) { |
133 | b. setKeycode ( ib->code ); | 147 | b. setKeycode ( ib->code ); |
134 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 148 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
135 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 149 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
136 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 150 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
137 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 151 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
138 | 152 | ||
139 | d->m_buttons->append ( b ); | 153 | d->m_buttons->append ( b ); |
140 | } | 154 | } |
141 | } | 155 | } |
142 | reloadButtonMapping(); | 156 | reloadButtonMapping(); |
143 | } | 157 | } |
144 | 158 | ||
145 | int Jornada::displayBrightnessResolution() const | 159 | int Jornada::displayBrightnessResolution() const |
146 | { | 160 | { |
147 | return 255; | 161 | return 255; |
148 | } | 162 | } |
149 | 163 | ||
150 | 164 | ||
151 | bool Jornada::setDisplayBrightness( int bright ) | 165 | bool Jornada::setDisplayBrightness( int bright ) |
152 | { | 166 | { |
153 | bool res = false; | 167 | bool res = false; |
154 | 168 | ||
155 | if ( bright > 255 ) | 169 | if ( bright > 255 ) |
156 | bright = 255; | 170 | bright = 255; |
157 | if ( bright < 0 ) | 171 | if ( bright < 0 ) |
158 | bright = 0; | 172 | bright = 0; |
159 | 173 | ||
160 | QString cmdline; | 174 | QString cmdline; |
161 | 175 | ||
162 | if ( !bright ) | 176 | if ( !bright ) |
163 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/sa1100fb/power"); | 177 | cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/*/power"); |
164 | else | 178 | else |
165 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %1 > /sys/class/backlight/sa1100fb/brightness" ).arg( bright ); | 179 | cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/*/power; echo %1 > /sys/class/backlight/*/brightness" ).arg( bright ); |
166 | 180 | ||
167 | // No Global::shellQuote as we gurantee it to be sane | 181 | // No Global::shellQuote as we gurantee it to be sane |
168 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 182 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
169 | 183 | ||
170 | return res; | 184 | return res; |
171 | } | 185 | } |
172 | 186 | ||
173 | 187 | ||
174 | bool Jornada::setDisplayStatus ( bool on ) | 188 | bool Jornada::setDisplayStatus ( bool on ) |
175 | { | 189 | { |
176 | bool res = false; | 190 | bool res = false; |
177 | 191 | ||
178 | QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); | 192 | QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/*/power; echo %2 > /sys/class/backlight/*/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" ); |
179 | 193 | ||
180 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); | 194 | res = ( ::system( QFile::encodeName(cmdline) ) == 0 ); |
181 | 195 | ||
182 | return res; | 196 | return res; |
183 | } | 197 | } |
184 | 198 | ||