I am trying to send a continuous stream of data from a raspberry pi to another pi through bluetooth using java. For the same, I am using the bluecove 2.1.0. I have created a bluetooth server in the Raspberry Pi which is continuously sending the data and I have a bluetooth client in the other Raspberry Pi which is trying to receive the data. For this I am trying to use bluetooth serial port profile using RFCOMM. As soon both the raspberry pis are paired, the bluetooth server is sending the data through the InputStream. Now, the problem what I am facing is, during the continuous sending of data from the server, the Raspberry Pi which is supposed to receive it, is not at all able to receive anything.
I believe this is due to the blocking InputStream which is returned by the pairing of the both devices. I couldn't find any solution to implement the same using non-blocking streams because bluecove Library only has API for blocking streams. This is the reason that the continuous delivery of the messages fails. I wanted to implement some functionality to simultaneously read and write messages from an InputStream. Could anyone help me please?
The Bluetooth Server Code: https://bitbucket.org/i-am-it/industry_4.0/src/129d900bbc265d47d4c231f1384b04d9376acb69/de.tum.in.bluetooth.server/src/main/java/de/tum/in/bluetooth/server/SPPServer.java?at=default
The Bluetooth Client Code: https://bitbucket.org/i-am-it/industry_4.0/src/129d900bbc265d47d4c231f1384b04d9376acb69/de.tum.in.bluetooth.milling.machine/src/main/java/de/tum/in/bluetooth/milling/machine/BluetoothConnector.java?at=default