feature: Add new CSC Screen

This commit is contained in:
Sylwester Zieliński
2021-09-14 11:37:40 +02:00
parent 419aaf7e5b
commit c944a446ef
72 changed files with 2949 additions and 227 deletions

View File

@@ -0,0 +1,7 @@
apply from: rootProject.file("library.gradle")
dependencies {
implementation project(":lib_events")
implementation libs.kotlin.coroutines
}

View File

@@ -0,0 +1,24 @@
package no.nordicsemi.android.broadcast
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("no.nordicsemi.android.broadcast.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="no.nordicsemi.android.broadcast">
</manifest>

View File

@@ -0,0 +1,34 @@
package no.nordicsemi.android.broadcast
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import no.nordicsemi.android.events.BluetoothReadDataEvent
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class BluetoothDataReadBroadcast @Inject constructor() {
private val _event = MutableSharedFlow<BluetoothReadDataEvent>(
replay = 1,
extraBufferCapacity = 1,
onBufferOverflow = BufferOverflow.DROP_OLDEST
)
val events: SharedFlow<BluetoothReadDataEvent> = _event
private val _wheelSize = MutableSharedFlow<Int>(
replay = 1,
extraBufferCapacity = 1,
onBufferOverflow = BufferOverflow.DROP_OLDEST
)
val wheelSize: SharedFlow<Int> = _wheelSize
fun offer(newEvent: BluetoothReadDataEvent) {
_event.tryEmit(newEvent)
}
fun setWheelSize(size: Int) {
_wheelSize.tryEmit(size)
}
}

View File

@@ -0,0 +1,17 @@
package no.nordicsemi.android.broadcast
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}