From d6d3d26bdadb6202b5993a2685137a9f21ba55de Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 27 May 2014 11:32:18 +0300 Subject: [PATCH] smp-tester: Allow multiple sending without expecting data Sometimes we need to send multiple PDUs without waiting for any specific PDU in between. --- tools/smp-tester.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tools/smp-tester.c b/tools/smp-tester.c index b1d25a36f..45c4d8bed 100644 --- a/tools/smp-tester.c +++ b/tools/smp-tester.c @@ -640,20 +640,23 @@ static void smp_server(const void *data, uint16_t len, void *user_data) } next: - if (smp->req_count == test_data->counter) { - test_condition_complete(test_data); - return; + while (true) { + if (smp->req_count == test_data->counter) { + test_condition_complete(test_data); + break; + } + + req = &smp->req[test_data->counter]; + + pdu = get_pdu(req->send); + bthost_send_cid(bthost, test_data->handle, SMP_CID, pdu, + req->send_len); + if (req->expect) + break; + else + test_data->counter++; } - req = &smp->req[test_data->counter]; - - pdu = get_pdu(req->send); - bthost_send_cid(bthost, test_data->handle, SMP_CID, pdu, - req->send_len); - - if (!req->expect) - test_condition_complete(test_data); - return; failed: -- 2.47.3