diff --git a/android/avdtptest.c b/android/avdtptest.c
index adbf7af..c8f7340 100644
--- a/android/avdtptest.c
+++ b/android/avdtptest.c
static GMainLoop *mainloop = NULL;
static int dev_role = AVDTP_SEP_TYPE_SOURCE;
-static bool initiator = false;
+static bool preconf = false;
static struct avdtp *avdtp = NULL;
struct avdtp_stream *avdtp_stream = NULL;
struct avdtp_local_sep *local_sep = NULL;
{
printf("%s\n", __func__);
- if (initiator)
+ if (preconf)
avdtp_open(avdtp, avdtp_stream);
}
}
}
-static gboolean idle_timeout(gpointer user_data)
-{
- int err;
-
- idle_id = 0;
-
- err = avdtp_discover(avdtp, discover_cb, NULL);
- if (err < 0) {
- printf("avdtp_discover failed: %s", strerror(-err));
- g_main_loop_quit(mainloop);
- }
-
- return FALSE;
-}
-
static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
{
uint16_t imtu, omtu;
g_io_channel_set_close_on_unref(chan, FALSE);
- if (initiator)
- avdtp_start(avdtp, avdtp_stream);
-
return;
}
avdtp_add_disconnect_cb(avdtp, disconnect_cb, NULL);
- if (initiator) {
+ if (preconf) {
int ret;
ret = avdtp_discover(avdtp, discover_cb, NULL);
printf("avdtp_discover failed: %s", strerror(-ret));
g_main_loop_quit(mainloop);
}
- } else {
- idle_id = g_timeout_add_seconds(1, idle_timeout, NULL);
}
}
printf("%s\n", __func__);
- if (!initiator)
- return;
-
do_connect(&gerr);
if (gerr) {
printf("connect failed: %s\n", gerr->message);
"\tavdtptest [options]\n");
printf("options:\n"
"\t-d <device_role> SRC (source) or SINK (sink)\n"
- "\t-s <stream_role> INT (initiator) or ACP (acceptor)\n"
"\t-i <hcidev> HCI adapter\n"
"\t-c <bdaddr> connect\n"
"\t-l listen\n"
"\t-r reject commands\n"
- "\t-f fragment\n");
+ "\t-f fragment\n"
+ "-t-p configure stream\n");
}
static struct option main_options[] = {
{ "help", 0, 0, 'h' },
{ "device_role", 1, 0, 'd' },
- { "stream_role", 1, 0, 's' },
{ "adapter", 1, 0, 'i' },
{ "connect", 1, 0, 'c' },
{ "listen", 0, 0, 'l' },
{ "reject", 0, 0, 'r' },
{ "fragment", 0, 0, 'f' },
+ { "preconf", 0, 0, 'p' },
{ 0, 0, 0, 0 }
};
exit(1);
}
- while ((opt = getopt_long(argc, argv, "d:hi:s:c:lrf",
+ while ((opt = getopt_long(argc, argv, "d:hi:c:lrfp",
main_options, NULL)) != EOF) {
switch (opt) {
case 'i':
exit(0);
}
break;
- case 's':
- if (!strncasecmp(optarg, "INT", sizeof("INT"))) {
- initiator = true;
- } else if (!strncasecmp(optarg, "ACP", sizeof("ACP"))) {
- initiator = false;
- } else {
- usage();
- exit(0);
- }
- break;
case 'c':
if (str2ba(optarg, &dst) < 0) {
usage();
case 'f':
fragment = true;
break;
+ case 'p':
+ preconf = true;
+ break;
case 'h':
default:
usage();