diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 92cdc43..46fe8f0 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
uint16_t send_opcode;
const void *send_param;
uint16_t send_len;
+ const void * (*send_func)(uint16_t *len);
uint8_t expect_status;
const void *expect_param;
uint16_t expect_len;
+ const void * (*expect_func)(uint16_t *len);
uint32_t expect_settings_set;
uint32_t expect_settings_unset;
uint16_t expect_alt_ev;
{
struct test_data *data = tester_get_data();
const struct generic_data *test = data->test_data;
+ const void *send_param = test->send_param;
+ uint16_t send_len = test->send_len;
if (test->setup_expect_hci_command) {
tester_print("Registering HCI command callback (setup)");
test->setup_expect_hci_command,
setup_command_hci_callback,
NULL);
+
+ if (test->send_func)
+ send_param = test->send_func(&send_len);
+
mgmt_send(data->mgmt, MGMT_OP_START_DISCOVERY, data->mgmt_index,
- test->send_len, test->send_param,
- NULL, NULL, NULL);
+ send_len, send_param, NULL, NULL, NULL);
} else {
unsigned char disc_param[] = { 0x07 };
{
struct test_data *data = tester_get_data();
const struct generic_data *test = data->test_data;
+ const void *expect_param = test->expect_param;
+ uint16_t expect_len = test->expect_len;
tester_print("Command 0x%04x finished with status 0x%02x",
test->send_opcode, status);
return;
}
- if (length != test->expect_len) {
+ if (test->expect_func)
+ expect_param = test->expect_func(&expect_len);
+
+ if (length != expect_len) {
tester_test_failed();
return;
}
- if (test->expect_param && test->expect_len > 0 &&
- memcmp(param, test->expect_param, length)) {
+ if (expect_param && expect_len > 0 &&
+ memcmp(param, expect_param, length)) {
tester_test_failed();
return;
}
{
struct test_data *data = tester_get_data();
const struct generic_data *test = data->test_data;
+ const void *send_param = test->send_param;
+ uint16_t send_len = test->send_len;
unsigned int id;
uint16_t index;
tester_print("Sending command 0x%04x", test->send_opcode);
- mgmt_send(data->mgmt, test->send_opcode, index,
- test->send_len, test->send_param,
+ if (test->send_func)
+ send_param = test->send_func(&send_len);
+
+ mgmt_send(data->mgmt, test->send_opcode, index, send_len, send_param,
command_generic_callback, NULL, NULL);
test_add_condition(data);
}