summaryrefslogtreecommitdiffstats
path: root/xyz.openbmc_project.Inventory.Manager.cpp
blob: 787b65fa43db07d990a74e59f1affe6ff830b490 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <algorithm>
#include <sdbusplus/server.hpp>
#include <sdbusplus/exception.hpp>
#include <xyz/openbmc_project/Inventory/Manager/server.hpp>


namespace sdbusplus
{
namespace xyz
{
namespace openbmc_project
{
namespace Inventory
{
namespace server
{

Manager::Manager(bus::bus& bus, const char* path)
        : _xyz_openbmc_project_Inventory_Manager_interface(
                bus, path, _interface, _vtable, this)
{
}


int Manager::_callback_Notify(
        sd_bus_message* msg, void* context, sd_bus_error* error)
{
    using sdbusplus::server::binding::details::convertForMessage;

    try
    {
        auto m = message::message(msg);

        sdbusplus::message::object_path path{};
    std::map<std::string, std::map<std::string, sdbusplus::message::variant<int64_t, std::string>>> object{};

        m.read(path, object);

        auto o = static_cast<Manager*>(context);
        o->notify(path, object);

        auto reply = m.new_method_return();
        // No data to append on reply.

        reply.method_return();
    }
    catch(sdbusplus::internal_exception_t& e)
    {
        sd_bus_error_set_const(error, e.name(), e.description());
        return -EINVAL;
    }

    return true;
}

namespace details
{
namespace Manager
{
static const auto _param_Notify =
        utility::tuple_to_array(message::types::type_id<
                sdbusplus::message::object_path, std::map<std::string, std::map<std::string, sdbusplus::message::variant<int64_t, std::string>>>>());
static const auto _return_Notify =
        utility::tuple_to_array(std::make_tuple('\0'));
}
}




const vtable::vtable_t Manager::_vtable[] = {
    vtable::start(),

    vtable::method("Notify",
                   details::Manager::_param_Notify
                        .data(),
                   details::Manager::_return_Notify
                        .data(),
                   _callback_Notify),
    vtable::end()
};

} // namespace server
} // namespace Inventory
} // namespace openbmc_project
} // namespace xyz
} // namespace sdbusplus

OpenPOWER on IntegriCloud