Merge pull request #136 from bsinno/ddi-sim-only

Send DMF message only in case of DMF sim.
This commit is contained in:
Michael Hirsch
2016-04-18 08:02:42 +02:00
2 changed files with 8 additions and 2 deletions

View File

@@ -86,7 +86,10 @@ public class SimulationController {
final String deviceId = name + i;
repository.add(deviceFactory.createSimulatedDevice(deviceId, tenant, protocol, pollDelay, new URL(endpoint),
gatewayToken));
spSenderService.createOrUpdateThing(tenant, deviceId);
if (protocol == Protocol.DMF_AMQP) {
spSenderService.createOrUpdateThing(tenant, deviceId);
}
}
return ResponseEntity.ok("Updated " + amount + " DMF connected targets!");

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.simulator;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice.Protocol;
import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,7 +53,9 @@ public class SimulatorStartup implements ApplicationListener<ContextRefreshedEve
LOGGER.error("Creation of simulated device at startup failed.", e);
}
spSenderService.createOrUpdateThing(autostart.getTenant(), deviceId);
if (autostart.getApi() == Protocol.DMF_AMQP) {
spSenderService.createOrUpdateThing(autostart.getTenant(), deviceId);
}
}
});
}