blob: cc0e6cf4cb07764b3f7dd7fca5e38405583cdfdd [file] [log] [blame]
Patrick Venture91ac8d32018-11-01 17:03:22 -07001#include "config.h"
2
3#include "group.hpp"
4#include "led-gen.hpp"
Vishwanatha Subbannaed490732016-12-20 15:59:29 +05305#include "ledlayout.hpp"
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05306#include "manager.hpp"
Patrick Venture91ac8d32018-11-01 17:03:22 -07007
8#include <iostream>
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +05309
10int main(void)
11{
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053012 /** @brief Dbus constructs used by LED Group manager */
13 sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
14
Vishwanatha Subbanna11ca8f92017-02-27 19:33:45 +053015 /** @brief Group manager object */
16 phosphor::led::Manager manager(bus, systemLedMap);
17
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053018 /** @brief sd_bus object manager */
19 sdbusplus::server::manager::manager objManager(bus, OBJPATH);
20
21 /** @brief vector of led groups */
22 std::vector<std::unique_ptr<phosphor::led::Group>> groups;
23
24 /** Now create so many dbus objects as there are groups */
Patrick Venture91ac8d32018-11-01 17:03:22 -070025 for (auto& grp : systemLedMap)
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053026 {
Patrick Venture91ac8d32018-11-01 17:03:22 -070027 groups.emplace_back(
28 std::make_unique<phosphor::led::Group>(bus, grp.first, manager));
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053029 }
30
31 /** @brief Claim the bus */
32 bus.request_name(BUSNAME);
33
34 /** @brief Wait for client requests */
Patrick Venture91ac8d32018-11-01 17:03:22 -070035 while (true)
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053036 {
37 /** @brief process dbus calls / signals discarding unhandled */
38 bus.process_discard();
39 bus.wait();
40 }
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +053041 return 0;
42}