monitor: Add ADV Monitor events to btmon parser
authorBrian Gix <brian.gix@intel.com>
Thu, 8 Sep 2022 14:55:54 +0000 (07:55 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:54 +0000 (14:55 +0530)
Add missing ADV Monitor MGMT events

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
monitor/packet.c

index 33554de..ad5071b 100755 (executable)
@@ -14910,6 +14910,37 @@ static void mgmt_controller_resume_evt(const void *data, uint16_t size)
        mgmt_print_address(data, addr_type);
 }
 
+static void mgmt_adv_monitor_device_found_evt(const void *data, uint16_t size)
+{
+       uint16_t handle = get_le16(data);
+       const uint8_t *addr = data + 2;
+       uint8_t addr_type = get_u8(data + 8);
+       int8_t rssi = get_s8(data + 9);
+       uint32_t flags = get_le32(data + 10);
+       uint16_t ad_data_len = get_le16(data + 14);
+       const uint8_t *ad_data = data + 16;
+
+       print_field("Handle: %d", handle);
+       print_bdaddr(addr);
+       print_field("Addr Type: %d", addr_type);
+       print_field("RSSI: %d", rssi);
+       mgmt_print_device_flags(flags);
+       print_field("AD Data Len: %d", ad_data_len);
+       size -= 16;
+       print_hex_field("AD Data", ad_data, size);
+}
+
+static void mgmt_adv_monitor_device_lost_evt(const void *data, uint16_t size)
+{
+       uint16_t handle = get_le16(data);
+       const uint8_t *addr = data + 2;
+       uint8_t addr_type = get_u8(data + 8);
+
+       print_field("Handle: %d", handle);
+       print_bdaddr(addr);
+       print_field("Addr Type: %d", addr_type);
+}
+
 static const struct mgmt_data mgmt_event_table[] = {
        { 0x0001, "Command Complete",
                        mgmt_command_complete_evt, 3, false },
@@ -14999,6 +15030,10 @@ static const struct mgmt_data mgmt_event_table[] = {
                        mgmt_controller_suspend_evt, 1, true },
        { 0x002e, "Controller Resumed",
                        mgmt_controller_resume_evt, 8, true },
+       { 0x002f, "ADV Monitor Device Found",
+                       mgmt_adv_monitor_device_found_evt, 16, false },
+       { 0x0030, "ADV Monitor Device Lost",
+                       mgmt_adv_monitor_device_lost_evt, 9, true },
        { }
 };