diff options
Diffstat (limited to 'gui/blanktimer.hpp')
-rw-r--r-- | gui/blanktimer.hpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/gui/blanktimer.hpp b/gui/blanktimer.hpp index c8159f643..5e617901f 100644 --- a/gui/blanktimer.hpp +++ b/gui/blanktimer.hpp @@ -19,7 +19,6 @@ #ifndef __BLANKTIMER_HEADER_HPP #define __BLANKTIMER_HEADER_HPP -#include <pthread.h> #include <sys/time.h> using namespace std; @@ -27,32 +26,29 @@ using namespace std; class blanktimer { public: - blanktimer(void); + blanktimer(); - int setTimerThread(void); - void resetTimerAndUnblank(void); + // set timeout in seconds void setTime(int newtime); - bool IsScreenOff(); -private: - typedef int (blanktimer::*ThreadPtr)(void); - typedef void* (*PThreadPtr)(void*); + // call this in regular intervals + void checkForTimeout(); + + // call this when an input event is received or when an operation is finished + void resetTimerAndUnblank(); - void setConBlank(int blank); + bool isScreenOff(); + +private: void setTimer(void); - timespec getTimer(void); string getBrightness(void); - int setBrightness(int brightness); - int setBlankTimer(void); - int setClockTimer(void); - pthread_mutex_t conblankmutex; - pthread_mutex_t timermutex; - int conblank; + pthread_mutex_t mutex; + enum State { kOn = 0, kDim = 1, kOff = 2, kBlanked = 3 }; + State state; timespec btimer; - unsigned long long sleepTimer; + long sleepTimer; string orig_brightness; - bool screenoff; }; extern blanktimer blankTimer; |