author | mickeyl <mickeyl> | 2004-01-13 18:32:19 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-13 18:32:19 (UTC) |
commit | 061ccf5b9d384b1f24d203e96f1f04ccf1dcf133 (patch) (unidiff) | |
tree | ec1fc064f001edba92e58116cdc35fc909b5cdd6 /libopie2/opiecore/device/odevice_simpad.cpp | |
parent | 59f7fa0a480bf921a67ad42fc1fe018b1be44192 (diff) | |
download | opie-061ccf5b9d384b1f24d203e96f1f04ccf1dcf133.zip opie-061ccf5b9d384b1f24d203e96f1f04ccf1dcf133.tar.gz opie-061ccf5b9d384b1f24d203e96f1f04ccf1dcf133.tar.bz2 |
- rewrite device detection
- cleanup
- split odevice stuff into header and cpp files
- Note for next buildsystem: Don't link all header files but distinguish
between public and private headers, e.g. odevice.h is public while
odevice_ipaq.h is private.
Diffstat (limited to 'libopie2/opiecore/device/odevice_simpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 56 |
1 files changed, 2 insertions, 54 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 82dce10..a2cd419 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -1,158 +1,106 @@ | |||
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.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> |
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 | #ifndef ARRAY_SIZE | ||
57 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
58 | #endif | ||
59 | |||
60 | // _IO and friends are only defined in kernel headers ... | ||
61 | |||
62 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | ||
63 | |||
64 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | ||
65 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | ||
66 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | ||
67 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | ||
68 | |||
69 | using namespace Opie; | 56 | using namespace Opie; |
70 | 57 | ||
71 | class SIMpad : public ODevice, public QWSServer::KeyboardFilter | 58 | struct s_button simpad_buttons [] = { |
72 | { | ||
73 | protected: | ||
74 | virtual void init(); | ||
75 | virtual void initButtons(); | ||
76 | |||
77 | public: | ||
78 | virtual bool setSoftSuspend( bool soft ); | ||
79 | virtual bool suspend(); | ||
80 | |||
81 | virtual bool setDisplayStatus( bool on ); | ||
82 | virtual bool setDisplayBrightness( int b ); | ||
83 | virtual int displayBrightnessResolution() const; | ||
84 | |||
85 | virtual void alarmSound(); | ||
86 | |||
87 | virtual QValueList <OLed> ledList() const; | ||
88 | virtual QValueList <OLedState> ledStateList( OLed led ) const; | ||
89 | virtual OLedState ledState( OLed led ) const; | ||
90 | virtual bool setLedState( OLed led, OLedState st ); | ||
91 | |||
92 | protected: | ||
93 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | ||
94 | virtual void timerEvent( QTimerEvent *te ); | ||
95 | |||
96 | int m_power_timer; | ||
97 | |||
98 | OLedState m_leds [1]; | ||
99 | }; | ||
100 | |||
101 | struct s_button { | ||
102 | uint model; | ||
103 | Qt::Key code; | ||
104 | char *utext; | ||
105 | char *pix; | ||
106 | char *fpressedservice; | ||
107 | char *fpressedaction; | ||
108 | char *fheldservice; | ||
109 | char *fheldaction; | ||
110 | } simpad_buttons [] = { | ||
111 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 59 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
112 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), | 60 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), |
113 | "devicebuttons/simpad_lower_up", | 61 | "devicebuttons/simpad_lower_up", |
114 | "datebook", "nextView()", | 62 | "datebook", "nextView()", |
115 | "today", "raise()" }, | 63 | "today", "raise()" }, |
116 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 64 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
117 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), | 65 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), |
118 | "devicebuttons/simpad_lower_down", | 66 | "devicebuttons/simpad_lower_down", |
119 | "addressbook", "raise()", | 67 | "addressbook", "raise()", |
120 | "addressbook", "beamBusinessCard()" }, | 68 | "addressbook", "beamBusinessCard()" }, |
121 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 69 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
122 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), | 70 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), |
123 | "devicebuttons/simpad_lower_right", | 71 | "devicebuttons/simpad_lower_right", |
124 | "QPE/TaskBar", "toggleMenu()", | 72 | "QPE/TaskBar", "toggleMenu()", |
125 | "QPE/TaskBar", "toggleStartMenu()" }, | 73 | "QPE/TaskBar", "toggleStartMenu()" }, |
126 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 74 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
127 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), | 75 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), |
128 | "devicebuttons/simpad_lower_left", | 76 | "devicebuttons/simpad_lower_left", |
129 | "mail", "raise()", | 77 | "mail", "raise()", |
130 | "mail", "newMail()" }, | 78 | "mail", "newMail()" }, |
131 | 79 | ||
132 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 80 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
133 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), | 81 | Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), |
134 | "devicebuttons/simpad_upper_up", | 82 | "devicebuttons/simpad_upper_up", |
135 | "QPE/Launcher", "home()", | 83 | "QPE/Launcher", "home()", |
136 | "buttonsettings", "raise()" }, | 84 | "buttonsettings", "raise()" }, |
137 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 85 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
138 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), | 86 | Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), |
139 | "devicebuttons/simpad_upper_down", | 87 | "devicebuttons/simpad_upper_down", |
140 | "addressbook", "raise()", | 88 | "addressbook", "raise()", |
141 | "addressbook", "beamBusinessCard()" }, | 89 | "addressbook", "beamBusinessCard()" }, |
142 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 90 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
143 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), | 91 | Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), |
144 | "devicebuttons/simpad_upper_right", | 92 | "devicebuttons/simpad_upper_right", |
145 | "QPE/TaskBar", "toggleMenu()", | 93 | "QPE/TaskBar", "toggleMenu()", |
146 | "QPE/TaskBar", "toggleStartMenu()" }, | 94 | "QPE/TaskBar", "toggleStartMenu()" }, |
147 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 95 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
148 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), | 96 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), |
149 | "devicebuttons/simpad_upper_left", | 97 | "devicebuttons/simpad_upper_left", |
150 | "QPE/Rotation", "flip()", | 98 | "QPE/Rotation", "flip()", |
151 | "QPE/Rotation", "flip()" }, | 99 | "QPE/Rotation", "flip()" }, |
152 | /* | 100 | /* |
153 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 101 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
154 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 102 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
155 | "devicebuttons/simpad_lower_upper", | 103 | "devicebuttons/simpad_lower_upper", |
156 | "QPE/Launcher", "home()", | 104 | "QPE/Launcher", "home()", |
157 | "buttonsettings", "raise()" }, | 105 | "buttonsettings", "raise()" }, |
158 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 106 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |