Browse Source
Merge pull request #5466 from thingsboard/lwm2m_fix_bug_update_fw
[3.3.2]lwm2m - fix bug info if first update Fw/Sw - failed
pull/5249/head
Yevhen Bondarenko
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
2 deletions
-
common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportCoapResource.java
-
common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java
|
|
|
@ -138,8 +138,8 @@ public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource { |
|
|
|
UUID currentId = UUID.fromString(idStr); |
|
|
|
Response response = new Response(CoAP.ResponseCode.CONTENT); |
|
|
|
byte[] otaData = this.getOtaData(currentId); |
|
|
|
log.debug("Read ota data (length): [{}]", otaData.length); |
|
|
|
if (otaData.length > 0) { |
|
|
|
if (otaData != null && otaData.length > 0) { |
|
|
|
log.debug("Read ota data (length): [{}]", otaData.length); |
|
|
|
response.setPayload(otaData); |
|
|
|
if (exchange.getRequestOptions().getBlock2() != null) { |
|
|
|
int chunkSize = exchange.getRequestOptions().getBlock2().getSzx(); |
|
|
|
@ -150,6 +150,8 @@ public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource { |
|
|
|
log.trace("With block1 Send currentId: [{}], length: [{}], ", currentId.toString(), otaData.length); |
|
|
|
} |
|
|
|
exchange.respond(response); |
|
|
|
} else { |
|
|
|
log.trace("Ota packaged currentId: [{}] is not found.", currentId.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -399,6 +399,9 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl |
|
|
|
log.debug("[{}] Starting update to [{}{}] using binary", client.getEndpoint(), fwInfo.getTargetName(), fwInfo.getTargetVersion()); |
|
|
|
startUpdateUsingBinary(client, fwInfo); |
|
|
|
} |
|
|
|
} else { |
|
|
|
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."); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("[{}] failed to update client: {}", client.getEndpoint(), fwInfo, e); |
|
|
|
@ -424,6 +427,9 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl |
|
|
|
startUpdateUsingBinary(client, swInfo); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
log.debug("[{}] failed to update client: [{}], previous update failed.", client.getEndpoint(), swInfo); |
|
|
|
logService.log(client, "Failed to process software update: " + swInfo + ". Previous update failed."); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("[{}] failed to update client: {}", client.getEndpoint(), swInfo, e); |
|
|
|
|