Francis Mariano
05/26/2022, 3:35 PMkable
is a great use case.
private val job = SupervisorJob(parentCoroutineContext.job)
private val scope = CoroutineScope(parentCoroutineContext + job)
private val connectionScope = CoroutineScope(scope.coroutineContext + Job(scope.coroutineContext[Job]))
Here is what I understood about the code quoted above:
scope
inherits parent's context but with new job
. That job
is a SupervisorJob
so if any child of scope
fails or is cancelled it manage each one separately (if one child fail or cancel the others child continue working and the parent also is not cancelled)
job
inherits parent's job. If parent is cancelled all the child also is cancelled.
Here is what I did not understand:
connectionScope
inherits context and job of scope
. Are they the same????Francis Mariano
07/14/2022, 7:24 PMoverride suspend fun dataOad(characteristic: Characteristic) : Flow<ByteArray> {
return peripheral.value.observe(characteristic)
.onStart { Log.debug { "AudioProcessorImpl - dataOad - onStart" } }
.onEach { Log.debug { "AudioProcessorImpl - dataOad - onEach" } }
.onCompletion { Log.debug { "AudioProcessorImpl - dataOad - onCompletion" } }
}
If I cancel the scope that calls dataOad and create it again the observe works fine. But if the peripheral close the connection and I reconnect, the observer does not work anymore 😞
It is necessary close the application and reopen it.Francis Mariano
08/03/2022, 8:06 PMScanner { filters = listOf(Filter.Service(uuidFrom("00000123-0000-1000-8000-00805F9B34FB"))) }
return only Product A
but Scanner { filters = listOf(Filter.Service(uuidFrom("00000124-0000-1000-8000-00805F9B34FB"))) }
return Product A
and Product B
Why???? Why???? I don't know more what I can do.babel
08/24/2022, 8:52 PMbabel
08/24/2022, 8:55 PMbabel
08/24/2022, 8:57 PMDaniel Gruber
09/16/2022, 2:02 PMbenkuly
01/20/2023, 4:41 PMFrancis Mariano
02/23/2023, 2:44 PMFrancis 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 AM