aboutsummaryrefslogtreecommitdiff
path: root/brightness_ctrl.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2018-04-09 22:42:45 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2018-04-09 22:42:45 +0800
commit6bdb9028af9a5256fbb47b942843e49aef7e3aa1 (patch)
treea2346e35e36a3fcb016cb7ab65bcbcb84dede1bf /brightness_ctrl.hpp
downloadlightsd-6bdb9028af9a5256fbb47b942843e49aef7e3aa1.tar.xz
Initial commit.
Diffstat (limited to 'brightness_ctrl.hpp')
-rw-r--r--brightness_ctrl.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/brightness_ctrl.hpp b/brightness_ctrl.hpp
new file mode 100644
index 0000000..4a94e0b
--- /dev/null
+++ b/brightness_ctrl.hpp
@@ -0,0 +1,35 @@
+#ifndef BRIGHTNESS_CTRL_HPP
+#define BRIGHTNESS_CTRL_HPP
+#include <chrono>
+#include <condition_variable>
+#include <experimental/filesystem>
+#include <thread>
+#include <vector>
+#include "sensor_als.hpp"
+namespace filesystem=std::experimental::filesystem::v1;
+class BrightnessControl
+{
+private:
+ filesystem::path cpath,brpath,maxbrpath;
+ std::vector<int> thresh,value;
+ int delay,direction,br,maxbr,tr,offset;
+ size_t cur;
+ SensorALS *als;
+ std::mutex interrupt_m,threshnotify_m;
+ std::condition_variable interrupt,threshnotify;
+ void _brightness_slide(int p);
+public:
+ void init(float initv,SensorALS *s);
+ void set_path(filesystem::path p);
+ void set_thresh(std::vector<int> _th);
+ void set_value(std::vector<int> _v);
+ void set_delay(int _d);
+ void set_trigrange(int _tr);
+
+ void set_offset(int rel,int off);
+
+ void on_sensor_report(float v);
+ void brightness_slide(int p);
+ void worker();
+};
+#endif