tools/mgmt-tester: Adds new test data with updated tx power
authorTedd Ho-Jeong An <hj.tedd.an@gmail.com>
Wed, 23 Dec 2020 00:26:33 +0000 (16:26 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:34 +0000 (19:08 +0530)
This patch adds new test data for the ext advertising test cases that
presets the advertising parameter and toggles the connectable flags.

When the adv instance is created, it updates the default tx power with
the value read from the controller. After toggling the connectable flag,
the host uses the tx_power stored in the adv list cache, which is the
value read from the controller, instead of the default tx power
value(127).

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/mgmt-tester.c

index 102dc52..bb9fb0b 100755 (executable)
@@ -7592,6 +7592,24 @@ static const struct generic_data add_ext_advertising_success_15 = {
        .expect_hci_len = sizeof(set_connectable_on_ext_adv_param),
 };
 
+static uint8_t preset_connectable_on_ext_adv_param[] = {
+       0x01,                                   /* Handle */
+       0x13, 0x00,                             /* Event type */
+       0x00, 0x08, 0x00,                       /* min_interval */
+       0x00, 0x08, 0x00,                       /* max_interval */
+       0x07,                                   /* channel_map */
+       0x00,                                   /* own_addr_type */
+       0x00,                                   /* peer_addr_type */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     /* peer_addr */
+       0x00,                                   /* filter_policy */
+       0x00,                                   /* Tx power */
+       0x01,                                   /* Primary PHY */
+       0x00,                                   /* primary adv max skip */
+       0x01,                                   /* Secondary PHY */
+       0x00,                                   /* adv sid*/
+       0x00,                                   /* Scan req notification */
+};
+
 static const struct generic_data add_ext_advertising_success_16 = {
        .send_opcode = MGMT_OP_SET_CONNECTABLE,
        .send_param = set_connectable_on_param,
@@ -7600,8 +7618,26 @@ static const struct generic_data add_ext_advertising_success_16 = {
        .expect_param = set_connectable_settings_param_3,
        .expect_len = sizeof(set_connectable_settings_param_3),
        .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
-       .expect_hci_param = set_connectable_on_ext_adv_param,
-       .expect_hci_len = sizeof(set_connectable_on_ext_adv_param),
+       .expect_hci_param = preset_connectable_on_ext_adv_param,
+       .expect_hci_len = sizeof(preset_connectable_on_ext_adv_param),
+};
+
+static uint8_t preset_connectable_off_ext_adv_param[] = {
+       0x01,                                   /* Handle */
+       0x10, 0x00,                             /* Event type */
+       0x00, 0x08, 0x00,                       /* min_interval */
+       0x00, 0x08, 0x00,                       /* max_interval */
+       0x07,                                   /* channel_map */
+       0x01,                                   /* own_addr_type */
+       0x00,                                   /* peer_addr_type */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     /* peer_addr */
+       0x00,                                   /* filter_policy */
+       0x00,                                   /* Tx power */
+       0x01,                                   /* Primary PHY */
+       0x00,                                   /* primary adv max skip */
+       0x01,                                   /* Secondary PHY */
+       0x00,                                   /* adv sid*/
+       0x00,                                   /* Scan req notification */
 };
 
 static const struct generic_data add_ext_advertising_success_17 = {
@@ -7612,8 +7648,8 @@ static const struct generic_data add_ext_advertising_success_17 = {
        .expect_param = set_le_settings_param_2,
        .expect_len = sizeof(set_le_settings_param_2),
        .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
-       .expect_hci_param = set_connectable_off_ext_adv_param,
-       .expect_hci_len = sizeof(set_connectable_off_ext_adv_param),
+       .expect_hci_param = preset_connectable_off_ext_adv_param,
+       .expect_hci_len = sizeof(preset_connectable_off_ext_adv_param),
 };
 
 static const struct generic_data add_ext_advertising_le_off = {
@@ -8240,6 +8276,24 @@ static void setup_add_advertising_1m(const void *test_data)
                                                NULL, NULL);
 }
 
+static uint8_t preset_connectable_on_ext_pdu_adv_param[] = {
+       0x01,                                   /* Handle */
+       0x01, 0x00,                             /* Event type */
+       0x00, 0x08, 0x00,                       /* min_interval */
+       0x00, 0x08, 0x00,                       /* max_interval */
+       0x07,                                   /* channel_map */
+       0x00,                                   /* own_addr_type */
+       0x00,                                   /* peer_addr_type */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     /* peer_addr */
+       0x00,                                   /* filter_policy */
+       0x00,                                   /* Tx power */
+       0x01,                                   /* Primary PHY */
+       0x00,                                   /* primary adv max skip */
+       0x01,                                   /* Secondary PHY */
+       0x00,                                   /* adv sid*/
+       0x00,                                   /* Scan req notification */
+};
+
 static const struct generic_data add_ext_advertising_conn_on_1m = {
        .send_opcode = MGMT_OP_SET_CONNECTABLE,
        .send_param = set_connectable_on_param,
@@ -8248,8 +8302,8 @@ static const struct generic_data add_ext_advertising_conn_on_1m = {
        .expect_param = set_connectable_settings_param_3,
        .expect_len = sizeof(set_connectable_settings_param_3),
        .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
-       .expect_hci_param = set_connectable_on_ext_pdu_adv_param,
-       .expect_hci_len = sizeof(set_connectable_on_ext_pdu_adv_param),
+       .expect_hci_param = preset_connectable_on_ext_pdu_adv_param,
+       .expect_hci_len = sizeof(preset_connectable_on_ext_pdu_adv_param),
 };
 
 static void setup_add_advertising_connectable_1m(const void *test_data)
@@ -8282,6 +8336,24 @@ static void setup_add_advertising_connectable_1m(const void *test_data)
                                                NULL, NULL);
 }
 
+static uint8_t preset_connectable_off_ext_1m_adv_param[] = {
+       0x01,                                   /* Handle */
+       0x00, 0x00,                             /* Event type */
+       0x00, 0x08, 0x00,                       /* min_interval */
+       0x00, 0x08, 0x00,                       /* max_interval */
+       0x07,                                   /* channel_map */
+       0x01,                                   /* own_addr_type */
+       0x00,                                   /* peer_addr_type */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     /* peer_addr */
+       0x00,                                   /* filter_policy */
+       0x00,                                   /* Tx power */
+       0x01,                                   /* Primary PHY */
+       0x00,                                   /* primary adv max skip */
+       0x01,                                   /* Secondary PHY */
+       0x00,                                   /* adv sid*/
+       0x00,                                   /* Scan req notification */
+};
+
 static const struct generic_data add_ext_advertising_conn_off_1m = {
        .send_opcode = MGMT_OP_SET_CONNECTABLE,
        .send_param = set_connectable_off_param,
@@ -8290,8 +8362,8 @@ static const struct generic_data add_ext_advertising_conn_off_1m = {
        .expect_param = set_le_settings_param_2,
        .expect_len = sizeof(set_le_settings_param_2),
        .expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS,
-       .expect_hci_param = set_connectable_off_ext_1m_adv_param,
-       .expect_hci_len = sizeof(set_connectable_off_ext_1m_adv_param),
+       .expect_hci_param = preset_connectable_off_ext_1m_adv_param,
+       .expect_hci_len = sizeof(preset_connectable_off_ext_1m_adv_param),
 };
 
 static const uint8_t get_phy_param[] = {