Class TCPProtocol
java.lang.Object
org.openremote.agent.protocol.AbstractProtocol<U,X>
org.openremote.agent.protocol.io.AbstractIOClientProtocol<T,U,V,W,X>
org.openremote.agent.protocol.io.AbstractNettyIOClientProtocol<T,U,W,X,V>
org.openremote.agent.protocol.tcp.AbstractTCPClientProtocol<TCPProtocol,TCPAgent,org.openremote.model.asset.agent.DefaultAgentLink,String,TCPIOClient<String>>
org.openremote.agent.protocol.tcp.TCPProtocol
- All Implemented Interfaces:
org.openremote.model.asset.agent.Protocol<TCPAgent>
public class TCPProtocol
extends AbstractTCPClientProtocol<TCPProtocol,TCPAgent,org.openremote.model.asset.agent.DefaultAgentLink,String,TCPIOClient<String>>
This is a generic TCP client protocol for communicating with TCP servers; it uses the
TCPIOClient to
handle the communication and all messages are processed as strings; if you require custom message type handling or
more specific handling then sub class the AbstractTCPClientProtocol).
To use this protocol create a TCPAgent.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected final List<org.openremote.model.util.Pair<org.openremote.model.attribute.AttributeRef,Consumer<String>>> Fields inherited from class org.openremote.agent.protocol.io.AbstractIOClientProtocol
clientFields inherited from class org.openremote.agent.protocol.AbstractProtocol
agent, assetService, datapointService, dynamicAttributes, executorService, linkedAttributes, messageBrokerContext, predictedDatapointService, producerTemplate, timerServiceFields inherited from interface org.openremote.model.asset.agent.Protocol
ACTUATOR_TOPIC, ACTUATOR_TOPIC_TARGET_PROTOCOL, DYNAMIC_TIME_PLACEHOLDER_REGEXP, DYNAMIC_VALUE_PLACEHOLDER, DYNAMIC_VALUE_PLACEHOLDER_REGEXP, SENSOR_QUEUE, SENSOR_QUEUE_SOURCE_PROTOCOL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateWriteMessage(org.openremote.model.attribute.Attribute<?> attribute, org.openremote.model.asset.agent.DefaultAgentLink agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue) Generate the actual message to send to theIOClientfor thisAttributeEventprotected voiddoLinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, org.openremote.model.asset.agent.DefaultAgentLink agentLink) Link anAttributeto its linkedAgent.protected voiddoUnlinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, org.openremote.model.asset.agent.DefaultAgentLink agentLink) Unlink anAttributefrom its linkedAgent.protected Supplier<io.netty.channel.ChannelHandler[]>Gets the NettyChannelHandlers for the IO clientGet the name for this protocolprotected voidonMessageReceived(String message) Called when theIOClientreceives a message from the serverMethods inherited from class org.openremote.agent.protocol.tcp.AbstractTCPClientProtocol
doCreateIoClientMethods inherited from class org.openremote.agent.protocol.io.AbstractNettyIOClientProtocol
createIoClientMethods inherited from class org.openremote.agent.protocol.io.AbstractIOClientProtocol
doLinkedAttributeWrite, doStart, doStop, getGenericStringEncodersAndDecoders, getProtocolInstanceUri, onConnectionStatusChangedMethods inherited from class org.openremote.agent.protocol.AbstractProtocol
getAgent, getLinkedAttributes, linkAttribute, processLinkedAttributeWrite, sendAttributeEvent, sendAttributeEvent, setConnectionStatus, start, stop, toString, unlinkAttribute, updateAgentAttribute, updateLinkedAttribute, updateLinkedAttributeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openremote.model.asset.agent.Protocol
prefixLogMessage
-
Field Details
-
PROTOCOL_DISPLAY_NAME
- See Also:
-
protocolMessageConsumers
-
-
Constructor Details
-
TCPProtocol
-
-
Method Details
-
getProtocolName
Description copied from interface:org.openremote.model.asset.agent.ProtocolGet the name for this protocol -
doLinkAttribute
protected void doLinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, org.openremote.model.asset.agent.DefaultAgentLink agentLink) Description copied from class:AbstractProtocolLink anAttributeto its linkedAgent.- Specified by:
doLinkAttributein classAbstractProtocol<TCPAgent,org.openremote.model.asset.agent.DefaultAgentLink>
-
doUnlinkAttribute
protected void doUnlinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, org.openremote.model.asset.agent.DefaultAgentLink agentLink) Description copied from class:AbstractProtocolUnlink anAttributefrom its linkedAgent.- Specified by:
doUnlinkAttributein classAbstractProtocol<TCPAgent,org.openremote.model.asset.agent.DefaultAgentLink>
-
getEncoderDecoderProvider
Description copied from class:AbstractNettyIOClientProtocolGets the NettyChannelHandlers for the IO client- Specified by:
getEncoderDecoderProviderin classAbstractNettyIOClientProtocol<TCPProtocol,TCPAgent, String, TCPIOClient<String>, org.openremote.model.asset.agent.DefaultAgentLink>
-
onMessageReceived
Description copied from class:AbstractIOClientProtocolCalled when theIOClientreceives a message from the server- Specified by:
onMessageReceivedin classAbstractIOClientProtocol<TCPProtocol,TCPAgent, String, TCPIOClient<String>, org.openremote.model.asset.agent.DefaultAgentLink>
-
createWriteMessage
protected String createWriteMessage(org.openremote.model.attribute.Attribute<?> attribute, org.openremote.model.asset.agent.DefaultAgentLink agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue) Description copied from class:AbstractIOClientProtocolGenerate the actual message to send to theIOClientfor thisAttributeEvent- Specified by:
createWriteMessagein classAbstractIOClientProtocol<TCPProtocol,TCPAgent, String, TCPIOClient<String>, org.openremote.model.asset.agent.DefaultAgentLink>
-