execute

abstract fun execute(stateChangeRequest: StateChangeRequest, callback: (Result<Unit>) -> Unit): Cancelable

Support function to executes the given StateChangeRequest.

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

Performs basic validation before execution (e.g. Property.writable is true and Status is Status.Ready). If the validation fails, the Result will immediately be in failed state with an appropriate Exception.

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

Since

1.3.0

Return

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

Parameters

stateChangeRequest

container storing the list of state changes you want to perform on a certain IotDevice.

callback

Tells if execution was successful or not.

abstract fun execute(stateChangeRequest: StateChangeRequest, lifecycleOwner: LifecycleOwner, callback: (Result<Unit>) -> Unit): Cancelable

Support function to executes the given StateChangeRequest.

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

Performs basic validation before execution (e.g. Property.writable is true and Status is Status.Ready). If the validation fails, the Result will immediately be in failed state with an appropriate Exception.

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

Since

1.9.0

Return

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

Parameters

stateChangeRequest

container storing the list of state changes you want to perform on a certain IotDevice.

lifecycleOwner

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

callback

Tells if execution was successful or not.