public class FirmwareTarget
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static long |
MAX_AVAILABLE_SIZE
Maximum available size for a firmware target: 4294967295L.
|
static int |
MAX_VERSION_SEGMENT_VALUE
Maximum value of a version segment: 255.
|
| Constructor and Description |
|---|
FirmwareTarget(int target,
java.lang.String version,
long availableSize)
Class constructor.
|
FirmwareTarget(int target,
java.lang.String version,
long availableSize,
java.lang.String label,
java.lang.String regex)
Class constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object arg0) |
byte[] |
generateInfoMessage()
Retrieves the firmware target information message as byte array.
|
long |
getAvailableSize()
Retrieves the firmware target available size to update.
|
java.lang.String |
getFirmwareIDString()
Retrieves the firmware ID string of this firmware target.
|
java.lang.String |
getLabel()
Retrieves the firmware target label.
|
java.lang.String |
getRegex()
Retrieves the firmware target regular expression.
|
int |
getTarget()
Retrieves the firmware target number.
|
java.lang.String |
getTargetPath()
Retrieves the path where firmware file will be stored for this target.
|
java.lang.String |
getVersion()
Retrieves the target version.
|
byte[] |
getVersionAsByteArray()
Retrieves the target version as byte array.
|
int |
hashCode() |
boolean |
isUpdateAllowed()
Retrieves whether update is allowed for this firmware target or not.
|
void |
setAllowUpdate(boolean allowUpdate)
Configures whether updates are allowed or not for this target.
|
void |
setLabel(java.lang.String label)
Sets the firmware target label.
|
void |
setRegex(java.lang.String regex)
Sets the firmware target regular expression.
|
void |
setTargetPath(java.lang.String targetPath)
Sets the path where firmware file will be stored for this target.
|
public static final long MAX_AVAILABLE_SIZE
public static final int MAX_VERSION_SEGMENT_VALUE
public FirmwareTarget(int target,
java.lang.String version,
long availableSize)
target - Firmware target number.version - Firmware target version. It must be a sequence of numbers
separated by dots, and each segment should not be greater
than 255.availableSize - Firmware target available size.java.lang.IllegalArgumentException - if target < 0 or
if version is not valid or
if availableSize > MAX_AVAILABLE_SIZE or
if availableSize < 0MAX_VERSION_SEGMENT_VALUE,
MAX_AVAILABLE_SIZEpublic FirmwareTarget(int target,
java.lang.String version,
long availableSize,
java.lang.String label,
java.lang.String regex)
label and a regular expression
(regex).
These two parts are optional. However, without a label users
will not have any useful way of selecting between targets (the
label is exposed to users of the server). Without the
regex file specification, firmware upgrade by file name cannot be
supported by the client. (However, if only target 0 is supported on a
client and no regex is declared, all file based upgrades will be
sent to target 0).
The length of the label plus the length of the regex
should not be exceed 127 characters.
If an invalid regex is provided, the behavior will be
equivalent to as if no regex was defined for the target.
target - Firmware target number.version - Firmware target version. It must be a sequence of numbers
separated by dots, and each segment should not be greater
than 255.availableSize - Firmware target available size.label - The firmware target label.regex - The firmware target download file pattern.java.lang.IllegalArgumentException - if target < 0 or
if version is not valid or
if availableSize > MAX_AVAILABLE_SIZE or
if availableSize < 0 or
if label.length() + regex.length() > 127MAX_VERSION_SEGMENT_VALUE,
MAX_AVAILABLE_SIZEpublic boolean equals(java.lang.Object arg0)
equals in class java.lang.Objectpublic byte[] generateInfoMessage()
public long getAvailableSize()
MAX_AVAILABLE_SIZEpublic java.lang.String getFirmwareIDString()
This is a variable length ASCII string that allows a label as a form
of textual information to be stored with the version number along with
an optional regular expression (regex) that indicates to the
server a matching file name that should be sent to this target during
firmware upgrade by file name.
The two parts of the firmware ID string are separated by a new-line character 0x0a '\n'.
The string is not null terminated. The length should not
exceed 128 octets.
public java.lang.String getLabel()
This label is exposed to users of the server while performing the
firmware upgrade process. May be null.
null.public java.lang.String getRegex()
This regular expression will be used to verify the firmware update
source file name and accept the firmware. It may be null.
null.public int getTarget()
public java.lang.String getTargetPath()
public java.lang.String getVersion()
public byte[] getVersionAsByteArray()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean isUpdateAllowed()
true if update is allowed for this target, false
otherwise.public void setAllowUpdate(boolean allowUpdate)
allowUpdate - true if updates are allowed for this target,
false otherwise.public void setLabel(java.lang.String label)
This label is exposed to users of the server while performing the firmware upgrade process.
label - The firmware target label that will be exposed to users
of the server while performing the firmware upgrade process.public void setRegex(java.lang.String regex)
This regular expression will be used to verify the firmware update source file name and accept the firmware.
regex - The firmware target regex that will be used to verify
the file name of the update file.public void setTargetPath(java.lang.String targetPath)
targetPath - The firmware target path.© Copyright 2014 Etherios, Inc. All rights reserved. Etherios, Inc. is a Division of Digi International Inc.