writeAs
suspend fun <T> Peripheral.writeAs(serviceUuid: Uuid, characteristicUuid: Uuid, value: T, encoder: BleEncoder<T>, writeType: WriteType = WriteType.WithResponse): Result<Unit>
Encodes value with encoder and writes it to a characteristic addressed by service+characteristic UUID. Failure cases mirror readAs:
PeripheralNotReadyException: peripheral not ready to resolve.
CharacteristicNotFoundException: ready to resolve, char absent.
any exception thrown by the underlying write.
kotlin.coroutines.cancellation.CancellationException is always propagated to the caller, never wrapped into Result.failure.