Arthur Ishiguro | 46c2bd0 | 2020-10-06 11:05:17 -0700 | [diff] [blame] | 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" |
Anthony Stange | 100aa5e | 2020-12-17 14:20:02 -0500 | [diff] [blame] | 19 | #include "IContextHubCallbackWrapper.h" |
Arthur Ishiguro | 46c2bd0 | 2020-10-06 11:05:17 -0700 | [diff] [blame] | 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> { |
Anthony Stange | 6c77c35 | 2020-12-16 12:50:08 -0500 | [diff] [blame] | 31 | using ContextHubMsg = ::android::hardware::contexthub::V1_2::ContextHubMsg; |
| 32 | using IContexthubCallback = ::android::hardware::contexthub::V1_2::IContexthubCallback; |
Anthony Stange | 100aa5e | 2020-12-17 14:20:02 -0500 | [diff] [blame] | 33 | using IContextHubCallbackWrapperBase = |
| 34 | ::android::hardware::contexthub::V1_X::implementation::IContextHubCallbackWrapperBase; |
Anthony Stange | 6c77c35 | 2020-12-16 12:50:08 -0500 | [diff] [blame] | 35 | using Result = ::android::hardware::contexthub::V1_0::Result; |
Arthur Ishiguro | 46c2bd0 | 2020-10-06 11:05:17 -0700 | [diff] [blame] | 36 | using SettingValue = ::android::hardware::contexthub::V1_1::SettingValue; |
| 37 | using SettingV1_1 = ::android::hardware::contexthub::V1_1::Setting; |
Anthony Stange | c3c59b3 | 2021-02-10 15:42:10 +0000 | [diff] [blame] | 38 | using getHubs_1_2_cb = ::android::hardware::contexthub::V1_2::IContexthub::getHubs_1_2_cb; |
Arthur Ishiguro | 46c2bd0 | 2020-10-06 11:05:17 -0700 | [diff] [blame] | 39 | |
| 40 | public: |
Anthony Stange | 100aa5e | 2020-12-17 14:20:02 -0500 | [diff] [blame] | 41 | // Methods from V1_0::IContexthub |
| 42 | Return<Result> registerCallback(uint32_t hubId, |
| 43 | const sp<V1_0::IContexthubCallback>& cb) override; |
Anthony Stange | 6c77c35 | 2020-12-16 12:50:08 -0500 | [diff] [blame] | 44 | |
Anthony Stange | 100aa5e | 2020-12-17 14:20:02 -0500 | [diff] [blame] | 45 | Return<Result> queryApps(uint32_t hubId) override; |
Anthony Stange | 6c77c35 | 2020-12-16 12:50:08 -0500 | [diff] [blame] | 46 | |
Arthur Ishiguro | 46c2bd0 | 2020-10-06 11:05:17 -0700 | [diff] [blame] | 47 | // Methods from V1_1::IContexthub |
| 48 | Return<void> onSettingChanged(SettingV1_1 setting, SettingValue newValue) override; |
| 49 | |
| 50 | // Methods from V1_2::IContexthub |
Anthony Stange | c3c59b3 | 2021-02-10 15:42:10 +0000 | [diff] [blame] | 51 | Return<void> getHubs_1_2(getHubs_1_2_cb _hidl_cb) override; |
| 52 | |
Arthur Ishiguro | 46c2bd0 | 2020-10-06 11:05:17 -0700 | [diff] [blame] | 53 | Return<void> onSettingChanged_1_2(Setting setting, SettingValue newValue) override; |
Anthony Stange | 100aa5e | 2020-12-17 14:20:02 -0500 | [diff] [blame] | 54 | |
| 55 | Return<Result> registerCallback_1_2(uint32_t hubId, |
| 56 | const sp<V1_2::IContexthubCallback>& cb) override; |
| 57 | |
Anthony Stange | 100aa5e | 2020-12-17 14:20:02 -0500 | [diff] [blame] | 58 | private: |
| 59 | sp<IContextHubCallbackWrapperBase> mCallback; |
Arthur Ishiguro | 46c2bd0 | 2020-10-06 11:05:17 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | } // namespace implementation |
| 63 | } // namespace V1_2 |
| 64 | } // namespace contexthub |
| 65 | } // namespace hardware |
| 66 | } // namespace android |