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) } }