bashwork/pymodbus — Issue #3: 	ReadFileRecordResponse <calculateRtuFrameSize> calculates invalid size
Author: bashwork
Created: 2012-01-14 16:02:23+00:00
State: open

Working on current SVN trunk, Revision r176
Code to reproduce:

records = []
records.append(FileRecord(file_number=26, record_number=0, record_length=1))
request = ReadFileRecordRequest(records)
request.unit_id = 4

rq = c.client.execute(request)

Problem:
- When calculating the response frame, the function ReadFileRecordResponse.calculateRtuFrameSize will have the whole frame as argument in including address and function code.

If changed from
byte_count = struct.unpack('B', buffer[0])[0]
to
byte_count = struct.unpack('B', buffer[2])[0] + 5
the function starts to work correctly.