diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-11-14 13:56:53 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-12-04 22:22:07 +0100 |
commit | 36803c249d65fe2d93d0833176cc178b467a56cd (patch) | |
tree | 7a3792de2a3b77225bd775b28653abcaaccee5a8 /tools/obex-client-tool.c | |
parent | c5cab062fc6ef2ccdbaf39f8583242a6a398a282 (diff) | |
download | bluez-36803c249d65fe2d93d0833176cc178b467a56cd.tar.gz |
gobex: tools: Fix using BT_IO_TYPE in test-client and test-server
Diffstat (limited to 'tools/obex-client-tool.c')
-rw-r--r-- | tools/obex-client-tool.c | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/tools/obex-client-tool.c b/tools/obex-client-tool.c index 81a2be07d..8488a20a7 100644 --- a/tools/obex-client-tool.c +++ b/tools/obex-client-tool.c @@ -344,69 +344,66 @@ static void conn_callback(GIOChannel *io, GError *err, gpointer user_data) transport_connect(io, transport); } -static GIOChannel *bluetooth_connect(GObexTransportType transport) +static GIOChannel *l2cap_connect(GObexTransportType transport, GError **err) { - GIOChannel *io; - GError *err = NULL; - BtIOType type; - BtIOOption option; - - if (option_dest == NULL || option_channel < 0) - return NULL; - - if (option_channel > 31) { - type = option_packet ? BT_IO_L2CAP : BT_IO_L2ERTM; - option = BT_IO_OPT_PSM; - } else { - type = BT_IO_RFCOMM; - option = BT_IO_OPT_CHANNEL; - } - - if (option_source) { - if (type == BT_IO_L2CAP) { - io = bt_io_connect(type, conn_callback, + if (option_source) + return bt_io_connect(conn_callback, GUINT_TO_POINTER(transport), - NULL, &err, + NULL, err, BT_IO_OPT_SOURCE, option_source, BT_IO_OPT_DEST, option_dest, - option, option_channel, + BT_IO_OPT_PSM, option_channel, BT_IO_OPT_MODE, BT_IO_MODE_ERTM, BT_IO_OPT_OMTU, option_omtu, BT_IO_OPT_IMTU, option_imtu, BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW, BT_IO_OPT_INVALID); - } else { - io = bt_io_connect(type, conn_callback, + + return bt_io_connect(conn_callback, GUINT_TO_POINTER(transport), - NULL, &err, - BT_IO_OPT_SOURCE, option_source, + NULL, err, BT_IO_OPT_DEST, option_dest, - option, option_channel, + BT_IO_OPT_PSM, option_channel, + BT_IO_OPT_MODE, BT_IO_MODE_ERTM, + BT_IO_OPT_OMTU, option_omtu, + BT_IO_OPT_IMTU, option_imtu, BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW, BT_IO_OPT_INVALID); - } - } else { - if (type == BT_IO_L2CAP) { - io = bt_io_connect(type, conn_callback, +} + +static GIOChannel *rfcomm_connect(GObexTransportType transport, GError **err) +{ + if (option_source) + return bt_io_connect(conn_callback, GUINT_TO_POINTER(transport), - NULL, &err, + NULL, err, + BT_IO_OPT_SOURCE, option_source, BT_IO_OPT_DEST, option_dest, - option, option_channel, - BT_IO_OPT_MODE, BT_IO_MODE_ERTM, - BT_IO_OPT_OMTU, option_omtu, - BT_IO_OPT_IMTU, option_imtu, + BT_IO_OPT_CHANNEL, option_channel, BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW, BT_IO_OPT_INVALID); - } else { - io = bt_io_connect(type, conn_callback, + + return bt_io_connect(conn_callback, GUINT_TO_POINTER(transport), - NULL, &err, + NULL, err, BT_IO_OPT_DEST, option_dest, - option, option_channel, + BT_IO_OPT_CHANNEL, option_channel, BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW, BT_IO_OPT_INVALID); - } - } +} + +static GIOChannel *bluetooth_connect(GObexTransportType transport) +{ + GIOChannel *io; + GError *err = NULL; + + if (option_dest == NULL || option_channel < 0) + return NULL; + + if (option_channel > 31) + io = l2cap_connect(transport, &err); + else + io = rfcomm_connect(transport, &err); if (io != NULL) return io; |