Java BlueCove not discover all Devices, Windows 10 x64
Asked Answered
P

3

6

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.

Portray answered 5/4, 2016 at 13:0 Comment(0)
D
5

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);
        }
    }
Duke answered 29/3, 2020 at 9:39 Comment(0)
C
2

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>
Carvel answered 17/6, 2016 at 16:44 Comment(1)
The JAR from the answer can be downloaded here, tested in 14/02/2017Calibre
K
1

The JAR can be downloaded from new link below-- i have used it for x64 ---

bluecove-2.1.1.jar >> Download from the link

Karyolymph answered 15/6, 2019 at 17:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.