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 #pragma once 17 18 #include "ContextHub.h" 19 #include "IContextHubCallbackWrapper.h" 20 21 #include <android/hardware/contexthub/1.2/IContexthub.h> 22 23 namespace android { 24 namespace hardware { 25 namespace contexthub { 26 namespace V1_2 { 27 namespace implementation { 28 29 class Contexthub 30 : public ::android::hardware::contexthub::V1_X::implementation::ContextHub<IContexthub> { 31 using ContextHubMsg = ::android::hardware::contexthub::V1_2::ContextHubMsg; 32 using IContexthubCallback = ::android::hardware::contexthub::V1_2::IContexthubCallback; 33 using IContextHubCallbackWrapperBase = 34 ::android::hardware::contexthub::V1_X::implementation::IContextHubCallbackWrapperBase; 35 using Result = ::android::hardware::contexthub::V1_0::Result; 36 using SettingValue = ::android::hardware::contexthub::V1_1::SettingValue; 37 using SettingV1_1 = ::android::hardware::contexthub::V1_1::Setting; 38 using getHubs_1_2_cb = ::android::hardware::contexthub::V1_2::IContexthub::getHubs_1_2_cb; 39 40 public: 41 // Methods from V1_0::IContexthub 42 Return<Result> registerCallback(uint32_t hubId, 43 const sp<V1_0::IContexthubCallback>& cb) override; 44 45 Return<Result> queryApps(uint32_t hubId) override; 46 47 // Methods from V1_1::IContexthub 48 Return<void> onSettingChanged(SettingV1_1 setting, SettingValue newValue) override; 49 50 // Methods from V1_2::IContexthub 51 Return<void> getHubs_1_2(getHubs_1_2_cb _hidl_cb) override; 52 53 Return<void> onSettingChanged_1_2(Setting setting, SettingValue newValue) override; 54 55 Return<Result> registerCallback_1_2(uint32_t hubId, 56 const sp<V1_2::IContexthubCallback>& cb) override; 57 58 private: 59 sp<IContextHubCallbackWrapperBase> mCallback; 60 }; 61 62 } // namespace implementation 63 } // namespace V1_2 64 } // namespace contexthub 65 } // namespace hardware 66 } // namespace android 67