arraysbluetooth-lowenergyrssi

Convert the Rssi value of Beacon to array


I'm planning to convert the output value of the specific beacon (Beacon 1 to 4) that I have scanned into an array like below:

enter image description here

By using the code below, I able to save the value into a random Rssi number but not into an array. Does anyone know on how to do that in Java

enter image description here

enter image description here


Solution

  • You can aggregate the RSSI readings into a mutable array list for each minor you encounter.

    Add this to your class's ctor:

    Map<Int, ArrayList> map = new HashMap<Int, ArrayList>();
    

    Append RSSI readings like so:

    if (!map.containsKey(b.getMinor()) {
        map.put(b.getMinor(), new ArrayList<Int>());
    }
    map.get(b.getMinor()).add(b.getRssi());