Bluetooth: BTLE: Add new commands parsing
authorJakub Pawlowski <jpawlowski@google.com>
Tue, 13 Dec 2016 03:27:58 +0000 (19:27 -0800)
committerAnders Broman <a.broman58@gmail.com>
Tue, 13 Dec 2016 08:56:32 +0000 (08:56 +0000)
Add "LE Set Extended Advertising Parameters" and
"LE Set Extended Advertising Parameters" commands parsing.

Change-Id: Ibcc9f145694e54710da3a11ade237f7132674366
Reviewed-on: https://code.wireshark.org/review/19234
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-bthci_cmd.c
epan/dissectors/packet-bthci_evt.c

index 900ed1220475a6387b279e2a14574d867c80d6ef..89cf129b49d3e3b5c3cc10d7d5ae5e5366ad2a26 100644 (file)
@@ -351,6 +351,13 @@ static int hf_bthci_cmd_le_peer_irk = -1;
 static int hf_bthci_cmd_le_local_irk = -1;
 static int hf_bthci_cmd_le_address_resolution_enable = -1;
 static int hf_bthci_cmd_le_rpa_timeout = -1;
+static int hf_bthci_cmd_advertising_handle = -1;
+static int hf_bthci_cmd_advertising_event_properties = -1;
+static int hf_bthci_cmd_primary_advertising_phy = -1;
+static int hf_bthci_cmd_sec_adv_max_skip = -1;
+static int hf_bthci_cmd_secondary_advertising_phy = -1;
+static int hf_bthci_cmd_advertising_sid = -1;
+static int hf_bthci_cmd_scan_req_notif_en = -1;
 
 
 static const int *hfx_bthci_cmd_le_event_mask[] = {
@@ -1669,6 +1676,19 @@ static const value_string tds_transport_state_vals[] = {
     {0, NULL }
 };
 
+static const value_string cmd_le_primary_advertising_phy[] = {
+    { 0x01, "Primary advertisement PHY is LE 1M" },
+    { 0x03, "Primary advertisement PHY is LE Coded" },
+    { 0, NULL }
+};
+
+static const value_string cmd_le_secondary_advertising_phy[] = {
+    { 0x01, "Secondary advertisement PHY is LE 1M" },
+    { 0x02, "Secondary advertisement PHY is LE 2M" },
+    { 0x03, "Secondary advertisement PHY is LE Coded" },
+    { 0, NULL }
+};
+
 void proto_register_bthci_cmd(void);
 void proto_reg_handoff_bthci_cmd(void);
 void proto_register_btcommon(void);
@@ -3390,6 +3410,48 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
             offset+=2;
             break;
 
+        case 0x035: /* LE Set Advertising Set Random Address */
+            proto_tree_add_item(tree, hf_bthci_cmd_advertising_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset+=1;
+            offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
+            break;
+
+        case 0x036: /* LE Set Extended Advertising Parameters */
+            proto_tree_add_item(tree, hf_bthci_cmd_advertising_handle, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset+=1;
+            item = proto_tree_add_item(tree, hf_bthci_cmd_advertising_event_properties, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+            offset+=2;
+            item = proto_tree_add_item(tree, hf_bthci_cmd_le_advts_interval_min, tvb, offset, 3, ENC_LITTLE_ENDIAN);
+            proto_item_append_text(item, " (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
+            offset+=3;
+            item = proto_tree_add_item(tree, hf_bthci_cmd_le_advts_interval_max, tvb, offset, 3, ENC_LITTLE_ENDIAN);
+            proto_item_append_text(item, " (%g msec)",  tvb_get_letohs(tvb, offset)*0.625);
+            offset+=3;
+            proto_tree_add_item(tree, hf_bthci_cmd_le_advts_channel_map_1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            proto_tree_add_item(tree, hf_bthci_cmd_le_advts_channel_map_2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            proto_tree_add_item(tree, hf_bthci_cmd_le_advts_channel_map_3, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_bthci_cmd_le_own_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_bthci_cmd_le_peer_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
+            proto_tree_add_item(tree, hf_bthci_cmd_le_advts_filter_policy, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_bthci_cmd_tx_power, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_bthci_cmd_primary_advertising_phy, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_bthci_cmd_sec_adv_max_skip, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_bthci_cmd_secondary_advertising_phy, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_bthci_cmd_advertising_sid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_bthci_cmd_scan_req_notif_en, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            break;
+
         case 0x002: /* LE Read Buffer Size */
         case 0x003: /* LE Read Local Supported Features */
         case 0x007: /* LE Read Advertising Channel Tx Power */
@@ -5209,6 +5271,41 @@ proto_register_bthci_cmd(void)
             FT_UINT16, BASE_HEX, NULL, 0x0,
             NULL, HFILL }
         },
+        { &hf_bthci_cmd_advertising_handle,
+          { "Advertising Handle", "bthci_cmd.advertising_handle",
+            FT_UINT8, BASE_HEX, NULL, 0x0,
+            NULL, HFILL }
+        },
+        { &hf_bthci_cmd_advertising_event_properties,
+          { "Advertising Event Properties", "bthci_cmd.advertising_event_properties",
+            FT_UINT16, BASE_HEX, NULL, 0x0,
+            NULL, HFILL }
+        },
+        { &hf_bthci_cmd_primary_advertising_phy,
+          { "Primary Advertising PHY", "bthci_cmd.primary_advertising_phy",
+            FT_UINT8, BASE_HEX, VALS(cmd_le_primary_advertising_phy), 0x0,
+            NULL, HFILL }
+        },
+        { &hf_bthci_cmd_sec_adv_max_skip,
+          { "Secondary Advertising Max Skip", "bthci_cmd.secondary_advertising_max_skip",
+            FT_UINT8, BASE_HEX, NULL, 0x0,
+            NULL, HFILL }
+        },
+        { &hf_bthci_cmd_secondary_advertising_phy,
+          { "Secondary Advertising PHY", "bthci_cmd.secondary_advertising_phy",
+            FT_UINT8, BASE_HEX, VALS(cmd_le_secondary_advertising_phy), 0x0,
+            NULL, HFILL }
+        },
+        { &hf_bthci_cmd_advertising_sid,
+          { "Advertising SID", "bthci_cmd.advertising_sid",
+            FT_UINT8, BASE_HEX, NULL, 0x0,
+            NULL, HFILL }
+        },
+        { &hf_bthci_cmd_scan_req_notif_en,
+          { "Scan Request Notification Enable", "bthci_cmd.scan_request_notification_enable",
+            FT_UINT8, BASE_HEX, NULL, 0x0,
+            NULL, HFILL }
+        },
     };
 
     static ei_register_info ei[] = {
index a3cd700e3e7b3de9320c8cbd758619685927c53c..da92fc4118957a877690623790faf6259b6451e3 100644 (file)
@@ -389,6 +389,7 @@ static int hf_bthci_evt_mws_to_mws_baud_rate = -1;
 static int hf_bthci_evt_mws_from_mws_baud_rates = -1;
 static int hf_bthci_evt_mws_from_mws_baud_rates_tranport_item = -1;
 static int hf_bthci_evt_mws_from_mws_baud_rate = -1;
+static int hf_bthci_evt_selected_tx_power = -1;
 
 static const int *hfx_bthci_evt_le_features[] = {
     &hf_bthci_evt_le_features_encryption,
@@ -4001,6 +4002,16 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
             break;
         }
 
+        case 0x2036: /* LE Set Extended Advertising Parameters */
+        {
+            proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            send_hci_summary_status_tap(tvb_get_guint8(tvb, offset), pinfo, bluetooth_data);
+            offset += 1;
+            proto_tree_add_item(tree, hf_bthci_evt_selected_tx_power, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset += 1;
+            break;
+        }
+
         case 0x140C: /* Get MWS Transport Layer Configuration */ {
             guint8       transports;
             guint8       i_transport;
@@ -6992,6 +7003,11 @@ proto_register_bthci_evt(void)
           { "From MWS Baud Rate",                          "bthci_evt.mws.from_mws_baud_rates.item.baud_rate",
             FT_UINT32, BASE_DEC, NULL, 0x0,
             NULL, HFILL }
+        },
+        { &hf_bthci_evt_selected_tx_power,
+          { "Selected TX Power (dBm)",                     "bthci_evt.transmit_power_level",
+            FT_INT8, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }
         }
     };