summaryrefslogtreecommitdiff
path: root/light/Light.h
diff options
context:
space:
mode:
Diffstat (limited to 'light/Light.h')
-rw-r--r--light/Light.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/light/Light.h b/light/Light.h
new file mode 100644
index 0000000..eac99bc
--- /dev/null
+++ b/light/Light.h
@@ -0,0 +1,40 @@
+#ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
+#define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
+
+#include <android/hardware/light/2.0/ILight.h>
+#include <hidl/Status.h>
+
+#include <fstream>
+#include <mutex>
+#include <unordered_map>
+
+namespace android {
+namespace hardware {
+namespace light {
+namespace V2_0 {
+namespace implementation {
+
+struct Light : public ILight {
+ Light(std::ofstream&& backlight, std::ofstream&& led);
+
+ // Methods from ::android::hardware::light::V2_0::ILight follow.
+ Return<Status> setLight(Type type, const LightState& state) override;
+ Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
+
+private:
+ void setBacklight(const LightState& state);
+ void setNotificationLight(const LightState& state);
+
+ std::ofstream mBacklight;
+ std::ofstream mLed;
+
+ std::unordered_map<Type, std::function<void(const LightState&)>> mLights;
+ std::mutex mLock;
+};
+} // namespace implementation
+} // namespace V2_0
+} // namespace light
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H