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