Error during getting android Bluetooth device RSSI from Windows 10 using BlueCove library

25 views Asked by At

I have the following simple code (below) using BlueCove 2.1.1 in particular the RemoteDeviceHelper.readRSSI(device) method which gives an error that so far I could not resolve. May I kindly ask your opinion? I'm trying a desktop app on Windows 10, and have a feeling that BlueCove wont work with this Windows version, or no other clue.

Here is the code:

public static void main(String[] args) {
    try {
        LocalDevice localDevice = LocalDevice.getLocalDevice();
        DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();

        // Discover nearby devices
        RemoteDevice[] devices = discoveryAgent.retrieveDevices(DiscoveryAgent.PREKNOWN);

        for (RemoteDevice device : devices) {
            System.out.println("Name: "+device.getFriendlyName(false));
            System.out.println("Address: "+device.getBluetoothAddress());

            // Get the RSSI value
            int rssi = RemoteDeviceHelper.readRSSI(device);
            System.out.println("Device: " + device.getBluetoothAddress() + ", RSSI: " + rssi);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

This is the error I got: enter image description here

0

There are 0 answers