Monitor non beacon ble devices (Android beacon Library)

Can I monitor non beacon ble devices using Android beacon library? If so, how can I use RSSI to estimate their distance without txpower?

resolvent:

Yes, you can use this library to detect non beacon ble devices. If you first measure the known RSSI at one meter of the device, you can also calculate the estimated distance to the device

The following code shows how to do this:

    final DistanceCalculator distanceCalculator = new ModelSpecificDistanceCalculator(this, null);
    final int RSSiAtOneMeter = -59;

    mBeaconManager.setNonBeaconLeScanCallback(new NonBeaconLeScanCallback() {
        @Override
        public void onNonBeaconLeScan(BluetoothDevice bluetoothDevice, int RSSi, byte[] bytes) {
            Double estimatedDistnaceInMeters = distanceCalculator.calculateDistance(RSSiAtOneMeter, RSSi);
            // TODO: do something with estimatedDistanceInMeters
        }
    });

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>