27#ifndef SDBUS_CXX_STANDARDINTERFACES_H_
28#define SDBUS_CXX_STANDARDINTERFACES_H_
42 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Peer";
55 proxy_.
callMethod(
"Ping").onInterface(INTERFACE_NAME);
58 std::string GetMachineId()
60 std::string machineUUID;
61 proxy_.
callMethod(
"GetMachineId").onInterface(INTERFACE_NAME).storeResultsTo(machineUUID);
72 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Introspectable";
83 std::string Introspect()
86 proxy_.
callMethod(
"Introspect").onInterface(INTERFACE_NAME).storeResultsTo(xml);
97 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
105 .onInterface(INTERFACE_NAME)
106 .call([
this](
const std::string& interfaceName
107 ,
const std::map<std::string, sdbus::Variant>& changedProperties
108 ,
const std::vector<std::string>& invalidatedProperties )
110 this->onPropertiesChanged(interfaceName, changedProperties, invalidatedProperties);
116 virtual void onPropertiesChanged(
const std::string& interfaceName
117 ,
const std::map<std::string, sdbus::Variant>& changedProperties
118 ,
const std::vector<std::string>& invalidatedProperties ) = 0;
121 sdbus::Variant Get(
const std::string& interfaceName,
const std::string& propertyName)
123 return proxy_.
getProperty(propertyName).onInterface(interfaceName);
126 void Set(
const std::string& interfaceName,
const std::string& propertyName,
const sdbus::Variant& value)
128 proxy_.
setProperty(propertyName).onInterface(interfaceName).toValue(value);
131 std::map<std::string, sdbus::Variant> GetAll(
const std::string& interfaceName)
133 std::map<std::string, sdbus::Variant> props;
134 proxy_.
callMethod(
"GetAll").onInterface(INTERFACE_NAME).withArguments(interfaceName).storeResultsTo(props);
145 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.ObjectManager";
153 .onInterface(INTERFACE_NAME)
155 ,
const std::map<std::string, std::map<std::string, sdbus::Variant>>& interfacesAndProperties )
157 this->onInterfacesAdded(objectPath, interfacesAndProperties);
162 .onInterface(INTERFACE_NAME)
164 ,
const std::vector<std::string>& interfaces )
166 this->onInterfacesRemoved(objectPath, interfaces);
173 ,
const std::map<std::string, std::map<std::string, sdbus::Variant>>& interfacesAndProperties) = 0;
175 ,
const std::vector<std::string>& interfaces) = 0;
178 std::map<sdbus::ObjectPath, std::map<std::string, std::map<std::string, sdbus::Variant>>> GetManagedObjects()
180 std::map<sdbus::ObjectPath, std::map<std::string, std::map<std::string, sdbus::Variant>>> objectsInterfacesAndProperties;
181 proxy_.
callMethod(
"GetManagedObjects").onInterface(INTERFACE_NAME).storeResultsTo(objectsInterfacesAndProperties);
182 return objectsInterfacesAndProperties;
196 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
207 void emitPropertiesChangedSignal(
const std::string& interfaceName,
const std::vector<std::string>& properties)
212 void emitPropertiesChangedSignal(
const std::string& interfaceName)
233 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:410
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:405
SignalSubscriber uponSignal(const std::string &signalName)
Registers signal handler for a given signal of the proxied D-Bus object.
Definition: IProxy.h:395
Definition: StandardInterfaces.h:71
Managed Object Convenience Adaptor.
Definition: StandardInterfaces.h:260
void emitInterfacesRemovedSignal()
Emits InterfacesRemoved signal for this object path.
Definition: StandardInterfaces.h:294
void emitInterfacesRemovedSignal(const std::vector< std::string > &interfaces)
Emits InterfacesRemoved signal for this object path.
Definition: StandardInterfaces.h:304
void emitInterfacesAddedSignal()
Emits InterfacesAdded signal for this object path.
Definition: StandardInterfaces.h:274
void emitInterfacesAddedSignal(const std::vector< std::string > &interfaces)
Emits InterfacesAdded signal for this object path.
Definition: StandardInterfaces.h:284
Object Manager Convenience Adaptor.
Definition: StandardInterfaces.h:232
Definition: StandardInterfaces.h:144
Definition: StandardInterfaces.h:41
Definition: StandardInterfaces.h:195
Definition: StandardInterfaces.h:96