blob: 8a091eb76cabb23b88302ecd22db80bf239155be [file] [log] [blame]
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05301#include <iostream>
2#include "manager.hpp"
3#include "group.hpp"
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +05304#include "config.h"
5
6int main(void)
7{
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05308 /** @brief Group manager object */
9 phosphor::led::Manager manager;
10
11 /** @brief Dbus constructs used by LED Group manager */
12 sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
13
14 /** @brief sd_bus object manager */
15 sdbusplus::server::manager::manager objManager(bus, OBJPATH);
16
17 /** @brief vector of led groups */
18 std::vector<std::unique_ptr<phosphor::led::Group>> groups;
19
20 /** Now create so many dbus objects as there are groups */
21 for (auto &grp: phosphor::led::Manager::ledMap)
22 {
23 groups.emplace_back(std::make_unique<phosphor::led::Group>(
24 bus, grp.first, manager));
25 }
26
27 /** @brief Claim the bus */
28 bus.request_name(BUSNAME);
29
30 /** @brief Wait for client requests */
31 while(true)
32 {
33 /** @brief process dbus calls / signals discarding unhandled */
34 bus.process_discard();
35 bus.wait();
36 }
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +053037 return 0;
38}