blob: 992a51a1289bcc970e10409d2cdda7f58eb7173c [file] [log] [blame]
#pragma once
#include "types.hpp"
#include "zone.hpp"
#include <sdbusplus/bus.hpp>
#include <sdeventplus/event.hpp>
#include <memory>
#include <vector>
namespace phosphor
{
namespace fan
{
namespace control
{
using ZoneMap = std::map<unsigned int, std::unique_ptr<Zone>>;
/**
* @class Fan control manager
*/
class Manager
{
public:
Manager() = delete;
Manager(const Manager&) = delete;
Manager(Manager&&) = default;
Manager& operator=(const Manager&) = delete;
Manager& operator=(Manager&&) = delete;
~Manager() = default;
/**
* Constructor
* Creates the Zone objects based on the
* _zoneLayouts data.
*
* @param[in] bus - The dbus object
* @param[in] event - The event loop
* @param[in] mode - The control mode
*/
Manager(sdbusplus::bus_t& bus, const sdeventplus::Event& event, Mode mode);
/**
* Does the fan control inititialization, which is
* setting fans to full, delaying so they
* can get there, and starting a target.
*/
void doInit(const sdeventplus::Event& event);
private:
/**
* The dbus object
*/
sdbusplus::bus_t& _bus;
/**
* The sdbusplus object manager
*/
sdbusplus::server::manager_t _objMgr;
/**
* The fan zones in the system
*/
ZoneMap _zones;
/**
* The fan zone layout for the system.
* This is generated data.
*/
static const std::vector<ZoneGroup> _zoneLayouts;
/**
* The number of seconds to delay after
* fans get set to high speed on a power on
* to give them a chance to get there.
*/
static const unsigned int _powerOnDelay;
};
} // namespace control
} // namespace fan
} // namespace phosphor