use of il.ac.technion.cs.smarthouse.sensors.Simulatable in project Smartcity-Smarthouse by TechnionYP5777.
the class Entry method main.
public static void main(final String[] args) {
SensorsSimulator simulator = new SensorsSimulator().setGeneralStreamingInteval(TimeUnit.SECONDS.toMillis(5));
SystemPresenterFactory factory = new SystemPresenterFactory().initMode(SystemMode.USER_MODE).enableModePopup(false).setUseCloudServer(false).enableLocalDatabase(false);
new Reflections("il.ac.technion.cs.smarthouse.applications", new SubTypesScanner(false)).getSubTypesOf(SmarthouseApplication.class).forEach(cls -> {
factory.addApplicationToInstall(new ApplicationPath(PathType.CLASS, cls));
if (Simulatable.class.isAssignableFrom(cls))
try {
simulator.addAllSensor(((Simulatable) cls.newInstance()).getSimulatedSensors());
} catch (InstantiationException | IllegalAccessException e) {
// Ignoring
}
});
factory.build();
new Thread() {
@Override
public void interrupt() {
simulator.stopSendingMsgsInAllSensors();
super.interrupt();
}
@Override
public void run() {
simulator.startSendingMsgsInAllSensors();
JavaFxHelper.startGui(new DeveloperSimulatorGui().setSimulator(simulator));
super.run();
}
}.start();
}
Aggregations