105 class Properties_proxy
107 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
114 ->uponSignal(
"PropertiesChanged")
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);
124 Properties_proxy(
const Properties_proxy&) =
delete;
125 Properties_proxy& operator=(
const Properties_proxy&) =
delete;
126 Properties_proxy(Properties_proxy&&) =
default;
127 Properties_proxy& operator=(Properties_proxy&&) =
default;
129 ~Properties_proxy() =
default;
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 template <
typename _Function>
142 PendingAsyncCall GetAsync(
const std::string& interfaceName,
const std::string& propertyName, _Function&& callback)
144 return proxy_->getPropertyAsync(propertyName).onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback));
147 std::future<sdbus::Variant> GetAsync(
const std::string& interfaceName,
const std::string& propertyName,
with_future_t)
149 return proxy_->getPropertyAsync(propertyName).onInterface(interfaceName).getResultAsFuture();
152 void Set(
const std::string& interfaceName,
const std::string& propertyName,
const sdbus::Variant& value)
154 proxy_->setProperty(propertyName).onInterface(interfaceName).toValue(value);
159 proxy_->setProperty(propertyName).onInterface(interfaceName).toValue(value, dont_expect_reply);
162 template <
typename _Function>
165 return proxy_->setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).uponReplyInvoke(std::forward<_Function>(callback));
168 std::future<void> SetAsync(
const std::string& interfaceName,
const std::string& propertyName,
const sdbus::Variant& value,
with_future_t)
170 return proxy_->setPropertyAsync(propertyName).onInterface(interfaceName).toValue(value).getResultAsFuture();
173 std::map<std::string, sdbus::Variant> GetAll(
const std::string& interfaceName)
175 return proxy_->getAllProperties().onInterface(interfaceName);
178 template <
typename _Function>
179 PendingAsyncCall GetAllAsync(
const std::string& interfaceName, _Function&& callback)
181 return proxy_->getAllPropertiesAsync().onInterface(interfaceName).uponReplyInvoke(std::forward<_Function>(callback));
184 std::future<std::map<std::string, sdbus::Variant>> GetAllAsync(
const std::string& interfaceName,
with_future_t)
186 return proxy_->getAllPropertiesAsync().onInterface(interfaceName).getResultAsFuture();
194 class ObjectManager_proxy
196 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.ObjectManager";
203 ->uponSignal(
"InterfacesAdded")
204 .onInterface(INTERFACE_NAME)
206 ,
const std::map<std::string, std::map<std::string, sdbus::Variant>>& interfacesAndProperties )
208 this->onInterfacesAdded(objectPath, interfacesAndProperties);
211 proxy_->uponSignal(
"InterfacesRemoved")
212 .onInterface(INTERFACE_NAME)
214 ,
const std::vector<std::string>& interfaces )
216 this->onInterfacesRemoved(objectPath, interfaces);
220 ObjectManager_proxy(
const ObjectManager_proxy&) =
delete;
221 ObjectManager_proxy& operator=(
const ObjectManager_proxy&) =
delete;
222 ObjectManager_proxy(ObjectManager_proxy&&) =
default;
223 ObjectManager_proxy& operator=(ObjectManager_proxy&&) =
default;
225 ~ObjectManager_proxy() =
default;
228 ,
const std::map<std::string, std::map<std::string, sdbus::Variant>>& interfacesAndProperties) = 0;
230 ,
const std::vector<std::string>& interfaces) = 0;
233 std::map<sdbus::ObjectPath, std::map<std::string, std::map<std::string, sdbus::Variant>>> GetManagedObjects()
235 std::map<sdbus::ObjectPath, std::map<std::string, std::map<std::string, sdbus::Variant>>> objectsInterfacesAndProperties;
236 proxy_->callMethod(
"GetManagedObjects").onInterface(INTERFACE_NAME).storeResultsTo(objectsInterfacesAndProperties);
237 return objectsInterfacesAndProperties;
249 class Properties_adaptor
251 static constexpr const char* INTERFACE_NAME =
"org.freedesktop.DBus.Properties";
259 Properties_adaptor(
const Properties_adaptor&) =
delete;
260 Properties_adaptor& operator=(
const Properties_adaptor&) =
delete;
261 Properties_adaptor(Properties_adaptor&&) =
default;
262 Properties_adaptor& operator=(Properties_adaptor&&) =
default;
264 ~Properties_adaptor() =
default;
267 void emitPropertiesChangedSignal(
const std::string& interfaceName,
const std::vector<std::string>& properties)
269 object_->emitPropertiesChangedSignal(interfaceName, properties);
272 void emitPropertiesChangedSignal(
const std::string& interfaceName)
274 object_->emitPropertiesChangedSignal(interfaceName);