summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 3edf8e7..fef623a 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1,794 +1,796 @@
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#ifndef QT_NO_SOUND
26#include <linux/soundcard.h> 27#include <linux/soundcard.h>
28#endif
27#include <math.h> 29#include <math.h>
28 30
29#include <qapplication.h> 31#include <qapplication.h>
30 32
31#include <qfile.h> 33#include <qfile.h>
32#include <qtextstream.h> 34#include <qtextstream.h>
33#include <qpe/sound.h> 35#include <qpe/sound.h>
34#include <qpe/resource.h> 36#include <qpe/resource.h>
35#include <qpe/config.h> 37#include <qpe/config.h>
36#include <qpe/qcopenvelope_qws.h> 38#include <qpe/qcopenvelope_qws.h>
37 39
38#include "odevice.h" 40#include "odevice.h"
39 41
40#include <qwindowsystem_qws.h> 42#include <qwindowsystem_qws.h>
41 43
42#ifndef ARRAY_SIZE 44#ifndef ARRAY_SIZE
43#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 45#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
44#endif 46#endif
45 47
46// _IO and friends are only defined in kernel headers ... 48// _IO and friends are only defined in kernel headers ...
47 49
48#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 50#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
49 51
50#define OD_IO(type,number) OD_IOC(0,type,number,0) 52#define OD_IO(type,number) OD_IOC(0,type,number,0)
51#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 53#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
52#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 54#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
53#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 55#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
54 56
55using namespace Opie; 57using namespace Opie;
56 58
57class ODeviceData { 59class ODeviceData {
58public: 60public:
59 QString m_vendorstr; 61 QString m_vendorstr;
60 OVendor m_vendor; 62 OVendor m_vendor;
61 63
62 QString m_modelstr; 64 QString m_modelstr;
63 OModel m_model; 65 OModel m_model;
64 66
65 QString m_systemstr; 67 QString m_systemstr;
66 OSystem m_system; 68 OSystem m_system;
67 69
68 QString m_sysverstr; 70 QString m_sysverstr;
69 71
70 Transformation m_rotation; 72 Transformation m_rotation;
71 ODirection m_direction; 73 ODirection m_direction;
72 74
73 QValueList <ODeviceButton> *m_buttons; 75 QValueList <ODeviceButton> *m_buttons;
74 uint m_holdtime; 76 uint m_holdtime;
75 QStrList *m_cpu_frequencies; 77 QStrList *m_cpu_frequencies;
76}; 78};
77 79
78class iPAQ : public ODevice, public QWSServer::KeyboardFilter { 80class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
79protected: 81protected:
80 virtual void init ( ); 82 virtual void init ( );
81 virtual void initButtons ( ); 83 virtual void initButtons ( );
82 84
83public: 85public:
84 virtual bool setSoftSuspend ( bool soft ); 86 virtual bool setSoftSuspend ( bool soft );
85 87
86 virtual bool setDisplayBrightness ( int b ); 88 virtual bool setDisplayBrightness ( int b );
87 virtual int displayBrightnessResolution ( ) const; 89 virtual int displayBrightnessResolution ( ) const;
88 90
89 virtual void alarmSound ( ); 91 virtual void alarmSound ( );
90 92
91 virtual QValueList <OLed> ledList ( ) const; 93 virtual QValueList <OLed> ledList ( ) const;
92 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 94 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
93 virtual OLedState ledState ( OLed led ) const; 95 virtual OLedState ledState ( OLed led ) const;
94 virtual bool setLedState ( OLed led, OLedState st ); 96 virtual bool setLedState ( OLed led, OLedState st );
95 97
96 virtual bool hasLightSensor ( ) const; 98 virtual bool hasLightSensor ( ) const;
97 virtual int readLightSensor ( ); 99 virtual int readLightSensor ( );
98 virtual int lightSensorResolution ( ) const; 100 virtual int lightSensorResolution ( ) const;
99 101
100protected: 102protected:
101 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 103 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
102 virtual void timerEvent ( QTimerEvent *te ); 104 virtual void timerEvent ( QTimerEvent *te );
103 105
104 int m_power_timer; 106 int m_power_timer;
105 107
106 OLedState m_leds [2]; 108 OLedState m_leds [2];
107}; 109};
108 110
109class Jornada : public ODevice { 111class Jornada : public ODevice {
110protected: 112protected:
111 virtual void init ( ); 113 virtual void init ( );
112 //virtual void initButtons ( ); 114 //virtual void initButtons ( );
113public: 115public:
114 virtual bool setSoftSuspend ( bool soft ); 116 virtual bool setSoftSuspend ( bool soft );
115 virtual bool setDisplayBrightness ( int b ); 117 virtual bool setDisplayBrightness ( int b );
116 virtual int displayBrightnessResolution ( ) const; 118 virtual int displayBrightnessResolution ( ) const;
117 static bool isJornada(); 119 static bool isJornada();
118 120
119}; 121};
120 122
121class Zaurus : public ODevice { 123class Zaurus : public ODevice {
122protected: 124protected:
123 virtual void init ( ); 125 virtual void init ( );
124 virtual void initButtons ( ); 126 virtual void initButtons ( );
125 127
126public: 128public:
127 virtual bool setSoftSuspend ( bool soft ); 129 virtual bool setSoftSuspend ( bool soft );
128 130
129 virtual bool setDisplayBrightness ( int b ); 131 virtual bool setDisplayBrightness ( int b );
130 virtual int displayBrightnessResolution ( ) const; 132 virtual int displayBrightnessResolution ( ) const;
131 133
132 virtual void alarmSound ( ); 134 virtual void alarmSound ( );
133 virtual void keySound ( ); 135 virtual void keySound ( );
134 virtual void touchSound ( ); 136 virtual void touchSound ( );
135 137
136 virtual QValueList <OLed> ledList ( ) const; 138 virtual QValueList <OLed> ledList ( ) const;
137 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 139 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
138 virtual OLedState ledState ( OLed led ) const; 140 virtual OLedState ledState ( OLed led ) const;
139 virtual bool setLedState ( OLed led, OLedState st ); 141 virtual bool setLedState ( OLed led, OLedState st );
140 142
141 static bool isZaurus(); 143 static bool isZaurus();
142 144
143protected: 145protected:
144 virtual void buzzer ( int snd ); 146 virtual void buzzer ( int snd );
145 147
146 OLedState m_leds [1]; 148 OLedState m_leds [1];
147 bool m_embedix; 149 bool m_embedix;
148}; 150};
149 151
150class SIMpad : public ODevice, public QWSServer::KeyboardFilter { 152class SIMpad : public ODevice, public QWSServer::KeyboardFilter {
151protected: 153protected:
152 virtual void init ( ); 154 virtual void init ( );
153 virtual void initButtons ( ); 155 virtual void initButtons ( );
154 156
155public: 157public:
156 virtual bool setSoftSuspend ( bool soft ); 158 virtual bool setSoftSuspend ( bool soft );
157 virtual bool suspend(); 159 virtual bool suspend();
158 160
159 virtual bool setDisplayStatus( bool on ); 161 virtual bool setDisplayStatus( bool on );
160 virtual bool setDisplayBrightness ( int b ); 162 virtual bool setDisplayBrightness ( int b );
161 virtual int displayBrightnessResolution ( ) const; 163 virtual int displayBrightnessResolution ( ) const;
162 164
163 virtual void alarmSound ( ); 165 virtual void alarmSound ( );
164 166
165 virtual QValueList <OLed> ledList ( ) const; 167 virtual QValueList <OLed> ledList ( ) const;
166 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 168 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
167 virtual OLedState ledState ( OLed led ) const; 169 virtual OLedState ledState ( OLed led ) const;
168 virtual bool setLedState ( OLed led, OLedState st ); 170 virtual bool setLedState ( OLed led, OLedState st );
169 171
170protected: 172protected:
171 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 173 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
172 virtual void timerEvent ( QTimerEvent *te ); 174 virtual void timerEvent ( QTimerEvent *te );
173 175
174 int m_power_timer; 176 int m_power_timer;
175 177
176 OLedState m_leds [1]; //FIXME check if really only one 178 OLedState m_leds [1]; //FIXME check if really only one
177}; 179};
178 180
179class Ramses : public ODevice, public QWSServer::KeyboardFilter { 181class Ramses : public ODevice, public QWSServer::KeyboardFilter {
180protected: 182protected:
181 virtual void init ( ); 183 virtual void init ( );
182 184
183public: 185public:
184 virtual bool setSoftSuspend ( bool soft ); 186 virtual bool setSoftSuspend ( bool soft );
185 virtual bool suspend ( ); 187 virtual bool suspend ( );
186 188
187 virtual bool setDisplayStatus( bool on ); 189 virtual bool setDisplayStatus( bool on );
188 virtual bool setDisplayBrightness ( int b ); 190 virtual bool setDisplayBrightness ( int b );
189 virtual int displayBrightnessResolution ( ) const; 191 virtual int displayBrightnessResolution ( ) const;
190 virtual bool setDisplayContrast ( int b ); 192 virtual bool setDisplayContrast ( int b );
191 virtual int displayContrastResolution ( ) const; 193 virtual int displayContrastResolution ( ) const;
192 194
193protected: 195protected:
194 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 196 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
195 virtual void timerEvent ( QTimerEvent *te ); 197 virtual void timerEvent ( QTimerEvent *te );
196 198
197 int m_power_timer; 199 int m_power_timer;
198}; 200};
199 201
200struct i_button { 202struct i_button {
201 uint model; 203 uint model;
202 Qt::Key code; 204 Qt::Key code;
203 char *utext; 205 char *utext;
204 char *pix; 206 char *pix;
205 char *fpressedservice; 207 char *fpressedservice;
206 char *fpressedaction; 208 char *fpressedaction;
207 char *fheldservice; 209 char *fheldservice;
208 char *fheldaction; 210 char *fheldaction;
209} ipaq_buttons [] = { 211} ipaq_buttons [] = {
210 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 212 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
211 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 213 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
212 "devicebuttons/ipaq_calendar", 214 "devicebuttons/ipaq_calendar",
213 "datebook", "nextView()", 215 "datebook", "nextView()",
214 "today", "raise()" }, 216 "today", "raise()" },
215 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 217 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
216 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 218 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
217 "devicebuttons/ipaq_contact", 219 "devicebuttons/ipaq_contact",
218 "addressbook", "raise()", 220 "addressbook", "raise()",
219 "addressbook", "beamBusinessCard()" }, 221 "addressbook", "beamBusinessCard()" },
220 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 222 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
221 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 223 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
222 "devicebuttons/ipaq_menu", 224 "devicebuttons/ipaq_menu",
223 "QPE/TaskBar", "toggleMenu()", 225 "QPE/TaskBar", "toggleMenu()",
224 "QPE/TaskBar", "toggleStartMenu()" }, 226 "QPE/TaskBar", "toggleStartMenu()" },
225 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 227 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
226 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 228 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
227 "devicebuttons/ipaq_mail", 229 "devicebuttons/ipaq_mail",
228 "mail", "raise()", 230 "mail", "raise()",
229 "mail", "newMail()" }, 231 "mail", "newMail()" },
230 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 232 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
231 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 233 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
232 "devicebuttons/ipaq_home", 234 "devicebuttons/ipaq_home",
233 "QPE/Launcher", "home()", 235 "QPE/Launcher", "home()",
234 "buttonsettings", "raise()" }, 236 "buttonsettings", "raise()" },
235 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 237 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
236 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 238 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
237 "devicebuttons/ipaq_record", 239 "devicebuttons/ipaq_record",
238 "QPE/VMemo", "toggleRecord()", 240 "QPE/VMemo", "toggleRecord()",
239 "sound", "raise()" }, 241 "sound", "raise()" },
240}; 242};
241 243
242struct z_button { 244struct z_button {
243 Qt::Key code; 245 Qt::Key code;
244 char *utext; 246 char *utext;
245 char *pix; 247 char *pix;
246 char *fpressedservice; 248 char *fpressedservice;
247 char *fpressedaction; 249 char *fpressedaction;
248 char *fheldservice; 250 char *fheldservice;
249 char *fheldaction; 251 char *fheldaction;
250} z_buttons [] = { 252} z_buttons [] = {
251 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 253 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
252 "devicebuttons/z_calendar", 254 "devicebuttons/z_calendar",
253 "datebook", "nextView()", 255 "datebook", "nextView()",
254 "today", "raise()" }, 256 "today", "raise()" },
255 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 257 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
256 "devicebuttons/z_contact", 258 "devicebuttons/z_contact",
257 "addressbook", "raise()", 259 "addressbook", "raise()",
258 "addressbook", "beamBusinessCard()" }, 260 "addressbook", "beamBusinessCard()" },
259 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 261 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
260 "devicebuttons/z_home", 262 "devicebuttons/z_home",
261 "QPE/Launcher", "home()", 263 "QPE/Launcher", "home()",
262 "buttonsettings", "raise()" }, 264 "buttonsettings", "raise()" },
263 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 265 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
264 "devicebuttons/z_menu", 266 "devicebuttons/z_menu",
265 "QPE/TaskBar", "toggleMenu()", 267 "QPE/TaskBar", "toggleMenu()",
266 "QPE/TaskBar", "toggleStartMenu()" }, 268 "QPE/TaskBar", "toggleStartMenu()" },
267 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 269 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
268 "devicebuttons/z_mail", 270 "devicebuttons/z_mail",
269 "mail", "raise()", 271 "mail", "raise()",
270 "mail", "newMail()" }, 272 "mail", "newMail()" },
271}; 273};
272 274
273struct z_button z_buttons_c700 [] = { 275struct z_button z_buttons_c700 [] = {
274 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 276 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
275 "devicebuttons/z_calendar", 277 "devicebuttons/z_calendar",
276 "datebook", "nextView()", 278 "datebook", "nextView()",
277 "today", "raise()" }, 279 "today", "raise()" },
278 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 280 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
279 "devicebuttons/z_contact", 281 "devicebuttons/z_contact",
280 "addressbook", "raise()", 282 "addressbook", "raise()",
281 "addressbook", "beamBusinessCard()" }, 283 "addressbook", "beamBusinessCard()" },
282 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 284 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
283 "devicebuttons/z_home", 285 "devicebuttons/z_home",
284 "QPE/Launcher", "home()", 286 "QPE/Launcher", "home()",
285 "buttonsettings", "raise()" }, 287 "buttonsettings", "raise()" },
286 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 288 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
287 "devicebuttons/z_menu", 289 "devicebuttons/z_menu",
288 "QPE/TaskBar", "toggleMenu()", 290 "QPE/TaskBar", "toggleMenu()",
289 "QPE/TaskBar", "toggleStartMenu()" }, 291 "QPE/TaskBar", "toggleStartMenu()" },
290 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), 292 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
291 "", 293 "",
292 "QPE/Rotation", "flip()", 294 "QPE/Rotation", "flip()",
293 "QPE/Rotation", "flip()" }, 295 "QPE/Rotation", "flip()" },
294}; 296};
295 297
296struct s_button { 298struct s_button {
297 uint model; 299 uint model;
298 Qt::Key code; 300 Qt::Key code;
299 char *utext; 301 char *utext;
300 char *pix; 302 char *pix;
301 char *fpressedservice; 303 char *fpressedservice;
302 char *fpressedaction; 304 char *fpressedaction;
303 char *fheldservice; 305 char *fheldservice;
304 char *fheldaction; 306 char *fheldaction;
305} simpad_buttons [] = { 307} simpad_buttons [] = {
306 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 308 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
307 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), 309 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"),
308 "devicebuttons/simpad_lower_up", 310 "devicebuttons/simpad_lower_up",
309 "datebook", "nextView()", 311 "datebook", "nextView()",
310 "today", "raise()" }, 312 "today", "raise()" },
311 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 313 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
312 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), 314 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"),
313 "devicebuttons/simpad_lower_down", 315 "devicebuttons/simpad_lower_down",
314 "addressbook", "raise()", 316 "addressbook", "raise()",
315 "addressbook", "beamBusinessCard()" }, 317 "addressbook", "beamBusinessCard()" },
316 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 318 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
317 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), 319 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"),
318 "devicebuttons/simpad_lower_right", 320 "devicebuttons/simpad_lower_right",
319 "QPE/TaskBar", "toggleMenu()", 321 "QPE/TaskBar", "toggleMenu()",
320 "QPE/TaskBar", "toggleStartMenu()" }, 322 "QPE/TaskBar", "toggleStartMenu()" },
321 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 323 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
322 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), 324 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"),
323 "devicebuttons/simpad_lower_left", 325 "devicebuttons/simpad_lower_left",
324 "mail", "raise()", 326 "mail", "raise()",
325 "mail", "newMail()" }, 327 "mail", "newMail()" },
326 328
327 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 329 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
328 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), 330 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"),
329 "devicebuttons/simpad_upper_up", 331 "devicebuttons/simpad_upper_up",
330 "QPE/Launcher", "home()", 332 "QPE/Launcher", "home()",
331 "buttonsettings", "raise()" }, 333 "buttonsettings", "raise()" },
332 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 334 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
333 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), 335 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"),
334 "devicebuttons/simpad_upper_down", 336 "devicebuttons/simpad_upper_down",
335 "addressbook", "raise()", 337 "addressbook", "raise()",
336 "addressbook", "beamBusinessCard()" }, 338 "addressbook", "beamBusinessCard()" },
337 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 339 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
338 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), 340 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"),
339 "devicebuttons/simpad_upper_right", 341 "devicebuttons/simpad_upper_right",
340 "QPE/TaskBar", "toggleMenu()", 342 "QPE/TaskBar", "toggleMenu()",
341 "QPE/TaskBar", "toggleStartMenu()" }, 343 "QPE/TaskBar", "toggleStartMenu()" },
342 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 344 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
343 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), 345 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"),
344 "devicebuttons/simpad_upper_left", 346 "devicebuttons/simpad_upper_left",
345 "QPE/Rotation", "flip()", 347 "QPE/Rotation", "flip()",
346 "QPE/Rotation", "flip()" }, 348 "QPE/Rotation", "flip()" },
347 /* 349 /*
348 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 350 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
349 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), 351 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
350 "devicebuttons/simpad_lower_upper", 352 "devicebuttons/simpad_lower_upper",
351 "QPE/Launcher", "home()", 353 "QPE/Launcher", "home()",
352 "buttonsettings", "raise()" }, 354 "buttonsettings", "raise()" },
353 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 355 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
354 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), 356 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
355 "devicebuttons/simpad_upper_lower", 357 "devicebuttons/simpad_upper_lower",
356 "QPE/Launcher", "home()", 358 "QPE/Launcher", "home()",
357 "buttonsettings", "raise()" }, 359 "buttonsettings", "raise()" },
358 */ 360 */
359}; 361};
360 362
361struct r_button { 363struct r_button {
362 uint model; 364 uint model;
363 Qt::Key code; 365 Qt::Key code;
364 char *utext; 366 char *utext;
365 char *pix; 367 char *pix;
366 char *fpressedservice; 368 char *fpressedservice;
367 char *fpressedaction; 369 char *fpressedaction;
368 char *fheldservice; 370 char *fheldservice;
369 char *fheldaction; 371 char *fheldaction;
370} ramses_buttons [] = { 372} ramses_buttons [] = {
371 { Model_Ramses_MNCI, 373 { Model_Ramses_MNCI,
372 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 374 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
373 "devicebuttons/z_menu", 375 "devicebuttons/z_menu",
374 "QPE/TaskBar", "toggleMenu()", 376 "QPE/TaskBar", "toggleMenu()",
375 "QPE/TaskBar", "toggleStartMenu()" }, 377 "QPE/TaskBar", "toggleStartMenu()" },
376 { Model_Ramses_MNCI, 378 { Model_Ramses_MNCI,
377 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 379 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
378 "devicebuttons/ipaq_home", 380 "devicebuttons/ipaq_home",
379 "QPE/Launcher", "home()", 381 "QPE/Launcher", "home()",
380 "buttonsettings", "raise()" }, 382 "buttonsettings", "raise()" },
381}; 383};
382 384
383class Yopy : public ODevice { 385class Yopy : public ODevice {
384protected: 386protected:
385 virtual void init ( ); 387 virtual void init ( );
386 virtual void initButtons ( ); 388 virtual void initButtons ( );
387 389
388public: 390public:
389 virtual bool suspend ( ); 391 virtual bool suspend ( );
390 392
391 virtual bool setDisplayBrightness ( int b ); 393 virtual bool setDisplayBrightness ( int b );
392 virtual int displayBrightnessResolution ( ) const; 394 virtual int displayBrightnessResolution ( ) const;
393 395
394 static bool isYopy ( ); 396 static bool isYopy ( );
395}; 397};
396 398
397struct yopy_button { 399struct yopy_button {
398 Qt::Key code; 400 Qt::Key code;
399 char *utext; 401 char *utext;
400 char *pix; 402 char *pix;
401 char *fpressedservice; 403 char *fpressedservice;
402 char *fpressedaction; 404 char *fpressedaction;
403 char *fheldservice; 405 char *fheldservice;
404 char *fheldaction; 406 char *fheldaction;
405} yopy_buttons [] = { 407} yopy_buttons [] = {
406 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"), 408 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"),
407 "devicebuttons/yopy_action", 409 "devicebuttons/yopy_action",
408 "datebook", "nextView()", 410 "datebook", "nextView()",
409 "today", "raise()" }, 411 "today", "raise()" },
410 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"), 412 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"),
411 "devicebuttons/yopy_ok", 413 "devicebuttons/yopy_ok",
412 "addressbook", "raise()", 414 "addressbook", "raise()",
413 "addressbook", "beamBusinessCard()" }, 415 "addressbook", "beamBusinessCard()" },
414 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "End Button"), 416 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "End Button"),
415 "devicebuttons/yopy_end", 417 "devicebuttons/yopy_end",
416 "QPE/Launcher", "home()", 418 "QPE/Launcher", "home()",
417 "buttonsettings", "raise()" }, 419 "buttonsettings", "raise()" },
418}; 420};
419 421
420static QCString makeChannel ( const char *str ) 422static QCString makeChannel ( const char *str )
421{ 423{
422 if ( str && !::strchr ( str, '/' )) 424 if ( str && !::strchr ( str, '/' ))
423 return QCString ( "QPE/Application/" ) + str; 425 return QCString ( "QPE/Application/" ) + str;
424 else 426 else
425 return str; 427 return str;
426} 428}
427 429
428static inline bool isQWS() 430static inline bool isQWS()
429{ 431{
430 return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 432 return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
431} 433}
432 434
433ODevice *ODevice::inst ( ) 435ODevice *ODevice::inst ( )
434{ 436{
435 static ODevice *dev = 0; 437 static ODevice *dev = 0;
436 438
437 if ( !dev ) { 439 if ( !dev ) {
438 if ( QFile::exists ( "/proc/hal/model" )) 440 if ( QFile::exists ( "/proc/hal/model" ))
439 dev = new iPAQ ( ); 441 dev = new iPAQ ( );
440 else if ( Zaurus::isZaurus() ) 442 else if ( Zaurus::isZaurus() )
441 dev = new Zaurus ( ); 443 dev = new Zaurus ( );
442 else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) 444 else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" ))
443 dev = new SIMpad ( ); 445 dev = new SIMpad ( );
444 else if ( QFile::exists ( "/proc/sys/board/name" )) 446 else if ( QFile::exists ( "/proc/sys/board/name" ))
445 dev = new Ramses ( ); 447 dev = new Ramses ( );
446 else if ( Yopy::isYopy() ) 448 else if ( Yopy::isYopy() )
447 dev = new Yopy ( ); 449 dev = new Yopy ( );
448 else if ( Jornada::isJornada() ) 450 else if ( Jornada::isJornada() )
449 dev = new Jornada ( ); 451 dev = new Jornada ( );
450 else 452 else
451 dev = new ODevice ( ); 453 dev = new ODevice ( );
452 dev-> init ( ); 454 dev-> init ( );
453 } 455 }
454 return dev; 456 return dev;
455} 457}
456 458
457 459
458/************************************************** 460/**************************************************
459 * 461 *
460 * common 462 * common
461 * 463 *
462 **************************************************/ 464 **************************************************/
463 465
464 466
465ODevice::ODevice ( ) 467ODevice::ODevice ( )
466{ 468{
467 d = new ODeviceData; 469 d = new ODeviceData;
468 470
469 d-> m_modelstr = "Unknown"; 471 d-> m_modelstr = "Unknown";
470 d-> m_model = Model_Unknown; 472 d-> m_model = Model_Unknown;
471 d-> m_vendorstr = "Unknown"; 473 d-> m_vendorstr = "Unknown";
472 d-> m_vendor = Vendor_Unknown; 474 d-> m_vendor = Vendor_Unknown;
473 d-> m_systemstr = "Unknown"; 475 d-> m_systemstr = "Unknown";
474 d-> m_system = System_Unknown; 476 d-> m_system = System_Unknown;
475 d-> m_sysverstr = "0.0"; 477 d-> m_sysverstr = "0.0";
476 d-> m_rotation = Rot0; 478 d-> m_rotation = Rot0;
477 d-> m_direction = CW; 479 d-> m_direction = CW;
478 480
479 d-> m_holdtime = 1000; // 1000ms 481 d-> m_holdtime = 1000; // 1000ms
480 d-> m_buttons = 0; 482 d-> m_buttons = 0;
481 d-> m_cpu_frequencies = new QStrList; 483 d-> m_cpu_frequencies = new QStrList;
482} 484}
483 485
484void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 486void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
485{ 487{
486 if ( msg == "deviceButtonMappingChanged()" ) { 488 if ( msg == "deviceButtonMappingChanged()" ) {
487 reloadButtonMapping ( ); 489 reloadButtonMapping ( );
488 } 490 }
489} 491}
490 492
491void ODevice::init ( ) 493void ODevice::init ( )
492{ 494{
493} 495}
494 496
495/** 497/**
496 * This method initialises the button mapping 498 * This method initialises the button mapping
497 */ 499 */
498void ODevice::initButtons ( ) 500void ODevice::initButtons ( )
499{ 501{
500 if ( d-> m_buttons ) 502 if ( d-> m_buttons )
501 return; 503 return;
502 504
503 // Simulation uses iPAQ 3660 device buttons 505 // Simulation uses iPAQ 3660 device buttons
504 506
505 qDebug ( "init Buttons" ); 507 qDebug ( "init Buttons" );
506 d-> m_buttons = new QValueList <ODeviceButton>; 508 d-> m_buttons = new QValueList <ODeviceButton>;
507 509
508 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 510 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
509 i_button *ib = ipaq_buttons + i; 511 i_button *ib = ipaq_buttons + i;
510 ODeviceButton b; 512 ODeviceButton b;
511 513
512 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 514 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
513 b. setKeycode ( ib-> code ); 515 b. setKeycode ( ib-> code );
514 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 516 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
515 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 517 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
516 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 518 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
517 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 519 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
518 d-> m_buttons-> append ( b ); 520 d-> m_buttons-> append ( b );
519 } 521 }
520 } 522 }
521 reloadButtonMapping ( ); 523 reloadButtonMapping ( );
522 524
523 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 525 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
524 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 526 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
525} 527}
526 528
527ODevice::~ODevice ( ) 529ODevice::~ODevice ( )
528{ 530{
529// we leak m_devicebuttons and m_cpu_frequency 531// we leak m_devicebuttons and m_cpu_frequency
530// but it's a singleton and it is not so importantant 532// but it's a singleton and it is not so importantant
531// -zecke 533// -zecke
532 delete d; 534 delete d;
533} 535}
534 536
535bool ODevice::setSoftSuspend ( bool /*soft*/ ) 537bool ODevice::setSoftSuspend ( bool /*soft*/ )
536{ 538{
537 return false; 539 return false;
538} 540}
539 541
540//#include <linux/apm_bios.h> 542//#include <linux/apm_bios.h>
541 543
542#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 544#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
543 545
544/** 546/**
545 * This method will try to suspend the device 547 * This method will try to suspend the device
546 * It only works if the user is the QWS Server and the apm application 548 * It only works if the user is the QWS Server and the apm application
547 * is installed. 549 * is installed.
548 * It tries to suspend and then waits some time cause some distributions 550 * It tries to suspend and then waits some time cause some distributions
549 * do have asynchronus apm implementations. 551 * do have asynchronus apm implementations.
550 * This method will either fail and return false or it'll suspend the 552 * This method will either fail and return false or it'll suspend the
551 * device and return once the device got woken up 553 * device and return once the device got woken up
552 * 554 *
553 * @return if the device got suspended 555 * @return if the device got suspended
554 */ 556 */
555bool ODevice::suspend ( ) 557bool ODevice::suspend ( )
556{ 558{
557 qDebug("ODevice::suspend"); 559 qDebug("ODevice::suspend");
558 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 560 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
559 return false; 561 return false;
560 562
561 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 563 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
562 return false; 564 return false;
563 565
564 bool res = false; 566 bool res = false;
565 567
566 struct timeval tvs, tvn; 568 struct timeval tvs, tvn;
567 ::gettimeofday ( &tvs, 0 ); 569 ::gettimeofday ( &tvs, 0 );
568 570
569 ::sync ( ); // flush fs caches 571 ::sync ( ); // flush fs caches
570 res = ( ::system ( "apm --suspend" ) == 0 ); 572 res = ( ::system ( "apm --suspend" ) == 0 );
571 573
572 // This is needed because the iPAQ apm implementation is asynchronous and we 574 // This is needed because the iPAQ apm implementation is asynchronous and we
573 // can not be sure when exactly the device is really suspended 575 // can not be sure when exactly the device is really suspended
574 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 576 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
575 577
576 if ( res ) { 578 if ( res ) {
577 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 579 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
578 ::usleep ( 200 * 1000 ); 580 ::usleep ( 200 * 1000 );
579 ::gettimeofday ( &tvn, 0 ); 581 ::gettimeofday ( &tvn, 0 );
580 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); 582 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
581 } 583 }
582 584
583 return res; 585 return res;
584} 586}
585 587
586//#include <linux/fb.h> better not rely on kernel headers in userspace ... 588//#include <linux/fb.h> better not rely on kernel headers in userspace ...
587 589
588#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 590#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
589 591
590/* VESA Blanking Levels */ 592/* VESA Blanking Levels */
591#define VESA_NO_BLANKING 0 593#define VESA_NO_BLANKING 0
592#define VESA_VSYNC_SUSPEND 1 594#define VESA_VSYNC_SUSPEND 1
593#define VESA_HSYNC_SUSPEND 2 595#define VESA_HSYNC_SUSPEND 2
594#define VESA_POWERDOWN 3 596#define VESA_POWERDOWN 3
595 597
596/** 598/**
597 * This sets the display on or off 599 * This sets the display on or off
598 */ 600 */
599bool ODevice::setDisplayStatus ( bool on ) 601bool ODevice::setDisplayStatus ( bool on )
600{ 602{
601 qDebug("ODevice::setDisplayStatus(%d)", on); 603 qDebug("ODevice::setDisplayStatus(%d)", on);
602 604
603 if ( d-> m_model == Model_Unknown ) 605 if ( d-> m_model == Model_Unknown )
604 return false; 606 return false;
605 607
606 bool res = false; 608 bool res = false;
607 int fd; 609 int fd;
608 610
609 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 611 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
610 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 612 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
611 ::close ( fd ); 613 ::close ( fd );
612 } 614 }
613 return res; 615 return res;
614} 616}
615 617
616/** 618/**
617 * This sets the display brightness 619 * This sets the display brightness
618 * 620 *
619 * @param p The brightness to be set on a scale from 0 to 255 621 * @param p The brightness to be set on a scale from 0 to 255
620 * @return success or failure 622 * @return success or failure
621 */ 623 */
622bool ODevice::setDisplayBrightness ( int p) 624bool ODevice::setDisplayBrightness ( int p)
623{ 625{
624 Q_UNUSED( p ) 626 Q_UNUSED( p )
625 return false; 627 return false;
626} 628}
627 629
628/** 630/**
629 * @return returns the number of steppings on the brightness slider 631 * @return returns the number of steppings on the brightness slider
630 * in the Light-'n-Power settings. 632 * in the Light-'n-Power settings.
631 */ 633 */
632int ODevice::displayBrightnessResolution ( ) const 634int ODevice::displayBrightnessResolution ( ) const
633{ 635{
634 return 16; 636 return 16;
635} 637}
636 638
637/** 639/**
638 * This sets the display contrast 640 * This sets the display contrast
639 * @param p The contrast to be set on a scale from 0 to 255 641 * @param p The contrast to be set on a scale from 0 to 255
640 * @return success or failure 642 * @return success or failure
641 */ 643 */
642bool ODevice::setDisplayContrast ( int p) 644bool ODevice::setDisplayContrast ( int p)
643{ 645{
644 Q_UNUSED( p ) 646 Q_UNUSED( p )
645 return false; 647 return false;
646} 648}
647 649
648/** 650/**
649 * @return return the max value for the brightness settings slider 651 * @return return the max value for the brightness settings slider
650 * or 0 if the device doesn't support setting of a contrast 652 * or 0 if the device doesn't support setting of a contrast
651 */ 653 */
652int ODevice::displayContrastResolution ( ) const 654int ODevice::displayContrastResolution ( ) const
653{ 655{
654 return 0; 656 return 0;
655} 657}
656 658
657/** 659/**
658 * This returns the vendor as string 660 * This returns the vendor as string
659 * @return Vendor as QString 661 * @return Vendor as QString
660 */ 662 */
661QString ODevice::vendorString ( ) const 663QString ODevice::vendorString ( ) const
662{ 664{
663 return d-> m_vendorstr; 665 return d-> m_vendorstr;
664} 666}
665 667
666/** 668/**
667 * This returns the vendor as one of the values of OVendor 669 * This returns the vendor as one of the values of OVendor
668 * @return OVendor 670 * @return OVendor
669 */ 671 */
670OVendor ODevice::vendor ( ) const 672OVendor ODevice::vendor ( ) const
671{ 673{
672 return d-> m_vendor; 674 return d-> m_vendor;
673} 675}
674 676
675/** 677/**
676 * This returns the model as a string 678 * This returns the model as a string
677 * @return A string representing the model 679 * @return A string representing the model
678 */ 680 */
679QString ODevice::modelString ( ) const 681QString ODevice::modelString ( ) const
680{ 682{
681 return d-> m_modelstr; 683 return d-> m_modelstr;
682} 684}
683 685
684/** 686/**
685 * This does return the OModel used 687 * This does return the OModel used
686 */ 688 */
687OModel ODevice::model ( ) const 689OModel ODevice::model ( ) const
688{ 690{
689 return d-> m_model; 691 return d-> m_model;
690} 692}
691 693
692/** 694/**
693 * This does return the systen name 695 * This does return the systen name
694 */ 696 */
695QString ODevice::systemString ( ) const 697QString ODevice::systemString ( ) const
696{ 698{
697 return d-> m_systemstr; 699 return d-> m_systemstr;
698} 700}
699 701
700/** 702/**
701 * Return System as OSystem value 703 * Return System as OSystem value
702 */ 704 */
703OSystem ODevice::system ( ) const 705OSystem ODevice::system ( ) const
704{ 706{
705 return d-> m_system; 707 return d-> m_system;
706} 708}
707 709
708/** 710/**
709 * @return the version string of the base system 711 * @return the version string of the base system
710 */ 712 */
711QString ODevice::systemVersionString ( ) const 713QString ODevice::systemVersionString ( ) const
712{ 714{
713 return d-> m_sysverstr; 715 return d-> m_sysverstr;
714} 716}
715 717
716/** 718/**
717 * @return the current Transformation 719 * @return the current Transformation
718 */ 720 */
719Transformation ODevice::rotation ( ) const 721Transformation ODevice::rotation ( ) const
720{ 722{
721 return d-> m_rotation; 723 return d-> m_rotation;
722} 724}
723 725
724/** 726/**
725 * @return the current rotation direction 727 * @return the current rotation direction
726 */ 728 */
727ODirection ODevice::direction ( ) const 729ODirection ODevice::direction ( ) const
728{ 730{
729 return d-> m_direction; 731 return d-> m_direction;
730} 732}
731 733
732/** 734/**
733 * This plays an alarmSound 735 * This plays an alarmSound
734 */ 736 */
735void ODevice::alarmSound ( ) 737void ODevice::alarmSound ( )
736{ 738{
737#ifndef QT_NO_SOUND 739#ifndef QT_NO_SOUND
738 static Sound snd ( "alarm" ); 740 static Sound snd ( "alarm" );
739 741
740 if ( snd. isFinished ( )) 742 if ( snd. isFinished ( ))
741 snd. play ( ); 743 snd. play ( );
742#endif 744#endif
743} 745}
744 746
745/** 747/**
746 * This plays a key sound 748 * This plays a key sound
747 */ 749 */
748void ODevice::keySound ( ) 750void ODevice::keySound ( )
749{ 751{
750#ifndef QT_NO_SOUND 752#ifndef QT_NO_SOUND
751 static Sound snd ( "keysound" ); 753 static Sound snd ( "keysound" );
752 754
753 if ( snd. isFinished ( )) 755 if ( snd. isFinished ( ))
754 snd. play ( ); 756 snd. play ( );
755#endif 757#endif
756} 758}
757 759
758/** 760/**
759 * This plays a touch sound 761 * This plays a touch sound
760 */ 762 */
761void ODevice::touchSound ( ) 763void ODevice::touchSound ( )
762{ 764{
763#ifndef QT_NO_SOUND 765#ifndef QT_NO_SOUND
764 static Sound snd ( "touchsound" ); 766 static Sound snd ( "touchsound" );
765 767
766 if ( snd. isFinished ( )) 768 if ( snd. isFinished ( ))
767 snd. play ( ); 769 snd. play ( );
768#endif 770#endif
769} 771}
770 772
771/** 773/**
772 * This method will return a list of leds 774 * This method will return a list of leds
773 * available on this device 775 * available on this device
774 * @return a list of LEDs. 776 * @return a list of LEDs.
775 */ 777 */
776QValueList <OLed> ODevice::ledList ( ) const 778QValueList <OLed> ODevice::ledList ( ) const
777{ 779{
778 return QValueList <OLed> ( ); 780 return QValueList <OLed> ( );
779} 781}
780 782
781/** 783/**
782 * This does return the state of the LEDs 784 * This does return the state of the LEDs
783 */ 785 */
784QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const 786QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const
785{ 787{
786 return QValueList <OLedState> ( ); 788 return QValueList <OLedState> ( );
787} 789}
788 790
789/** 791/**
790 * @return the state for a given OLed 792 * @return the state for a given OLed
791 */ 793 */
792OLedState ODevice::ledState ( OLed /*which*/ ) const 794OLedState ODevice::ledState ( OLed /*which*/ ) const
793{ 795{
794 return Led_Off; 796 return Led_Off;