1 /* 2 * Copyright (C) 2025 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 <gmock/gmock.h> 20 #include <string> 21 22 #include "hal/ranging_hal.h" 23 24 namespace bluetooth { 25 namespace hal { 26 namespace testing { 27 class MockRangingHal : public RangingHal { 28 public: 29 MOCK_METHOD(bool, IsBound, ()); 30 MOCK_METHOD(RangingHalVersion, GetRangingHalVersion, ()); 31 MOCK_METHOD(std::vector<VendorSpecificCharacteristic>, GetVendorSpecificCharacteristics, ()); 32 MOCK_METHOD(void, OpenSession, 33 (uint16_t connection_handle, uint16_t att_handle, 34 const std::vector<hal::VendorSpecificCharacteristic>& vendor_specific_data)); 35 MOCK_METHOD(void, HandleVendorSpecificReply, 36 (uint16_t connection_handle, 37 const std::vector<hal::VendorSpecificCharacteristic>& vendor_specific_reply)); 38 MOCK_METHOD(void, WriteRawData, 39 (uint16_t connection_handle, const ChannelSoundingRawData& raw_data)); 40 MOCK_METHOD(void, UpdateChannelSoundingConfig, 41 (uint16_t connection_handle, 42 const hci::LeCsConfigCompleteView& leCsConfigCompleteView, 43 uint8_t local_supported_sw_time, uint8_t remote_supported_sw_time, 44 uint16_t conn_interval)); 45 MOCK_METHOD(void, UpdateConnInterval, (uint16_t connection_handle, uint16_t conn_interval)); 46 MOCK_METHOD(void, UpdateProcedureEnableConfig, 47 (uint16_t connection_handle, 48 const hci::LeCsProcedureEnableCompleteView& leCsProcedureEnableCompleteView)); 49 MOCK_METHOD(void, WriteProcedureData, 50 (uint16_t connection_handle, hci::CsRole local_cs_role, 51 const ProcedureDataV2& procedure_data, uint16_t procedure_counter)); 52 MOCK_METHOD(bool, IsAbortedProcedureRequired, (uint16_t connection_handle)); 53 RegisterCallback(RangingHalCallback * callback)54 void RegisterCallback(RangingHalCallback* callback) override { ranging_hal_callback_ = callback; } GetRangingHalCallback()55 RangingHalCallback* GetRangingHalCallback() { return ranging_hal_callback_; } 56 Start()57 void Start() override {} Stop()58 void Stop() override {} ListDependencies(ModuleList *)59 void ListDependencies(ModuleList* /*list*/) const override {} ToString()60 std::string ToString() const override { return std::string("mock ranging hal"); } 61 62 private: 63 RangingHalCallback* ranging_hal_callback_ = nullptr; 64 }; 65 } // namespace testing 66 } // namespace hal 67 } // namespace bluetooth 68