B4J Question [Solved] Raspberry Pi 3 with bluetooth

Mark Read

Well-Known Member
Licensed User
Longtime User
Has anyone managed to get the RPi3 working with B4J and the in-built bluetooth?

I have the #AdditionalJar's included but the code crashes at bt.listen with the error message

Program started.
BlueCove version 2.1.1-SNAPSHOT on bluez
My address: B8:27:EB:87:50:52
***************************************************************************
javax.bluetooth.ServiceRegistrationException: Can not open SDP session. [2] No such file or directory
at com.intel.bluetooth.BluetoothStackBlueZ.openSDPSessionImpl(Native Method)
at com.intel.bluetooth.BluetoothStackBlueZ.getSDPSession(BluetoothStackBlueZ.java:518)
at com.intel.bluetooth.BluetoothStackBlueZ.registerSDPRecord(BluetoothStackBlueZ.java:543)
at com.intel.bluetooth.BluetoothStackBlueZ.rfServerOpen(BluetoothStackBlueZ.java:607)
at com.intel.bluetooth.BluetoothRFCommConnectionNotifier.<init>(BluetoothRFCommConnectionNotifier.java:42)
at com.intel.bluetooth.MicroeditionConnector.openImpl(MicroeditionConnector.java:389)
at com.intel.bluetooth.MicroeditionConnector.open(MicroeditionConnector.java:156)
at javax.microedition.io.Connector.open(Connector.java:83)
at anywheresoftware.b4j.objects.Bluetooth$3.run(Bluetooth.java:192)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Error connecting...

If there is no solution, can I disable the inbuilt adapter and use a dongle?
 

Mark Read

Well-Known Member
Licensed User
Longtime User
Thx Erel, had already seen that post but it didn't work.

Now I have it working.

Here are the steps I used, starting from the latest Noobs version.

1. Sudo apt-get update

2. Sudo apt-get upgrade

3. Reboot

4. sudo nano /usr/lib/systemd/system/bluetooth.service

5.
Look for ExecStart=/usr/libexec/bluetooth/bluetoothd. Put " -C" at the end of this line.

6.
ctrl + O to save and ctrl + x to quit

7. Reboot to restart the daemon and bluetooth services.

8. sudo sdptool browse local and check that it works (otherwise an error appears).

9. sudo apt-get install libbluetooth-dev

10. Reboot. Try your code.

I know that it is a lot of rebooting but otherwise certain services do not like to restart.

Now I can control my RPi3 with my tablet (B4A App). Yippie!!! :D:D:D
 
Upvote 0
Top