summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-29 15:50:21 (UTC)
committer sandman <sandman>2002-10-29 15:50:21 (UTC)
commitbad66a2ea2aea8bec1c7895b0e1a461e2f4859c2 (patch) (unidiff)
tree6a39587f58ff01456fff0a6d17d5564d28bb4f4f
parent6224d462ef211b3b4cffa42d4a7f261caa92834b (diff)
downloadopie-bad66a2ea2aea8bec1c7895b0e1a461e2f4859c2.zip
opie-bad66a2ea2aea8bec1c7895b0e1a461e2f4859c2.tar.gz
opie-bad66a2ea2aea8bec1c7895b0e1a461e2f4859c2.tar.bz2
added lightSensorResolution() to get the hardware resolution of the light
sensor
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp12
-rw-r--r--libopie/odevice.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 9f64fc0..4c49c4f 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -83,12 +83,13 @@ public:
83 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 83 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
84 virtual OLedState ledState ( OLed led ) const; 84 virtual OLedState ledState ( OLed led ) const;
85 virtual bool setLedState ( OLed led, OLedState st ); 85 virtual bool setLedState ( OLed led, OLedState st );
86 86
87 virtual bool hasLightSensor ( ) const; 87 virtual bool hasLightSensor ( ) const;
88 virtual int readLightSensor ( ); 88 virtual int readLightSensor ( );
89 virtual int lightSensorResolution ( ) const;
89 90
90 //virtual QValueList <int> keyList ( ) const; 91 //virtual QValueList <int> keyList ( ) const;
91 92
92protected: 93protected:
93 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 94 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
94 virtual void timerEvent ( QTimerEvent *te ); 95 virtual void timerEvent ( QTimerEvent *te );
@@ -366,12 +367,16 @@ bool ODevice::hasLightSensor ( ) const
366 367
367int ODevice::readLightSensor ( ) 368int ODevice::readLightSensor ( )
368{ 369{
369 return -1; 370 return -1;
370} 371}
371 372
373int ODevice::lightSensorResolution ( ) const
374{
375 return 0;
376}
372 377
373//QValueList <int> ODevice::keyList ( ) const 378//QValueList <int> ODevice::keyList ( ) const
374//{ 379//{
375 //return QValueList <int> ( ); 380 //return QValueList <int> ( );
376//} 381//}
377 382
@@ -679,14 +684,13 @@ int iPAQ::displayBrightnessResolution ( ) const
679 684
680 685
681bool iPAQ::hasLightSensor ( ) const 686bool iPAQ::hasLightSensor ( ) const
682{ 687{
683 return true; 688 return true;
684} 689}
685#include <errno.h> 690
686#include <string.h>
687int iPAQ::readLightSensor ( ) 691int iPAQ::readLightSensor ( )
688{ 692{
689 int fd; 693 int fd;
690 int val = -1; 694 int val = -1;
691 695
692 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { 696 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) {
@@ -704,12 +708,16 @@ int iPAQ::readLightSensor ( )
704 ::close ( fd ); 708 ::close ( fd );
705 } 709 }
706 710
707 return val; 711 return val;
708} 712}
709 713
714int iPAQ::lightSensorResolution ( ) const
715{
716 return 256;
717}
710 718
711/************************************************** 719/**************************************************
712 * 720 *
713 * Zaurus 721 * Zaurus
714 * 722 *
715 **************************************************/ 723 **************************************************/
diff --git a/libopie/odevice.h b/libopie/odevice.h
index be2a9c7..e07b91c 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -132,12 +132,13 @@ public:
132 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 132 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
133 virtual OLedState ledState ( OLed led ) const; 133 virtual OLedState ledState ( OLed led ) const;
134 virtual bool setLedState ( OLed led, OLedState st ); 134 virtual bool setLedState ( OLed led, OLedState st );
135 135
136 virtual bool hasLightSensor ( ) const; 136 virtual bool hasLightSensor ( ) const;
137 virtual int readLightSensor ( ); 137 virtual int readLightSensor ( );
138 virtual int lightSensorResolution ( ) const;
138 139
139 //virtual QValueList <int> keyList ( ) const; 140 //virtual QValueList <int> keyList ( ) const;
140}; 141};
141 142
142} 143}
143 144