B4J Question Raspberry Pi Bluetooth

lip

Active Member
Licensed User
I am trying to connect my Raspberry Pi to a Data Logging device using Bluetooth SPP. It will get the messages via Bluetooth then post them to my server using HTTP Posts.

I am reasonably experienced with B4A but this is day 0 (Hour 2) with B4J and a Raspberry Pi.

So far, I have created a non-UI app and can Post strings to my Server, get responses and see them in the logs.

My Rapspberry Pi has a USB Bluetooth dongle. I can see it using the Raspberry Pi command line and it seems to be working fine.

Next Step, to get the Pi to connect to my Data Logger. For now, I am happy to hard code the Data Logger's mac address and connect to it without doing a search.

I'm looking for a few helpful pointers if possible:-

- Which Library do I use? JSerial? JBluetooth?

- I am slightly confused by some forum articles which seem to direct me to connect my PC to my Pi using Bluetooth. I am not trying to do this, I am trying to connect my Pi to a third device;

- Will I be able to use SPP?

- Will I be able to use Prefix mode?

Thanks in advance for any nuggets.
 

Erel

Administrator
Staff member
Licensed User
If the Bluetooth module is mapped to a virtual serial port then you can use jSerial. Otherwise you need to use jBluetooth. Note that jBluetooth doesn't support all types of Bluetooth adapters.

I am slightly confused by some forum articles which seem to direct me to connect my PC to my Pi using Bluetooth.
It doesn't matter whether you connect to a PC or a data logging device.

- Will I be able to use SPP?
Yes. SPP is the serial profile.

- Will I be able to use Prefix mode?
No. You can only use prefix mode if both sides of the connection implement this protocol.
 
Top