diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-06-28 15:56:09 +0530 |
---|---|---|
committer | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-07-04 12:26:27 +0530 |
commit | 307d80b3d78efc669f38a63938371adcc6934391 (patch) | |
tree | 3435e2bc4c20cf4a62f514d92612c38a19a966d4 | |
parent | 2180b2daa8f2207c37308a09e12d08ed3317205c (diff) | |
download | openpower-occ-control-307d80b3d78efc669f38a63938371adcc6934391.tar.gz openpower-occ-control-307d80b3d78efc669f38a63938371adcc6934391.zip |
Implement OCC status interface
Change-Id: I43822cb28bc2d23398fb09352c9876e169c666f7
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | occ_manager.hpp | 16 | ||||
-rw-r--r-- | occ_status.cpp | 14 | ||||
-rw-r--r-- | occ_status.hpp | 48 |
4 files changed, 77 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index b68f9a0..a15ea12 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,10 +1,12 @@ # Build these headers, don't install them noinst_HEADERS = \ - occ_pass_through.hpp + occ_pass_through.hpp \ + occ_status.hpp sbin_PROGRAMS = openpower-occ-control openpower_occ_control_SOURCES = \ occ_pass_through.cpp \ + occ_status.cpp \ app.cpp \ org/open_power/OCC/PassThrough/error.cpp diff --git a/occ_manager.hpp b/occ_manager.hpp index 067a6d2..a1b5234 100644 --- a/occ_manager.hpp +++ b/occ_manager.hpp @@ -6,6 +6,7 @@ #include <functional> #include <sdbusplus/bus.hpp> #include "occ_pass_through.hpp" +#include "occ_status.hpp" #include "config.h" namespace sdbusRule = sdbusplus::bus::match::rules; @@ -28,8 +29,8 @@ struct Manager Manager& operator=(Manager&&) = default; ~Manager() = default; - /** @brief Ctor - Add OCC pass-through objects on the bus. Create - * OCC objects when corresponding CPU inventory is created. + /** @brief Adds OCC pass-through and status objects on the bus + * when corresponding CPU inventory is created. * @param[in] bus - handle to the bus */ Manager(sdbusplus::bus::bus& bus): @@ -68,11 +69,15 @@ struct Manager name.replace(index, std::strlen(CPU_NAME), OCC_NAME); auto path = fs::path(OCC_CONTROL_ROOT) / name; - objects.emplace_back( + passThroughObjects.emplace_back( std::make_unique<PassThrough>( bus, path.c_str())); + statusObjects.emplace_back( + std::make_unique<Status>( + bus, + path.c_str())); return 0; } @@ -81,7 +86,10 @@ struct Manager sdbusplus::bus::bus& bus; /** @brief OCC pass-through objects */ - std::vector<std::unique_ptr<PassThrough>> objects; + std::vector<std::unique_ptr<PassThrough>> passThroughObjects; + + /** @brief OCC Status objects */ + std::vector<std::unique_ptr<Status>> statusObjects; /** @brief sbdbusplus match objects */ std::vector<sdbusplus::bus::match_t> cpuMatches; diff --git a/occ_status.cpp b/occ_status.cpp new file mode 100644 index 0000000..a78ea47 --- /dev/null +++ b/occ_status.cpp @@ -0,0 +1,14 @@ +#include "occ_status.hpp" +namespace open_power +{ +namespace occ +{ + +// Handles updates to occActive property +bool Status::occActive(bool value) +{ + return Base::Status::occActive(value); +} + +} // namespace occ +} // namespace open_power diff --git a/occ_status.hpp b/occ_status.hpp new file mode 100644 index 0000000..068f83b --- /dev/null +++ b/occ_status.hpp @@ -0,0 +1,48 @@ +#pragma once + +#include <sdbusplus/bus.hpp> +#include <sdbusplus/server/object.hpp> +#include <org/open_power/OCC/Status/server.hpp> +namespace open_power +{ +namespace occ +{ + +namespace Base = sdbusplus::org::open_power::OCC::server; +using Interface = sdbusplus::server::object::object<Base::Status>; + +/** @class Status + * @brief Implementation of OCC Active Status + */ +class Status : public Interface +{ + public: + Status() = delete; + ~Status() = default; + Status(const Status&) = delete; + Status& operator=(const Status&) = delete; + Status(Status&&) = default; + Status& operator=(Status&&) = default; + + /** @brief Constructs the Status object + * + * @param[in] bus - DBus bus to attach to + * @param[in] path - DBus object path + */ + Status(sdbusplus::bus::bus& bus, const char* path) + : Interface(bus, path) + { + // Nothing to do here + } + + /** @brief SET OccActive to True or False + * + * @param[in] value - Intended value + * + * @return - Updated value of the property + */ + bool occActive(bool value) override; +}; + +} // namespace occ +} // namespace open_power |