1 #pragma once 2 3 #include "common/entity_manager_interface.hpp" 4 #include "inventory/modbus_inventory.hpp" 5 #include "port/base_port.hpp" 6 7 #include <sdbusplus/async.hpp> 8 9 namespace phosphor::modbus::rtu 10 { 11 12 namespace InventoryIntf = phosphor::modbus::rtu::inventory; 13 namespace PortIntf = phosphor::modbus::rtu::port; 14 15 class DeviceManager 16 { 17 public: 18 DeviceManager() = delete; 19 DeviceManager(const DeviceManager&) = delete; 20 DeviceManager& operator=(const DeviceManager&) = delete; 21 DeviceManager(DeviceManager&&) = delete; 22 DeviceManager& operator=(DeviceManager&&) = delete; 23 24 explicit DeviceManager(sdbusplus::async::context& ctx); 25 26 private: 27 using inventory_device_map_t = 28 std::unordered_map<std::string, std::unique_ptr<InventoryIntf::Device>>; 29 using port_map_t = 30 std::unordered_map<std::string, std::unique_ptr<PortIntf::BasePort>>; 31 32 auto processConfigAdded(const sdbusplus::message::object_path& objectPath, 33 const std::string& interfaceName) 34 -> sdbusplus::async::task<>; 35 36 auto processConfigRemoved(const sdbusplus::message::object_path& objectPath, 37 const std::string& interfaceName) 38 -> sdbusplus::async::task<>; 39 40 sdbusplus::async::context& ctx; 41 entity_manager::EntityManagerInterface entityManager; 42 inventory_device_map_t inventoryDevices; 43 port_map_t ports; 44 }; 45 46 } // namespace phosphor::modbus::rtu 47