author | sandman <sandman> | 2002-10-29 15:50:21 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-29 15:50:21 (UTC) |
commit | bad66a2ea2aea8bec1c7895b0e1a461e2f4859c2 (patch) (unidiff) | |
tree | 6a39587f58ff01456fff0a6d17d5564d28bb4f4f | |
parent | 6224d462ef211b3b4cffa42d4a7f261caa92834b (diff) | |
download | opie-bad66a2ea2aea8bec1c7895b0e1a461e2f4859c2.zip opie-bad66a2ea2aea8bec1c7895b0e1a461e2f4859c2.tar.gz opie-bad66a2ea2aea8bec1c7895b0e1a461e2f4859c2.tar.bz2 |
added lightSensorResolution() to get the hardware resolution of the light
sensor
-rw-r--r-- | libopie/odevice.cpp | 12 | ||||
-rw-r--r-- | libopie/odevice.h | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9f64fc0..4c49c4f 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -1,184 +1,185 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* This file is part of the OPIE libraries |
2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) | 2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include <fcntl.h> | 22 | #include <fcntl.h> |
23 | #include <sys/ioctl.h> | 23 | #include <sys/ioctl.h> |
24 | #include <signal.h> | 24 | #include <signal.h> |
25 | #include <sys/time.h> | 25 | #include <sys/time.h> |
26 | #include <linux/soundcard.h> | 26 | #include <linux/soundcard.h> |
27 | #include <math.h> | 27 | #include <math.h> |
28 | 28 | ||
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qpe/sound.h> | 33 | #include <qpe/sound.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | 36 | ||
37 | #include "odevice.h" | 37 | #include "odevice.h" |
38 | 38 | ||
39 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
40 | 40 | ||
41 | 41 | ||
42 | // _IO and friends are only defined in kernel headers ... | 42 | // _IO and friends are only defined in kernel headers ... |
43 | 43 | ||
44 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 44 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
45 | 45 | ||
46 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 46 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
47 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 47 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
48 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 48 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
49 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 49 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
50 | 50 | ||
51 | using namespace Opie; | 51 | using namespace Opie; |
52 | 52 | ||
53 | class ODeviceData { | 53 | class ODeviceData { |
54 | public: | 54 | public: |
55 | bool m_qwsserver; | 55 | bool m_qwsserver; |
56 | 56 | ||
57 | QString m_vendorstr; | 57 | QString m_vendorstr; |
58 | OVendor m_vendor; | 58 | OVendor m_vendor; |
59 | 59 | ||
60 | QString m_modelstr; | 60 | QString m_modelstr; |
61 | OModel m_model; | 61 | OModel m_model; |
62 | 62 | ||
63 | QString m_systemstr; | 63 | QString m_systemstr; |
64 | OSystem m_system; | 64 | OSystem m_system; |
65 | 65 | ||
66 | QString m_sysverstr; | 66 | QString m_sysverstr; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | 69 | ||
70 | class iPAQ : public QObject, public ODevice, public QWSServer::KeyboardFilter { | 70 | class iPAQ : public QObject, public ODevice, public QWSServer::KeyboardFilter { |
71 | protected: | 71 | protected: |
72 | virtual void init ( ); | 72 | virtual void init ( ); |
73 | 73 | ||
74 | public: | 74 | public: |
75 | virtual bool setSoftSuspend ( bool soft ); | 75 | virtual bool setSoftSuspend ( bool soft ); |
76 | 76 | ||
77 | virtual bool setDisplayBrightness ( int b ); | 77 | virtual bool setDisplayBrightness ( int b ); |
78 | virtual int displayBrightnessResolution ( ) const; | 78 | virtual int displayBrightnessResolution ( ) const; |
79 | 79 | ||
80 | virtual void alarmSound ( ); | 80 | virtual void alarmSound ( ); |
81 | 81 | ||
82 | virtual QValueList <OLed> ledList ( ) const; | 82 | virtual QValueList <OLed> ledList ( ) const; |
83 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 83 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
84 | virtual OLedState ledState ( OLed led ) const; | 84 | virtual OLedState ledState ( OLed led ) const; |
85 | virtual bool setLedState ( OLed led, OLedState st ); | 85 | virtual bool setLedState ( OLed led, OLedState st ); |
86 | 86 | ||
87 | virtual bool hasLightSensor ( ) const; | 87 | virtual bool hasLightSensor ( ) const; |
88 | virtual int readLightSensor ( ); | 88 | virtual int readLightSensor ( ); |
89 | virtual int lightSensorResolution ( ) const; | ||
89 | 90 | ||
90 | //virtual QValueList <int> keyList ( ) const; | 91 | //virtual QValueList <int> keyList ( ) const; |
91 | 92 | ||
92 | protected: | 93 | protected: |
93 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | 94 | virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); |
94 | virtual void timerEvent ( QTimerEvent *te ); | 95 | virtual void timerEvent ( QTimerEvent *te ); |
95 | 96 | ||
96 | int m_power_timer; | 97 | int m_power_timer; |
97 | 98 | ||
98 | OLedState m_leds [2]; | 99 | OLedState m_leds [2]; |
99 | }; | 100 | }; |
100 | 101 | ||
101 | class Zaurus : public ODevice { | 102 | class Zaurus : public ODevice { |
102 | protected: | 103 | protected: |
103 | virtual void init ( ); | 104 | virtual void init ( ); |
104 | 105 | ||
105 | public: | 106 | public: |
106 | virtual bool setSoftSuspend ( bool soft ); | 107 | virtual bool setSoftSuspend ( bool soft ); |
107 | 108 | ||
108 | virtual bool setDisplayBrightness ( int b ); | 109 | virtual bool setDisplayBrightness ( int b ); |
109 | virtual int displayBrightnessResolution ( ) const; | 110 | virtual int displayBrightnessResolution ( ) const; |
110 | 111 | ||
111 | virtual void alarmSound ( ); | 112 | virtual void alarmSound ( ); |
112 | virtual void keySound ( ); | 113 | virtual void keySound ( ); |
113 | virtual void touchSound ( ); | 114 | virtual void touchSound ( ); |
114 | 115 | ||
115 | virtual QValueList <OLed> ledList ( ) const; | 116 | virtual QValueList <OLed> ledList ( ) const; |
116 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 117 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
117 | virtual OLedState ledState ( OLed led ) const; | 118 | virtual OLedState ledState ( OLed led ) const; |
118 | virtual bool setLedState ( OLed led, OLedState st ); | 119 | virtual bool setLedState ( OLed led, OLedState st ); |
119 | 120 | ||
120 | //virtual QValueList <int> keyList ( ) const; | 121 | //virtual QValueList <int> keyList ( ) const; |
121 | 122 | ||
122 | protected: | 123 | protected: |
123 | virtual void buzzer ( int snd ); | 124 | virtual void buzzer ( int snd ); |
124 | 125 | ||
125 | OLedState m_leds [1]; | 126 | OLedState m_leds [1]; |
126 | }; | 127 | }; |
127 | 128 | ||
128 | 129 | ||
129 | 130 | ||
130 | 131 | ||
131 | 132 | ||
132 | 133 | ||
133 | 134 | ||
134 | ODevice *ODevice::inst ( ) | 135 | ODevice *ODevice::inst ( ) |
135 | { | 136 | { |
136 | static ODevice *dev = 0; | 137 | static ODevice *dev = 0; |
137 | 138 | ||
138 | if ( !dev ) { | 139 | if ( !dev ) { |
139 | if ( QFile::exists ( "/proc/hal/model" )) | 140 | if ( QFile::exists ( "/proc/hal/model" )) |
140 | dev = new iPAQ ( ); | 141 | dev = new iPAQ ( ); |
141 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 142 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
142 | dev = new Zaurus ( ); | 143 | dev = new Zaurus ( ); |
143 | else | 144 | else |
144 | dev = new ODevice ( ); | 145 | dev = new ODevice ( ); |
145 | 146 | ||
146 | dev-> init ( ); | 147 | dev-> init ( ); |
147 | } | 148 | } |
148 | return dev; | 149 | return dev; |
149 | } | 150 | } |
150 | 151 | ||
151 | 152 | ||
152 | /************************************************** | 153 | /************************************************** |
153 | * | 154 | * |
154 | * common | 155 | * common |
155 | * | 156 | * |
156 | **************************************************/ | 157 | **************************************************/ |
157 | 158 | ||
158 | 159 | ||
159 | ODevice::ODevice ( ) | 160 | ODevice::ODevice ( ) |
160 | { | 161 | { |
161 | d = new ODeviceData; | 162 | d = new ODeviceData; |
162 | 163 | ||
163 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 164 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
164 | 165 | ||
165 | d-> m_modelstr = "Unknown"; | 166 | d-> m_modelstr = "Unknown"; |
166 | d-> m_model = Model_Unknown; | 167 | d-> m_model = Model_Unknown; |
167 | d-> m_vendorstr = "Unkown"; | 168 | d-> m_vendorstr = "Unkown"; |
168 | d-> m_vendor = Vendor_Unknown; | 169 | d-> m_vendor = Vendor_Unknown; |
169 | d-> m_systemstr = "Unkown"; | 170 | d-> m_systemstr = "Unkown"; |
170 | d-> m_system = System_Unknown; | 171 | d-> m_system = System_Unknown; |
171 | d-> m_sysverstr = "0.0"; | 172 | d-> m_sysverstr = "0.0"; |
172 | } | 173 | } |
173 | 174 | ||
174 | void ODevice::init ( ) | 175 | void ODevice::init ( ) |
175 | { | 176 | { |
176 | } | 177 | } |
177 | 178 | ||
178 | ODevice::~ODevice ( ) | 179 | ODevice::~ODevice ( ) |
179 | { | 180 | { |
180 | delete d; | 181 | delete d; |
181 | } | 182 | } |
182 | 183 | ||
183 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 184 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
184 | { | 185 | { |
@@ -276,192 +277,196 @@ OVendor ODevice::vendor ( ) const | |||
276 | return d-> m_vendor; | 277 | return d-> m_vendor; |
277 | } | 278 | } |
278 | 279 | ||
279 | QString ODevice::modelString ( ) const | 280 | QString ODevice::modelString ( ) const |
280 | { | 281 | { |
281 | return d-> m_modelstr; | 282 | return d-> m_modelstr; |
282 | } | 283 | } |
283 | 284 | ||
284 | OModel ODevice::model ( ) const | 285 | OModel ODevice::model ( ) const |
285 | { | 286 | { |
286 | return d-> m_model; | 287 | return d-> m_model; |
287 | } | 288 | } |
288 | 289 | ||
289 | QString ODevice::systemString ( ) const | 290 | QString ODevice::systemString ( ) const |
290 | { | 291 | { |
291 | return d-> m_systemstr; | 292 | return d-> m_systemstr; |
292 | } | 293 | } |
293 | 294 | ||
294 | OSystem ODevice::system ( ) const | 295 | OSystem ODevice::system ( ) const |
295 | { | 296 | { |
296 | return d-> m_system; | 297 | return d-> m_system; |
297 | } | 298 | } |
298 | 299 | ||
299 | QString ODevice::systemVersionString ( ) const | 300 | QString ODevice::systemVersionString ( ) const |
300 | { | 301 | { |
301 | return d-> m_sysverstr; | 302 | return d-> m_sysverstr; |
302 | } | 303 | } |
303 | 304 | ||
304 | void ODevice::alarmSound ( ) | 305 | void ODevice::alarmSound ( ) |
305 | { | 306 | { |
306 | #ifndef QT_QWS_EBX | 307 | #ifndef QT_QWS_EBX |
307 | #ifndef QT_NO_SOUND | 308 | #ifndef QT_NO_SOUND |
308 | static Sound snd ( "alarm" ); | 309 | static Sound snd ( "alarm" ); |
309 | 310 | ||
310 | if ( snd. isFinished ( )) | 311 | if ( snd. isFinished ( )) |
311 | snd. play ( ); | 312 | snd. play ( ); |
312 | #endif | 313 | #endif |
313 | #endif | 314 | #endif |
314 | } | 315 | } |
315 | 316 | ||
316 | void ODevice::keySound ( ) | 317 | void ODevice::keySound ( ) |
317 | { | 318 | { |
318 | #ifndef QT_QWS_EBX | 319 | #ifndef QT_QWS_EBX |
319 | #ifndef QT_NO_SOUND | 320 | #ifndef QT_NO_SOUND |
320 | static Sound snd ( "keysound" ); | 321 | static Sound snd ( "keysound" ); |
321 | 322 | ||
322 | if ( snd. isFinished ( )) | 323 | if ( snd. isFinished ( )) |
323 | snd. play ( ); | 324 | snd. play ( ); |
324 | #endif | 325 | #endif |
325 | #endif | 326 | #endif |
326 | } | 327 | } |
327 | 328 | ||
328 | void ODevice::touchSound ( ) | 329 | void ODevice::touchSound ( ) |
329 | { | 330 | { |
330 | 331 | ||
331 | #ifndef QT_QWS_EBX | 332 | #ifndef QT_QWS_EBX |
332 | #ifndef QT_NO_SOUND | 333 | #ifndef QT_NO_SOUND |
333 | static Sound snd ( "touchsound" ); | 334 | static Sound snd ( "touchsound" ); |
334 | 335 | ||
335 | if ( snd. isFinished ( )) | 336 | if ( snd. isFinished ( )) |
336 | snd. play ( ); | 337 | snd. play ( ); |
337 | #endif | 338 | #endif |
338 | #endif | 339 | #endif |
339 | } | 340 | } |
340 | 341 | ||
341 | 342 | ||
342 | QValueList <OLed> ODevice::ledList ( ) const | 343 | QValueList <OLed> ODevice::ledList ( ) const |
343 | { | 344 | { |
344 | return QValueList <OLed> ( ); | 345 | return QValueList <OLed> ( ); |
345 | } | 346 | } |
346 | 347 | ||
347 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 348 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
348 | { | 349 | { |
349 | return QValueList <OLedState> ( ); | 350 | return QValueList <OLedState> ( ); |
350 | } | 351 | } |
351 | 352 | ||
352 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 353 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
353 | { | 354 | { |
354 | return Led_Off; | 355 | return Led_Off; |
355 | } | 356 | } |
356 | 357 | ||
357 | bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) | 358 | bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) |
358 | { | 359 | { |
359 | return false; | 360 | return false; |
360 | } | 361 | } |
361 | 362 | ||
362 | bool ODevice::hasLightSensor ( ) const | 363 | bool ODevice::hasLightSensor ( ) const |
363 | { | 364 | { |
364 | return false; | 365 | return false; |
365 | } | 366 | } |
366 | 367 | ||
367 | int ODevice::readLightSensor ( ) | 368 | int ODevice::readLightSensor ( ) |
368 | { | 369 | { |
369 | return -1; | 370 | return -1; |
370 | } | 371 | } |
371 | 372 | ||
373 | int ODevice::lightSensorResolution ( ) const | ||
374 | { | ||
375 | return 0; | ||
376 | } | ||
372 | 377 | ||
373 | //QValueList <int> ODevice::keyList ( ) const | 378 | //QValueList <int> ODevice::keyList ( ) const |
374 | //{ | 379 | //{ |
375 | //return QValueList <int> ( ); | 380 | //return QValueList <int> ( ); |
376 | //} | 381 | //} |
377 | 382 | ||
378 | 383 | ||
379 | 384 | ||
380 | /************************************************** | 385 | /************************************************** |
381 | * | 386 | * |
382 | * iPAQ | 387 | * iPAQ |
383 | * | 388 | * |
384 | **************************************************/ | 389 | **************************************************/ |
385 | 390 | ||
386 | void iPAQ::init ( ) | 391 | void iPAQ::init ( ) |
387 | { | 392 | { |
388 | d-> m_vendorstr = "HP"; | 393 | d-> m_vendorstr = "HP"; |
389 | d-> m_vendor = Vendor_HP; | 394 | d-> m_vendor = Vendor_HP; |
390 | 395 | ||
391 | QFile f ( "/proc/hal/model" ); | 396 | QFile f ( "/proc/hal/model" ); |
392 | 397 | ||
393 | if ( f. open ( IO_ReadOnly )) { | 398 | if ( f. open ( IO_ReadOnly )) { |
394 | QTextStream ts ( &f ); | 399 | QTextStream ts ( &f ); |
395 | 400 | ||
396 | d-> m_modelstr = "H" + ts. readLine ( ); | 401 | d-> m_modelstr = "H" + ts. readLine ( ); |
397 | 402 | ||
398 | if ( d-> m_modelstr == "H3100" ) | 403 | if ( d-> m_modelstr == "H3100" ) |
399 | d-> m_model = Model_iPAQ_H31xx; | 404 | d-> m_model = Model_iPAQ_H31xx; |
400 | else if ( d-> m_modelstr == "H3600" ) | 405 | else if ( d-> m_modelstr == "H3600" ) |
401 | d-> m_model = Model_iPAQ_H36xx; | 406 | d-> m_model = Model_iPAQ_H36xx; |
402 | else if ( d-> m_modelstr == "H3700" ) | 407 | else if ( d-> m_modelstr == "H3700" ) |
403 | d-> m_model = Model_iPAQ_H37xx; | 408 | d-> m_model = Model_iPAQ_H37xx; |
404 | else if ( d-> m_modelstr == "H3800" ) | 409 | else if ( d-> m_modelstr == "H3800" ) |
405 | d-> m_model = Model_iPAQ_H38xx; | 410 | d-> m_model = Model_iPAQ_H38xx; |
406 | else | 411 | else |
407 | d-> m_model = Model_Unknown; | 412 | d-> m_model = Model_Unknown; |
408 | 413 | ||
409 | f. close ( ); | 414 | f. close ( ); |
410 | } | 415 | } |
411 | 416 | ||
412 | f. setName ( "/etc/familiar-version" ); | 417 | f. setName ( "/etc/familiar-version" ); |
413 | if ( f. open ( IO_ReadOnly )) { | 418 | if ( f. open ( IO_ReadOnly )) { |
414 | d-> m_systemstr = "Familiar"; | 419 | d-> m_systemstr = "Familiar"; |
415 | d-> m_system = System_Familiar; | 420 | d-> m_system = System_Familiar; |
416 | 421 | ||
417 | QTextStream ts ( &f ); | 422 | QTextStream ts ( &f ); |
418 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 423 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
419 | 424 | ||
420 | f. close ( ); | 425 | f. close ( ); |
421 | } | 426 | } |
422 | 427 | ||
423 | m_leds [0] = m_leds [1] = Led_Off; | 428 | m_leds [0] = m_leds [1] = Led_Off; |
424 | 429 | ||
425 | m_power_timer = 0; | 430 | m_power_timer = 0; |
426 | 431 | ||
427 | if ( d-> m_qwsserver ) | 432 | if ( d-> m_qwsserver ) |
428 | QWSServer::setKeyboardFilter ( this ); | 433 | QWSServer::setKeyboardFilter ( this ); |
429 | } | 434 | } |
430 | 435 | ||
431 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... | 436 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... |
432 | 437 | ||
433 | typedef struct { | 438 | typedef struct { |
434 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 439 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
435 | unsigned char TotalTime; /* Units of 5 seconds */ | 440 | unsigned char TotalTime; /* Units of 5 seconds */ |
436 | unsigned char OnTime; /* units of 100m/s */ | 441 | unsigned char OnTime; /* units of 100m/s */ |
437 | unsigned char OffTime; /* units of 100m/s */ | 442 | unsigned char OffTime; /* units of 100m/s */ |
438 | } LED_IN; | 443 | } LED_IN; |
439 | 444 | ||
440 | typedef struct { | 445 | typedef struct { |
441 | unsigned char mode; | 446 | unsigned char mode; |
442 | unsigned char pwr; | 447 | unsigned char pwr; |
443 | unsigned char brightness; | 448 | unsigned char brightness; |
444 | } FLITE_IN; | 449 | } FLITE_IN; |
445 | 450 | ||
446 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 451 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
447 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 452 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
448 | 453 | ||
449 | 454 | ||
450 | 455 | ||
451 | QValueList <OLed> iPAQ::ledList ( ) const | 456 | QValueList <OLed> iPAQ::ledList ( ) const |
452 | { | 457 | { |
453 | QValueList <OLed> vl; | 458 | QValueList <OLed> vl; |
454 | vl << Led_Power; | 459 | vl << Led_Power; |
455 | 460 | ||
456 | if ( d-> m_model == Model_iPAQ_H38xx ) | 461 | if ( d-> m_model == Model_iPAQ_H38xx ) |
457 | vl << Led_BlueTooth; | 462 | vl << Led_BlueTooth; |
458 | return vl; | 463 | return vl; |
459 | } | 464 | } |
460 | 465 | ||
461 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | 466 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const |
462 | { | 467 | { |
463 | QValueList <OLedState> vl; | 468 | QValueList <OLedState> vl; |
464 | 469 | ||
465 | if ( l == Led_Power ) | 470 | if ( l == Led_Power ) |
466 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; | 471 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; |
467 | else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) | 472 | else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) |
@@ -589,217 +594,220 @@ void iPAQ::alarmSound ( ) | |||
589 | #ifndef QT_NO_SOUND | 594 | #ifndef QT_NO_SOUND |
590 | static Sound snd ( "alarm" ); | 595 | static Sound snd ( "alarm" ); |
591 | int fd; | 596 | int fd; |
592 | int vol; | 597 | int vol; |
593 | bool vol_reset = false; | 598 | bool vol_reset = false; |
594 | 599 | ||
595 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { | 600 | if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { |
596 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 601 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
597 | Config cfg ( "qpe" ); | 602 | Config cfg ( "qpe" ); |
598 | cfg. setGroup ( "Volume" ); | 603 | cfg. setGroup ( "Volume" ); |
599 | 604 | ||
600 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 605 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
601 | if ( volalarm < 0 ) | 606 | if ( volalarm < 0 ) |
602 | volalarm = 0; | 607 | volalarm = 0; |
603 | else if ( volalarm > 100 ) | 608 | else if ( volalarm > 100 ) |
604 | volalarm = 100; | 609 | volalarm = 100; |
605 | volalarm |= ( volalarm << 8 ); | 610 | volalarm |= ( volalarm << 8 ); |
606 | 611 | ||
607 | if (( volalarm & 0xff ) > ( vol & 0xff )) { | 612 | if (( volalarm & 0xff ) > ( vol & 0xff )) { |
608 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 613 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
609 | vol_reset = true; | 614 | vol_reset = true; |
610 | } | 615 | } |
611 | } | 616 | } |
612 | } | 617 | } |
613 | 618 | ||
614 | snd. play ( ); | 619 | snd. play ( ); |
615 | while ( !snd. isFinished ( )) | 620 | while ( !snd. isFinished ( )) |
616 | qApp-> processEvents ( ); | 621 | qApp-> processEvents ( ); |
617 | 622 | ||
618 | if ( fd >= 0 ) { | 623 | if ( fd >= 0 ) { |
619 | if ( vol_reset ) | 624 | if ( vol_reset ) |
620 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 625 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
621 | ::close ( fd ); | 626 | ::close ( fd ); |
622 | } | 627 | } |
623 | #endif | 628 | #endif |
624 | #endif | 629 | #endif |
625 | } | 630 | } |
626 | 631 | ||
627 | 632 | ||
628 | bool iPAQ::setSoftSuspend ( bool soft ) | 633 | bool iPAQ::setSoftSuspend ( bool soft ) |
629 | { | 634 | { |
630 | bool res = false; | 635 | bool res = false; |
631 | int fd; | 636 | int fd; |
632 | 637 | ||
633 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 638 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
634 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 639 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
635 | res = true; | 640 | res = true; |
636 | else | 641 | else |
637 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 642 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
638 | 643 | ||
639 | ::close ( fd ); | 644 | ::close ( fd ); |
640 | } | 645 | } |
641 | else | 646 | else |
642 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 647 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
643 | 648 | ||
644 | return res; | 649 | return res; |
645 | } | 650 | } |
646 | 651 | ||
647 | 652 | ||
648 | bool iPAQ::setDisplayBrightness ( int bright ) | 653 | bool iPAQ::setDisplayBrightness ( int bright ) |
649 | { | 654 | { |
650 | bool res = false; | 655 | bool res = false; |
651 | int fd; | 656 | int fd; |
652 | 657 | ||
653 | if ( bright > 255 ) | 658 | if ( bright > 255 ) |
654 | bright = 255; | 659 | bright = 255; |
655 | if ( bright < 0 ) | 660 | if ( bright < 0 ) |
656 | bright = 0; | 661 | bright = 0; |
657 | 662 | ||
658 | // 128 is the maximum if you want a decent lifetime for the LCD | 663 | // 128 is the maximum if you want a decent lifetime for the LCD |
659 | 664 | ||
660 | if ( bright > 1 ) | 665 | if ( bright > 1 ) |
661 | bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic | 666 | bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic |
662 | //bright = ( bright + 1 ) / 2; | 667 | //bright = ( bright + 1 ) / 2; |
663 | 668 | ||
664 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 669 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
665 | FLITE_IN bl; | 670 | FLITE_IN bl; |
666 | bl. mode = 1; | 671 | bl. mode = 1; |
667 | bl. pwr = bright ? 1 : 0; | 672 | bl. pwr = bright ? 1 : 0; |
668 | bl. brightness = bright; | 673 | bl. brightness = bright; |
669 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 674 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
670 | ::close ( fd ); | 675 | ::close ( fd ); |
671 | } | 676 | } |
672 | return res; | 677 | return res; |
673 | } | 678 | } |
674 | 679 | ||
675 | int iPAQ::displayBrightnessResolution ( ) const | 680 | int iPAQ::displayBrightnessResolution ( ) const |
676 | { | 681 | { |
677 | return 256; // really 128, but logarithmic control is smoother this way | 682 | return 256; // really 128, but logarithmic control is smoother this way |
678 | } | 683 | } |
679 | 684 | ||
680 | 685 | ||
681 | bool iPAQ::hasLightSensor ( ) const | 686 | bool iPAQ::hasLightSensor ( ) const |
682 | { | 687 | { |
683 | return true; | 688 | return true; |
684 | } | 689 | } |
685 | #include <errno.h> | 690 | |
686 | #include <string.h> | ||
687 | int iPAQ::readLightSensor ( ) | 691 | int iPAQ::readLightSensor ( ) |
688 | { | 692 | { |
689 | int fd; | 693 | int fd; |
690 | int val = -1; | 694 | int val = -1; |
691 | 695 | ||
692 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 696 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
693 | char buffer [8]; | 697 | char buffer [8]; |
694 | 698 | ||
695 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 699 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
696 | char *endptr; | 700 | char *endptr; |
697 | 701 | ||
698 | buffer [4] = 0; | 702 | buffer [4] = 0; |
699 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 703 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
700 | 704 | ||
701 | if ( *endptr != 0 ) | 705 | if ( *endptr != 0 ) |
702 | val = -1; | 706 | val = -1; |
703 | } | 707 | } |
704 | ::close ( fd ); | 708 | ::close ( fd ); |
705 | } | 709 | } |
706 | 710 | ||
707 | return val; | 711 | return val; |
708 | } | 712 | } |
709 | 713 | ||
714 | int iPAQ::lightSensorResolution ( ) const | ||
715 | { | ||
716 | return 256; | ||
717 | } | ||
710 | 718 | ||
711 | /************************************************** | 719 | /************************************************** |
712 | * | 720 | * |
713 | * Zaurus | 721 | * Zaurus |
714 | * | 722 | * |
715 | **************************************************/ | 723 | **************************************************/ |
716 | 724 | ||
717 | 725 | ||
718 | 726 | ||
719 | void Zaurus::init ( ) | 727 | void Zaurus::init ( ) |
720 | { | 728 | { |
721 | d-> m_modelstr = "Zaurus SL5000"; | 729 | d-> m_modelstr = "Zaurus SL5000"; |
722 | d-> m_model = Model_Zaurus_SL5000; | 730 | d-> m_model = Model_Zaurus_SL5000; |
723 | d-> m_vendorstr = "Sharp"; | 731 | d-> m_vendorstr = "Sharp"; |
724 | d-> m_vendor = Vendor_Sharp; | 732 | d-> m_vendor = Vendor_Sharp; |
725 | 733 | ||
726 | QFile f ( "/proc/filesystems" ); | 734 | QFile f ( "/proc/filesystems" ); |
727 | 735 | ||
728 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { | 736 | if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { |
729 | d-> m_systemstr = "OpenZaurus"; | 737 | d-> m_systemstr = "OpenZaurus"; |
730 | d-> m_system = System_OpenZaurus; | 738 | d-> m_system = System_OpenZaurus; |
731 | 739 | ||
732 | f. close ( ); | 740 | f. close ( ); |
733 | 741 | ||
734 | f. setName ( "/etc/oz_version" ); | 742 | f. setName ( "/etc/oz_version" ); |
735 | if ( f. open ( IO_ReadOnly )) { | 743 | if ( f. open ( IO_ReadOnly )) { |
736 | QTextStream ts ( &f ); | 744 | QTextStream ts ( &f ); |
737 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 745 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
738 | f. close ( ); | 746 | f. close ( ); |
739 | } | 747 | } |
740 | } | 748 | } |
741 | else { | 749 | else { |
742 | d-> m_systemstr = "Zaurus"; | 750 | d-> m_systemstr = "Zaurus"; |
743 | d-> m_system = System_Zaurus; | 751 | d-> m_system = System_Zaurus; |
744 | } | 752 | } |
745 | 753 | ||
746 | 754 | ||
747 | m_leds [0] = Led_Off; | 755 | m_leds [0] = Led_Off; |
748 | } | 756 | } |
749 | 757 | ||
750 | #include <unistd.h> | 758 | #include <unistd.h> |
751 | #include <fcntl.h> | 759 | #include <fcntl.h> |
752 | #include <sys/ioctl.h> | 760 | #include <sys/ioctl.h> |
753 | 761 | ||
754 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 762 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
755 | 763 | ||
756 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 764 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
757 | 765 | ||
758 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 766 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
759 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 767 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
760 | 768 | ||
761 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 769 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
762 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 770 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
763 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 771 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
764 | 772 | ||
765 | /* --- for SHARP_BUZZER device --- */ | 773 | /* --- for SHARP_BUZZER device --- */ |
766 | 774 | ||
767 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 775 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
768 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 776 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
769 | 777 | ||
770 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 778 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
771 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 779 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
772 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 780 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
773 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 781 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
774 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 782 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
775 | 783 | ||
776 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 784 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
777 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 785 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
778 | 786 | ||
779 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 787 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
780 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 788 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
781 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 789 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
782 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 790 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
783 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 791 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
784 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 792 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
785 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 793 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
786 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 794 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
787 | 795 | ||
788 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 796 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
789 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 797 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
790 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 798 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
791 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 799 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
792 | // | 800 | // |
793 | 801 | ||
794 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 802 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
795 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 803 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
796 | 804 | ||
797 | typedef struct sharp_led_status { | 805 | typedef struct sharp_led_status { |
798 | int which; /* select which LED status is wanted. */ | 806 | int which; /* select which LED status is wanted. */ |
799 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 807 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
800 | } sharp_led_status; | 808 | } sharp_led_status; |
801 | 809 | ||
802 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 810 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
803 | 811 | ||
804 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 812 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
805 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 813 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
diff --git a/libopie/odevice.h b/libopie/odevice.h index be2a9c7..e07b91c 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -42,104 +42,105 @@ enum OModel { | |||
42 | Model_Zaurus_SL5000 = ( Model_Zaurus | 1 ), | 42 | Model_Zaurus_SL5000 = ( Model_Zaurus | 1 ), |
43 | }; | 43 | }; |
44 | 44 | ||
45 | enum OVendor { | 45 | enum OVendor { |
46 | Vendor_Unknown, | 46 | Vendor_Unknown, |
47 | 47 | ||
48 | Vendor_HP, | 48 | Vendor_HP, |
49 | Vendor_Sharp | 49 | Vendor_Sharp |
50 | }; | 50 | }; |
51 | 51 | ||
52 | enum OSystem { | 52 | enum OSystem { |
53 | System_Unknown, | 53 | System_Unknown, |
54 | 54 | ||
55 | System_Familiar, | 55 | System_Familiar, |
56 | System_Zaurus, | 56 | System_Zaurus, |
57 | System_OpenZaurus | 57 | System_OpenZaurus |
58 | }; | 58 | }; |
59 | 59 | ||
60 | enum OLedState { | 60 | enum OLedState { |
61 | Led_Off, | 61 | Led_Off, |
62 | Led_On, | 62 | Led_On, |
63 | Led_BlinkSlow, | 63 | Led_BlinkSlow, |
64 | Led_BlinkFast | 64 | Led_BlinkFast |
65 | }; | 65 | }; |
66 | 66 | ||
67 | enum OLed { | 67 | enum OLed { |
68 | Led_Mail, | 68 | Led_Mail, |
69 | Led_Power, | 69 | Led_Power, |
70 | Led_BlueTooth | 70 | Led_BlueTooth |
71 | }; | 71 | }; |
72 | 72 | ||
73 | enum OHardKey { | 73 | enum OHardKey { |
74 | HardKey_Datebook = Qt::Key_F9, | 74 | HardKey_Datebook = Qt::Key_F9, |
75 | HardKey_Contacts = Qt::Key_F10, | 75 | HardKey_Contacts = Qt::Key_F10, |
76 | HardKey_Menu = Qt::Key_F11, | 76 | HardKey_Menu = Qt::Key_F11, |
77 | HardKey_Home = Qt::Key_F12, | 77 | HardKey_Home = Qt::Key_F12, |
78 | HardKey_Mail = Qt::Key_F14, | 78 | HardKey_Mail = Qt::Key_F14, |
79 | HardKey_Record = Qt::Key_F24, | 79 | HardKey_Record = Qt::Key_F24, |
80 | HardKey_Suspend = Qt::Key_F34, | 80 | HardKey_Suspend = Qt::Key_F34, |
81 | HardKey_Backlight = Qt::Key_F35, | 81 | HardKey_Backlight = Qt::Key_F35, |
82 | }; | 82 | }; |
83 | 83 | ||
84 | 84 | ||
85 | class ODevice | 85 | class ODevice |
86 | { | 86 | { |
87 | private: | 87 | private: |
88 | ODevice ( const ODevice & ); | 88 | ODevice ( const ODevice & ); |
89 | 89 | ||
90 | protected: | 90 | protected: |
91 | ODevice ( ); | 91 | ODevice ( ); |
92 | virtual void init ( ); | 92 | virtual void init ( ); |
93 | 93 | ||
94 | ODeviceData *d; | 94 | ODeviceData *d; |
95 | 95 | ||
96 | public: | 96 | public: |
97 | virtual ~ODevice ( ); | 97 | virtual ~ODevice ( ); |
98 | 98 | ||
99 | static ODevice *inst ( ); | 99 | static ODevice *inst ( ); |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | // information | 103 | // information |
104 | 104 | ||
105 | QString modelString ( ) const; | 105 | QString modelString ( ) const; |
106 | OModel model ( ) const; | 106 | OModel model ( ) const; |
107 | 107 | ||
108 | QString vendorString ( ) const; | 108 | QString vendorString ( ) const; |
109 | OVendor vendor ( ) const; | 109 | OVendor vendor ( ) const; |
110 | 110 | ||
111 | QString systemString ( ) const; | 111 | QString systemString ( ) const; |
112 | OSystem system ( ) const; | 112 | OSystem system ( ) const; |
113 | 113 | ||
114 | QString systemVersionString ( ) const; | 114 | QString systemVersionString ( ) const; |
115 | 115 | ||
116 | // system | 116 | // system |
117 | 117 | ||
118 | virtual bool setSoftSuspend ( bool on ); | 118 | virtual bool setSoftSuspend ( bool on ); |
119 | virtual bool suspend ( ); | 119 | virtual bool suspend ( ); |
120 | 120 | ||
121 | virtual bool setDisplayStatus ( bool on ); | 121 | virtual bool setDisplayStatus ( bool on ); |
122 | virtual bool setDisplayBrightness ( int brightness ); | 122 | virtual bool setDisplayBrightness ( int brightness ); |
123 | virtual int displayBrightnessResolution ( ) const; | 123 | virtual int displayBrightnessResolution ( ) const; |
124 | 124 | ||
125 | // input / output | 125 | // input / output |
126 | 126 | ||
127 | virtual void alarmSound ( ); | 127 | virtual void alarmSound ( ); |
128 | virtual void keySound ( ); | 128 | virtual void keySound ( ); |
129 | virtual void touchSound ( ); | 129 | virtual void touchSound ( ); |
130 | 130 | ||
131 | virtual QValueList <OLed> ledList ( ) const; | 131 | virtual QValueList <OLed> ledList ( ) const; |
132 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 132 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
133 | virtual OLedState ledState ( OLed led ) const; | 133 | virtual OLedState ledState ( OLed led ) const; |
134 | virtual bool setLedState ( OLed led, OLedState st ); | 134 | virtual bool setLedState ( OLed led, OLedState st ); |
135 | 135 | ||
136 | virtual bool hasLightSensor ( ) const; | 136 | virtual bool hasLightSensor ( ) const; |
137 | virtual int readLightSensor ( ); | 137 | virtual int readLightSensor ( ); |
138 | virtual int lightSensorResolution ( ) const; | ||
138 | 139 | ||
139 | //virtual QValueList <int> keyList ( ) const; | 140 | //virtual QValueList <int> keyList ( ) const; |
140 | }; | 141 | }; |
141 | 142 | ||
142 | } | 143 | } |
143 | 144 | ||
144 | #endif | 145 | #endif |
145 | 146 | ||