00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _LIBOPIE_ODEVICE_H_
00022 #define _LIBOPIE_ODEVICE_H_
00023
00024 #include <qobject.h>
00025 #include <qstring.h>
00026 #include <qnamespace.h>
00027 #include <qstrlist.h>
00028
00029 #include <opie/odevicebutton.h>
00030
00031 #include <qpe/qpeapplication.h>
00032
00033 class ODeviceData;
00034
00035 namespace Opie {
00036
00040 enum OModel {
00041 Model_Unknown,
00042
00043 Model_Series_Mask = 0xff000000,
00044
00045 Model_iPAQ = ( 1 << 24 ),
00046
00047 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
00048 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
00049 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
00050 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
00051 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
00052 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
00053 Model_iPAQ_H5xxx = ( Model_iPAQ | 0x000011 ),
00054
00055 Model_Jornada = ( 6 << 24 ),
00056 Model_Jornada_56x = ( Model_Jornada | 0x000001 ),
00057
00058 Model_Zaurus = ( 2 << 24 ),
00059
00060 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
00061 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
00062 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
00063 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
00064 Model_Zaurus_SLC7x0 = ( Model_Zaurus | 0x000005 ),
00065
00066 Model_SIMpad = ( 3 << 24 ),
00067
00068 Model_SIMpad_All = ( Model_SIMpad | 0xffffff ),
00069 Model_SIMpad_CL4 = ( Model_SIMpad | 0x000001 ),
00070 Model_SIMpad_SL4 = ( Model_SIMpad | 0x000002 ),
00071 Model_SIMpad_SLC = ( Model_SIMpad | 0x000004 ),
00072 Model_SIMpad_TSinus = ( Model_SIMpad | 0x000008 ),
00073
00074 Model_Ramses = ( 4 << 24 ),
00075
00076 Model_Ramses_All = ( Model_Ramses | 0xffffff ),
00077 Model_Ramses_MNCI = ( Model_Ramses | 0x000001 ),
00078
00079 Model_Yopy = ( 5 << 24 ),
00080
00081 Model_Yopy_All = ( Model_Yopy | 0xffffff ),
00082 Model_Yopy_3000 = ( Model_Yopy | 0x000001 ),
00083 Model_Yopy_3500 = ( Model_Yopy | 0x000002 ),
00084 Model_Yopy_3700 = ( Model_Yopy | 0x000003 ),
00085
00086 };
00087
00091 enum OVendor {
00092 Vendor_Unknown,
00093
00094 Vendor_HP,
00095 Vendor_Sharp,
00096 Vendor_SIEMENS,
00097 Vendor_MundN,
00098 Vendor_GMate,
00099 };
00100
00104 enum OSystem {
00105 System_Unknown,
00106
00107 System_Familiar,
00108 System_Zaurus,
00109 System_OpenZaurus,
00110 System_Linupy,
00111 };
00112
00113 enum OLedState {
00114 Led_Off,
00115 Led_On,
00116 Led_BlinkSlow,
00117 Led_BlinkFast
00118 };
00119
00120 enum OLed {
00121 Led_Mail,
00122 Led_Power,
00123 Led_BlueTooth
00124 };
00125
00126 enum OHardKey {
00127 HardKey_Datebook = Qt::Key_F9,
00128 HardKey_Contacts = Qt::Key_F10,
00129 HardKey_Menu = Qt::Key_F11,
00130 HardKey_Home = Qt::Key_F12,
00131 HardKey_Mail = Qt::Key_F13,
00132 HardKey_Record = Qt::Key_F24,
00133 HardKey_Suspend = Qt::Key_F34,
00134 HardKey_Backlight = Qt::Key_F35,
00135 HardKey_Action = Qt::Key_F10,
00136 HardKey_OK = Qt::Key_F11,
00137 HardKey_End = Qt::Key_F12,
00138 };
00139
00140 enum ODirection {
00141 CW = 0,
00142 CCW = 1,
00143 Flip = 2,
00144 };
00145
00146 enum OHingeStatus {
00147 CASE_CLOSED = 3,
00148 CASE_PORTRAIT = 2,
00149 CASE_LANDSCAPE = 0,
00150 CASE_UNKNOWN = 1,
00151 };
00152
00163 class ODevice : public QObject {
00164 Q_OBJECT
00165
00166 private:
00167
00168 ODevice ( const ODevice & );
00169
00170 protected:
00171 ODevice ( );
00172 virtual void init ( );
00173 virtual void initButtons ( );
00174
00175 ODeviceData *d;
00176
00177 public:
00178
00179 virtual ~ODevice ( );
00180
00181 static ODevice *inst ( );
00182
00183
00184
00185 QString modelString ( ) const;
00186 OModel model ( ) const;
00187 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); }
00188
00189 QString vendorString ( ) const;
00190 OVendor vendor ( ) const;
00191
00192 QString systemString ( ) const;
00193 OSystem system ( ) const;
00194
00195 QString systemVersionString ( ) const;
00196
00197 virtual Transformation rotation ( ) const;
00198 virtual ODirection direction ( ) const;
00199
00200
00201
00202 virtual bool setSoftSuspend ( bool on );
00203 virtual bool suspend ( );
00204
00205 virtual bool setDisplayStatus ( bool on );
00206 virtual bool setDisplayBrightness ( int brightness );
00207 virtual int displayBrightnessResolution ( ) const;
00208 virtual bool setDisplayContrast ( int contrast );
00209 virtual int displayContrastResolution ( ) const;
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 virtual void alarmSound ( );
00220 virtual void keySound ( );
00221 virtual void touchSound ( );
00222
00223 virtual QValueList <OLed> ledList ( ) const;
00224 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
00225 virtual OLedState ledState ( OLed led ) const;
00226 virtual bool setLedState ( OLed led, OLedState st );
00227
00228 virtual bool hasLightSensor ( ) const;
00229 virtual int readLightSensor ( );
00230 virtual int lightSensorResolution ( ) const;
00231
00232 virtual bool hasHingeSensor ( ) const;
00233 virtual OHingeStatus readHingeSensor ( );
00234
00235 const QStrList &allowedCpuFrequencies() const;
00236 bool setCurrentCpuFrequency(uint index);
00237
00246 const QValueList<ODeviceButton> &buttons ( ) ;
00247
00252 const ODeviceButton *buttonForKeycode ( ushort keyCode );
00253
00258 void remapPressedAction ( int button, const OQCopMessage &qcopMessage );
00259
00264 void remapHeldAction ( int button, const OQCopMessage &qcopMessage );
00265
00269 uint buttonHoldTime ( ) const;
00270
00271 signals:
00272 void buttonMappingChanged ( );
00273
00274 private slots:
00275 void systemMessage ( const QCString &, const QByteArray & );
00276
00277 protected:
00278 void reloadButtonMapping ( );
00279
00280 virtual void virtual_hook( int id, void* data );
00281 };
00282
00283 }
00284
00285 #endif
00286