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