From d182227658745cb2ddf1be720f34fdd0c3e5cb88 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 24 Jan 2013 14:23:37 +0200 Subject: [PATCH] tools: Add Multiple 32-bit UUID test case to mgmt-tester --- tools/mgmt-tester.c | 74 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 84aa49df6..26d2dd453 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -844,10 +844,14 @@ static const char write_eir_multi_uuid16_hci[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const char add_uuid32_param[] = { +static const char add_uuid32_param_1[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x78, 0x56, 0x34, 0x12, 0x00 }; +static const char add_uuid32_param_2[] = { + 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x00, 0x00, 0xef, 0xcd, 0xbc, 0x9a, + 0x00 }; static const char write_eir_uuid32_hci[] = { 0x00, 0x02, 0x0a, 0x00, 0x05, 0x05, 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -879,6 +883,37 @@ static const char write_eir_uuid32_hci[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const char write_eir_uuid32_multi_hci[] = { 0x00, + 0x02, 0x0a, 0x00, 0x09, 0x05, 0x78, 0x56, 0x34, + 0x12, 0xef, 0xcd, 0xbc, 0x9a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const struct generic_data add_uuid16_test_1 = { .send_opcode = MGMT_OP_ADD_UUID, @@ -906,8 +941,8 @@ static const struct generic_data add_multi_uuid16_test_1 = { static const struct generic_data add_uuid32_test_1 = { .send_opcode = MGMT_OP_ADD_UUID, - .send_param = add_uuid32_param, - .send_len = sizeof(add_uuid32_param), + .send_param = add_uuid32_param_1, + .send_len = sizeof(add_uuid32_param_1), .expect_status = MGMT_STATUS_SUCCESS, .expect_param = set_dev_class_zero_rsp, .expect_len = sizeof(set_dev_class_zero_rsp), @@ -916,6 +951,18 @@ static const struct generic_data add_uuid32_test_1 = { .expect_hci_len = sizeof(write_eir_uuid32_hci), }; +static const struct generic_data add_uuid32_multi_test_1 = { + .send_opcode = MGMT_OP_ADD_UUID, + .send_param = add_uuid32_param_2, + .send_len = sizeof(add_uuid32_param_2), + .expect_status = MGMT_STATUS_SUCCESS, + .expect_param = set_dev_class_zero_rsp, + .expect_len = sizeof(set_dev_class_zero_rsp), + .expect_hci_command = BT_HCI_CMD_WRITE_EXT_INQUIRY_RESPONSE, + .expect_hci_param = write_eir_uuid32_multi_hci, + .expect_hci_len = sizeof(write_eir_uuid32_multi_hci), +}; + static const char load_link_keys_valid_param_1[] = { 0x00, 0x00, 0x00 }; static const char load_link_keys_valid_param_2[] = { 0x01, 0x00, 0x00 }; static const char load_link_keys_invalid_param_1[] = { 0x02, 0x00, 0x00 }; @@ -1241,6 +1288,25 @@ static void setup_ssp(const void *test_data) setup_powered_callback, NULL, NULL); } +static void setup_multi_uuid32(const void *test_data) +{ + struct test_data *data = tester_get_data(); + unsigned char param[] = { 0x01 }; + + tester_print("Powering on controller (with 32-bit UUID)"); + + mgmt_send(data->mgmt, MGMT_OP_SET_SSP, data->mgmt_index, + sizeof(param), param, NULL, NULL, NULL); + + mgmt_send(data->mgmt, MGMT_OP_ADD_UUID, data->mgmt_index, + sizeof(add_uuid32_param_1), add_uuid32_param_1, + NULL, NULL, NULL); + + mgmt_send(data->mgmt, MGMT_OP_SET_POWERED, data->mgmt_index, + sizeof(param), param, + setup_powered_callback, NULL, NULL); +} + static void setup_multi_uuid16(const void *test_data) { struct test_data *data = tester_get_data(); @@ -1656,6 +1722,8 @@ int main(int argc, char *argv[]) setup_multi_uuid16, test_command_generic); test_bredr("Add UUID - UUID-32 1", &add_uuid32_test_1, setup_ssp, test_command_generic); + test_bredr("Add UUID - UUID-32 multiple 1", &add_uuid32_multi_test_1, + setup_multi_uuid32, test_command_generic); test_bredr("Load Link Keys - Empty List Success 1", &load_link_keys_success_test_1, NULL, -- 2.47.3