summaryrefslogtreecommitdiff
path: root/libopie/odevice.h
Unidiff
Diffstat (limited to 'libopie/odevice.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.h302
1 files changed, 0 insertions, 302 deletions
diff --git a/libopie/odevice.h b/libopie/odevice.h
deleted file mode 100644
index fc41079..0000000
--- a/libopie/odevice.h
+++ b/dev/null
@@ -1,302 +0,0 @@
1/* This file is part of the OPIE libraries
2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org)
3 Copyright (C) 2003 Holger 'zecke' Freyther (zecke@handhelds.org)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21#ifndef _LIBOPIE_ODEVICE_H_
22#define _LIBOPIE_ODEVICE_H_
23
24#include <qobject.h>
25#include <qstring.h>
26#include <qnamespace.h>
27#include <qstrlist.h>
28
29#include <opie/odevicebutton.h>
30
31#include <qpe/qpeapplication.h> /* for Transformation enum.. */
32
33class ODeviceData;
34
35namespace Opie {
36
37/**
38 * The available devices
39 */
40enum OModel {
41 Model_Unknown, // = 0
42
43 Model_Series_Mask = 0xff000000,
44
45 Model_iPAQ = ( 1 << 24 ),
46
47 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
48 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
49 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
50 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
51 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
52 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
53 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000011 ),
54
55 Model_Jornada = ( 6 << 24 ),
56 Model_Jornada_56x = ( Model_Jornada | 0x000001 ),
57
58 Model_Zaurus = ( 2 << 24 ),
59
60 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
61 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
62 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
63 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
64 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ),
65
66 Model_SIMpad = ( 3 << 24 ),
67
68 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
69 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
70 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
71 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
72 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
73
74 Model_Ramses = ( 4 << 24 ),
75
76 Model_Ramses_All = ( Model_Ramses | 0xffffff ),
77 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
78
79 Model_Yopy = ( 5 << 24 ),
80
81 Model_Yopy_All = ( Model_Yopy | 0xffffff ),
82 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ),
83 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ),
84 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ),
85
86};
87
88/**
89 * The vendor of the device
90 */
91enum OVendor {
92 Vendor_Unknown,
93
94 Vendor_HP,
95 Vendor_Sharp,
96 Vendor_SIEMENS,
97 Vendor_MundN,
98 Vendor_GMate,
99};
100
101/**
102 * The System used
103 */
104enum OSystem {
105 System_Unknown,
106
107 System_Familiar,
108 System_Zaurus,
109 System_OpenZaurus,
110 System_Linupy,
111};
112
113enum OLedState {
114 Led_Off,
115 Led_On,
116 Led_BlinkSlow,
117 Led_BlinkFast
118};
119
120enum OLed {
121 Led_Mail,
122 Led_Power,
123 Led_BlueTooth
124};
125
126enum OHardKey {
127 HardKey_Datebook = Qt::Key_F9,
128 HardKey_Contacts = Qt::Key_F10,
129 HardKey_Menu = Qt::Key_F11,
130 HardKey_Home = Qt::Key_F12,
131 HardKey_Mail = Qt::Key_F13,
132 HardKey_Record = Qt::Key_F24,
133 HardKey_Suspend = Qt::Key_F34,
134 HardKey_Backlight = Qt::Key_F35,
135 HardKey_Action = Qt::Key_F10,
136 HardKey_OK = Qt::Key_F11,
137 HardKey_End = Qt::Key_F12,
138};
139
140enum ODirection {
141 CW = 0,
142 CCW = 1,
143 Flip = 2,
144};
145
146enum OHingeStatus {
147 CASE_CLOSED = 3,
148 CASE_PORTRAIT = 2,
149 CASE_LANDSCAPE = 0,
150 CASE_UNKNOWN = 1,
151};
152
153/**
154 * A singleton which gives informations about device specefic option
155 * like the Hardware used, LEDs, the Base Distribution and
156 * hardware key mappings.
157 *
158 * @short A small class for device specefic options
159 * @see QObject
160 * @author Robert Griebl
161 * @version 1.0
162 */
163class ODevice : public QObject {
164 Q_OBJECT
165
166private:
167 /* disable copy */
168 ODevice ( const ODevice & );
169
170protected:
171 ODevice ( );
172 virtual void init ( );
173 virtual void initButtons ( );
174
175 ODeviceData *d;
176
177public:
178 // sandman do we want to allow destructions? -zecke?
179 virtual ~ODevice ( );
180
181 static ODevice *inst ( );
182
183 // information
184
185 QString modelString ( ) const;
186 OModel model ( ) const;
187 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); }
188
189 QString vendorString ( ) const;
190 OVendor vendor ( ) const;
191
192 QString systemString ( ) const;
193 OSystem system ( ) const;
194
195 QString systemVersionString ( ) const;
196
197 /*virtual*/ Transformation rotation ( ) const;
198 /*virtual*/ ODirection direction ( ) const;
199
200// system
201
202 virtual bool setSoftSuspend ( bool on );
203 virtual bool suspend ( );
204
205 virtual bool setDisplayStatus ( bool on );
206 virtual bool setDisplayBrightness ( int brightness );
207 virtual int displayBrightnessResolution ( ) const;
208 virtual bool setDisplayContrast ( int contrast );
209 virtual int displayContrastResolution ( ) const;
210
211 // don't add new virtual methods, use this:
212 ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
213 // and in your subclass do do overwrite
214 //protected virtual int virtual_hook(int, void *)
215 // which is defined below
216
217 // input / output
218 //FIXME playAlarmSound and al might be better -zecke
219 virtual void alarmSound ( );
220 virtual void keySound ( );
221 virtual void touchSound ( );
222
223 virtual QValueList <OLed> ledList ( ) const;
224 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
225 virtual OLedState ledState ( OLed led ) const;
226 virtual bool setLedState ( OLed led, OLedState st );
227
228 virtual bool hasLightSensor ( ) const;
229 virtual int readLightSensor ( );
230 virtual int lightSensorResolution ( ) const;
231
232 /*virtual*/ bool hasHingeSensor ( ) const;
233 /*virtual*/ OHingeStatus readHingeSensor ( );
234
235 const QStrList &allowedCpuFrequencies() const;
236 bool setCurrentCpuFrequency(uint index);
237
238 /**
239 * Returns the available buttons on this device. The number and location
240 * of buttons will vary depending on the device. Button numbers will be assigned
241 * by the device manufacturer and will be from most preferred button to least preffered
242 * button. Note that this list only contains "user mappable" buttons.
243 *
244 * @todo ### make const
245 */
246 const QValueList<ODeviceButton> &buttons ( ) /** /todo ### make const */;
247
248 /**
249 * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it
250 * returns 0L
251 */
252 const ODeviceButton *buttonForKeycode ( ushort keyCode );
253
254 /**
255 * Reassigns the pressed action for \a button. To return to the factory
256 * default pass an empty string as \a qcopMessage.
257 */
258 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
259
260 /**
261 * Reassigns the held action for \a button. To return to the factory
262 * default pass an empty string as \a qcopMessage.
263 */
264 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
265
266 /**
267 * How long (in ms) you have to press a button for a "hold" action
268 */
269 uint buttonHoldTime ( ) const;
270
271signals:
272 void buttonMappingChanged ( );
273
274private slots:
275 void systemMessage ( const QCString &, const QByteArray & );
276
277protected:
278 void reloadButtonMapping ( );
279 /* ugly virtual hook */
280 virtual void virtual_hook( int id, void* data );
281
282protected:
283 enum { VIRTUAL_ROTATION = 0x200, VIRTUAL_DIRECTION,
284 VIRTUAL_HAS_HINGE, VIRTUAL_HINGE };
285 struct VirtRotation {
286 Transformation trans;
287 };
288 struct VirtDirection {
289 ODirection direct;
290 };
291 struct VirtHasHinge {
292 bool hasHinge;
293 };
294 struct VirtHingeStatus {
295 OHingeStatus hingeStat;
296 };
297};
298
299}
300
301#endif
302