Compare commits

..

1 Commits

Author SHA1 Message Date
a34ee6a5be Add connection on measurement start to PKT8 2024-09-18 10:07:15 +03:00
21 changed files with 29 additions and 49 deletions

View File

@ -9,4 +9,4 @@ This project build using [DataForge](http://www.inr.ru/~nozik/dataforge/) framew
It is intended to fix this problem with public maven repository later. It is intended to fix this problem with public maven repository later.
# Requirements # # Requirements #
Project requires JDK 16 in the system. GUI modules must be compiled on the target OS (linux on linux systems) Project requires JDK 8 with JavaFX for desktop controls (https://www.azul.com/downloads/?version=java-8-lts&package=jdk-fx)

View File

@ -4,7 +4,7 @@ plugins {
javafx { javafx {
modules = listOf("javafx.controls", "javafx.web") modules = listOf("javafx.controls", "javafx.web")
version = "16" version = "11"
} }
description = "A tornadofx based kotlin library" description = "A tornadofx based kotlin library"

View File

@ -7,7 +7,7 @@ apply plugin: 'kotlin'
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }
if (!hasProperty('mainClass')) { if (!hasProperty('mainClass')) {

View File

@ -4,7 +4,7 @@ plugins {
javafx { javafx {
modules = listOf("javafx.controls") modules = listOf("javafx.controls")
version = "16" version = "11"
} }
description = "dataforge-plots" description = "dataforge-plots"

View File

@ -4,7 +4,7 @@ plugins {
javafx { javafx {
modules = listOf("javafx.controls") modules = listOf("javafx.controls")
version = "16" version = "11"
} }
description = "jFreeChart plugin" description = "jFreeChart plugin"

View File

@ -6,7 +6,7 @@ plugins {
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }
apply plugin: "kotlin" apply plugin: "kotlin"

View File

@ -7,7 +7,7 @@ plugins {
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }

View File

@ -5,7 +5,7 @@ plugins{
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }
apply plugin: 'application' apply plugin: 'application'
@ -22,7 +22,7 @@ dependencies {
} }
application{ application{
mainClassName = "inr.numass.control.cryotemp.PKT8AppKt" mainClassName("inr.numass.control.cryotemp.PKT8App")
} }
task testDevice(dependsOn: classes, type: JavaExec) { task testDevice(dependsOn: classes, type: JavaExec) {

View File

@ -18,7 +18,6 @@ package inr.numass.control.cryotemp
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaUtils import hep.dataforge.meta.MetaUtils
import inr.numass.control.NumassControlApplication import inr.numass.control.NumassControlApplication
import javafx.application.Application
import javafx.stage.Stage import javafx.stage.Stage
/** /**
@ -39,9 +38,3 @@ class PKT8App : NumassControlApplication<PKT8Device>() {
.orElseThrow{RuntimeException("Temperature measurement configuration not found")} .orElseThrow{RuntimeException("Temperature measurement configuration not found")}
} }
} }
fun main() {
Application.launch(PKT8App::class.java)
}

View File

@ -251,6 +251,10 @@ class PKT8Device(context: Context, meta: Meta) : PortSensor(context, meta) {
// logger.warn("Trying to start measurement which is already started") // logger.warn("Trying to start measurement which is already started")
// } // }
if(!connected.booleanValue){
logger.info("Not connected, connecting...")
connected.setAndWait(true)
}
logger.info("Starting measurement") logger.info("Starting measurement")

View File

@ -6,7 +6,7 @@ plugins{
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }

View File

@ -6,7 +6,7 @@ plugins{
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }
version = "0.3.0" version = "0.3.0"

View File

@ -5,14 +5,15 @@ plugins{
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }
version = "0.4.0" version = "0.4.0"
application{ if (!hasProperty('mainClass')) {
mainClassName = "inr.numass.control.msp.MspAppKt" ext.mainClass = 'inr.numass.control.msp.MspApp'
} }
mainClassName = mainClass
dependencies { dependencies {

View File

@ -18,7 +18,6 @@ package inr.numass.control.msp
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaUtils import hep.dataforge.meta.MetaUtils
import inr.numass.control.NumassControlApplication import inr.numass.control.NumassControlApplication
import javafx.application.Application
import javafx.stage.Stage import javafx.stage.Stage
/** /**
@ -40,9 +39,3 @@ class MspApp : NumassControlApplication<MspDevice>() {
} }
} }
fun main() {
Application.launch(MspApp::class.java)
}

View File

@ -78,13 +78,13 @@ abstract class DeviceDisplayFX<D : Device> : Component(), Connection {
protected abstract fun buildView(device: D): UIComponent?; protected abstract fun buildView(device: D): UIComponent?;
fun valueStateProperty(stateName: String): ObjectProperty<Value> { fun valueStateProperty(stateName: String): ObjectProperty<Value> {
val state: ValueState = device.states.filterIsInstance<ValueState>().find { it.name == stateName } val state: ValueState = device.states.filterIsInstance(ValueState::class.java).find { it.name == stateName }
?: throw NameNotFoundException("State with name $stateName not found") ?: throw NameNotFoundException("State with name $stateName not found")
return state.asProperty() return state.asProperty()
} }
fun booleanStateProperty(stateName: String): BooleanProperty { fun booleanStateProperty(stateName: String): BooleanProperty {
val state: ValueState = device.states.filterIsInstance<ValueState>().find { it.name == stateName } val state: ValueState = device.states.filterIsInstance(ValueState::class.java).find { it.name == stateName }
?: throw NameNotFoundException("State with name $stateName not found") ?: throw NameNotFoundException("State with name $stateName not found")
return state.asBooleanProperty() return state.asBooleanProperty()
} }

View File

@ -112,20 +112,18 @@ fun EventTarget.deviceStateIndicator(connection: DeviceDisplayFX<*>, state: Stri
fun Node.deviceStateToggle(connection: DeviceDisplayFX<*>, state: String, title: String = state) { fun Node.deviceStateToggle(connection: DeviceDisplayFX<*>, state: String, title: String = state) {
if (connection.device.stateNames.contains(state)) { if (connection.device.stateNames.contains(state)) {
togglebutton(title) { togglebutton(title) {
isSelected = false
selectedProperty().addListener { _, oldValue, newValue -> selectedProperty().addListener { _, oldValue, newValue ->
if (oldValue != newValue) { if (oldValue != newValue) {
connection.device.states[state] = newValue connection.device.states[state] = newValue
} }
} }
connection.valueStateProperty(state).apply { connection.valueStateProperty(state).onChange {
isSelected = value?.boolean ?: false
onChange {
runLater { runLater {
isSelected = it?.boolean ?: false isSelected = it?.boolean ?: false
} }
} }
} }
}
deviceStateIndicator(connection, state, false) deviceStateIndicator(connection, state, false)
} else { } else {
throw RuntimeException("Device does not support state $state"); throw RuntimeException("Device does not support state $state");

View File

@ -5,7 +5,7 @@ plugins{
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }
version = "0.6.0" version = "0.6.0"
@ -15,7 +15,7 @@ dependencies {
} }
application{ application{
mainClassName = "inr.numass.control.readvac.ReadVacKt" mainClassName("inr.numass.control.readvac.ReadVac")
} }
task testDevice(dependsOn: classes, type: JavaExec) { task testDevice(dependsOn: classes, type: JavaExec) {

View File

@ -8,7 +8,6 @@ package inr.numass.control.readvac
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaUtils import hep.dataforge.meta.MetaUtils
import inr.numass.control.NumassControlApplication import inr.numass.control.NumassControlApplication
import javafx.application.Application
import javafx.stage.Stage import javafx.stage.Stage
/** /**
@ -31,9 +30,5 @@ class ReadVac : NumassControlApplication<VacCollectorDevice>() {
} }
} }
fun main() {
Application.launch(ReadVac::class.java)
}

View File

@ -47,10 +47,6 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
private val helper = StorageHelper(this, this::buildLoader) private val helper = StorageHelper(this, this::buildLoader)
init {
states["storing"] = true
}
private val collector = object : DeviceListener { private val collector = object : DeviceListener {
val averagingDuration: Duration = Duration.parse(meta.getString("averagingDuration", "PT30S")) val averagingDuration: Duration = Duration.parse(meta.getString("averagingDuration", "PT30S"))

View File

@ -5,7 +5,7 @@ plugins {
javafx { javafx {
modules = ["javafx.controls", "javafx.web"] modules = ["javafx.controls", "javafx.web"]
version = "16" version = "11"
} }
apply plugin: 'kotlin' apply plugin: 'kotlin'

View File

@ -8,7 +8,7 @@ plugins {
javafx { javafx {
modules = listOf("javafx.graphics", "javafx.controls", "javafx.web") modules = listOf("javafx.graphics", "javafx.controls", "javafx.web")
version = "16" version = "11"
} }
repositories { repositories {