Search code examples
androidandroid-wifi

Wi-Fi signal strength unit


I using this code for get wifi signal set.(BSSID, SSID, RSSI.. etc.).

public void sortScanResult()
{
    wifiScan.scanWifiSignal(); 
    scanedResults = new ArrayList<ScanResult>(wifiScan.getScanResults());

    Comparator<ScanResult> comparator = new Comparator<ScanResult>() {
        @Override
        public int compare(ScanResult lhs, ScanResult rhs) {
            return (lhs.level > rhs.level ? -1 : (lhs.level == rhs.level ? 0 : 1));
        }
    };

    Collections.sort(scanedResults, comparator); //sorting result


    if (scanedResults.size() > 10) {
        int resultSize = scanedResults.size();
        for (int index = resultSize - 1; ; index--) {
            scanedResults.remove(index);
            if (scanedResults.size() == 10) break;
        }  
    }
}

but the scanResults of this code return RSSI level by INT.

I want get rssi level value by float for precision because I use for indoor navigation.(Finger Print).

Is there no way to get RSSI level value by float?

ps. sorry, I'm poor at English.


Solution

  • Even if it were in float, that doesn't imply greater accuracy as float is 32bit same as int.

    But anyway it's just not available at the hardware level:

    Vendors and chipset makers provide their own accuracy, granularity.

    Cisco Systems cards have a RSSI_Max value of 100 and will report 101 different power levels, where the RSSI value is 0 to 100. Another popular Wi-Fi chipset is made by Atheros. An Atheros based card will return an RSSI value of 0 to 127 (0x7f) with 128 (0x80) indicating an invalid value.

    So that's what you have to work with, around 7 bits.

    P.S. you won't have much luck with your approach according to the wiki article:

    RSSI doesn't always provide measurements that are sufficiently accurate to properly determine the location.