blob: 2afdb6d9f33e7cd23542f360cae9c07a02b66f93 [file] [log] [blame]
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06001#include <algorithm>
2#include <sdbusplus/server.hpp>
3#include <sdbusplus/exception.hpp>
4#include <xyz/openbmc_project/Logging/Internal/Manager/server.hpp>
5
6
7namespace sdbusplus
8{
9namespace xyz
10{
11namespace openbmc_project
12{
13namespace Logging
14{
15namespace Internal
16{
17namespace server
18{
19
20Manager::Manager(bus::bus& bus, const char* path)
21 : _xyz_openbmc_project_Logging_Internal_Manager_interface(
22 bus, path, _interface, _vtable, this)
23{
24}
25
26
27int Manager::_callback_Commit(
28 sd_bus_message* msg, void* context, sd_bus_error* error)
29{
30 using sdbusplus::server::binding::details::convertForMessage;
31
32 try
33 {
34 auto m = message::message(sd_bus_message_ref(msg));
35
36 uint64_t transactionId{};
37 std::string errMsg{};
38
39 m.read(transactionId, errMsg);
40
41 auto o = static_cast<Manager*>(context);
42 o->commit(transactionId, errMsg);
43
44 auto reply = m.new_method_return();
45 // No data to append on reply.
46
47 reply.method_return();
48 }
49 catch(sdbusplus::internal_exception_t& e)
50 {
51 sd_bus_error_set_const(error, e.name(), e.description());
52 return -EINVAL;
53 }
54
55 return true;
56}
57
58namespace details
59{
60namespace Manager
61{
62static const auto _param_Commit =
63 utility::tuple_to_array(message::types::type_id<
64 uint64_t, std::string>());
65static const auto _return_Commit =
66 utility::tuple_to_array(std::make_tuple('\0'));
67}
68}
69
70
71
72
73const vtable::vtable_t Manager::_vtable[] = {
74 vtable::start(),
75
76 vtable::method("Commit",
77 details::Manager::_param_Commit
78 .data(),
79 details::Manager::_return_Commit
80 .data(),
81 _callback_Commit),
82 vtable::end()
83};
84
85} // namespace server
86} // namespace Internal
87} // namespace Logging
88} // namespace openbmc_project
89} // namespace xyz
90} // namespace sdbusplus
91