Class FullDuplexTransmissionPortDecorator<PM extends PortMetrics>

  • Type Parameters:
    PM - The actual PortMetrics type to use.
    All Implemented Interfaces:
    Flushable, org.refcodes.component.Closable, org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.ClosedAccessor, org.refcodes.component.ConnectableComponent, org.refcodes.component.ConnectableComponent.ConnectableAutomaton, org.refcodes.component.ConnectionComponent<PM>, org.refcodes.component.ConnectionComponent.ConnectionAutomaton<PM>, org.refcodes.component.ConnectionOpenable<PM>, org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<PM>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<PM,​Port<PM>>, org.refcodes.component.ConnectionStatusAccessor, org.refcodes.component.Flushable, org.refcodes.component.LinkComponent, org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.Openable, org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<Port<PM>>, org.refcodes.component.OpenedAccessor, org.refcodes.io.Availability, org.refcodes.io.ByteDestination, org.refcodes.io.ByteReceiver, org.refcodes.io.BytesDestination, org.refcodes.io.ByteSource, org.refcodes.io.BytesReceiver, org.refcodes.io.BytesSource, org.refcodes.io.BytesTransceiver, org.refcodes.io.BytesTransmitter, org.refcodes.io.ByteTransceiver, org.refcodes.io.ByteTransmitter, org.refcodes.io.Receivable, org.refcodes.io.Skippable, org.refcodes.io.TimeoutInputStreamAccessor, org.refcodes.io.Transmittable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.InputStreamAccessor, org.refcodes.mixin.OutputStreamAccessor, org.refcodes.numerical.CrcAlgorithmAccessor, org.refcodes.numerical.CrcChecksumValidationModeAccessor, org.refcodes.numerical.EndianessAccessor, AcknowledgeMagicBytesAccessor, AcknowledgeRetryNumberAccessor, AcknowledgeTimeoutInMsAccessor, Port<PM>, PortMetricsAccessor<PM>, SegmentDestination, SegmentReceiver, SegmentSource, SegmentTransceiver, SegmentTransmitter, SequenceNumberAccessor, SequenceNumberInitValueAccessor, SequenceNumberWidthAccessor, SerialReceiver, SerialTransceiver, SerialTransmitter, TransmissionMagicBytesAccessor

    public class FullDuplexTransmissionPortDecorator<PM extends PortMetrics>
    extends AbstractPortDecorator<PM>
    implements Port<PM>, AcknowledgeMagicBytesAccessor, AcknowledgeTimeoutInMsAccessor, AcknowledgeRetryNumberAccessor, TransmissionMagicBytesAccessor, SequenceNumberAccessor, SequenceNumberInitValueAccessor, SequenceNumberWidthAccessor, org.refcodes.numerical.CrcAlgorithmAccessor, org.refcodes.numerical.CrcChecksumValidationModeAccessor, org.refcodes.numerical.EndianessAccessor
    A FullDuplexTransmissionPortDecorator decorates a Port for its usage in Full-Duplex mode regarding the transmission of Segment messages (or any transmission finished off by calling AbstractPortDecorator.flush()). This is achieved by giving each Segment (or transmission) to be transmitted a sequence number together with magic bytes identifying the transmission as being a Segment. Each acknowledge message is given the sequence numbers of successfully received Segment transmissions alongside magic bytes identifying the acknowledge message as such. This way Segment messages and acknowledge messages can be distinguished from each other and transmission can take place in Full-Duplex mode. This implementation applies the Full-Duplex handshake on Segment messages rather than on packets (of a defined size) in order to enable microcontroller based implementation to participate easily in this kind of Full-Duplex. Caution: In case very much data (long transmissions) is to be transmitted, then the outbound line will be blocked by the transmission so that for the time of sending the transmission no acknowledge message upon receival of an inbound transmission can be sent over the outbound line! For such use cases sending much data in a single transmission, consider using the FullDuplexPacketPortDecorator instead as a big transmission is sent in chunks of data blocks inbetween which acknowledge messages can be sent.
    • Constructor Detail

      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort)
        Decorates the given Port with full duplex Segment multiplexer functionality.
        Parameters:
        aPort - The Port to be decorated.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   TransmissionMetrics aTransmissionMetrics)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   int aAcknowledgeRetryNumber,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aAcknowledgeRetryNumber - The number of retries waiting for an ACK from the return channel.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   int aAcknowledgeRetryNumber,
                                                   long aAcknowledgeTimeoutInMs,
                                                   int aSequenceNumberWidth,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aAcknowledgeRetryNumber - The number of retries waiting for an ACK from the return channel.
        aAcknowledgeTimeoutInMs - The timeout in milliseconds to pend till the next retry.
        aSequenceNumberWidth - The width in bytes to be used for the binary sequence number representation.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   int aAcknowledgeRetryNumber,
                                                   long aAcknowledgeTimeoutInMs,
                                                   int aSequenceNumberInitValue,
                                                   int aSequenceNumberWidth,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aAcknowledgeRetryNumber - The number of retries waiting for an ACK from the return channel.
        aAcknowledgeTimeoutInMs - The timeout in milliseconds to pend till the next retry.
        aSequenceNumberInitValue - The initialization value for the sequence number counter.
        aSequenceNumberWidth - The width in bytes to be used for the binary sequence number representation.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality.
        Parameters:
        aPort - The Port to be decorated.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   TransmissionMetrics aTransmissionMetrics,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   int aAcknowledgeRetryNumber,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aAcknowledgeRetryNumber - The number of retries waiting for an ACK from the return channel.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   int aAcknowledgeRetryNumber,
                                                   long aAcknowledgeTimeoutInMs,
                                                   int aSequenceNumberWidth,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aAcknowledgeRetryNumber - The number of retries waiting for an ACK from the return channel.
        aAcknowledgeTimeoutInMs - The timeout in milliseconds to pend till the next retry.
        aSequenceNumberWidth - The width in bytes to be used for the binary sequence number representation.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
      • FullDuplexTransmissionPortDecorator

        public FullDuplexTransmissionPortDecorator​(Port<PM> aPort,
                                                   org.refcodes.numerical.Endianess aEndianess,
                                                   byte[] aTransmissionMagicBytes,
                                                   byte[] aAcknowledgeMagicBytes,
                                                   int aAcknowledgeRetryNumber,
                                                   long aAcknowledgeTimeoutInMs,
                                                   int aSequenceNumberInitValue,
                                                   int aSequenceNumberWidth,
                                                   org.refcodes.numerical.CrcAlgorithm aCrcAlgorithm,
                                                   org.refcodes.numerical.ChecksumValidationMode aCrcChecksumValidationMode,
                                                   ExecutorService aExecutorService)
        Decorates the given Port with full duplex Segment multiplexer functionality as of the given arguments.
        Parameters:
        aPort - The Port to be decorated.
        aEndianess - The Endianess to use when calculating the CRC checksum.
        aTransmissionMagicBytes - The magic bytes identifying a regular transmission (as of transmitSegment(Segment) or the like).
        aAcknowledgeMagicBytes - The ACK character to be used by the return channel to transmit an ACK (acknowledge) response after successful receiving a transmission.
        aAcknowledgeRetryNumber - The number of retries waiting for an ACK from the return channel.
        aAcknowledgeTimeoutInMs - The timeout in milliseconds to pend till the next retry.
        aSequenceNumberInitValue - The initialization value for the sequence number counter.
        aSequenceNumberWidth - The width in bytes to be used for the binary sequence number representation.
        aCrcAlgorithm - The CrcAlgorithm to be used for CRC checksum calculation.
        aCrcChecksumValidationMode - The mode of operation when validating provided CRC checksums against calculated ones.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.