Beacon distance

Beacon Distance is a simple yet powerful application designed to measure and monitor distances using beacon technology.

Installation

  1. Add the latest version of package to your pubspec.yaml (and rundart pub get):
dependencies:
  beacon_distance: ^0.0.1
  1. Import the package and use it in your Flutter App.
import 'package:beacon_distance/beacon_util.dart';

This Flutter function, calculateDistance, is designed to estimate the distance between a Bluetooth device and its transmitter based on the received signal strength indicator (RSSI) and the transmission power (txPower).

Parameters

txPower: Transmission power in decibels (dB) at 1 meter from the Bluetooth device.

rssi: Received Signal Strength Indicator, representing the signal strength received by the device.

Return Value

The function returns the estimated distance between the Bluetooth device and its transmitter. If the distance cannot be determined, the function returns -1.0.

Usage

void main() {
  // Example usage
  int txPower = -10;    // Replace with the actual transmission power value
  double rssi = -55.5;  // Replace with the actual received signal strength

  double distance = calculateDistance(txPower, rssi);

  if (distance == -1.0) {
    print("Unable to determine distance.");
  } else {
    print("Estimated distance: $distance meters.");
  }
}

Libraries

beacon_distance