-rw-r--r-- | libopie/odevice.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libopie/odevice.h b/libopie/odevice.h index d8ad135..2a5e494 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -1,248 +1,261 @@ | |||
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_Zaurus = ( 2 << 24 ), | 54 | Model_Zaurus = ( 2 << 24 ), |
55 | 55 | ||
56 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), | 56 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
57 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), | 57 | Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), |
58 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), | 58 | Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ), |
59 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 59 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
60 | Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), | 60 | Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), |
61 | 61 | ||
62 | Model_SIMpad = ( 3 << 24 ), | 62 | Model_SIMpad = ( 3 << 24 ), |
63 | 63 | ||
64 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), | 64 | Model_SIMpad_All = ( Model_SIMpad | 0xffffff ), |
65 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), | 65 | Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ), |
66 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), | 66 | Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ), |
67 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), | 67 | Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ), |
68 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), | 68 | Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ), |
69 | 69 | ||
70 | Model_Ramses = ( 4 << 24 ), | 70 | Model_Ramses = ( 4 << 24 ), |
71 | 71 | ||
72 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), | 72 | Model_Ramses_All = ( Model_Ramses | 0xffffff ), |
73 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), | 73 | Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ), |
74 | |||
75 | Model_Yopy = ( 5 << 24 ), | ||
76 | |||
77 | Model_Yopy_All = ( Model_Yopy | 0xffffff ), | ||
78 | Model_Yopy_3000 = ( Model_Yopy | 0x000001 ), | ||
79 | Model_Yopy_3500 = ( Model_Yopy | 0x000002 ), | ||
80 | Model_Yopy_3700 = ( Model_Yopy | 0x000003 ), | ||
81 | |||
74 | }; | 82 | }; |
75 | 83 | ||
76 | /** | 84 | /** |
77 | * The vendor of the device | 85 | * The vendor of the device |
78 | */ | 86 | */ |
79 | enum OVendor { | 87 | enum OVendor { |
80 | Vendor_Unknown, | 88 | Vendor_Unknown, |
81 | 89 | ||
82 | Vendor_HP, | 90 | Vendor_HP, |
83 | Vendor_Sharp, | 91 | Vendor_Sharp, |
84 | Vendor_SIEMENS, | 92 | Vendor_SIEMENS, |
85 | Vendor_MundN, | 93 | Vendor_MundN, |
94 | Vendor_GMate, | ||
86 | }; | 95 | }; |
87 | 96 | ||
88 | /** | 97 | /** |
89 | * The System used | 98 | * The System used |
90 | */ | 99 | */ |
91 | enum OSystem { | 100 | enum OSystem { |
92 | System_Unknown, | 101 | System_Unknown, |
93 | 102 | ||
94 | System_Familiar, | 103 | System_Familiar, |
95 | System_Zaurus, | 104 | System_Zaurus, |
96 | System_OpenZaurus | 105 | System_OpenZaurus, |
106 | System_Linupy, | ||
97 | }; | 107 | }; |
98 | 108 | ||
99 | enum OLedState { | 109 | enum OLedState { |
100 | Led_Off, | 110 | Led_Off, |
101 | Led_On, | 111 | Led_On, |
102 | Led_BlinkSlow, | 112 | Led_BlinkSlow, |
103 | Led_BlinkFast | 113 | Led_BlinkFast |
104 | }; | 114 | }; |
105 | 115 | ||
106 | enum OLed { | 116 | enum OLed { |
107 | Led_Mail, | 117 | Led_Mail, |
108 | Led_Power, | 118 | Led_Power, |
109 | Led_BlueTooth | 119 | Led_BlueTooth |
110 | }; | 120 | }; |
111 | 121 | ||
112 | enum OHardKey { | 122 | enum OHardKey { |
113 | HardKey_Datebook = Qt::Key_F9, | 123 | HardKey_Datebook = Qt::Key_F9, |
114 | HardKey_Contacts = Qt::Key_F10, | 124 | HardKey_Contacts = Qt::Key_F10, |
115 | HardKey_Menu = Qt::Key_F11, | 125 | HardKey_Menu = Qt::Key_F11, |
116 | HardKey_Home = Qt::Key_F12, | 126 | HardKey_Home = Qt::Key_F12, |
117 | HardKey_Mail = Qt::Key_F13, | 127 | HardKey_Mail = Qt::Key_F13, |
118 | HardKey_Record = Qt::Key_F24, | 128 | HardKey_Record = Qt::Key_F24, |
119 | HardKey_Suspend = Qt::Key_F34, | 129 | HardKey_Suspend = Qt::Key_F34, |
120 | HardKey_Backlight = Qt::Key_F35, | 130 | HardKey_Backlight = Qt::Key_F35, |
131 | HardKey_Action = Qt::Key_F10, | ||
132 | HardKey_OK = Qt::Key_F11, | ||
133 | HardKey_End = Qt::Key_F12, | ||
121 | }; | 134 | }; |
122 | 135 | ||
123 | enum ODirection { | 136 | enum ODirection { |
124 | CW = 0, | 137 | CW = 0, |
125 | CCW = 1, | 138 | CCW = 1, |
126 | Flip = 2, | 139 | Flip = 2, |
127 | }; | 140 | }; |
128 | 141 | ||
129 | /** | 142 | /** |
130 | * A singleton which gives informations about device specefic option | 143 | * A singleton which gives informations about device specefic option |
131 | * like the Hardware used, LEDs, the Base Distribution and | 144 | * like the Hardware used, LEDs, the Base Distribution and |
132 | * hardware key mappings. | 145 | * hardware key mappings. |
133 | * | 146 | * |
134 | * @short A small class for device specefic options | 147 | * @short A small class for device specefic options |
135 | * @see QObject | 148 | * @see QObject |
136 | * @author Robert Griebl | 149 | * @author Robert Griebl |
137 | * @version 1.0 | 150 | * @version 1.0 |
138 | */ | 151 | */ |
139 | class ODevice : public QObject { | 152 | class ODevice : public QObject { |
140 | Q_OBJECT | 153 | Q_OBJECT |
141 | 154 | ||
142 | private: | 155 | private: |
143 | /* disable copy */ | 156 | /* disable copy */ |
144 | ODevice ( const ODevice & ); | 157 | ODevice ( const ODevice & ); |
145 | 158 | ||
146 | protected: | 159 | protected: |
147 | ODevice ( ); | 160 | ODevice ( ); |
148 | virtual void init ( ); | 161 | virtual void init ( ); |
149 | virtual void initButtons ( ); | 162 | virtual void initButtons ( ); |
150 | 163 | ||
151 | ODeviceData *d; | 164 | ODeviceData *d; |
152 | 165 | ||
153 | public: | 166 | public: |
154 | // sandman do we want to allow destructions? -zecke? | 167 | // sandman do we want to allow destructions? -zecke? |
155 | virtual ~ODevice ( ); | 168 | virtual ~ODevice ( ); |
156 | 169 | ||
157 | static ODevice *inst ( ); | 170 | static ODevice *inst ( ); |
158 | 171 | ||
159 | // information | 172 | // information |
160 | 173 | ||
161 | QString modelString ( ) const; | 174 | QString modelString ( ) const; |
162 | OModel model ( ) const; | 175 | OModel model ( ) const; |
163 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } | 176 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } |
164 | 177 | ||
165 | QString vendorString ( ) const; | 178 | QString vendorString ( ) const; |
166 | OVendor vendor ( ) const; | 179 | OVendor vendor ( ) const; |
167 | 180 | ||
168 | QString systemString ( ) const; | 181 | QString systemString ( ) const; |
169 | OSystem system ( ) const; | 182 | OSystem system ( ) const; |
170 | 183 | ||
171 | QString systemVersionString ( ) const; | 184 | QString systemVersionString ( ) const; |
172 | 185 | ||
173 | Transformation rotation ( ) const; | 186 | Transformation rotation ( ) const; |
174 | ODirection direction ( ) const; | 187 | ODirection direction ( ) const; |
175 | 188 | ||
176 | // system | 189 | // system |
177 | 190 | ||
178 | virtual bool setSoftSuspend ( bool on ); | 191 | virtual bool setSoftSuspend ( bool on ); |
179 | virtual bool suspend ( ); | 192 | virtual bool suspend ( ); |
180 | 193 | ||
181 | virtual bool setDisplayStatus ( bool on ); | 194 | virtual bool setDisplayStatus ( bool on ); |
182 | virtual bool setDisplayBrightness ( int brightness ); | 195 | virtual bool setDisplayBrightness ( int brightness ); |
183 | virtual int displayBrightnessResolution ( ) const; | 196 | virtual int displayBrightnessResolution ( ) const; |
184 | virtual bool setDisplayContrast ( int contrast ); | 197 | virtual bool setDisplayContrast ( int contrast ); |
185 | virtual int displayContrastResolution ( ) const; | 198 | virtual int displayContrastResolution ( ) const; |
186 | 199 | ||
187 | // don't add new virtual methods, use this: | 200 | // don't add new virtual methods, use this: |
188 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 201 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
189 | // and in your subclass do do overwrite | 202 | // and in your subclass do do overwrite |
190 | //protected virtual int virtual_hook(int, void *) | 203 | //protected virtual int virtual_hook(int, void *) |
191 | // which is defined below | 204 | // which is defined below |
192 | 205 | ||
193 | // input / output | 206 | // input / output |
194 | //FIXME playAlarmSound and al might be better -zecke | 207 | //FIXME playAlarmSound and al might be better -zecke |
195 | virtual void alarmSound ( ); | 208 | virtual void alarmSound ( ); |
196 | virtual void keySound ( ); | 209 | virtual void keySound ( ); |
197 | virtual void touchSound ( ); | 210 | virtual void touchSound ( ); |
198 | 211 | ||
199 | virtual QValueList <OLed> ledList ( ) const; | 212 | virtual QValueList <OLed> ledList ( ) const; |
200 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 213 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
201 | virtual OLedState ledState ( OLed led ) const; | 214 | virtual OLedState ledState ( OLed led ) const; |
202 | virtual bool setLedState ( OLed led, OLedState st ); | 215 | virtual bool setLedState ( OLed led, OLedState st ); |
203 | 216 | ||
204 | virtual bool hasLightSensor ( ) const; | 217 | virtual bool hasLightSensor ( ) const; |
205 | virtual int readLightSensor ( ); | 218 | virtual int readLightSensor ( ); |
206 | virtual int lightSensorResolution ( ) const; | 219 | virtual int lightSensorResolution ( ) const; |
207 | 220 | ||
208 | const QStrList &allowedCpuFrequencies() const; | 221 | const QStrList &allowedCpuFrequencies() const; |
209 | bool setCurrentCpuFrequency(uint index); | 222 | bool setCurrentCpuFrequency(uint index); |
210 | 223 | ||
211 | /** | 224 | /** |
212 | * Returns the available buttons on this device. The number and location | 225 | * Returns the available buttons on this device. The number and location |
213 | * of buttons will vary depending on the device. Button numbers will be assigned | 226 | * of buttons will vary depending on the device. Button numbers will be assigned |
214 | * by the device manufacturer and will be from most preferred button to least preffered | 227 | * by the device manufacturer and will be from most preferred button to least preffered |
215 | * button. Note that this list only contains "user mappable" buttons. | 228 | * button. Note that this list only contains "user mappable" buttons. |
216 | */ | 229 | */ |
217 | const QValueList<ODeviceButton> &buttons ( ) /* ### make const */; | 230 | const QValueList<ODeviceButton> &buttons ( ) /* ### make const */; |
218 | 231 | ||
219 | /** | 232 | /** |
220 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 233 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
221 | * returns 0L | 234 | * returns 0L |
222 | */ | 235 | */ |
223 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 236 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
224 | 237 | ||
225 | /** | 238 | /** |
226 | * Reassigns the pressed action for \a button. To return to the factory | 239 | * Reassigns the pressed action for \a button. To return to the factory |
227 | * default pass an empty string as \a qcopMessage. | 240 | * default pass an empty string as \a qcopMessage. |
228 | */ | 241 | */ |
229 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 242 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
230 | 243 | ||
231 | /** | 244 | /** |
232 | * Reassigns the held action for \a button. To return to the factory | 245 | * Reassigns the held action for \a button. To return to the factory |
233 | * default pass an empty string as \a qcopMessage. | 246 | * default pass an empty string as \a qcopMessage. |
234 | */ | 247 | */ |
235 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 248 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
236 | 249 | ||
237 | /** | 250 | /** |
238 | * How long (in ms) you have to press a button for a "hold" action | 251 | * How long (in ms) you have to press a button for a "hold" action |
239 | */ | 252 | */ |
240 | uint buttonHoldTime ( ) const; | 253 | uint buttonHoldTime ( ) const; |
241 | 254 | ||
242 | signals: | 255 | signals: |
243 | void buttonMappingChanged ( ); | 256 | void buttonMappingChanged ( ); |
244 | 257 | ||
245 | private slots: | 258 | private slots: |
246 | void systemMessage ( const QCString &, const QByteArray & ); | 259 | void systemMessage ( const QCString &, const QByteArray & ); |
247 | 260 | ||
248 | protected: | 261 | protected: |