Skip to content

Commit 4dcd54c

Browse files
committed
Merge pull request #115 from hamiltonkibbe/read_device_info_fix
Read device info fix
2 parents 60a7266 + b951503 commit 4dcd54c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

pymodbus/mei_message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class ReadDeviceInformationRequest(ModbusRequest):
2525
2626
The Read Device Identification interface is modeled as an address space
2727
composed of a set of addressable data elements. The data elements are
28-
called objects and an object Id identifies them.
28+
called objects and an object Id identifies them.
2929
'''
3030
function_code = 0x2b
3131
sub_function_code = 0x0e
32-
_rtu_frame_size = 3
32+
_rtu_frame_size = 7
3333

3434
def __init__(self, read_code=None, object_id=0x00, **kwargs):
3535
''' Initializes a new instance

test/test_mei_messages.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
MEI Message Test Fixture
44
--------------------------------
55
6-
This fixture tests the functionality of all the
6+
This fixture tests the functionality of all the
77
mei based request/response messages:
88
'''
99
import unittest
@@ -45,7 +45,7 @@ def testReadDeviceInformationRequest(self):
4545
control = ModbusControlBlock()
4646
control.Identity.VendorName = "Company"
4747
control.Identity.ProductCode = "Product"
48-
control.Identity.MajorMinorevision = "v2.1.12"
48+
control.Identity.MajorMinorRevision = "v2.1.12"
4949

5050
handle = ReadDeviceInformationRequest()
5151
result = handle.execute(context)
@@ -69,7 +69,7 @@ def testReadDeviceInformationRequestError(self):
6969
def testReadDeviceInformationResponseEncode(self):
7070
''' Test that the read fifo queue response can encode '''
7171
message = '\x0e\x01\x83\x00\x00\x03'
72-
message += '\x00\x07Company\x01\x07Product\x02\x07v2.1.12'
72+
message += '\x00\x07Company\x01\x07Product\x02\x07v2.1.12'
7373
dataset = {
7474
0x00: 'Company',
7575
0x01: 'Product',
@@ -84,7 +84,7 @@ def testReadDeviceInformationResponseEncode(self):
8484
def testReadDeviceInformationResponseDecode(self):
8585
''' Test that the read device information response can decode '''
8686
message = '\x0e\x01\x01\x00\x00\x03'
87-
message += '\x00\x07Company\x01\x07Product\x02\x07v2.1.12'
87+
message += '\x00\x07Company\x01\x07Product\x02\x07v2.1.12'
8888
handle = ReadDeviceInformationResponse(read_code=0x00, information=[])
8989
handle.decode(message)
9090
self.assertEqual(handle.read_code, DeviceInformation.Basic)
@@ -98,6 +98,9 @@ def testRtuFrameSize(self):
9898
message = '\x04\x2B\x0E\x01\x81\x00\x01\x01\x00\x06\x66\x6F\x6F\x62\x61\x72\xD7\x3B'
9999
result = ReadDeviceInformationResponse.calculateRtuFrameSize(message)
100100
self.assertEqual(result, 18)
101+
message = '\x00\x2B\x0E\x02\x00\x4D\x47'
102+
result = ReadDeviceInformationRequest.calculateRtuFrameSize(message)
103+
self.assertEqual(result, 7)
101104

102105

103106
#---------------------------------------------------------------------------#

0 commit comments

Comments
 (0)