116 static inline const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
135 .onInterface(INTERFACE_NAME)
137 ,
const std::map<PropertyName, sdbus::Variant>& changedProperties
138 ,
const std::vector<PropertyName>& invalidatedProperties )
140 this->onPropertiesChanged(interfaceName, changedProperties, invalidatedProperties);
144 virtual void onPropertiesChanged(
const InterfaceName& interfaceName
145 ,
const std::map<PropertyName, sdbus::Variant>& changedProperties
146 ,
const std::vector<PropertyName>& invalidatedProperties ) = 0;
151 return m_proxy.
getProperty(propertyName).onInterface(interfaceName);
154 sdbus::Variant Get(std::string_view interfaceName, std::string_view propertyName)
156 return m_proxy.
getProperty(propertyName).onInterface(interfaceName);
159 template <
typename _Function>
162 return m_proxy.
getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback));
165 template <
typename _Function>
168 return m_proxy.
getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback), return_slot);
171 template <
typename _Function>
172 PendingAsyncCall GetAsync(std::string_view interfaceName, std::string_view propertyName, _Function&& callback)
174 return m_proxy.
getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback));
177 template <
typename _Function>
178 [[nodiscard]] Slot GetAsync(std::string_view interfaceName, std::string_view propertyName, _Function&& callback,
return_slot_t)
180 return m_proxy.
getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback), return_slot);
185 return m_proxy.
getPropertyAsync(propertyName).onInterface(interfaceName).getResultAsFuture();
188 std::future<sdbus::Variant> GetAsync(std::string_view interfaceName, std::string_view propertyName,
with_future_t)
190 return m_proxy.
getPropertyAsync(propertyName).onInterface(interfaceName).getResultAsFuture();
195 m_proxy.
setProperty(propertyName).onInterface(interfaceName).toValue(value);
198 void Set(std::string_view interfaceName,
const std::string_view propertyName,
const sdbus::Variant& value)
200 m_proxy.
setProperty(propertyName).onInterface(interfaceName).toValue(value);
205 m_proxy.
setProperty(propertyName).onInterface(interfaceName).toValue(value, dont_expect_reply);
210 m_proxy.
setProperty(propertyName).onInterface(interfaceName).toValue(value, dont_expect_reply);
213 template <
typename _Function>
216 return m_proxy.
setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<_Function>(callback));
219 template <
typename _Function>
222 return m_proxy.
setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<_Function>(callback), return_slot);
225 template <
typename _Function>
228 return m_proxy.
setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<_Function>(callback));
231 template <
typename _Function>
234 return m_proxy.
setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<_Function>(callback), return_slot);
239 return m_proxy.
setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).getResultAsFuture();
242 std::future<void> SetAsync(std::string_view interfaceName, std::string_view propertyName,
const sdbus::Variant& value,
with_future_t)
244 return m_proxy.
setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).getResultAsFuture();
247 std::map<PropertyName, sdbus::Variant> GetAll(
const InterfaceName& interfaceName)
252 std::map<PropertyName, sdbus::Variant> GetAll(std::string_view interfaceName)
257 template <
typename _Function>
260 return m_proxy.
getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback));
263 template <
typename _Function>
266 return m_proxy.
getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback), return_slot);
269 template <
typename _Function>
270 PendingAsyncCall GetAllAsync(std::string_view interfaceName, _Function&& callback)
272 return m_proxy.
getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback));
275 template <
typename _Function>
278 return m_proxy.
getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback), return_slot);
286 std::future<std::map<PropertyName, sdbus::Variant>> GetAllAsync(std::string_view interfaceName,
with_future_t)
298 static inline const char* INTERFACE_NAME =
"org.freedesktop.DBus.ObjectManager";
317 .onInterface(INTERFACE_NAME)
319 ,
const std::map<
sdbus::InterfaceName, std::map<PropertyName, sdbus::Variant>>& interfacesAndProperties )
321 this->onInterfacesAdded(objectPath, interfacesAndProperties);
326 .onInterface(INTERFACE_NAME)
328 ,
const std::vector<sdbus::InterfaceName>& interfaces )
330 this->onInterfacesRemoved(objectPath, interfaces);
335 ,
const std::map<
sdbus::InterfaceName, std::map<PropertyName, sdbus::Variant>>& interfacesAndProperties) = 0;
337 ,
const std::vector<sdbus::InterfaceName>& interfaces) = 0;
340 std::map<sdbus::ObjectPath, std::map<sdbus::InterfaceName, std::map<PropertyName, sdbus::Variant>>> GetManagedObjects()
342 std::map<sdbus::ObjectPath, std::map<sdbus::InterfaceName, std::map<PropertyName, sdbus::Variant>>> objectsInterfacesAndProperties;
343 m_proxy.
callMethod(
"GetManagedObjects").onInterface(INTERFACE_NAME).storeResultsTo(objectsInterfacesAndProperties);
344 return objectsInterfacesAndProperties;