• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 
17 #define LOG_TAG "ContextHubHal"
18 #define LOG_NDEBUG 0
19 
20 #include "generic_context_hub_v1_1.h"
21 
22 #include "context_hub_settings_util.h"
23 
24 #include <chrono>
25 #include <cinttypes>
26 #include <vector>
27 
28 #include <log/log.h>
29 #include <unistd.h>
30 
31 namespace android {
32 namespace hardware {
33 namespace contexthub {
34 namespace V1_1 {
35 namespace implementation {
36 
37 using ::android::chre::HostProtocolHost;
38 using ::android::hardware::Return;
39 using ::android::hardware::contexthub::common::implementation::getFbsSetting;
40 using ::android::hardware::contexthub::common::implementation::
41     getFbsSettingValue;
42 using ::flatbuffers::FlatBufferBuilder;
43 
44 // Aliased for consistency with the way these symbols are referenced in
45 // CHRE-side code
46 namespace fbs = ::chre::fbs;
47 
onSettingChanged(Setting setting,SettingValue newValue)48 Return<void> GenericContextHubV1_1::onSettingChanged(Setting setting,
49                                                      SettingValue newValue) {
50   fbs::Setting fbsSetting;
51   fbs::SettingState fbsState;
52   if (getFbsSetting(reinterpret_cast<V1_2::Setting &>(setting), &fbsSetting) &&
53       getFbsSettingValue(newValue, &fbsState)) {
54     mConnection.sendSettingChangedNotification(fbsSetting, fbsState);
55   }
56 
57   return Void();
58 }
59 
60 }  // namespace implementation
61 }  // namespace V1_1
62 }  // namespace contexthub
63 }  // namespace hardware
64 }  // namespace android
65