feat(Modbus): add ReadInputsAsync function#10
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds the ReadInputsAsync function to the Modbus library, implementing support for reading discrete inputs (function code 0x02) from Modbus TCP slaves. The implementation refactors the existing Modbus client code to support multiple read operations through a shared private method.
- Implements
ReadInputsAsyncmethod for reading discrete inputs (FC2) - Refactors existing
ReadCoilsAsyncimplementation to use shared validation and parsing logic - Makes factory method parameters optional for better usability
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Longbow.Modbus/IModbusTcpClient.cs | Updates interface to add ReadInputsAsync method and improve documentation |
| src/Longbow.Modbus/DefaultModbusTcpClient.cs | Implements ReadInputsAsync with shared validation logic and refactors existing code |
| src/Longbow.Modbus/IModbusFactory.cs | Makes factory method parameters optional |
| src/Longbow.Modbus/DefaultModbusFactory.cs | Updates factory implementation to handle optional parameters |
| src/Longbow.Modbus/ModbusMessageBuilder.cs | Changes return type from byte[] to ReadOnlyMemory<byte> |
| test/UnitTestModbus/TcpClientTest.cs | Adds unit test for new ReadInputsAsync functionality |
| test/UnitTestSocket/TcpSocketFactoryTest.cs | Updates service registration calls |
| test/UnitTestSocket/DefaultSocketClientProviderTest.cs | Updates service registration calls |
| src/Longbow.TcpSocket/Longbow.TcpSocket.csproj | Version bump to 9.0.1 |
| src/Longbow.Socket/Longbow.Socket.csproj | Version bump to 9.0.1 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link issues
fixes #9
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge