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