blob: 5d092b7d6c1f4f482ceb1eba5f307e7dd27a60b3 [file] [log] [blame]
Vishwanatha Subbanna307d80b2017-06-28 15:56:09 +05301#pragma once
2
3#include <sdbusplus/bus.hpp>
4#include <sdbusplus/server/object.hpp>
5#include <org/open_power/OCC/Status/server.hpp>
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +05306#include "occ_device.hpp"
Vishwanatha Subbanna307d80b2017-06-28 15:56:09 +05307namespace open_power
8{
9namespace occ
10{
11
12namespace Base = sdbusplus::org::open_power::OCC::server;
13using Interface = sdbusplus::server::object::object<Base::Status>;
14
15/** @class Status
16 * @brief Implementation of OCC Active Status
17 */
18class Status : public Interface
19{
20 public:
21 Status() = delete;
22 ~Status() = default;
23 Status(const Status&) = delete;
24 Status& operator=(const Status&) = delete;
25 Status(Status&&) = default;
26 Status& operator=(Status&&) = default;
27
28 /** @brief Constructs the Status object
29 *
30 * @param[in] bus - DBus bus to attach to
31 * @param[in] path - DBus object path
32 */
33 Status(sdbusplus::bus::bus& bus, const char* path)
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +053034 : Interface(bus, path),
35 path(path),
36 device(name + std::to_string((this->path.back() - '0') + 1))
Vishwanatha Subbanna307d80b2017-06-28 15:56:09 +053037 {
38 // Nothing to do here
39 }
40
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +053041 /** @brief Since we are overriding the setter-occActive but not the
42 * getter-occActive, we need to have this using in order to
43 * allow passthrough usage of the getter-occActive
44 */
45 using Base::Status::occActive;
46
Vishwanatha Subbanna307d80b2017-06-28 15:56:09 +053047 /** @brief SET OccActive to True or False
48 *
49 * @param[in] value - Intended value
50 *
51 * @return - Updated value of the property
52 */
53 bool occActive(bool value) override;
Vishwanatha Subbanna32e84e92017-06-28 19:17:28 +053054
55 private:
56 /** @brief OCC dbus object path */
57 std::string path;
58
59 /** @brief occ name prefix */
60 std::string name = OCC_NAME;
61
62 /** @brief OCC device object to do bind and unbind */
63 Device device;
Vishwanatha Subbanna307d80b2017-06-28 15:56:09 +053064};
65
66} // namespace occ
67} // namespace open_power