All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Fix PHP 8.5 warning and bump dependencies #173
- Allow unit ID to be in range of 0-255 #160
- Adds Function 11 (0x0b)
Get Communication Event Counterand Function 17 (0x11)Report server IDsupport #156
- Debug page for writing registers, similar to index.php which is for reading registers #148
- Fix undefined variable in example
- Fix deprecated string interpolation for PHP8.2 #153
- Endian fixes when
Endian::$defaultEndianis set before request/response is created #145 - Add ability to delay receiving response after request is sent (useful for Serial devices) #144
- Improved
exmaples/index.phpwith ability to read serial devices #144
- AddressSplitter can avoid unaddressable ranges when splitting read requests #141
- Made
Compose/*Builderclasses*AddressSplitterfield protected so extending classes can change that field. AddressSplitterusesisFirstByte()for byte sorting- Fixed parsing composer
WriteRegisterRequestandWriteCoilRequestrequests - they should act as composerRead*Requestclasses and return an array (empty in this case).Composer\Write\Register\WriteRegisterRequestandComposer\Write\Coil\WriteCoilRequestmethodParsenow returnsarray|ErrorResponseas interface implementation should.
- Fixed
Packet::isCompleteLengthRTU()to differentiate fix sized function code responses from variable sized responses.
- Added
Packet::isCompleteLengthRTU()to help checking if packet is complete RTU packet. Helps when receiving fragmented packets. - Example for RTU over TCP with higher level API examples/rtu_over_tcp_with_higherlevel_api.php
ResultContainer.offsetGetwas missing return type- Update Github CI flow to run on PRs
Breaking change - types for all arguments/return values
- Minimum version is now PHP 8.0
- All method arguments and returns values have types now
- Examples use now up-to-date React event loop
- Adds Function 22 (0x16) Mask Write Register support
- Use PHPStan for code static analysis in CI flow
- support for
double(64bit double precision floating point) data type to API. This requires PHP 7.2+ as it uses https://www.php.net/manual/en/function.pack.phpEandeformats.
- Use PHP 8.1 in CI flow.
examples/index.phpnow supports FC3 and FC4 requests.
- From PHP 8.1
Types::parseAsciiStringFromRegister()fails to convert extended ASCII (8bit) characters to UTF-8. IntroducedCharset::$defaultCharsetto be able to set default charset used to convert strings.
- Allow high level API setting custom endian for
stringaddress withReadRegistersBuilderandStringReadRegisterAddressclasses.
- Allow high level API setting custom endian for each address with
ReadRegistersBuilderandReadRegisterAddressclasses.
BinaryStreamConnectionendless loop (CPU @ 100%) when stream is ready for reading but stream returns no data at all (#73)
- Example for Modbus server examples/example_response_server.php
- Changed examples to use
Packet::isCompleteLength()
- Added functions to check is received data is complete/error Modbus TCP packet (PR #63)
- Changed
StreamHandlerto read data until complete packet is received. Previously we read only once from stream and naively assumed that Modbus TCP packet can not be fragmented over multiple TCP packets/ multiple stream reads. This fixed #61.
- Escape stty command for SerialStreamCreator to avoid unescaped arguments (#54)
- Added high level API to compose Coil (fc1/2) requests. See:
ModbusTcpClient\Composer\Read\ReadCoilsBuilderModbusTcpClient\Composer\Write\WriteCoilsBuilder
- Added 'serial' protocol support to
BinaryStreamConnection. See examples/rtu_usb_to_serial_stream.php how to use it. - Added example to read modbus RTU from Usb to rs-485 adapter and SHT20 sensor (#50)
- Adds Function 23 (0x17) Read/Write Multiple registers support (#47)
- Started changelog
- Adds request time on example request page
- (BREAKING change) abstract class
ModbusTcpClient\Composer\Addresschanged to interface