Skip to content

Commit 9f736df

Browse files
authored
Merge new message layer and old framer directory. (#2135)
* message ==> framers. * Rename message to framing. * Framer ==> FramerType. * Update doc. * Move complete.
1 parent 2e31260 commit 9f736df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1219
-681
lines changed

API_changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ API changes 3.7.0
1010
- on_reconnect_callback() removed from clients (sync/async).
1111
- on_connect_callback(true/false) added to async clients.
1212
- binary framer no longer supported
13+
- Framer.<type> renamed to FramerType.<type>
1314

1415

1516
API changes 3.6.0

check_ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ codespell
99
ruff check --fix --exit-non-zero-on-fix .
1010
pylint --recursive=y examples pymodbus test
1111
mypy pymodbus
12-
pytest --cov --numprocesses auto
12+
pytest -x --cov --numprocesses auto
1313
echo "Ready to push"

doc/source/_static/examples.tgz

-43 Bytes
Binary file not shown.

doc/source/_static/examples.zip

-26 Bytes
Binary file not shown.

doc/source/library/architecture/architecture.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ The internal structure of pymodbus is a bit complicated, mostly due to the mixtu
55

66
The overall architecture can be viewed as:
77

8+
89
Client classes (interface to applications)
910
mixin (interface with all requests defined as methods)
10-
transaction (handles transactions and allow concurrent calls)
11-
framers (add pre/post headers to make a valid package)
12-
transport (handles actual transportation)
11+
Lower levels are Common
1312

1413
Server classes (interface to applications)
1514
datastores (handles registers/values to be returned)
15+
Lower levels are Common
16+
17+
pdu (build/create response/request class)
1618
transaction (handles transactions and allow concurrent calls)
1719
framers (add pre/post headers to make a valid package)
1820
transport (handles actual transportation)
@@ -25,4 +27,3 @@ In detail the packages can viewed as:
2527
In detail the classes can be viewed as:
2628

2729
.. image:: classes.png
28-

doc/source/library/framer.rst

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
Framer
22
======
33

4-
pymodbus\.framer\.ascii_framer module
5-
-------------------------------------
4+
pymodbus\.framer\.old_framer_ascii module
5+
-----------------------------------------
66

7-
.. automodule:: pymodbus.framer.ascii_framer
7+
.. automodule:: pymodbus.framer.old_framer_ascii
88
:members:
99
:undoc-members:
1010
:show-inheritance:
1111

12-
pymodbus\.framer\.rtu_framer module
13-
-----------------------------------
12+
pymodbus\.framer\.old_framer_rtu module
13+
---------------------------------------
1414

15-
.. automodule:: pymodbus.framer.rtu_framer
15+
.. automodule:: pymodbus.framer.old_framer_rtu
1616
:members:
1717
:undoc-members:
1818
:show-inheritance:
1919

20-
pymodbus\.framer\.socket_framer module
21-
--------------------------------------
20+
pymodbus\.framer\.old_framer_socket module
21+
------------------------------------------
2222

23-
.. automodule:: pymodbus.framer.socket_framer
23+
.. automodule:: pymodbus.framer.old_framer_socket
24+
:members:
25+
:undoc-members:
26+
:show-inheritance:
27+
28+
pymodbus\.framer\.old_framer_tls module
29+
---------------------------------------
30+
31+
.. automodule:: pymodbus.framer.old_framer_tls
2432
:members:
2533
:undoc-members:
2634
:show-inheritance:

examples/client_custom_msg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import asyncio
1414
import struct
1515

16-
from pymodbus import Framer
16+
from pymodbus import FramerType
1717
from pymodbus.bit_read_message import ReadCoilsRequest
1818
from pymodbus.client import AsyncModbusTcpClient as ModbusClient
1919
from pymodbus.pdu import ModbusExceptions, ModbusRequest, ModbusResponse
@@ -118,7 +118,7 @@ def __init__(self, address, **kwargs):
118118

119119
async def main(host="localhost", port=5020):
120120
"""Run versions of read coil."""
121-
async with ModbusClient(host=host, port=port, framer_name=Framer.SOCKET) as client:
121+
async with ModbusClient(host=host, port=port, framer_name=FramerType.SOCKET) as client:
122122
await client.connect()
123123

124124
# new modbus function code.

examples/client_performance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import asyncio
1717
import time
1818

19-
from pymodbus import Framer
19+
from pymodbus import FramerType
2020
from pymodbus.client import AsyncModbusSerialClient, ModbusSerialClient
2121

2222

@@ -29,7 +29,7 @@ def run_sync_client_test():
2929
print("--- Testing sync client v3.4.1")
3030
client = ModbusSerialClient(
3131
"/dev/ttys007",
32-
framer_name=Framer.RTU,
32+
framer_name=FramerType.RTU,
3333
baudrate=9600,
3434
)
3535
client.connect()
@@ -56,7 +56,7 @@ async def run_async_client_test():
5656
print("--- Testing async client v3.4.1")
5757
client = AsyncModbusSerialClient(
5858
"/dev/ttys007",
59-
framer_name=Framer.RTU,
59+
framer_name=FramerType.RTU,
6060
baudrate=9600,
6161
)
6262
await client.connect()

examples/package_test_tool.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
import pymodbus.client as modbusClient
5151
import pymodbus.server as modbusServer
52-
from pymodbus import Framer, ModbusException, pymodbus_apply_logging_config
52+
from pymodbus import FramerType, ModbusException, pymodbus_apply_logging_config
5353
from pymodbus.datastore import (
5454
ModbusSequentialDataBlock,
5555
ModbusServerContext,
@@ -160,14 +160,14 @@ def __init__(self, comm: CommType):
160160
if comm == CommType.TCP:
161161
self.server = modbusServer.ModbusTcpServer(
162162
self.context,
163-
framer=Framer.SOCKET,
163+
framer=FramerType.SOCKET,
164164
identity=self.identity,
165165
address=(NULLMODEM_HOST, test_port),
166166
)
167167
elif comm == CommType.SERIAL:
168168
self.server = modbusServer.ModbusSerialServer(
169169
self.context,
170-
framer=Framer.SOCKET,
170+
framer=FramerType.SOCKET,
171171
identity=self.identity,
172172
port=f"{NULLMODEM_HOST}:{test_port}",
173173
)

examples/server_hook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import asyncio
88
import logging
99

10-
from pymodbus import Framer, pymodbus_apply_logging_config
10+
from pymodbus import FramerType, pymodbus_apply_logging_config
1111
from pymodbus.datastore import (
1212
ModbusSequentialDataBlock,
1313
ModbusServerContext,
@@ -63,7 +63,7 @@ async def setup(self):
6363
)
6464
self.server = ModbusTcpServer(
6565
context,
66-
Framer.SOCKET,
66+
FramerType.SOCKET,
6767
None,
6868
("127.0.0.1", 5020),
6969
request_tracer=self.server_request_tracer,

0 commit comments

Comments
 (0)