Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame^] | 1 | #include "config.h" |
| 2 | |
| 3 | #include "group.hpp" |
| 4 | #include "led-gen.hpp" |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 5 | #include "ledlayout.hpp" |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 6 | #include "manager.hpp" |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame^] | 7 | |
| 8 | #include <iostream> |
Vishwanatha Subbanna | b21fda7 | 2016-10-17 17:46:37 +0530 | [diff] [blame] | 9 | |
| 10 | int main(void) |
| 11 | { |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 12 | /** @brief Dbus constructs used by LED Group manager */ |
| 13 | sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); |
| 14 | |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 15 | /** @brief Group manager object */ |
| 16 | phosphor::led::Manager manager(bus, systemLedMap); |
| 17 | |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 18 | /** @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 Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame^] | 25 | for (auto& grp : systemLedMap) |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 26 | { |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame^] | 27 | groups.emplace_back( |
| 28 | std::make_unique<phosphor::led::Group>(bus, grp.first, manager)); |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | /** @brief Claim the bus */ |
| 32 | bus.request_name(BUSNAME); |
| 33 | |
| 34 | /** @brief Wait for client requests */ |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame^] | 35 | while (true) |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 36 | { |
| 37 | /** @brief process dbus calls / signals discarding unhandled */ |
| 38 | bus.process_discard(); |
| 39 | bus.wait(); |
| 40 | } |
Vishwanatha Subbanna | b21fda7 | 2016-10-17 17:46:37 +0530 | [diff] [blame] | 41 | return 0; |
| 42 | } |