Loading system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +4 −0 Original line number Diff line number Diff line Loading @@ -1319,4 +1319,8 @@ void DualModeController::HciWriteLoopbackMode(packets::PacketView<true> args) { SendCommandCompleteSuccess(OpCode::WRITE_LOOPBACK_MODE); } void DualModeController::SetAddress(Address address) { properties_.SetAddress(address); } } // namespace test_vendor_lib system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h +3 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,9 @@ class DualModeController : public Device { void RegisterScoChannel(const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& send_sco); // Set the device's address. void SetAddress(Address address) override; // Controller commands. For error codes, see the Bluetooth Core Specification, // Version 4.2, Volume 2, Part D (page 370). Loading system/vendor_libs/test_vendor_lib/model/devices/device.cc +4 −0 Original line number Diff line number Diff line Loading @@ -70,4 +70,8 @@ void Device::SendLinkLayerPacket(model::packets::LinkLayerPacketView to_send, } } void Device::SetAddress(Address) { LOG_INFO("%s does not implement %s", GetTypeString().c_str(), __func__); } } // namespace test_vendor_lib system/vendor_libs/test_vendor_lib/model/devices/device.h +3 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,9 @@ class Device { return false; } // Set the device's Bluetooth address. virtual void SetAddress(Address address); // Set the advertisement interval in milliseconds. void SetAdvertisementInterval(std::chrono::milliseconds ms) { advertising_interval_ms_ = ms; Loading system/vendor_libs/test_vendor_lib/model/setup/test_command_handler.cc +17 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ TestCommandHandler::TestCommandHandler(TestModel& test_model) : model_(test_mode SET_HANDLER("add_device_to_phy", AddDeviceToPhy); SET_HANDLER("del_device_from_phy", DelDeviceFromPhy); SET_HANDLER("list", List); SET_HANDLER("set_device_address", SetDeviceAddress); SET_HANDLER("set_timer_period", SetTimerPeriod); SET_HANDLER("start_timer", StartTimer); SET_HANDLER("stop_timer", StopTimer); Loading Loading @@ -212,6 +213,22 @@ void TestCommandHandler::List(const vector<std::string>& args) { send_response_(model_.List()); } void TestCommandHandler::SetDeviceAddress(const vector<std::string>& args) { if (args.size() != 2) { response_string_ = "TestCommandHandler 'set_device_address' takes two arguments"; send_response_(response_string_); return; } size_t device_id = std::stoi(args[0]); Address device_address; Address::FromString(args[1], device_address); model_.SetDeviceAddress(device_id, device_address); response_string_ = "set_device_address " + args[0]; response_string_ += " "; response_string_ += args[1]; send_response_(response_string_); } void TestCommandHandler::SetTimerPeriod(const vector<std::string>& args) { if (args.size() != 1) { LOG_INFO("SetTimerPeriod takes 1 argument"); Loading Loading
system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +4 −0 Original line number Diff line number Diff line Loading @@ -1319,4 +1319,8 @@ void DualModeController::HciWriteLoopbackMode(packets::PacketView<true> args) { SendCommandCompleteSuccess(OpCode::WRITE_LOOPBACK_MODE); } void DualModeController::SetAddress(Address address) { properties_.SetAddress(address); } } // namespace test_vendor_lib
system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h +3 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,9 @@ class DualModeController : public Device { void RegisterScoChannel(const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& send_sco); // Set the device's address. void SetAddress(Address address) override; // Controller commands. For error codes, see the Bluetooth Core Specification, // Version 4.2, Volume 2, Part D (page 370). Loading
system/vendor_libs/test_vendor_lib/model/devices/device.cc +4 −0 Original line number Diff line number Diff line Loading @@ -70,4 +70,8 @@ void Device::SendLinkLayerPacket(model::packets::LinkLayerPacketView to_send, } } void Device::SetAddress(Address) { LOG_INFO("%s does not implement %s", GetTypeString().c_str(), __func__); } } // namespace test_vendor_lib
system/vendor_libs/test_vendor_lib/model/devices/device.h +3 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,9 @@ class Device { return false; } // Set the device's Bluetooth address. virtual void SetAddress(Address address); // Set the advertisement interval in milliseconds. void SetAdvertisementInterval(std::chrono::milliseconds ms) { advertising_interval_ms_ = ms; Loading
system/vendor_libs/test_vendor_lib/model/setup/test_command_handler.cc +17 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ TestCommandHandler::TestCommandHandler(TestModel& test_model) : model_(test_mode SET_HANDLER("add_device_to_phy", AddDeviceToPhy); SET_HANDLER("del_device_from_phy", DelDeviceFromPhy); SET_HANDLER("list", List); SET_HANDLER("set_device_address", SetDeviceAddress); SET_HANDLER("set_timer_period", SetTimerPeriod); SET_HANDLER("start_timer", StartTimer); SET_HANDLER("stop_timer", StopTimer); Loading Loading @@ -212,6 +213,22 @@ void TestCommandHandler::List(const vector<std::string>& args) { send_response_(model_.List()); } void TestCommandHandler::SetDeviceAddress(const vector<std::string>& args) { if (args.size() != 2) { response_string_ = "TestCommandHandler 'set_device_address' takes two arguments"; send_response_(response_string_); return; } size_t device_id = std::stoi(args[0]); Address device_address; Address::FromString(args[1], device_address); model_.SetDeviceAddress(device_id, device_address); response_string_ = "set_device_address " + args[0]; response_string_ += " "; response_string_ += args[1]; send_response_(response_string_); } void TestCommandHandler::SetTimerPeriod(const vector<std::string>& args) { if (args.size() != 1) { LOG_INFO("SetTimerPeriod takes 1 argument"); Loading