Moved SimpleDBus interfaces to dedicated namespace

This commit is contained in:
Kevin Dewald
2025-08-10 22:10:44 -07:00
parent 74becd625e
commit 89274f04af
7 changed files with 11 additions and 9 deletions

View File

@@ -28,7 +28,7 @@ class BluezRoot : public SimpleDBus::Proxy {
std::shared_ptr<Agent> _agent;
std::shared_ptr<SimpleDBus::Proxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::ObjectManager> object_manager();
std::shared_ptr<SimpleDBus::Interfaces::ObjectManager> object_manager();
};
} // namespace SimpleBluez

View File

@@ -8,7 +8,7 @@ BluezRoot::BluezRoot(std::shared_ptr<SimpleDBus::Connection> conn, const std::st
: Proxy(conn, bus_name, path) {}
void BluezRoot::on_registration() {
_interfaces.emplace(std::make_pair("org.freedesktop.DBus.ObjectManager", std::make_shared<SimpleDBus::ObjectManager>(_conn, shared_from_this())));
_interfaces.emplace(std::make_pair("org.freedesktop.DBus.ObjectManager", std::make_shared<SimpleDBus::Interfaces::ObjectManager>(_conn, shared_from_this())));
object_manager()->InterfacesAdded = [&](std::string path, SimpleDBus::Holder options) { path_add(path, options); };
object_manager()->InterfacesRemoved = [&](std::string path, SimpleDBus::Holder options) {
@@ -40,6 +40,6 @@ std::shared_ptr<SimpleDBus::Proxy> BluezRoot::path_create(const std::string& pat
return std::static_pointer_cast<SimpleDBus::Proxy>(child);
}
std::shared_ptr<SimpleDBus::ObjectManager> BluezRoot::object_manager() {
return std::dynamic_pointer_cast<SimpleDBus::ObjectManager>(interface_get("org.freedesktop.DBus.ObjectManager"));
std::shared_ptr<SimpleDBus::Interfaces::ObjectManager> BluezRoot::object_manager() {
return std::dynamic_pointer_cast<SimpleDBus::Interfaces::ObjectManager>(interface_get("org.freedesktop.DBus.ObjectManager"));
}

View File

@@ -5,7 +5,7 @@
#include <functional>
namespace SimpleDBus {
namespace SimpleDBus::Interfaces {
class ObjectManager : public Interface {
public:
@@ -23,4 +23,4 @@ class ObjectManager : public Interface {
static const SimpleDBus::AutoRegisterInterface<ObjectManager> registry;
};
} // namespace SimpleDBus
} // namespace SimpleDBus::Interfaces

View File

@@ -3,7 +3,7 @@
#include <simpledbus/advanced/Interface.h>
#include <simpledbus/advanced/InterfaceRegistry.h>
namespace SimpleDBus {
namespace SimpleDBus::Interfaces {
class Properties : public Interface {
public:
@@ -27,4 +27,4 @@ class Properties : public Interface {
static const SimpleDBus::AutoRegisterInterface<Properties> registry;
};
} // namespace SimpleDBus
} // namespace SimpleDBus::Interfaces

View File

@@ -25,7 +25,7 @@ void Proxy::on_registration() {
// TODO: This is a hack to make sure the Properties interface is always available and
// not removed by the linker. We'll remove this once the Properties interface is used
// a lot more.
auto prop = std::make_shared<Properties>(_conn, shared_from_this());
auto prop = std::make_shared<Interfaces::Properties>(_conn, shared_from_this());
}
std::shared_ptr<Proxy> Proxy::path_create(const std::string& path) {

View File

@@ -2,6 +2,7 @@
#include <simpledbus/advanced/Proxy.h>
using namespace SimpleDBus;
using namespace SimpleDBus::Interfaces;
const AutoRegisterInterface<ObjectManager> ObjectManager::registry{
"org.freedesktop.DBus.ObjectManager",

View File

@@ -2,6 +2,7 @@
#include <simpledbus/interfaces/Properties.h>
using namespace SimpleDBus;
using namespace SimpleDBus::Interfaces;
const AutoRegisterInterface<Properties> Properties::registry {
"org.freedesktop.DBus.Properties",