Skip to content

Commit 3fb83cc

Browse files
committed
Fix #461 - Udp client/server , Fix #401 - package license with source, #457 Fix typo's in docstrings, #455-Support float16
1 parent 4bdf738 commit 3fb83cc

22 files changed

+80
-30
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Version 2.3.0
2+
-----------------------------------------------------------
3+
* Support Modbus TLS (client / server)
4+
* Distribute license with source
5+
* BinaryPayloadDecoder/Encoder now supports float16 on python3.6 and above
6+
* Fix asyncio UDP client/server
7+
* Minor cosmetic updates
8+
19
Version 2.3.0rc1
210
-----------------------------------------------------------
311
* Asyncio Server implementation (Python 3.7 and above only)

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include requirements.txt
22
include README.rst
3-
include CHANGELOG.rst
3+
include CHANGELOG.rst
4+
include doc/LICENSE

examples/common/async_asyncio_client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# Import the required asynchronous client
1717
# ----------------------------------------------------------------------- #
1818
from pymodbus.client.asynchronous.tcp import AsyncModbusTCPClient as ModbusClient
19-
# from pymodbus.client.asynchronous.udp import (
20-
# AsyncModbusUDPClient as ModbusClient)
19+
from pymodbus.client.asynchronous.udp import (
20+
AsyncModbusUDPClient as ModbusClient)
2121
from pymodbus.client.asynchronous import schedulers
2222

