Brad Bishop | adc4566 | 2016-10-28 20:00:57 -0500 | [diff] [blame] | 1 | #include <sdbusplus/server.hpp> |
| 2 | #include <xyz/openbmc_project/Inventory/Manager/server.hpp> |
| 3 | |
| 4 | namespace sdbusplus |
| 5 | { |
| 6 | namespace server |
| 7 | { |
| 8 | namespace xyz |
| 9 | { |
| 10 | namespace openbmc_project |
| 11 | { |
| 12 | namespace Inventory |
| 13 | { |
| 14 | |
| 15 | Manager::Manager(bus::bus& bus, const char* path) |
| 16 | : _xyz_openbmc_project_Inventory_Manager_interface( |
| 17 | bus, path, _interface, _vtable, this) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | |
| 22 | int Manager::_callback_Notify( |
| 23 | sd_bus_message* msg, void* context, sd_bus_error* error) |
| 24 | { |
| 25 | auto m = message::message(sd_bus_message_ref(msg)); |
| 26 | |
| 27 | std::string path{}; |
| 28 | std::map<std::string, std::map<std::string, sdbusplus::message::variant<std::string>>> object{}; |
| 29 | |
| 30 | m.read(path, object); |
| 31 | |
| 32 | auto o = static_cast<Manager*>(context); |
| 33 | o->notify(path, object); |
| 34 | |
| 35 | auto reply = m.new_method_return(); |
| 36 | // No data to append on reply. |
| 37 | |
| 38 | reply.method_return(); |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | namespace details |
| 44 | { |
| 45 | namespace Manager |
| 46 | { |
| 47 | static const auto _param_Notify = |
| 48 | utility::tuple_to_array(message::types::type_id< |
| 49 | std::string, std::map<std::string, std::map<std::string, sdbusplus::message::variant<std::string>>>>()); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | |
| 54 | |
| 55 | const vtable::vtable_t Manager::_vtable[] = { |
| 56 | vtable::start(), |
| 57 | |
| 58 | vtable::method("Notify", |
| 59 | details::Manager::_param_Notify |
| 60 | .data(), |
| 61 | nullptr, |
| 62 | _callback_Notify), |
| 63 | vtable::end() |
| 64 | }; |
| 65 | |
| 66 | } // namespace Inventory |
| 67 | } // namespace openbmc_project |
| 68 | } // namespace xyz |
| 69 | } // namespace server |
| 70 | } // namespace sdbusplus |
| 71 | |