bind

@JvmName(name = "bindDevice")
fun <T> T.bind(device: Flow<ConnectableDevice?>, scope: CoroutineScope, binding: ConnectedDeviceBinding.RequiresServicesDiscovered<T>.() -> Unit): StateFlow<T>

Binds an object of type T to the Flow of a ConnectableDevice, so that it may be updated according to binding

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

device

the Flow of the ConnectableDevice that should trigger updates.

scope

the CoroutineScope in which to bind

Type Parameters

T

the type of the object to bind to


fun <T> T.bind(device: ConnectableDevice, scope: CoroutineScope, binding: ConnectedDeviceBinding.RequiresServicesDiscovered<T>.() -> Unit): StateFlow<T>

Binds an object of type T to a ConnectableDevice, so that it may be updated according to binding

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

device

the ConnectableDevice that should trigger updates.

scope

the CoroutineScope in which to bind

Type Parameters

T

the type of the object to bind to


fun <T> T.bind(deviceState: ConnectableDeviceState.Connected.DiscoveredServices, scope: CoroutineScope, binding: ConnectedDeviceBinding.EnsuresAvailable<T>.() -> Unit): StateFlow<T>

Binds an object of type T to a ConnectableDeviceState.Connected.DiscoveredServices state, so that it may be updated according to binding. This assumes services has been discovered and as such any binding will fail if a RemoteAttribute is not available.

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

scope

the CoroutineScope in which to bind

binding

Type Parameters

T

the type of the object to bind to


@JvmName(name = "bindService")
fun <T> T.bind(service: Flow<RemoteService?>, scope: CoroutineScope, binding: RemoteServiceBinding.RequiresServicesDiscovered<T>.() -> Unit): StateFlow<T>

Binds an object of type T to the Flow of a RemoteService, so that it may be updated according to binding

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

service

the Flow of the RemoteService that should trigger updates.

scope

the CoroutineScope in which to bind

binding

Type Parameters

T

the type of the object to bind to


fun <T> T.bind(service: RemoteService, scope: CoroutineScope, binding: RemoteServiceBinding.EnsuresAvailable<T>.() -> Unit): StateFlow<T>

Binds an object of type T to a RemoteService, so that it may be updated according to binding.

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

service

the RemoteService that should trigger updates.

scope

the CoroutineScope in which to bind

binding

Type Parameters

T

the type of the object to bind to


@JvmName(name = "bindCharacteristic")
fun <T> T.bind(characteristic: Flow<RemoteCharacteristic?>, scope: CoroutineScope, binding: RemoteCharacteristicBinding.RequiresServicesDiscovered<T>.() -> Unit): StateFlow<T>

Binds an object of type T to the Flow of a RemoteCharacteristic, so that it may be updated according to binding

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

characteristic

the Flow of the RemoteCharacteristic that should trigger updates.

scope

the CoroutineScope in which to bind

Type Parameters

T

the type of the object to bind to


fun <T> T.bind(characteristic: RemoteCharacteristic, scope: CoroutineScope, binding: RemoteCharacteristicBinding.EnsuresServicesAvailable<T>.() -> Unit): StateFlow<T>

Binds an object of type T to a RemoteCharacteristic, so that it may be updated according to binding.

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

characteristic

the RemoteCharacteristic that should trigger updates.

scope

the CoroutineScope in which to bind

Type Parameters

T

the type of the object to bind to


@JvmName(name = "bindDescriptor")
fun <T> T.bind(descriptor: Flow<RemoteDescriptor?>, scope: CoroutineScope, binding: RemoteDescriptorBinding.RequiresServicesDiscovered<T>.() -> Unit): StateFlow<T>

Binds an object of type T to the Flow of a RemoteDescriptor, so that it may be updated according to binding

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

descriptor

the Flow of the RemoteDescriptor that should trigger updates.

scope

the CoroutineScope in which to bind

Type Parameters

T

the type of the object to bind to


fun <T> T.bind(descriptor: RemoteDescriptor, scope: CoroutineScope, binding: RemoteDescriptorBinding<T>.() -> Unit): StateFlow<T>

Binds an object of type T to a RemoteDescriptor, so that it may be updated according to binding.

Return

a StateFlow of T that updates whenever mutating occurs due to actions set up in binding

Parameters

descriptor

the RemoteDescriptor that should trigger updates.

scope

the CoroutineScope in which to bind

binding

the RemoteDescriptorBinding that sets up binding to the RemoteDescriptor

Type Parameters

T

the type of the object to bind to