author | alwin <alwin> | 2004-02-19 11:38:19 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-02-19 11:38:19 (UTC) |
commit | b0019ad8b4a0d69dfd98fe4aa599600746eac20f (patch) (unidiff) | |
tree | 8a77c163eab658f9cca5c573b8999905f9d26c87 /libopie2/opiecore/device/odevice_simpad.cpp | |
parent | fd12f140cefd20ff7658b695c657c3a6a838da19 (diff) | |
download | opie-b0019ad8b4a0d69dfd98fe4aa599600746eac20f.zip opie-b0019ad8b4a0d69dfd98fe4aa599600746eac20f.tar.gz opie-b0019ad8b4a0d69dfd98fe4aa599600746eac20f.tar.bz2 |
when going to suspend, a QCopEnvelope message will send
( "QPE/System","aboutSuspend()" )
Diffstat (limited to 'libopie2/opiecore/device/odevice_simpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 4397b78..31b9297 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -1,48 +1,48 @@ | |||
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_simpad.h" | 30 | #include "odevice_simpad.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> |
@@ -305,48 +305,49 @@ void SIMpad::playAlarmSound() | |||
305 | vol_reset = true; | 305 | vol_reset = true; |
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
309 | snd. play(); | 309 | snd. play(); |
310 | while ( !snd. isFinished()) | 310 | while ( !snd. isFinished()) |
311 | qApp->processEvents(); | 311 | qApp->processEvents(); |
312 | 312 | ||
313 | if ( fd >= 0 ) { | 313 | if ( fd >= 0 ) { |
314 | if ( vol_reset ) | 314 | if ( vol_reset ) |
315 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 315 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
316 | ::close ( fd ); | 316 | ::close ( fd ); |
317 | } | 317 | } |
318 | #endif | 318 | #endif |
319 | } | 319 | } |
320 | 320 | ||
321 | 321 | ||
322 | bool SIMpad::suspend() // Must override because SIMpad does NOT have apm | 322 | bool SIMpad::suspend() // Must override because SIMpad does NOT have apm |
323 | { | 323 | { |
324 | qDebug( "ODevice for SIMpad: suspend()" ); | 324 | qDebug( "ODevice for SIMpad: suspend()" ); |
325 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 325 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
326 | return false; | 326 | return false; |
327 | 327 | ||
328 | bool res = false; | 328 | bool res = false; |
329 | ODevice::sendSuspendmsg(); | ||
329 | 330 | ||
330 | struct timeval tvs, tvn; | 331 | struct timeval tvs, tvn; |
331 | ::gettimeofday ( &tvs, 0 ); | 332 | ::gettimeofday ( &tvs, 0 ); |
332 | 333 | ||
333 | ::sync(); // flush fs caches | 334 | ::sync(); // flush fs caches |
334 | res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) | 335 | res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) |
335 | 336 | ||
336 | return res; | 337 | return res; |
337 | } | 338 | } |
338 | 339 | ||
339 | 340 | ||
340 | bool SIMpad::setSoftSuspend ( bool soft ) | 341 | bool SIMpad::setSoftSuspend ( bool soft ) |
341 | { | 342 | { |
342 | qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); | 343 | qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); |
343 | return false; | 344 | return false; |
344 | } | 345 | } |
345 | 346 | ||
346 | 347 | ||
347 | bool SIMpad::setDisplayStatus ( bool on ) | 348 | bool SIMpad::setDisplayStatus ( bool on ) |
348 | { | 349 | { |
349 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); | 350 | qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); |
350 | 351 | ||
351 | bool res = false; | 352 | bool res = false; |
352 | int fd; | 353 | int fd; |