From 86a8cb503758385ed4ce1dfde2ed578a565373bb Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 4 Sep 2009 00:48:54 +0300 Subject: Add support for waiting before exiting to avtest --- test/avtest.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/avtest.c b/test/avtest.c index a725add9..33daf42e 100644 --- a/test/avtest.c +++ b/test/avtest.c @@ -724,6 +724,7 @@ static void usage() "\t--reject Reject command\n" "\t--send Send command\n" "\t--preconf Configure stream before actual command\n" + "\t--wait Wait N seconds before exiting\n" "\t--fragment Use minimum MTU and fragmented messages\n" "\t--invalid Send invalid command\n"); } @@ -737,6 +738,7 @@ static struct option main_options[] = { { "preconf", 0, 0, 'c' }, { "fragment", 0, 0, 'F' }, { "avctp", 0, 0, 'C' }, + { "wait", 1, 0, 'w' }, { 0, 0, 0, 0 } }; @@ -775,12 +777,12 @@ int main(int argc, char *argv[]) unsigned char cmd = 0x00; bdaddr_t src, dst; int opt, mode = MODE_NONE, sk, invalid = 0, preconf = 0, fragment = 0; - int avctp = 0; + int avctp = 0, wait_before_exit = 0; bacpy(&src, BDADDR_ANY); bacpy(&dst, BDADDR_ANY); - while ((opt = getopt_long(argc, argv, "+i:r:s:f:hcFC", + while ((opt = getopt_long(argc, argv, "+i:r:s:f:hcFCw:", main_options, NULL)) != EOF) { switch (opt) { case 'i': @@ -816,6 +818,10 @@ int main(int argc, char *argv[]) avctp = 1; break; + case 'w': + wait_before_exit = atoi(optarg); + break; + case 'h': default: usage(); @@ -846,6 +852,10 @@ int main(int argc, char *argv[]) process_avctp(sk, cmd); } else do_avdtp_send(sk, &src, &dst, cmd, invalid, preconf); + if (wait_before_exit) { + printf("Waiting %d seconds before exiting\n", wait_before_exit); + sleep(wait_before_exit); + } if (media_sock >= 0) close(media_sock); close(sk); -- cgit v1.2.3