-rw-r--r-- | libopie/odevice.cpp | 8 | ||||
-rw-r--r-- | libopie/odevice.h | 2 |
2 files changed, 1 insertions, 9 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 6572fb6..1da8862 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -1,344 +1,338 @@ | |||
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 | 27 | ||
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | 29 | ||
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qtextstream.h> | 31 | #include <qtextstream.h> |
32 | #include <qpe/sound.h> | 32 | #include <qpe/sound.h> |
33 | #include <qpe/resource.h> | 33 | #include <qpe/resource.h> |
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | 35 | ||
36 | 36 | ||
37 | 37 | ||
38 | #include "odevice.h" | 38 | #include "odevice.h" |
39 | 39 | ||
40 | 40 | ||
41 | class ODeviceData { | 41 | class ODeviceData { |
42 | public: | 42 | public: |
43 | QString m_vendorstr; | 43 | QString m_vendorstr; |
44 | OVendor m_vendor; | 44 | OVendor m_vendor; |
45 | 45 | ||
46 | QString m_modelstr; | 46 | QString m_modelstr; |
47 | OModel m_model; | 47 | OModel m_model; |
48 | 48 | ||
49 | QString m_systemstr; | 49 | QString m_systemstr; |
50 | OSystem m_system; | 50 | OSystem m_system; |
51 | 51 | ||
52 | QString m_sysverstr; | 52 | QString m_sysverstr; |
53 | 53 | ||
54 | OLedState m_leds [4]; // just for convenience ... | 54 | OLedState m_leds [4]; // just for convenience ... |
55 | }; | 55 | }; |
56 | 56 | ||
57 | class ODeviceIPAQ : public ODevice { | 57 | class ODeviceIPAQ : public ODevice { |
58 | protected: | 58 | protected: |
59 | virtual void init ( ); | 59 | virtual void init ( ); |
60 | 60 | ||
61 | public: | 61 | public: |
62 | virtual void alarmSound ( ); | 62 | virtual void alarmSound ( ); |
63 | 63 | ||
64 | virtual uint hasLeds ( ) const; | 64 | virtual uint hasLeds ( ) const; |
65 | virtual OLedState led ( uint which ) const; | 65 | virtual OLedState led ( uint which ) const; |
66 | virtual bool setLed ( uint which, OLedState st ); | 66 | virtual bool setLed ( uint which, OLedState st ); |
67 | }; | 67 | }; |
68 | 68 | ||
69 | class ODeviceZaurus : public ODevice { | 69 | class ODeviceZaurus : public ODevice { |
70 | protected: | 70 | protected: |
71 | virtual void init ( ); | 71 | virtual void init ( ); |
72 | 72 | ||
73 | public: | 73 | public: |
74 | virtual void alarmSound ( ); | 74 | virtual void alarmSound ( ); |
75 | virtual void keySound ( ); | 75 | virtual void keySound ( ); |
76 | virtual void touchSound ( ); | 76 | virtual void touchSound ( ); |
77 | 77 | ||
78 | virtual uint hasLeds ( ) const; | 78 | virtual uint hasLeds ( ) const; |
79 | virtual OLedState led ( uint which ) const; | 79 | virtual OLedState led ( uint which ) const; |
80 | virtual bool setLed ( uint which, OLedState st ); | 80 | virtual bool setLed ( uint which, OLedState st ); |
81 | 81 | ||
82 | protected: | 82 | protected: |
83 | virtual void buzzer ( int snd ); | 83 | virtual void buzzer ( int snd ); |
84 | }; | 84 | }; |
85 | 85 | ||
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | ODevice *ODevice::inst ( ) | 89 | ODevice *ODevice::inst ( ) |
90 | { | 90 | { |
91 | static ODevice *dev = 0; | 91 | static ODevice *dev = 0; |
92 | 92 | ||
93 | if ( !dev ) { | 93 | if ( !dev ) { |
94 | if ( QFile::exists ( "/proc/hal/model" )) | 94 | if ( QFile::exists ( "/proc/hal/model" )) |
95 | dev = new ODeviceIPAQ ( ); | 95 | dev = new ODeviceIPAQ ( ); |
96 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 96 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
97 | dev = new ODeviceZaurus ( ); | 97 | dev = new ODeviceZaurus ( ); |
98 | else | 98 | else |
99 | dev = new ODevice ( ); | 99 | dev = new ODevice ( ); |
100 | 100 | ||
101 | dev-> init ( ); | 101 | dev-> init ( ); |
102 | } | 102 | } |
103 | return dev; | 103 | return dev; |
104 | } | 104 | } |
105 | 105 | ||
106 | ODevice::ODevice ( ) | 106 | ODevice::ODevice ( ) |
107 | { | 107 | { |
108 | d = new ODeviceData; | 108 | d = new ODeviceData; |
109 | 109 | ||
110 | d-> m_modelstr = "Unknown"; | 110 | d-> m_modelstr = "Unknown"; |
111 | d-> m_model = OMODEL_Unknown; | 111 | d-> m_model = OMODEL_Unknown; |
112 | d-> m_vendorstr = "Unkown"; | 112 | d-> m_vendorstr = "Unkown"; |
113 | d-> m_vendor = OVENDOR_Unknown; | 113 | d-> m_vendor = OVENDOR_Unknown; |
114 | d-> m_systemstr = "Unkown"; | 114 | d-> m_systemstr = "Unkown"; |
115 | d-> m_system = OSYSTEM_Unknown; | 115 | d-> m_system = OSYSTEM_Unknown; |
116 | d-> m_sysverstr = "0.0"; | 116 | d-> m_sysverstr = "0.0"; |
117 | } | 117 | } |
118 | 118 | ||
119 | void ODevice::init ( ) | 119 | void ODevice::init ( ) |
120 | { | 120 | { |
121 | } | 121 | } |
122 | 122 | ||
123 | ODevice::~ODevice ( ) | 123 | ODevice::~ODevice ( ) |
124 | { | 124 | { |
125 | delete d; | 125 | delete d; |
126 | } | 126 | } |
127 | 127 | ||
128 | //#include <linux/apm_bios.h> | 128 | //#include <linux/apm_bios.h> |
129 | 129 | ||
130 | //#define APM_IOC_SUSPEND _IO('A',2) | 130 | //#define APM_IOC_SUSPEND _IO('A',2) |
131 | 131 | ||
132 | #define APM_IOC_SUSPEND (( 0<<30 ) | ( 'A'<<8 ) | ( 2 ) | ( 0<<16 )) | 132 | #define APM_IOC_SUSPEND (( 0<<30 ) | ( 'A'<<8 ) | ( 2 ) | ( 0<<16 )) |
133 | 133 | ||
134 | |||
135 | void ODevice::tstp_sighandler ( int ) | ||
136 | { | ||
137 | } | ||
138 | |||
139 | |||
140 | bool ODevice::suspend ( ) | 134 | bool ODevice::suspend ( ) |
141 | { | 135 | { |
142 | if ( d-> m_model == OMODEL_Unknown ) // better don't suspend in qvfb / on unkown devices | 136 | if ( d-> m_model == OMODEL_Unknown ) // better don't suspend in qvfb / on unkown devices |
143 | return false; | 137 | return false; |
144 | 138 | ||
145 | int fd; | 139 | int fd; |
146 | bool res = false; | 140 | bool res = false; |
147 | 141 | ||
148 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || | 142 | if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || |
149 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { | 143 | (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { |
150 | struct timeval tvs, tvn; | 144 | struct timeval tvs, tvn; |
151 | 145 | ||
152 | ::signal ( SIGTSTP, tstp_sighandler );// we don't want to be stopped | 146 | ::signal ( SIGTSTP, SIG_IGN );// we don't want to be stopped |
153 | ::gettimeofday ( &tvs, 0 ); | 147 | ::gettimeofday ( &tvs, 0 ); |
154 | 148 | ||
155 | res = ( ::ioctl ( fd, APM_IOC_SUSPEND ) == 0 ); // tell the kernel to "start" suspending | 149 | res = ( ::ioctl ( fd, APM_IOC_SUSPEND ) == 0 ); // tell the kernel to "start" suspending |
156 | ::close ( fd ); | 150 | ::close ( fd ); |
157 | 151 | ||
158 | if ( res ) { | 152 | if ( res ) { |
159 | ::kill ( -::getpid ( ), SIGTSTP ); // stop everthing in out process group | 153 | ::kill ( -::getpid ( ), SIGTSTP ); // stop everthing in out process group |
160 | 154 | ||
161 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 155 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
162 | ::usleep ( 200 * 1000 ); | 156 | ::usleep ( 200 * 1000 ); |
163 | ::gettimeofday ( &tvn, 0 ); | 157 | ::gettimeofday ( &tvn, 0 ); |
164 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 158 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
165 | 159 | ||
166 | ::kill ( -::getpid ( ), SIGCONT ); // continue everything in our process group | 160 | ::kill ( -::getpid ( ), SIGCONT ); // continue everything in our process group |
167 | } | 161 | } |
168 | 162 | ||
169 | ::signal ( SIGTSTP, SIG_DFL ); | 163 | ::signal ( SIGTSTP, SIG_DFL ); |
170 | } | 164 | } |
171 | 165 | ||
172 | return res; | 166 | return res; |
173 | } | 167 | } |
174 | 168 | ||
175 | 169 | ||
176 | QString ODevice::vendorString ( ) | 170 | QString ODevice::vendorString ( ) |
177 | { | 171 | { |
178 | return d-> m_vendorstr; | 172 | return d-> m_vendorstr; |
179 | } | 173 | } |
180 | 174 | ||
181 | OVendor ODevice::vendor ( ) | 175 | OVendor ODevice::vendor ( ) |
182 | { | 176 | { |
183 | return d-> m_vendor; | 177 | return d-> m_vendor; |
184 | } | 178 | } |
185 | 179 | ||
186 | QString ODevice::modelString ( ) | 180 | QString ODevice::modelString ( ) |
187 | { | 181 | { |
188 | return d-> m_modelstr; | 182 | return d-> m_modelstr; |
189 | } | 183 | } |
190 | 184 | ||
191 | OModel ODevice::model ( ) | 185 | OModel ODevice::model ( ) |
192 | { | 186 | { |
193 | return d-> m_model; | 187 | return d-> m_model; |
194 | } | 188 | } |
195 | 189 | ||
196 | QString ODevice::systemString ( ) | 190 | QString ODevice::systemString ( ) |
197 | { | 191 | { |
198 | return d-> m_systemstr; | 192 | return d-> m_systemstr; |
199 | } | 193 | } |
200 | 194 | ||
201 | OSystem ODevice::system ( ) | 195 | OSystem ODevice::system ( ) |
202 | { | 196 | { |
203 | return d-> m_system; | 197 | return d-> m_system; |
204 | } | 198 | } |
205 | 199 | ||
206 | QString ODevice::systemVersionString ( ) | 200 | QString ODevice::systemVersionString ( ) |
207 | { | 201 | { |
208 | return d-> m_sysverstr; | 202 | return d-> m_sysverstr; |
209 | } | 203 | } |
210 | 204 | ||
211 | void ODevice::alarmSound ( ) | 205 | void ODevice::alarmSound ( ) |
212 | { | 206 | { |
213 | #ifndef QT_QWS_EBX | 207 | #ifndef QT_QWS_EBX |
214 | #ifndef QT_NO_SOUND | 208 | #ifndef QT_NO_SOUND |
215 | static Sound snd ( "alarm" ); | 209 | static Sound snd ( "alarm" ); |
216 | 210 | ||
217 | if ( snd. isFinished ( )) | 211 | if ( snd. isFinished ( )) |
218 | snd. play ( ); | 212 | snd. play ( ); |
219 | #endif | 213 | #endif |
220 | #endif | 214 | #endif |
221 | } | 215 | } |
222 | 216 | ||
223 | void ODevice::keySound ( ) | 217 | void ODevice::keySound ( ) |
224 | { | 218 | { |
225 | #ifndef QT_QWS_EBX | 219 | #ifndef QT_QWS_EBX |
226 | #ifndef QT_NO_SOUND | 220 | #ifndef QT_NO_SOUND |
227 | static Sound snd ( "keysound" ); | 221 | static Sound snd ( "keysound" ); |
228 | 222 | ||
229 | if ( snd. isFinished ( )) | 223 | if ( snd. isFinished ( )) |
230 | snd. play ( ); | 224 | snd. play ( ); |
231 | #endif | 225 | #endif |
232 | #endif | 226 | #endif |
233 | } | 227 | } |
234 | 228 | ||
235 | void ODevice::touchSound ( ) | 229 | void ODevice::touchSound ( ) |
236 | { | 230 | { |
237 | 231 | ||
238 | #ifndef QT_QWS_EBX | 232 | #ifndef QT_QWS_EBX |
239 | #ifndef QT_NO_SOUND | 233 | #ifndef QT_NO_SOUND |
240 | static Sound snd ( "touchsound" ); | 234 | static Sound snd ( "touchsound" ); |
241 | //qDebug("touchSound"); | 235 | //qDebug("touchSound"); |
242 | if ( snd. isFinished ( )) { | 236 | if ( snd. isFinished ( )) { |
243 | snd. play ( ); | 237 | snd. play ( ); |
244 | // qDebug("sound should play"); | 238 | // qDebug("sound should play"); |
245 | } | 239 | } |
246 | #endif | 240 | #endif |
247 | #endif | 241 | #endif |
248 | } | 242 | } |
249 | 243 | ||
250 | uint ODevice::hasLeds ( ) const | 244 | uint ODevice::hasLeds ( ) const |
251 | { | 245 | { |
252 | return 0; | 246 | return 0; |
253 | } | 247 | } |
254 | 248 | ||
255 | OLedState ODevice::led ( uint /*which*/ ) const | 249 | OLedState ODevice::led ( uint /*which*/ ) const |
256 | { | 250 | { |
257 | return OLED_Off; | 251 | return OLED_Off; |
258 | } | 252 | } |
259 | 253 | ||
260 | bool ODevice::setLed ( uint /*which*/, OLedState /*st*/ ) | 254 | bool ODevice::setLed ( uint /*which*/, OLedState /*st*/ ) |
261 | { | 255 | { |
262 | return false; | 256 | return false; |
263 | } | 257 | } |
264 | 258 | ||
265 | 259 | ||
266 | 260 | ||
267 | 261 | ||
268 | //#if defined( QT_QWS_IPAQ ) // IPAQ | 262 | //#if defined( QT_QWS_IPAQ ) // IPAQ |
269 | 263 | ||
270 | 264 | ||
271 | void ODeviceIPAQ::init ( ) | 265 | void ODeviceIPAQ::init ( ) |
272 | { | 266 | { |
273 | d-> m_vendorstr = "HP"; | 267 | d-> m_vendorstr = "HP"; |
274 | d-> m_vendor = OVENDOR_HP; | 268 | d-> m_vendor = OVENDOR_HP; |
275 | 269 | ||
276 | QFile f ( "/proc/hal/model" ); | 270 | QFile f ( "/proc/hal/model" ); |
277 | 271 | ||
278 | if ( f. open ( IO_ReadOnly )) { | 272 | if ( f. open ( IO_ReadOnly )) { |
279 | QTextStream ts ( &f ); | 273 | QTextStream ts ( &f ); |
280 | 274 | ||
281 | d-> m_modelstr = "H" + ts. readLine ( ); | 275 | d-> m_modelstr = "H" + ts. readLine ( ); |
282 | 276 | ||
283 | if ( d-> m_modelstr == "H3100" ) | 277 | if ( d-> m_modelstr == "H3100" ) |
284 | d-> m_model = OMODEL_iPAQ_H31xx; | 278 | d-> m_model = OMODEL_iPAQ_H31xx; |
285 | else if ( d-> m_modelstr == "H3600" ) | 279 | else if ( d-> m_modelstr == "H3600" ) |
286 | d-> m_model = OMODEL_iPAQ_H36xx; | 280 | d-> m_model = OMODEL_iPAQ_H36xx; |
287 | else if ( d-> m_modelstr == "H3700" ) | 281 | else if ( d-> m_modelstr == "H3700" ) |
288 | d-> m_model = OMODEL_iPAQ_H37xx; | 282 | d-> m_model = OMODEL_iPAQ_H37xx; |
289 | else if ( d-> m_modelstr == "H3800" ) | 283 | else if ( d-> m_modelstr == "H3800" ) |
290 | d-> m_model = OMODEL_iPAQ_H38xx; | 284 | d-> m_model = OMODEL_iPAQ_H38xx; |
291 | else | 285 | else |
292 | d-> m_model = OMODEL_Unknown; | 286 | d-> m_model = OMODEL_Unknown; |
293 | 287 | ||
294 | f. close ( ); | 288 | f. close ( ); |
295 | } | 289 | } |
296 | 290 | ||
297 | f. setName ( "/etc/familiar-version" ); | 291 | f. setName ( "/etc/familiar-version" ); |
298 | if ( f. open ( IO_ReadOnly )) { | 292 | if ( f. open ( IO_ReadOnly )) { |
299 | d-> m_systemstr = "Familiar"; | 293 | d-> m_systemstr = "Familiar"; |
300 | d-> m_system = OSYSTEM_Familiar; | 294 | d-> m_system = OSYSTEM_Familiar; |
301 | 295 | ||
302 | QTextStream ts ( &f ); | 296 | QTextStream ts ( &f ); |
303 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 297 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
304 | 298 | ||
305 | f. close ( ); | 299 | f. close ( ); |
306 | } | 300 | } |
307 | 301 | ||
308 | d-> m_leds [0] = OLED_Off; | 302 | d-> m_leds [0] = OLED_Off; |
309 | } | 303 | } |
310 | 304 | ||
311 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... | 305 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... |
312 | 306 | ||
313 | typedef struct h3600_ts_led { | 307 | typedef struct h3600_ts_led { |
314 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 308 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
315 | unsigned char TotalTime; /* Units of 5 seconds */ | 309 | unsigned char TotalTime; /* Units of 5 seconds */ |
316 | unsigned char OnTime; /* units of 100m/s */ | 310 | unsigned char OnTime; /* units of 100m/s */ |
317 | unsigned char OffTime; /* units of 100m/s */ | 311 | unsigned char OffTime; /* units of 100m/s */ |
318 | } LED_IN; | 312 | } LED_IN; |
319 | 313 | ||
320 | 314 | ||
321 | // #define IOC_H3600_TS_MAGIC 'f' | 315 | // #define IOC_H3600_TS_MAGIC 'f' |
322 | // #define LED_ON _IOW(IOC_H3600_TS_MAGIC, 5, struct h3600_ts_led) | 316 | // #define LED_ON _IOW(IOC_H3600_TS_MAGIC, 5, struct h3600_ts_led) |
323 | #define LED_ON (( 1<<30 ) | ( 'f'<<8 ) | ( 5 ) | ( sizeof(struct h3600_ts_led)<<16 )) // _IOW only defined in kernel headers :( | 317 | #define LED_ON (( 1<<30 ) | ( 'f'<<8 ) | ( 5 ) | ( sizeof(struct h3600_ts_led)<<16 )) // _IOW only defined in kernel headers :( |
324 | 318 | ||
325 | 319 | ||
326 | void ODeviceIPAQ::alarmSound ( ) | 320 | void ODeviceIPAQ::alarmSound ( ) |
327 | { | 321 | { |
328 | #if defined( QT_QWS_IPAQ ) // IPAQ | 322 | #if defined( QT_QWS_IPAQ ) // IPAQ |
329 | #ifndef QT_NO_SOUND | 323 | #ifndef QT_NO_SOUND |
330 | static Sound snd ( "alarm" ); | 324 | static Sound snd ( "alarm" ); |
331 | int fd; | 325 | int fd; |
332 | int vol; | 326 | int vol; |
333 | bool vol_reset = false; | 327 | bool vol_reset = false; |
334 | 328 | ||
335 | if ((( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) || | 329 | if ((( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) || |
336 | (( fd = ::open ( "/dev/mixer", O_RDWR )) >= 0 )) { | 330 | (( fd = ::open ( "/dev/mixer", O_RDWR )) >= 0 )) { |
337 | 331 | ||
338 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { | 332 | if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { |
339 | Config cfg ( "qpe" ); | 333 | Config cfg ( "qpe" ); |
340 | cfg. setGroup ( "Volume" ); | 334 | cfg. setGroup ( "Volume" ); |
341 | 335 | ||
342 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); | 336 | int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); |
343 | if ( volalarm < 0 ) | 337 | if ( volalarm < 0 ) |
344 | volalarm = 0; | 338 | volalarm = 0; |
diff --git a/libopie/odevice.h b/libopie/odevice.h index cda504a..5009b91 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -1,111 +1,109 @@ | |||
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 | #ifndef _LIBOPIE_ODEVICE_H_ | 20 | #ifndef _LIBOPIE_ODEVICE_H_ |
21 | #define _LIBOPIE_ODEVICE_H_ | 21 | #define _LIBOPIE_ODEVICE_H_ |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | 24 | ||
25 | 25 | ||
26 | class ODeviceData; | 26 | class ODeviceData; |
27 | 27 | ||
28 | enum OModel { | 28 | enum OModel { |
29 | OMODEL_Unknown, | 29 | OMODEL_Unknown, |
30 | 30 | ||
31 | OMODEL_iPAQ_H31xx, | 31 | OMODEL_iPAQ_H31xx, |
32 | OMODEL_iPAQ_H36xx, | 32 | OMODEL_iPAQ_H36xx, |
33 | OMODEL_iPAQ_H37xx, | 33 | OMODEL_iPAQ_H37xx, |
34 | OMODEL_iPAQ_H38xx, | 34 | OMODEL_iPAQ_H38xx, |
35 | 35 | ||
36 | OMODEL_Zaurus_SL5000 | 36 | OMODEL_Zaurus_SL5000 |
37 | }; | 37 | }; |
38 | 38 | ||
39 | enum OVendor { | 39 | enum OVendor { |
40 | OVENDOR_Unknown, | 40 | OVENDOR_Unknown, |
41 | 41 | ||
42 | OVENDOR_HP, | 42 | OVENDOR_HP, |
43 | OVENDOR_Sharp | 43 | OVENDOR_Sharp |
44 | }; | 44 | }; |
45 | 45 | ||
46 | enum OSystem { | 46 | enum OSystem { |
47 | OSYSTEM_Unknown, | 47 | OSYSTEM_Unknown, |
48 | 48 | ||
49 | OSYSTEM_Familiar, | 49 | OSYSTEM_Familiar, |
50 | OSYSTEM_Zaurus, | 50 | OSYSTEM_Zaurus, |
51 | OSYSTEM_OpenZaurus | 51 | OSYSTEM_OpenZaurus |
52 | }; | 52 | }; |
53 | 53 | ||
54 | enum OLedState { | 54 | enum OLedState { |
55 | OLED_Off, | 55 | OLED_Off, |
56 | OLED_On, | 56 | OLED_On, |
57 | OLED_BlinkSlow, | 57 | OLED_BlinkSlow, |
58 | OLED_BlinkFast | 58 | OLED_BlinkFast |
59 | }; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | class ODevice | 62 | class ODevice |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | 65 | ||
66 | public: | 66 | public: |
67 | static ODevice *inst ( ); | 67 | static ODevice *inst ( ); |
68 | 68 | ||
69 | // system | 69 | // system |
70 | virtual bool suspend ( ); | 70 | virtual bool suspend ( ); |
71 | 71 | ||
72 | // information | 72 | // information |
73 | 73 | ||
74 | QString modelString ( ); | 74 | QString modelString ( ); |
75 | OModel model ( ); | 75 | OModel model ( ); |
76 | 76 | ||
77 | QString vendorString ( ); | 77 | QString vendorString ( ); |
78 | OVendor vendor ( ); | 78 | OVendor vendor ( ); |
79 | 79 | ||
80 | QString systemString ( ); | 80 | QString systemString ( ); |
81 | OSystem system ( ); | 81 | OSystem system ( ); |
82 | 82 | ||
83 | QString systemVersionString ( ); | 83 | QString systemVersionString ( ); |
84 | 84 | ||
85 | // input / output | 85 | // input / output |
86 | 86 | ||
87 | virtual void alarmSound ( ); | 87 | virtual void alarmSound ( ); |
88 | virtual void keySound ( ); | 88 | virtual void keySound ( ); |
89 | virtual void touchSound ( ); | 89 | virtual void touchSound ( ); |
90 | 90 | ||
91 | virtual uint hasLeds ( ) const; | 91 | virtual uint hasLeds ( ) const; |
92 | virtual OLedState led ( uint which ) const; | 92 | virtual OLedState led ( uint which ) const; |
93 | virtual bool setLed ( uint which, OLedState st ); | 93 | virtual bool setLed ( uint which, OLedState st ); |
94 | 94 | ||
95 | virtual ~ODevice ( ); | 95 | virtual ~ODevice ( ); |
96 | 96 | ||
97 | protected: | 97 | protected: |
98 | ODevice ( ); | 98 | ODevice ( ); |
99 | virtual void init ( ); | 99 | virtual void init ( ); |
100 | 100 | ||
101 | ODeviceData *d; | 101 | ODeviceData *d; |
102 | 102 | ||
103 | private: | 103 | private: |
104 | ODevice ( const ODevice & ); | 104 | ODevice ( const ODevice & ); |
105 | |||
106 | static void tstp_sighandler ( int ); | ||
107 | }; | 105 | }; |
108 | 106 | ||
109 | #endif | 107 | #endif |
110 | 108 | ||
111 | 109 | ||