1 #pragma once
2 
3 #include <sdbusplus/bus.hpp>
4 #include <sdbusplus/server/object.hpp>
5 #include <org/open_power/OCC/Status/server.hpp>
6 #include "occ_device.hpp"
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)
34             : Interface(bus, path),
35               path(path),
36               device(name + std::to_string((this->path.back() - '0') + 1))
37         {
38             // Nothing to do here
39         }
40 
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 
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;
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;
64 };
65 
66 } // namespace occ
67 } // namespace open_power
68