diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-03-24 02:02:25 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-03-24 02:02:25 +0100 |
commit | ca967050478034a4333e89af0fa5cbeee9283aa4 (patch) | |
tree | ac79d45984806855486e4132e56232cd344a78f6 /monitor/control.c | |
parent | f5b246a4d48aba4052ed7edb6719a55d490f2595 (diff) | |
download | bluez-ca967050478034a4333e89af0fa5cbeee9283aa4.tar.gz |
monitor: Print control events for advertising added/removed
Diffstat (limited to 'monitor/control.c')
-rw-r--r-- | monitor/control.c | 40 |
1 files changed, 40 insertions, 0 deletions
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); |