Add dbus_get_prop_async utility

This drastically reduces the amount of boilerplate needed to get a
property from a bus object.
This commit is contained in:
Calvin Lee 2017-11-09 12:58:32 -07:00
parent b9f36716b5
commit 87035380e3
4 changed files with 137 additions and 293 deletions

View file

@ -11,6 +11,23 @@ extern DBusConnection *conn;
*/
bool dbus_message_iter_check_signature(DBusMessageIter *iter, const char *sig);
/**
* Fetches the property and calls `callback` with a message iter pointing it.
* Performs error handling and signature checking.
*
* Returns: true if message is successfully sent (will not necessarily arrive)
* and false otherwise
*
* NOTE: `expected_signature` must remain valid until the message reply is
* received, please only use 'static signatures.
*/
bool dbus_get_prop_async(const char *destination,
const char *path,
const char *iface,
const char *prop,
const char *expected_signature,
void(*callback)(DBusMessageIter *iter, void *data),
void *data);
/**
* Should be called in main loop to dispatch events
*/