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 #include "Light.h" 17 18 namespace android { 19 namespace hardware { 20 namespace tests { 21 namespace extension { 22 namespace light { 23 namespace V2_0 { 24 namespace implementation { 25 26 // Methods from ::android::hardware::light::V2_0::ILight follow. 27 Return<Status> Light::setLight(Type type, const LightState& state) { 28 // Forward types for new methods. 29 30 ExtLightState extState { 31 .state = state, 32 .interpolationOmega = 33 static_cast<int32_t>(Default::INTERPOLATION_OMEGA), 34 .brightness = // ExtBrightness inherits from Brightness 35 static_cast<ExtBrightness>(state.brightnessMode) 36 }; 37 38 return setExtLight(type, extState); 39 } 40 41 Return<void> Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb) { 42 // implement unchanged method as you would always 43 hidl_vec<Type> vec{}; 44 45 // ****************************************************** 46 // Note: awesome proprietary hardware implementation here 47 // ****************************************************** 48 49 _hidl_cb(vec); 50 51 return Void(); 52 } 53 54 // Methods from ::android::hardware::example::extension::light::V2_0::ILight follow. 55 Return<Status> Light::setExtLight(Type /* type */, 56 const ExtLightState& /* state */) { 57 58 // ****************************************************** 59 // Note: awesome proprietary hardware implementation here 60 // ****************************************************** 61 62 return Status::SUCCESS; 63 } 64 65 } // namespace implementation 66 } // namespace V2_0 67 } // namespace light 68 } // namespace extension 69 } // namespace tests 70 } // namespace hardware 71 } // namespace android 72