distance

fun Flow<ConnectableDevice?>.distance(environmentalFactor: Double = 2.0, averageOver: Int = 5): Flow<Double>

Gets the (Flow of) the distance in meters between the scanner and a Flow of ConnectableDevice. To get a more stable result, this method will average the distance over the last averageOver results.

Return

the Flow of distance in meters between the scanner and the ConnectableDevice in the given Flow

Parameters

environmentalFactor

the constant to account for environmental interference. Should usually range between 2.0 and 4.0

averageOver

averages the calculated distance over this amount of scan results. Always uses the last results.


fun ConnectableDevice.distance(environmentalFactor: Double = 2.0, averageOver: Int = 5): Flow<Double>

Gets the (Flow of) the distance in meters between the scanner and a ConnectableDevice. To get a more stable result, this method will average the distance over the last averageOver results.

Return

the Flow of distance in meters between the scanner and the ConnectableDevice

Parameters

environmentalFactor

the constant to account for environmental interference. Should usually range between 2.0 and 4.0

averageOver

averages the calculated distance over this amount of scan results. Always uses the last results.