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)21BluetoothChannelSoundingSession::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>>> *)28ndk::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)33ndk::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)39ndk::ScopedAStatus BluetoothChannelSoundingSession::isAbortedProcedureRequired( 40 bool* _aidl_return) { 41 *_aidl_return = false; 42 return ::ndk::ScopedAStatus::ok(); 43 } writeRawData(const ChannelSoudingRawData &)44ndk::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)51ndk::ScopedAStatus BluetoothChannelSoundingSession::close(Reason in_reason) { 52 callback_->onClose(in_reason); 53 return ::ndk::ScopedAStatus::ok(); 54 } 55 } // namespace aidl::android::hardware::bluetooth::ranging::impl 56