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