Skip to content

feat(Modbus): add ReadInputsAsync function#10

Merged
ArgoZhang merged 8 commits into
mainfrom
feat-modbus
Sep 4, 2025
Merged

feat(Modbus): add ReadInputsAsync function#10
ArgoZhang merged 8 commits into
mainfrom
feat-modbus

Conversation

@ArgoZhang

Copy link
Copy Markdown
Member

Link issues

fixes #9

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Copilot AI review requested due to automatic review settings September 4, 2025 03:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ReadInputsAsync method for reading discrete inputs (FC2)
  • Refactors existing ReadCoilsAsync implementation 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.

Comment thread src/Longbow.Modbus/DefaultModbusTcpClient.cs Outdated
Comment thread src/Longbow.Modbus/DefaultModbusTcpClient.cs Outdated
@ArgoZhang ArgoZhang merged commit 0dfc733 into main Sep 4, 2025
1 check failed
@ArgoZhang ArgoZhang deleted the feat-modbus branch September 4, 2025 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Modbus): add ReadInputsAsync function

2 participants