xref: /aosp_15_r20/hardware/interfaces/bluetooth/ranging/aidl/default/BluetoothChannelSoundingSession.cpp (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
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 "BluetoothChannelSoundingSession.h"
18 
19 namespace aidl::android::hardware::bluetooth::ranging::impl {
20 
BluetoothChannelSoundingSession(std::shared_ptr<IBluetoothChannelSoundingSessionCallback> callback,Reason reason)21 BluetoothChannelSoundingSession::BluetoothChannelSoundingSession(
22     std::shared_ptr<IBluetoothChannelSoundingSessionCallback> callback,
23     Reason reason) {
24   callback_ = callback;
25   callback_->onOpened(reason);
26 }
27 
getVendorSpecificReplies(std::optional<std::vector<std::optional<VendorSpecificData>>> *)28 ndk::ScopedAStatus BluetoothChannelSoundingSession::getVendorSpecificReplies(
29     std::optional<
30         std::vector<std::optional<VendorSpecificData>>>* /*_aidl_return*/) {
31   return ::ndk::ScopedAStatus::ok();
32 }
getSupportedResultTypes(std::vector<ResultType> * _aidl_return)33 ndk::ScopedAStatus BluetoothChannelSoundingSession::getSupportedResultTypes(
34     std::vector<ResultType>* _aidl_return) {
35   std::vector<ResultType> supported_result_types = {ResultType::RESULT_METERS};
36   *_aidl_return = supported_result_types;
37   return ::ndk::ScopedAStatus::ok();
38 }
isAbortedProcedureRequired(bool * _aidl_return)39 ndk::ScopedAStatus BluetoothChannelSoundingSession::isAbortedProcedureRequired(
40     bool* _aidl_return) {
41   *_aidl_return = false;
42   return ::ndk::ScopedAStatus::ok();
43 }
writeRawData(const ChannelSoudingRawData &)44 ndk::ScopedAStatus BluetoothChannelSoundingSession::writeRawData(
45     const ChannelSoudingRawData& /*in_rawData*/) {
46   RangingResult ranging_result;
47   ranging_result.resultMeters = 0.0;
48   callback_->onResult(ranging_result);
49   return ::ndk::ScopedAStatus::ok();
50 }
close(Reason in_reason)51 ndk::ScopedAStatus BluetoothChannelSoundingSession::close(Reason in_reason) {
52   callback_->onClose(in_reason);
53   return ::ndk::ScopedAStatus::ok();
54 }
writeProcedureData(const ChannelSoundingProcedureData &)55 ndk::ScopedAStatus BluetoothChannelSoundingSession::writeProcedureData(
56     const ChannelSoundingProcedureData& /*in_procedureData*/) {
57   return ::ndk::ScopedAStatus::ok();
58 }
updateChannelSoundingConfig(const Config &)59 ndk::ScopedAStatus BluetoothChannelSoundingSession::updateChannelSoundingConfig(
60     const Config& /*in_config*/) {
61   return ::ndk::ScopedAStatus::ok();
62 }
updateProcedureEnableConfig(const ProcedureEnableConfig &)63 ndk::ScopedAStatus BluetoothChannelSoundingSession::updateProcedureEnableConfig(
64     const ProcedureEnableConfig& /*in_procedureEnableConfig*/) {
65   return ::ndk::ScopedAStatus::ok();
66 }
updateBleConnInterval(int)67 ndk::ScopedAStatus BluetoothChannelSoundingSession::updateBleConnInterval(
68     int /*in_bleConnInterval*/) {
69   return ::ndk::ScopedAStatus::ok();
70 }
71 }  // namespace aidl::android::hardware::bluetooth::ranging::impl
72