1 /*
2 * Copyright (C) 2023 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 #include "BluetoothChannelSounding.h"
18
19 #include "BluetoothChannelSoundingSession.h"
20
21 namespace aidl::android::hardware::bluetooth::ranging::impl {
22
BluetoothChannelSounding()23 BluetoothChannelSounding::BluetoothChannelSounding() {}
~BluetoothChannelSounding()24 BluetoothChannelSounding::~BluetoothChannelSounding() {}
25
getVendorSpecificData(std::optional<std::vector<std::optional<VendorSpecificData>>> *)26 ndk::ScopedAStatus BluetoothChannelSounding::getVendorSpecificData(
27 std::optional<
28 std::vector<std::optional<VendorSpecificData>>>* /*_aidl_return*/) {
29 return ::ndk::ScopedAStatus::ok();
30 }
getSupportedSessionTypes(std::optional<std::vector<SessionType>> * _aidl_return)31 ndk::ScopedAStatus BluetoothChannelSounding::getSupportedSessionTypes(
32 std::optional<std::vector<SessionType>>* _aidl_return) {
33 std::vector<SessionType> supported_session_types = {};
34 *_aidl_return = supported_session_types;
35 return ::ndk::ScopedAStatus::ok();
36 }
getMaxSupportedCsSecurityLevel(CsSecurityLevel * _aidl_return)37 ndk::ScopedAStatus BluetoothChannelSounding::getMaxSupportedCsSecurityLevel(
38 CsSecurityLevel* _aidl_return) {
39 CsSecurityLevel security_level = CsSecurityLevel::NOT_SUPPORTED;
40 *_aidl_return = security_level;
41 return ::ndk::ScopedAStatus::ok();
42 }
openSession(const BluetoothChannelSoundingParameters &,const std::shared_ptr<IBluetoothChannelSoundingSessionCallback> & in_callback,std::shared_ptr<IBluetoothChannelSoundingSession> * _aidl_return)43 ndk::ScopedAStatus BluetoothChannelSounding::openSession(
44 const BluetoothChannelSoundingParameters& /*in_params*/,
45 const std::shared_ptr<IBluetoothChannelSoundingSessionCallback>&
46 in_callback,
47 std::shared_ptr<IBluetoothChannelSoundingSession>* _aidl_return) {
48 if (in_callback == nullptr) {
49 return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
50 EX_ILLEGAL_ARGUMENT, "Invalid nullptr callback");
51 }
52 std::shared_ptr<BluetoothChannelSoundingSession> session = nullptr;
53 session = ndk::SharedRefBase::make<BluetoothChannelSoundingSession>(
54 in_callback, Reason::LOCAL_STACK_REQUEST);
55 *_aidl_return = session;
56 return ::ndk::ScopedAStatus::ok();
57 }
58 } // namespace aidl::android::hardware::bluetooth::ranging::impl
59