| Jagpal Singh Gill | cad9ecf | 2025-10-22 19:53:16 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "common/entity_manager_interface.hpp" |
| Jagpal Singh Gill | 7184805 | 2025-10-16 00:28:58 -0700 | [diff] [blame^] | 4 | #include "common/events.hpp" |
| Jagpal Singh Gill | e92aba4 | 2025-10-16 00:00:13 -0700 | [diff] [blame] | 5 | #include "device/base_device.hpp" |
| Jagpal Singh Gill | cad9ecf | 2025-10-22 19:53:16 -0700 | [diff] [blame] | 6 | #include "inventory/modbus_inventory.hpp" |
| 7 | #include "port/base_port.hpp" |
| 8 | |
| 9 | #include <sdbusplus/async.hpp> |
| 10 | |
| 11 | namespace phosphor::modbus::rtu |
| 12 | { |
| 13 | |
| 14 | namespace InventoryIntf = phosphor::modbus::rtu::inventory; |
| 15 | namespace PortIntf = phosphor::modbus::rtu::port; |
| Jagpal Singh Gill | e92aba4 | 2025-10-16 00:00:13 -0700 | [diff] [blame] | 16 | namespace ModbusIntf = phosphor::modbus::rtu; |
| 17 | namespace DeviceIntf = phosphor::modbus::rtu::device; |
| Jagpal Singh Gill | 7184805 | 2025-10-16 00:28:58 -0700 | [diff] [blame^] | 18 | namespace EventIntf = phosphor::modbus::events; |
| Jagpal Singh Gill | cad9ecf | 2025-10-22 19:53:16 -0700 | [diff] [blame] | 19 | |
| 20 | class DeviceManager |
| 21 | { |
| 22 | public: |
| 23 | DeviceManager() = delete; |
| 24 | DeviceManager(const DeviceManager&) = delete; |
| 25 | DeviceManager& operator=(const DeviceManager&) = delete; |
| 26 | DeviceManager(DeviceManager&&) = delete; |
| 27 | DeviceManager& operator=(DeviceManager&&) = delete; |
| 28 | |
| 29 | explicit DeviceManager(sdbusplus::async::context& ctx); |
| 30 | |
| 31 | private: |
| 32 | using inventory_device_map_t = |
| 33 | std::unordered_map<std::string, std::unique_ptr<InventoryIntf::Device>>; |
| Jagpal Singh Gill | e92aba4 | 2025-10-16 00:00:13 -0700 | [diff] [blame] | 34 | |
| Jagpal Singh Gill | cad9ecf | 2025-10-22 19:53:16 -0700 | [diff] [blame] | 35 | using port_map_t = |
| 36 | std::unordered_map<std::string, std::unique_ptr<PortIntf::BasePort>>; |
| 37 | |
| Jagpal Singh Gill | e92aba4 | 2025-10-16 00:00:13 -0700 | [diff] [blame] | 38 | using device_map_t = |
| 39 | std::unordered_map<std::string, |
| 40 | std::unique_ptr<DeviceIntf::BaseDevice>>; |
| 41 | |
| Jagpal Singh Gill | cad9ecf | 2025-10-22 19:53:16 -0700 | [diff] [blame] | 42 | auto processConfigAdded(const sdbusplus::message::object_path& objectPath, |
| 43 | const std::string& interfaceName) |
| 44 | -> sdbusplus::async::task<>; |
| 45 | |
| Jagpal Singh Gill | e92aba4 | 2025-10-16 00:00:13 -0700 | [diff] [blame] | 46 | auto processPortAdded(const sdbusplus::message::object_path& objectPath, |
| 47 | const std::string& interfaceName) |
| 48 | -> sdbusplus::async::task<>; |
| 49 | |
| 50 | auto processInventoryAdded( |
| 51 | const sdbusplus::message::object_path& objectPath) |
| 52 | -> sdbusplus::async::task<>; |
| 53 | |
| 54 | auto processDeviceAdded(const sdbusplus::message::object_path& objectPath, |
| 55 | const std::string& interfaceName) |
| 56 | -> sdbusplus::async::task<>; |
| 57 | |
| Jagpal Singh Gill | cad9ecf | 2025-10-22 19:53:16 -0700 | [diff] [blame] | 58 | auto processConfigRemoved(const sdbusplus::message::object_path& objectPath, |
| 59 | const std::string& interfaceName) |
| 60 | -> sdbusplus::async::task<>; |
| 61 | |
| 62 | sdbusplus::async::context& ctx; |
| 63 | entity_manager::EntityManagerInterface entityManager; |
| Jagpal Singh Gill | 7184805 | 2025-10-16 00:28:58 -0700 | [diff] [blame^] | 64 | EventIntf::Events events; |
| Jagpal Singh Gill | cad9ecf | 2025-10-22 19:53:16 -0700 | [diff] [blame] | 65 | inventory_device_map_t inventoryDevices; |
| 66 | port_map_t ports; |
| Jagpal Singh Gill | e92aba4 | 2025-10-16 00:00:13 -0700 | [diff] [blame] | 67 | device_map_t devices; // Modbus devices |
| Jagpal Singh Gill | cad9ecf | 2025-10-22 19:53:16 -0700 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | } // namespace phosphor::modbus::rtu |