Class JSerialCommConnector<CO,CI>

java.lang.Object
de.iip_ecosphere.platform.connectors.AbstractConnector<O,I,CO,CI>
de.iip_ecosphere.platform.connectors.AbstractChannelConnector<byte[],byte[],CO,CI>
de.oktoflow.platform.connectors.serial.JSerialCommConnector<CO,CI>
Type Parameters:
CO - the output type to the oktoflow platform
CI - the input type from the oktoflow platform
All Implemented Interfaces:
de.iip_ecosphere.platform.connectors.Connector<byte[],byte[],CO,CI>, de.iip_ecosphere.platform.connectors.events.EventHandlingConnector, de.iip_ecosphere.platform.connectors.model.AbstractModelAccess.NotificationChangedListener

@MachineConnector(hasModel=false, supportsEvents=true, supportsHierarchicalQNames=false, supportsModelCalls=false, supportsModelProperties=false, supportsModelStructs=false, specificSettings={"BAUDRATE","DATABITS","STOPBITS","PARITY"}) public class JSerialCommConnector<CO,CI> extends de.iip_ecosphere.platform.connectors.AbstractChannelConnector<byte[],byte[],CO,CI>
Implements the generic serial connector. Requires the port descriptor/name in ConnectorParameter.getHost(). Do not rename, this class is referenced in META-INF/services. This implementation is potentially not thread-safe, i.e., it may require a sending queue. Accepts the following specific settings:
  • BAUDRATE: Integer (default 9600)
  • DATABITS: Integer (default 8)
  • STOPBITS: Integer (default 1)
  • PARITY: "NO", "EVEN", "ODD", "MARK", "SPACE" (default "NO")
Author:
Holger Eichelberger, SSE
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private class 
    The internal reception callback.
    static class 
    The descriptor of this connector (see META-INF/services).

    Nested classes/interfaces inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector

    de.iip_ecosphere.platform.connectors.AbstractConnector.BasicAdapterProvider
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final de.iip_ecosphere.platform.support.logging.Logger
     
    static final String
     
    private com.fazecast.jSerialComm.SerialPort
     

    Fields inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector

    DEFAULT_CHANNEL
  • Constructor Summary

    Constructors
    Constructor
    Description
    JSerialCommConnector(de.iip_ecosphere.platform.connectors.ChannelAdapterSelector<byte[],byte[],CO,CI> selector, de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[],byte[],CO,CI>... adapter)
    Creates a connector instance.
    JSerialCommConnector(de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[],byte[],CO,CI>... adapter)
    Creates a connector instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    connectImpl(de.iip_ecosphere.platform.connectors.ConnectorParameter params)
     
    protected void
     
    void
     
     
    protected void
    error(String message, Throwable th)
     
     
    protected byte[]
     
     
    protected void
    writeImpl(byte[] data, String channel)
     

    Methods inherited from class de.iip_ecosphere.platform.connectors.AbstractChannelConnector

    getOutputChannels, getSelector, initSelector, request, write, writeImpl

    Methods inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector

    checkCache, configureAdapter, configureModelAccess, connect, createTlsContext, disconnect, doPolling, enableNotifications, enablePolling, getCachingStrategy, getCachingStrategyCls, getConnectorInputType, getConnectorOutputType, getConnectorParameter, getInitCachingStrategyCls, getInstanceIdentification, getProtocolInputType, getProtocolOutputType, getStorageValue, initializeModelAccess, installPollTask, isPolling, notificationsChanged, notifyDataTimeDifference, notifyReconfigured, received, received, request, setDataTimeDifference, setDataTimeDifferenceProvider, setInstanceIdentification, setReceptionCallback, setStorageValue, trigger, trigger, uninstallPollTask, useTls

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface de.iip_ecosphere.platform.connectors.Connector

    createSharedSpace, disconnectSafe, enableSharedSpace, enumerateFields, enumerateFields, setReceptionCallbackSafe
  • Field Details

    • NAME

      public static final String NAME
      See Also:
    • LOGGER

      private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER
    • port

      private com.fazecast.jSerialComm.SerialPort port
  • Constructor Details

    • JSerialCommConnector

      @SafeVarargs public JSerialCommConnector(de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[],byte[],CO,CI>... adapter)
      Creates a connector instance.
      Parameters:
      adapter - the protocol adapter(s)
      Throws:
      IllegalArgumentException - if adapter is null or empty or adapters are null
    • JSerialCommConnector

      @SafeVarargs public JSerialCommConnector(de.iip_ecosphere.platform.connectors.ChannelAdapterSelector<byte[],byte[],CO,CI> selector, de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[],byte[],CO,CI>... adapter)
      Creates a connector instance.
      Parameters:
      selector - the adapter selector (null leads to a default selector for the first adapter)
      adapter - the protocol adapter(s)
      Throws:
      IllegalArgumentException - if adapter is null or empty or adapters are null
  • Method Details

    • connectImpl

      protected void connectImpl(de.iip_ecosphere.platform.connectors.ConnectorParameter params) throws IOException
      Specified by:
      connectImpl in class de.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[],CO,CI>
      Throws:
      IOException
    • disconnectImpl

      protected void disconnectImpl() throws IOException
      Specified by:
      disconnectImpl in class de.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[],CO,CI>
      Throws:
      IOException
    • dispose

      public void dispose()
      Specified by:
      dispose in interface de.iip_ecosphere.platform.connectors.Connector<byte[],byte[],CO,CI>
      Overrides:
      dispose in class de.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[],CO,CI>
    • getName

      public String getName()
    • writeImpl

      protected void writeImpl(byte[] data, String channel) throws IOException
      Specified by:
      writeImpl in class de.iip_ecosphere.platform.connectors.AbstractChannelConnector<byte[],byte[],CO,CI>
      Throws:
      IOException
    • read

      protected byte[] read() throws IOException
      Specified by:
      read in class de.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[],CO,CI>
      Throws:
      IOException
    • error

      protected void error(String message, Throwable th)
      Specified by:
      error in class de.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[],CO,CI>
    • supportedEncryption

      public String supportedEncryption()
    • enabledEncryption

      public String enabledEncryption()