mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-21 08:24:22 +01:00
feature: Add new CSC Screen
This commit is contained in:
3
lib_events/build.gradle
Normal file
3
lib_events/build.gradle
Normal file
@@ -0,0 +1,3 @@
|
||||
apply from: rootProject.file("library.gradle")
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
5
lib_events/src/main/AndroidManifest.xml
Normal file
5
lib_events/src/main/AndroidManifest.xml
Normal 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>
|
||||
@@ -0,0 +1,3 @@
|
||||
package no.nordicsemi.android.events
|
||||
|
||||
sealed class BluetoothReadDataEvent
|
||||
@@ -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()
|
||||
@@ -0,0 +1,7 @@
|
||||
package no.nordicsemi.android.events
|
||||
|
||||
val <T> T.exhaustive
|
||||
get() = this
|
||||
|
||||
val String.Companion.EMPTY
|
||||
get() = ""
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user