blob: 8b89824d6b583e34134a0b650f157c12f7442674 [file] [log] [blame]
Arthur Ishiguro46c2bd02020-10-06 11:05:17 -07001/*
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 Stange100aa5e2020-12-17 14:20:02 -050019#include "IContextHubCallbackWrapper.h"
Arthur Ishiguro46c2bd02020-10-06 11:05:17 -070020
21#include <android/hardware/contexthub/1.2/IContexthub.h>
22
23namespace android {
24namespace hardware {
25namespace contexthub {
26namespace V1_2 {
27namespace implementation {
28
29class Contexthub
30 : public ::android::hardware::contexthub::V1_X::implementation::ContextHub<IContexthub> {
Anthony Stange6c77c352020-12-16 12:50:08 -050031 using ContextHubMsg = ::android::hardware::contexthub::V1_2::ContextHubMsg;
32 using IContexthubCallback = ::android::hardware::contexthub::V1_2::IContexthubCallback;
Anthony Stange100aa5e2020-12-17 14:20:02 -050033 using IContextHubCallbackWrapperBase =
34 ::android::hardware::contexthub::V1_X::implementation::IContextHubCallbackWrapperBase;
Anthony Stange6c77c352020-12-16 12:50:08 -050035 using Result = ::android::hardware::contexthub::V1_0::Result;
Arthur Ishiguro46c2bd02020-10-06 11:05:17 -070036 using SettingValue = ::android::hardware::contexthub::V1_1::SettingValue;
37 using SettingV1_1 = ::android::hardware::contexthub::V1_1::Setting;
38
39 public:
Anthony Stange100aa5e2020-12-17 14:20:02 -050040 // Methods from V1_0::IContexthub
41 Return<Result> registerCallback(uint32_t hubId,
42 const sp<V1_0::IContexthubCallback>& cb) override;
Anthony Stange6c77c352020-12-16 12:50:08 -050043
Anthony Stange100aa5e2020-12-17 14:20:02 -050044 Return<Result> queryApps(uint32_t hubId) override;
Anthony Stange6c77c352020-12-16 12:50:08 -050045
Arthur Ishiguro46c2bd02020-10-06 11:05:17 -070046 // Methods from V1_1::IContexthub
47 Return<void> onSettingChanged(SettingV1_1 setting, SettingValue newValue) override;
48
49 // Methods from V1_2::IContexthub
50 Return<void> onSettingChanged_1_2(Setting setting, SettingValue newValue) override;
Anthony Stange100aa5e2020-12-17 14:20:02 -050051
52 Return<Result> registerCallback_1_2(uint32_t hubId,
53 const sp<V1_2::IContexthubCallback>& cb) override;
54
55 Return<Result> sendMessageToHub_1_2(uint32_t hubId, const ContextHubMsg& msg) override;
56
57 private:
58 sp<IContextHubCallbackWrapperBase> mCallback;
Arthur Ishiguro46c2bd02020-10-06 11:05:17 -070059};
60
61} // namespace implementation
62} // namespace V1_2
63} // namespace contexthub
64} // namespace hardware
65} // namespace android