代码拉取完成,页面将自动刷新
#pragma once
#include "config.h"
#include "settings.hpp"
#include <sdbusplus/bus.hpp>
#include <xyz/openbmc_project/State/Boot/Progress/client.hpp>
#include <xyz/openbmc_project/State/Host/server.hpp>
namespace phosphor
{
namespace state
{
namespace manager
{
using HypervisorInherit = sdbusplus::server::object_t<
sdbusplus::server::xyz::openbmc_project::state::Host>;
using BootProgress =
sdbusplus::client::xyz::openbmc_project::state::boot::Progress<>;
namespace server = sdbusplus::server::xyz::openbmc_project::state;
namespace sdbusRule = sdbusplus::bus::match::rules;
/** @class Host
* @brief OpenBMC host state management implementation.
* @details A concrete implementation for xyz.openbmc_project.State.Host
* DBus API.
*/
class Hypervisor : public HypervisorInherit
{
public:
Hypervisor() = delete;
Hypervisor(const Hypervisor&) = delete;
Hypervisor& operator=(const Hypervisor&) = delete;
Hypervisor(Hypervisor&&) = delete;
Hypervisor& operator=(Hypervisor&&) = delete;
virtual ~Hypervisor() = default;
/** @brief Constructs Hypervisor State Manager
*
* @param[in] bus - The Dbus bus object
* @param[in] objPath - The Dbus object path
*/
Hypervisor(sdbusplus::bus_t& bus, const char* objPath) :
HypervisorInherit(bus, objPath,
HypervisorInherit::action::emit_object_added),
bus(bus),
bootProgressChangeSignal(
bus,
sdbusRule::propertiesChanged("/xyz/openbmc_project/state/host0",
BootProgress::interface),
[this](sdbusplus::message_t& m) { bootProgressChangeEvent(m); })
{}
/** @brief Set value of HostTransition */
server::Host::Transition
requestedHostTransition(server::Host::Transition value) override;
/** @brief Set value of CurrentHostState */
server::Host::HostState
currentHostState(server::Host::HostState value) override;
/** @brief Return value of CurrentHostState */
server::Host::HostState currentHostState() const override;
/** @brief Check if BootProgress change affects hypervisor state
*
* @param[in] bootProgress - BootProgress value to check
*
*/
void updateCurrentHostState(std::string& bootProgress);
private:
/** @brief Process BootProgress property changes
*
* Instance specific interface to monitor for changes to the BootProgress
* property which may impact Hypervisor state.
*
* @param[in] msg - Data associated with subscribed signal
*
*/
void bootProgressChangeEvent(sdbusplus::message_t& msg);
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus_t& bus;
/** @brief Watch BootProgress changes to know hypervisor state **/
sdbusplus::bus::match_t bootProgressChangeSignal;
};
} // namespace manager
} // namespace state
} // namespace phosphor
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。