blob: fead6478846a249adb3349697287f1cb2bdc882a [file] [log] [blame]
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05301#pragma once
2
Patrick Venture91ac8d32018-11-01 17:03:22 -07003#include "manager.hpp"
4
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05305#include <sdbusplus/bus.hpp>
6#include <sdbusplus/server/object.hpp>
Andrew Geisslerd02c3cb2020-05-16 10:28:02 -05007#include <string>
Vishwanatha Subbanna55ef5b02017-03-10 13:32:08 +05308#include <xyz/openbmc_project/Led/Group/server.hpp>
Andrew Geisslerd02c3cb2020-05-16 10:28:02 -05009
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053010namespace phosphor
11{
12namespace led
13{
14
15/** @class Group
16 * @brief Manages group of LEDs and applies action on the elements of group
17 */
18class Group : sdbusplus::server::object::object<
Patrick Venture91ac8d32018-11-01 17:03:22 -070019 sdbusplus::xyz::openbmc_project::Led::server::Group>
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053020{
Patrick Venture91ac8d32018-11-01 17:03:22 -070021 public:
22 Group() = delete;
23 ~Group() = default;
24 Group(const Group&) = delete;
25 Group& operator=(const Group&) = delete;
26 Group(Group&&) = default;
27 Group& operator=(Group&&) = default;
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053028
Patrick Venture91ac8d32018-11-01 17:03:22 -070029 /** @brief Constructs LED Group
30 *
31 * @param[in] bus - Handle to system dbus
32 * @param[in] objPath - The Dbus path that hosts LED group
33 * @param[in] manager - Reference to Manager
34 */
35 Group(sdbusplus::bus::bus& bus, const std::string& objPath,
36 Manager& manager) :
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053037
Patrick Venture91ac8d32018-11-01 17:03:22 -070038 sdbusplus::server::object::object<
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053039 sdbusplus::xyz::openbmc_project::Led::server::Group>(
Patrick Venture91ac8d32018-11-01 17:03:22 -070040 bus, objPath.c_str()),
41 path(objPath), manager(manager)
42 {
43 // Nothing to do here
44 }
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053045
Patrick Venture91ac8d32018-11-01 17:03:22 -070046 /** @brief Property SET Override function
47 *
48 * @param[in] value - True or False
49 * @return - Success or exception thrown
50 */
51 bool asserted(bool value) override;
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053052
Patrick Venture91ac8d32018-11-01 17:03:22 -070053 private:
54 /** @brief Path of the group instance */
55 std::string path;
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053056
Patrick Venture91ac8d32018-11-01 17:03:22 -070057 /** @brief Reference to Manager object */
58 Manager& manager;
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053059};
60
61} // namespace led
62} // namespace phosphor