-rw-r--r-- | libopie/odevice.cpp | 16 | ||||
-rw-r--r-- | libopie/odevice.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9931684..bc8014a 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -24,32 +24,34 @@ | |||
24 | 24 | ||
25 | 25 | ||
26 | #include "odevice.h" | 26 | #include "odevice.h" |
27 | 27 | ||
28 | 28 | ||
29 | class ODeviceData { | 29 | class ODeviceData { |
30 | public: | 30 | public: |
31 | QString m_vendorstr; | 31 | QString m_vendorstr; |
32 | OVendor m_vendor; | 32 | OVendor m_vendor; |
33 | 33 | ||
34 | QString m_modelstr; | 34 | QString m_modelstr; |
35 | OModel m_model; | 35 | OModel m_model; |
36 | 36 | ||
37 | QString m_systemstr; | 37 | QString m_systemstr; |
38 | OSystem m_system; | 38 | OSystem m_system; |
39 | 39 | ||
40 | QString m_sysverstr; | ||
41 | |||
40 | OLedState m_leds [4]; // just for convenience ... | 42 | OLedState m_leds [4]; // just for convenience ... |
41 | }; | 43 | }; |
42 | 44 | ||
43 | class ODeviceIPAQ : public ODevice { | 45 | class ODeviceIPAQ : public ODevice { |
44 | protected: | 46 | protected: |
45 | virtual void init ( ); | 47 | virtual void init ( ); |
46 | 48 | ||
47 | public: | 49 | public: |
48 | virtual void alarmSound ( ); | 50 | virtual void alarmSound ( ); |
49 | 51 | ||
50 | virtual uint hasLeds ( ) const; | 52 | virtual uint hasLeds ( ) const; |
51 | virtual OLedState led ( uint which ) const; | 53 | virtual OLedState led ( uint which ) const; |
52 | virtual bool setLed ( uint which, OLedState st ); | 54 | virtual bool setLed ( uint which, OLedState st ); |
53 | }; | 55 | }; |
54 | 56 | ||
55 | class ODeviceZaurus : public ODevice { | 57 | class ODeviceZaurus : public ODevice { |
@@ -86,32 +88,33 @@ ODevice *ODevice::inst ( ) | |||
86 | 88 | ||
87 | dev-> init ( ); | 89 | dev-> init ( ); |
88 | } | 90 | } |
89 | return dev; | 91 | return dev; |
90 | } | 92 | } |
91 | 93 | ||
92 | ODevice::ODevice ( ) | 94 | ODevice::ODevice ( ) |
93 | { | 95 | { |
94 | d = new ODeviceData; | 96 | d = new ODeviceData; |
95 | 97 | ||
96 | d-> m_modelstr = "Unknown"; | 98 | d-> m_modelstr = "Unknown"; |
97 | d-> m_model = OMODEL_Unknown; | 99 | d-> m_model = OMODEL_Unknown; |
98 | d-> m_vendorstr = "Unkown"; | 100 | d-> m_vendorstr = "Unkown"; |
99 | d-> m_vendor = OVENDOR_Unknown; | 101 | d-> m_vendor = OVENDOR_Unknown; |
100 | d-> m_systemstr = "Unkown"; | 102 | d-> m_systemstr = "Unkown"; |
101 | d-> m_system = OSYSTEM_Unknown; | 103 | d-> m_system = OSYSTEM_Unknown; |
104 | d-> m_sysverstr = "0.0"; | ||
102 | } | 105 | } |
103 | 106 | ||
104 | void ODevice::init ( ) | 107 | void ODevice::init ( ) |
105 | { | 108 | { |
106 | } | 109 | } |
107 | 110 | ||
108 | ODevice::~ODevice ( ) | 111 | ODevice::~ODevice ( ) |
109 | { | 112 | { |
110 | delete d; | 113 | delete d; |
111 | } | 114 | } |
112 | 115 | ||
113 | QString ODevice::vendorString ( ) | 116 | QString ODevice::vendorString ( ) |
114 | { | 117 | { |
115 | return d-> m_vendorstr; | 118 | return d-> m_vendorstr; |
116 | } | 119 | } |
117 | 120 | ||
@@ -127,32 +130,37 @@ QString ODevice::modelString ( ) | |||
127 | 130 | ||
128 | OModel ODevice::model ( ) | 131 | OModel ODevice::model ( ) |
129 | { | 132 | { |
130 | return d-> m_model; | 133 | return d-> m_model; |
131 | } | 134 | } |
132 | 135 | ||
133 | QString ODevice::systemString ( ) | 136 | QString ODevice::systemString ( ) |
134 | { | 137 | { |
135 | return d-> m_systemstr; | 138 | return d-> m_systemstr; |
136 | } | 139 | } |
137 | 140 | ||
138 | OSystem ODevice::system ( ) | 141 | OSystem ODevice::system ( ) |
139 | { | 142 | { |
140 | return d-> m_system; | 143 | return d-> m_system; |
141 | } | 144 | } |
142 | 145 | ||
146 | QString ODevice::systemVersionString ( ) | ||
147 | { | ||
148 | return d-> m_sysverstr; | ||
149 | } | ||
150 | |||
143 | void ODevice::alarmSound ( ) | 151 | void ODevice::alarmSound ( ) |
144 | { | 152 | { |
145 | #ifndef QT_QWS_EBX | 153 | #ifndef QT_QWS_EBX |
146 | #ifndef QT_NO_SOUND | 154 | #ifndef QT_NO_SOUND |
147 | static Sound snd ( "alarm" ); | 155 | static Sound snd ( "alarm" ); |
148 | 156 | ||
149 | if ( snd. isFinished ( )) | 157 | if ( snd. isFinished ( )) |
150 | snd. play ( ); | 158 | snd. play ( ); |
151 | #endif | 159 | #endif |
152 | #endif | 160 | #endif |
153 | } | 161 | } |
154 | 162 | ||
155 | void ODevice::keySound ( ) | 163 | void ODevice::keySound ( ) |
156 | { | 164 | { |
157 | #ifndef QT_QWS_EBX | 165 | #ifndef QT_QWS_EBX |
158 | #ifndef QT_NO_SOUND | 166 | #ifndef QT_NO_SOUND |
@@ -213,35 +221,41 @@ void ODeviceIPAQ::init ( ) | |||
213 | d-> m_modelstr = "H" + ts. readLine ( ); | 221 | d-> m_modelstr = "H" + ts. readLine ( ); |
214 | 222 | ||
215 | if ( d-> m_modelstr == "H3100" ) | 223 | if ( d-> m_modelstr == "H3100" ) |
216 | d-> m_model = OMODEL_iPAQ_H31xx; | 224 | d-> m_model = OMODEL_iPAQ_H31xx; |
217 | else if ( d-> m_modelstr == "H3600" ) | 225 | else if ( d-> m_modelstr == "H3600" ) |
218 | d-> m_model = OMODEL_iPAQ_H36xx; | 226 | d-> m_model = OMODEL_iPAQ_H36xx; |
219 | else if ( d-> m_modelstr == "H3700" ) | 227 | else if ( d-> m_modelstr == "H3700" ) |
220 | d-> m_model = OMODEL_iPAQ_H37xx; | 228 | d-> m_model = OMODEL_iPAQ_H37xx; |
221 | else if ( d-> m_modelstr == "H3800" ) | 229 | else if ( d-> m_modelstr == "H3800" ) |
222 | d-> m_model = OMODEL_iPAQ_H38xx; | 230 | d-> m_model = OMODEL_iPAQ_H38xx; |
223 | else | 231 | else |
224 | d-> m_model = OMODEL_Unknown; | 232 | d-> m_model = OMODEL_Unknown; |
225 | 233 | ||
226 | f. close ( ); | 234 | f. close ( ); |
227 | } | 235 | } |
228 | 236 | ||
229 | if ( QFile::exists ( "/etc/familiar-version" )) { | 237 | f. setName ( "/etc/familiar-version" ); |
238 | if ( f. open ( IO_ReadOnly )) { | ||
230 | d-> m_systemstr = "Familiar"; | 239 | d-> m_systemstr = "Familiar"; |
231 | d-> m_system = OSYSTEM_Familiar; | 240 | d-> m_system = OSYSTEM_Familiar; |
241 | |||
242 | QTextStream ts ( &f ); | ||
243 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | ||
244 | |||
245 | f. close ( ); | ||
232 | } | 246 | } |
233 | 247 | ||
234 | d-> m_leds [0] = OLED_Off; | 248 | d-> m_leds [0] = OLED_Off; |
235 | } | 249 | } |
236 | 250 | ||
237 | #include <unistd.h> | 251 | #include <unistd.h> |
238 | #include <fcntl.h> | 252 | #include <fcntl.h> |
239 | #include <sys/ioctl.h> | 253 | #include <sys/ioctl.h> |
240 | #include <linux/soundcard.h> | 254 | #include <linux/soundcard.h> |
241 | #include <qapplication.h> | 255 | #include <qapplication.h> |
242 | #include <qpe/config.h> | 256 | #include <qpe/config.h> |
243 | 257 | ||
244 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... | 258 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... |
245 | 259 | ||
246 | typedef struct h3600_ts_led { | 260 | typedef struct h3600_ts_led { |
247 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 261 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
diff --git a/libopie/odevice.h b/libopie/odevice.h index b40abe7..b54e576 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -65,32 +65,33 @@ public: | |||
65 | 65 | ||
66 | public: | 66 | public: |
67 | static ODevice *inst ( ); | 67 | static ODevice *inst ( ); |
68 | 68 | ||
69 | 69 | ||
70 | // information | 70 | // information |
71 | 71 | ||
72 | QString modelString ( ); | 72 | QString modelString ( ); |
73 | OModel model ( ); | 73 | OModel model ( ); |
74 | 74 | ||
75 | QString vendorString ( ); | 75 | QString vendorString ( ); |
76 | OVendor vendor ( ); | 76 | OVendor vendor ( ); |
77 | 77 | ||
78 | QString systemString ( ); | 78 | QString systemString ( ); |
79 | OSystem system ( ); | 79 | OSystem system ( ); |
80 | 80 | ||
81 | QString systemVersionString ( ); | ||
81 | 82 | ||
82 | // input / output | 83 | // input / output |
83 | 84 | ||
84 | virtual void alarmSound ( ); | 85 | virtual void alarmSound ( ); |
85 | virtual void keySound ( ); | 86 | virtual void keySound ( ); |
86 | virtual void touchSound ( ); | 87 | virtual void touchSound ( ); |
87 | 88 | ||
88 | virtual uint hasLeds ( ) const; | 89 | virtual uint hasLeds ( ) const; |
89 | virtual OLedState led ( uint which ) const; | 90 | virtual OLedState led ( uint which ) const; |
90 | virtual bool setLed ( uint which, OLedState st ); | 91 | virtual bool setLed ( uint which, OLedState st ); |
91 | 92 | ||
92 | virtual ~ODevice ( ); | 93 | virtual ~ODevice ( ); |
93 | 94 | ||
94 | protected: | 95 | protected: |
95 | ODevice ( ); | 96 | ODevice ( ); |
96 | virtual void init ( ); | 97 | virtual void init ( ); |