summaryrefslogtreecommitdiff
path: root/monitor/control.c
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2014-07-01 19:26:40 -0300
committerMarcel Holtmann <marcel@holtmann.org>2014-07-02 00:45:51 +0200
commit46f68d732be64e4adfc9f0fdd3b1d5724d6c442d (patch)
tree2a29a011c9bce7d2c93b565e92c3e9f34e3ec907 /monitor/control.c
parenta1451db1fef3f641c5600b23744ef04a7c87b904 (diff)
downloadbluez-46f68d732be64e4adfc9f0fdd3b1d5724d6c442d.tar.gz
monitor: Add support for decoding New Connection Parameter event
Diffstat (limited to 'monitor/control.c')
-rw-r--r--monitor/control.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/monitor/control.c b/monitor/control.c
index 083f65dcc..c4568d807 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -580,6 +580,33 @@ static void mgmt_device_removed(uint16_t len, const void *buf)
packet_hexdump(buf, len);
}
+static void mgmt_new_conn_param(uint16_t len, const void *buf)
+{
+ const struct mgmt_ev_new_conn_param *ev = buf;
+ char addr[18];
+ uint16_t min, max, latency, timeout;
+
+ if (len < sizeof(*ev)) {
+ printf("* Malformed New Connection Parameter control\n");
+ return;
+ }
+
+ ba2str(&ev->addr.bdaddr, addr);
+ min = le16_to_cpu(ev->min_interval);
+ max = le16_to_cpu(ev->max_interval);
+ latency = le16_to_cpu(ev->latency);
+ timeout = le16_to_cpu(ev->timeout);
+
+ printf("@ New Conn Param: %s (%d) hint %d min 0x%4.4x max 0x%4.4x "
+ "latency 0x%4.4x timeout 0x%4.4x\n", addr, ev->addr.type,
+ ev->store_hint, min, max, latency, timeout);
+
+ buf += sizeof(*ev);
+ len -= sizeof(*ev);
+
+ packet_hexdump(buf, len);
+}
+
void control_message(uint16_t opcode, const void *data, uint16_t size)
{
switch (opcode) {
@@ -658,6 +685,9 @@ void control_message(uint16_t opcode, const void *data, uint16_t size)
case MGMT_EV_DEVICE_REMOVED:
mgmt_device_removed(size, data);
break;
+ case MGMT_EV_NEW_CONN_PARAM:
+ mgmt_new_conn_param(size, data);
+ break;
default:
printf("* Unknown control (code %d len %d)\n", opcode, size);
packet_hexdump(data, size);