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