Removed sleep.
Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -13,7 +13,6 @@ import java.util.Map;
|
|||||||
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
|
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
|
||||||
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
|
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
|
||||||
import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
|
import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
|
||||||
import org.eclipse.hawkbit.dmf.json.model.ActionStatus;
|
|
||||||
import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
|
import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
|
||||||
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice;
|
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice;
|
||||||
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater;
|
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater;
|
||||||
@@ -139,31 +138,25 @@ public class SpReceiverService extends ReceiverService {
|
|||||||
DownloadAndUpdateRequest.class);
|
DownloadAndUpdateRequest.class);
|
||||||
final Long actionId = downloadAndUpdateRequest.getActionId();
|
final Long actionId = downloadAndUpdateRequest.getActionId();
|
||||||
|
|
||||||
try {
|
deviceUpdater.startUpdate(tenant, thingId, actionId,
|
||||||
Thread.sleep(1_000);
|
downloadAndUpdateRequest.getSoftwareModules().get(0).getModuleVersion(), new UpdaterCallback() {
|
||||||
} catch (final InterruptedException e) {
|
@Override
|
||||||
LOGGER.error("Sleep interrupted", e);
|
public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) {
|
||||||
}
|
switch (device.getResponseStatus()) {
|
||||||
|
case SUCCESSFUL:
|
||||||
spSenderService.sendActionStatusMessage(tenant, ActionStatus.RUNNING,
|
spSenderService.finishUpdateProcess(
|
||||||
"device Simulator retrieved update request. proceeding with simulation.", actionId);
|
new SimulatedUpdate(device.getTenant(), device.getId(), actionId),
|
||||||
deviceUpdater.startUpdate(tenant, thingId, actionId, downloadAndUpdateRequest.getSoftwareModules().get(0)
|
"Simulation complete!");
|
||||||
.getModuleVersion(), new UpdaterCallback() {
|
break;
|
||||||
@Override
|
case ERROR:
|
||||||
public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) {
|
spSenderService.finishUpdateProcessWithError(
|
||||||
switch (device.getResponseStatus()) {
|
new SimulatedUpdate(device.getTenant(), device.getId(), actionId),
|
||||||
case SUCCESSFUL:
|
"Simulation complete with error!");
|
||||||
spSenderService.finishUpdateProcess(new SimulatedUpdate(device.getTenant(), device.getId(),
|
break;
|
||||||
actionId), "Simulation complete!");
|
default:
|
||||||
break;
|
break;
|
||||||
case ERROR:
|
}
|
||||||
spSenderService.finishUpdateProcessWithError(new SimulatedUpdate(device.getTenant(),
|
}
|
||||||
device.getId(), actionId), "Simulation complete with error!");
|
});
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user