27#ifndef SDBUS_CXX_STANDARDINTERFACES_H_
28#define SDBUS_CXX_STANDARDINTERFACES_H_
42 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Peer";
60 proxy_->
callMethod(
"Ping").onInterface(INTERFACE_NAME);
63 std::string GetMachineId()
65 std::string machineUUID;
66 proxy_->
callMethod(
"GetMachineId").onInterface(INTERFACE_NAME).storeResultsTo(machineUUID);
77 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Introspectable";
93 std::string Introspect()
96 proxy_->
callMethod(
"Introspect").onInterface(INTERFACE_NAME).storeResultsTo(xml);
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 void Set(
const std::string& interfaceName,
const std::string& propertyName,
const sdbus::Variant& value)
143 proxy_->
setProperty(propertyName).onInterface(interfaceName).toValue(value);
146 std::map<std::string, sdbus::Variant> GetAll(
const std::string& interfaceName)
148 std::map<std::string, sdbus::Variant> props;
149 proxy_->
callMethod(
"GetAll").onInterface(INTERFACE_NAME).withArguments(interfaceName).storeResultsTo(props);
160 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.ObjectManager";
168 .onInterface(INTERFACE_NAME)
170 ,
const std::map<std::string, std::map<std::string, sdbus::Variant>>& interfacesAndProperties )
172 this->onInterfacesAdded(objectPath, interfacesAndProperties);
176 .onInterface(INTERFACE_NAME)
178 ,
const std::vector<std::string>& interfaces )
180 this->onInterfacesRemoved(objectPath, interfaces);
192 ,
const std::map<std::string, std::map<std::string, sdbus::Variant>>& interfacesAndProperties) = 0;
194 ,
const std::vector<std::string>& interfaces) = 0;
197 std::map<sdbus::ObjectPath, std::map<std::string, std::map<std::string, sdbus::Variant>>> GetManagedObjects()
199 std::map<sdbus::ObjectPath, std::map<std::string, std::map<std::string, sdbus::Variant>>> objectsInterfacesAndProperties;
200 proxy_->
callMethod(
"GetManagedObjects").onInterface(INTERFACE_NAME).storeResultsTo(objectsInterfacesAndProperties);
201 return objectsInterfacesAndProperties;
215 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
231 void emitPropertiesChangedSignal(
const std::string& interfaceName,
const std::vector<std::string>& properties)
236 void emitPropertiesChangedSignal(
const std::string& interfaceName)
257 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.ObjectManager";
virtual void emitInterfacesRemovedSignal()=0
Emits InterfacesRemoved signal on 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.
virtual void emitPropertiesChangedSignal(const std::string &interfaceName, const std::vector< std::string > &propNames)=0
Emits PropertyChanged signal for specified properties under a given interface of this object path.
PropertySetter setProperty(const std::string &propertyName)
Sets value of a property of the proxied D-Bus object.
Definition IProxy.h:448
virtual MethodReply callMethod(const MethodCall &message, uint64_t timeout=0)=0
Calls method on the proxied D-Bus object.
PropertyGetter getProperty(const std::string &propertyName)
Gets value of a property of the proxied D-Bus object.
Definition IProxy.h:443
SignalSubscriber uponSignal(const std::string &signalName)
Registers signal handler for a given signal of the proxied D-Bus object.
Definition IProxy.h:433
Definition StandardInterfaces.h:76
Managed Object Convenience Adaptor.
Definition StandardInterfaces.h:289
void emitInterfacesRemovedSignal()
Emits InterfacesRemoved signal for this object path.
Definition StandardInterfaces.h:329
void emitInterfacesRemovedSignal(const std::vector< std::string > &interfaces)
Emits InterfacesRemoved signal for this object path.
Definition StandardInterfaces.h:339
void emitInterfacesAddedSignal()
Emits InterfacesAdded signal for this object path.
Definition StandardInterfaces.h:309
void emitInterfacesAddedSignal(const std::vector< std::string > &interfaces)
Emits InterfacesAdded signal for this object path.
Definition StandardInterfaces.h:319
Object Manager Convenience Adaptor.
Definition StandardInterfaces.h:256
Definition StandardInterfaces.h:159
Definition StandardInterfaces.h:41
Definition StandardInterfaces.h:214
Definition StandardInterfaces.h:106