| /* |
| * Copyright (C) 2018 The LineageOS Project |
| * |
| * SPDX-License-Identifier: Apache-2.0 |
| */ |
| |
| #pragma once |
| |
| #include <aidl/android/hardware/light/BnLights.h> |
| #include <android-base/logging.h> |
| #include <hardware/hardware.h> |
| #include <hardware/lights.h> |
| #include <vector> |
| |
| static unsigned int brightness_table_0x7ff[256] = { |
| 0, 113, 218, 299, 379, 444, 484, 540, 580, 629, 669, 685, |
| 725, 766, 790, 830, 854, 870, 911, 935, 951, 991, 1015, 1040, |
| 1056, 1080, 1096, 1120, 1136, 1160, 1160, 1160, 1160, 1225, 1225, 1241, |
| 1265, 1265, 1281, 1281, 1305, 1305, 1322, 1322, 1346, 1346, 1362, 1362, |
| 1386, 1386, 1402, 1402, 1426, 1426, 1426, 1450, 1450, 1450, 1467, 1467, |
| 1467, 1491, 1491, 1491, 1507, 1507, 1507, 1531, 1531, 1531, 1531, 1547, |
| 1547, 1547, 1547, 1571, 1571, 1587, 1587, 1587, 1587, 1587, 1612, 1612, |
| 1612, 1636, 1636, 1636, 1636, 1636, 1652, 1652, 1652, 1652, 1652, 1676, |
| 1676, 1676, 1676, 1676, 1692, 1692, 1692, 1692, 1692, 1716, 1716, 1716, |
| 1716, 1716, 1732, 1732, 1732, 1732, 1732, 1732, 1732, 1732, 1757, 1757, |
| 1757, 1757, 1773, 1773, 1773, 1773, 1773, 1773, 1797, 1797, 1797, 1797, |
| 1797, 1797, 1797, 1797, 1797, 1797, 1813, 1813, 1813, 1813, 1813, 1813, |
| 1813, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1861, 1861, 1861, 1861, |
| 1861, 1861, 1861, 1861, 1861, 1861, 1877, 1877, 1877, 1877, 1877, 1877, |
| 1877, 1877, 1877, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1902, |
| 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1918, 1942, 1942, |
| 1942, 1942, 1942, 1942, 1942, 1942, 1942, 1942, 1958, 1958, 1958, 1958, |
| 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1982, 1982, 1982, 1982, |
| 1982, 1982, 1982, 1982, 1982, 1982, 1982, 1998, 1998, 1998, 1998, 1998, |
| 1998, 1998, 1998, 1998, 1998, 1998, 1998, 2022, 2022, 2022, 2022, 2022, |
| 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2047, 2047, 2047, 2047, |
| 2047, 2047, 2047, 2047 |
| }; |
| |
| static unsigned int brightness_table_0xfff[256] = { |
| 0, 226, 436, 597, 758, 887, 968, 1080, 1161, 1258, 1338, 1371, |
| 1451, 1532, 1580, 1661, 1709, 1741, 1822, 1870, 1902, 1983, 2031, 2080, |
| 2112, 2160, 2193, 2241, 2273, 2322, 2322, 2322, 2322, 2450, 2450, 2483, |
| 2531, 2531, 2563, 2563, 2612, 2612, 2644, 2644, 2692, 2692, 2724, 2724, |
| 2773, 2773, 2805, 2805, 2853, 2853, 2853, 2902, 2902, 2902, 2934, 2934, |
| 2934, 2982, 2982, 2982, 3015, 3015, 3015, 3063, 3063, 3063, 3063, 3095, |
| 3095, 3095, 3095, 3144, 3144, 3176, 3176, 3176, 3176, 3176, 3224, 3224, |
| 3224, 3272, 3272, 3272, 3272, 3272, 3305, 3305, 3305, 3305, 3305, 3353, |
| 3353, 3353, 3353, 3353, 3385, 3385, 3385, 3385, 3385, 3434, 3434, 3434, |
| 3434, 3434, 3466, 3466, 3466, 3466, 3466, 3466, 3466, 3466, 3514, 3514, |
| 3514, 3514, 3546, 3546, 3546, 3546, 3546, 3546, 3595, 3595, 3595, 3595, |
| 3595, 3595, 3595, 3595, 3595, 3595, 3627, 3627, 3627, 3627, 3627, 3627, |
| 3627, 3675, 3675, 3675, 3675, 3675, 3675, 3675, 3724, 3724, 3724, 3724, |
| 3724, 3724, 3724, 3724, 3724, 3724, 3756, 3756, 3756, 3756, 3756, 3756, |
| 3756, 3756, 3756, 3804, 3804, 3804, 3804, 3804, 3804, 3804, 3804, 3804, |
| 3837, 3837, 3837, 3837, 3837, 3837, 3837, 3837, 3837, 3837, 3885, 3885, |
| 3885, 3885, 3885, 3885, 3885, 3885, 3885, 3885, 3917, 3917, 3917, 3917, |
| 3917, 3917, 3917, 3917, 3917, 3917, 3917, 3917, 3966, 3966, 3966, 3966, |
| 3966, 3966, 3966, 3966, 3966, 3966, 3966, 3998, 3998, 3998, 3998, 3998, |
| 3998, 3998, 3998, 3998, 3998, 3998, 3998, 4046, 4046, 4046, 4046, 4046, |
| 4046, 4046, 4046, 4046, 4046, 4046, 4046, 4046, 4095, 4095, 4095, 4095, |
| 4095, 4095, 4095, 4095 |
| }; |
| |
| using ::aidl::android::hardware::light::HwLightState; |
| using ::aidl::android::hardware::light::HwLight; |
| using ::aidl::android::hardware::light::LightType; |
| using ::aidl::android::hardware::light::BnLights; |
| |
| namespace aidl { |
| namespace android { |
| namespace hardware { |
| namespace light { |
| |
| class Lights : public BnLights { |
| ndk::ScopedAStatus setLightState(int id, const HwLightState& state) override; |
| ndk::ScopedAStatus getLights(std::vector<HwLight>* types) override; |
| }; |
| |
| } // namespace light |
| } // namespace hardware |
| } // namespace android |
| } // namespace aidl |