tuyendothanh / nmodbus

Automatically exported from code.google.com/p/nmodbus
0 stars 0 forks source link

WriteMultipleCoils notifies DataStoreWrittenTo even with invalid values count #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Subscribe to DataStore.DataStoreWrittenTo
2. WriteMultipleCoils 10 values

What is the expected output? What do you see instead?
DataStoreEventArgs.A.Count in DataStore.DataStoreWrittenTo should be 10.
Instead is 16. (Always multiple of 8)

What version of the product are you using? On what operating system?
Version 1.8.0.0. Vista 32bit.

Please provide any additional information below.
Can be easily fixed in WriteMultipleCoilsRequest.cs:73 
Method InitializeUnique(byte[] frame)
Data should be set like this:
Data = new DiscreteCollection((new BitArray(frame.Slice(7,
ByteCount).ToArray())).Cast<bool>().Take(NumberOfPoints).ToArray());

Original issue reported on code.google.com by cio...@gmail.com on 30 Oct 2008 at 11:41

GoogleCodeExporter commented 9 years ago

Original comment by sja...@gmail.com on 24 Nov 2008 at 6:32