Class TransmissionMetrics

java.lang.Object
org.refcodes.serial.TransmissionMetrics
All Implemented Interfaces:
org.refcodes.mixin.BlockSizeAccessor, org.refcodes.mixin.EncodingAccessor<Charset>, org.refcodes.mixin.ReadTimeoutMillisAccessor, org.refcodes.mixin.WriteTimeoutMillisAccessor, org.refcodes.numerical.ChecksumValidationModeAccessor, org.refcodes.numerical.CrcAlgorithmAccessor, org.refcodes.numerical.CrcChecksumConcatenateModeAccessor, org.refcodes.numerical.EndianessAccessor, AcknowledgeMagicBytesAccessor, AcknowledgeRetryNumberAccessor, AcknowledgeSegmentPackagerAccessor, AcknowledgeTimeoutMillisAccessor, ClearToSendMagicBytesAccessor, ClearToSendSegmentPackagerAccessor, ClearToSendTimeoutMillisAccessor, EndOfStringByteAccessor, EnquiryStandbyTimeMillisAccessor, IoHeuristicsTimeToLiveMillisAccessor, LengthWidthAccessor, MagicBytesLengthAccessor, PacketLengthWidthAccessor, PacketMagicBytesAccessor, PacketSegmentPackagerAccessor, PingMagicBytesAccessor, PingRetryNumberAccessor, PingTimeoutMillisAccessor, PongMagicBytesAccessor, ReadyToReceiveMagicBytesAccessor, ReadyToReceiveRetryNumberAccessor, ReadyToReceiveSegmentPackagerAccessor, ReadyToReceiveTimeoutMillisAccessor, ReadyToSendMagicBytesAccessor, ReadyToSendRetryNumberAccessor, ReadyToSendSegmentPackagerAccessor, ReadyToSendTimeoutMillisAccessor, SequenceNumberConcatenateModeAccessor, SequenceNumberInitValueAccessor, SequenceNumberWidthAccessor, TransmissionRetryNumberAccessor, TransmissionTimeoutMillisAccessor

