Class HardwareLink
- All Implemented Interfaces:
BoardIdentifier
- Direct Known Subclasses:
BoardIfaceLink
,FirmwareUpdatableLink
- Since:
- 1.0
- Version:
- 2022-12-01
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the link.getBoard()
Returns the linked board.String[]
Return firmware information about the hardware.Returns the unique identifier of this board.abstract String
Returns theinstanceId
of the board.Return the link type.abstract String
Returns the serial number of the board, if available.Return the revision of the hardware.Returns the display version of the serial number.abstract String
getType()
Returns thetype
of the board.boolean
isValid()
Return true if the link is currently valid for use.void
Set the link invalid.
-
Constructor Details
-
HardwareLink
public HardwareLink()
-
-
Method Details
-
getLinkType
Return the link type. Useful for UI code to know what data to expect. -
getIdentity
Returns the unique identifier of this board. This is used to remember that this board has been linked previously and used to determine when it has been replaced.This value must be unique among all other instances of this type of board. This defaults to the serial number, but can be overridden to use something like MAC address if the serial number isn't available. Unlike serial number, this will not be displayed so this can be overridden while serial number is left empty.
-
getMfgSerialNum
Returns the serial number of the board, if available. This serial number should match the manufacturing data of the board and should be used in analytic data. This should not be used for display purposes. -
getSerialNum
Returns the display version of the serial number. By default, this returns the manufacturer's serial number, but in the event that the serial number printed on the board is in a different format from the manufacturer's serial number, then this can be overridden to return the serial number for display purposes. -
getRevision
Return the revision of the hardware. By default this returns null as many boards don't internally track revisions. Override if your hardware has an internal revision value that can be displayed to the user in the admin screens. -
getFirmwareVersions
Return firmware information about the hardware. By default this returns null to indicate there is no firmware information. This should be overridden to return an array of strings, one for each firmware type applicable to the board. For example, if the board has both bootloader and application firmware, this can return two strings to capture the two versions. This is for display only so prefixes can be used to help the user understand the different versions if needed. -
getBoard
Returns the linked board. -
isValid
public boolean isValid()Return true if the link is currently valid for use. This is changed to false when the link is unregisterd fromHardwareService
. This generally occurs when the hardware disconnects andHardwareService
is notified. -
setInvalid
public void setInvalid()Set the link invalid. This is called fromHardwareService
when a link is unregistered. If overridden, it must callsuper.setInvalid()
. -
close
Close the link. This is called when the board the link is associated with is uninstalled. This should close the underlying link if possible.- Throws:
Exception
-
getType
Description copied from interface:BoardIdentifier
Returns thetype
of the board.The hardware service uses the type to determine compatible firmware, as well as to link with adapters that are connected to the matching physical board.
If a physical board is revised, it may keep the same type but have different variant information. The logical board is primarily concerned with the high-level feature set of the hardware, and leverages the link to the adapter to perform actual operations on the hardware. This means that a new version of a board can be spun with a different CPU and hardware changes, but so long as the protocol to the device is the same, it can still have the same board type.
- Specified by:
getType
in interfaceBoardIdentifier
-
getInstanceId
Description copied from interface:BoardIdentifier
Returns theinstanceId
of the board.If there is more than one instance of the board in the system, then the instanceId is used to determine which one is which. Typically, the hardware has a mechanism to identify which instance it is (via cable harness, jumper or some other mechanism), and that is the value that must be used here. For example, if a device can contain three instances of a board, and the cable harness allows the board to identify its position as "1", "2", or "3", then the logical board must use an instanceId of "1", "2", or "3" so that hardware service can match the incoming adapter link to the logical board.
In general, there should never be more than one instance of a particular board type with the same identifierId, as there is no way to distinguish them from each other.
If there is only one instance of the board, this will typically return null, as the hardware will not need to determine an instance ID in the adapter code.
- Specified by:
getInstanceId
in interfaceBoardIdentifier
-