1

I have a bluetooth button and I need to connect it with my Java code (not Android). I found bluecove - implementation of JSR82, but I really don't understand how to use it? Ultimately I need my program to handle button clicks.

Now I found solution to find neraby devices:

LocalDevice localDevice = LocalDevice.getLocalDevice();
DiscoveryAgent agent = localDevice.getDiscoveryAgent();
RemoteDevice[] remoteDevices = agent.retrieveDevices(DiscoveryAgent.PREKNOWN);

but how to connect and listent events? Is it even possible?

Kadzhaev Marat
  • 1,278
  • 1
  • 19
  • 33
  • Is your device a Bluetooth LE device? If it is I believe that bluecove does not support what you are intending to do. Otherwise please post the following extra information: Target Operating System, Target Device Information. Target Bluetooth Stack. – Luis Ramirez Aug 06 '17 at 19:09
  • @LuisRamirez, as far as I know - no. To be sure: https://www.amazon.com/Forrader%C2%AE-AB-Shutter-Bluetooth-Controller/dp/B00KLDDZ2G this is button which I have. Target OS: Windows 10. Targer device info: uses Bluetooth V3.0 – Kadzhaev Marat Aug 06 '17 at 19:48
  • I think you will need to start by following the samples on this page http://snapshot.bluecove.org/bluecove/apidocs/overview-summary.html#ServicesSearch look at the device discovery and service discovery. – Luis Ramirez Aug 07 '17 at 00:02
  • @LuisRamirez, well I tried the sample above and problem is that I can't found any 'services' of device. Maybe you have any other ideas? – Kadzhaev Marat Aug 08 '17 at 08:04
  • New Idea, have you tried to connect directly via a socket to your device? I am not sure how to do this in bluecove, but if you do have access to visual studio you can try 32feet.net rfcomm sample. Additionally check the device manager when you pair your device. Check if any new devices are added when its paired. This may give you some clues. – Luis Ramirez Aug 11 '17 at 00:49

0 Answers0