[PATCH BlueZ 12/14] Emit SignalLevel when RSSI alert is received

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

 



Changes Proximity Monitor emitting a signal when the RSSI threshold
monitoring event is received.
---
 proximity/monitor.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/proximity/monitor.c b/proximity/monitor.c
index 4bd4506..818325a 100644
--- a/proximity/monitor.c
+++ b/proximity/monitor.c
@@ -186,7 +186,31 @@ static int write_alert_level(struct monitor *monitor)
 
 static void monitor_rssi_alert(uint8_t alert, gpointer user_data)
 {
-	DBG("");
+	struct monitor *monitor = user_data;
+	const char *level, *path = device_get_path(monitor->device);
+
+	switch (alert) {
+	case 0x00:
+		level = "good";
+		break;
+	case 0x01:
+		level = "regular";
+		break;
+	case 0x02:
+		level = "weak";
+		break;
+	default:
+		level = "unknown";
+		break;
+	}
+
+	emit_property_changed(monitor->conn, path, PROXIMITY_INTERFACE,
+					"SignalLevel", DBUS_TYPE_STRING,
+					&level);
+	g_free(monitor->signallevel);
+	monitor->signallevel = g_strdup(level);
+
+	DBG("SignalLevel: %s", level);
 }
 
 static void tx_power_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
-- 
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