summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index c5342e1..c0b6efa 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1,159 +1,158 @@
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#include <stdlib.h> 20#include <stdlib.h>
21#include <unistd.h> 21#include <unistd.h>
22#include <fcntl.h> 22#include <fcntl.h>
23#include <sys/ioctl.h> 23#include <sys/ioctl.h>
24#include <signal.h> 24#include <signal.h>
25#include <sys/time.h> 25#include <sys/time.h>
26#ifndef QT_NO_SOUND 26#ifndef QT_NO_SOUND
27#include <linux/soundcard.h> 27#include <linux/soundcard.h>
28#endif 28#endif
29#include <math.h> 29#include <math.h>
30 30
31#include <qapplication.h>
32 31
33#include <qfile.h> 32#include <qfile.h>
34#include <qtextstream.h> 33#include <qtextstream.h>
35#include <qpe/sound.h> 34#include <qpe/sound.h>
36#include <qpe/resource.h> 35#include <qpe/resource.h>
37#include <qpe/config.h> 36#include <qpe/config.h>
38#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
39 38
40#include "odevice.h" 39#include "odevice.h"
41 40
42#include <qwindowsystem_qws.h> 41#include <qwindowsystem_qws.h>
43 42
44#ifndef ARRAY_SIZE 43#ifndef ARRAY_SIZE
45#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 44#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
46#endif 45#endif
47 46
48// _IO and friends are only defined in kernel headers ... 47// _IO and friends are only defined in kernel headers ...
49 48
50#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 49#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
51 50
52#define OD_IO(type,number) OD_IOC(0,type,number,0) 51#define OD_IO(type,number) OD_IOC(0,type,number,0)
53#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 52#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
54#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 53#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
55#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 54#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
56 55
57using namespace Opie; 56using namespace Opie;
58 57
59class ODeviceData { 58class ODeviceData {
60public: 59public:
61 QString m_vendorstr; 60 QString m_vendorstr;
62 OVendor m_vendor; 61 OVendor m_vendor;
63 62
64 QString m_modelstr; 63 QString m_modelstr;
65 OModel m_model; 64 OModel m_model;
66 65
67 QString m_systemstr; 66 QString m_systemstr;
68 OSystem m_system; 67 OSystem m_system;
69 68
70 QString m_sysverstr; 69 QString m_sysverstr;
71 70
72 Transformation m_rotation; 71 Transformation m_rotation;
73 ODirection m_direction; 72 ODirection m_direction;
74 73
75 QValueList <ODeviceButton> *m_buttons; 74 QValueList <ODeviceButton> *m_buttons;
76 uint m_holdtime; 75 uint m_holdtime;
77 QStrList *m_cpu_frequencies; 76 QStrList *m_cpu_frequencies;
78 77
79}; 78};
80 79
81class iPAQ : public ODevice, public QWSServer::KeyboardFilter { 80class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
82protected: 81protected:
83 virtual void init ( ); 82 virtual void init ( );
84 virtual void initButtons ( ); 83 virtual void initButtons ( );
85 84
86public: 85public:
87 virtual bool setSoftSuspend ( bool soft ); 86 virtual bool setSoftSuspend ( bool soft );
88 87
89 virtual bool setDisplayBrightness ( int b ); 88 virtual bool setDisplayBrightness ( int b );
90 virtual int displayBrightnessResolution ( ) const; 89 virtual int displayBrightnessResolution ( ) const;
91 90
92 virtual void alarmSound ( ); 91 virtual void alarmSound ( );
93 92
94 virtual QValueList <OLed> ledList ( ) const; 93 virtual QValueList <OLed> ledList ( ) const;
95 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 94 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
96 virtual OLedState ledState ( OLed led ) const; 95 virtual OLedState ledState ( OLed led ) const;
97 virtual bool setLedState ( OLed led, OLedState st ); 96 virtual bool setLedState ( OLed led, OLedState st );
98 97
99 virtual bool hasLightSensor ( ) const; 98 virtual bool hasLightSensor ( ) const;
100 virtual int readLightSensor ( ); 99 virtual int readLightSensor ( );
101 virtual int lightSensorResolution ( ) const; 100 virtual int lightSensorResolution ( ) const;
102 101
103protected: 102protected:
104 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 103 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
105 virtual void timerEvent ( QTimerEvent *te ); 104 virtual void timerEvent ( QTimerEvent *te );
106 105
107 int m_power_timer; 106 int m_power_timer;
108 107
109 OLedState m_leds [2]; 108 OLedState m_leds [2];
110}; 109};
111 110
112class Jornada : public ODevice { 111class Jornada : public ODevice {
113protected: 112protected:
114 virtual void init ( ); 113 virtual void init ( );
115 //virtual void initButtons ( ); 114 //virtual void initButtons ( );
116public: 115public:
117 virtual bool setSoftSuspend ( bool soft ); 116 virtual bool setSoftSuspend ( bool soft );
118 virtual bool setDisplayBrightness ( int b ); 117 virtual bool setDisplayBrightness ( int b );
119 virtual int displayBrightnessResolution ( ) const; 118 virtual int displayBrightnessResolution ( ) const;
120 static bool isJornada(); 119 static bool isJornada();
121 120
122}; 121};
123 122
124class Zaurus : public ODevice { 123class Zaurus : public ODevice {
125protected: 124protected:
126 virtual void init ( ); 125 virtual void init ( );
127 virtual void initButtons ( ); 126 virtual void initButtons ( );
128 127
129public: 128public:
130 virtual bool setSoftSuspend ( bool soft ); 129 virtual bool setSoftSuspend ( bool soft );
131 130
132 virtual bool setDisplayBrightness ( int b ); 131 virtual bool setDisplayBrightness ( int b );
133 virtual int displayBrightnessResolution ( ) const; 132 virtual int displayBrightnessResolution ( ) const;
134 133
135 virtual void alarmSound ( ); 134 virtual void alarmSound ( );
136 virtual void keySound ( ); 135 virtual void keySound ( );
137 virtual void touchSound ( ); 136 virtual void touchSound ( );
138 137
139 virtual QValueList <OLed> ledList ( ) const; 138 virtual QValueList <OLed> ledList ( ) const;
140 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 139 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
141 virtual OLedState ledState ( OLed led ) const; 140 virtual OLedState ledState ( OLed led ) const;
142 virtual bool setLedState ( OLed led, OLedState st ); 141 virtual bool setLedState ( OLed led, OLedState st );
143 142
144 bool hasHingeSensor() const; 143 bool hasHingeSensor() const;
145 OHingeStatus readHingeSensor(); 144 OHingeStatus readHingeSensor();
146 145
147 static bool isZaurus(); 146 static bool isZaurus();
148 147
149 // Does this break BC? 148 // Does this break BC?
150 virtual bool suspend ( ); 149 virtual bool suspend ( );
151 Transformation rotation ( ) const; 150 Transformation rotation ( ) const;
152 ODirection direction ( ) const; 151 ODirection direction ( ) const;
153 152
154protected: 153protected:
155 virtual void buzzer ( int snd ); 154 virtual void buzzer ( int snd );
156 155
157 OLedState m_leds [1]; 156 OLedState m_leds [1];
158 bool m_embedix; 157 bool m_embedix;
159 void virtual_hook( int id, void *data ); 158 void virtual_hook( int id, void *data );