| 346 | } |
| 347 | |
| 348 | int 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 | |
| 377 | int Object::sdbus_property_set_callback( sd_bus */*bus*/ |
| 378 | , const char */*objectPath*/ |
nothing calls this directly
no test coverage detected