blob: 4df1a6aa4545f5963159ffb5f07b742a9f809c10 [file] [log] [blame]
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05301#include <iostream>
Vishwanatha Subbannaed490732016-12-20 15:59:29 +05302#include "ledlayout.hpp"
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05303#include "manager.hpp"
4#include "group.hpp"
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +05305#include "config.h"
Vishwanatha Subbannaed490732016-12-20 15:59:29 +05306#include "led-gen.hpp"
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +05307
8int main(void)
9{
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053010 /** @brief Dbus constructs used by LED Group manager */
11 sdbusplus::bus::bus bus = sdbusplus::bus::new_default();
12
Vishwanatha Subbanna11ca8f92017-02-27 19:33:45 +053013 /** @brief Group manager object */
14 phosphor::led::Manager manager(bus, systemLedMap);
15
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053016 /** @brief sd_bus object manager */
17 sdbusplus::server::manager::manager objManager(bus, OBJPATH);
18
19 /** @brief vector of led groups */
20 std::vector<std::unique_ptr<phosphor::led::Group>> groups;
21
22 /** Now create so many dbus objects as there are groups */
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053023 for (auto &grp: systemLedMap)
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053024 {
25 groups.emplace_back(std::make_unique<phosphor::led::Group>(
26 bus, grp.first, manager));
27 }
28
29 /** @brief Claim the bus */
30 bus.request_name(BUSNAME);
31
32 /** @brief Wait for client requests */
33 while(true)
34 {
35 /** @brief process dbus calls / signals discarding unhandled */
36 bus.process_discard();
37 bus.wait();
38 }
Vishwanatha Subbannab21fda72016-10-17 17:46:37 +053039 return 0;
40}