114 class Properties_proxy
116 static inline const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
119 explicit Properties_proxy(
IProxy& proxy)
124 ~Properties_proxy() =
default;
129 .uponSignal(
"PropertiesChanged")
130 .onInterface(INTERFACE_NAME)
132 ,
const std::map<PropertyName, Variant>& changedProperties
133 ,
const std::vector<PropertyName>& invalidatedProperties )
135 this->onPropertiesChanged(interfaceName, changedProperties, invalidatedProperties);
139 virtual void onPropertiesChanged(
const InterfaceName& interfaceName
140 ,
const std::map<PropertyName, Variant>& changedProperties
141 ,
const std::vector<PropertyName>& invalidatedProperties ) = 0;
144 Properties_proxy(
const Properties_proxy&) =
delete;
145 Properties_proxy& operator=(
const Properties_proxy&) =
delete;
146 Properties_proxy(Properties_proxy&&) =
delete;
147 Properties_proxy& operator=(Properties_proxy&&) =
delete;
151 return m_proxy.getProperty(propertyName).onInterface(interfaceName);
154 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>
166 [[nodiscard]] Slot GetAsync(
const InterfaceName& interfaceName,
const PropertyName& propertyName, Function&& callback,
return_slot_t)
168 return m_proxy.getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<Function>(callback), return_slot);
173 return m_proxy.getPropertyAsync(propertyName).onInterface(interfaceName).getResultAsFuture();
178 return m_proxy.getPropertyAsync(propertyName).onInterface(interfaceName).getResultAsAwaitable();
181 template <
typename Function>
182 PendingAsyncCall GetAsync(std::string_view interfaceName, std::string_view propertyName, Function&& callback)
184 return m_proxy.getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<Function>(callback));
187 template <
typename Function>
188 [[nodiscard]] Slot GetAsync(std::string_view interfaceName, std::string_view propertyName, Function&& callback,
return_slot_t)
190 return m_proxy.getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<Function>(callback), return_slot);
193 std::future<Variant> GetAsync(std::string_view interfaceName, std::string_view propertyName,
with_future_t)
195 return m_proxy.getPropertyAsync(propertyName).onInterface(interfaceName).getResultAsFuture();
200 return m_proxy.getPropertyAsync(propertyName).onInterface(interfaceName).getResultAsAwaitable();
203 void Set(
const InterfaceName& interfaceName,
const PropertyName& propertyName,
const Variant& value)
205 m_proxy.setProperty(propertyName).onInterface(interfaceName).toValue(value);
208 void Set(std::string_view interfaceName,
const std::string_view propertyName,
const Variant& value)
210 m_proxy.setProperty(propertyName).onInterface(interfaceName).toValue(value);
215 m_proxy.setProperty(propertyName).onInterface(interfaceName).toValue(value, dont_expect_reply);
220 m_proxy.setProperty(propertyName).onInterface(interfaceName).toValue(value, dont_expect_reply);
223 template <
typename Function>
226 return m_proxy.setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<Function>(callback));
229 template <
typename Function>
232 return m_proxy.setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<Function>(callback), return_slot);
237 return m_proxy.setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).getResultAsFuture();
242 return m_proxy.setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).getResultAsAwaitable();
245 template <
typename Function>
246 PendingAsyncCall SetAsync(std::string_view interfaceName, std::string_view propertyName,
const Variant& value, Function&& callback)
248 return m_proxy.setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<Function>(callback));
251 template <
typename Function>
252 [[nodiscard]] Slot SetAsync(std::string_view interfaceName, std::string_view propertyName,
const Variant& value, Function&& callback,
return_slot_t)
254 return m_proxy.setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<Function>(callback), return_slot);
257 std::future<void> SetAsync(std::string_view interfaceName, std::string_view propertyName,
const Variant& value,
with_future_t)
259 return m_proxy.setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).getResultAsFuture();
264 return m_proxy.setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).getResultAsAwaitable();
267 std::map<PropertyName, Variant> GetAll(
const InterfaceName& interfaceName)
269 return m_proxy.getAllProperties().onInterface(interfaceName);
272 std::map<PropertyName, Variant> GetAll(std::string_view interfaceName)
274 return m_proxy.getAllProperties().onInterface(interfaceName);
277 template <
typename Function>
280 return m_proxy.getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<Function>(callback));
283 template <
typename Function>
286 return m_proxy.getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<Function>(callback), return_slot);
291 return m_proxy.getAllPropertiesAsync().onInterface(interfaceName).getResultAsFuture();
296 return m_proxy.getAllPropertiesAsync().onInterface(interfaceName).getResultAsAwaitable();
299 template <
typename Function>
300 PendingAsyncCall GetAllAsync(std::string_view interfaceName, Function&& callback)
302 return m_proxy.getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<Function>(callback));
305 template <
typename Function>
306 [[nodiscard]] Slot GetAllAsync(std::string_view interfaceName, Function&& callback,
return_slot_t)
308 return m_proxy.getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<Function>(callback), return_slot);
311 std::future<std::map<PropertyName, Variant>> GetAllAsync(std::string_view interfaceName,
with_future_t)
313 return m_proxy.getAllPropertiesAsync().onInterface(interfaceName).getResultAsFuture();
318 return m_proxy.getAllPropertiesAsync().onInterface(interfaceName).getResultAsAwaitable();
326 class ObjectManager_proxy
328 static inline const char* INTERFACE_NAME =
"org.freedesktop.DBus.ObjectManager";
331 explicit ObjectManager_proxy(
IProxy& proxy)
336 ~ObjectManager_proxy() =
default;
341 .uponSignal(
"InterfacesAdded")
342 .onInterface(INTERFACE_NAME)
344 ,
const std::map<
InterfaceName, std::map<PropertyName, Variant>>& interfacesAndProperties )
346 this->onInterfacesAdded(objectPath, interfacesAndProperties);
350 .uponSignal(
"InterfacesRemoved")
351 .onInterface(INTERFACE_NAME)
353 ,
const std::vector<InterfaceName>& interfaces )
355 this->onInterfacesRemoved(objectPath, interfaces);
359 virtual void onInterfacesAdded(
const ObjectPath& objectPath
360 ,
const std::map<
InterfaceName, std::map<PropertyName, Variant>>& interfacesAndProperties) = 0;
361 virtual void onInterfacesRemoved(
const ObjectPath& objectPath
362 ,
const std::vector<InterfaceName>& interfaces) = 0;
365 ObjectManager_proxy(
const ObjectManager_proxy&) =
delete;
366 ObjectManager_proxy& operator=(
const ObjectManager_proxy&) =
delete;
367 ObjectManager_proxy(ObjectManager_proxy&&) =
delete;
368 ObjectManager_proxy& operator=(ObjectManager_proxy&&) =
delete;
370 std::map<ObjectPath, std::map<InterfaceName, std::map<PropertyName, Variant>>> GetManagedObjects()
372 std::map<ObjectPath, std::map<InterfaceName, std::map<PropertyName, Variant>>> objectsInterfacesAndProperties;
373 m_proxy.callMethod(
"GetManagedObjects").onInterface(INTERFACE_NAME).storeResultsTo(objectsInterfacesAndProperties);
374 return objectsInterfacesAndProperties;
377 template <
typename Function>
380 return m_proxy.callMethodAsync(
"GetManagedObjects").onInterface(INTERFACE_NAME).uponReplyInvoke(std::forward<Function>(callback));
383 template <
typename Function>
384 [[nodiscard]] Slot GetManagedObjectsAsync(Function&& callback,
return_slot_t)
386 return m_proxy.callMethodAsync(
"GetManagedObjects").onInterface(INTERFACE_NAME).uponReplyInvoke(std::forward<Function>(callback), return_slot);
389 std::future<std::map<ObjectPath, std::map<InterfaceName, std::map<PropertyName, Variant>>>> GetManagedObjectsAsync(
with_future_t)
391 return m_proxy.callMethodAsync(
"GetManagedObjects").onInterface(INTERFACE_NAME).getResultAsFuture<std::map<ObjectPath, std::map<InterfaceName, std::map<PropertyName, Variant>>>>();
396 return m_proxy.callMethodAsync(
"GetManagedObjects").onInterface(INTERFACE_NAME).getResultAsAwaitable<std::map<ObjectPath, std::map<InterfaceName, std::map<PropertyName, Variant>>>>();