Francis Mariano
02/23/2023, 2:55 PMFlow<Bluetooth.Availability>
. I have the following use case:
all permissions is granted, bluetooth adapter is enabled but location service is disabled.
The flow emits LocationServicesDisabled which is correct, but after I enable the LocationService, the flow could emit a new state, like Available or Unavailable(reason = Off)
What do you think about that???Cristian MG
06/12/2023, 8:28 AMCristian MG
06/12/2023, 8:28 AMCristian MG
06/12/2023, 8:29 AMCristian MG
06/12/2023, 8:29 AMCristian MG
06/12/2023, 8:48 AMCristian MG
07/13/2023, 12:02 PMnikunjsakhrelia
08/03/2023, 8:33 AMnikunjsakhrelia
08/03/2023, 8:34 AMCristian MG
09/07/2023, 10:05 AMCristian MG
09/07/2023, 11:43 AMCristian MG
09/07/2023, 11:43 AMCristian MG
09/07/2023, 11:45 AMCristian MG
09/07/2023, 11:51 AM9C:9C:1F:CD:F3:02 read
service: 4f4a4554-4520-4341-4c4f-520001000000
characteristic: 4f4a4554-4520-4341-4c4f-520001000001
onConnectionUpdated() - Device=9C9C1F_2 interval=30 latency=0 timeout=600 status=0
Cristian MG
09/07/2023, 11:58 AMCristian MG
09/07/2023, 12:00 PMonScannerRegistered() - status=0 scannerId=7 mScannerId=0
9C:9C:1F:CD:F3:02 onCharacteristicRead
service: 4f4a4554-4520-4341-4c4f-520001000000
characteristic: 4f4a4554-4520-4341-4c4f-520001000001
status: GATT_SUCCESS(0)
As you can see the function onCharacteristicRead is firing automatically after pairing and not fire with the error event
GATT_AUTH_FAIL
GATT_INSUFFICIENT_AUTHENTICATION
GATT_INSUFFICIENT_ENCRYPTION
travis
09/07/2023, 5:14 PMCristian MG
10/06/2023, 12:41 PMJim Schultz
10/26/2023, 6:28 PMCristian MG
02/14/2024, 7:46 AMCristian MG
02/14/2024, 7:47 AMIvan Harnastaeu
05/02/2024, 8:32 AMThrows(Exception::class)
.
Here's how it looks:
@Throws(Exception::class)
fun deviceFlow(): Flow<BLEDevice> {
return scanner.advertisements
.filter { !it.name.isNullOrBlank() }
.map {
BLEDevice(
name = it.name.orEmpty(),
advertisement = it
)
}
}
}
If I just throw an Exception in the body of this function, it works fine. But if I run it on a device without Bluetooth usage permission, the function awaitPoweredOn()
throws an exception and crashes the app and does not propagate this exception further. And I would like to handle such exceptions on the client side.
Thanks in advance!Linus Närkling
05/29/2024, 7:28 AMlibs.versions.toml
file like so:
[versions]
indexeddb = "0.7.1"
[libraries]
indexeddb = { group = "com.juul.indexeddb", name = "core", version.ref = "indexeddb" }
So first I'm unsure if the dependency should be defined in shared/build.gradle.kts
or composeApp/build.gradle.kts
. I think the latter, but I've tried both.
For shared/build.gradle.kts
, I've added this under `kotlin > sourceSets`:
sourceSets {
commonMain.dependencies {
// put your Multiplatform dependencies here
}
wasmJsMain.dependencies {
implementation(libs.indexeddb)
}
}
Full file: https://gist.github.com/VapidLinus/efb65c7ed1311a3af066b6d8f0d763b4
And for composeApp/build.gradle.kts
I've added this under `kotlin > sourceSets`:
sourceSets {
val desktopMain by getting
androidMain.dependencies {
...
}
commonMain.dependencies {
...
}
desktopMain.dependencies {
implementation(compose.desktop.currentOs)
}
wasmJsMain.dependencies {
implementation(libs.indexeddb)
}
}
Full file: https://gist.github.com/VapidLinus/0a4efe8588af8f7fbf2b8faf837522d4
Then I do a Gradle sync and expect the dependency should work, but it seems not. To test I have a file composeApp/src/wasmJsMain/kotlin/App.wasmJs.kt
where I try to open a database:
import kotlin.random.Random
import com.juul.indexeddb.openDatabase
actual fun databaseTest() {
val database = openDatabase("test.db", 1)
}
But I get the errors:
Unresolved reference: com :3
Unresolved reference: openDatabase: 5
If I look under "External Libraries" in the Project window in Android Studio I do not see com.juul.indexeddb
listed so I think the dependency isn't getting added.
I've also tried replacing implementation(libs.indexeddb)
with implementation("com.juul.indexeddb:core:0.7.1")
just in case it is a config issue, but that does not help either.
Does anyone have any advice or know what I'm doing wrong to add indexeddb as a dependency to my wasm module? Much appreciatedykws
09/23/2024, 8:21 AMCristian MG
10/02/2024, 7:00 AMBrendan Weinstein
12/22/2024, 11:02 PMS K
12/24/2024, 9:58 AMGuoqiang.Li
01/27/2025, 2:37 PMfun start() {
if (_status.value == BluetoothStatus.Scanning) return
_status.value = BluetoothStatus.Scanning
scanScope.launch {
withTimeoutOrNull(ScanDurationMillts) {
bluetoothScanner
.advertisements
.catch { cause -> _status.value = BluetoothStatus.Failed(cause.message?:"Unknown error") }
.onCompletion { cause ->
if(cause == null || cause is CancellationException) {
_status.value = BluetoothStatus.ScanStoped
}
}
.collect { advertisement ->
found = found.plus(advertisement)
_advertisements.value = found.toList()
}
}
}
}
val bluetoothScanner = Scanner {
logging {
level = Logging.Level.Events
}
filters {
match {
services = listOf(SERVICE_UUID)
// name = Filter.Name.Prefix("ED719M")
}
}
}
Guoqiang.Li
01/31/2025, 4:10 PMGiorgi
05/08/2025, 12:56 PM