MCPcopy Create free account
hub / github.com/Kistler-Group/sdbus-cpp / sdbus_property_get_callback

Method sdbus_property_get_callback

src/Object.cpp:348–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348int Object::sdbus_property_get_callback( sd_bus */*bus*/
349 , const char */*objectPath*/
350 , const char */*interface*/
351 , const char *property
352 , sd_bus_message *sdbusReply
353 , void *userData
354 , sd_bus_error *retError )
355{
356 auto* vtable = static_cast<VTable*>(userData);
357 assert(vtable != nullptr);
358 assert(vtable->object != nullptr);
359
360 const auto* propertyItem = findProperty(*vtable, property);
361 assert(propertyItem != nullptr);
362
363 // Getter may be empty - the case of "write-only" property
364 if (!propertyItem->getCallback)
365 {
366 sd_bus_error_set(retError, "org.freedesktop.DBus.Error.Failed", "Cannot read property as it is write-only");
367 return 1;
368 }
369
370 auto reply = Message::Factory::create<PropertyGetReply>(sdbusReply, &vtable->object->connection_);
371
372 auto ok = invokeHandlerAndCatchErrors([&](){ propertyItem->getCallback(reply); }, retError);
373
374 return ok ? 1 : -1;
375}
376
377int Object::sdbus_property_set_callback( sd_bus */*bus*/
378 , const char */*objectPath*/

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected