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

3
lib_events/build.gradle Normal file
View File

@@ -0,0 +1,3 @@
apply from: rootProject.file("library.gradle")
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

View File

@@ -0,0 +1,24 @@
package no.nordicsemi.android.events
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.events.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="no.nordicsemi.android.events">
</manifest>

View File

@@ -0,0 +1,3 @@
package no.nordicsemi.android.events
sealed class BluetoothReadDataEvent

View File

@@ -0,0 +1,28 @@
package no.nordicsemi.android.events
import android.bluetooth.BluetoothDevice
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
sealed class CSCServiceEvent : BluetoothReadDataEvent(), Parcelable
@Parcelize
data class OnDistanceChangedEvent(
val bluetoothDevice: BluetoothDevice,
val speed: Float,
val distance: Float,
val totalDistance: Float
) : CSCServiceEvent()
@Parcelize
data class CrankDataChanged(
val bluetoothDevice: BluetoothDevice,
val crankCadence: Int,
val gearRatio: Float
) : CSCServiceEvent()
@Parcelize
data class OnBatteryLevelChanged(
val device: BluetoothDevice,
val batteryLevel: Int
) : CSCServiceEvent()

View File

@@ -0,0 +1,7 @@
package no.nordicsemi.android.events
val <T> T.exhaustive
get() = this
val String.Companion.EMPTY
get() = ""

View File

@@ -0,0 +1,17 @@
package no.nordicsemi.android.events
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)
}
}