Search in sources :

Example 1 with SensorBuilder

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;
}
Also used : SensorsSimulator(il.ac.technion.cs.smarthouse.sensors.simulator.SensorsSimulator) SensorBuilder(il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder)

Example 2 with SensorBuilder

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;
}
Also used : SensorsSimulator(il.ac.technion.cs.smarthouse.sensors.simulator.SensorsSimulator) SensorBuilder(il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder)

Example 3 with SensorBuilder

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();
}
Also used : SensorBuilder(il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder) SystemCore(il.ac.technion.cs.smarthouse.system.SystemCore) SensorsLocalServer(il.ac.technion.cs.smarthouse.system.sensors.SensorsLocalServer) Before(org.junit.Before)

Example 4 with SensorBuilder

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;
}
Also used : SensorsSimulator(il.ac.technion.cs.smarthouse.sensors.simulator.SensorsSimulator) SensorBuilder(il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder)

Example 5 with SensorBuilder

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();
}
Also used : SensorBuilder(il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder) Alert(javafx.scene.control.Alert)

Aggregations

SensorBuilder (il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder)6 SensorsSimulator (il.ac.technion.cs.smarthouse.sensors.simulator.SensorsSimulator)3 SystemCore (il.ac.technion.cs.smarthouse.system.SystemCore)2 Before (org.junit.Before)2 GenericSensor (il.ac.technion.cs.smarthouse.sensors.simulator.GenericSensor)1 FileSystem (il.ac.technion.cs.smarthouse.system.file_system.FileSystem)1 SensorsLocalServer (il.ac.technion.cs.smarthouse.system.sensors.SensorsLocalServer)1 ServiceType (il.ac.technion.cs.smarthouse.system.services.ServiceType)1 SensorApi (il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorApi)1 SensorData (il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorData)1 SensorsService (il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorsService)1 Random (il.ac.technion.cs.smarthouse.utils.Random)1 Alert (javafx.scene.control.Alert)1 After (org.junit.After)1 Assert (org.junit.Assert)1 Test (org.junit.Test)1