From 89274f04af7a0c7588230846bf4a252cabd0f0d6 Mon Sep 17 00:00:00 2001 From: Kevin Dewald Date: Sun, 10 Aug 2025 22:10:44 -0700 Subject: [PATCH] Moved SimpleDBus interfaces to dedicated namespace --- simplebluez/include/simplebluez/BluezRoot.h | 2 +- simplebluez/src/BluezRoot.cpp | 6 +++--- simpledbus/include/simpledbus/interfaces/ObjectManager.h | 4 ++-- simpledbus/include/simpledbus/interfaces/Properties.h | 4 ++-- simpledbus/src/advanced/Proxy.cpp | 2 +- simpledbus/src/interfaces/ObjectManager.cpp | 1 + simpledbus/src/interfaces/Properties.cpp | 1 + 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/simplebluez/include/simplebluez/BluezRoot.h b/simplebluez/include/simplebluez/BluezRoot.h index 6cdbbb8..165b255 100644 --- a/simplebluez/include/simplebluez/BluezRoot.h +++ b/simplebluez/include/simplebluez/BluezRoot.h @@ -28,7 +28,7 @@ class BluezRoot : public SimpleDBus::Proxy { std::shared_ptr _agent; std::shared_ptr path_create(const std::string& path) override; - std::shared_ptr object_manager(); + std::shared_ptr object_manager(); }; } // namespace SimpleBluez diff --git a/simplebluez/src/BluezRoot.cpp b/simplebluez/src/BluezRoot.cpp index 75a0174..acf646c 100644 --- a/simplebluez/src/BluezRoot.cpp +++ b/simplebluez/src/BluezRoot.cpp @@ -8,7 +8,7 @@ BluezRoot::BluezRoot(std::shared_ptr 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(_conn, shared_from_this()))); + _interfaces.emplace(std::make_pair("org.freedesktop.DBus.ObjectManager", std::make_shared(_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 BluezRoot::path_create(const std::string& pat return std::static_pointer_cast(child); } -std::shared_ptr BluezRoot::object_manager() { - return std::dynamic_pointer_cast(interface_get("org.freedesktop.DBus.ObjectManager")); +std::shared_ptr BluezRoot::object_manager() { + return std::dynamic_pointer_cast(interface_get("org.freedesktop.DBus.ObjectManager")); } diff --git a/simpledbus/include/simpledbus/interfaces/ObjectManager.h b/simpledbus/include/simpledbus/interfaces/ObjectManager.h index 65ae6ce..353336b 100644 --- a/simpledbus/include/simpledbus/interfaces/ObjectManager.h +++ b/simpledbus/include/simpledbus/interfaces/ObjectManager.h @@ -5,7 +5,7 @@ #include -namespace SimpleDBus { +namespace SimpleDBus::Interfaces { class ObjectManager : public Interface { public: @@ -23,4 +23,4 @@ class ObjectManager : public Interface { static const SimpleDBus::AutoRegisterInterface registry; }; -} // namespace SimpleDBus +} // namespace SimpleDBus::Interfaces diff --git a/simpledbus/include/simpledbus/interfaces/Properties.h b/simpledbus/include/simpledbus/interfaces/Properties.h index 165edfc..cbff1fe 100644 --- a/simpledbus/include/simpledbus/interfaces/Properties.h +++ b/simpledbus/include/simpledbus/interfaces/Properties.h @@ -3,7 +3,7 @@ #include #include -namespace SimpleDBus { +namespace SimpleDBus::Interfaces { class Properties : public Interface { public: @@ -27,4 +27,4 @@ class Properties : public Interface { static const SimpleDBus::AutoRegisterInterface registry; }; -} // namespace SimpleDBus \ No newline at end of file +} // namespace SimpleDBus::Interfaces \ No newline at end of file diff --git a/simpledbus/src/advanced/Proxy.cpp b/simpledbus/src/advanced/Proxy.cpp index bc8c14f..205e56e 100644 --- a/simpledbus/src/advanced/Proxy.cpp +++ b/simpledbus/src/advanced/Proxy.cpp @@ -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(_conn, shared_from_this()); + auto prop = std::make_shared(_conn, shared_from_this()); } std::shared_ptr Proxy::path_create(const std::string& path) { diff --git a/simpledbus/src/interfaces/ObjectManager.cpp b/simpledbus/src/interfaces/ObjectManager.cpp index e69d23c..7e8b63c 100644 --- a/simpledbus/src/interfaces/ObjectManager.cpp +++ b/simpledbus/src/interfaces/ObjectManager.cpp @@ -2,6 +2,7 @@ #include using namespace SimpleDBus; +using namespace SimpleDBus::Interfaces; const AutoRegisterInterface ObjectManager::registry{ "org.freedesktop.DBus.ObjectManager", diff --git a/simpledbus/src/interfaces/Properties.cpp b/simpledbus/src/interfaces/Properties.cpp index d50e121..5cd550b 100644 --- a/simpledbus/src/interfaces/Properties.cpp +++ b/simpledbus/src/interfaces/Properties.cpp @@ -2,6 +2,7 @@ #include using namespace SimpleDBus; +using namespace SimpleDBus::Interfaces; const AutoRegisterInterface Properties::registry { "org.freedesktop.DBus.Properties",