1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
17 #define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
18 
19 #include <android/hardware/light/2.0/ILight.h>
20 #include <hardware/hardware.h>
21 #include <hardware/lights.h>
22 #include <hidl/MQDescriptor.h>
23 #include <hidl/Status.h>
24 #include <map>
25 
26 namespace android {
27 namespace hardware {
28 namespace light {
29 namespace V2_0 {
30 namespace implementation {
31 
32 using ::android::hardware::hidl_string;
33 using ::android::hardware::hidl_vec;
34 using ::android::hardware::Return;
35 using ::android::hardware::light::V2_0::ILight;
36 using ::android::hardware::light::V2_0::LightState;
37 using ::android::hardware::light::V2_0::Status;
38 using ::android::hardware::light::V2_0::Type;
39 
40 struct Light : public ILight {
41   Light(std::map<Type, light_device_t*>&& lights);
42 
43   Return<Status> setLight(Type type, const LightState& state) override;
44   Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
45 
46   Return<void> debug(const hidl_handle& handle,
47                      const hidl_vec<hidl_string>& options) override;
48 
49  private:
50   std::map<Type, light_device_t*> mLights;
51 };
52 
53 }  // namespace implementation
54 }  // namespace V2_0
55 }  // namespace light
56 }  // namespace hardware
57 }  // namespace android
58 
59 #endif  // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
60