Diffstat (limited to 'libopie2/opiecore/device/odevice_ipaq.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 55 |
1 files changed, 3 insertions, 52 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index d928806..d68bce1 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -18,25 +18,25 @@ | |||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice.h" | 30 | #include "odevice_ipaq.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
@@ -44,98 +44,49 @@ | |||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #ifndef ARRAY_SIZE | 56 | /* KERNEL */ |
57 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
58 | #endif | ||
59 | |||
60 | // _IO and friends are only defined in kernel headers ... | ||
61 | |||
62 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 57 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
63 | 58 | ||
64 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 59 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
65 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 60 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
66 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) | 61 | #define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) |
67 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 62 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
68 | 63 | ||
69 | typedef struct { | 64 | typedef struct { |
70 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 65 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
71 | unsigned char TotalTime; /* Units of 5 seconds */ | 66 | unsigned char TotalTime; /* Units of 5 seconds */ |
72 | unsigned char OnTime; /* units of 100m/s */ | 67 | unsigned char OnTime; /* units of 100m/s */ |
73 | unsigned char OffTime; /* units of 100m/s */ | 68 | unsigned char OffTime; /* units of 100m/s */ |
74 | } LED_IN; | 69 | } LED_IN; |
75 | 70 | ||
76 | typedef struct { | 71 | typedef struct { |
77 | unsigned char mode; | 72 | unsigned char mode; |
78 | unsigned char pwr; | 73 | unsigned char pwr; |
79 | unsigned char brightness; | 74 | unsigned char brightness; |
80 | } FLITE_IN; | 75 | } FLITE_IN; |
81 | 76 | ||
82 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 77 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
83 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 78 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
84 | 79 | ||
85 | using namespace Opie; | 80 | struct i_button ipaq_buttons [] = { |
86 | |||
87 | class iPAQ : public ODevice, public QWSServer::KeyboardFilter | ||
88 | { | ||
89 | |||
90 | protected: | ||
91 | virtual void init(); | ||
92 | virtual void initButtons(); | ||
93 | |||
94 | public: | ||
95 | virtual bool setSoftSuspend( bool soft ); | ||
96 | |||
97 | virtual bool setDisplayBrightness( int b ); | ||
98 | virtual int displayBrightnessResolution() const; | ||
99 | |||
100 | virtual void alarmSound(); | ||
101 | |||
102 | virtual QValueList <OLed> ledList() const; | ||
103 | virtual QValueList <OLedState> ledStateList( OLed led ) const; | ||
104 | virtual OLedState ledState( OLed led ) const; | ||
105 | virtual bool setLedState( OLed led, OLedState st ); | ||
106 | |||
107 | virtual bool hasLightSensor() const; | ||
108 | virtual int readLightSensor(); | ||
109 | virtual int lightSensorResolution() const; | ||
110 | |||
111 | protected: | ||
112 | virtual bool filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); | ||
113 | virtual void timerEvent( QTimerEvent *te ); | ||
114 | |||
115 | int m_power_timer; | ||
116 | |||
117 | OLedState m_leds [2]; | ||
118 | }; | ||
119 | |||
120 | struct i_button { | ||
121 | uint model; | ||
122 | Qt::Key code; | ||
123 | char *utext; | ||
124 | char *pix; | ||
125 | char *fpressedservice; | ||
126 | char *fpressedaction; | ||
127 | char *fheldservice; | ||
128 | char *fheldaction; | ||
129 | } ipaq_buttons [] = { | ||
130 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 81 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
131 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 82 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
132 | "devicebuttons/ipaq_calendar", | 83 | "devicebuttons/ipaq_calendar", |
133 | "datebook", "nextView()", | 84 | "datebook", "nextView()", |
134 | "today", "raise()" }, | 85 | "today", "raise()" }, |
135 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, | 86 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, |
136 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 87 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
137 | "devicebuttons/ipaq_contact", | 88 | "devicebuttons/ipaq_contact", |
138 | "addressbook", "raise()", | 89 | "addressbook", "raise()", |
139 | "addressbook", "beamBusinessCard()" }, | 90 | "addressbook", "beamBusinessCard()" }, |
140 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 91 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
141 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 92 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |