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

commonMain.dk.cachet.carp.common.application.devices.CustomProtocolDevice.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.application.devices

import dk.cachet.carp.common.application.Trilean
import dk.cachet.carp.common.application.data.DataType
import dk.cachet.carp.common.application.sampling.DataTypeSamplingSchemeMap
import dk.cachet.carp.common.application.sampling.SamplingConfiguration
import dk.cachet.carp.common.application.tasks.CustomProtocolTask
import dk.cachet.carp.common.application.tasks.TaskConfigurationList
import kotlinx.serialization.*
import kotlin.js.JsExport
import kotlin.reflect.KClass


/**
 * A primary device which uses a single [CustomProtocolTask] to determine how to run a study on the device.
 */
@Serializable
@JsExport
@Suppress( "NON_EXPORTABLE_TYPE" )
data class CustomProtocolDevice( override val roleName: String, override val isOptional: Boolean = false ) :
    PrimaryDeviceConfiguration()
{
    object Sensors : DataTypeSamplingSchemeMap()
    object Tasks : TaskConfigurationList()


    // Measures and data types are defined in the custom `CustomProtocolTask.studyProtocol` and thus not managed by core.
    override fun getSupportedDataTypes(): Set = Sensors.keys
    override fun getDataTypeSamplingSchemes(): DataTypeSamplingSchemeMap = Sensors

    override val defaultSamplingConfiguration: Map = emptyMap()

    override fun createDeviceRegistrationBuilder(): DefaultDeviceRegistrationBuilder =
        DefaultDeviceRegistrationBuilder()
    override fun getRegistrationClass(): KClass = DefaultDeviceRegistration::class
    override fun isValidRegistration( registration: DefaultDeviceRegistration ) = Trilean.TRUE
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy