Class Board
- All Implemented Interfaces:
HandleAware
,AssemblyAware
,BoardIdentifier
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 whenHardwareService
matches aHardwareLink
with 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
FirmwareUpdater
then 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 newHardwareLink
to be established to the board.
- Since:
- 1.0
- Version:
- 2022-12-01
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(BoardLinkListener listener) Add a listener to the board.Returns the associated assembly.Returns the handle for this bean.getLink()
Return theHardwareLink
for the board or throw exception if not currently linked.int
Return the number of times the board has been linked.boolean
isLinked()
Return true if the board is linked to hardware.void
onLink
(HardwareLink link) Called when the board is linked to hardware.void
onUnlink
(HardwareLink link) Called when the board is unlinked from hardware.void
removeListener
(BoardLinkListener listener) Remove a listener from the board.void
Returns if board is linked, throws exception if not.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.core.service.assembly.AssemblyAware
getAssemblyName
Methods inherited from interface com.tccc.kos.core.service.hardware.BoardIdentifier
getInstanceId, getType
Methods 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. -
addListener
Add a listener to the board. -
removeListener
Remove a listener from the board. -
getLink
Return theHardwareLink
for 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
-
verifyLinked
public void verifyLinked()Returns if board is linked, throws exception if not. -
getHandle
Description copied from interface:HandleAware
Returns the handle for this bean. This is used by the context to compute the opaque handle for the object.- Specified by:
getHandle
in interfaceHandleAware
- Returns:
- the handle node for the bean
-
getAssembly
Description copied from interface:AssemblyAware
Returns the associated assembly.- Specified by:
getAssembly
in interfaceAssemblyAware
-