blob: fdfcf55d7457e89e7fd2df7681c173d6ce59769f [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>
Vishwanatha Subbanna55ef5b02017-03-10 13:32:08 +05307#include <xyz/openbmc_project/Led/Group/server.hpp>
Andrew Geisslerd02c3cb2020-05-16 10:28:02 -05008
George Liua6c18f82020-06-22 10:50:04 +08009#include <string>
10
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053011namespace phosphor
12{
13namespace led
14{
15
16/** @class Group
17 * @brief Manages group of LEDs and applies action on the elements of group
18 */
George Liua6c18f82020-06-22 10:50:04 +080019class Group :
20 sdbusplus::server::object::object<
21 sdbusplus::xyz::openbmc_project::Led::server::Group>
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053022{
Patrick Venture91ac8d32018-11-01 17:03:22 -070023 public:
24 Group() = delete;
25 ~Group() = default;
26 Group(const Group&) = delete;
27 Group& operator=(const Group&) = delete;
28 Group(Group&&) = default;
29 Group& operator=(Group&&) = default;
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053030
Patrick Venture91ac8d32018-11-01 17:03:22 -070031 /** @brief Constructs LED Group
32 *
33 * @param[in] bus - Handle to system dbus
34 * @param[in] objPath - The Dbus path that hosts LED group
35 * @param[in] manager - Reference to Manager
36 */
37 Group(sdbusplus::bus::bus& bus, const std::string& objPath,
38 Manager& manager) :
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053039
Patrick Venture91ac8d32018-11-01 17:03:22 -070040 sdbusplus::server::object::object<
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053041 sdbusplus::xyz::openbmc_project::Led::server::Group>(
Patrick Venture91ac8d32018-11-01 17:03:22 -070042 bus, objPath.c_str()),
43 path(objPath), manager(manager)
44 {
45 // Nothing to do here
46 }
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053047
Patrick Venture91ac8d32018-11-01 17:03:22 -070048 /** @brief Property SET Override function
49 *
50 * @param[in] value - True or False
51 * @return - Success or exception thrown
52 */
53 bool asserted(bool value) override;
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053054
Patrick Venture91ac8d32018-11-01 17:03:22 -070055 private:
56 /** @brief Path of the group instance */
57 std::string path;
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053058
Patrick Venture91ac8d32018-11-01 17:03:22 -070059 /** @brief Reference to Manager object */
60 Manager& manager;
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053061};
62
63} // namespace led
64} // namespace phosphor