27#ifndef SDBUS_CXX_STANDARDINTERFACES_H_
28#define SDBUS_CXX_STANDARDINTERFACES_H_
43 static inline const char* INTERFACE_NAME =
"org.freedesktop.DBus.Peer";
65 m_proxy.
callMethod(
"Ping").onInterface(INTERFACE_NAME);
68 std::string GetMachineId()
70 std::string machineUUID;
71 m_proxy.
callMethod(
"GetMachineId").onInterface(INTERFACE_NAME).storeResultsTo(machineUUID);
82 static inline const char* INTERFACE_NAME =
"org.freedesktop.DBus.Introspectable";
102 std::string Introspect()
105 m_proxy.
callMethod(
"Introspect").onInterface(INTERFACE_NAME).storeResultsTo(xml);
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;
358 static inline const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
372 void registerAdaptor()
377 void emitPropertiesChangedSignal(
const InterfaceName& interfaceName,
const std::vector<PropertyName>& properties)
382 void emitPropertiesChangedSignal(
const char* interfaceName,
const std::vector<PropertyName>& properties)
387 void emitPropertiesChangedSignal(
const InterfaceName& interfaceName)
392 void emitPropertiesChangedSignal(
const char* interfaceName)
413 static inline const char* INTERFACE_NAME =
"org.freedesktop.DBus.ObjectManager";
427 void registerAdaptor()
462 void registerAdaptor()
virtual void emitInterfacesRemovedSignal()=0
Emits InterfacesRemoved signal on this object path.
virtual void emitPropertiesChangedSignal(const InterfaceName &interfaceName, const std::vector< PropertyName > &propNames)=0
Emits PropertyChanged signal for specified properties under a given interface of this object path.
virtual void addObjectManager()=0
Adds an ObjectManager interface at the path of this D-Bus object.
virtual void emitInterfacesAddedSignal()=0
Emits InterfacesAdded signal on this object path.
PropertyGetter getProperty(const PropertyName &propertyName)
Gets value of a property of the D-Bus object.
Definition IProxy.h:789
AsyncPropertyGetter getPropertyAsync(const PropertyName &propertyName)
Gets value of a property of the D-Bus object asynchronously.
Definition IProxy.h:799
AsyncAllPropertiesGetter getAllPropertiesAsync()
Gets values of all properties of the D-Bus object asynchronously.
Definition IProxy.h:834
PropertySetter setProperty(const PropertyName &propertyName)
Sets value of a property of the D-Bus object.
Definition IProxy.h:809
MethodInvoker callMethod(const MethodName &methodName)
Calls method on the D-Bus object.
Definition IProxy.h:744
SignalSubscriber uponSignal(const SignalName &signalName)
Registers signal handler for a given signal of the D-Bus object.
Definition IProxy.h:774
AllPropertiesGetter getAllProperties()
Gets values of all properties of the D-Bus object.
Definition IProxy.h:829
AsyncPropertySetter setPropertyAsync(const PropertyName &propertyName)
Sets value of a property of the D-Bus object asynchronously.
Definition IProxy.h:819
Definition StandardInterfaces.h:81
Managed Object Convenience Adaptor.
Definition StandardInterfaces.h:448
void emitInterfacesRemovedSignal()
Emits InterfacesRemoved signal for this object path.
Definition StandardInterfaces.h:492
void emitInterfacesAddedSignal()
Emits InterfacesAdded signal for this object path.
Definition StandardInterfaces.h:472
void emitInterfacesAddedSignal(const std::vector< sdbus::InterfaceName > &interfaces)
Emits InterfacesAdded signal for this object path.
Definition StandardInterfaces.h:482
void emitInterfacesRemovedSignal(const std::vector< InterfaceName > &interfaces)
Emits InterfacesRemoved signal for this object path.
Definition StandardInterfaces.h:502
Object Manager Convenience Adaptor.
Definition StandardInterfaces.h:412
Definition StandardInterfaces.h:297
Definition StandardInterfaces.h:42
Definition StandardInterfaces.h:357
Definition StandardInterfaces.h:115
Definition TypeTraits.h:107
Definition TypeTraits.h:88
Definition TypeTraits.h:104