getUnits

abstract fun getUnits(availability: Availability, sorting: Sorting, type: IotUnit.Type?, callback: (List<IotUnit>) -> Unit): Cancelable

Support function to get a list with IotUnit.

Note: The purpose of this function is to support clients that can not use Coroutines or the Kotlin programming language!

To check if the unit is in range use IotUnit.isNearby. To get a list with only the ones in range applications can call:

getUnitController()
.getUnits(Availability.All, Sorting.Distance)
.map { iotUnitList -> iotUnitList?.filter { iotUnit -> iotUnit.isNearby() } }

Since

1.6.0

Return

Cancelable It is your responsibility to cancel this operation, when no longer needed, to avoid memory leaks.

Parameters

availability

determines whether return all units the logged user has access to or only the ones available now. Availability.AvailableNow will filter out units booked by other users, units with restricted access times and blue-id units not yet synchronized with blue-id servers.

sorting

determines the order units will be returned. Sorting.None will simply return them on the order returned by backend. Calls using Sorting.Distance will actively scan for units and will be ordered by their distance, closest first and out-of-range at the end of the list.

callback

receiving the list of IotUnits.

abstract fun getUnits(availability: Availability, sorting: Sorting, type: IotUnit.Type?, lifecycleOwner: LifecycleOwner, callback: (List<IotUnit>) -> Unit): Cancelable

Support function to get a list with IotUnit.

Note: The purpose of this function is to support clients that can not use Coroutines or the Kotlin programming language!

To check if the unit is in range use IotUnit.isNearby. To get a list with only the ones in range applications can call:

sdk.getUnitController()
.getUnits(Availability.All, Sorting.Distance)
.map { iotUnitList -> iotUnitList?.filter { iotUnit -> iotUnit.isNearby() } }

Since

1.9.0

Return

Cancelable In case you want to cancel before Lifecycle.State.DESTROYED.

Parameters

availability

determines whether return all units the logged user has access to or only the ones available now. Availability.AvailableNow will filter out units booked by other users, units with restricted access times and blue-id units not yet synchronized with blue-id servers.

sorting

determines the order units will be returned. Sorting.None will simply return them on the order returned by backend. Calls using Sorting.Distance will actively scan for units and will be ordered by their distance, closest first and out-of-range at the end of the list.

lifecycleOwner

auto cancel the Cancelable when lifecycle state is Lifecycle.State.DESTROYED.

callback

receiving the list of IotUnits.

abstract fun getUnits(availability: Availability, sorting: Sorting, type: IotUnit.Type?, samplePeriodInMillis: Long, callback: (List<IotUnit>) -> Unit): Cancelable

Support function to get a list with IotUnit.

Note: The purpose of this function is to support clients that can not use Coroutines or the Kotlin programming language!

To check if the unit is in range use IotUnit.isNearby. To get a list with only the ones in range applications can call:

getUnitController()
.getUnits(Availability.All, Sorting.Distance)
.map { iotUnitList -> iotUnitList?.filter { iotUnit -> iotUnit.isNearby() } }

Since

1.9.0

Return

Cancelable It is your responsibility to cancel this operation, when no longer needed, to avoid memory leaks.

Parameters

availability

determines whether return all units the logged user has access to or only the ones available now. Availability.AvailableNow will filter out units booked by other users, units with restricted access times and blue-id units not yet synchronized with blue-id servers.

sorting

determines the order units will be returned. Sorting.None will simply return them on the order returned by backend. Calls using Sorting.Distance will actively scan for units and will be ordered by their distance, closest first and out-of-range at the end of the list.

samplePeriodInMillis

does not emit new values within sample period (compared to the latest emitted value). This might swallow some values but ensures your UI does not need to handle lots of incoming values. If you put 2000, you won't get updates within 2 seconds to the latest emitted value.

callback

receiving the list of IotUnits.

abstract fun getUnits(availability: Availability, sorting: Sorting, type: IotUnit.Type?, samplePeriodInMillis: Long, lifecycleOwner: LifecycleOwner, callback: (List<IotUnit>) -> Unit): Cancelable

Support function to get a list with IotUnit.

Note: The purpose of this function is to support clients that can not use Coroutines or the Kotlin programming language!

To check if the unit is in range use IotUnit.isNearby. To get a list with only the ones in range applications can call:

getUnitController()
.getUnits(Availability.All, Sorting.Distance)
.map { iotUnitList -> iotUnitList?.filter { iotUnit -> iotUnit.isNearby() } }

Since

1.9.0

Return

Cancelable In case you want to cancel before Lifecycle.State.DESTROYED.

Parameters

availability

determines whether return all units the logged user has access to or only the ones available now. Availability.AvailableNow will filter out units booked by other users, units with restricted access times and blue-id units not yet synchronized with blue-id servers.

sorting

determines the order units will be returned. Sorting.None will simply return them on the order returned by backend. Calls using Sorting.Distance will actively scan for units and will be ordered by their distance, closest first and out-of-range at the end of the list.

samplePeriodInMillis

does not emit new values within sample period (compared to the latest emitted value). This might swallow some values but ensures your UI does not need to handle lots of incoming values. If you put 2000, you won't get updates within 2 seconds to the latest emitted value.

lifecycleOwner

auto cancel the Cancelable when lifecycle state is Lifecycle.State.DESTROYED.

callback

receiving the list of IotUnits.