* [PATCH BlueZ] test: Add support for passing address type to btiotest
@ 2012-10-10 23:56 Vinicius Costa Gomes
2012-10-11 6:57 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Vinicius Costa Gomes @ 2012-10-10 23:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Vinicius Costa Gomes
---
test/btiotest.c | 51 +++++++++++++++++++++++++++++----------------------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/test/btiotest.c b/test/btiotest.c
index f090dd9..4cafcc3 100644
--- a/test/btiotest.c
+++ b/test/btiotest.c
@@ -254,9 +254,9 @@ static void confirm_cb(GIOChannel *io, gpointer user_data)
}
}
-static void l2cap_connect(const char *src, const char *dst, uint16_t psm,
- uint16_t cid, gint disconn,
- gint sec, gint prio)
+static void l2cap_connect(const char *src, const char *dst, uint8_t addr_type,
+ uint16_t psm, uint16_t cid, gint disconn,
+ gint sec, gint prio)
{
struct io_data *data;
GError *err = NULL;
@@ -267,25 +267,27 @@ static void l2cap_connect(const char *src, const char *dst, uint16_t psm,
if (src)
data->io = bt_io_connect(connect_cb, data,
- (GDestroyNotify) io_data_unref,
- &err,
- BT_IO_OPT_SOURCE, src,
- BT_IO_OPT_DEST, dst,
- BT_IO_OPT_PSM, psm,
- BT_IO_OPT_CID, cid,
- BT_IO_OPT_SEC_LEVEL, sec,
- BT_IO_OPT_PRIORITY, prio,
- BT_IO_OPT_INVALID);
+ (GDestroyNotify) io_data_unref,
+ &err,
+ BT_IO_OPT_SOURCE, src,
+ BT_IO_OPT_DEST, dst,
+ BT_IO_OPT_DEST_TYPE, addr_type,
+ BT_IO_OPT_PSM, psm,
+ BT_IO_OPT_CID, cid,
+ BT_IO_OPT_SEC_LEVEL, sec,
+ BT_IO_OPT_PRIORITY, prio,
+ BT_IO_OPT_INVALID);
else
data->io = bt_io_connect(connect_cb, data,
- (GDestroyNotify) io_data_unref,
- &err,
- BT_IO_OPT_DEST, dst,
- BT_IO_OPT_PSM, psm,
- BT_IO_OPT_CID, cid,
- BT_IO_OPT_SEC_LEVEL, sec,
- BT_IO_OPT_PRIORITY, prio,
- BT_IO_OPT_INVALID);
+ (GDestroyNotify) io_data_unref,
+ &err,
+ BT_IO_OPT_DEST, dst,
+ BT_IO_OPT_DEST_TYPE, addr_type,
+ BT_IO_OPT_PSM, psm,
+ BT_IO_OPT_CID, cid,
+ BT_IO_OPT_SEC_LEVEL, sec,
+ BT_IO_OPT_PRIORITY, prio,
+ BT_IO_OPT_INVALID);
if (!data->io) {
printf("Connecting to %s failed: %s\n", dst, err->message);
@@ -501,6 +503,7 @@ static gint opt_sec = 0;
static gboolean opt_master = FALSE;
static gint opt_priority = 0;
static gint opt_cid = 0;
+static guint8 opt_addr_type = 0;
static GMainLoop *main_loop;
@@ -511,6 +514,9 @@ static GOptionEntry options[] = {
"L2CAP PSM" },
{ "cid", 'j', 0, G_OPTION_ARG_INT, &opt_cid,
"L2CAP CID" },
+ { "addr-type", 't', 0, G_OPTION_ARG_INT, &opt_addr_type,
+ "Address type "
+ "(0 BR/EDR 1 LE Public 2 LE Random" },
{ "sco", 's', 0, G_OPTION_ARG_NONE, &opt_sco,
"Use SCO" },
{ "defer", 'd', 0, G_OPTION_ARG_NONE, &opt_defer,
@@ -559,8 +565,9 @@ int main(int argc, char *argv[])
if (opt_psm || opt_cid) {
if (argc > 1)
- l2cap_connect(opt_dev, argv[1], opt_psm, opt_cid,
- opt_disconn, opt_sec, opt_priority);
+ l2cap_connect(opt_dev, argv[1], opt_addr_type,
+ opt_psm, opt_cid, opt_disconn,
+ opt_sec, opt_priority);
else
l2cap_listen(opt_dev, opt_psm, opt_defer, opt_reject,
opt_disconn, opt_accept, opt_sec,
--
1.7.12.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-11 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10 23:56 [PATCH BlueZ] test: Add support for passing address type to btiotest Vinicius Costa Gomes
2012-10-11 6:57 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).