summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-04-09 16:20:38 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-03-11 11:37:43 +0200
commit519776b96460d850a01582ee5884b8fa0752bc00 (patch)
tree8fdc63ccff5229a4a2bb0ae6f1f1ef70ee02c900
parentc4db10d2cde32ab4c05417a75e11698816a87c27 (diff)
downloadbluez-519776b96460d850a01582ee5884b8fa0752bc00.tar.gz
service: Do not emit duplicate states
-rw-r--r--plugins/service.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/service.c b/plugins/service.c
index 43baec101..243df4682 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -51,6 +51,7 @@ static GSList *services = NULL;
struct service_data {
struct btd_service *service;
+ btd_service_state_t state;
char *path;
DBusMessage *connect;
DBusMessage *disconnect;
@@ -132,10 +133,11 @@ static DBusMessage *service_connect(DBusConnection *conn, DBusMessage *msg,
static const char *data_get_state(struct service_data *data)
{
- btd_service_state_t state = btd_service_get_state(data->service);
int err;
- switch (state) {
+ data->state = btd_service_get_state(data->service);
+
+ switch (data->state) {
case BTD_SERVICE_STATE_UNAVAILABLE:
return "unavailable";
case BTD_SERVICE_STATE_DISCONNECTED:
@@ -419,8 +421,10 @@ static void service_cb(struct btd_service *service,
break;
}
- g_dbus_emit_property_changed(btd_get_dbus_connection(), data->path,
- SERVICE_INTERFACE, "State");
+ if (data->state != btd_service_get_state(service))
+ g_dbus_emit_property_changed(btd_get_dbus_connection(),
+ data->path, SERVICE_INTERFACE,
+ "State");
}
static int service_init(void)