Skip to content

Commit

Permalink
FRAMER_NAME_TO_OLD_CLASS.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Oct 4, 2024
1 parent 3c4edbf commit 9768e54
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pymodbus/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pymodbus.client.modbusclientprotocol import ModbusClientProtocol
from pymodbus.exceptions import ConnectionException, ModbusIOException
from pymodbus.factory import ClientDecoder
from pymodbus.framer import FRAMER_NAME_TO_CLASS, FramerType, ModbusFramer
from pymodbus.framer import FRAMER_NAME_TO_OLD_CLASS, FramerType, ModbusFramer
from pymodbus.logging import Log
from pymodbus.pdu import ModbusRequest, ModbusResponse
from pymodbus.transaction import SyncModbusTransactionManager
Expand Down Expand Up @@ -188,7 +188,7 @@ def __init__(
self.slaves: list[int] = []

# Common variables.
self.framer: ModbusFramer = FRAMER_NAME_TO_CLASS.get(
self.framer: ModbusFramer = FRAMER_NAME_TO_OLD_CLASS.get(
framer, cast(type[ModbusFramer], framer)
)(ClientDecoder(), self)
self.transaction = SyncModbusTransactionManager(
Expand Down
4 changes: 2 additions & 2 deletions pymodbus/client/modbusclientprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import cast

from pymodbus.factory import ClientDecoder
from pymodbus.framer import FRAMER_NAME_TO_CLASS, FramerType, ModbusFramer
from pymodbus.framer import FRAMER_NAME_TO_OLD_CLASS, FramerType, ModbusFramer
from pymodbus.logging import Log
from pymodbus.transaction import ModbusTransactionManager
from pymodbus.transport import CommParams, ModbusProtocol
Expand All @@ -32,7 +32,7 @@ def __init__(
self.on_connect_callback = on_connect_callback

# Common variables.
self.framer = FRAMER_NAME_TO_CLASS.get(
self.framer = FRAMER_NAME_TO_OLD_CLASS.get(
framer, cast(type[ModbusFramer], framer)
)(ClientDecoder(), self)
self.transaction = ModbusTransactionManager()
Expand Down
4 changes: 2 additions & 2 deletions pymodbus/framer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Framer."""
__all__ = [
"Framer",
"FRAMER_NAME_TO_CLASS",
"FRAMER_NAME_TO_OLD_CLASS",
"ModbusFramer",
"ModbusAsciiFramer",
"ModbusRtuFramer",
Expand All @@ -19,7 +19,7 @@
from pymodbus.framer.old_framer_tls import ModbusTlsFramer


FRAMER_NAME_TO_CLASS = {
FRAMER_NAME_TO_OLD_CLASS = {
FramerType.ASCII: ModbusAsciiFramer,
FramerType.RTU: ModbusRtuFramer,
FramerType.SOCKET: ModbusSocketFramer,
Expand Down
4 changes: 2 additions & 2 deletions pymodbus/server/async_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pymodbus.device import ModbusControlBlock, ModbusDeviceIdentification
from pymodbus.exceptions import NoSuchSlaveException
from pymodbus.factory import ServerDecoder
from pymodbus.framer import FRAMER_NAME_TO_CLASS, FramerType, ModbusFramer
from pymodbus.framer import FRAMER_NAME_TO_OLD_CLASS, FramerType, ModbusFramer
from pymodbus.logging import Log
from pymodbus.pdu import ModbusExceptions as merror
from pymodbus.transport import CommParams, CommType, ModbusProtocol
Expand Down Expand Up @@ -274,7 +274,7 @@ def __init__(
if isinstance(identity, ModbusDeviceIdentification):
self.control.Identity.update(identity)

self.framer = FRAMER_NAME_TO_CLASS.get(framer, framer)
self.framer = FRAMER_NAME_TO_OLD_CLASS.get(framer, framer)
self.serving: asyncio.Future = asyncio.Future()

def callback_new_connection(self):
Expand Down

0 comments on commit 9768e54

Please sign in to comment.