Loading system/vendor_libs/test_vendor_lib/model/devices/beacon.cc +2 −4 Original line number Diff line number Diff line Loading @@ -70,8 +70,7 @@ void Beacon::TimerTick() { std::shared_ptr<model::packets::LinkLayerPacketBuilder> to_send = std::move(ad); std::vector<std::shared_ptr<PhyLayer>> le_phys = phy_layers_[Phy::Type::LOW_ENERGY]; for (std::shared_ptr<PhyLayer> phy : le_phys) { for (auto phy : phy_layers_[Phy::Type::LOW_ENERGY]) { phy->Send(to_send); } } Loading @@ -88,8 +87,7 @@ void Beacon::IncomingPacket(model::packets::LinkLayerPacketView packet) { std::shared_ptr<model::packets::LinkLayerPacketBuilder> to_send = std::move(scan_response); std::vector<std::shared_ptr<PhyLayer>> le_phys = phy_layers_[Phy::Type::LOW_ENERGY]; for (auto phy : le_phys) { for (auto phy : phy_layers_[Phy::Type::LOW_ENERGY]) { phy->Send(to_send); } } Loading system/vendor_libs/test_vendor_lib/model/devices/device.cc +4 −4 Original line number Diff line number Diff line Loading @@ -42,10 +42,10 @@ void Device::UnregisterPhyLayers() { } void Device::UnregisterPhyLayer(Phy::Type phy_type, uint32_t factory_id) { for (size_t i = 0; i < phy_layers_[phy_type].size(); i++) { if (phy_layers_[phy_type][i]->IsFactoryId(factory_id)) { phy_layers_[phy_type][i]->Unregister(); phy_layers_[phy_type].erase(phy_layers_[phy_type].begin() + i); for (const auto phy_layer : phy_layers_[phy_type]) { if (phy_layer->IsFactoryId(factory_id)) { phy_layer->Unregister(); phy_layers_[phy_type].remove(phy_layer); } } } Loading system/vendor_libs/test_vendor_lib/model/devices/device.h +2 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <chrono> #include <cstdint> #include <list> #include <map> #include <string> #include <vector> Loading Loading @@ -86,7 +87,7 @@ class Device { Phy::Type phy_type); protected: std::map<Phy::Type, std::vector<std::shared_ptr<PhyLayer>>> phy_layers_; std::map<Phy::Type, std::list<std::shared_ptr<PhyLayer>>> phy_layers_; std::chrono::steady_clock::time_point last_advertisement_; Loading system/vendor_libs/test_vendor_lib/model/devices/loopback.cc +1 −2 Original line number Diff line number Diff line Loading @@ -80,8 +80,7 @@ void Loopback::IncomingPacket(model::packets::LinkLayerPacketView packet) { std::shared_ptr<model::packets::LinkLayerPacketBuilder> to_send = std::move(scan_response); std::vector<std::shared_ptr<PhyLayer>> le_phys = phy_layers_[Phy::Type::LOW_ENERGY]; for (auto phy : le_phys) { for (auto phy : phy_layers_[Phy::Type::LOW_ENERGY]) { LOG_INFO("Sending a Scan Response on a Phy"); phy->Send(to_send); } Loading system/vendor_libs/test_vendor_lib/model/setup/phy_layer.h +9 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,12 @@ class PhyLayer { public: PhyLayer(Phy::Type phy_type, uint32_t id, const std::function<void(model::packets::LinkLayerPacketView)>& device_receive) : phy_type_(phy_type), id_(id), transmit_to_device_(device_receive) {} device_receive, uint32_t device_id) : phy_type_(phy_type), id_(id), device_id_(device_id), transmit_to_device_(device_receive) {} virtual void Send( const std::shared_ptr<model::packets::LinkLayerPacketBuilder> packet) = 0; Loading @@ -48,11 +52,14 @@ class PhyLayer { return id_; } uint32_t GetDeviceId() { return device_id_; } virtual ~PhyLayer() = default; private: Phy::Type phy_type_; uint32_t id_; uint32_t device_id_; protected: const std::function<void(model::packets::LinkLayerPacketView)> Loading Loading
system/vendor_libs/test_vendor_lib/model/devices/beacon.cc +2 −4 Original line number Diff line number Diff line Loading @@ -70,8 +70,7 @@ void Beacon::TimerTick() { std::shared_ptr<model::packets::LinkLayerPacketBuilder> to_send = std::move(ad); std::vector<std::shared_ptr<PhyLayer>> le_phys = phy_layers_[Phy::Type::LOW_ENERGY]; for (std::shared_ptr<PhyLayer> phy : le_phys) { for (auto phy : phy_layers_[Phy::Type::LOW_ENERGY]) { phy->Send(to_send); } } Loading @@ -88,8 +87,7 @@ void Beacon::IncomingPacket(model::packets::LinkLayerPacketView packet) { std::shared_ptr<model::packets::LinkLayerPacketBuilder> to_send = std::move(scan_response); std::vector<std::shared_ptr<PhyLayer>> le_phys = phy_layers_[Phy::Type::LOW_ENERGY]; for (auto phy : le_phys) { for (auto phy : phy_layers_[Phy::Type::LOW_ENERGY]) { phy->Send(to_send); } } Loading
system/vendor_libs/test_vendor_lib/model/devices/device.cc +4 −4 Original line number Diff line number Diff line Loading @@ -42,10 +42,10 @@ void Device::UnregisterPhyLayers() { } void Device::UnregisterPhyLayer(Phy::Type phy_type, uint32_t factory_id) { for (size_t i = 0; i < phy_layers_[phy_type].size(); i++) { if (phy_layers_[phy_type][i]->IsFactoryId(factory_id)) { phy_layers_[phy_type][i]->Unregister(); phy_layers_[phy_type].erase(phy_layers_[phy_type].begin() + i); for (const auto phy_layer : phy_layers_[phy_type]) { if (phy_layer->IsFactoryId(factory_id)) { phy_layer->Unregister(); phy_layers_[phy_type].remove(phy_layer); } } } Loading
system/vendor_libs/test_vendor_lib/model/devices/device.h +2 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <chrono> #include <cstdint> #include <list> #include <map> #include <string> #include <vector> Loading Loading @@ -86,7 +87,7 @@ class Device { Phy::Type phy_type); protected: std::map<Phy::Type, std::vector<std::shared_ptr<PhyLayer>>> phy_layers_; std::map<Phy::Type, std::list<std::shared_ptr<PhyLayer>>> phy_layers_; std::chrono::steady_clock::time_point last_advertisement_; Loading
system/vendor_libs/test_vendor_lib/model/devices/loopback.cc +1 −2 Original line number Diff line number Diff line Loading @@ -80,8 +80,7 @@ void Loopback::IncomingPacket(model::packets::LinkLayerPacketView packet) { std::shared_ptr<model::packets::LinkLayerPacketBuilder> to_send = std::move(scan_response); std::vector<std::shared_ptr<PhyLayer>> le_phys = phy_layers_[Phy::Type::LOW_ENERGY]; for (auto phy : le_phys) { for (auto phy : phy_layers_[Phy::Type::LOW_ENERGY]) { LOG_INFO("Sending a Scan Response on a Phy"); phy->Send(to_send); } Loading
system/vendor_libs/test_vendor_lib/model/setup/phy_layer.h +9 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,12 @@ class PhyLayer { public: PhyLayer(Phy::Type phy_type, uint32_t id, const std::function<void(model::packets::LinkLayerPacketView)>& device_receive) : phy_type_(phy_type), id_(id), transmit_to_device_(device_receive) {} device_receive, uint32_t device_id) : phy_type_(phy_type), id_(id), device_id_(device_id), transmit_to_device_(device_receive) {} virtual void Send( const std::shared_ptr<model::packets::LinkLayerPacketBuilder> packet) = 0; Loading @@ -48,11 +52,14 @@ class PhyLayer { return id_; } uint32_t GetDeviceId() { return device_id_; } virtual ~PhyLayer() = default; private: Phy::Type phy_type_; uint32_t id_; uint32_t device_id_; protected: const std::function<void(model::packets::LinkLayerPacketView)> Loading