summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp55
-rw-r--r--libopie/odevice.h10
2 files changed, 54 insertions, 11 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index d39d72f..78eb416 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -56,24 +56,26 @@ public:
56 bool m_qwsserver; 56 bool m_qwsserver;
57 57
58 QString m_vendorstr; 58 QString m_vendorstr;
59 OVendor m_vendor; 59 OVendor m_vendor;
60 60
61 QString m_modelstr; 61 QString m_modelstr;
62 OModel m_model; 62 OModel m_model;
63 63
64 QString m_systemstr; 64 QString m_systemstr;
65 OSystem m_system; 65 OSystem m_system;
66 66
67 QString m_sysverstr; 67 QString m_sysverstr;
68
69 Transformation m_rotation;
68 70
69 QValueList <ODeviceButton> m_buttons; 71 QValueList <ODeviceButton> m_buttons;
70 uint m_holdtime; 72 uint m_holdtime;
71}; 73};
72 74
73 75
74class iPAQ : public ODevice, public QWSServer::KeyboardFilter { 76class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
75protected: 77protected:
76 virtual void init ( ); 78 virtual void init ( );
77 79
78public: 80public:
79 virtual bool setSoftSuspend ( bool soft ); 81 virtual bool setSoftSuspend ( bool soft );
@@ -240,24 +242,25 @@ ODevice::ODevice ( )
240{ 242{
241 d = new ODeviceData; 243 d = new ODeviceData;
242 244
243 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 245 d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
244 246
245 d-> m_modelstr = "Unknown"; 247 d-> m_modelstr = "Unknown";
246 d-> m_model = Model_Unknown; 248 d-> m_model = Model_Unknown;
247 d-> m_vendorstr = "Unknown"; 249 d-> m_vendorstr = "Unknown";
248 d-> m_vendor = Vendor_Unknown; 250 d-> m_vendor = Vendor_Unknown;
249 d-> m_systemstr = "Unknown"; 251 d-> m_systemstr = "Unknown";
250 d-> m_system = System_Unknown; 252 d-> m_system = System_Unknown;
251 d-> m_sysverstr = "0.0"; 253 d-> m_sysverstr = "0.0";
254 d-> m_rotation = None;
252 255
253 d-> m_holdtime = 1000; // 1000ms 256 d-> m_holdtime = 1000; // 1000ms
254 257
255 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 258 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
256 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 259 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
257} 260}
258 261
259void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 262void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
260{ 263{
261 if ( msg == "deviceButtonMappingChanged()" ) { 264 if ( msg == "deviceButtonMappingChanged()" ) {
262 reloadButtonMapping ( ); 265 reloadButtonMapping ( );
263 } 266 }
@@ -391,24 +394,29 @@ QString ODevice::systemString ( ) const
391} 394}
392 395
393OSystem ODevice::system ( ) const 396OSystem ODevice::system ( ) const
394{ 397{
395 return d-> m_system; 398 return d-> m_system;
396} 399}
397 400
398QString ODevice::systemVersionString ( ) const 401QString ODevice::systemVersionString ( ) const
399{ 402{
400 return d-> m_sysverstr; 403 return d-> m_sysverstr;
401} 404}
402 405
406Transformation ODevice::rotation ( ) const
407{
408 return d-> m_rotation;
409}
410
403void ODevice::alarmSound ( ) 411void ODevice::alarmSound ( )
404{ 412{
405#ifndef QT_NO_SOUND 413#ifndef QT_NO_SOUND
406 static Sound snd ( "alarm" ); 414 static Sound snd ( "alarm" );
407 415
408 if ( snd. isFinished ( )) 416 if ( snd. isFinished ( ))
409 snd. play ( ); 417 snd. play ( );
410#endif 418#endif
411} 419}
412 420
413void ODevice::keySound ( ) 421void ODevice::keySound ( )
414{ 422{
@@ -578,24 +586,37 @@ void iPAQ::init ( )
578 else if ( d-> m_modelstr == "H3700" ) 586 else if ( d-> m_modelstr == "H3700" )
579 d-> m_model = Model_iPAQ_H37xx; 587 d-> m_model = Model_iPAQ_H37xx;
580 else if ( d-> m_modelstr == "H3800" ) 588 else if ( d-> m_modelstr == "H3800" )
581 d-> m_model = Model_iPAQ_H38xx; 589 d-> m_model = Model_iPAQ_H38xx;
582 else if ( d-> m_modelstr == "H3900" ) 590 else if ( d-> m_modelstr == "H3900" )
583 d-> m_model = Model_iPAQ_H39xx; 591 d-> m_model = Model_iPAQ_H39xx;
584 else 592 else
585 d-> m_model = Model_Unknown; 593 d-> m_model = Model_Unknown;
586 594
587 f. close ( ); 595 f. close ( );
588 } 596 }
589 597
598 switch ( d-> m_model ) {
599 case Model_iPAQ_H31xx:
600 case Model_iPAQ_H38xx:
601 d-> m_rotation = Rot90;
602 break;
603 case Model_iPAQ_H36xx:
604 case Model_iPAQ_H37xx:
605 case Model_iPAQ_H39xx:
606 default:
607 d-> m_rotation = Rot270;
608 break;
609 }
610
590 f. setName ( "/etc/familiar-version" ); 611 f. setName ( "/etc/familiar-version" );
591 if ( f. open ( IO_ReadOnly )) { 612 if ( f. open ( IO_ReadOnly )) {
592 d-> m_systemstr = "Familiar"; 613 d-> m_systemstr = "Familiar";
593 d-> m_system = System_Familiar; 614 d-> m_system = System_Familiar;
594 615
595 QTextStream ts ( &f ); 616 QTextStream ts ( &f );
596 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 617 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
597 618
598 f. close ( ); 619 f. close ( );
599 } 620 }
600 621
601 m_leds [0] = m_leds [1] = Led_Off; 622 m_leds [0] = m_leds [1] = Led_Off;
@@ -632,25 +653,24 @@ typedef struct {
632} LED_IN; 653} LED_IN;
633 654
634typedef struct { 655typedef struct {
635 unsigned char mode; 656 unsigned char mode;
636 unsigned char pwr; 657 unsigned char pwr;
637 unsigned char brightness; 658 unsigned char brightness;
638} FLITE_IN; 659} FLITE_IN;
639 660
640#define LED_ON OD_IOW( 'f', 5, LED_IN ) 661#define LED_ON OD_IOW( 'f', 5, LED_IN )
641#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 662#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
642 663
643 664
644
645QValueList <OLed> iPAQ::ledList ( ) const 665QValueList <OLed> iPAQ::ledList ( ) const
646{ 666{
647 QValueList <OLed> vl; 667 QValueList <OLed> vl;
648 vl << Led_Power; 668 vl << Led_Power;
649 669
650 if ( d-> m_model == Model_iPAQ_H38xx ) 670 if ( d-> m_model == Model_iPAQ_H38xx )
651 vl << Led_BlueTooth; 671 vl << Led_BlueTooth;
652 return vl; 672 return vl;
653} 673}
654 674
655QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const 675QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
656{ 676{
@@ -928,35 +948,54 @@ void Zaurus::init ( )
928 } 948 }
929 } 949 }
930 else { 950 else {
931 d-> m_systemstr = "Zaurus"; 951 d-> m_systemstr = "Zaurus";
932 d-> m_system = System_Zaurus; 952 d-> m_system = System_Zaurus;
933 } 953 }
934 954
935 f. setName ( "/proc/deviceinfo/product" ); 955 f. setName ( "/proc/deviceinfo/product" );
936 if ( f. open ( IO_ReadOnly ) ) { 956 if ( f. open ( IO_ReadOnly ) ) {
937 QTextStream ts ( &f ); 957 QTextStream ts ( &f );
938 QString model = ts. readLine ( ); 958 QString model = ts. readLine ( );
939 f. close ( ); 959 f. close ( );
940 if ( model == "SL-5000D" ) { 960
941 d-> m_model = Model_Zaurus_SL5000; 961 d-> m_modelstr = QString("Zaurus ") + model;
942 d-> m_modelstr = "Zaurus SL-5000D"; 962 if ( model == "SL-5500" )
943 } else if ( model == "SL-5500" ) {
944 d-> m_model = Model_Zaurus_SL5500; 963 d-> m_model = Model_Zaurus_SL5500;
945 d-> m_modelstr = "Zaurus SL-5500"; 964 else if ( model == "SL-C700" )
946 } 965 d-> m_model = Model_Zaurus_SLC700;
966 else if ( model == "SL-A300" )
967 d-> m_model = Model_Zaurus_SLA300;
968 else if ( model == "SL-B600" || model == "SL-5600" )
969 d-> m_model = Model_Zaurus_SLB600;
970 else
971 d-> m_model = Model_Zaurus_SL5000;
947 } 972 }
948 else { 973 else {
949 d-> m_model = Model_Zaurus_SL5000; 974 d-> m_model = Model_Zaurus_SL5000;
950 d-> m_modelstr = "Zaurus SL-5000D (unverified)"; 975 d-> m_modelstr = "Zaurus (model unknown)";
976 }
977
978 switch ( d-> m_model ) {
979 case Model_Zaurus_SLC700:
980 /* note for C700, we must check the display rotation
981 * sensor to set an appropriate value
982 */
983 case Model_Zaurus_SLA300:
984 case Model_Zaurus_SLB600:
985 case Model_Zaurus_SL5500:
986 case Model_Zaurus_SL5000:
987 default:
988 d-> m_rotation = Rot270;
989 break;
951 } 990 }
952 991
953 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { 992 for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) {
954 z_button *zb = z_buttons + i; 993 z_button *zb = z_buttons + i;
955 ODeviceButton b; 994 ODeviceButton b;
956 995
957 b. setKeycode ( zb-> code ); 996 b. setKeycode ( zb-> code );
958 b. setUserText ( qApp-> translate ( "Button", zb-> utext )); 997 b. setUserText ( qApp-> translate ( "Button", zb-> utext ));
959 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 998 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
960 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction )); 999 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), zb-> fpressedaction ));
961 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction )); 1000 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), zb-> fheldaction ));
962 1001
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 54b85a2..8164c4d 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -17,46 +17,51 @@
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _LIBOPIE_ODEVICE_H_ 20#ifndef _LIBOPIE_ODEVICE_H_
21#define _LIBOPIE_ODEVICE_H_ 21#define _LIBOPIE_ODEVICE_H_
22 22
23#include <qobject.h> 23#include <qobject.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qnamespace.h> 25#include <qnamespace.h>
26 26
27#include <opie/odevicebutton.h> 27#include <opie/odevicebutton.h>
28 28
29enum Transformation { None, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */
30
29class ODeviceData; 31class ODeviceData;
30 32
31namespace Opie { 33namespace Opie {
32 34
33enum OModel { 35enum OModel {
34 Model_Unknown, 36 Model_Unknown,
35 37
36 Model_Series_Mask = 0xff000000, 38 Model_Series_Mask = 0xff000000,
37 39
38 Model_iPAQ = ( 1 << 24 ), 40 Model_iPAQ = ( 1 << 24 ),
39 41
40 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), 42 Model_iPAQ_All = ( Model_iPAQ | 0xffffff ),
41 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), 43 Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ),
42 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), 44 Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ),
43 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), 45 Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ),
44 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), 46 Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ),
45 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), 47 Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ),
46 48
47 Model_Zaurus = ( 2 << 24 ), 49 Model_Zaurus = ( 2 << 24 ),
48 50
49 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), 51 Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ),
50 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ), 52 Model_Zaurus_SL5500 = ( Model_Zaurus | 0x000002 ),
53 Model_Zaurus_SLA300 = ( Model_Zaurus | 0x000003 ),
54 Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ),
55 Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ),
51}; 56};
52 57
53 enum OVendor { 58 enum OVendor {
54 Vendor_Unknown, 59 Vendor_Unknown,
55 60
56 Vendor_HP, 61 Vendor_HP,
57 Vendor_Sharp 62 Vendor_Sharp
58 }; 63 };
59 64
60enum OSystem { 65enum OSystem {
61 System_Unknown, 66 System_Unknown,
62 67
@@ -80,58 +85,57 @@ enum OLed {
80 85
81enum OHardKey { 86enum OHardKey {
82 HardKey_Datebook = Qt::Key_F9, 87 HardKey_Datebook = Qt::Key_F9,
83 HardKey_Contacts = Qt::Key_F10, 88 HardKey_Contacts = Qt::Key_F10,
84 HardKey_Menu = Qt::Key_F11, 89 HardKey_Menu = Qt::Key_F11,
85 HardKey_Home = Qt::Key_F12, 90 HardKey_Home = Qt::Key_F12,
86 HardKey_Mail = Qt::Key_F13, 91 HardKey_Mail = Qt::Key_F13,
87 HardKey_Record = Qt::Key_F24, 92 HardKey_Record = Qt::Key_F24,
88 HardKey_Suspend = Qt::Key_F34, 93 HardKey_Suspend = Qt::Key_F34,
89 HardKey_Backlight = Qt::Key_F35, 94 HardKey_Backlight = Qt::Key_F35,
90}; 95};
91 96
92
93class ODevice : public QObject { 97class ODevice : public QObject {
94 Q_OBJECT 98 Q_OBJECT
95 99
96private: 100private:
97 ODevice ( const ODevice & ); 101 ODevice ( const ODevice & );
98 102
99protected: 103protected:
100 ODevice ( ); 104 ODevice ( );
101 virtual void init ( ); 105 virtual void init ( );
102 106
103 ODeviceData *d; 107 ODeviceData *d;
104 108
105public: 109public:
106 virtual ~ODevice ( ); 110 virtual ~ODevice ( );
107 111
108 static ODevice *inst ( ); 112 static ODevice *inst ( );
109 113
110
111
112// information 114// information
113 115
114 QString modelString ( ) const; 116 QString modelString ( ) const;
115 OModel model ( ) const; 117 OModel model ( ) const;
116 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } 118 inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); }
117 119
118 QString vendorString ( ) const; 120 QString vendorString ( ) const;
119 OVendor vendor ( ) const; 121 OVendor vendor ( ) const;
120 122
121 QString systemString ( ) const; 123 QString systemString ( ) const;
122 OSystem system ( ) const; 124 OSystem system ( ) const;
123 125
124 QString systemVersionString ( ) const; 126 QString systemVersionString ( ) const;
125 127
128 Transformation rotation ( ) const;
129
126 // system 130 // system
127 131
128 virtual bool setSoftSuspend ( bool on ); 132 virtual bool setSoftSuspend ( bool on );
129 virtual bool suspend ( ); 133 virtual bool suspend ( );
130 134
131 virtual bool setDisplayStatus ( bool on ); 135 virtual bool setDisplayStatus ( bool on );
132 virtual bool setDisplayBrightness ( int brightness ); 136 virtual bool setDisplayBrightness ( int brightness );
133 virtual int displayBrightnessResolution ( ) const; 137 virtual int displayBrightnessResolution ( ) const;
134 138
135// input / output 139// input / output
136 140
137 virtual void alarmSound ( ); 141 virtual void alarmSound ( );