00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef ODEVICE_H_
00031 #define ODEVICE_H_
00032
00033
00034 #include <opie2/odevicebutton.h>
00035 #include <qpe/qpeapplication.h>
00036
00037
00038 #include <qnamespace.h>
00039 #include <qobject.h>
00040 #include <qstring.h>
00041
00042
00043 #include <qstrlist.h>
00044 #include <qwindowsystem_qws.h>
00045
00046
00047 class Sound;
00048
00049 namespace Opie{
00050 namespace Core{
00051
00052 class ODeviceData;
00056 enum OModel {
00057 Model_Unknown,
00058
00059 Model_Series_Mask = 0xffff0000,
00060
00061 Model_iPAQ = ( 1 << 16 ),
00062
00063 Model_iPAQ_All = ( Model_iPAQ | 0xffff ),
00064 Model_iPAQ_H31xx = ( Model_iPAQ | 0x0001 ),
00065 Model_iPAQ_H36xx = ( Model_iPAQ | 0x0002 ),
00066 Model_iPAQ_H37xx = ( Model_iPAQ | 0x0003 ),
00067 Model_iPAQ_H38xx = ( Model_iPAQ | 0x0004 ),
00068 Model_iPAQ_H39xx = ( Model_iPAQ | 0x0005 ),
00069 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x0006 ),
00070 Model_iPAQ_H22xx = ( Model_iPAQ | 0x0007 ),
00071 Model_iPAQ_H191x = ( Model_iPAQ | 0x0008 ),
00072 Model_iPAQ_H1940 = ( Model_iPAQ | 0x0009 ),
00073
00074 Model_Jornada = ( 6 << 16 ),
00075 Model_Jornada_56x = ( Model_Jornada | 0x0001 ),
00076 Model_Jornada_720 = ( Model_Jornada | 0x0002 ),
00077
00078 Model_Zaurus = ( 2 << 16 ),
00079
00080 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x0001 ),
00081 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x0002 ),
00082 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x0003 ),
00083 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x0004 ),
00084 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x0005 ),
00085 Model_Zaurus_SL6000 = ( Model_Zaurus | 0x0006 ),
00086 Model_Zaurus_SLC3000 = ( Model_Zaurus | 0x0007 ),
00087 Model_Zaurus_SLC1000 = ( Model_Zaurus | 0x0008 ),
00088 Model_Zaurus_SLC3100 = ( Model_Zaurus | 0x0009 ),
00089
00090 Model_SIMpad = ( 3 << 16 ),
00091
00092 Model_SIMpad_All = ( Model_SIMpad | 0xffff ),
00093 Model_SIMpad_CL4 = ( Model_SIMpad | 0x0001 ),
00094 Model_SIMpad_SL4 = ( Model_SIMpad | 0x0002 ),
00095 Model_SIMpad_SLC = ( Model_SIMpad | 0x0003 ),
00096 Model_SIMpad_TSinus = ( Model_SIMpad | 0x0004 ),
00097
00098 Model_Ramses = ( 4 << 16 ),
00099
00100 Model_Ramses_All = ( Model_Ramses | 0xffff ),
00101 Model_Ramses_MNCI = ( Model_Ramses | 0x0001 ),
00102 Model_Ramses_MNCIRX = ( Model_Ramses | 0x0002 ),
00103
00104 Model_Yopy = ( 5 << 16 ),
00105
00106 Model_Yopy_All = ( Model_Yopy | 0xffff ),
00107 Model_Yopy_3000 = ( Model_Yopy | 0x0001 ),
00108 Model_Yopy_3500 = ( Model_Yopy | 0x0002 ),
00109 Model_Yopy_3700 = ( Model_Yopy | 0x0003 ),
00110
00111 Model_Beagle = ( 6 << 16 ),
00112
00113 Model_Beagle_All = ( Model_Beagle | 0xffff ),
00114 Model_Beagle_PA100 = ( Model_Beagle | 0x0001 ),
00115
00116 Model_GenuineIntel = ( 7 << 16 ),
00117
00118 Model_MyPal = ( 8 << 16 ),
00119
00120 Model_MyPal_All = ( Model_MyPal | 0xffff ),
00121 Model_MyPal_620 = ( Model_MyPal | 0x0001 ),
00122 Model_MyPal_716 = ( Model_MyPal | 0x0002 ),
00123 Model_MyPal_730 = ( Model_MyPal | 0x0003 )
00124 };
00125
00129 enum OVendor {
00130 Vendor_Unknown,
00131
00132 Vendor_HP,
00133 Vendor_Sharp,
00134 Vendor_SIEMENS,
00135 Vendor_MundN,
00136 Vendor_GMate,
00137 Vendor_MasterIA,
00138 Vendor_GenuineIntel,
00139 Vendor_Asus
00140 };
00141
00145 enum OSystem {
00146 System_Unknown,
00147
00148 System_Familiar,
00149 System_Zaurus,
00150 System_OpenZaurus,
00151 System_Linupy,
00152 System_OpenEmbedded,
00153 System_PC
00154 };
00155
00156 typedef struct {
00157 OSystem system;
00158 char* sysstr;
00159 char* sysvfile;
00160 } ODistribution;
00161
00162 extern ODistribution distributions[];
00163
00164
00165 enum OLedState {
00166 Led_Off,
00167 Led_On,
00168 Led_BlinkSlow,
00169 Led_BlinkFast
00170 };
00171
00172 enum OLed {
00173 Led_Mail,
00174 Led_Power,
00175 Led_BlueTooth
00176 };
00177
00178 enum OHardKey {
00179 HardKey_Datebook = Qt::Key_F9,
00180 HardKey_Contacts = Qt::Key_F10,
00181 HardKey_Menu = Qt::Key_F11,
00182 HardKey_Home = Qt::Key_F12,
00183 HardKey_Mail = Qt::Key_F13,
00184 HardKey_Record = Qt::Key_F24,
00185 HardKey_Suspend = Qt::Key_F34,
00186 HardKey_Backlight = Qt::Key_F35,
00187 HardKey_Action = Qt::Key_F10,
00188 HardKey_OK = Qt::Key_F11,
00189 HardKey_End = Qt::Key_F12,
00190 };
00191
00192 enum ODirection {
00193 CW = 0,
00194 CCW = 1,
00195 Flip = 2,
00196 };
00197
00198 enum OHingeStatus {
00199 CASE_CLOSED = 3,
00200 CASE_PORTRAIT = 2,
00201 CASE_LANDSCAPE = 0,
00202 CASE_UNKNOWN = 1,
00203 };
00204
00205
00206
00207
00208
00209
00210 struct default_button {
00211 Qt::Key code;
00212 char *utext;
00213 char *pix;
00214 char *fpressedservice;
00215 char *fpressedaction;
00216 char *fheldservice;
00217 char *fheldaction;
00218 };
00219
00230 class ODevice : public QObject
00231 {
00232 Q_OBJECT
00233
00234 private:
00235
00236 ODevice ( const ODevice & );
00237
00238 protected:
00239 ODevice();
00240 virtual void init(const QString&);
00241 virtual void initButtons();
00242 static void sendSuspendmsg();
00243
00244 ODeviceData *d;
00245
00246 public:
00247
00248 virtual ~ODevice();
00249 static ODevice *inst();
00250
00251
00252 QString modelString() const;
00253 OModel model() const;
00254 inline OModel series() const { return (OModel) ( model() & Model_Series_Mask ); }
00255
00256 QString vendorString() const;
00257 OVendor vendor() const;
00258
00259 QString systemString() const;
00260 OSystem system() const;
00261
00262 QString systemVersionString() const;
00263
00264 virtual Transformation rotation() const;
00265 virtual ODirection direction() const;
00266
00267 QString qteDriver() const;
00268
00269
00270 virtual bool suspend();
00271
00272 virtual bool setDisplayStatus ( bool on );
00273 virtual bool setDisplayBrightness ( int brightness );
00274 virtual int displayBrightnessResolution() const;
00275 virtual bool setDisplayContrast ( int contrast );
00276 virtual int displayContrastResolution() const;
00277
00278
00279
00280
00281
00282
00283
00284
00285 virtual void playAlarmSound();
00286 virtual void playKeySound();
00287 virtual void playTouchSound();
00288
00289 virtual QValueList <OLed> ledList() const;
00290 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
00291 virtual OLedState ledState ( OLed led ) const;
00292 virtual bool setLedState ( OLed led, OLedState st );
00293
00294 virtual bool hasLightSensor() const;
00295 virtual int readLightSensor();
00296 virtual int lightSensorResolution() const;
00297
00298 virtual bool hasHingeSensor() const;
00299 virtual OHingeStatus readHingeSensor()const;
00300
00301 const QStrList &allowedCpuFrequencies() const;
00302 bool setCurrentCpuFrequency(uint index);
00303
00313 const QValueList<ODeviceButton> &buttons();
00314
00319 const ODeviceButton *buttonForKeycode ( ushort keyCode );
00320
00325 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
00326
00331 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
00332
00336 uint buttonHoldTime() const;
00337
00338 signals:
00339 void buttonMappingChanged();
00340
00341 private slots:
00342 void systemMessage ( const QCString &, const QByteArray & );
00343 void playingStopped();
00344
00345 protected:
00346 void addPreHandler(QWSServer::KeyboardFilter*aFilter);
00347 void remPreHandler(QWSServer::KeyboardFilter*aFilter);
00348 void reloadButtonMapping();
00349 void changeMixerForAlarm( int mixer, const char* file, Sound *snd);
00350
00351
00352 virtual void virtual_hook( int id, void* data );
00353 };
00354
00355 class ODeviceData {
00356
00357 public:
00358 QString m_vendorstr;
00359 OVendor m_vendor;
00360
00361 QString m_modelstr;
00362 OModel m_model;
00363
00364 QString m_systemstr;
00365 OSystem m_system;
00366
00367 QString m_sysverstr;
00368
00369 Transformation m_rotation;
00370 ODirection m_direction;
00371
00372 QString m_qteDriver;
00373
00374 QValueList <ODeviceButton> *m_buttons;
00375 uint m_holdtime;
00376 QStrList *m_cpu_frequencies;
00377 bool m_initializedButtonQcop : 1;
00378
00379
00380 int m_sound, m_vol, m_mixer;
00381 };
00382
00383 extern bool isQWS();
00384 extern QCString makeChannel ( const char *str );
00385 }
00386 }
00387
00388
00389
00390
00391 #endif
00392