From aa25ca56743a1b29e318bc6a6033e5adc630e01f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 18 Nov 2019 17:04:27 +0300 Subject: [PATCH] JDK update new vacuum controller --- .../control/readvac/VacCollectorDevice.kt | 6 ++--- .../control/readvac/VacCollectorDisplay.kt | 22 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorDevice.kt b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorDevice.kt index 6d3acd5f..b8c271ec 100644 --- a/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorDevice.kt +++ b/numass-control/vac/src/main/kotlin/inr/numass/control/readvac/VacCollectorDevice.kt @@ -47,7 +47,7 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection() { private val table = FXCollections.observableHashMap() - 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(); @@ -58,7 +54,7 @@ class VacCollectorDisplay : DeviceDisplayFX() { 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) } }