[no commit message]

This commit is contained in:
Alexander Nozik 2016-02-15 20:00:19 +03:00
parent 62193839de
commit f3f5af5412
7 changed files with 38 additions and 28 deletions

View File

@ -62,9 +62,9 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
private Consumer<MspResponse> responseDelegate; private Consumer<MspResponse> responseDelegate;
private Consumer<Throwable> errorDelegate; private Consumer<Throwable> errorDelegate;
public MspDevice(String name, Context context, Meta config) { // public MspDevice(String name, Context context, Meta config) {
super(name, context, config); // super(name, context, config);
} // }
@Override @Override
public void init() throws ControlException { public void init() throws ControlException {

View File

@ -151,7 +151,10 @@ public class MspViewController implements Initializable, MspListener {
} }
if (mspConfig != null) { if (mspConfig != null) {
this.device = new MspDevice(mspName, context, mspConfig); this.device = new MspDevice();
device.setName(mspName);
device.setContext(context);
device.setMeta(mspConfig);
try { try {
getDevice().setListener(this); getDevice().setListener(this);
getDevice().init(); getDevice().init();

View File

@ -26,9 +26,9 @@ public class CM32Device extends Sensor<Double> {
private PortHandler handler; private PortHandler handler;
public CM32Device(String name, Context context, Meta meta) { // public CM32Device(String name, Context context, Meta meta) {
super(name, context, meta); // super(name, context, meta);
} // }
public void setHandler(PortHandler handler){ public void setHandler(PortHandler handler){
this.handler = handler; this.handler = handler;

View File

@ -34,9 +34,9 @@ public class MKSVacDevice extends Sensor<Double> {
// private static final String DELIMETER = ";FF"; // private static final String DELIMETER = ";FF";
private PortHandler handler; private PortHandler handler;
public MKSVacDevice(String name, Context context, Meta meta) { // public MKSVacDevice(String name, Context context, Meta meta) {
super(name, context, meta); // super(name, context, meta);
} // }
public void setHandler(PortHandler handler){ public void setHandler(PortHandler handler){
this.handler = handler; this.handler = handler;

View File

@ -30,9 +30,9 @@ public class VITVacDevice extends Sensor<Double> {
private PortHandler handler; private PortHandler handler;
public VITVacDevice(String name, Context context, Meta meta) { // public VITVacDevice(String name, Context context, Meta meta) {
super(name, context, meta); // super(name, context, meta);
} // }
public void setHandler(PortHandler handler) { public void setHandler(PortHandler handler) {
this.handler = handler; this.handler = handler;

View File

@ -17,6 +17,7 @@ import hep.dataforge.exceptions.MeasurementException;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.values.Value; import hep.dataforge.values.Value;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -30,23 +31,29 @@ import java.util.concurrent.TimeUnit;
*/ */
public class VacCollectorDevice extends Sensor<DataPoint> { public class VacCollectorDevice extends Sensor<DataPoint> {
private final Map<String, Sensor> sensorMap; private Map<String, Sensor> sensorMap = new HashMap<>();
/** // /**
* Sensors in reversed order // * Sensors in reversed order
* // *
* @param name // * @param name
* @param context // * @param context
* @param meta // * @param meta
* @param sensors // * @param sensors
*/ // */
public VacCollectorDevice(String name, Context context, Meta meta, Sensor... sensors) { // public VacCollectorDevice(String name, Context context, Meta meta, Sensor... sensors) {
super(name, context, meta); // sensorMap = new LinkedHashMap<>(sensors.length);
// for (Sensor sensor : sensors) {
// sensorMap.put(sensor.getName(), sensor);
// }
// //TODO add automatic construction from meta using deviceManager
// }
public void setSensors(Sensor... sensors){
sensorMap = new LinkedHashMap<>(sensors.length); sensorMap = new LinkedHashMap<>(sensors.length);
for (Sensor sensor : sensors) { for (Sensor sensor : sensors) {
sensorMap.put(sensor.getName(), sensor); sensorMap.put(sensor.getName(), sensor);
} }
//TODO add automatic construction from meta using deviceManager
} }
@Override @Override

View File

@ -45,8 +45,8 @@ public class TestVac extends Application {
.setValue("thickness", 3)) .setValue("thickness", 3))
.build(); .build();
VacCollectorDevice collector = new VacCollectorDevice("collector", VacCollectorDevice collector = new VacCollectorDevice();
GlobalContext.instance(), null, sensor1, sensor2, sensor3, poweredSensor); collector.setSensors(sensor1, sensor2, sensor3, poweredSensor);
collector.init(); collector.init();
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/VacCollector.fxml")); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/VacCollector.fxml"));