Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
WriteCoilsRequest
-
Hi,
I'm Andrex
(http://mango.serotoninsoftware.com/forum/posts/list/379.page#1831)after some test of tcp transport I found some unexpected exception while send more than 1016 coil values.
After decompiling modbus4J.jar shipped with the version 1.8.2 of mango I found that line 60 of
com.serotonin.modbus4j.msg.WriteCoilsRequest
/* 60 */ this.data = new byte[ModbusUtils.popByte(queue)];
is the origin of th exception.
After changing the line to/* 60 */ this.data = new byte[ModbusUtils.popUnsignedByte(queue)];
(using unsigned value) my test pass correctly.
I dont know if the original row is incorrect or if my change is a good correction, but I hope to be helpful.
Regards
Andrea -
Hi Andrea,
Thanks for reporting this. You are correct, an unsigned byte should be popped at that point. I've made the fix in the code.
-
Oh, also, i believe a similar change is required in WriteRegistersRequest at line 59:
data = new byte[ModbusUtils.popByte(queue)];
... should be:
data = new byte[ModbusUtils.popUnsignedByte(queue)];