From 19ab4f498a1a78fe72ec345a7f910a0dc9b92f5e Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Fri, 26 Nov 2021 11:12:31 +0200 Subject: [PATCH] lwm2m - info about previous update Ota --- .../server/ota/DefaultLwM2MOtaUpdateService.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java index 050929c470..66903d8812 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java @@ -399,12 +399,12 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl log.debug("[{}] Starting update to [{}{}] using binary", client.getEndpoint(), fwInfo.getTargetName(), fwInfo.getTargetVersion()); startUpdateUsingBinary(client, fwInfo); } - } else if (fwInfo.updateState != null) { - log.debug("[{}] failed to process firmware update: [{}]. Previous update failed.", client.getEndpoint(), fwInfo); - logService.log(client, "Failed to process firmware update: " + fwInfo + ". Previous update failed."); + } else if (fwInfo.getResult() != null && fwInfo.getResult().getCode() > 1) { + log.trace("[{}] Previous update failed. [{}]", client.getEndpoint(), fwInfo); + logService.log(client, "Previous update firmware failed. Result: " + fwInfo.getResult().name()); } } catch (Exception e) { - log.info("[{}] failed to update client: {}", client.getEndpoint(), fwInfo, e); + log.error("[{}] failed to update client: {}", client.getEndpoint(), fwInfo, e); sendStateUpdateToTelemetry(client, fwInfo, OtaPackageUpdateStatus.FAILED, "Internal server error: " + e.getMessage()); } } @@ -427,9 +427,9 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl startUpdateUsingBinary(client, swInfo); } } - } else if (swInfo.updateState != null) { - log.debug("[{}] failed to update client: [{}], previous update failed.", client.getEndpoint(), swInfo); - logService.log(client, "Failed to process software update: " + swInfo + ". Previous update failed."); + } else if (swInfo.getResult() != null && swInfo.getResult().code >= 50) { + log.trace("[{}] Previous update failed. [{}]", client.getEndpoint(), swInfo); + logService.log(client, "Previous update software failed. Result: " + swInfo.getResult().name()); } } catch (Exception e) { log.info("[{}] failed to update client: {}", client.getEndpoint(), swInfo, e);