Class AbstractVelbusProtocol<S extends AbstractVelbusProtocol<S,T>,T extends VelbusAgent<T,S>>
java.lang.Object
org.openremote.agent.protocol.AbstractProtocol<T,VelbusAgentLink>
org.openremote.agent.protocol.velbus.AbstractVelbusProtocol<S,T>
- All Implemented Interfaces:
org.openremote.model.asset.agent.Protocol<T>
,org.openremote.model.protocol.ProtocolAssetImport
- Direct Known Subclasses:
VelbusSerialProtocol
,VelbusTCPProtocol
public abstract class AbstractVelbusProtocol<S extends AbstractVelbusProtocol<S,T>,T extends VelbusAgent<T,S>>
extends AbstractProtocol<T,VelbusAgentLink>
implements org.openremote.model.protocol.ProtocolAssetImport
-
Field Summary
FieldsFields inherited from class org.openremote.agent.protocol.AbstractProtocol
agent, assetService, datapointService, dynamicAttributes, executorService, linkedAttributes, messageBrokerContext, predictedDatapointService, processorLock, producerTemplate, scheduledExecutorService, timerService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract IOClient<VelbusPacket>
createIoClient
(T agent) Should return an instance ofIOClient
for the supplied agentprotected void
doLinkAttribute
(String assetId, org.openremote.model.attribute.Attribute<?> attribute, VelbusAgentLink agentLink) Link anAttribute
to its linkedAgent
.protected void
doLinkedAttributeWrite
(VelbusAgentLink agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue) An Attribute event (write) has been requested for an attribute linked to this protocol.protected void
doStart
(org.openremote.model.Container container) Start this protocol instanceprotected void
doStop
(org.openremote.model.Container container) Stop this protocol instanceprotected void
doUnlinkAttribute
(String assetId, org.openremote.model.attribute.Attribute<?> attribute, VelbusAgentLink agentLink) Unlink anAttribute
from its linkedAgent
.Get a URI that describes this specific protocol instancestartAssetImport
(byte[] fileData, Consumer<org.openremote.model.asset.AssetTreeNode[]> assetConsumer) Start the process asynchronously; the implementation can make as many calls as it desires to the assetConsumer with the found assets; when the implementation has finished then the returned future will becomeFuture.isDone()
.Methods inherited from class org.openremote.agent.protocol.AbstractProtocol
getAgent, getLinkedAttributes, linkAttribute, onAgentAttributeChanged, processLinkedAttributeWrite, sendAttributeEvent, sendAttributeEvent, setAssetService, setConnectionStatus, start, stop, toString, unlinkAttribute, updateLinkedAttribute, updateLinkedAttribute
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.openremote.model.asset.agent.Protocol
getProtocolName, prefixLogMessage
-
Field Details
-
DEFAULT_TIME_INJECTION_INTERVAL_SECONDS
public static final int DEFAULT_TIME_INJECTION_INTERVAL_SECONDS- See Also:
-
LOG
-
network
-
attributePropertyValueConsumers
-
-
Constructor Details
-
AbstractVelbusProtocol
-
-
Method Details
-
getProtocolInstanceUri
Description copied from interface:org.openremote.model.asset.agent.Protocol
Get a URI that describes this specific protocol instance- Specified by:
getProtocolInstanceUri
in interfaceorg.openremote.model.asset.agent.Protocol<S extends AbstractVelbusProtocol<S,
T>>
-
doStart
Description copied from class:AbstractProtocol
Start this protocol instance- Specified by:
doStart
in classAbstractProtocol<T extends VelbusAgent<T,
S>, VelbusAgentLink> - Throws:
Exception
-
doStop
Description copied from class:AbstractProtocol
Stop this protocol instance- Specified by:
doStop
in classAbstractProtocol<T extends VelbusAgent<T,
S>, VelbusAgentLink> - Throws:
Exception
-
doLinkAttribute
protected void doLinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, VelbusAgentLink agentLink) Description copied from class:AbstractProtocol
Link anAttribute
to its linkedAgent
.- Specified by:
doLinkAttribute
in classAbstractProtocol<T extends VelbusAgent<T,
S>, VelbusAgentLink>
-
doUnlinkAttribute
protected void doUnlinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, VelbusAgentLink agentLink) Description copied from class:AbstractProtocol
Unlink anAttribute
from its linkedAgent
.- Specified by:
doUnlinkAttribute
in classAbstractProtocol<T extends VelbusAgent<T,
S>, VelbusAgentLink>
-
doLinkedAttributeWrite
protected void doLinkedAttributeWrite(VelbusAgentLink agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue) Description copied from class:AbstractProtocol
An Attribute event (write) has been requested for an attribute linked to this protocol. The processedValue is the resulting value after applying standard outbound value processing (seeProtocolUtil.doOutboundValueProcessing(org.openremote.model.attribute.AttributeRef, org.openremote.model.asset.agent.AgentLink<?>, java.lang.Object, boolean, java.time.Instant)
). Protocol implementations should generally use the processedValue but may also choose to use the original value for some purpose if required.- Specified by:
doLinkedAttributeWrite
in classAbstractProtocol<T extends VelbusAgent<T,
S>, VelbusAgentLink>
-
createIoClient
Should return an instance ofIOClient
for the supplied agent- Throws:
RuntimeException
-
startAssetImport
public Future<Void> startAssetImport(byte[] fileData, Consumer<org.openremote.model.asset.AssetTreeNode[]> assetConsumer) Description copied from interface:org.openremote.model.protocol.ProtocolAssetImport
Start the process asynchronously; the implementation can make as many calls as it desires to the assetConsumer with the found assets; when the implementation has finished then the returned future will becomeFuture.isDone()
. The callee can also cancel the future at any time. If for some reason the process cannot be started or encounters an error then this method should log more details before completing the future.- Specified by:
startAssetImport
in interfaceorg.openremote.model.protocol.ProtocolAssetImport
-