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