summaryrefslogtreecommitdiffstats
path: root/gui/blanktimer.hpp
diff options
context:
space:
mode:
authorthat <github@that.at>2015-01-11 12:16:53 +0100
committerthat <github@that.at>2015-01-11 12:16:53 +0100
commitfb759d45f5c95e3184ffc9c35b57a0a463a6d1ab (patch)
tree66389b15099bbdc842b30b9863bc182ff6513337 /gui/blanktimer.hpp
parentFix restore of images for mtd and bml nand (diff)
downloadandroid_bootable_recovery-fb759d45f5c95e3184ffc9c35b57a0a463a6d1ab.tar
android_bootable_recovery-fb759d45f5c95e3184ffc9c35b57a0a463a6d1ab.tar.gz
android_bootable_recovery-fb759d45f5c95e3184ffc9c35b57a0a463a6d1ab.tar.bz2
android_bootable_recovery-fb759d45f5c95e3184ffc9c35b57a0a463a6d1ab.tar.lz
android_bootable_recovery-fb759d45f5c95e3184ffc9c35b57a0a463a6d1ab.tar.xz
android_bootable_recovery-fb759d45f5c95e3184ffc9c35b57a0a463a6d1ab.tar.zst
android_bootable_recovery-fb759d45f5c95e3184ffc9c35b57a0a463a6d1ab.zip
Diffstat (limited to '')
-rw-r--r--gui/blanktimer.hpp32
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;