All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dk.cachet.carp.common.infrastructure.test.StubDeviceConfiguration.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.DeviceConfiguration
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 [DeviceConfiguration] which can measure [STUB_DATA_POINT_TYPE].
 */
@Serializable
data class StubDeviceConfiguration(
    @Required override val roleName: String = "Stub device",
    override val isOptional: Boolean = false,
    override val defaultSamplingConfiguration: Map = emptyMap()
) :
    DeviceConfiguration()
{
    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 = Trilean.TRUE
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy