[PATCH BlueZ 08/14] Add handle for RSSI monitor alert event in mgmt

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

 



Changes mgmtops plugin adding the handler for the RSSI threshold alert
event. This event is sent by the kernel when the alerting state/type
changes.
---
 plugins/mgmtops.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index e01f330..3d909ab 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1385,6 +1385,27 @@ static void mgmt_discovering(int sk, uint16_t index, void *buf, size_t len)
 	adapter_set_state(adapter, state);
 }
 
+static void rssi_monitor_alert(int sk, uint16_t index, void *buf, size_t len)
+{
+	struct mgmt_ev_rssi_monitor_alert *ev = buf;
+	struct controller_info *info;
+
+	if (len != sizeof(*ev)) {
+		error("Too small rssi_monitor_alert event");
+		return;
+	}
+
+	if (index > max_index) {
+		error("Unexpected index %u in RSSI monitor alert event", index);
+		return;
+	}
+
+	info = &controllers[index];
+
+	btd_event_rssi_monitor_alert(&info->bdaddr, &ev->bdaddr,
+							ev->alert_type);
+}
+
 static gboolean mgmt_event(GIOChannel *io, GIOCondition cond, gpointer user_data)
 {
 	char buf[MGMT_BUF_SIZE];
@@ -1489,6 +1510,9 @@ static gboolean mgmt_event(GIOChannel *io, GIOCondition cond, gpointer user_data
 	case MGMT_EV_DISCOVERING:
 		mgmt_discovering(sk, index, buf + MGMT_HDR_SIZE, len);
 		break;
+	case MGMT_EV_RSSI_MONITOR_ALERT:
+		rssi_monitor_alert(sk, index, buf + MGMT_HDR_SIZE, len);
+		break;
 	default:
 		error("Unknown Management opcode %u (index %u)", opcode, index);
 		break;
-- 
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