A slave device wont re-connect
Hello everyone,
I have two devices that can act as Bluetooth master (A and B) and a single device that can act only as a Slave (C). The slave can communicate only using the RFCOMM profile. The devices A and B are actually Linux boxes with D-Link DBT-122 BT USB dongles. The device C is a sensor device that I have no control over (I can just switch it on and off).
I've been trying to implement a software on the devices A and B which would do the following:
1) make periodic BT scans
2) if it finds the device C in these scans, it would create an RFCOMM connection to the device C and simply read the data that it is sending
3) when the device C moves out of the range say device A to the coverage area of device B the device B should then discover device C and create the connection (roaming)
My application is threaded where thread 1 periodically creates a BT socket, mekes a BT scan and closes the socket. Thread number 2 is created when the first thread discovers the device C. This thread does the following:
1) create a BT socket
2) binds the socket to a local BT address
3) connects to the discovered device C
4) read data from socket
5) close socket
This all goes just fine. If the device C first connects to device A and then moves to lose connection with it, the device B can discover it and the connection succeeds. The problem comes when the device C loses the connection to B. Even though the device A can discover C again, the connect() _always_ fails.
I have even tried to close the connection using RFCOMMRELEASEDEV ioctl.
My question is that have I missed something that I should do in order to shutdown the BT connection properly so that the device C would be ready for a new connection from another device?
Best regards,
Signature · 11 lines
Mr. Mikko Saarnivala ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Bluez-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-users
Marcel Holtmann
maintainerHi Mikko,
Quoted 33 lines
I have two devices that can act as Bluetooth master (A and B) and a single device that can act only as a Slave (C). The slave can communicate only using the RFCOMM profile. The devices A and B are actually Linux boxes with D-Link DBT-122 BT USB dongles. The device C is a sensor device that I have no control over (I can just switch it on and off).
I've been trying to implement a software on the devices A and B which would do the following:
1) make periodic BT scans
2) if it finds the device C in these scans, it would create an RFCOMM connection to the device C and simply read the data that it is sending
3) when the device C moves out of the range say device A to the coverage area of device B the device B should then discover device C and create the connection (roaming)My application is threaded where thread 1 periodically creates a BT socket, mekes a BT scan and closes the socket. Thread number 2 is created when the first thread discovers the device C. This thread does the following:
1) create a BT socket
2) binds the socket to a local BT address
3) connects to the discovered device C
4) read data from socket
5) close socketThis all goes just fine. If the device C first connects to device A and then moves to lose connection with it, the device B can discover it and the connection succeeds. The problem comes when the device C loses the connection to B. Even though the device A can discover C again, the
connect()_always_ fails.
Quoted 5 lines
I have even tried to close the connection using RFCOMMRELEASEDEV ioctl.
My question is that have I missed something that I should do in order to shutdown the BT connection properly so that the device C would be ready for a new connection from another device?
first of all threading is not buying you anything. You run an inquiry and page another device at the same time. That is a chip limitation and that is true for all chips. Period.
Second of all, I need to see the source, hciconfig -a settings and a hcidump -X -V for that situation.
Regards
Marcel
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-users mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users