Skip to content

Commit

Permalink
HEX prefix '0x' added to thing's versions. (#384)
Browse files Browse the repository at this point in the history
HEX prefix '0x' added to thing's versions. This change is needed in order ESH firmware update mechanism to be able to distinguish between HEX and DEC version formats.

Signed-off-by: YordanDZhelev <zhelev.yordan@gmail.com>
  • Loading branch information
YordanDZhelev authored and cdjackson committed Feb 21, 2019
1 parent 282f924 commit c3c9e08
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ public class ZigBeeBindingConstants {
public static final String OFFLINE_DISCOVERY_INCOMPLETE = "@text/zigbee.status.offline_discoveryincomplete";

public static final String FIRMWARE_FAILED = "@text/zigbee.firmware.failed";
public static final String FIRMWARE_VERSION_HEX_PREFIX = "0x";

// List of channel state constants
public static final String STATE_OPTION_BATTERY_MIN_THRESHOLD = "minThreshold";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ public Map<String, String> getProperties(final ZigBeeNode node) {
if (otaCluster != null) {
Integer fileVersion = otaCluster.getCurrentFileVersion(Long.MAX_VALUE);
if (fileVersion != null) {
properties.put(Thing.PROPERTY_FIRMWARE_VERSION, String.format("%08X", fileVersion));
properties.put(Thing.PROPERTY_FIRMWARE_VERSION,
String.format("%s%08X", ZigBeeBindingConstants.FIRMWARE_VERSION_HEX_PREFIX, fileVersion));
} else {
logger.debug("{}: OTA firmware failed", node.getIeeeAddress());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,8 @@ public void otaStatusUpdate(ZigBeeOtaServerStatus status, int percent) {
for (int retry = 0; retry < 3; retry++) {
Integer fileVersion = finalOtaServer.getCurrentFileVersion();
if (fileVersion != null) {
updateProperty(Thing.PROPERTY_FIRMWARE_VERSION, String.format("%08X", fileVersion));
updateProperty(Thing.PROPERTY_FIRMWARE_VERSION, String.format("%s%08X",
ZigBeeBindingConstants.FIRMWARE_VERSION_HEX_PREFIX, fileVersion));
break;
} else {
logger.debug("{}: OTA firmware request timeout (retry {})", node.getIeeeAddress(), retry);
Expand Down

0 comments on commit c3c9e08

Please sign in to comment.