Class AbstractIOClientProtocol<T extends AbstractIOClientProtocol<T,U,V,W,X>,U extends IOAgent<U,T,X>,V,W extends IOClient<V>,X extends org.openremote.model.asset.agent.AgentLink<?>>

java.lang.Object
org.openremote.agent.protocol.AbstractProtocol<U,X>
org.openremote.agent.protocol.io.AbstractIOClientProtocol<T,U,V,W,X>
All Implemented Interfaces:
org.openremote.model.asset.agent.Protocol<U>
Direct Known Subclasses:
AbstractMQTTClientProtocol, AbstractNettyIOClientProtocol

public abstract class AbstractIOClientProtocol<T extends AbstractIOClientProtocol<T,U,V,W,X>,U extends IOAgent<U,T,X>,V,W extends IOClient<V>,X extends org.openremote.model.asset.agent.AgentLink<?>> extends AbstractProtocol<U,X>
This is an abstract Protocol for protocols that require an IOClient.
  • Field Details

    • LOG

      public static final Logger LOG
    • client

      protected W extends IOClient<V> client
  • Constructor Details

    • AbstractIOClientProtocol

      protected AbstractIOClientProtocol(U agent)
  • Method Details

    • getGenericStringEncodersAndDecoders

      public static Supplier<io.netty.channel.ChannelHandler[]> getGenericStringEncodersAndDecoders(AbstractNettyIOClient<String,?> client, IOAgent<?,?,?> agent)
      Supplies a set of encoders/decoders that convert from/to String to/from ByteBuf based on the generic protocol Attributes
    • getProtocolInstanceUri

      public String getProtocolInstanceUri()
      Description copied from interface: org.openremote.model.asset.agent.Protocol
      Get a URI that describes this specific protocol instance
    • doStop

      protected void doStop(org.openremote.model.Container container) throws Exception
      Description copied from class: AbstractProtocol
      Stop this protocol instance
      Specified by:
      doStop in class AbstractProtocol<U extends IOAgent<U,T,X>,X extends org.openremote.model.asset.agent.AgentLink<?>>
      Throws:
      Exception
    • doStart

      protected void doStart(org.openremote.model.Container container) throws Exception
      Description copied from class: AbstractProtocol
      Start this protocol instance
      Specified by:
      doStart in class AbstractProtocol<U extends IOAgent<U,T,X>,X extends org.openremote.model.asset.agent.AgentLink<?>>
      Throws:
      Exception
    • doLinkedAttributeWrite

      protected void doLinkedAttributeWrite(X 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 (see ProtocolUtil.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 class AbstractProtocol<U extends IOAgent<U,T,X>,X extends org.openremote.model.asset.agent.AgentLink<?>>
    • createIoClient

      protected W createIoClient() throws Exception
      Throws:
      Exception
    • onConnectionStatusChanged

      protected void onConnectionStatusChanged(org.openremote.model.asset.agent.ConnectionStatus connectionStatus)
      Called when the IOClient ConnectionStatus changes
    • doCreateIoClient

      protected abstract W doCreateIoClient() throws Exception
      Should return an instance of IOClient for the linked Agent.
      Throws:
      Exception
    • onMessageReceived

      protected abstract void onMessageReceived(V message)
      Called when the IOClient receives a message from the server
    • createWriteMessage

      protected abstract V createWriteMessage(X agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue)
      Generate the actual message to send to the IOClient for this AttributeEvent