summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice.h b/libopie2/opiecore/device/odevice.h
index f4b3e0e..6f0d036 100644
--- a/libopie2/opiecore/device/odevice.h
+++ b/libopie2/opiecore/device/odevice.h
@@ -1,360 +1,361 @@
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#ifndef ODEVICE_H_ 30#ifndef ODEVICE_H_
31#define ODEVICE_H_ 31#define ODEVICE_H_
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/odevicebutton.h> 34#include <opie2/odevicebutton.h>
35#include <qpe/qpeapplication.h> /* for Transformation enum.. */ 35#include <qpe/qpeapplication.h> /* for Transformation enum.. */
36 36
37/* QT */ 37/* QT */
38#include <qnamespace.h> 38#include <qnamespace.h>
39#include <qobject.h> 39#include <qobject.h>
40#include <qstring.h> 40#include <qstring.h>
41 41
42 42
43#include <qstrlist.h> 43#include <qstrlist.h>
44#include <qwindowsystem_qws.h> 44#include <qwindowsystem_qws.h>
45 45
46 46
47class Sound; 47class Sound;
48 48
49namespace Opie{ 49namespace Opie{
50namespace Core{ 50namespace Core{
51 51
52class ODeviceData; 52class ODeviceData;
53/** 53/**
54 * The available devices 54 * The available devices
55 */ 55 */
56enum OModel { 56enum OModel {
57 Model_Unknown, // = 0 57 Model_Unknown, // = 0
58 58
59 Model_Series_Mask = 0xff000000, 59 Model_Series_Mask = 0xff000000,
60 60
61 Model_iPAQ = ( 1 << 24 ), 61 Model_iPAQ = ( 1 << 24 ),
62 62
63 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), 63 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), 64 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), 65 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), 66 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), 67 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), 68 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ), 69 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000020 ),
70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ), 70 Model_iPAQ_H22xx = ( Model_iPAQ | 0x000040 ),
71 71
72 Model_Jornada = ( 6 << 24 ), 72 Model_Jornada = ( 6 << 24 ),
73 Model_Jornada_56x = ( Model_Jornada | 0x000001 ), 73 Model_Jornada_56x = ( Model_Jornada | 0x000001 ),
74 74
75 Model_Zaurus = ( 2 << 24 ), 75 Model_Zaurus = ( 2 << 24 ),
76 76
77 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), 77 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
78 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), 78 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
79 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), 79 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
80 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), 80 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
81 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ), 81 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ),
82 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ), 82 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x000006 ),
83 83
84 Model_SIMpad = ( 3 << 24 ), 84 Model_SIMpad = ( 3 << 24 ),
85 85
86 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), 86 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
87 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), 87 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
88 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), 88 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
89 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), 89 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
90 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), 90 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
91 91
92 Model_Ramses = ( 4 << 24 ), 92 Model_Ramses = ( 4 << 24 ),
93 93
94 Model_Ramses_All = ( Model_Ramses | 0xffffff ), 94 Model_Ramses_All = ( Model_Ramses | 0xffffff ),
95 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), 95 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
96 Model_Ramses_MNCIRX = ( Model_Ramses | 0x000002 ),
96 97
97 Model_Yopy = ( 5 << 24 ), 98 Model_Yopy = ( 5 << 24 ),
98 99
99 Model_Yopy_All = ( Model_Yopy | 0xffffff ), 100 Model_Yopy_All = ( Model_Yopy | 0xffffff ),
100 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), 101 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ),
101 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), 102 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ),
102 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), 103 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ),
103 104
104 Model_Beagle = ( 6 << 24 ), 105 Model_Beagle = ( 6 << 24 ),
105 106
106 Model_Beagle_All = ( Model_Beagle | 0xffffff ), 107 Model_Beagle_All = ( Model_Beagle | 0xffffff ),
107 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ), 108 Model_Beagle_PA100 = ( Model_Beagle | 0x000001 ),
108 109
109}; 110};
110 111
111/** 112/**
112 * The vendor of the device 113 * The vendor of the device
113 */ 114 */
114enum OVendor { 115enum OVendor {
115 Vendor_Unknown, 116 Vendor_Unknown,
116 117
117 Vendor_HP, 118 Vendor_HP,
118 Vendor_Sharp, 119 Vendor_Sharp,
119 Vendor_SIEMENS, 120 Vendor_SIEMENS,
120 Vendor_MundN, 121 Vendor_MundN,
121 Vendor_GMate, 122 Vendor_GMate,
122 Vendor_MasterIA, 123 Vendor_MasterIA,
123}; 124};
124 125
125/** 126/**
126 * The System used 127 * The System used
127 */ 128 */
128enum OSystem { 129enum OSystem {
129 System_Unknown, 130 System_Unknown,
130 131
131 System_Familiar, 132 System_Familiar,
132 System_Zaurus, 133 System_Zaurus,
133 System_OpenZaurus, 134 System_OpenZaurus,
134 System_Linupy, 135 System_Linupy,
135 System_OpenEmbedded, 136 System_OpenEmbedded,
136}; 137};
137 138
138typedef struct { 139typedef struct {
139 OSystem system; 140 OSystem system;
140 char* sysstr; 141 char* sysstr;
141 char* sysvfile; 142 char* sysvfile;
142} ODistribution; 143} ODistribution;
143 144
144extern ODistribution distributions[]; 145extern ODistribution distributions[];
145 146
146 147
147enum OLedState { 148enum OLedState {
148 Led_Off, 149 Led_Off,
149 Led_On, 150 Led_On,
150 Led_BlinkSlow, 151 Led_BlinkSlow,
151 Led_BlinkFast 152 Led_BlinkFast
152}; 153};
153 154
154enum OLed { 155enum OLed {
155 Led_Mail, 156 Led_Mail,
156 Led_Power, 157 Led_Power,
157 Led_BlueTooth 158 Led_BlueTooth
158}; 159};
159 160
160enum OHardKey { 161enum OHardKey {
161 HardKey_Datebook = Qt::Key_F9, 162 HardKey_Datebook = Qt::Key_F9,
162 HardKey_Contacts = Qt::Key_F10, 163 HardKey_Contacts = Qt::Key_F10,
163 HardKey_Menu = Qt::Key_F11, 164 HardKey_Menu = Qt::Key_F11,
164 HardKey_Home = Qt::Key_F12, 165 HardKey_Home = Qt::Key_F12,
165 HardKey_Mail = Qt::Key_F13, 166 HardKey_Mail = Qt::Key_F13,
166 HardKey_Record = Qt::Key_F24, 167 HardKey_Record = Qt::Key_F24,
167 HardKey_Suspend = Qt::Key_F34, 168 HardKey_Suspend = Qt::Key_F34,
168 HardKey_Backlight = Qt::Key_F35, 169 HardKey_Backlight = Qt::Key_F35,
169 HardKey_Action = Qt::Key_F10, 170 HardKey_Action = Qt::Key_F10,
170 HardKey_OK = Qt::Key_F11, 171 HardKey_OK = Qt::Key_F11,
171 HardKey_End = Qt::Key_F12, 172 HardKey_End = Qt::Key_F12,
172}; 173};
173 174
174enum ODirection { 175enum ODirection {
175 CW = 0, 176 CW = 0,
176 CCW = 1, 177 CCW = 1,
177 Flip = 2, 178 Flip = 2,
178}; 179};
179 180
180enum OHingeStatus { 181enum OHingeStatus {
181 CASE_CLOSED = 3, 182 CASE_CLOSED = 3,
182 CASE_PORTRAIT = 2, 183 CASE_PORTRAIT = 2,
183 CASE_LANDSCAPE = 0, 184 CASE_LANDSCAPE = 0,
184 CASE_UNKNOWN = 1, 185 CASE_UNKNOWN = 1,
185}; 186};
186 187
187/* default button for qvfb or such 188/* default button for qvfb or such
188 * see odevice.cpp for details. 189 * see odevice.cpp for details.
189 * hint: manage a user defined button for qvfb? 190 * hint: manage a user defined button for qvfb?
190 * alwin 191 * alwin
191 */ 192 */
192struct default_button { 193struct default_button {
193 Qt::Key code; 194 Qt::Key code;
194 char *utext; 195 char *utext;
195 char *pix; 196 char *pix;
196 char *fpressedservice; 197 char *fpressedservice;
197 char *fpressedaction; 198 char *fpressedaction;
198 char *fheldservice; 199 char *fheldservice;
199 char *fheldaction; 200 char *fheldaction;
200}; 201};
201 202
202/** 203/**
203 * A singleton which gives informations about device specefic option 204 * A singleton which gives informations about device specefic option
204 * like the Hardware used, LEDs, the Base Distribution and 205 * like the Hardware used, LEDs, the Base Distribution and
205 * hardware key mappings. 206 * hardware key mappings.
206 * 207 *
207 * @short A small class for device specefic options 208 * @short A small class for device specefic options
208 * @see QObject 209 * @see QObject
209 * @author Robert Griebl 210 * @author Robert Griebl
210 * @version 1.0 211 * @version 1.0
211 */ 212 */
212class ODevice : public QObject 213class ODevice : public QObject
213{ 214{
214 Q_OBJECT 215 Q_OBJECT
215 216
216private: 217private:
217 /* disable copy */ 218 /* disable copy */
218 ODevice ( const ODevice & ); 219 ODevice ( const ODevice & );
219 220
220protected: 221protected:
221 ODevice(); 222 ODevice();
222 virtual void init(const QString&); 223 virtual void init(const QString&);
223 virtual void initButtons(); 224 virtual void initButtons();
224 static void sendSuspendmsg(); 225 static void sendSuspendmsg();
225 226
226 ODeviceData *d; 227 ODeviceData *d;
227 228
228public: 229public:
229 // sandman do we want to allow destructions? -zecke? 230 // sandman do we want to allow destructions? -zecke?
230 virtual ~ODevice(); 231 virtual ~ODevice();
231 232
232 static ODevice *inst(); 233 static ODevice *inst();
233 234
234 // information 235 // information
235 236
236 QString modelString() const; 237 QString modelString() const;
237 OModel model() const; 238 OModel model() const;
238 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); } 239 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); }
239 240
240 QString vendorString() const; 241 QString vendorString() const;
241 OVendor vendor() const; 242 OVendor vendor() const;
242 243
243 QString systemString() const; 244 QString systemString() const;
244 OSystem system() const; 245 OSystem system() const;
245 246
246 QString systemVersionString() const; 247 QString systemVersionString() const;
247 248
248 virtual Transformation rotation() const; 249 virtual Transformation rotation() const;
249 virtual ODirection direction() const; 250 virtual ODirection direction() const;
250 251
251 // system 252 // system
252 253
253 virtual bool setSoftSuspend ( bool on ); 254 virtual bool setSoftSuspend ( bool on );
254 virtual bool suspend(); 255 virtual bool suspend();
255 256
256 virtual bool setDisplayStatus ( bool on ); 257 virtual bool setDisplayStatus ( bool on );
257 virtual bool setDisplayBrightness ( int brightness ); 258 virtual bool setDisplayBrightness ( int brightness );
258 virtual int displayBrightnessResolution() const; 259 virtual int displayBrightnessResolution() const;
259 virtual bool setDisplayContrast ( int contrast ); 260 virtual bool setDisplayContrast ( int contrast );
260 virtual int displayContrastResolution() const; 261 virtual int displayContrastResolution() const;
261 262
262 // don't add new virtual methods, use this: 263 // don't add new virtual methods, use this:
263 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; 264 // /*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
264 // and in your subclass do do overwrite 265 // and in your subclass do overwrite
265 // protected virtual int virtual_hook(int, void *) 266 // protected virtual int virtual_hook(int, void *)
266 // which is defined below 267 // which is defined below
267 268
268 // input / output 269 // input / output
269 virtual void playAlarmSound(); 270 virtual void playAlarmSound();
270 virtual void playKeySound(); 271 virtual void playKeySound();
271 virtual void playTouchSound(); 272 virtual void playTouchSound();
272 273
273 virtual QValueList <OLed> ledList() const; 274 virtual QValueList <OLed> ledList() const;
274 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 275 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
275 virtual OLedState ledState ( OLed led ) const; 276 virtual OLedState ledState ( OLed led ) const;
276 virtual bool setLedState ( OLed led, OLedState st ); 277 virtual bool setLedState ( OLed led, OLedState st );
277 278
278 virtual bool hasLightSensor() const; 279 virtual bool hasLightSensor() const;
279 virtual int readLightSensor(); 280 virtual int readLightSensor();
280 virtual int lightSensorResolution() const; 281 virtual int lightSensorResolution() const;
281 282
282 virtual bool hasHingeSensor() const; 283 virtual bool hasHingeSensor() const;
283 virtual OHingeStatus readHingeSensor(); 284 virtual OHingeStatus readHingeSensor();
284 285
285 const QStrList &allowedCpuFrequencies() const; 286 const QStrList &allowedCpuFrequencies() const;
286 bool setCurrentCpuFrequency(uint index); 287 bool setCurrentCpuFrequency(uint index);
287 288
288 /** 289 /**
289 * Returns the available buttons on this device. The number and location 290 * Returns the available buttons on this device. The number and location
290 * of buttons will vary depending on the device. Button numbers will be assigned 291 * of buttons will vary depending on the device. Button numbers will be assigned
291 * by the device manufacturer and will be from most preferred button to least preffered 292 * by the device manufacturer and will be from most preferred button to least preffered
292 * button. Note that this list only contains "user mappable" buttons. 293 * button. Note that this list only contains "user mappable" buttons.
293 * 294 *
294 * @todo Make method const and take care of calling initButtons or make that const too 295 * @todo Make method const and take care of calling initButtons or make that const too
295 * 296 *
296 */ 297 */
297 const QValueList<ODeviceButton> &buttons(); 298 const QValueList<ODeviceButton> &buttons();
298 299
299 /** 300 /**
300 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it 301 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
301 * returns 0L 302 * returns 0L
302 */ 303 */
303 const ODeviceButton *buttonForKeycode ( ushort keyCode ); 304 const ODeviceButton *buttonForKeycode ( ushort keyCode );
304 305
305 /** 306 /**
306 * Reassigns the pressed action for \a button. To return to the factory 307 * Reassigns the pressed action for \a button. To return to the factory
307 * default pass an empty string as \a qcopMessage. 308 * default pass an empty string as \a qcopMessage.
308 */ 309 */
309 void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); 310 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
310 311
311 /** 312 /**
312 * Reassigns the held action for \a button. To return to the factory 313 * Reassigns the held action for \a button. To return to the factory
313 * default pass an empty string as \a qcopMessage. 314 * default pass an empty string as \a qcopMessage.
314 */ 315 */
315 void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); 316 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
316 317
317 /** 318 /**
318 * How long (in ms) you have to press a button for a "hold" action 319 * How long (in ms) you have to press a button for a "hold" action
319 */ 320 */
320 uint buttonHoldTime() const; 321 uint buttonHoldTime() const;
321 322
322signals: 323signals:
323 void buttonMappingChanged(); 324 void buttonMappingChanged();
324 325
325private slots: 326private slots:
326 void systemMessage ( const QCString &, const QByteArray & ); 327 void systemMessage ( const QCString &, const QByteArray & );
327 void playingStopped(); 328 void playingStopped();
328 329
329protected: 330protected:
330 void addPreHandler(QWSServer::KeyboardFilter*aFilter); 331 void addPreHandler(QWSServer::KeyboardFilter*aFilter);
331 void remPreHandler(QWSServer::KeyboardFilter*aFilter); 332 void remPreHandler(QWSServer::KeyboardFilter*aFilter);
332 void reloadButtonMapping(); 333 void reloadButtonMapping();
333 void changeMixerForAlarm( int mixer, const char* file, Sound *snd); 334 void changeMixerForAlarm( int mixer, const char* file, Sound *snd);
334 335
335 /* ugly virtual hook */ 336 /* ugly virtual hook */
336 virtual void virtual_hook( int id, void* data ); 337 virtual void virtual_hook( int id, void* data );
337}; 338};
338 339
339class ODeviceData { 340class ODeviceData {
340 341
341 public: 342 public:
342 QString m_vendorstr; 343 QString m_vendorstr;
343 OVendor m_vendor; 344 OVendor m_vendor;
344 345
345 QString m_modelstr; 346 QString m_modelstr;
346 OModel m_model; 347 OModel m_model;
347 348
348 QString m_systemstr; 349 QString m_systemstr;
349 OSystem m_system; 350 OSystem m_system;
350 351
351 QString m_sysverstr; 352 QString m_sysverstr;
352 353
353 Transformation m_rotation; 354 Transformation m_rotation;
354 ODirection m_direction; 355 ODirection m_direction;
355 356
356 QValueList <ODeviceButton> *m_buttons; 357 QValueList <ODeviceButton> *m_buttons;
357 uint m_holdtime; 358 uint m_holdtime;
358 QStrList *m_cpu_frequencies; 359 QStrList *m_cpu_frequencies;
359 360
360 /* values for changeMixerForAlarm */ 361 /* values for changeMixerForAlarm */