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 <android/hardware/contexthub/1.1/IContexthub.h>
19 
20 namespace android {
21 namespace hardware {
22 namespace contexthub {
23 namespace V1_1 {
24 namespace implementation {
25 
26 class Contexthub : public V1_1::IContexthub {
27     using ContextHubMsg = ::android::hardware::contexthub::V1_0::ContextHubMsg;
28     using IContexthubCallback = ::android::hardware::contexthub::V1_0::IContexthubCallback;
29     using NanoAppBinary = ::android::hardware::contexthub::V1_0::NanoAppBinary;
30     using Result = ::android::hardware::contexthub::V1_0::Result;
31 
32   public:
33     // Methods from V1_0::IContexthub
34     Return<void> getHubs(getHubs_cb _hidl_cb) override;
35     Return<Result> registerCallback(uint32_t hubId,
36                                     const ::android::sp<IContexthubCallback>& cb) override;
37     Return<Result> sendMessageToHub(uint32_t hubId, const ContextHubMsg& msg) override;
38     Return<Result> loadNanoApp(uint32_t hubId, const NanoAppBinary& appBinary,
39                                uint32_t transactionId) override;
40     Return<Result> unloadNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId) override;
41     Return<Result> enableNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId) override;
42     Return<Result> disableNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId) override;
43     Return<Result> queryApps(uint32_t hubId) override;
44 
45     // Methods from V1_1::IContexthub
46     Return<void> onSettingChanged(Setting setting, SettingValue newValue) override;
47 
48   private:
49     sp<IContexthubCallback> mCallback;
50 };
51 
52 }  // namespace implementation
53 }  // namespace V1_1
54 }  // namespace contexthub
55 }  // namespace hardware
56 }  // namespace android
57