107 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
115 .onInterface(INTERFACE_NAME)
116 .call([
this](
const std::string& interfaceName
117 ,
const std::map<std::string, sdbus::Variant>& changedProperties
118 ,
const std::vector<std::string>& invalidatedProperties )
120 this->onPropertiesChanged(interfaceName, changedProperties, invalidatedProperties);
131 virtual void onPropertiesChanged(
const std::string& interfaceName
132 ,
const std::map<std::string, sdbus::Variant>& changedProperties
133 ,
const std::vector<std::string>& invalidatedProperties ) = 0;
136 sdbus::Variant Get(
const std::string& interfaceName,
const std::string& propertyName)
138 return proxy_->
getProperty(propertyName).onInterface(interfaceName);
141 template <
typename _Function>
142 PendingAsyncCall GetAsync(
const std::string& interfaceName,
const std::string& propertyName, _Function&& callback)
144 return proxy_->
getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback));
147 std::future<sdbus::Variant> GetAsync(
const std::string& interfaceName,
const std::string& propertyName,
with_future_t)
149 return proxy_->
getPropertyAsync(propertyName).onInterface(interfaceName).getResultAsFuture();
152 void Set(
const std::string& interfaceName,
const std::string& propertyName,
const sdbus::Variant& value)
154 proxy_->
setProperty(propertyName).onInterface(interfaceName).toValue(value);
159 proxy_->
setProperty(propertyName).onInterface(interfaceName).toValue(value, dont_expect_reply);
162 template <
typename _Function>
165 return proxy_->
setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<_Function>(callback));
168 std::future<void> SetAsync(
const std::string& interfaceName,
const std::string& propertyName,
const sdbus::Variant& value,
with_future_t)
170 return proxy_->
setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).getResultAsFuture();
173 std::map<std::string, sdbus::Variant> GetAll(
const std::string& interfaceName)
178 template <
typename _Function>
179 PendingAsyncCall GetAllAsync(
const std::string& interfaceName, _Function&& callback)
181 return proxy_->
getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback));
184 std::future<std::map<std::string, sdbus::Variant>> GetAllAsync(
const std::string& interfaceName,
with_future_t)
196 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.ObjectManager";
204 .onInterface(INTERFACE_NAME)
206 ,
const std::map<std::string, std::map<std::string, sdbus::Variant>>& interfacesAndProperties )
208 this->onInterfacesAdded(objectPath, interfacesAndProperties);
212 .onInterface(INTERFACE_NAME)
214 ,
const std::vector<std::string>& interfaces )
216 this->onInterfacesRemoved(objectPath, interfaces);
228 ,
const std::map<std::string, std::map<std::string, sdbus::Variant>>& interfacesAndProperties) = 0;
230 ,
const std::vector<std::string>& interfaces) = 0;
233 std::map<sdbus::ObjectPath, std::map<std::string, std::map<std::string, sdbus::Variant>>> GetManagedObjects()
235 std::map<sdbus::ObjectPath, std::map<std::string, std::map<std::string, sdbus::Variant>>> objectsInterfacesAndProperties;
236 proxy_->
callMethod(
"GetManagedObjects").onInterface(INTERFACE_NAME).storeResultsTo(objectsInterfacesAndProperties);
237 return objectsInterfacesAndProperties;