JDK update new vacuum controller
This commit is contained in:
parent
e549bad998
commit
aa25ca5674
@ -47,7 +47,7 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
|
||||
|
||||
private val helper = StorageHelper(this, this::buildLoader)
|
||||
|
||||
private val collector = object : DeviceListener, Connection {
|
||||
private val collector = object : DeviceListener {
|
||||
val averagingDuration: Duration = Duration.parse(meta.getString("averagingDuration", "PT30S"))
|
||||
|
||||
private val collector = RegularPointCollector(averagingDuration) {
|
||||
@ -56,7 +56,7 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
|
||||
|
||||
override fun notifyStateChanged(device: Device, name: String, state: Any) {
|
||||
if (name == MEASUREMENT_RESULT_STATE) {
|
||||
collector.put(device.name, (state as Meta).getValue("value"))
|
||||
collector.put(device.name, (state as Meta).getValue(RESULT_VALUE))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -70,11 +70,11 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
|
||||
|
||||
|
||||
override fun init() {
|
||||
super.init()
|
||||
for (s in sensors) {
|
||||
s.init()
|
||||
s.connect(collector, Roles.DEVICE_LISTENER_ROLE)
|
||||
}
|
||||
super.init()
|
||||
}
|
||||
|
||||
override val type: String
|
||||
|
@ -5,13 +5,13 @@
|
||||
*/
|
||||
package inr.numass.control.readvac
|
||||
|
||||
import hep.dataforge.connections.Connection
|
||||
import hep.dataforge.control.connections.Roles
|
||||
import hep.dataforge.control.devices.Device
|
||||
import hep.dataforge.control.devices.DeviceListener
|
||||
import hep.dataforge.control.devices.Sensor
|
||||
import hep.dataforge.control.measurements.Measurement
|
||||
import hep.dataforge.control.measurements.MeasurementListener
|
||||
import hep.dataforge.fx.bindWindow
|
||||
import hep.dataforge.fx.fragments.LogFragment
|
||||
import hep.dataforge.meta.Meta
|
||||
import hep.dataforge.plots.PlotGroup
|
||||
import hep.dataforge.plots.data.TimePlot
|
||||
import hep.dataforge.values.Value
|
||||
@ -24,7 +24,6 @@ import javafx.geometry.Orientation
|
||||
import javafx.scene.control.ScrollPane
|
||||
import javafx.scene.layout.Priority
|
||||
import tornadofx.*
|
||||
import java.time.Instant
|
||||
|
||||
/**
|
||||
* A view controller for Vac collector
|
||||
@ -35,16 +34,13 @@ class VacCollectorDisplay : DeviceDisplayFX<VacCollectorDevice>() {
|
||||
|
||||
private val table = FXCollections.observableHashMap<String, Double>()
|
||||
|
||||
private val sensorConnection = object : MeasurementListener, Connection {
|
||||
override fun onMeasurementResult(measurement: Measurement<*>, result: Any, time: Instant?) {
|
||||
if (result is Double) {
|
||||
table[measurement.device.name] = result;
|
||||
private val sensorConnection = object : DeviceListener {
|
||||
|
||||
override fun notifyStateChanged(device: Device, name: String, state: Any) {
|
||||
if (name == Sensor.MEASUREMENT_RESULT_STATE) {
|
||||
table[device.name] = (state as Meta).getDouble(Sensor.RESULT_VALUE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMeasurementFailed(measurement: Measurement<*>?, exception: Throwable?) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private val viewList = FXCollections.observableArrayList<VacDisplay>();
|
||||
@ -58,7 +54,7 @@ class VacCollectorDisplay : DeviceDisplayFX<VacCollectorDevice>() {
|
||||
device.sensors.forEach { sensor ->
|
||||
val view = VacDisplay()
|
||||
sensor.connect(view, Roles.VIEW_ROLE, Roles.DEVICE_LISTENER_ROLE)
|
||||
sensor.connect(sensorConnection, Roles.MEASUREMENT_LISTENER_ROLE);
|
||||
sensor.connect(sensorConnection, Roles.DEVICE_LISTENER_ROLE)
|
||||
viewList.add(view)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user