In java (but not android) I need to connect to a 'hidden' bluetooth device. I'm using bluecove. I know the devices MAC address already.
In principle I can do this with:
StreamConnection conn = (StreamConnection) Connector.open("btspp://<mac>:1;authenticate=true;encrypt=tue;master=false;"
however the problem is that I need to use an authenticated connection (with a PIN).
Searching the web, I found this: Detect hidden bluetooth device with known ID
which allows me to create a RemoteDevice and then pass in a PIN to authenticate it, but I cannot find out how to use that RemoteDevice to then open a connection?
Answers like this: How to create a (javax.bluetooth.)RemoteDevice / connect with mac-address
suggest it can be done.
EDIT
To clarify, I believe that I can do the pairing and authentication with:
RemoteDevice rd = new RemoteDevice("<mac>");
RemoteDeviceHelper.authenticate(rd, "<pin>");
But then how do I use that "rd" object to open a (serial) connection to my bluetooth device?