[PATCH BlueZ 08/11] Reset the Immediate Alert at disconnection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reporter will turn off the alert when the link is disconnected. At the
Proximity Monitor side, the Immediate Alert level should also follow
the same logic.
---
 proximity/monitor.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/proximity/monitor.c b/proximity/monitor.c
index f765824..58557e9 100644
--- a/proximity/monitor.c
+++ b/proximity/monitor.c
@@ -342,9 +342,25 @@ static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
 static void attio_disconnected_cb(gpointer user_data)
 {
 	struct monitor *monitor = user_data;
+	const char *path = device_get_path(monitor->device);
 
 	g_attrib_unref(monitor->attrib);
 	monitor->attrib = NULL;
+
+	if (monitor->immediateto == 0)
+		return;
+
+	g_source_remove(monitor->immediateto);
+	monitor->immediateto = 0;
+
+	if (g_strcmp0(monitor->immediatelevel, "none") == 0)
+		return;
+
+	g_free(monitor->immediatelevel);
+	monitor->immediatelevel = g_strdup("none");
+	emit_property_changed(monitor->conn, path, PROXIMITY_INTERFACE,
+					"ImmediateAlertLevel", DBUS_TYPE_STRING,
+					&monitor->immediatelevel);
 }
 
 static gboolean level_is_valid(const char *level)
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux