commonMain.dk.cachet.carp.common.infrastructure.test.StubPrimaryDeviceConfiguration.kt Maven / Gradle / Ivy
Go to download
Helper classes and base types relied upon by all subsystems. This library does not contain any domain logic.
The newest version!
package dk.cachet.carp.common.infrastructure.test
import dk.cachet.carp.common.application.Trilean
import dk.cachet.carp.common.application.data.DataType
import dk.cachet.carp.common.application.devices.DefaultDeviceRegistration
import dk.cachet.carp.common.application.devices.DefaultDeviceRegistrationBuilder
import dk.cachet.carp.common.application.devices.PrimaryDeviceConfiguration
import dk.cachet.carp.common.application.sampling.DataTypeSamplingSchemeMap
import dk.cachet.carp.common.application.sampling.SamplingConfiguration
import kotlinx.serialization.*
import kotlin.reflect.KClass
/**
* A stub [PrimaryDeviceConfiguration] which can measure [STUB_DATA_POINT_TYPE].
*/
@Serializable
data class StubPrimaryDeviceConfiguration(
@Required override val roleName: String = "Stub primary device",
override val isOptional: Boolean = false,
override val defaultSamplingConfiguration: Map = emptyMap()
) : PrimaryDeviceConfiguration()
{
object Sensors : DataTypeSamplingSchemeMap()
{
val STUB_DATA_POINT = add( StubDataTypeSamplingScheme() )
}
override fun getSupportedDataTypes(): Set = Sensors.keys
override fun getDataTypeSamplingSchemes(): DataTypeSamplingSchemeMap = Sensors
override fun createDeviceRegistrationBuilder(): DefaultDeviceRegistrationBuilder = DefaultDeviceRegistrationBuilder()
override fun getRegistrationClass(): KClass = DefaultDeviceRegistration::class
override fun isValidRegistration( registration: DefaultDeviceRegistration ) = Trilean.TRUE
}