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 #ifndef ANDROID_HARDWARE_CONTEXTHUB_COMMON_CONTEXT_HUB_SETTINGS_UTIL_H 18 #define ANDROID_HARDWARE_CONTEXTHUB_COMMON_CONTEXT_HUB_SETTINGS_UTIL_H 19 20 #include <cinttypes> 21 22 #include <android/hardware/contexthub/1.1/IContexthub.h> 23 #include <android/hardware/contexthub/1.2/IContexthub.h> 24 25 #include "chre_host/host_protocol_host.h" 26 27 namespace android { 28 namespace hardware { 29 namespace contexthub { 30 namespace common { 31 namespace implementation { 32 33 /** 34 * @param setting The HAL Setting (<= v1.2). 35 * @param fbsSetting A non-null pointer where the corresponding flatbuffers 36 * settings value will be stored. 37 * 38 * @return true if the flatbuffers setting value was found and populated. 39 */ 40 bool getFbsSetting( 41 const ::android::hardware::contexthub::V1_2::Setting &setting, 42 ::chre::fbs::Setting *fbsSetting); 43 44 /** 45 * @param setting The HAL v1.1 SettingValue. 46 * @param fbsSetting A non-null pointer where the corresponding flatbuffers 47 * setting state value will be stored. 48 * 49 * @return true if the flatbuffers setting state value was found and populated. 50 */ 51 bool getFbsSettingValue( 52 const ::android::hardware::contexthub::V1_1::SettingValue &newValue, 53 ::chre::fbs::SettingState *fbsState); 54 55 } // namespace implementation 56 } // namespace common 57 } // namespace contexthub 58 } // namespace hardware 59 } // namespace android 60 61 #endif // ANDROID_HARDWARE_CONTEXTHUB_COMMON_CONTEXT_HUB_SETTINGS_UTIL_H 62