From 3b856f33d76ca9aa83973b3fea31fadecd55d2ca Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 11 Jan 2013 15:10:30 +0200 Subject: [PATCH] tools: Add HCI command monitoring to discoverable on/off tests --- tools/mgmt-tester.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 84e3198a5..6fb22eec2 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -502,9 +502,12 @@ static const uint8_t set_discoverable_invalid_param[] = { 0x02, 0x00, 0x00 }; static const uint8_t set_discoverable_off_param[] = { 0x00, 0x00, 0x00 }; static const uint8_t set_discoverable_offtimeout_param[] = { 0x00, 0x01, 0x00 }; static const uint8_t set_discoverable_garbage_param[] = { 0x01, 0x00, 0x00, 0x00 }; -static const uint8_t set_discoverable_on_settings_param[] = { 0x8b, 0x00, 0x00, 0x00 }; +static const uint8_t set_discoverable_on_settings_param_1[] = { 0x8a, 0x00, 0x00, 0x00 }; +static const uint8_t set_discoverable_on_settings_param_2[] = { 0x8b, 0x00, 0x00, 0x00 }; static const uint8_t set_discoverable_off_settings_param_1[] = { 0x82, 0x00, 0x00, 0x00 }; static const uint8_t set_discoverable_off_settings_param_2[] = { 0x83, 0x00, 0x00, 0x00 }; +static const uint8_t set_discoverable_on_scan_enable_param[] = { 0x03 }; +static const uint8_t set_discoverable_off_scan_enable_param[] = { 0x02 }; static const struct generic_data set_discoverable_on_invalid_param_test_1 = { .send_opcode = MGMT_OP_SET_DISCOVERABLE, @@ -560,16 +563,29 @@ static const struct generic_data set_discoverable_on_rejected_test_3 = { .expect_status = MGMT_STATUS_REJECTED, }; -static const struct generic_data set_discoverable_on_success_test = { +static const struct generic_data set_discoverable_on_success_test_1 = { .send_opcode = MGMT_OP_SET_DISCOVERABLE, .send_param = set_discoverable_on_param, .send_len = sizeof(set_discoverable_on_param), .expect_status = MGMT_STATUS_SUCCESS, - .expect_param = set_discoverable_on_settings_param, - .expect_len = sizeof(set_discoverable_on_settings_param), + .expect_param = set_discoverable_on_settings_param_1, + .expect_len = sizeof(set_discoverable_on_settings_param_1), .expect_settings_set = MGMT_SETTING_DISCOVERABLE, }; +static const struct generic_data set_discoverable_on_success_test_2 = { + .send_opcode = MGMT_OP_SET_DISCOVERABLE, + .send_param = set_discoverable_on_param, + .send_len = sizeof(set_discoverable_on_param), + .expect_status = MGMT_STATUS_SUCCESS, + .expect_param = set_discoverable_on_settings_param_2, + .expect_len = sizeof(set_discoverable_on_settings_param_2), + .expect_settings_set = MGMT_SETTING_DISCOVERABLE, + .expect_hci_command = BT_HCI_CMD_WRITE_SCAN_ENABLE, + .expect_hci_param = set_discoverable_on_scan_enable_param, + .expect_hci_len = sizeof(set_discoverable_on_scan_enable_param), +}; + static const struct generic_data set_discoverable_off_success_test_1 = { .send_opcode = MGMT_OP_SET_DISCOVERABLE, .send_param = set_discoverable_off_param, @@ -586,6 +602,9 @@ static const struct generic_data set_discoverable_off_success_test_2 = { .expect_status = MGMT_STATUS_SUCCESS, .expect_param = set_discoverable_off_settings_param_2, .expect_len = sizeof(set_discoverable_off_settings_param_2), + .expect_hci_command = BT_HCI_CMD_WRITE_SCAN_ENABLE, + .expect_hci_param = set_discoverable_off_scan_enable_param, + .expect_hci_len = sizeof(set_discoverable_off_scan_enable_param), }; static const char set_link_sec_on_param[] = { 0x01 }; @@ -974,10 +993,10 @@ int main(int argc, char *argv[]) &set_discoverable_on_rejected_test_3, setup_powered, test_command_generic); test_bredr("Set discoverable on - Success 1", - &set_discoverable_on_success_test, + &set_discoverable_on_success_test_1, setup_connectable, test_command_generic); test_bredr("Set discoverable on - Success 2", - &set_discoverable_on_success_test, + &set_discoverable_on_success_test_2, setup_powered_connectable, test_command_generic); test_bredr("Set discoverable off - Success 1", &set_discoverable_off_success_test_1, -- 2.47.3