diff options
| author | Hashbang173 <hashbang173@gmail.com> | 2018-04-07 11:54:16 -0400 |
|---|---|---|
| committer | Hashbang173 <hashbang173@gmail.com> | 2018-04-07 11:54:16 -0400 |
| commit | 695e1bd83a89a08ab966bc465ebfdea428e5425f (patch) | |
| tree | 72fca51d55a3969969c0a390640043809f7b4ab9 /light/Light.h | |
| parent | 43613d803aa70bae6848e862c1969c959ab007cc (diff) | |
| parent | 7d6fa12bc7b48bf5cbb30846659eb3cee33a0cf8 (diff) | |
Change-Id: Ia1c37971b7ab91220b418ef72599aaabc76f5f8b
Diffstat (limited to 'light/Light.h')
| -rw-r--r-- | light/Light.h | 40 |
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 |
