Skip to content

Commit

Permalink
simplify register property of schema in ipc signals
Browse files Browse the repository at this point in the history
  • Loading branch information
jbbjarnason committed Jun 26, 2024
1 parent 1908499 commit 3c26b1c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions libs/ipc/inc/public/tfc/ipc/details/dbus_ipc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,7 @@ class dbus_ipc {
interface_->register_signal<value_t>(std::string{ dbus::tags::value });
interface_->register_property_r<value_t>(std::string{ dbus::tags::value }, sdbusplus::vtable::property_::none,
[this](const auto&) { return value_; });
interface_->register_property_r<std::string>(
std::string{ dbus::tags::type }, sdbusplus::vtable::property_::const_, []([[maybe_unused]] std::string& old_value) {
auto const val{ tfc::json::write_json_schema<value_t>() };
if (!val) {
fmt::println(stderr, "Unable to get schema: '{}'", glz::format_error(val.error()));
return std::string{};
}
return val.value();
});
interface_->register_property(std::string{ dbus::tags::type }, schema);

interface_->initialize();
}
Expand All @@ -76,6 +68,7 @@ class dbus_ipc {
private:
std::shared_ptr<sdbusplus::asio::dbus_interface> interface_{};
value_t value_{};
std::string const schema{ tfc::json::write_json_schema<value_t>().value() };
};

} // namespace tfc::ipc::details

0 comments on commit 3c26b1c

Please sign in to comment.