From ca967050478034a4333e89af0fa5cbeee9283aa4 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 24 Mar 2015 02:02:25 +0100 Subject: [PATCH] monitor: Print control events for advertising added/removed --- monitor/control.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/monitor/control.c b/monitor/control.c index 38a1b316c..e61a79d64 100644 --- a/monitor/control.c +++ b/monitor/control.c @@ -738,6 +738,40 @@ static void mgmt_new_conn_param(uint16_t len, const void *buf) packet_hexdump(buf, len); } +static void mgmt_advertising_added(uint16_t len, const void *buf) +{ + const struct mgmt_ev_advertising_added *ev = buf; + + if (len < sizeof(*ev)) { + printf("* Malformed Advertising Added control\n"); + return; + } + + printf("@ Advertising Added: %u\n", ev->instance); + + buf += sizeof(*ev); + len -= sizeof(*ev); + + packet_hexdump(buf, len); +} + +static void mgmt_advertising_removed(uint16_t len, const void *buf) +{ + const struct mgmt_ev_advertising_removed *ev = buf; + + if (len < sizeof(*ev)) { + printf("* Malformed Advertising Removed control\n"); + return; + } + + printf("@ Advertising Removed: %u\n", ev->instance); + + buf += sizeof(*ev); + len -= sizeof(*ev); + + packet_hexdump(buf, len); +} + void control_message(uint16_t opcode, const void *data, uint16_t size) { switch (opcode) { @@ -834,6 +868,12 @@ void control_message(uint16_t opcode, const void *data, uint16_t size) case MGMT_EV_EXT_INDEX_REMOVED: mgmt_ext_index_removed(size, data); break; + case MGMT_EV_ADVERTISING_ADDED: + mgmt_advertising_added(size, data); + break; + case MGMT_EV_ADVERTISING_REMOVED: + mgmt_advertising_removed(size, data); + break; default: printf("* Unknown control (code %d len %d)\n", opcode, size); packet_hexdump(data, size); -- 2.47.3