summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-10-19 20:57:03 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-10-20 09:15:50 +0200
commitc0e24cc461cb60cde2791cd89d59a1ff1be0f6b2 (patch)
tree7af64440530a62ba8570c044d9aa600f32867160
parent42ab9f491dc9efb2732d09a4e6e1be5b833af3bb (diff)
bt: Fix interface update for DeviceProxy
BaseProxy had a hardcoded leftover pointing to AdapterInterface only.
-rw-r--r--src/bt.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bt.cc b/src/bt.cc
index 7a504a2..e3c12d9 100644
--- a/src/bt.cc
+++ b/src/bt.cc
@@ -205,9 +205,11 @@ class BaseProxy : public sdbus::ProxyInterfaces<sdbus::Properties_proxy> {
protected:
BaseProxy(sdbus::IConnection& connection, sdbus::ObjectPath const& path,
+ sdbus::InterfaceName const& interface,
std::map<sdbus::PropertyName, size_t> const& names)
: sdbus::ProxyInterfaces<sdbus::Properties_proxy>(connection, kService,
path),
+ interface_(interface),
names_(names) {}
virtual void update(size_t field, sdbus::Variant const& value) = 0;
@@ -229,7 +231,7 @@ class BaseProxy : public sdbus::ProxyInterfaces<sdbus::Properties_proxy> {
const sdbus::InterfaceName& interface_name,
const std::map<sdbus::PropertyName, sdbus::Variant>& changed,
const std::vector<sdbus::PropertyName>& invalidated) override {
- if (interface_name != kAdapterInterface)
+ if (interface_name != interface_)
return;
++waiting_;
for (auto const& pair : changed) {
@@ -262,6 +264,7 @@ class BaseProxy : public sdbus::ProxyInterfaces<sdbus::Properties_proxy> {
}
}
+ sdbus::InterfaceName const& interface_;
std::map<sdbus::PropertyName, size_t> const& names_;
uint8_t waiting_{0};
bool updated_{false};
@@ -279,7 +282,8 @@ class DeviceProxy : public BaseProxy, public Device {
DeviceProxy(IManager& manager, sdbus::IConnection& connection,
sdbus::ObjectPath const& path,
std::map<sdbus::PropertyName, sdbus::Variant> const& properties)
- : BaseProxy(connection, path, kNames), manager_(manager) {
+ : BaseProxy(connection, path, kDeviceInterface, kNames),
+ manager_(manager) {
init(properties);
}
@@ -370,7 +374,8 @@ class AdapterProxy : public BaseProxy, public Adapter {
AdapterProxy(IManager& manager, sdbus::IConnection& connection,
sdbus::ObjectPath const& path,
std::map<sdbus::PropertyName, sdbus::Variant> const& properties)
- : BaseProxy(connection, path, kNames), manager_(manager) {
+ : BaseProxy(connection, path, kAdapterInterface, kNames),
+ manager_(manager) {
init(properties);
}