Merge pull request #4922 from YevhenBondarenko/lwm2m-improvements

update fw/sw strategy
This commit is contained in:
Andrew Shvayka 2021-07-19 12:15:28 +03:00 committed by GitHub
commit d991376f44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,6 +174,11 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
attributesToFetch.add(SOFTWARE_URL); attributesToFetch.add(SOFTWARE_URL);
} }
var clientSettings = clientContext.getProfile(client.getProfileId()).getClientLwM2mSettings();
onFirmwareStrategyUpdate(client, clientSettings);
onCurrentSoftwareStrategyUpdate(client, clientSettings);
if (!attributesToFetch.isEmpty()) { if (!attributesToFetch.isEmpty()) {
var future = attributesService.getSharedAttributes(client, attributesToFetch); var future = attributesService.getSharedAttributes(client, attributesToFetch);
DonAsynchron.withCallback(future, attrs -> { DonAsynchron.withCallback(future, attrs -> {
@ -547,7 +552,7 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
if (info == null) { if (info == null) {
var profile = clientContext.getProfile(client.getProfileId()); var profile = clientContext.getProfile(client.getProfileId());
info = new LwM2MClientSwOtaInfo(endpoint, profile.getClientLwM2mSettings().getSwUpdateResource(), info = new LwM2MClientSwOtaInfo(endpoint, profile.getClientLwM2mSettings().getSwUpdateResource(),
LwM2MSoftwareUpdateStrategy.fromStrategySwByCode(profile.getClientLwM2mSettings().getFwUpdateStrategy())); LwM2MSoftwareUpdateStrategy.fromStrategySwByCode(profile.getClientLwM2mSettings().getSwUpdateStrategy()));
update(info); update(info);
} }
return info; return info;