I'm trying to connect from my Windows PC to my GPS-Running Watch (TomTom Runner 2), as there are only Android & iOS Apps available that support Syncing via Bluetooth. Windows need to use the USB-Cable, but I like to do this with BLTH.
For Linux, there is already existing a project: https://github.com/dlenski/ttblue but sadly not for Windows.
I'm a beginner in Java, but already got with Netbeans and the official Code Examples from BlueCove (http://bluecove.org/bluecove/apidocs/overview-summary.html) some sucess. The Java Code is finding BLTH-Devices in the near, but not the GPS-Watch. But the GPS-Watch itself is same time visible to other Devices (Android Phone, Microsoft Windows), also visible in the Windows Settings on the same system where the Java Code is running.
I'm now a bit struggeling why BlueCove is not finding the device, also if the Hardware is able to?
I already came to the idea if this is related to the BLTH-Stack. Winsock is used as default. Using: System.setProperty(BlueCoveConfigProperties.PROPERTY_STACK, "widcomm");
Result in: Native Library bluecove_x64 not available Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available; resource not found bluecove_x64.dll load [bluecove_x64] no bluecove_x64 in java.library.path Where I'm right not sure what the issue is.
To get sure it's (or not) related to the BLTH-Stack I tried the Test-Programm from Bluecove (bluecove-tester-app.jar - http:// bluecove.org/bluecove-examples/bluecove-tester/) I'm able to start, but on selecting Discovery it will result in error:
"libraries not available" On & Offline.
Just wondering as I expected (as Java newbie) in a .jar all is already included. Also in Netbeans it looks all libraries in the .jar. But finally this is not my issue.
Sorry for the long text... Maybe one of you could give me an hint.
Thanks and regards.
There is a valid implementation as a fork for the 2.1.1 version https://mvnrepository.com/artifact/io.ultreia/bluecove/2.1.1
Has been very hard to find. Hope it works.
@DisplayName("Bluetooth device test")
@Test
void discoverDevices() {
try {
LocalDevice dev = LocalDevice.getLocalDevice();
String mac = dev.getBluetoothAddress();
System.out.println("Address:" + mac);
DiscoveryAgent agent = dev.getDiscoveryAgent();
System.out.println(dev.getFriendlyName());
} catch (Exception e) {
log.error("MEK", e);
}
}
I think there are at least two questions here. I'll answer the one I just went through the hassle of figuring it out myself. Your error:
Native Library bluecove_x64 not available Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available; resource not found bluecove_x64.dll load [bluecove_x64] no bluecove_x64 in java.library.path
Is because the last official BlueCove release was 32 bit only. You need to download the last 'snapshot' release.
There are at least three ways to fix this error.
You can install the 32 bit version of the JDK/JRE and make your project 32 bit.
You can download the latest 64 bit JAR directly from here: http://snapshot.bluecove.org/distribution/download/2.1.1-SNAPSHOT/2.1.1-SNAPSHOT.63/
Or if you're a maven user, add this to your POM file to get the latest 64 bit JAR
<repositories>
<!-- Bluetooth Snapshots Repo -->
<repository>
<id>pyx4j-web-snapshot</id>
<url>http://repository.pyx4j.com/maven2-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<dependencies>
<!-- Bluetooth connection -->
<dependency>
<groupId>net.sf.bluecove</groupId>
<artifactId>bluecove</artifactId>
<version>2.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With