• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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/Status.h>
23 #include <hidl/MQDescriptor.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::light::V2_0::ILight;
33 using ::android::hardware::light::V2_0::LightState;
34 using ::android::hardware::light::V2_0::Status;
35 using ::android::hardware::light::V2_0::Type;
36 using ::android::hardware::Return;
37 using ::android::hardware::Void;
38 using ::android::hardware::hidl_vec;
39 using ::android::hardware::hidl_string;
40 using ::android::sp;
41 
42 struct Light : public ILight {
43     Light(std::map<Type, light_device_t*> &&lights);
44 
45     Return<Status> setLight(Type type, const LightState& state)  override;
46     Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb)  override;
47 
48     Return<void> debug(const hidl_handle& handle, const hidl_vec<hidl_string>& options) override;
49 
50    private:
51     std::map<Type, light_device_t*> mLights;
52 };
53 
54 extern "C" ILight* HIDL_FETCH_ILight(const char* name);
55 
56 }  // namespace implementation
57 }  // namespace V2_0
58 }  // namespace light
59 }  // namespace hardware
60 }  // namespace android
61 
62 #endif  // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
63