Commit c9fbe74321ac3d4638d239b6205ccfe8c12419bb

Authored by YevhenBondarenko
1 parent 2af3be78

Used OtaPackage tag for FW/SW updates

@@ -64,6 +64,7 @@ import static org.thingsboard.server.common.data.ota.OtaPackageKey.CHECKSUM; @@ -64,6 +64,7 @@ import static org.thingsboard.server.common.data.ota.OtaPackageKey.CHECKSUM;
64 import static org.thingsboard.server.common.data.ota.OtaPackageKey.CHECKSUM_ALGORITHM; 64 import static org.thingsboard.server.common.data.ota.OtaPackageKey.CHECKSUM_ALGORITHM;
65 import static org.thingsboard.server.common.data.ota.OtaPackageKey.SIZE; 65 import static org.thingsboard.server.common.data.ota.OtaPackageKey.SIZE;
66 import static org.thingsboard.server.common.data.ota.OtaPackageKey.STATE; 66 import static org.thingsboard.server.common.data.ota.OtaPackageKey.STATE;
  67 +import static org.thingsboard.server.common.data.ota.OtaPackageKey.TAG;
67 import static org.thingsboard.server.common.data.ota.OtaPackageKey.TITLE; 68 import static org.thingsboard.server.common.data.ota.OtaPackageKey.TITLE;
68 import static org.thingsboard.server.common.data.ota.OtaPackageKey.TS; 69 import static org.thingsboard.server.common.data.ota.OtaPackageKey.TS;
69 import static org.thingsboard.server.common.data.ota.OtaPackageKey.URL; 70 import static org.thingsboard.server.common.data.ota.OtaPackageKey.URL;
@@ -246,6 +247,11 @@ public class DefaultOtaPackageStateService implements OtaPackageStateService { @@ -246,6 +247,11 @@ public class DefaultOtaPackageStateService implements OtaPackageStateService {
246 List<TsKvEntry> telemetry = new ArrayList<>(); 247 List<TsKvEntry> telemetry = new ArrayList<>();
247 telemetry.add(new BasicTsKvEntry(ts, new StringDataEntry(getTargetTelemetryKey(firmware.getType(), TITLE), firmware.getTitle()))); 248 telemetry.add(new BasicTsKvEntry(ts, new StringDataEntry(getTargetTelemetryKey(firmware.getType(), TITLE), firmware.getTitle())));
248 telemetry.add(new BasicTsKvEntry(ts, new StringDataEntry(getTargetTelemetryKey(firmware.getType(), VERSION), firmware.getVersion()))); 249 telemetry.add(new BasicTsKvEntry(ts, new StringDataEntry(getTargetTelemetryKey(firmware.getType(), VERSION), firmware.getVersion())));
  250 +
  251 + if (StringUtils.isNotEmpty(firmware.getTag())) {
  252 + telemetry.add(new BasicTsKvEntry(ts, new StringDataEntry(getTargetTelemetryKey(firmware.getType(), TAG), firmware.getTag())));
  253 + }
  254 +
249 telemetry.add(new BasicTsKvEntry(ts, new LongDataEntry(getTargetTelemetryKey(firmware.getType(), TS), ts))); 255 telemetry.add(new BasicTsKvEntry(ts, new LongDataEntry(getTargetTelemetryKey(firmware.getType(), TS), ts)));
250 telemetry.add(new BasicTsKvEntry(ts, new StringDataEntry(getTelemetryKey(firmware.getType(), STATE), OtaPackageUpdateStatus.QUEUED.name()))); 256 telemetry.add(new BasicTsKvEntry(ts, new StringDataEntry(getTelemetryKey(firmware.getType(), STATE), OtaPackageUpdateStatus.QUEUED.name())));
251 257
@@ -289,6 +295,9 @@ public class DefaultOtaPackageStateService implements OtaPackageStateService { @@ -289,6 +295,9 @@ public class DefaultOtaPackageStateService implements OtaPackageStateService {
289 List<AttributeKvEntry> attributes = new ArrayList<>(); 295 List<AttributeKvEntry> attributes = new ArrayList<>();
290 attributes.add(new BaseAttributeKvEntry(ts, new StringDataEntry(getAttributeKey(otaPackageType, TITLE), otaPackage.getTitle()))); 296 attributes.add(new BaseAttributeKvEntry(ts, new StringDataEntry(getAttributeKey(otaPackageType, TITLE), otaPackage.getTitle())));
291 attributes.add(new BaseAttributeKvEntry(ts, new StringDataEntry(getAttributeKey(otaPackageType, VERSION), otaPackage.getVersion()))); 297 attributes.add(new BaseAttributeKvEntry(ts, new StringDataEntry(getAttributeKey(otaPackageType, VERSION), otaPackage.getVersion())));
  298 + if (StringUtils.isNotEmpty(otaPackage.getTag())) {
  299 + attributes.add(new BaseAttributeKvEntry(ts, new StringDataEntry(getAttributeKey(otaPackageType, TAG), otaPackage.getTag())));
  300 + }
292 if (otaPackage.hasUrl()) { 301 if (otaPackage.hasUrl()) {
293 attributes.add(new BaseAttributeKvEntry(ts, new StringDataEntry(getAttributeKey(otaPackageType, URL), otaPackage.getUrl()))); 302 attributes.add(new BaseAttributeKvEntry(ts, new StringDataEntry(getAttributeKey(otaPackageType, URL), otaPackage.getUrl())));
294 List<String> attrToRemove = new ArrayList<>(); 303 List<String> attrToRemove = new ArrayList<>();
@@ -19,7 +19,7 @@ import lombok.Getter; @@ -19,7 +19,7 @@ import lombok.Getter;
19 19
20 public enum OtaPackageKey { 20 public enum OtaPackageKey {
21 21
22 - TITLE("title"), VERSION("version"), TS("ts"), STATE("state"), SIZE("size"), CHECKSUM("checksum"), CHECKSUM_ALGORITHM("checksum_algorithm"), URL("url"); 22 + TITLE("title"), VERSION("version"), TS("ts"), STATE("state"), SIZE("size"), CHECKSUM("checksum"), CHECKSUM_ALGORITHM("checksum_algorithm"), URL("url"), TAG("tag");
23 23
24 @Getter 24 @Getter
25 private final String value; 25 private final String value;
@@ -120,9 +120,11 @@ public class DefaultLwM2MAttributesService implements LwM2MAttributesService { @@ -120,9 +120,11 @@ public class DefaultLwM2MAttributesService implements LwM2MAttributesService {
120 if (msg.getSharedUpdatedCount() > 0 && lwM2MClient != null) { 120 if (msg.getSharedUpdatedCount() > 0 && lwM2MClient != null) {
121 String newFirmwareTitle = null; 121 String newFirmwareTitle = null;
122 String newFirmwareVersion = null; 122 String newFirmwareVersion = null;
  123 + String newFirmwareTag = null;
123 String newFirmwareUrl = null; 124 String newFirmwareUrl = null;
124 String newSoftwareTitle = null; 125 String newSoftwareTitle = null;
125 String newSoftwareVersion = null; 126 String newSoftwareVersion = null;
  127 + String newSoftwareTag = null;
126 String newSoftwareUrl = null; 128 String newSoftwareUrl = null;
127 List<TransportProtos.TsKvProto> otherAttributes = new ArrayList<>(); 129 List<TransportProtos.TsKvProto> otherAttributes = new ArrayList<>();
128 for (TransportProtos.TsKvProto tsKvProto : msg.getSharedUpdatedList()) { 130 for (TransportProtos.TsKvProto tsKvProto : msg.getSharedUpdatedList()) {
@@ -131,12 +133,16 @@ public class DefaultLwM2MAttributesService implements LwM2MAttributesService { @@ -131,12 +133,16 @@ public class DefaultLwM2MAttributesService implements LwM2MAttributesService {
131 newFirmwareTitle = getStrValue(tsKvProto); 133 newFirmwareTitle = getStrValue(tsKvProto);
132 } else if (DefaultLwM2MOtaUpdateService.FIRMWARE_VERSION.equals(attrName)) { 134 } else if (DefaultLwM2MOtaUpdateService.FIRMWARE_VERSION.equals(attrName)) {
133 newFirmwareVersion = getStrValue(tsKvProto); 135 newFirmwareVersion = getStrValue(tsKvProto);
  136 + } else if (DefaultLwM2MOtaUpdateService.FIRMWARE_TAG.equals(attrName)) {
  137 + newFirmwareTag = getStrValue(tsKvProto);
134 } else if (DefaultLwM2MOtaUpdateService.FIRMWARE_URL.equals(attrName)) { 138 } else if (DefaultLwM2MOtaUpdateService.FIRMWARE_URL.equals(attrName)) {
135 newFirmwareUrl = getStrValue(tsKvProto); 139 newFirmwareUrl = getStrValue(tsKvProto);
136 } else if (DefaultLwM2MOtaUpdateService.SOFTWARE_TITLE.equals(attrName)) { 140 } else if (DefaultLwM2MOtaUpdateService.SOFTWARE_TITLE.equals(attrName)) {
137 newSoftwareTitle = getStrValue(tsKvProto); 141 newSoftwareTitle = getStrValue(tsKvProto);
138 } else if (DefaultLwM2MOtaUpdateService.SOFTWARE_VERSION.equals(attrName)) { 142 } else if (DefaultLwM2MOtaUpdateService.SOFTWARE_VERSION.equals(attrName)) {
139 newSoftwareVersion = getStrValue(tsKvProto); 143 newSoftwareVersion = getStrValue(tsKvProto);
  144 + } else if (DefaultLwM2MOtaUpdateService.SOFTWARE_TAG.equals(attrName)) {
  145 + newSoftwareTag = getStrValue(tsKvProto);
140 } else if (DefaultLwM2MOtaUpdateService.SOFTWARE_URL.equals(attrName)) { 146 } else if (DefaultLwM2MOtaUpdateService.SOFTWARE_URL.equals(attrName)) {
141 newSoftwareUrl = getStrValue(tsKvProto); 147 newSoftwareUrl = getStrValue(tsKvProto);
142 }else { 148 }else {
@@ -144,10 +150,10 @@ public class DefaultLwM2MAttributesService implements LwM2MAttributesService { @@ -144,10 +150,10 @@ public class DefaultLwM2MAttributesService implements LwM2MAttributesService {
144 } 150 }
145 } 151 }
146 if (newFirmwareTitle != null || newFirmwareVersion != null) { 152 if (newFirmwareTitle != null || newFirmwareVersion != null) {
147 - otaUpdateService.onTargetFirmwareUpdate(lwM2MClient, newFirmwareTitle, newFirmwareVersion, Optional.ofNullable(newFirmwareUrl)); 153 + otaUpdateService.onTargetFirmwareUpdate(lwM2MClient, newFirmwareTitle, newFirmwareVersion, Optional.ofNullable(newFirmwareUrl), Optional.ofNullable(newFirmwareTag));
148 } 154 }
149 if (newSoftwareTitle != null || newSoftwareVersion != null) { 155 if (newSoftwareTitle != null || newSoftwareVersion != null) {
150 - otaUpdateService.onTargetSoftwareUpdate(lwM2MClient, newSoftwareTitle, newSoftwareVersion, Optional.ofNullable(newSoftwareUrl)); 156 + otaUpdateService.onTargetSoftwareUpdate(lwM2MClient, newSoftwareTitle, newSoftwareVersion, Optional.ofNullable(newSoftwareUrl), Optional.ofNullable(newSoftwareTag));
151 } 157 }
152 if (!otherAttributes.isEmpty()) { 158 if (!otherAttributes.isEmpty()) {
153 onAttributesUpdate(lwM2MClient, otherAttributes); 159 onAttributesUpdate(lwM2MClient, otherAttributes);
@@ -85,9 +85,11 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl @@ -85,9 +85,11 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
85 85
86 public static final String FIRMWARE_VERSION = getAttributeKey(OtaPackageType.FIRMWARE, OtaPackageKey.VERSION); 86 public static final String FIRMWARE_VERSION = getAttributeKey(OtaPackageType.FIRMWARE, OtaPackageKey.VERSION);
87 public static final String FIRMWARE_TITLE = getAttributeKey(OtaPackageType.FIRMWARE, OtaPackageKey.TITLE); 87 public static final String FIRMWARE_TITLE = getAttributeKey(OtaPackageType.FIRMWARE, OtaPackageKey.TITLE);
  88 + public static final String FIRMWARE_TAG = getAttributeKey(OtaPackageType.FIRMWARE, OtaPackageKey.TAG);
88 public static final String FIRMWARE_URL = getAttributeKey(OtaPackageType.FIRMWARE, OtaPackageKey.URL); 89 public static final String FIRMWARE_URL = getAttributeKey(OtaPackageType.FIRMWARE, OtaPackageKey.URL);
89 public static final String SOFTWARE_VERSION = getAttributeKey(OtaPackageType.SOFTWARE, OtaPackageKey.VERSION); 90 public static final String SOFTWARE_VERSION = getAttributeKey(OtaPackageType.SOFTWARE, OtaPackageKey.VERSION);
90 public static final String SOFTWARE_TITLE = getAttributeKey(OtaPackageType.SOFTWARE, OtaPackageKey.TITLE); 91 public static final String SOFTWARE_TITLE = getAttributeKey(OtaPackageType.SOFTWARE, OtaPackageKey.TITLE);
  92 + public static final String SOFTWARE_TAG = getAttributeKey(OtaPackageType.SOFTWARE, OtaPackageKey.TAG);
91 public static final String SOFTWARE_URL = getAttributeKey(OtaPackageType.SOFTWARE, OtaPackageKey.URL); 93 public static final String SOFTWARE_URL = getAttributeKey(OtaPackageType.SOFTWARE, OtaPackageKey.URL);
92 94
93 public static final String FIRMWARE_UPDATE_COAP_RESOURCE = "tbfw"; 95 public static final String FIRMWARE_UPDATE_COAP_RESOURCE = "tbfw";
@@ -165,6 +167,7 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl @@ -165,6 +167,7 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
165 if (fwInfo.isSupported()) { 167 if (fwInfo.isSupported()) {
166 attributesToFetch.add(FIRMWARE_TITLE); 168 attributesToFetch.add(FIRMWARE_TITLE);
167 attributesToFetch.add(FIRMWARE_VERSION); 169 attributesToFetch.add(FIRMWARE_VERSION);
  170 + attributesToFetch.add(FIRMWARE_TAG);
168 attributesToFetch.add(FIRMWARE_URL); 171 attributesToFetch.add(FIRMWARE_URL);
169 } 172 }
170 173
@@ -172,6 +175,7 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl @@ -172,6 +175,7 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
172 if (swInfo.isSupported()) { 175 if (swInfo.isSupported()) {
173 attributesToFetch.add(SOFTWARE_TITLE); 176 attributesToFetch.add(SOFTWARE_TITLE);
174 attributesToFetch.add(SOFTWARE_VERSION); 177 attributesToFetch.add(SOFTWARE_VERSION);
  178 + attributesToFetch.add(SOFTWARE_TAG);
175 attributesToFetch.add(SOFTWARE_URL); 179 attributesToFetch.add(SOFTWARE_URL);
176 } 180 }
177 181
@@ -186,17 +190,19 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl @@ -186,17 +190,19 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
186 if (fwInfo.isSupported()) { 190 if (fwInfo.isSupported()) {
187 Optional<String> newFwTitle = getAttributeValue(attrs, FIRMWARE_TITLE); 191 Optional<String> newFwTitle = getAttributeValue(attrs, FIRMWARE_TITLE);
188 Optional<String> newFwVersion = getAttributeValue(attrs, FIRMWARE_VERSION); 192 Optional<String> newFwVersion = getAttributeValue(attrs, FIRMWARE_VERSION);
  193 + Optional<String> newFwTag = getAttributeValue(attrs, FIRMWARE_TAG);
189 Optional<String> newFwUrl = getAttributeValue(attrs, FIRMWARE_URL); 194 Optional<String> newFwUrl = getAttributeValue(attrs, FIRMWARE_URL);
190 if (newFwTitle.isPresent() && newFwVersion.isPresent()) { 195 if (newFwTitle.isPresent() && newFwVersion.isPresent()) {
191 - onTargetFirmwareUpdate(client, newFwTitle.get(), newFwVersion.get(), newFwUrl); 196 + onTargetFirmwareUpdate(client, newFwTitle.get(), newFwVersion.get(), newFwUrl, newFwTag);
192 } 197 }
193 } 198 }
194 if (swInfo.isSupported()) { 199 if (swInfo.isSupported()) {
195 Optional<String> newSwTitle = getAttributeValue(attrs, SOFTWARE_TITLE); 200 Optional<String> newSwTitle = getAttributeValue(attrs, SOFTWARE_TITLE);
196 Optional<String> newSwVersion = getAttributeValue(attrs, SOFTWARE_VERSION); 201 Optional<String> newSwVersion = getAttributeValue(attrs, SOFTWARE_VERSION);
  202 + Optional<String> newSwTag = getAttributeValue(attrs, SOFTWARE_TAG);
197 Optional<String> newSwUrl = getAttributeValue(attrs, SOFTWARE_URL); 203 Optional<String> newSwUrl = getAttributeValue(attrs, SOFTWARE_URL);
198 if (newSwTitle.isPresent() && newSwVersion.isPresent()) { 204 if (newSwTitle.isPresent() && newSwVersion.isPresent()) {
199 - onTargetSoftwareUpdate(client, newSwTitle.get(), newSwVersion.get(), newSwUrl); 205 + onTargetSoftwareUpdate(client, newSwTitle.get(), newSwVersion.get(), newSwUrl, newSwTag);
200 } 206 }
201 } 207 }
202 }, throwable -> { 208 }, throwable -> {
@@ -216,9 +222,9 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl @@ -216,9 +222,9 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
216 } 222 }
217 223
218 @Override 224 @Override
219 - public void onTargetFirmwareUpdate(LwM2mClient client, String newFirmwareTitle, String newFirmwareVersion, Optional<String> newFirmwareUrl) { 225 + public void onTargetFirmwareUpdate(LwM2mClient client, String newFirmwareTitle, String newFirmwareVersion, Optional<String> newFirmwareUrl, Optional<String> newFirmwareTag) {
220 LwM2MClientFwOtaInfo fwInfo = getOrInitFwInfo(client); 226 LwM2MClientFwOtaInfo fwInfo = getOrInitFwInfo(client);
221 - fwInfo.updateTarget(newFirmwareTitle, newFirmwareVersion, newFirmwareUrl); 227 + fwInfo.updateTarget(newFirmwareTitle, newFirmwareVersion, newFirmwareUrl, newFirmwareTag);
222 update(fwInfo); 228 update(fwInfo);
223 startFirmwareUpdateIfNeeded(client, fwInfo); 229 startFirmwareUpdateIfNeeded(client, fwInfo);
224 } 230 }
@@ -354,9 +360,9 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl @@ -354,9 +360,9 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
354 } 360 }
355 361
356 @Override 362 @Override
357 - public void onTargetSoftwareUpdate(LwM2mClient client, String newSoftwareTitle, String newSoftwareVersion, Optional<String> newFirmwareUrl) { 363 + public void onTargetSoftwareUpdate(LwM2mClient client, String newSoftwareTitle, String newSoftwareVersion, Optional<String> newSoftwareUrl, Optional<String> newSoftwareTag) {
358 LwM2MClientSwOtaInfo fwInfo = getOrInitSwInfo(client); 364 LwM2MClientSwOtaInfo fwInfo = getOrInitSwInfo(client);
359 - fwInfo.updateTarget(newSoftwareTitle, newSoftwareVersion, newFirmwareUrl); 365 + fwInfo.updateTarget(newSoftwareTitle, newSoftwareVersion, newSoftwareUrl, newSoftwareTag);
360 update(fwInfo); 366 update(fwInfo);
361 startSoftwareUpdateIfNeeded(client, fwInfo); 367 startSoftwareUpdateIfNeeded(client, fwInfo);
362 } 368 }
@@ -368,7 +374,7 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl @@ -368,7 +374,7 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
368 sendStateUpdateToTelemetry(client, fwInfo, OtaPackageUpdateStatus.FAILED, "Client does not support firmware update or profile misconfiguration!"); 374 sendStateUpdateToTelemetry(client, fwInfo, OtaPackageUpdateStatus.FAILED, "Client does not support firmware update or profile misconfiguration!");
369 } else if (fwInfo.isUpdateRequired()) { 375 } else if (fwInfo.isUpdateRequired()) {
370 if (StringUtils.isNotEmpty(fwInfo.getTargetUrl())) { 376 if (StringUtils.isNotEmpty(fwInfo.getTargetUrl())) {
371 - log.debug("[{}] Starting update to [{}{}] using URL: {}", client.getEndpoint(), fwInfo.getTargetName(), fwInfo.getTargetVersion(), fwInfo.getTargetUrl()); 377 + log.debug("[{}] Starting update to [{}{}][] using URL: {}", client.getEndpoint(), fwInfo.getTargetName(), fwInfo.getTargetVersion(), fwInfo.getTargetUrl());
372 startUpdateUsingUrl(client, FW_URL_ID, fwInfo.getTargetUrl()); 378 startUpdateUsingUrl(client, FW_URL_ID, fwInfo.getTargetUrl());
373 } else { 379 } else {
374 log.debug("[{}] Starting update to [{}{}] using binary", client.getEndpoint(), fwInfo.getTargetName(), fwInfo.getTargetVersion()); 380 log.debug("[{}] Starting update to [{}{}] using binary", client.getEndpoint(), fwInfo.getTargetName(), fwInfo.getTargetVersion());
@@ -32,6 +32,7 @@ public abstract class LwM2MClientOtaInfo<Strategy, State, Result> { @@ -32,6 +32,7 @@ public abstract class LwM2MClientOtaInfo<Strategy, State, Result> {
32 32
33 protected String targetName; 33 protected String targetName;
34 protected String targetVersion; 34 protected String targetVersion;
  35 + protected String targetTag;
35 protected String targetUrl; 36 protected String targetUrl;
36 37
37 //TODO: use value from device if applicable; 38 //TODO: use value from device if applicable;
@@ -52,10 +53,11 @@ public abstract class LwM2MClientOtaInfo<Strategy, State, Result> { @@ -52,10 +53,11 @@ public abstract class LwM2MClientOtaInfo<Strategy, State, Result> {
52 this.strategy = strategy; 53 this.strategy = strategy;
53 } 54 }
54 55
55 - public void updateTarget(String targetName, String targetVersion, Optional<String> newTargetUrl) { 56 + public void updateTarget(String targetName, String targetVersion, Optional<String> newTargetUrl, Optional<String> newTargetTag) {
56 this.targetName = targetName; 57 this.targetName = targetName;
57 this.targetVersion = targetVersion; 58 this.targetVersion = targetVersion;
58 this.targetUrl = newTargetUrl.orElse(null); 59 this.targetUrl = newTargetUrl.orElse(null);
  60 + this.targetTag = newTargetTag.orElse(null);
59 } 61 }
60 62
61 @JsonIgnore 63 @JsonIgnore
@@ -64,13 +66,18 @@ public abstract class LwM2MClientOtaInfo<Strategy, State, Result> { @@ -64,13 +66,18 @@ public abstract class LwM2MClientOtaInfo<Strategy, State, Result> {
64 return false; 66 return false;
65 } else { 67 } else {
66 String targetPackageId = getPackageId(targetName, targetVersion); 68 String targetPackageId = getPackageId(targetName, targetVersion);
67 - String currentPackageIdUsingObject5 = getPackageId(currentName, currentVersion); 69 + String currentPackageId = getPackageId(currentName, currentVersion);
68 if (StringUtils.isNotEmpty(failedPackageId) && failedPackageId.equals(targetPackageId)) { 70 if (StringUtils.isNotEmpty(failedPackageId) && failedPackageId.equals(targetPackageId)) {
69 return false; 71 return false;
70 } else { 72 } else {
71 - if (targetPackageId.equals(currentPackageIdUsingObject5)) { 73 + if (targetPackageId.equals(currentPackageId)) {
  74 + return false;
  75 + } else if (StringUtils.isNotEmpty(targetTag) && targetTag.equals(currentPackageId)) {
72 return false; 76 return false;
73 } else if (StringUtils.isNotEmpty(currentVersion3)) { 77 } else if (StringUtils.isNotEmpty(currentVersion3)) {
  78 + if (StringUtils.isNotEmpty(targetTag) && !currentVersion3.contains(targetPackageId)) {
  79 + return false;
  80 + }
74 return !currentVersion3.contains(targetPackageId); 81 return !currentVersion3.contains(targetPackageId);
75 } else { 82 } else {
76 return true; 83 return true;
@@ -26,9 +26,9 @@ public interface LwM2MOtaUpdateService { @@ -26,9 +26,9 @@ public interface LwM2MOtaUpdateService {
26 26
27 void forceFirmwareUpdate(LwM2mClient client); 27 void forceFirmwareUpdate(LwM2mClient client);
28 28
29 - void onTargetFirmwareUpdate(LwM2mClient client, String newFwTitle, String newFwVersion, Optional<String> newFwUrl); 29 + void onTargetFirmwareUpdate(LwM2mClient client, String newFwTitle, String newFwVersion, Optional<String> newFwUrl, Optional<String> newFwTag);
30 30
31 - void onTargetSoftwareUpdate(LwM2mClient client, String newSwTitle, String newSwVersion, Optional<String> newSwUrl); 31 + void onTargetSoftwareUpdate(LwM2mClient client, String newSwTitle, String newSwVersion, Optional<String> newSwUrl, Optional<String> newSwTag);
32 32
33 void onCurrentFirmwareNameUpdate(LwM2mClient client, String name); 33 void onCurrentFirmwareNameUpdate(LwM2mClient client, String name);
34 34