[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<Throwable> errorDelegate;
public MspDevice(String name, Context context, Meta config) {
super(name, context, config);
}
// public MspDevice(String name, Context context, Meta config) {
// super(name, context, config);
// }
@Override
public void init() throws ControlException {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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