| #pragma once |
| |
| #include <boost/asio/io_context.hpp> |
| #include <phosphor-logging/lg2.hpp> |
| #include <sdbusplus/asio/object_server.hpp> |
| #include <sdbusplus/asio/property.hpp> |
| |
| #include <chrono> |
| #include <ctime> |
| #include <filesystem> |
| #include <fstream> |
| #include <iostream> |
| #include <regex> |
| #include <string> |
| #include <variant> |
| #include <vector> |
| |
| const std::filesystem::path powerFaultLogDir = |
| "/mnt/luks-mmcblk0_fs/power-fault-logs"; |
| |
| constexpr const char* powerFaultPath = "/xyz/openbmc_project/powerfault"; |
| constexpr const char* powerFaultService = "xyz.openbmc_project.powerfault"; |
| constexpr const char* powerFaultInterface = "xyz.openbmc_project.powerfault"; |
| |
| // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) |
| static boost::asio::io_context io; |
| // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) |
| static std::shared_ptr<sdbusplus::asio::connection> conn; |
| // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) |
| static std::shared_ptr<sdbusplus::asio::object_server> server; |
| |
| class DbusUtility |
| { |
| public: |
| static void sendSdBusSignal( |
| const char* signalName, |
| const std::shared_ptr<sdbusplus::asio::dbus_interface>& ifaceLog); |
| virtual void dbusAddStoredLog(const std::string& logFileName); |
| }; |
| |
| #ifdef UNIT_TEST |
| // forward declaration |
| class MockDbusUtility; |
| using DbusUtil = MockDbusUtility; |
| #else |
| using DbusUtil = DbusUtility; |
| #endif |
| |
| DbusUtil* getDbusUtil(); |