Moving msp to kotlin

This commit is contained in:
Alexander Nozik 2017-06-02 19:32:03 +03:00
commit 203c02bf53
7 changed files with 16 additions and 7 deletions

View File

@ -38,7 +38,7 @@ class BoardController() : Controller(), AutoCloseable {
fun load(app: Application) { fun load(app: Application) {
runAsync { runAsync {
NumassControlUtils.getConfig(app).ifPresent { getConfig(app).ifPresent {
val libDir = File(app.parameters.named.getOrDefault("libPath", "../lib")); val libDir = File(app.parameters.named.getOrDefault("libPath", "../lib"));
val contextBuilder = Context val contextBuilder = Context
.builder("NUMASS-SERVER"); .builder("NUMASS-SERVER");

View File

@ -13,7 +13,7 @@ class ServerApp : App(BoardView::class) {
override fun start(stage: Stage) { override fun start(stage: Stage) {
controller.load(this) controller.load(this)
super.start(stage) super.start(stage)
NumassControlUtils.setDFStageIcon(stage) setDFStageIcon(stage)
} }
override fun stop() { override fun stop() {

View File

@ -47,6 +47,7 @@ import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* A device controller for Dubna PKT 8 cryogenic thermometry device * A device controller for Dubna PKT 8 cryogenic thermometry device
* *

View File

@ -26,6 +26,7 @@ import java.util.function.Predicate
* Created by darksnake on 08-May-17. * Created by darksnake on 08-May-17.
*/ */
val DEFAULT_CONFIG_LOCATION = "./numass-control.xml" val DEFAULT_CONFIG_LOCATION = "./numass-control.xml"
val STORING_STATE = "storing"
val dfIcon: Image = Image(Global::class.java.getResourceAsStream("/img/df.png")) val dfIcon: Image = Image(Global::class.java.getResourceAsStream("/img/df.png"))
/** /**
@ -114,4 +115,3 @@ fun setDFStageIcon(stage: Stage) {
stage.icons.add(dfIcon) stage.icons.add(dfIcon)
} }

View File

@ -22,13 +22,15 @@ import javafx.beans.property.adapter.JavaBeanBooleanPropertyBuilder;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static hep.dataforge.values.ValueType.BOOLEAN;
/** /**
* @author Alexander Nozik * @author Alexander Nozik
*/ */
@ValueDef(name = "address", def = "253") @ValueDef(name = "address", def = "253")
@ValueDef(name = "channel", def = "5") @ValueDef(name = "channel", def = "5")
@ValueDef(name = "powerButton", type = "BOOLEAN", def = "true") @ValueDef(name = "powerButton", type = {BOOLEAN}, def = "true")
@StateDef(name = "power", writable = true, info = "Device powered up") @StateDef(value = @ValueDef(name = "power", info = "Device powered up"), writable = true)
public class MKSVacDevice extends PortSensor<Double> { public class MKSVacDevice extends PortSensor<Double> {
public MKSVacDevice() { public MKSVacDevice() {

View File

@ -21,10 +21,12 @@ import java.math.RoundingMode;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static hep.dataforge.values.ValueType.NUMBER;
/** /**
* @author Alexander Nozik * @author Alexander Nozik
*/ */
@ValueDef(name = "address", type = "NUMBER", def = "1", info = "A modbus address") @ValueDef(name = "address", type = {NUMBER}, def = "1", info = "A modbus address")
public class MeradatVacDevice extends PortSensor<Double> { public class MeradatVacDevice extends PortSensor<Double> {
private static final String REQUEST = "0300000002"; private static final String REQUEST = "0300000002";

View File

@ -16,6 +16,7 @@ import hep.dataforge.control.devices.Sensor;
import hep.dataforge.control.devices.StateDef; import hep.dataforge.control.devices.StateDef;
import hep.dataforge.control.measurements.AbstractMeasurement; import hep.dataforge.control.measurements.AbstractMeasurement;
import hep.dataforge.control.measurements.Measurement; import hep.dataforge.control.measurements.Measurement;
import hep.dataforge.description.ValueDef;
import hep.dataforge.exceptions.ControlException; import hep.dataforge.exceptions.ControlException;
import hep.dataforge.exceptions.MeasurementException; import hep.dataforge.exceptions.MeasurementException;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
@ -45,7 +46,10 @@ import static hep.dataforge.control.devices.PortSensor.CONNECTED_STATE;
* @author <a href="mailto:altavir@gmail.com">Alexander Nozik</a> * @author <a href="mailto:altavir@gmail.com">Alexander Nozik</a>
*/ */
@RoleDef(name = Roles.STORAGE_ROLE, objectType = StorageConnection.class, info = "Storage for acquired points") @RoleDef(name = Roles.STORAGE_ROLE, objectType = StorageConnection.class, info = "Storage for acquired points")
@StateDef(name = "storing", writable = true, info = "Define if this device is currently writes to storage") @StateDef(
value = @ValueDef(name = "storing", info = "Define if this device is currently writes to storage"),
writable = true
)
public class VacCollectorDevice extends Sensor<DataPoint> { public class VacCollectorDevice extends Sensor<DataPoint> {
private Map<String, Sensor<Double>> sensorMap = new LinkedHashMap<>(); private Map<String, Sensor<Double>> sensorMap = new LinkedHashMap<>();