Class HardwareService
java.lang.Object
com.tccc.kos.commons.util.ready.ReadyBean
com.tccc.kos.commons.core.service.AbstractService
com.tccc.kos.core.service.hardware.HardwareService
- All Implemented Interfaces:
CtxEventListener
,ContextHandleAware
,HandleAware
,Ready
,ReadyAndReadyListener
,ReadyListener
Service that manages all external hardware.
- Since:
- 1.0
- Version:
- 2023-03-06
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturn the resolver that can map a particuler board identifier, such as a serial number, to a particular logical board.Return the list of resolvers so that new resolvers can be added in the desired order.boolean
Override in subclasses to be notified when all dependencies are ready.void
register
(HardwareLink link) Register a hardware link.void
Trigger the board resolve process.void
unregister
(HardwareLink link) Unregister a hardware link.Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyAndReadyListener
onDependenciesReady
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Field Details
-
TOPIC_BOARD_LINKED
- See Also:
-
TOPIC_BOARD_UNLINKED
- See Also:
-
-
Method Details
-
onBeanReady
public boolean onBeanReady()Description copied from interface:ReadyAndReadyListener
Override in subclasses to be notified when all dependencies are ready. Return true to indicate that this bean is also ready. If the bean needs to callsetReady()
later due to some async processing, return false to preventsetReady()
from being called automatically.It is recommended to override this method rather than
onDependenciesReady()
as a majority of the time it requires callingsuper.onDependneciesReady()
or explicitly callingsetReady()
which defaults to a failure mode.- Returns:
- true if this object is now ready
-
getResolvers
Return the list of resolvers so that new resolvers can be added in the desired order. Resolvers are used to matchHardwareLink
objects toBoard
objects. Out of the box these are matched usingBoardIdentity
but the list of resolvers can be modified to include alternate ways of matching boards to links. -
resolveBoards
public void resolveBoards()Trigger the board resolve process. This process is triggered internally so there is rarely a need to call this externally unless the resolvers list has been modified. -
register
Register a hardware link. The link will be matched with a board so that the board can access the hardware. -
unregister
Unregister a hardware link. Called when hardware disconnects so the board can be updated to indicate that it is offline. -
getIdentityMappingResolver
Return the resolver that can map a particuler board identifier, such as a serial number, to a particular logical board. This can be used to access the board mappings managed by this resolver.
-