Problems with bt_io_listen
Hi all,
We are developing an implementation of HDP and MCAP for bluez. We are triying to perform many connections between two devices but when we make the second connection it is not created correctly.
We are using a defer connection (we passed a confirm callback to the bt_io_listen function) and we think that we are missing something but we can't find what. If we used the connection callback (not defer) all the connections are done successfully.
We are listening with the following code:
static void confirm_cb(GIOChannel *chan, gpointer user_data)
{
...
node->chan = g_io_channel_ref(chan);
...
/* All is ok */
return;
drop:
/* Connection refused */
g_io_channel_shutdown(chan, TRUE, NULL);
}....
chan = bt_io_listen(BT_IO_L2CAP, NULL, confirm_cb, NULL,
NULL, &gerr, BT_IO_OPT_SOURCE_BDADDR, &src, BT_IO_OPT_PSM, 0x1001, BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM, BT_IO_OPT_INVALID);
...
Any ideas?
Regards and thank.
Jose.
Luiz Augusto von Dentz
maintainerHi,
Quoted 13 lines · José Antonio Santos Cadenas
Hi all,
We are developing an implementation of HDP and MCAP for bluez. We are triying to perform many connections between two devices but when we make the second connection it is not created correctly.
We are using a defer connection (we passed a confirm callback to the
bt_io_listenfunction) and we think that we are missing something but we can't find what. If we used the connection callback (not defer) all the connections are done successfully.We are listening with the following code:
Quoted 11 lines
static void
confirm_cb(GIOChannel *chan, gpointer user_data){
...
node->chan =g_io_channel_ref(chan);
...
/* All is ok */
return;
drop:
/* Connection refused */g_io_channel_shutdown(chan, TRUE, NULL);
}
Im not really sure what is the problem but maybe it is the missing bt_io_accept, but of course it can be that you just hide it in those
...
Quoted 8 lines
....
chan = bt_io_listen(BT_IO_L2CAP, NULL,confirm_cb, NULL, NULL, &gerr,BT_IO_OPT_SOURCE_BDADDR, &src,BT_IO_OPT_PSM,0x1001,BT_IO_OPT_SEC_LEVEL,BT_IO_SEC_MEDIUM,BT_IO_OPT_INVALID);
...
The listen part at least seems ok.
Signature · 2 lines
Luiz Augusto von Dentz Computer Engineer
Hello,
Quoted 29 lines
Hi,
Quoted 14 lines · José Antonio Santos Cadenas
Hi all,
We are developing an implementation of HDP and MCAP for bluez. We are triying to perform many connections between two devices but when we make the second connection it is not created correctly.
We are using a defer connection (we passed a confirm callback to the
bt_io_listenfunction) and we think that we are missing something but we can't find what. If we used the connection callback (not defer) all the connections are done successfully.We are listening with the following code:
static void
confirm_cb(GIOChannel *chan, gpointer user_data)Quoted 10 lines
{ ... node->chan = g_io_channel_ref(chan); ... /* All is ok */ return; drop: /* Connection refused */ g_io_channel_shutdown(chan, TRUE, NULL); }
Quoted 3 lines
Im not really sure what is the problem but maybe it is the missing
bt_io_accept, but of course it can be that you just hide it in those
...
You're rigth, we forgot the bt_io_accept call.
Quoted 10 lines
Quoted 9 lines
....
chan = bt_io_listen(BT_IO_L2CAP, NULL,confirm_cb, NULL,NULL, &gerr, BT_IO_OPT_SOURCE_BDADDR, &src, BT_IO_OPT_PSM, 0x1001, BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM, BT_IO_OPT_INVALID);...
Quoted 3 lines
The listen part at least seems ok.
Thanks.