Loading tools/rootcanal/model/setup/test_model.cc +4 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <optional> #include <type_traits> // for remove_extent_t #include <utility> // for move #include <optional> #include "include/phy.h" // for Phy, Phy::Type #include "log.h" Loading Loading @@ -203,8 +204,9 @@ void TestModel::AddRemote(const std::string& server, int port, Phy::Type type) { } PhyDevice::Identifier TestModel::AddHciConnection( std::shared_ptr<HciDevice> device) { device->SetAddress(GenerateBluetoothAddress()); std::shared_ptr<HciDevice> device, std::optional<Address> address) { // clients can specify BD_ADDR or have it set based on device_id. device->SetAddress(address.value_or(GenerateBluetoothAddress())); AddDevice(std::static_pointer_cast<Device>(device)); INFO(device->id_, "Initialized device with address {}", device->GetAddress()); Loading tools/rootcanal/model/setup/test_model.h +3 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <memory> // for shared_ptr #include <string> // for string #include <vector> // for vector #include <optional> #include "hci/address.h" // for Address #include "model/devices/hci_device.h" // for HciDevice Loading Loading @@ -84,8 +85,8 @@ class TestModel { // Handle incoming remote connections void AddLinkLayerConnection(std::shared_ptr<Device> dev, Phy::Type phy_type); // Add an HCI device, return its index PhyDevice::Identifier AddHciConnection(std::shared_ptr<HciDevice> dev); PhyDevice::Identifier AddHciConnection(std::shared_ptr<HciDevice> dev, std::optional<Address> address = {}); // Handle closed remote connections (both hci & link layer) void OnConnectionClosed(PhyDevice::Identifier device_id, AsyncUserId user_id); Loading Loading
tools/rootcanal/model/setup/test_model.cc +4 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <optional> #include <type_traits> // for remove_extent_t #include <utility> // for move #include <optional> #include "include/phy.h" // for Phy, Phy::Type #include "log.h" Loading Loading @@ -203,8 +204,9 @@ void TestModel::AddRemote(const std::string& server, int port, Phy::Type type) { } PhyDevice::Identifier TestModel::AddHciConnection( std::shared_ptr<HciDevice> device) { device->SetAddress(GenerateBluetoothAddress()); std::shared_ptr<HciDevice> device, std::optional<Address> address) { // clients can specify BD_ADDR or have it set based on device_id. device->SetAddress(address.value_or(GenerateBluetoothAddress())); AddDevice(std::static_pointer_cast<Device>(device)); INFO(device->id_, "Initialized device with address {}", device->GetAddress()); Loading
tools/rootcanal/model/setup/test_model.h +3 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <memory> // for shared_ptr #include <string> // for string #include <vector> // for vector #include <optional> #include "hci/address.h" // for Address #include "model/devices/hci_device.h" // for HciDevice Loading Loading @@ -84,8 +85,8 @@ class TestModel { // Handle incoming remote connections void AddLinkLayerConnection(std::shared_ptr<Device> dev, Phy::Type phy_type); // Add an HCI device, return its index PhyDevice::Identifier AddHciConnection(std::shared_ptr<HciDevice> dev); PhyDevice::Identifier AddHciConnection(std::shared_ptr<HciDevice> dev, std::optional<Address> address = {}); // Handle closed remote connections (both hci & link layer) void OnConnectionClosed(PhyDevice::Identifier device_id, AsyncUserId user_id); Loading