2323
else:
@@ -141,6 +141,7 @@ def run_with_not_running_loop():
141141
log.debug("------------------------------------------------------")
142142
loop = asyncio.new_event_loop()
143143
assert not loop.is_running()
144+
asyncio.set_event_loop(loop)
144145
new_loop, client = ModbusClient(schedulers.ASYNC_IO, port=5020, loop=loop)
145146
loop.run_until_complete(start_async_test(client.protocol))
146147
loop.close()
@@ -191,9 +192,12 @@ def run_with_no_loop():
191192
ModbusClient Factory creates a loop.
192193
:return:
193194
"""
195+
log.debug("---------------------RUN_WITH_NO_LOOP-----------------")
194196
loop, client = ModbusClient(schedulers.ASYNC_IO, port=5020)
195197
loop.run_until_complete(start_async_test(client.protocol))
196198
loop.close()
199+
log.debug("--------DONE RUN_WITH_NO_LOOP-------------")
200+
log.debug("")
197201

198202

199203
if __name__ == '__main__':
@@ -207,5 +211,5 @@ def run_with_no_loop():
207211

208212
# Run with already running loop
209213
run_with_already_running_loop()
210-
log.debug("---------------------RUN_WITH_NO_LOOP-----------------")
214+
211215
log.debug("")

examples/common/asynchronous_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def run_async_server():
108108
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
109109
identity.ProductName = 'Pymodbus Server'
110110
identity.ModelName = 'Pymodbus Server'
111-
identity.MajorMinorRevision = '2.2.0'
111+
identity.MajorMinorRevision = '2.3.0'
112112

113113
# ----------------------------------------------------------------------- #
114114
# run the server you want

examples/common/asyncio_server.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# --------------------------------------------------------------------------- #
1212
# import the various server implementations
1313
# --------------------------------------------------------------------------- #
14+
import asyncio
1415
from pymodbus.server.asyncio import StartTcpServer
1516
from pymodbus.server.asyncio import StartUdpServer
1617
from pymodbus.server.asyncio import StartSerialServer
@@ -105,15 +106,15 @@ async def run_server():
105106
identity.VendorUrl = 'http://github.com/riptideio/pymodbus/'
106107
identity.ProductName = 'Pymodbus Server'
107108
identity.ModelName = 'Pymodbus Server'
108-
identity.MajorMinorRevision = '2.2.0'
109+
identity.MajorMinorRevision = '2.3.0'
109110

110111
# ----------------------------------------------------------------------- #
111112
# run the server you want
112113
# ----------------------------------------------------------------------- #
113114
# Tcp:
114115
# immediately start serving:
115-
server = await StartTcpServer(context, identity=identity, address=("0.0.0.0", 5020),
116-
allow_reuse_address=True)
116+
# server = await StartTcpServer(context, identity=identity, address=("0.0.0.0", 5020),
117+
# allow_reuse_address=True)
117118

118119
# deferred start:
119120
# server = await StartTcpServer(context, identity=identity, address=("0.0.0.0", 5020),
@@ -122,19 +123,15 @@ async def run_server():
122123
# asyncio.get_event_loop().call_later(20, lambda : server.)
123124
# await server.serve_forever()
124125

125-
126-
127-
128126
# TCP with different framer
129127
# StartTcpServer(context, identity=identity,
130128
# framer=ModbusRtuFramer, address=("0.0.0.0", 5020))
131129

132130
# Udp:
133-
# server = await StartUdpServer(context, identity=identity, address=("0.0.0.0", 5020),
134-
# allow_reuse_address=True, defer_start=True)
131+
server = await StartUdpServer(context, identity=identity, address=("0.0.0.0", 5020),
132+
allow_reuse_address=True, defer_start=True)
135133
#
136-
# await server.serve_forever()
137-
134+
await server.serve_forever()
138135

139136
# !!! SERIAL SERVER NOT IMPLEMENTED !!!
140137
# Ascii:

examples/common/callback_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def run_callback_server():
132132
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
133133
identity.ProductName = 'pymodbus Server'
134134
identity.ModelName = 'pymodbus Server'
135-
identity.MajorMinorRevision = '2.2.0'
135+
identity.MajorMinorRevision = '2.3.0'
136136

137137
# ----------------------------------------------------------------------- #
138138
# run the server you want

examples/common/custom_datablock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def run_custom_db_server():
6868
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
6969
identity.ProductName = 'pymodbus Server'
7070
identity.ModelName = 'pymodbus Server'
71-
identity.MajorMinorRevision = '2.2.0'
71+
identity.MajorMinorRevision = '2.3.0'
7272

7373
# ----------------------------------------------------------------------- #
7474
# run the server you want

examples/common/custom_synchronous_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def run_server():
101101
identity.VendorUrl = 'http://github.com/riptideio/pymodbus/'
102102
identity.ProductName = 'Pymodbus Server'
103103
identity.ModelName = 'Pymodbus Server'
104-
identity.MajorMinorRevision = '2.1.0'
104+
identity.MajorMinorRevision = '2.3.0'
105105

106106
# ----------------------------------------------------------------------- #
107107
# run the server you want

examples/common/dbstore_update_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def run_dbstore_update_server():
8686
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
8787
identity.ProductName = 'pymodbus Server'
8888
identity.ModelName = 'pymodbus Server'
89-
identity.MajorMinorRevision = '2.2.0'
89+
identity.MajorMinorRevision = '2.3.0'
9090

9191
# ----------------------------------------------------------------------- #
9292
# run the server you want

examples/common/modbus_payload.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def run_binary_payload_ex():
8181
builder.add_16bit_uint(0x1234)
8282
builder.add_32bit_int(-0x1234)
8383
builder.add_32bit_uint(0x12345678)
84+
builder.add_16bit_float(12.34)
85+
builder.add_16bit_float(-12.34)
8486
builder.add_32bit_float(22.34)
8587
builder.add_32bit_float(-22.34)
8688
builder.add_64bit_int(-0xDEADBEEF)
@@ -144,6 +146,8 @@ def run_binary_payload_ex():
144146
('16uint', decoder.decode_16bit_uint()),
145147
('32int', decoder.decode_32bit_int()),
146148
('32uint', decoder.decode_32bit_uint()),
149+
('16float', decoder.decode_16bit_float()),
150+
('16float2', decoder.decode_16bit_float()),
147151
('32float', decoder.decode_32bit_float()),
148152
('32float2', decoder.decode_32bit_float()),
149153
('64int', decoder.decode_64bit_int()),

0 commit comments

Comments
 (0)