Skip to content

v2.2.0

Latest

Choose a tag to compare

@kevinherron kevinherron released this 07 Nov 21:23

Compatibility notes

2.2.0 contains API and behavior changes. Review these before upgrading from 2.1.x.

API changes

  • WriteSingleRegisterRequest.value() and WriteSingleRegisterResponse.value() return byte[] instead of int. This breaks source and binary compatibility for callers of value() and record patterns. The (int, int) constructors remain. ReadWriteModbusServices.writeSingleRegister now declares ModbusResponseException. (#169)
  • ModbusClientConfig gained broadcastTurnaroundDelay and responseValidator components. The 2.1.x four-argument constructor no longer exists; use ModbusClientConfig.create(...) or the builder. (#181, #196)
  • SerialPortTransportConfig gained a partialFrameTimeout component, which changes its canonical constructor. Use SerialPortTransportConfig.create(...) or the builder. (#209)

Behavior changes

  • Built-in requests reject out-of-range addresses, quantities, and values with IllegalArgumentException before encoding. Value arrays must be exactly the required length (WriteMultipleCoilsRequest previously accepted a longer buffer), and unused bits in the last coil byte must be zero. (#193)
  • Typed client calls validate responses against their requests. Malformed responses fail with ModbusMalformedResponseException. (#196, #201)
  • Pending client requests fail with ModbusConnectionLostException when the connection is lost, instead of waiting for their timeout. Sends on a disconnected transport fail with ModbusNotConnectedException. (#202, #208)
  • Blocking client calls throw ModbusExecutionException with the exceptions above as the cause. A lost connection previously surfaced as ModbusTimeoutException. (#201, #202, #208)
  • The RTU client keeps one request on the wire at a time. Serial client writes run on the configured executor, which must run tasks on its own threads. (#171, #175)
  • After disconnect(), SerialPortClientTransport.getSerialPort() returns a new SerialPort. Settings applied directly to the previous instance must be reapplied after reconnecting. (#171)
  • RTU client broadcasts go through the request queue. (#181)
  • RTU and RTU-over-TCP servers treat unit ID 0 as a broadcast. They ignore read requests to unit 0, and they deliver write requests to the unit IDs returned by ModbusServices.getBroadcastUnitIds(ModbusRtuRequestContext) (default: unit 0) without sending a response. A custom ModbusRtuServerTransport must accept a null response frame from FrameReceiver.receive. (#195)
  • ModbusClientConfig rejects a negative requestTimeout or one longer than Long.MAX_VALUE nanoseconds. The RTU client schedules timeouts in nanoseconds, so custom TimeoutScheduler implementations must honor the time unit. (#207)
  • Server transports discard partial request frames after partialFrameTimeout. The serial default follows the Modbus end-of-frame delay for the baud rate. USB serial adapters with latency timers may need a longer value. (#209)
  • stop() on Modbus TCP and RTU-over-TCP servers returns only after the listening socket is released. (#213)

What's Changed

New Contributors

Full Changelog: v2.1.6...v2.2.0