From fff442f245be5630c003e3b69501ca0f405bd110 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 17 Jan 2013 13:58:21 +0200 Subject: [PATCH] tools: Add mgmt test case for multiple UUID-16 values --- tools/mgmt-tester.c | 83 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 76 insertions(+), 7 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index bcaad03f5..58f559bed 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -791,10 +791,14 @@ static const struct generic_data set_dev_class_invalid_param_test_1 = { .expect_status = MGMT_STATUS_INVALID_PARAMS, }; -static const char add_uuid16_param[] = { +static const char add_spp_uuid_param[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00 }; +static const char add_dun_uuid_param[] = { + 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x00, 0x00, 0x03, 0x11, 0x00, 0x00, + 0x00 }; static const char write_eir_uuid16_hci[] = { 0x00, 0x03, 0x03, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -826,6 +830,37 @@ static const char write_eir_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 write_eir_multi_uuid16_hci[] = { 0x00, + 0x05, 0x03, 0x03, 0x11, 0x01, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 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[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x78, 0x56, 0x34, 0x12, @@ -862,10 +897,10 @@ static const char write_eir_uuid32_hci[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const struct generic_data add_uuid16_param_test_1 = { +static const struct generic_data add_uuid16_test_1 = { .send_opcode = MGMT_OP_ADD_UUID, - .send_param = add_uuid16_param, - .send_len = sizeof(add_uuid16_param), + .send_param = add_spp_uuid_param, + .send_len = sizeof(add_spp_uuid_param), .expect_status = MGMT_STATUS_SUCCESS, .expect_param = set_dev_class_zero_rsp, .expect_len = sizeof(set_dev_class_zero_rsp), @@ -874,7 +909,19 @@ static const struct generic_data add_uuid16_param_test_1 = { .expect_hci_len = sizeof(write_eir_uuid16_hci), }; -static const struct generic_data add_uuid32_param_test_1 = { +static const struct generic_data add_multi_uuid16_test_1 = { + .send_opcode = MGMT_OP_ADD_UUID, + .send_param = add_dun_uuid_param, + .send_len = sizeof(add_dun_uuid_param), + .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_multi_uuid16_hci, + .expect_hci_len = sizeof(write_eir_multi_uuid16_hci), +}; + +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), @@ -968,6 +1015,25 @@ static void setup_ssp(const void *test_data) setup_powered_callback, NULL, NULL); } +static void setup_multi_uuid16(const void *test_data) +{ + struct test_data *data = tester_get_data(); + unsigned char param[] = { 0x01 }; + + tester_print("Powering on controller (with SPP 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_spp_uuid_param), add_spp_uuid_param, + 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_powered(const void *test_data) { struct test_data *data = tester_get_data(); @@ -1358,9 +1424,12 @@ int main(int argc, char *argv[]) &set_dev_class_invalid_param_test_1, NULL, test_command_generic); - test_bredr("Add UUID - UUID-16 1", &add_uuid16_param_test_1, + test_bredr("Add UUID - UUID-16 1", &add_uuid16_test_1, setup_ssp, test_command_generic); - test_bredr_timeout("Add UUID - UUID-32 1", &add_uuid32_param_test_1, + test_bredr_timeout("Add UUID - UUID-16 multiple 1", + &add_multi_uuid16_test_1, + setup_multi_uuid16, test_command_generic, 1); + test_bredr_timeout("Add UUID - UUID-32 1", &add_uuid32_test_1, setup_ssp, test_command_generic, 1); return tester_run(); -- 2.47.3