libopie API Documentation

odevice.h

00001 /*  This file is part of the OPIE libraries
00002     Copyright (C) 2002 Robert Griebl (sandman@handhelds.org)
00003     Copyright (C) 2003 Holger 'zecke' Freyther (zecke@handhelds.org)
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
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> /* for Transformation enum.. */
00032 
00033 class ODeviceData;
00034 
00035 namespace Opie {
00036 
00040 enum OModel {
00041         Model_Unknown, // = 0
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         /* disable copy */
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     // sandman do we want to allow destructions? -zecke?
00179     virtual ~ODevice ( );
00180 
00181     static ODevice *inst ( );
00182 
00183     // information
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 // system
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     // don't add new virtual methods, use this:
00212     //  /*virtual */ void boo(int i ) { return virtual_hook(1,&i); };
00213     // and in your subclass do do overwrite
00214     //  protected virtual int virtual_hook(int, void *)
00215     // which is defined below
00216 
00217     // input / output
00218     //FIXME playAlarmSound and al might be better -zecke
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         /*  ugly virtual hook */
00280         virtual void virtual_hook( int id, void* data );
00281 };
00282 
00283 }
00284 
00285 #endif
00286 
KDE Logo
This file is part of the documentation for OPIE Version 1.1.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:43 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001