Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include <sdbusplus/server/object.hpp> |
| 5 | #include <org/open_power/OCC/Status/server.hpp> |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 6 | #include "occ_device.hpp" |
Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 7 | namespace open_power |
| 8 | { |
| 9 | namespace occ |
| 10 | { |
| 11 | |
| 12 | namespace Base = sdbusplus::org::open_power::OCC::server; |
| 13 | using Interface = sdbusplus::server::object::object<Base::Status>; |
| 14 | |
| 15 | /** @class Status |
| 16 | * @brief Implementation of OCC Active Status |
| 17 | */ |
| 18 | class 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 Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 34 | : Interface(bus, path), |
| 35 | path(path), |
| 36 | device(name + std::to_string((this->path.back() - '0') + 1)) |
Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 37 | { |
| 38 | // Nothing to do here |
| 39 | } |
| 40 | |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 41 | /** @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 Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 47 | /** @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 Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 54 | |
| 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 Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } // namespace occ |
| 67 | } // namespace open_power |