refactor: improve Object vtable registration (#388)

This improves the D-Bus object API registration/unregistration by making it more flexible, more dynamic, closer to sd-bus API design but still on high abstraction level, and -- most importantly -- less error-prone since no `finishRegistration()` call is needed anymore.
This commit is contained in:
Stanislav Angelovič
2023-12-30 18:40:38 +01:00
parent e76d38c317
commit bdf313bc60
27 changed files with 1047 additions and 1103 deletions

View File

@@ -470,7 +470,7 @@ Slot Connection::addObjectVTable( const std::string& objectPath
{
sd_bus_slot *slot{};
auto r = sdbus_->sd_bus_add_object_vtable(bus_.get()
auto r = sdbus_->sd_bus_add_object_vtable( bus_.get()
, &slot
, objectPath.c_str()
, interfaceName.c_str()
@@ -500,7 +500,7 @@ MethodCall Connection::createMethodCall( const std::string& destination
{
sd_bus_message *sdbusMsg{};
auto r = sdbus_->sd_bus_message_new_method_call(bus_.get()
auto r = sdbus_->sd_bus_message_new_method_call( bus_.get()
, &sdbusMsg
, destination.empty() ? nullptr : destination.c_str()
, objectPath.c_str()
@@ -518,7 +518,7 @@ Signal Connection::createSignal( const std::string& objectPath
{
sd_bus_message *sdbusMsg{};
auto r = sdbus_->sd_bus_message_new_signal(bus_.get()
auto r = sdbus_->sd_bus_message_new_signal( bus_.get()
, &sdbusMsg
, objectPath.c_str()
, interfaceName.c_str()
@@ -575,7 +575,7 @@ void Connection::emitPropertiesChangedSignal( const std::string& objectPath
{
auto names = to_strv(propNames);
auto r = sdbus_->sd_bus_emit_properties_changed_strv(bus_.get()
auto r = sdbus_->sd_bus_emit_properties_changed_strv( bus_.get()
, objectPath.c_str()
, interfaceName.c_str()
, propNames.empty() ? nullptr : &names[0] );
@@ -595,7 +595,7 @@ void Connection::emitInterfacesAddedSignal( const std::string& objectPath
{
auto names = to_strv(interfaces);
auto r = sdbus_->sd_bus_emit_interfaces_added_strv(bus_.get()
auto r = sdbus_->sd_bus_emit_interfaces_added_strv( bus_.get()
, objectPath.c_str()
, interfaces.empty() ? nullptr : &names[0] );
@@ -614,7 +614,7 @@ void Connection::emitInterfacesRemovedSignal( const std::string& objectPath
{
auto names = to_strv(interfaces);
auto r = sdbus_->sd_bus_emit_interfaces_removed_strv(bus_.get()
auto r = sdbus_->sd_bus_emit_interfaces_removed_strv( bus_.get()
, objectPath.c_str()
, interfaces.empty() ? nullptr : &names[0] );