Skip to content

Commit

Permalink
Renamed SimpleDBus Proxy class to RemoteProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
kdewald committed Sep 27, 2024
1 parent ed2a218 commit b19c46d
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 109 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ include simpledbus/include/simpledbus/external/kvn_safe_callback.hpp
include simpledbus/include/simpledbus/external/logfwd.hpp
include simpledbus/include/simpledbus/interfaces/ObjectManager.h
include simpledbus/src/advanced/RemoteInterface.cpp
include simpledbus/src/advanced/Proxy.cpp
include simpledbus/src/advanced/RemoteProxy.cpp
include simpledbus/src/base/Connection.cpp
include simpledbus/src/base/Exceptions.cpp
include simpledbus/src/base/Holder.cpp
Expand Down
2 changes: 1 addition & 1 deletion simpleble/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")

target_sources(simpleble PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/advanced/RemoteInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/advanced/Proxy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/advanced/RemoteProxy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/base/Connection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/base/Exceptions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/base/Holder.cpp
Expand Down
2 changes: 1 addition & 1 deletion simplebluez/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ set(SIMPLEBLUEZ_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/interfaces/Battery1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/interfaces/AgentManager1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/advanced/RemoteInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/advanced/Proxy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/advanced/RemoteProxy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/base/Connection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/base/Exceptions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../simpledbus/src/base/Holder.cpp
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/include/simplebluez/Adapter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>

#include <simplebluez/Device.h>
#include <simplebluez/interfaces/Adapter1.h>
Expand All @@ -9,7 +9,7 @@

namespace SimpleBluez {

class Adapter : public SimpleDBus::Proxy {
class Adapter : public SimpleDBus::RemoteProxy {
public:
typedef Adapter1::DiscoveryFilter DiscoveryFilter;

Expand All @@ -34,7 +34,7 @@ class Adapter : public SimpleDBus::Proxy {
void clear_on_device_updated();

private:
std::shared_ptr<SimpleDBus::Proxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteProxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteInterface> interfaces_create(const std::string& interface_name) override;

std::shared_ptr<Adapter1> adapter1();
Expand Down
4 changes: 2 additions & 2 deletions simplebluez/include/simplebluez/Agent.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include <simplebluez/interfaces/Agent1.h>
#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>

namespace SimpleBluez {

class Agent : public SimpleDBus::Proxy {
class Agent : public SimpleDBus::RemoteProxy {
public:
typedef enum {
DisplayOnly,
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/include/simplebluez/Bluez.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>
#include <simpledbus/interfaces/ObjectManager.h>

#include <simplebluez/Adapter.h>
Expand All @@ -10,7 +10,7 @@

namespace SimpleBluez {

class Bluez : public SimpleDBus::Proxy {
class Bluez : public SimpleDBus::RemoteProxy {
public:
Bluez();
virtual ~Bluez();
Expand All @@ -23,7 +23,7 @@ class Bluez : public SimpleDBus::Proxy {
void register_agent();

private:
std::shared_ptr<SimpleDBus::Proxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteProxy> path_create(const std::string& path) override;

std::shared_ptr<SimpleDBus::ObjectManager> object_manager();

Expand Down
6 changes: 3 additions & 3 deletions simplebluez/include/simplebluez/Characteristic.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>

#include <simplebluez/Descriptor.h>
#include <simplebluez/Types.h>
Expand All @@ -10,7 +10,7 @@

namespace SimpleBluez {

class Characteristic : public SimpleDBus::Proxy {
class Characteristic : public SimpleDBus::RemoteProxy {
public:
Characteristic(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path);
virtual ~Characteristic();
Expand Down Expand Up @@ -38,7 +38,7 @@ class Characteristic : public SimpleDBus::Proxy {
void clear_on_value_changed();

private:
std::shared_ptr<SimpleDBus::Proxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteProxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteInterface> interfaces_create(const std::string& interface_name) override;

std::shared_ptr<GattCharacteristic1> gattcharacteristic1();
Expand Down
4 changes: 2 additions & 2 deletions simplebluez/include/simplebluez/Descriptor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>

#include <simplebluez/Types.h>
#include <simplebluez/interfaces/GattDescriptor1.h>
Expand All @@ -9,7 +9,7 @@

namespace SimpleBluez {

class Descriptor : public SimpleDBus::Proxy {
class Descriptor : public SimpleDBus::RemoteProxy {
public:
Descriptor(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path);
virtual ~Descriptor();
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/include/simplebluez/Device.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>

#include <simplebluez/Characteristic.h>
#include <simplebluez/Service.h>
Expand All @@ -9,7 +9,7 @@

namespace SimpleBluez {

class Device : public SimpleDBus::Proxy {
class Device : public SimpleDBus::RemoteProxy {
public:
Device(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path);
virtual ~Device();
Expand Down Expand Up @@ -55,7 +55,7 @@ class Device : public SimpleDBus::Proxy {
void clear_on_battery_percentage_changed();

private:
std::shared_ptr<SimpleDBus::Proxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteProxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteInterface> interfaces_create(const std::string& interface_name) override;

std::shared_ptr<Device1> device1();
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/include/simplebluez/ProxyOrg.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#pragma once

#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>

#include <simplebluez/Adapter.h>
#include <simplebluez/Agent.h>

namespace SimpleBluez {

class ProxyOrg : public SimpleDBus::Proxy {
class ProxyOrg : public SimpleDBus::RemoteProxy {
public:
ProxyOrg(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path);
virtual ~ProxyOrg() = default;
Expand All @@ -16,7 +16,7 @@ class ProxyOrg : public SimpleDBus::Proxy {
void register_agent(std::shared_ptr<Agent> agent);

private:
std::shared_ptr<SimpleDBus::Proxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteProxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteInterface> interfaces_create(const std::string& interface_name) override;
};

Expand Down
6 changes: 3 additions & 3 deletions simplebluez/include/simplebluez/ProxyOrgBluez.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>

#include <simplebluez/Adapter.h>
#include <simplebluez/Agent.h>
Expand All @@ -9,7 +9,7 @@

namespace SimpleBluez {

class ProxyOrgBluez : public SimpleDBus::Proxy {
class ProxyOrgBluez : public SimpleDBus::RemoteProxy {
public:
ProxyOrgBluez(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path);
virtual ~ProxyOrgBluez() = default;
Expand All @@ -19,7 +19,7 @@ class ProxyOrgBluez : public SimpleDBus::Proxy {
std::vector<std::shared_ptr<Adapter>> get_adapters();

private:
std::shared_ptr<SimpleDBus::Proxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteProxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteInterface> interfaces_create(const std::string& interface_name) override;
std::shared_ptr<AgentManager1> agentmanager1();
};
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/include/simplebluez/Service.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#pragma once

#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/RemoteProxy.h>

#include <simplebluez/Characteristic.h>
#include <simplebluez/interfaces/GattService1.h>

namespace SimpleBluez {

class Service : public SimpleDBus::Proxy {
class Service : public SimpleDBus::RemoteProxy {
public:
Service(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path);
virtual ~Service() = default;
Expand All @@ -20,7 +20,7 @@ class Service : public SimpleDBus::Proxy {
std::string uuid();

private:
std::shared_ptr<SimpleDBus::Proxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteProxy> path_create(const std::string& path) override;
std::shared_ptr<SimpleDBus::RemoteInterface> interfaces_create(const std::string& interface_name) override;

std::shared_ptr<GattService1> gattservice1();
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/src/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
using namespace SimpleBluez;

Adapter::Adapter(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path)
: Proxy(conn, bus_name, path) {}
: RemoteProxy(conn, bus_name, path) {}

Adapter::~Adapter() {}

std::shared_ptr<SimpleDBus::Proxy> Adapter::path_create(const std::string& path) {
std::shared_ptr<SimpleDBus::RemoteProxy> Adapter::path_create(const std::string& path) {
auto child = std::make_shared<Device>(_conn, _bus_name, path);
return std::static_pointer_cast<SimpleDBus::Proxy>(child);
return std::static_pointer_cast<SimpleDBus::RemoteProxy>(child);
}

std::shared_ptr<SimpleDBus::RemoteInterface> Adapter::interfaces_create(const std::string& interface_name) {
Expand Down
2 changes: 1 addition & 1 deletion simplebluez/src/Agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using namespace SimpleBluez;

Agent::Agent(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path)
: Proxy(conn, bus_name, path) {
: RemoteProxy(conn, bus_name, path) {
_interfaces.emplace(std::make_pair(
"org.bluez.Agent1", std::static_pointer_cast<SimpleDBus::RemoteInterface>(std::make_shared<Agent1>(_conn, _path))));
}
Expand Down
8 changes: 4 additions & 4 deletions simplebluez/src/Bluez.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace SimpleBluez;
#define DBUS_BUS DBUS_BUS_SYSTEM
#endif

Bluez::Bluez() : Proxy(std::make_shared<SimpleDBus::Connection>(DBUS_BUS), "org.bluez", "/") {
Bluez::Bluez() : RemoteProxy(std::make_shared<SimpleDBus::Connection>(DBUS_BUS), "org.bluez", "/") {
_interfaces["org.freedesktop.DBus.ObjectManager"] = std::static_pointer_cast<SimpleDBus::RemoteInterface>(
std::make_shared<SimpleDBus::ObjectManager>(_conn, "org.bluez", "/"));

Expand Down Expand Up @@ -41,7 +41,7 @@ void Bluez::init() {

// Create the agent that will handle pairing.
_agent = std::make_shared<Agent>(_conn, "org.bluez", "/agent");
path_append_child("/agent", std::static_pointer_cast<SimpleDBus::Proxy>(_agent));
path_append_child("/agent", std::static_pointer_cast<SimpleDBus::RemoteProxy>(_agent));
}

void Bluez::run_async() {
Expand All @@ -61,9 +61,9 @@ std::shared_ptr<Agent> Bluez::get_agent() { return std::dynamic_pointer_cast<Age

void Bluez::register_agent() { std::dynamic_pointer_cast<ProxyOrg>(path_get("/org"))->register_agent(_agent); }

std::shared_ptr<SimpleDBus::Proxy> Bluez::path_create(const std::string& path) {
std::shared_ptr<SimpleDBus::RemoteProxy> Bluez::path_create(const std::string& path) {
auto child = std::make_shared<ProxyOrg>(_conn, _bus_name, path);
return std::static_pointer_cast<SimpleDBus::Proxy>(child);
return std::static_pointer_cast<SimpleDBus::RemoteProxy>(child);
}

std::shared_ptr<SimpleDBus::ObjectManager> Bluez::object_manager() {
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/src/Characteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ using namespace SimpleBluez;

Characteristic::Characteristic(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name,
const std::string& path)
: Proxy(conn, bus_name, path) {}
: RemoteProxy(conn, bus_name, path) {}

Characteristic::~Characteristic() {}

std::shared_ptr<SimpleDBus::Proxy> Characteristic::path_create(const std::string& path) {
std::shared_ptr<SimpleDBus::RemoteProxy> Characteristic::path_create(const std::string& path) {
auto child = std::make_shared<Descriptor>(_conn, _bus_name, path);
return std::static_pointer_cast<SimpleDBus::Proxy>(child);
return std::static_pointer_cast<SimpleDBus::RemoteProxy>(child);
}

std::shared_ptr<SimpleDBus::RemoteInterface> Characteristic::interfaces_create(const std::string& interface_name) {
Expand Down
2 changes: 1 addition & 1 deletion simplebluez/src/Descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using namespace SimpleBluez;

Descriptor::Descriptor(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name,
const std::string& path)
: Proxy(conn, bus_name, path) {}
: RemoteProxy(conn, bus_name, path) {}

Descriptor::~Descriptor() {}

Expand Down
8 changes: 4 additions & 4 deletions simplebluez/src/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
using namespace SimpleBluez;

Device::Device(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path)
: Proxy(conn, bus_name, path) {}
: RemoteProxy(conn, bus_name, path) {}

Device::~Device() {}

std::shared_ptr<SimpleDBus::Proxy> Device::path_create(const std::string& path) {
std::shared_ptr<SimpleDBus::RemoteProxy> Device::path_create(const std::string& path) {
const std::string next_child = SimpleDBus::Path::next_child_strip(_path, path);

if (next_child.find("service") == 0) {
auto child = std::make_shared<Service>(_conn, _bus_name, path);
return std::static_pointer_cast<SimpleDBus::Proxy>(child);
return std::static_pointer_cast<SimpleDBus::RemoteProxy>(child);
} else {
return std::make_shared<Proxy>(_conn, _bus_name, path);
return std::make_shared<RemoteProxy>(_conn, _bus_name, path);
}
}

Expand Down
6 changes: 3 additions & 3 deletions simplebluez/src/ProxyOrg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using namespace SimpleBluez;

ProxyOrg::ProxyOrg(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path)
: Proxy(conn, bus_name, path) {}
: RemoteProxy(conn, bus_name, path) {}

std::vector<std::shared_ptr<Adapter>> ProxyOrg::get_adapters() {
return std::dynamic_pointer_cast<ProxyOrgBluez>(path_get("/org/bluez"))->get_adapters();
Expand All @@ -14,9 +14,9 @@ void ProxyOrg::register_agent(std::shared_ptr<Agent> agent) {
std::dynamic_pointer_cast<ProxyOrgBluez>(path_get("/org/bluez"))->register_agent(agent);
}

std::shared_ptr<SimpleDBus::Proxy> ProxyOrg::path_create(const std::string& path) {
std::shared_ptr<SimpleDBus::RemoteProxy> ProxyOrg::path_create(const std::string& path) {
auto child = std::make_shared<ProxyOrgBluez>(_conn, _bus_name, path);
return std::static_pointer_cast<SimpleDBus::Proxy>(child);
return std::static_pointer_cast<SimpleDBus::RemoteProxy>(child);
}

std::shared_ptr<SimpleDBus::RemoteInterface> ProxyOrg::interfaces_create(const std::string& interface_name) {
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/src/ProxyOrgBluez.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ using namespace SimpleBluez;

ProxyOrgBluez::ProxyOrgBluez(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name,
const std::string& path)
: Proxy(conn, bus_name, path) {}
: RemoteProxy(conn, bus_name, path) {}

std::shared_ptr<SimpleDBus::Proxy> ProxyOrgBluez::path_create(const std::string& path) {
std::shared_ptr<SimpleDBus::RemoteProxy> ProxyOrgBluez::path_create(const std::string& path) {
auto child = std::make_shared<Adapter>(_conn, _bus_name, path);
return std::static_pointer_cast<SimpleDBus::Proxy>(child);
return std::static_pointer_cast<SimpleDBus::RemoteProxy>(child);
}

std::shared_ptr<SimpleDBus::RemoteInterface> ProxyOrgBluez::interfaces_create(const std::string& interface_name) {
Expand Down
6 changes: 3 additions & 3 deletions simplebluez/src/Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using namespace SimpleBluez;

Service::Service(std::shared_ptr<SimpleDBus::Connection> conn, const std::string& bus_name, const std::string& path)
: Proxy(conn, bus_name, path) {}
: RemoteProxy(conn, bus_name, path) {}

std::shared_ptr<SimpleDBus::Proxy> Service::path_create(const std::string& path) {
std::shared_ptr<SimpleDBus::RemoteProxy> Service::path_create(const std::string& path) {
auto child = std::make_shared<Characteristic>(_conn, _bus_name, path);
return std::static_pointer_cast<SimpleDBus::Proxy>(child);
return std::static_pointer_cast<SimpleDBus::RemoteProxy>(child);
}

std::shared_ptr<SimpleDBus::RemoteInterface> Service::interfaces_create(const std::string& interface_name) {
Expand Down
Loading

0 comments on commit b19c46d

Please sign in to comment.