Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.ArrayIndexOutOfBoundsException when accessing coil index #87

Open
paulorb opened this issue Feb 9, 2023 · 1 comment
Open

Comments

@paulorb
Copy link

paulorb commented Feb 9, 2023

When performing a read of coils

           val request = ReadCoilsRequest()
            request.serverAddress = 1
            request.startAddress = 0
            request.transactionId = 0
            request.quantity = 123
            val response = m.processRequest(request) as ReadCoilsResponse

When trying to get the value of an individual coil, it gives an exception java.lang.ArrayIndexOutOfBoundsException when accessing a specific coil index

println("test: ${response.modbusCoils.get(120)}")

As a workaround I am using the coils property (which is indicated to be deprecated)

println("test: ${response.coils.get(120)}")

@kochedykov
Copy link
Owner

Tested, it works. There is no OutOfBounds exception.

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

No branches or pull requests

2 participants