blob: 7a2cfd170224c77f79908448aba29f02dc2da96b [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>
Arthur Ishigurofd5e65c2022-11-08 16:49:47 +000022#include <vector>
Arthur Ishiguro065a9a52021-11-19 00:24:45 +000023
Arthur Ishiguroa257b782021-08-04 10:40:29 -070024namespace aidl {
25namespace android {
26namespace hardware {
27namespace contexthub {
28
29class 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 Ishiguro070f47d2022-01-06 22:42:10 +000032 int32_t in_transactionId) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070033 ::ndk::ScopedAStatus unloadNanoapp(int32_t in_contextHubId, int64_t in_appId,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000034 int32_t in_transactionId) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070035 ::ndk::ScopedAStatus disableNanoapp(int32_t in_contextHubId, int64_t in_appId,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000036 int32_t in_transactionId) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070037 ::ndk::ScopedAStatus enableNanoapp(int32_t in_contextHubId, int64_t in_appId,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000038 int32_t in_transactionId) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070039 ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override;
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000040 ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId) override;
Arthur Ishigurofd5e65c2022-11-08 16:49:47 +000041 ::ndk::ScopedAStatus getPreloadedNanoappIds(
Matthew Sedamd70f84d2023-03-06 18:34:24 +000042 int32_t in_contextHubId, std::vector<int64_t>* out_preloadedNanoappIds) override;
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000043 ::ndk::ScopedAStatus registerCallback(
44 int32_t in_contextHubId, const std::shared_ptr<IContextHubCallback>& in_cb) override;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070045 ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId,
Arthur Ishiguro070f47d2022-01-06 22:42:10 +000046 const ContextHubMessage& in_message) override;
Matthew Sedamc8ce4d52023-01-09 20:18:21 +000047 ::ndk::ScopedAStatus setTestMode(bool enable) override;
Arthur Ishiguro065a9a52021-11-19 00:24:45 +000048 ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override;
49
50 ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override;
Anthony Stange7fba1002023-03-02 21:45:20 +000051 ::ndk::ScopedAStatus onNanSessionStateChanged(const NanSessionStateUpdate& in_update) override;
Arthur Ishiguro94e1aa22021-10-26 17:25:19 +000052
53 private:
54 static constexpr uint32_t kMockHubId = 0;
55 std::shared_ptr<IContextHubCallback> mCallback;
Arthur Ishiguro065a9a52021-11-19 00:24:45 +000056
57 std::unordered_set<char16_t> mConnectedHostEndpoints;
Arthur Ishiguroa257b782021-08-04 10:40:29 -070058};
59
60} // namespace contexthub
61} // namespace hardware
62} // namespace android
63} // namespace aidl