distance

fun Flow<Device?>.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 Device. 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 Device 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.