Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 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 | #pragma once |
| 18 | |
| 19 | #include <aidl/android/hardware/contexthub/BnContextHub.h> |
| 20 | |
Arthur Ishiguro | 065a9a5 | 2021-11-19 00:24:45 +0000 | [diff] [blame] | 21 | #include <unordered_set> |
| 22 | |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 23 | namespace aidl { |
| 24 | namespace android { |
| 25 | namespace hardware { |
| 26 | namespace contexthub { |
| 27 | |
| 28 | class ContextHub : public BnContextHub { |
| 29 | ::ndk::ScopedAStatus getContextHubs(std::vector<ContextHubInfo>* out_contextHubInfos) override; |
| 30 | ::ndk::ScopedAStatus loadNanoapp(int32_t in_contextHubId, const NanoappBinary& in_appBinary, |
| 31 | int32_t in_transactionId, bool* _aidl_return) override; |
| 32 | ::ndk::ScopedAStatus unloadNanoapp(int32_t in_contextHubId, int64_t in_appId, |
| 33 | int32_t in_transactionId, bool* _aidl_return) override; |
| 34 | ::ndk::ScopedAStatus disableNanoapp(int32_t in_contextHubId, int64_t in_appId, |
| 35 | int32_t in_transactionId, bool* _aidl_return) override; |
| 36 | ::ndk::ScopedAStatus enableNanoapp(int32_t in_contextHubId, int64_t in_appId, |
| 37 | int32_t in_transactionId, bool* _aidl_return) override; |
| 38 | ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override; |
| 39 | ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId, bool* _aidl_return) override; |
| 40 | ::ndk::ScopedAStatus registerCallback(int32_t in_contextHubId, |
| 41 | const std::shared_ptr<IContextHubCallback>& in_cb, |
| 42 | bool* _aidl_return) override; |
| 43 | ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId, |
| 44 | const ContextHubMessage& in_message, |
| 45 | bool* _aidl_return) override; |
Arthur Ishiguro | 065a9a5 | 2021-11-19 00:24:45 +0000 | [diff] [blame] | 46 | ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override; |
| 47 | |
| 48 | ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override; |
Arthur Ishiguro | 94e1aa2 | 2021-10-26 17:25:19 +0000 | [diff] [blame] | 49 | |
| 50 | private: |
| 51 | static constexpr uint32_t kMockHubId = 0; |
| 52 | std::shared_ptr<IContextHubCallback> mCallback; |
Arthur Ishiguro | 065a9a5 | 2021-11-19 00:24:45 +0000 | [diff] [blame] | 53 | |
| 54 | std::unordered_set<char16_t> mConnectedHostEndpoints; |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | } // namespace contexthub |
| 58 | } // namespace hardware |
| 59 | } // namespace android |
| 60 | } // namespace aidl |