Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate info to new ble api #1001

Merged
merged 20 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix characteristic collect
makeevrserg committed Dec 18, 2024
commit c744b04a0cdec16f9972af2e5e20a242007cdd37
Original file line number Diff line number Diff line change
@@ -10,9 +10,13 @@ import com.flipperdevices.core.log.warn
import kotlinx.collections.immutable.ImmutableMap
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onEach
import no.nordicsemi.android.kotlin.ble.client.main.callback.ClientBleGatt
import no.nordicsemi.android.kotlin.ble.client.main.service.ClientBleGattServices
import no.nordicsemi.android.kotlin.ble.core.data.BleGattProperty
@@ -57,6 +61,10 @@ class FTransportMetaInfoApiImpl(
return flowOf(characteristic.read().value)
}
info { "Subscribe on $address characteristic" }
return characteristic.getNotifications().map { it.value }
// Don't block one flow by another
return listOf(
flow { emit(characteristic.read().value) },
characteristic.getNotifications().map { it.value }
).merge()
}
}