use of il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder in project Smartcity-Smarthouse by TechnionYP5777.
the class VitalsApp method initSimulator.
private static SensorsSimulator initSimulator() {
final String pulsePath = "vitals" + PathBuilder.DELIMITER + "pulse", sysBPPath = "vitals" + PathBuilder.DELIMITER + "systolicBP", diBPPath = "vitals" + PathBuilder.DELIMITER + "diastolicBP";
SensorsSimulator s = new SensorsSimulator();
s.addSensor(new SensorBuilder().setCommname("iVitals").setAlias("Yarden's vitals sensor").addInfoSendingPath(pulsePath, Integer.class).addStreamingRange(pulsePath, Arrays.asList(80, 100)).addInfoSendingPath(sysBPPath, Integer.class).addStreamingRange(sysBPPath, Arrays.asList(100, 130)).addInfoSendingPath(diBPPath, Integer.class).addStreamingRange(diBPPath, Arrays.asList(30, 40)).setStreamInterval(TimeUnit.SECONDS.toMillis(1)).build());
return s;
}
use of il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder in project Smartcity-Smarthouse by TechnionYP5777.
the class SosAppGui method initSimulator.
private static SensorsSimulator initSimulator() {
final String path = "sos" + PathBuilder.DELIMITER + "pressed";
SensorsSimulator s = new SensorsSimulator();
s.addSensor(new SensorBuilder().setCommname("iSOS").setAlias("Elia's sos sensor").addInfoSendingPath(path, Boolean.class).addStreamingRange(path, Arrays.asList(true)).setStreamInterval(TimeUnit.MINUTES.toMillis(3)).build());
return s;
}
use of il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder in project Smartcity-Smarthouse by TechnionYP5777.
the class GenericSensorTest method init.
@Before
public void init() {
builder = new SensorBuilder().setCommname("testComm").setAlias("testAlias");
systemCore = new SystemCore();
server = new SensorsLocalServer(systemCore.getFileSystem());
new Thread(server).start();
}
use of il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder in project Smartcity-Smarthouse by TechnionYP5777.
the class StoveModuleGui method initSimulator.
private static SensorsSimulator initSimulator() {
final String onPath = "stove" + PathBuilder.DELIMITER + "is_on", temperPath = "stove" + PathBuilder.DELIMITER + "temperature";
SensorsSimulator s = new SensorsSimulator();
s.addSensor(new SensorBuilder().setCommname("iStoves").setAlias("Roy's awesome stove").addInfoSendingPath(onPath, Boolean.class).addInfoSendingPath(temperPath, Integer.class).addStreamingRange(onPath, Arrays.asList(true)).addStreamingRange(temperPath, Arrays.asList(0, 140)).setStreamInterval(1000L).build());
return s;
}
use of il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder in project Smartcity-Smarthouse by TechnionYP5777.
the class ConfigurationWindowController method saveNewSensor.
private void saveNewSensor() {
String commercialName = commName.getText(), aliasName = alias.getText();
final Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error Dialog");
alert.setHeaderText("Invalid Input Paramaters");
if ("".equals(commercialName)) {
alert.setContentText("Commercial Name cant be empty.");
alert.showAndWait();
return;
}
if (this.getModel().checkCommNameExists(commercialName)) {
alert.setContentText("Commercial Name allready exists! if you want another instance of this sensor use the clone button.");
alert.showAndWait();
return;
}
if ("".equals(aliasName)) {
alert.setContentText("Alias cant be empty.");
alert.showAndWait();
return;
}
if (typesList.isEmpty()) {
alert.setContentText("Sensor must have at least one path.");
alert.showAndWait();
return;
}
SensorBuilder b = new SensorBuilder();
b.setAlias(aliasName);
b.setCommname(commercialName);
this.typesList.forEach(x -> b.addInfoSendingPath(x.getKey(), x.getValue()));
this.getModel().addSensor(b.build());
alias.clear();
commName.clear();
addNameField.clear();
addTypeField.getSelectionModel().clearSelection();
addTypeField.setValue(null);
typesList = FXCollections.observableArrayList();
fieldsTable.setItems(typesList);
((DeveloperSimulatorController) this.getParentController()).moveToSensorsList();
}
Aggregations