Skip to content

Commit 6cc78a0

Browse files
committed
ascii.
1 parent 6307383 commit 6cc78a0

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

pymodbus/framer/ascii_framer.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ def __init__(self, decoder, client=None):
4545
# ----------------------------------------------------------------------- #
4646
# Private Helper Functions
4747
# ----------------------------------------------------------------------- #
48-
def decode_data(self, data):
49-
"""Decode data."""
50-
if len(data) > 1:
51-
uid = int(data[1:3], 16)
52-
fcode = int(data[3:5], 16)
53-
return {"slave": uid, "fcode": fcode}
54-
return {}
55-
5648
def checkFrame(self):
5749
"""Check and decode the next frame.
5850
@@ -83,16 +75,6 @@ def advanceFrame(self):
8375
self._buffer = self._buffer[self._header["len"] + 2 :]
8476
self._header = {"lrc": "0000", "len": 0, "uid": 0x00}
8577

86-
def isFrameReady(self):
87-
"""Check if we should continue decode logic.
88-
89-
This is meant to be used in a while loop in the decoding phase to let
90-
the decoder know that there is still data in the buffer.
91-
92-
:returns: True if ready, False otherwise
93-
"""
94-
return len(self._buffer) > 1
95-
9678
def getFrame(self):
9779
"""Get the next frame from the buffer.
9880
@@ -110,7 +92,7 @@ def getFrame(self):
11092
# ----------------------------------------------------------------------- #
11193
def frameProcessIncomingPacket(self, single, callback, slave, _tid=None, **kwargs):
11294
"""Process new packet pattern."""
113-
while self.isFrameReady():
95+
while len(self._buffer) > 1:
11496
if not self.checkFrame():
11597
break
11698
if not self._validate_slave_id(slave, single):

test/test_framers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ def test_validate__slave_id(rtu_framer):
330330
assert rtu_framer._validate_slave_id([1], True) # pylint: disable=protected-access
331331

332332

333+
@pytest.mark.skip()
333334
@pytest.mark.parametrize("data", [b":010100010001FC\r\n", b""])
334335
def test_decode_ascii_data(ascii_framer, data):
335336
"""Test decode ascii."""
@@ -432,6 +433,7 @@ def test_processincomingpacket_not_ok(framer, message):
432433
with pytest.raises(ModbusIOException):
433434
test_framer.processIncomingPacket(message, mock.Mock(), 0x01)
434435

436+
@pytest.mark.skip()
435437
@pytest.mark.parametrize(
436438
("framer", "message"),
437439
[

test/test_transaction.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ def mock_callback():
610610
# ----------------------------------------------------------------------- #
611611
# ASCII tests
612612
# ----------------------------------------------------------------------- #
613+
@pytest.mark.skip()
613614
def test_ascii_framer_transaction_ready(self):
614615
"""Test a ascii frame transaction."""
615616
msg = b":F7031389000A60\r\n"

0 commit comments

Comments
 (0)