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> |
Arthur Ishiguro | fd5e65c | 2022-11-08 16:49:47 +0000 | [diff] [blame] | 22 | #include <vector> |
Arthur Ishiguro | 065a9a5 | 2021-11-19 00:24:45 +0000 | [diff] [blame] | 23 | |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 24 | namespace aidl { |
| 25 | namespace android { |
| 26 | namespace hardware { |
| 27 | namespace contexthub { |
| 28 | |
| 29 | class ContextHub : public BnContextHub { |
| 30 | ::ndk::ScopedAStatus getContextHubs(std::vector<ContextHubInfo>* out_contextHubInfos) override; |
| 31 | ::ndk::ScopedAStatus loadNanoapp(int32_t in_contextHubId, const NanoappBinary& in_appBinary, |
Arthur Ishiguro | 070f47d | 2022-01-06 22:42:10 +0000 | [diff] [blame] | 32 | int32_t in_transactionId) override; |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 33 | ::ndk::ScopedAStatus unloadNanoapp(int32_t in_contextHubId, int64_t in_appId, |
Arthur Ishiguro | 070f47d | 2022-01-06 22:42:10 +0000 | [diff] [blame] | 34 | int32_t in_transactionId) override; |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 35 | ::ndk::ScopedAStatus disableNanoapp(int32_t in_contextHubId, int64_t in_appId, |
Arthur Ishiguro | 070f47d | 2022-01-06 22:42:10 +0000 | [diff] [blame] | 36 | int32_t in_transactionId) override; |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 37 | ::ndk::ScopedAStatus enableNanoapp(int32_t in_contextHubId, int64_t in_appId, |
Arthur Ishiguro | 070f47d | 2022-01-06 22:42:10 +0000 | [diff] [blame] | 38 | int32_t in_transactionId) override; |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 39 | ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override; |
Arthur Ishiguro | 070f47d | 2022-01-06 22:42:10 +0000 | [diff] [blame] | 40 | ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId) override; |
Arthur Ishiguro | fd5e65c | 2022-11-08 16:49:47 +0000 | [diff] [blame] | 41 | ::ndk::ScopedAStatus getPreloadedNanoappIds( |
Matthew Sedam | d70f84d | 2023-03-06 18:34:24 +0000 | [diff] [blame] | 42 | int32_t in_contextHubId, std::vector<int64_t>* out_preloadedNanoappIds) override; |
Arthur Ishiguro | 070f47d | 2022-01-06 22:42:10 +0000 | [diff] [blame] | 43 | ::ndk::ScopedAStatus registerCallback( |
| 44 | int32_t in_contextHubId, const std::shared_ptr<IContextHubCallback>& in_cb) override; |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 45 | ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId, |
Arthur Ishiguro | 070f47d | 2022-01-06 22:42:10 +0000 | [diff] [blame] | 46 | const ContextHubMessage& in_message) override; |
Matthew Sedam | c8ce4d5 | 2023-01-09 20:18:21 +0000 | [diff] [blame] | 47 | ::ndk::ScopedAStatus setTestMode(bool enable) override; |
Arthur Ishiguro | 065a9a5 | 2021-11-19 00:24:45 +0000 | [diff] [blame] | 48 | ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override; |
| 49 | |
| 50 | ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override; |
Anthony Stange | 7fba100 | 2023-03-02 21:45:20 +0000 | [diff] [blame] | 51 | ::ndk::ScopedAStatus onNanSessionStateChanged(const NanSessionStateUpdate& in_update) override; |
Arthur Ishiguro | 94e1aa2 | 2021-10-26 17:25:19 +0000 | [diff] [blame] | 52 | |
| 53 | private: |
| 54 | static constexpr uint32_t kMockHubId = 0; |
| 55 | std::shared_ptr<IContextHubCallback> mCallback; |
Arthur Ishiguro | 065a9a5 | 2021-11-19 00:24:45 +0000 | [diff] [blame] | 56 | |
| 57 | std::unordered_set<char16_t> mConnectedHostEndpoints; |
Arthur Ishiguro | a257b78 | 2021-08-04 10:40:29 -0700 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | } // namespace contexthub |
| 61 | } // namespace hardware |
| 62 | } // namespace android |
| 63 | } // namespace aidl |