Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 1 | #include <iostream> |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 2 | #include "ledlayout.hpp" |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 3 | #include "manager.hpp" |
| 4 | #include "group.hpp" |
Vishwanatha Subbanna | b21fda7 | 2016-10-17 17:46:37 +0530 | [diff] [blame] | 5 | #include "config.h" |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 6 | #include "led-gen.hpp" |
Vishwanatha Subbanna | b21fda7 | 2016-10-17 17:46:37 +0530 | [diff] [blame] | 7 | |
| 8 | int main(void) |
| 9 | { |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 10 | /** @brief Dbus constructs used by LED Group manager */ |
| 11 | sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); |
| 12 | |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 13 | /** @brief Group manager object */ |
| 14 | phosphor::led::Manager manager(bus, systemLedMap); |
| 15 | |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 16 | /** @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 Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 23 | for (auto &grp: systemLedMap) |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 24 | { |
| 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 Subbanna | b21fda7 | 2016-10-17 17:46:37 +0530 | [diff] [blame] | 39 | return 0; |
| 40 | } |