The TransmissionMetrics interface represents common parameters required when configuring a transmission. Not all configuration parameters may be required when applying the TransmissionMetrics. This depends on your setup of Segment and/or Section compositions. Usually TransmissionMetrics are applied to sub-classes of the type Segment and Section.
  • Field Details

    • DEFAULT_ACKNOWLEDGE_MAGIC_BYTES

      public static final byte[] DEFAULT_ACKNOWLEDGE_MAGIC_BYTES
    • DEFAULT_CLEAR_TO_SEND_MAGIC_BYTES

      public static final byte[] DEFAULT_CLEAR_TO_SEND_MAGIC_BYTES
    • DEFAULT_PACKET_MAGIC_BYTES

      public static final byte[] DEFAULT_PACKET_MAGIC_BYTES
    • DEFAULT_LAST_PACKET_MAGIC_BYTES

      public static final byte[] DEFAULT_LAST_PACKET_MAGIC_BYTES
    • DEFAULT_READY_TO_RECEIVE_MAGIC_BYTES

      public static final byte[] DEFAULT_READY_TO_RECEIVE_MAGIC_BYTES
    • DEFAULT_READY_TO_SEND_MAGIC_BYTES

      public static final byte[] DEFAULT_READY_TO_SEND_MAGIC_BYTES
    • DEFAULT_ACKNOWLEDGE_RETRY_NUMBER

      public static final int DEFAULT_ACKNOWLEDGE_RETRY_NUMBER
    • DEFAULT_ACKNOWLEDGE_TIMEOUT_IN_MS

      public static final long DEFAULT_ACKNOWLEDGE_TIMEOUT_IN_MS
    • DEFAULT_PING_RETRY_NUMBER

      public static final int DEFAULT_PING_RETRY_NUMBER
    • DEFAULT_PING_TIMEOUT_IN_MS

      public static final long DEFAULT_PING_TIMEOUT_IN_MS
    • DEFAULT_BLOCK_SIZE

      public static final int DEFAULT_BLOCK_SIZE
      See Also:
    • DEFAULT_CLEAR_TO_SEND_TIMEOUT_IN_MS

      public static final long DEFAULT_CLEAR_TO_SEND_TIMEOUT_IN_MS
    • DEFAULT_CRC_ALGORITHM

      public static final org.refcodes.numerical.CrcAlgorithm DEFAULT_CRC_ALGORITHM
    • DEFAULT_CRC_CHECKSUM_CONCATENATE_MODE

      public static final org.refcodes.mixin.ConcatenateMode DEFAULT_CRC_CHECKSUM_CONCATENATE_MODE
    • DEFAULT_CHECKSUM_VALIDATION_MODE

      public static final org.refcodes.numerical.ChecksumValidationMode DEFAULT_CHECKSUM_VALIDATION_MODE
    • DEFAULT_ENCODING

      public static final Charset DEFAULT_ENCODING
    • DEFAULT_END_OF_STRING_BYTE

      public static final byte DEFAULT_END_OF_STRING_BYTE
      See Also:
    • DEFAULT_ENDIANESS

      public static final org.refcodes.numerical.Endianess DEFAULT_ENDIANESS
    • DEFAULT_ENQUIERY_STRANDBY_TIME_IN_MS

      public static final long DEFAULT_ENQUIERY_STRANDBY_TIME_IN_MS
      See Also:
    • DEFAULT_LENGTH_WIDTH

      public static final int DEFAULT_LENGTH_WIDTH
      See Also:
    • DEFAULT_TRUNCATE_LENGTH_WIDTH

      public static final int DEFAULT_TRUNCATE_LENGTH_WIDTH
      See Also:
    • DEFAULT_MAGIC_BYTES_LENGTH

      public static final int DEFAULT_MAGIC_BYTES_LENGTH
      See Also:
    • DEFAULT_READ_TIMEOUT_IN_MS

      public static final long DEFAULT_READ_TIMEOUT_IN_MS
    • DEFAULT_READY_TO_RECEIVE_RETRY_NUMBER

      public static final int DEFAULT_READY_TO_RECEIVE_RETRY_NUMBER
    • DEFAULT_READY_TO_RECEIVE_TIMEOUT_IN_MS

      public static final long DEFAULT_READY_TO_RECEIVE_TIMEOUT_IN_MS
    • DEFAULT_READY_TO_SEND_RETRY_NUMBER

      public static final int DEFAULT_READY_TO_SEND_RETRY_NUMBER
    • DEFAULT_READY_TO_SEND_TIMEOUT_IN_MS

      public static final long DEFAULT_READY_TO_SEND_TIMEOUT_IN_MS
    • DEFAULT_SEQUENCE_NUMBER_CONCATENATE_MODE

      public static final org.refcodes.mixin.ConcatenateMode DEFAULT_SEQUENCE_NUMBER_CONCATENATE_MODE
    • DEFAULT_SEQUENCE_NUMBER_INIT_VALUE

      public static final int DEFAULT_SEQUENCE_NUMBER_INIT_VALUE
      See Also:
    • DEFAULT_SEQUENCE_NUMBER_WIDTH

      public static final int DEFAULT_SEQUENCE_NUMBER_WIDTH
      See Also:
    • DEFAULT_TRANSMISSION_RETRY_NUMBER

      public static final int DEFAULT_TRANSMISSION_RETRY_NUMBER
    • DEFAULT_TRANSMISSION_TIMEOUT_IN_MS

      public static final long DEFAULT_TRANSMISSION_TIMEOUT_IN_MS
    • DEFAULT_WRITE_TIMEOUT_IN_MS

      public static final long DEFAULT_WRITE_TIMEOUT_IN_MS
    • DEFAULT_IO_HEURISTICS_TIME_TO_LIVE_IN_MS

      public static final long DEFAULT_IO_HEURISTICS_TIME_TO_LIVE_IN_MS
    • _acknowledgeMagicBytes

      protected byte[] _acknowledgeMagicBytes
    • _clearToSendMagicBytes

      protected byte[] _clearToSendMagicBytes
    • _packetMagicBytes

      protected byte[] _packetMagicBytes
    • _readyToReceiveMagicBytes

      protected byte[] _readyToReceiveMagicBytes
    • _readyToSendMagicBytes

      protected byte[] _readyToSendMagicBytes
    • _pingMagicBytes

      protected byte[] _pingMagicBytes
    • _pongMagicBytes

      protected byte[] _pongMagicBytes
    • _acknowledgeSegmentPackager

      protected SegmentPackager _acknowledgeSegmentPackager
    • _acknowledgeRetryNumber

      protected int _acknowledgeRetryNumber
    • _acknowledgeTimeoutInMs

      protected long _acknowledgeTimeoutInMs
    • _pingRetryNumber

      protected int _pingRetryNumber
    • _pingTimeoutInMs

      protected long _pingTimeoutInMs
    • _blockSize

      protected int _blockSize
    • _checksumValidationMode

      protected org.refcodes.numerical.ChecksumValidationMode _checksumValidationMode
    • _clearToSendSegmentPackager

      protected SegmentPackager _clearToSendSegmentPackager
    • _clearToSendTimeoutInMs

      protected long _clearToSendTimeoutInMs
    • _crcAlgorithm

      protected org.refcodes.numerical.CrcAlgorithm _crcAlgorithm
    • _crcChecksumConcatenateMode

      protected org.refcodes.mixin.ConcatenateMode _crcChecksumConcatenateMode
    • _encoding

      protected Charset _encoding
    • _endianess

      protected org.refcodes.numerical.Endianess _endianess
    • _endOfStringByte

      protected byte _endOfStringByte
    • _enquiryStandbyTimeInMs

      protected long _enquiryStandbyTimeInMs
    • _lengthWidth

      protected int _lengthWidth
    • _packetLengthWidth

      protected int _packetLengthWidth
    • _magicBytesLength

      protected int _magicBytesLength
    • _packetSegmentPackager

      protected SegmentPackager _packetSegmentPackager
    • _readTimeoutInMs

      protected long _readTimeoutInMs
    • _readyToReceiveRetryNumber

      protected int _readyToReceiveRetryNumber
    • _readyToReceiveSegmentPackager

      protected SegmentPackager _readyToReceiveSegmentPackager
    • _readyToReceiveTimeoutInMs

      protected long _readyToReceiveTimeoutInMs
    • _readyToSendRetryNumber

      protected int _readyToSendRetryNumber
    • _readyToSendSegmentPackager

      protected SegmentPackager _readyToSendSegmentPackager
    • _readyToSendTimeoutInMs

      protected long _readyToSendTimeoutInMs
    • _sequenceNumberConcatenateMode

      protected org.refcodes.mixin.ConcatenateMode _sequenceNumberConcatenateMode
    • _sequenceNumberInitValue

      protected int _sequenceNumberInitValue
    • _sequenceNumberWidth

      protected int _sequenceNumberWidth
    • _transmissionRetryNumber

      protected int _transmissionRetryNumber
    • _transmissionTimeoutInMs

      protected long _transmissionTimeoutInMs
    • _writeTimeoutInMs

      protected long _writeTimeoutInMs
    • _ioHeuristicsTimeToLiveInMs

      protected long _ioHeuristicsTimeToLiveInMs
  • Constructor Details

    • TransmissionMetrics

      protected TransmissionMetrics(TransmissionMetrics.Builder aBuilder)
      Instantiates a new transmission metrics.
      Parameters:
      aBuilder - the builder
    • TransmissionMetrics

      public TransmissionMetrics()
      Creates an instance of the TransmissionMetrics with default values being applied as defined in the TransmissionMetrics type.
  • Method Details

    • toAckSegmentPackager

      public SegmentPackager toAckSegmentPackager()
      Inferences the ACK SegmentPackager. In case one is available as of getAcknowledgeSegmentPackager(), then that is returned. Else CRC settings are evaluated and if possible sufficient CRC settings are available, a CrcSegmentPackager is returned. If there are no sufficient CRC settings, then a SegmentPackager.DummySegmentPackager is returned.
      Returns:
      An interferenced SegmentPackager as of the instance's properties.
    • toPacketSegmentPackager

      public SegmentPackager toPacketSegmentPackager()
      Inferences the packet SegmentPackager. In case one is available as of getPacketSegmentPackager(), then that is returned. Else CRC settings are evaluated and if possible sufficient CRC settings are available, a CrcSegmentPackager is returned. If there are no sufficient CRC settings, then a SegmentPackager.DummySegmentPackager is returned.
      Returns:
      An interferenced SegmentPackager as of the instance's properties.
    • getPongMagicBytes

      public byte[] getPongMagicBytes()
      Retrieves the magic bytes from the pong magic bytes property.
      Specified by:
      getPongMagicBytes in interface PongMagicBytesAccessor
      Returns:
      The magic bytes stored by the pong magic bytes property.
    • getPingMagicBytes

      public byte[] getPingMagicBytes()
      Retrieves the magic bytes from the ping magic bytes property.
      Specified by:
      getPingMagicBytes in interface PingMagicBytesAccessor
      Returns:
      The magic bytes stored by the ping magic bytes property.
    • getPacketLengthWidth

      public int getPacketLengthWidth()
      Retrieves the packet length width (in bytes) from the packet length width (in bytes) property.
      Specified by:
      getPacketLengthWidth in interface PacketLengthWidthAccessor
      Returns:
      The packet length width (in bytes) stored by the packet length width (in bytes) property.
    • getAcknowledgeMagicBytes

      public byte[] getAcknowledgeMagicBytes()
      Retrieves the magic bytes from the acknowledge magic bytes property.
      Specified by:
      getAcknowledgeMagicBytes in interface AcknowledgeMagicBytesAccessor
      Returns:
      The magic bytes stored by the acknowledge magic bytes property.
    • getAcknowledgeSegmentPackager

      public SegmentPackager getAcknowledgeSegmentPackager()
      Retrieves the SegmentPackager ACK property.
      Specified by:
      getAcknowledgeSegmentPackager in interface AcknowledgeSegmentPackagerAccessor
      Returns:
      The SegmentPackager stored by the ACK SegmentPackager property.
    • getAcknowledgeRetryNumber

      public int getAcknowledgeRetryNumber()
      Retrieves the number of retries from the acknowledge retry number. A acknowledge retry number is the overall number of retries to use when counting retries.
      Specified by:
      getAcknowledgeRetryNumber in interface AcknowledgeRetryNumberAccessor
      Returns:
      The number of retries stored by the acknowledge retry number.
    • getAcknowledgeTimeoutMillis

      public long getAcknowledgeTimeoutMillis()
      The acknowledge timeout attribute in milliseconds.
      Specified by:
      getAcknowledgeTimeoutMillis in interface AcknowledgeTimeoutMillisAccessor
      Returns:
      An long integer with the timeout in milliseconds.
    • getPingTimeoutMillis

      public long getPingTimeoutMillis()
      The ping timeout attribute in milliseconds.
      Specified by:
      getPingTimeoutMillis in interface PingTimeoutMillisAccessor
      Returns:
      An long integer with the timeout in milliseconds.
    • getPingRetryNumber

      public int getPingRetryNumber()
      Retrieves the number of retries from the ping retry number. A ping retry number is the overall number of retries to use when counting retries.
      Specified by:
      getPingRetryNumber in interface PingRetryNumberAccessor
      Returns:
      The number of retries stored by the ping retry number.
    • getBlockSize

      public int getBlockSize()
      Specified by:
      getBlockSize in interface org.refcodes.mixin.BlockSizeAccessor
    • getClearToSendMagicBytes

      public byte[] getClearToSendMagicBytes()
      Retrieves the magic bytes from the CTS ("clear-to-send") magic bytes property.
      Specified by:
      getClearToSendMagicBytes in interface ClearToSendMagicBytesAccessor
      Returns:
      The magic bytes stored by the CTS ("clear-to-send") magic bytes property.
    • getClearToSendSegmentPackager

      public SegmentPackager getClearToSendSegmentPackager()
      Retrieves the SegmentPackager CTS ("clear-to-send") property.
      Specified by:
      getClearToSendSegmentPackager in interface ClearToSendSegmentPackagerAccessor
      Returns:
      The SegmentPackager stored by the CTS ("clear-to-send") SegmentPackager property.
    • getClearToSendTimeoutMillis

      public long getClearToSendTimeoutMillis()
      The CTS ("clear-to-send") timeout attribute in milliseconds.
      Specified by:
      getClearToSendTimeoutMillis in interface ClearToSendTimeoutMillisAccessor
      Returns:
      An integer with the CTS ("clear-to-send") timeout in milliseconds.
    • getCrcAlgorithm

      public org.refcodes.numerical.CrcAlgorithm getCrcAlgorithm()
      Specified by:
      getCrcAlgorithm in interface org.refcodes.numerical.CrcAlgorithmAccessor
    • getCrcChecksumConcatenateMode

      public org.refcodes.mixin.ConcatenateMode getCrcChecksumConcatenateMode()
      Specified by:
      getCrcChecksumConcatenateMode in interface org.refcodes.numerical.CrcChecksumConcatenateModeAccessor
    • getChecksumValidationMode

      public org.refcodes.numerical.ChecksumValidationMode getChecksumValidationMode()
      Specified by:
      getChecksumValidationMode in interface org.refcodes.numerical.ChecksumValidationModeAccessor
    • getEncoding

      public Charset getEncoding()
      Specified by:
      getEncoding in interface org.refcodes.mixin.EncodingAccessor<Charset>
    • getEndianess

      public org.refcodes.numerical.Endianess getEndianess()
      Specified by:
      getEndianess in interface org.refcodes.numerical.EndianessAccessor
    • getEndOfStringByte

      public byte getEndOfStringByte()
      Retrieves the end of string byte from the end of string byte property.
      Specified by:
      getEndOfStringByte in interface EndOfStringByteAccessor
      Returns:
      The end of string byte stored by the end of string byte property.
    • getEnquiryStandbyTimeMillis

      public long getEnquiryStandbyTimeMillis()
      The ENQ ("enquiry") timeout attribute in milliseconds.
      Specified by:
      getEnquiryStandbyTimeMillis in interface EnquiryStandbyTimeMillisAccessor
      Returns:
      An integer with the ENQ ("enquiry") timeout in milliseconds.
    • getLengthWidth

      public int getLengthWidth()
      Retrieves the length width (in bytes) from the length width (in bytes) property.
      Specified by:
      getLengthWidth in interface LengthWidthAccessor
      Returns:
      The length width (in bytes) stored by the length width (in bytes) property.
    • getMagicBytesLength

      public int getMagicBytesLength()
      Retrieves the magic bytes length from the magic bytes magic bytes length property.
      Specified by:
      getMagicBytesLength in interface MagicBytesLengthAccessor
      Returns:
      The magic bytes length stored by the magic bytes magic bytes length property.
    • getPacketMagicBytes

      public byte[] getPacketMagicBytes()
      Retrieves the magic bytes from the packet magic bytes property.
      Specified by:
      getPacketMagicBytes in interface PacketMagicBytesAccessor
      Returns:
      The magic bytes stored by the packet magic bytes property.
    • getPacketSegmentPackager

      public SegmentPackager getPacketSegmentPackager()
      Retrieves the SegmentPackager from the packet SegmentPackager property.
      Specified by:
      getPacketSegmentPackager in interface PacketSegmentPackagerAccessor
      Returns:
      The SegmentPackager stored by the packet SegmentPackager property.
    • getReadTimeoutMillis

      public long getReadTimeoutMillis()
      Specified by:
      getReadTimeoutMillis in interface org.refcodes.mixin.ReadTimeoutMillisAccessor
    • getReadyToReceiveMagicBytes

      public byte[] getReadyToReceiveMagicBytes()
      Retrieves the magic bytes from the RTR ("ready-to-receive") magic bytes property.
      Specified by:
      getReadyToReceiveMagicBytes in interface ReadyToReceiveMagicBytesAccessor
      Returns:
      The magic bytes stored by the RTR ("ready-to-receive") magic bytes property.
    • getReadyToReceiveRetryNumber

      public int getReadyToReceiveRetryNumber()
      Retrieves the number of retries from the RTR ("ready-to-receive") retry number. A RTR retry number is the overall number of retries to use when counting retries.
      Specified by:
      getReadyToReceiveRetryNumber in interface ReadyToReceiveRetryNumberAccessor
      Returns:
      The number of retries stored by the RTR ("ready-to-receive") retry number.
    • getReadyToReceiveSegmentPackager

      public SegmentPackager getReadyToReceiveSegmentPackager()
      Retrieves the SegmentPackager RTR ("ready-to-receive") property.
      Specified by:
      getReadyToReceiveSegmentPackager in interface ReadyToReceiveSegmentPackagerAccessor
      Returns:
      The SegmentPackager stored by the RTR ("ready-to-receive") SegmentPackager property.
    • getReadyToReceiveTimeoutMillis

      public long getReadyToReceiveTimeoutMillis()
      The RTR ("ready-to-receive") timeout attribute in milliseconds.
      Specified by:
      getReadyToReceiveTimeoutMillis in interface ReadyToReceiveTimeoutMillisAccessor
      Returns:
      An integer with the RTR ("ready-to-receive") timeout in milliseconds.
    • getReadyToSendMagicBytes

      public byte[] getReadyToSendMagicBytes()
      Retrieves the magic bytes from the RTS ("ready-to-send") magic bytes property.
      Specified by:
      getReadyToSendMagicBytes in interface ReadyToSendMagicBytesAccessor
      Returns:
      The magic bytes stored by the RTS ("ready-to-send") magic bytes property.
    • getReadyToSendRetryNumber

      public int getReadyToSendRetryNumber()
      Retrieves the number of retries from the RTS ("ready-to-send") retry number. A RTS retry number is the overall number of retries to use when counting retries.
      Specified by:
      getReadyToSendRetryNumber in interface ReadyToSendRetryNumberAccessor
      Returns:
      The number of retries stored by the RTS ("ready-to-send") retry number.
    • getReadyToSendSegmentPackager

      public SegmentPackager getReadyToSendSegmentPackager()
      Retrieves the SegmentPackager RTS ("ready-to-send") property.
      Specified by:
      getReadyToSendSegmentPackager in interface ReadyToSendSegmentPackagerAccessor
      Returns:
      The SegmentPackager stored by the RTS ("ready-to-send") SegmentPackager property.
    • getReadyToSendTimeoutMillis

      public long getReadyToSendTimeoutMillis()
      The RTS ("ready-to-send") timeout attribute in milliseconds.
      Specified by:
      getReadyToSendTimeoutMillis in interface ReadyToSendTimeoutMillisAccessor
      Returns:
      An integer with the RTS ("ready-to-send") timeout in milliseconds.
    • getSequenceNumberConcatenateMode

      public org.refcodes.mixin.ConcatenateMode getSequenceNumberConcatenateMode()
      Retrieves the ConcatenateMode from the sequence number ConcatenateMode property.
      Specified by:
      getSequenceNumberConcatenateMode in interface SequenceNumberConcatenateModeAccessor
      Returns:
      The ConcatenateMode stored by the sequence number ConcatenateMode property.
    • getSequenceNumberInitValue

      public int getSequenceNumberInitValue()
      Retrieves the sequence number initial value from the sequence number initial value property.
      Specified by:
      getSequenceNumberInitValue in interface SequenceNumberInitValueAccessor
      Returns:
      The sequence number initial value stored by the sequence number initial value property.
    • getSequenceNumberWidth

      public int getSequenceNumberWidth()
      Retrieves the sequence number width (in bytes) from the sequence number width (in bytes) property.
      Specified by:
      getSequenceNumberWidth in interface SequenceNumberWidthAccessor
      Returns:
      The sequence number width (in bytes) stored by the sequence number width (in bytes) property.
    • getTransmissionRetryNumber

      public int getTransmissionRetryNumber()
      Retrieves the number of retries from the transmission retry number. A transmission retry number is the overall number of retries to use when counting retries.
      Specified by:
      getTransmissionRetryNumber in interface TransmissionRetryNumberAccessor
      Returns:
      The number of retries stored by the transmission retry number.
    • getTransmissionTimeoutMillis

      public long getTransmissionTimeoutMillis()
      The transmission timeout attribute in milliseconds.
      Specified by:
      getTransmissionTimeoutMillis in interface TransmissionTimeoutMillisAccessor
      Returns:
      An long integer with the timeout in milliseconds.
    • getWriteTimeoutMillis

      public long getWriteTimeoutMillis()
      Specified by:
      getWriteTimeoutMillis in interface org.refcodes.mixin.WriteTimeoutMillisAccessor
    • getIoHeuristicsTimeToLiveMillis

      public long getIoHeuristicsTimeToLiveMillis()
      The IO heuristics TTL (time to live) attribute in milliseconds.
      Specified by:
      getIoHeuristicsTimeToLiveMillis in interface IoHeuristicsTimeToLiveMillisAccessor
      Returns:
      An integer with the in milliseconds.
    • builder

      public static TransmissionMetrics.Builder builder()
      Creates builder to build TransmissionMetrics.
      Returns:
      created builder