From 39c29f8cac2de8e685e88e751421fdc3d5984baf Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 24 Jan 2013 15:31:45 +0200 Subject: [PATCH] tools: Add multiple UUID-128 test case to mgmt-tester --- tools/mgmt-tester.c | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 88c73d6c1..857a67be0 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -935,6 +935,10 @@ static const char add_uuid128_param_1[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00 }; +static const char add_uuid128_param_2[] = { + 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, + 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00, + 0x00 }; static const char write_eir_uuid128_hci[] = { 0x00, 0x02, 0x0a, 0x00, 0x11, 0x07, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, @@ -966,6 +970,37 @@ static const char write_eir_uuid128_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_uuid128_multi_hci[] = { 0x00, + 0x02, 0x0a, 0x00, 0x21, 0x07, 0x00, 0x11, 0x22, + 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, + 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0xff, 0xee, 0xdd, + 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55, + 0x44, 0x33, 0x22, 0x11, 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, @@ -1027,6 +1062,18 @@ static const struct generic_data add_uuid128_test_1 = { .expect_hci_len = sizeof(write_eir_uuid128_hci), }; +static const struct generic_data add_uuid128_multi_test_1 = { + .send_opcode = MGMT_OP_ADD_UUID, + .send_param = add_uuid128_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_uuid128_multi_hci, + .expect_hci_len = sizeof(write_eir_uuid128_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 }; @@ -1377,6 +1424,25 @@ static void setup_multi_uuid32(const void *test_data) setup_powered_callback, NULL, NULL); } +static void setup_multi_uuid128(const void *test_data) +{ + struct test_data *data = tester_get_data(); + unsigned char param[] = { 0x01 }; + + tester_print("Powering on controller (with 128-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_uuid128_param_1), add_uuid128_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(); @@ -1802,6 +1868,8 @@ int main(int argc, char *argv[]) setup_multi_uuid32, test_command_generic); test_bredr("Add UUID - UUID-128 1", &add_uuid128_test_1, setup_ssp, test_command_generic); + test_bredr("Add UUID - UUID-128 multiple 1", &add_uuid128_multi_test_1, + setup_multi_uuid128, test_command_generic); test_bredr("Load Link Keys - Empty List Success 1", &load_link_keys_success_test_1, NULL, -- 2.47.3