From: Jakub Pawlowski <jpawlowski@google.com>
To: linux-bluetooth@vger.kernel.org
Cc: Jakub Pawlowski <jpawlowski@google.com>
Subject: [PATCH 1/2] gdbus: add method for immediate property update
Date: Thu, 17 Sep 2015 21:39:56 -0700 [thread overview]
Message-ID: <1442551197-5374-1-git-send-email-jpawlowski@google.com> (raw)
g_dbus_emit_property_changed doesn't send dbus signal immediately. Instead
it stores changed properties, and schedule signal to be send at
g_iddle_add. Additionally, if this method is called few times for some
property, only last value will be sent in property changed signal.
If remote device sends lots of notifications, they're all scheduled to be
notified using this method. This might result in some notifications being
lost.
This patch adds new method, that immediately sends property changed
signal, instead of sheduling it for nearest iddle moment.
---
gdbus/gdbus.h | 3 +++
gdbus/object.c | 46 +++++++++++++++++++++++++++++++++++-----------
2 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index d99c254..b31246a 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -300,6 +300,9 @@ void g_dbus_pending_property_error(GDBusPendingReply id, const char *name,
void g_dbus_emit_property_changed(DBusConnection *connection,
const char *path, const char *interface,
const char *name);
+void g_dbus_emit_property_changed_immediate(DBusConnection *connection,
+ const char *path, const char *interface,
+ const char *name);
gboolean g_dbus_get_properties(DBusConnection *connection, const char *path,
const char *interface, DBusMessageIter *iter);
diff --git a/gdbus/object.c b/gdbus/object.c
index 96db516..fff9e0d 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1720,21 +1720,12 @@ static void process_property_changes(struct generic_data *data)
}
}
-void g_dbus_emit_property_changed(DBusConnection *connection,
- const char *path, const char *interface,
- const char *name)
+static void prepare_property_changed(const char *interface, const char *name,
+ struct generic_data *data)
{
const GDBusPropertyTable *property;
- struct generic_data *data;
struct interface_data *iface;
- if (path == NULL)
- return;
-
- if (!dbus_connection_get_object_path_data(connection, path,
- (void **) &data) || data == NULL)
- return;
-
iface = find_interface(data->interfaces, interface);
if (iface == NULL)
return;
@@ -1759,10 +1750,43 @@ void g_dbus_emit_property_changed(DBusConnection *connection,
data->pending_prop = TRUE;
iface->pending_prop = g_slist_prepend(iface->pending_prop,
(void *) property);
+}
+
+void g_dbus_emit_property_changed(DBusConnection *connection, const char *path,
+ const char *interface, const char *name)
+{
+ struct generic_data *data;
+
+ if (path == NULL)
+ return;
+
+ if (!dbus_connection_get_object_path_data(connection, path,
+ (void **) &data) || data == NULL)
+ return;
+
+ prepare_property_changed(interface, name, data);
add_pending(data);
}
+void g_dbus_emit_property_changed_immediate(DBusConnection *connection,
+ const char *path, const char *interface,
+ const char *name)
+{
+ struct generic_data *data;
+
+ if (path == NULL)
+ return;
+
+ if (!dbus_connection_get_object_path_data(connection, path,
+ (void **) &data) || data == NULL)
+ return;
+
+ prepare_property_changed(interface, name, data);
+
+ process_property_changes(data);
+}
+
gboolean g_dbus_get_properties(DBusConnection *connection, const char *path,
const char *interface, DBusMessageIter *iter)
{
--
2.5.0
next reply other threads:[~2015-09-18 4:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 4:39 Jakub Pawlowski [this message]
2015-09-18 4:39 ` [PATCH 2/2] core/gatt-client: fix losing notifications Jakub Pawlowski
2015-09-18 7:15 ` [PATCH 1/2] gdbus: add method for immediate property update Luiz Augusto von Dentz
2015-09-18 7:52 ` Jakub Pawlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442551197-5374-1-git-send-email-jpawlowski@google.com \
--to=jpawlowski@google.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox