monitor: Decode LL_PERIODIC_SYNC_IND
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 27 Feb 2019 11:12:27 +0000 (13:12 +0200)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
This introduces the command passing for LL_PERIODIC_SYNC_IND PDU added
in 5.1.

Change-Id: I6bbc4ef6107c3bf0045ef3427458bacfec95ea92
Signed-off-by: himanshu <h.himanshu@samsung.com>
monitor/bt.h
monitor/ll.c

index f3995b4..3b2af74 100755 (executable)
@@ -156,6 +156,18 @@ struct bt_ll_cte_req {
 
 #define BT_LL_CTE_RSP          0x1b
 
+#define BT_LL_PERIODIC_SYNC_IND        0x1c
+struct bt_ll_periodic_sync_ind {
+       uint16_t id;
+       uint8_t  info[18];
+       uint16_t event_count;
+       uint16_t last_counter;
+       uint8_t  adv_info;
+       uint8_t  phy;
+       uint8_t  adv_addr[6];
+       uint16_t sync_counter;
+} __attribute__ ((packed));
+
 #define LMP_ESC4(x) ((127 << 8) | (x))
 
 #define BT_LMP_NAME_REQ                        1
index fdfea42..2378218 100755 (executable)
@@ -569,6 +569,30 @@ static void cte_req(const void *data, uint8_t size)
        }
 }
 
+static void periodic_sync_ind(const void *data, uint8_t size)
+{
+       const struct bt_ll_periodic_sync_ind *pdu = data;
+       uint8_t mask;
+
+       print_field("ID: 0x%4.4x", pdu->id);
+       print_field("SyncInfo:");
+       packet_hexdump(pdu->info, sizeof(pdu->info));
+       print_field("connEventCount: 0x%4.4x", pdu->event_count);
+       print_field("lastPaEventCounter: 0x%4.4x", pdu->last_counter);
+       print_field("SID: 0x%2.2x", pdu->adv_info & 0xf0);
+       print_field("AType: %s", pdu->adv_info & 0x08 ? "random" : "public");
+       print_field("SCA: 0x%2.2x", pdu->adv_info & 0x07);
+       print_field("PHY: 0x%2.2x", pdu->phy);
+
+       mask = print_bitfield(2, pdu->phy, le_phys);
+       if (mask)
+               print_text(COLOR_UNKNOWN_OPTIONS_BIT, "  Reserved"
+                                                       " (0x%2.2x)", mask);
+
+       packet_print_addr("AdvA", pdu->adv_addr, pdu->adv_info & 0x08);
+       print_field("syncConnEventCount: 0x%4.4x", pdu->sync_counter);
+}
+
 struct llcp_data {
        uint8_t opcode;
        const char *str;
@@ -606,6 +630,7 @@ static const struct llcp_data llcp_table[] = {
        { 0x19, "LL_MIN_USED_CHANNELS_IND", min_used_channels,  2, true },
        { 0x1a, "LL_CTE_REQ",               cte_req,            1, true },
        { 0x1b, "LL_CTE_RSP",               null_pdu,           0, true },
+       { 0x1c, "LL_PERIODIC_SYNC_IND",     periodic_sync_ind, 34, true },
        { }
 };