Send DMF message only in case of DMF sim.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-04-11 12:41:16 +02:00
parent 80dde61085
commit 2bf328402c
2 changed files with 8 additions and 2 deletions

View File

@@ -86,8 +86,11 @@ public class SimulationController {
final String deviceId = name + i; final String deviceId = name + i;
repository.add(deviceFactory.createSimulatedDevice(deviceId, tenant, protocol, pollDelay, new URL(endpoint), repository.add(deviceFactory.createSimulatedDevice(deviceId, tenant, protocol, pollDelay, new URL(endpoint),
gatewayToken)); gatewayToken));
if (protocol == Protocol.DMF_AMQP) {
spSenderService.createOrUpdateThing(tenant, deviceId); spSenderService.createOrUpdateThing(tenant, deviceId);
} }
}
return ResponseEntity.ok("Updated " + amount + " DMF connected targets!"); 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.MalformedURLException;
import java.net.URL; import java.net.URL;
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice.Protocol;
import org.eclipse.hawkbit.simulator.amqp.SpSenderService; import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -52,8 +53,10 @@ public class SimulatorStartup implements ApplicationListener<ContextRefreshedEve
LOGGER.error("Creation of simulated device at startup failed.", e); LOGGER.error("Creation of simulated device at startup failed.", e);
} }
if (autostart.getApi() == Protocol.DMF_AMQP) {
spSenderService.createOrUpdateThing(autostart.getTenant(), deviceId); spSenderService.createOrUpdateThing(autostart.getTenant(), deviceId);
} }
}
}); });
} }