Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame^] | 1 | #include <iostream> |
| 2 | #include "manager.hpp" |
| 3 | #include "group.hpp" |
Vishwanatha Subbanna | b21fda7 | 2016-10-17 17:46:37 +0530 | [diff] [blame] | 4 | #include "config.h" |
| 5 | |
| 6 | int main(void) |
| 7 | { |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame^] | 8 | /** @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 Subbanna | b21fda7 | 2016-10-17 17:46:37 +0530 | [diff] [blame] | 37 | return 0; |
| 38 | } |