use of il.ac.technion.cs.smarthouse.sensors.sos.SosSensor in project Smartcity-Smarthouse by TechnionYP5777.
the class SosSensorSimulator method start.
@Override
public void start(final Stage s) throws Exception {
sensor = new SosSensor(Random.sensorId(), 40001);
for (boolean res = false; !res; ) res = sensor.register();
final Image sosImage = new Image(getClass().getResourceAsStream("/sensors/sos/sos_icon.png"), 320, 0, true, true);
final Button sosButton = new Button();
sosButton.setId("sosButton");
sosButton.setGraphic(new ImageView(sosImage));
sosButton.setStyle("-fx-focus-color: transparent;");
sosButton.setOnAction(event -> sensor.updateSystem());
final StackPane layout = new StackPane();
layout.getChildren().add(sosButton);
s.setScene(new Scene(layout, 320, 268));
s.setTitle("SOS Sensor Simulator");
s.show();
}