Class Board
- All Implemented Interfaces:
HandleAware,AssemblyAware,BoardIdentifier
- Direct Known Subclasses:
UpdatableBoard
The logical representation is created at startup, and is used to access the physical hardware when it comes online. This allows control logic to wire up all the boards even when they're offline, so that when they become available they can be used.
Board objects are created as part of Assembly creation so that the
boards are available to be wired up in the application code even if the
hardware doesn't exist or hasn't been discovered yet. In general a Board
object is used to access the underlying hardware but these accesses won't work
until the actual hardware becomes available. This process is known as linking.
Hardware integration starts with a HardwareLink passed to
HardwareService. The service will match the link with an existing board
and the board can then pass hardware operations through that link to the actual
hardware. The board will experience the following events as part of this process:
-
onLink(): Called whenHardwareServicematches aHardwareLinkwith a board. The board can use this event to establish additional communication channels to the board. For example, if the board is connected with an adapter, in theonLink()callback it can connected to additional ifaces provided by the hardware. - firmware update : If the board has a
FirmwareUpdaterthen the hardware firmware versions will be checked and updated as needed. -
onStart(): After firmware update,onOnline()will be called to indicate that the board is ready for normal use.
-
onStop(): IfonStart()was called, a matching call toonOffline()will be made to indicate that the board is going offline. -
onUnlink(): The hardware link has been disconnected from the board and the board is back into pending state, waiting for a newHardwareLinkto be established to the board.
- Since:
- 1.0
- Version:
- 2022-12-01
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLinkListener(BoardLinkListener listener) Add a listener to the board.voidaddReadyListener(BoardReadyListener listener) Add a listener to the board.voidCalled to indicate the board is ready for use.Returns the associated assembly.Returns the handle for this bean.getLink()Return theHardwareLinkfor the board or throw exception if not currently linked.intReturn the number of times the board has been linked.booleanisLinked()Return true if the board is linked to hardware.booleanIf true, the board is optional.booleanisReady()Return true if the board is ready.booleanisSticky()Indicates that an optional board is also sticky.booleanCalled after the board is linked to see if the board is ready for use.voidonLink(HardwareLink link) Called when the board is linked to hardware.voidonUnlink(HardwareLink link) Called when the board is unlinked from hardware.voidremoveListener(HardwareListener listener) Remove a listener from the board.voidsetOptional(boolean optional) Indicate that the board is optional.voidsetSticky(boolean sticky) Used to indicate whether an optional board, once linked, should be expected in the future or not.voidReturns if board is linked, throws exception if not.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tccc.kos.core.service.assembly.AssemblyAware
getAssemblyNameMethods inherited from interface com.tccc.kos.core.service.hardware.BoardIdentifier
getInstanceId, getTypeMethods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
-
Constructor Details
-
Board
-
-
Method Details
-
isLinked
public boolean isLinked()Return true if the board is linked to hardware. -
getLinkCount
public int getLinkCount()Return the number of times the board has been linked. This indicates how many times the hardware has disconnected and reconnected. -
addLinkListener
Add a listener to the board. -
addReadyListener
Add a listener to the board. -
removeListener
Remove a listener from the board. -
getLink
Return theHardwareLinkfor the board or throw exception if not currently linked.- Throws:
NotLinkedException- if not linked
-
onLink
Called when the board is linked to hardware. Override as needed.- Parameters:
link- the link to the hardware
-
onUnlink
Called when the board is unlinked from hardware. Override as needed.- Parameters:
link- the link to the hardware
-
onBoardReady
public boolean onBoardReady()Called after the board is linked to see if the board is ready for use. If this returns true, anyBoardReadyListenerwill be called for this board. If this returns false, it is the responsibility of the board to eventually callboardReady()to fire the associated listeners. -
boardReady
public void boardReady()Called to indicate the board is ready for use. This notifies all associatedBoardReadyListenerthat the board is ready for use.onBoardReady()is called afteronLinkis called and link callbacks are complete. IfonBoardReady()returns true (which it does by default) thenboardReady()will be called. If the board requires additional setup after linking before it is ready for use, overrideonBoardReady()to return false. It is then up the board to callboardReady()when the board is actually ready for use.This can only be called once per link. If it is called more than once, only the first call will generate an event.
Listeners can be attached to just this board to be notified of this particular board being ready, or to
HardwareServiceto be notified when any board becomes ready. -
isReady
public boolean isReady()Return true if the board is ready. This is true if the board is linked andboardReady()has been called. If the board unlinks then this will become false again. -
verifyLinked
public void verifyLinked()Returns if board is linked, throws exception if not. -
isOptional
public boolean isOptional()If true, the board is optional. Optional boards don't generate troubles when not linked. -
setOptional
public void setOptional(boolean optional) Indicate that the board is optional. Optional hardware will not generate troubles when not linked, unless the board is also marked sticky and the board has previously been linked.- Parameters:
optional- true if the board is optional
-
isSticky
public boolean isSticky()Indicates that an optional board is also sticky. This means that once the optional board has been linked once, it's expected to exist in the future, and if missing, will generate a trouble. -
setSticky
public void setSticky(boolean sticky) Used to indicate whether an optional board, once linked, should be expected in the future or not. For example, an expansion board may be considered optional, but once installed, is expected to be there in the future. This would be an optional + sticky board. However, a calibration device which is only used during maintenance is not expected to exist after initial linking as the technician takes the device with them. This would be an optional only device.- Parameters:
sticky- true if the board is expected to exist once linked
-
getHandle
Description copied from interface:HandleAwareReturns the handle for this bean. This is used by the context to compute the opaque handle for the object.- Specified by:
getHandlein interfaceHandleAware- Returns:
- the handle node for the bean
-
getAssembly
Description copied from interface:AssemblyAwareReturns the associated assembly.- Specified by:
getAssemblyin interfaceAssemblyAware
-