blob: 03d84321347ed495d12b717c083c52bad55494f5 [file] [log] [blame]
Arthur Ishiguroa257b782021-08-04 10:40:29 -07001/*
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 Ishiguro065a9a52021-11-19 00:24:45 +000021#include <unordered_set>
22
Arthur Ishiguroa257b782021-08-04 10:40:29 -070023namespace aidl {
24namespace android {
25namespace hardware {
26namespace contexthub {
27
28class 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,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000031 int32_t in_transactionId) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070032 ::ndk::ScopedAStatus unloadNanoapp(int32_t in_contextHubId, int64_t in_appId,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000033 int32_t in_transactionId) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070034 ::ndk::ScopedAStatus disableNanoapp(int32_t in_contextHubId, int64_t in_appId,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000035 int32_t in_transactionId) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070036 ::ndk::ScopedAStatus enableNanoapp(int32_t in_contextHubId, int64_t in_appId,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000037 int32_t in_transactionId) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070038 ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override;
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000039 ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId) override;
40 ::ndk::ScopedAStatus registerCallback(
41 int32_t in_contextHubId, const std::shared_ptr<IContextHubCallback>& in_cb) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070042 ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000043 const ContextHubMessage& in_message) override;
Arthur Ishiguro065a9a52021-11-19 00:24:45 +000044 ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override;
45
46 ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override;
Arthur Ishiguro94e1aa22021-10-26 17:25:19 +000047
48 private:
49 static constexpr uint32_t kMockHubId = 0;
50 std::shared_ptr<IContextHubCallback> mCallback;
Arthur Ishiguro065a9a52021-11-19 00:24:45 +000051
52 std::unordered_set<char16_t> mConnectedHostEndpoints;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070053};
54
55} // namespace contexthub
56} // namespace hardware
57} // namespace android
58} // namespace aidl