-rw-r--r-- | libopie/odevice.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libopie/odevice.h b/libopie/odevice.h index 8273761..ee0b0ec 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -114,143 +114,153 @@ enum OLedState { | |||
114 | Led_Off, | 114 | Led_Off, |
115 | Led_On, | 115 | Led_On, |
116 | Led_BlinkSlow, | 116 | Led_BlinkSlow, |
117 | Led_BlinkFast | 117 | Led_BlinkFast |
118 | }; | 118 | }; |
119 | 119 | ||
120 | enum OLed { | 120 | enum OLed { |
121 | Led_Mail, | 121 | Led_Mail, |
122 | Led_Power, | 122 | Led_Power, |
123 | Led_BlueTooth | 123 | Led_BlueTooth |
124 | }; | 124 | }; |
125 | 125 | ||
126 | enum OHardKey { | 126 | enum OHardKey { |
127 | HardKey_Datebook = Qt::Key_F9, | 127 | HardKey_Datebook = Qt::Key_F9, |
128 | HardKey_Contacts = Qt::Key_F10, | 128 | HardKey_Contacts = Qt::Key_F10, |
129 | HardKey_Menu = Qt::Key_F11, | 129 | HardKey_Menu = Qt::Key_F11, |
130 | HardKey_Home = Qt::Key_F12, | 130 | HardKey_Home = Qt::Key_F12, |
131 | HardKey_Mail = Qt::Key_F13, | 131 | HardKey_Mail = Qt::Key_F13, |
132 | HardKey_Record = Qt::Key_F24, | 132 | HardKey_Record = Qt::Key_F24, |
133 | HardKey_Suspend = Qt::Key_F34, | 133 | HardKey_Suspend = Qt::Key_F34, |
134 | HardKey_Backlight = Qt::Key_F35, | 134 | HardKey_Backlight = Qt::Key_F35, |
135 | HardKey_Action = Qt::Key_F10, | 135 | HardKey_Action = Qt::Key_F10, |
136 | HardKey_OK = Qt::Key_F11, | 136 | HardKey_OK = Qt::Key_F11, |
137 | HardKey_End = Qt::Key_F12, | 137 | HardKey_End = Qt::Key_F12, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | enum ODirection { | 140 | enum ODirection { |
141 | CW = 0, | 141 | CW = 0, |
142 | CCW = 1, | 142 | CCW = 1, |
143 | Flip = 2, | 143 | Flip = 2, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | enum OHingeStatus { | ||
147 | CASE_CLOSED = 3, | ||
148 | CASE_PORTRAIT = 2, | ||
149 | CASE_LANDSCAPE = 0, | ||
150 | CASE_UNKNOWN = 1, | ||
151 | }; | ||
152 | |||
146 | /** | 153 | /** |
147 | * A singleton which gives informations about device specefic option | 154 | * A singleton which gives informations about device specefic option |
148 | * like the Hardware used, LEDs, the Base Distribution and | 155 | * like the Hardware used, LEDs, the Base Distribution and |
149 | * hardware key mappings. | 156 | * hardware key mappings. |
150 | * | 157 | * |
151 | * @short A small class for device specefic options | 158 | * @short A small class for device specefic options |
152 | * @see QObject | 159 | * @see QObject |
153 | * @author Robert Griebl | 160 | * @author Robert Griebl |
154 | * @version 1.0 | 161 | * @version 1.0 |
155 | */ | 162 | */ |
156 | class ODevice : public QObject { | 163 | class ODevice : public QObject { |
157 | Q_OBJECT | 164 | Q_OBJECT |
158 | 165 | ||
159 | private: | 166 | private: |
160 | /* disable copy */ | 167 | /* disable copy */ |
161 | ODevice ( const ODevice & ); | 168 | ODevice ( const ODevice & ); |
162 | 169 | ||
163 | protected: | 170 | protected: |
164 | ODevice ( ); | 171 | ODevice ( ); |
165 | virtual void init ( ); | 172 | virtual void init ( ); |
166 | virtual void initButtons ( ); | 173 | virtual void initButtons ( ); |
167 | 174 | ||
168 | ODeviceData *d; | 175 | ODeviceData *d; |
169 | 176 | ||
170 | public: | 177 | public: |
171 | // sandman do we want to allow destructions? -zecke? | 178 | // sandman do we want to allow destructions? -zecke? |
172 | virtual ~ODevice ( ); | 179 | virtual ~ODevice ( ); |
173 | 180 | ||
174 | static ODevice *inst ( ); | 181 | static ODevice *inst ( ); |
175 | 182 | ||
176 | // information | 183 | // information |
177 | 184 | ||
178 | QString modelString ( ) const; | 185 | QString modelString ( ) const; |
179 | OModel model ( ) const; | 186 | OModel model ( ) const; |
180 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } | 187 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } |
181 | 188 | ||
182 | QString vendorString ( ) const; | 189 | QString vendorString ( ) const; |
183 | OVendor vendor ( ) const; | 190 | OVendor vendor ( ) const; |
184 | 191 | ||
185 | QString systemString ( ) const; | 192 | QString systemString ( ) const; |
186 | OSystem system ( ) const; | 193 | OSystem system ( ) const; |
187 | 194 | ||
188 | QString systemVersionString ( ) const; | 195 | QString systemVersionString ( ) const; |
189 | 196 | ||
190 | virtual Transformation rotation ( ) const; | 197 | virtual Transformation rotation ( ) const; |
191 | virtual ODirection direction ( ) const; | 198 | virtual ODirection direction ( ) const; |
192 | 199 | ||
193 | // system | 200 | // system |
194 | 201 | ||
195 | virtual bool setSoftSuspend ( bool on ); | 202 | virtual bool setSoftSuspend ( bool on ); |
196 | virtual bool suspend ( ); | 203 | virtual bool suspend ( ); |
197 | 204 | ||
198 | virtual bool setDisplayStatus ( bool on ); | 205 | virtual bool setDisplayStatus ( bool on ); |
199 | virtual bool setDisplayBrightness ( int brightness ); | 206 | virtual bool setDisplayBrightness ( int brightness ); |
200 | virtual int displayBrightnessResolution ( ) const; | 207 | virtual int displayBrightnessResolution ( ) const; |
201 | virtual bool setDisplayContrast ( int contrast ); | 208 | virtual bool setDisplayContrast ( int contrast ); |
202 | virtual int displayContrastResolution ( ) const; | 209 | virtual int displayContrastResolution ( ) const; |
203 | 210 | ||
204 | // don't add new virtual methods, use this: | 211 | // don't add new virtual methods, use this: |
205 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; | 212 | ///*virtual */ void boo(int i ) { return virtual_hook(1,&i); }; |
206 | // and in your subclass do do overwrite | 213 | // and in your subclass do do overwrite |
207 | //protected virtual int virtual_hook(int, void *) | 214 | //protected virtual int virtual_hook(int, void *) |
208 | // which is defined below | 215 | // which is defined below |
209 | 216 | ||
210 | // input / output | 217 | // input / output |
211 | //FIXME playAlarmSound and al might be better -zecke | 218 | //FIXME playAlarmSound and al might be better -zecke |
212 | virtual void alarmSound ( ); | 219 | virtual void alarmSound ( ); |
213 | virtual void keySound ( ); | 220 | virtual void keySound ( ); |
214 | virtual void touchSound ( ); | 221 | virtual void touchSound ( ); |
215 | 222 | ||
216 | virtual QValueList <OLed> ledList ( ) const; | 223 | virtual QValueList <OLed> ledList ( ) const; |
217 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 224 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
218 | virtual OLedState ledState ( OLed led ) const; | 225 | virtual OLedState ledState ( OLed led ) const; |
219 | virtual bool setLedState ( OLed led, OLedState st ); | 226 | virtual bool setLedState ( OLed led, OLedState st ); |
220 | 227 | ||
221 | virtual bool hasLightSensor ( ) const; | 228 | virtual bool hasLightSensor ( ) const; |
222 | virtual int readLightSensor ( ); | 229 | virtual int readLightSensor ( ); |
223 | virtual int lightSensorResolution ( ) const; | 230 | virtual int lightSensorResolution ( ) const; |
224 | 231 | ||
232 | virtual bool hasHingeSensor ( ) const; | ||
233 | virtual OHingeStatus readHingeSensor ( ); | ||
234 | |||
225 | const QStrList &allowedCpuFrequencies() const; | 235 | const QStrList &allowedCpuFrequencies() const; |
226 | bool setCurrentCpuFrequency(uint index); | 236 | bool setCurrentCpuFrequency(uint index); |
227 | 237 | ||
228 | /** | 238 | /** |
229 | * Returns the available buttons on this device. The number and location | 239 | * Returns the available buttons on this device. The number and location |
230 | * of buttons will vary depending on the device. Button numbers will be assigned | 240 | * of buttons will vary depending on the device. Button numbers will be assigned |
231 | * by the device manufacturer and will be from most preferred button to least preffered | 241 | * by the device manufacturer and will be from most preferred button to least preffered |
232 | * button. Note that this list only contains "user mappable" buttons. | 242 | * button. Note that this list only contains "user mappable" buttons. |
233 | */ | 243 | */ |
234 | const QValueList<ODeviceButton> &buttons ( ) /* ### make const */; | 244 | const QValueList<ODeviceButton> &buttons ( ) /* ### make const */; |
235 | 245 | ||
236 | /** | 246 | /** |
237 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it | 247 | * Returns the DeviceButton for the \a keyCode. If \a keyCode is not found, it |
238 | * returns 0L | 248 | * returns 0L |
239 | */ | 249 | */ |
240 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); | 250 | const ODeviceButton *buttonForKeycode ( ushort keyCode ); |
241 | 251 | ||
242 | /** | 252 | /** |
243 | * Reassigns the pressed action for \a button. To return to the factory | 253 | * Reassigns the pressed action for \a button. To return to the factory |
244 | * default pass an empty string as \a qcopMessage. | 254 | * default pass an empty string as \a qcopMessage. |
245 | */ | 255 | */ |
246 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); | 256 | void remapPressedAction ( int button, const OQCopMessage &qcopMessage ); |
247 | 257 | ||
248 | /** | 258 | /** |
249 | * Reassigns the held action for \a button. To return to the factory | 259 | * Reassigns the held action for \a button. To return to the factory |
250 | * default pass an empty string as \a qcopMessage. | 260 | * default pass an empty string as \a qcopMessage. |
251 | */ | 261 | */ |
252 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); | 262 | void remapHeldAction ( int button, const OQCopMessage &qcopMessage ); |
253 | 263 | ||
254 | /** | 264 | /** |
255 | * How long (in ms) you have to press a button for a "hold" action | 265 | * How long (in ms) you have to press a button for a "hold" action |
256 | */ | 266 | */ |