Home | History | Annotate | Download | only in default
      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     // Methods from ::android::hardware::light::V2_0::ILight follow.
     46     Return<Status> setLight(Type type, const LightState& state)  override;
     47     Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb)  override;
     48 
     49 private:
     50     std::map<Type, light_device_t*> mLights;
     51 };
     52 
     53 extern "C" ILight* HIDL_FETCH_ILight(const char* name);
     54 
     55 }  // namespace implementation
     56 }  // namespace V2_0
     57 }  // namespace light
     58 }  // namespace hardware
     59 }  // namespace android
     60 
     61 #endif  // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
     62