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