Skip to content

Commit 565ab1e

Browse files
authored
slave_id -> dev_id (internally). (#2486)
1 parent 7572508 commit 565ab1e

File tree

19 files changed

+148
-151
lines changed

19 files changed

+148
-151
lines changed

examples/client_custom_msg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CustomModbusPDU(ModbusPDU):
3838

3939
def __init__(self, values=None, slave=1, transaction=0):
4040
"""Initialize."""
41-
super().__init__(slave_id=slave, transaction_id=transaction)
41+
super().__init__(dev_id=slave, transaction_id=transaction)
4242
self.values = values or []
4343

4444
def encode(self):
@@ -70,7 +70,7 @@ class CustomRequest(ModbusPDU):
7070

7171
def __init__(self, address=None, slave=1, transaction=0):
7272
"""Initialize."""
73-
super().__init__(slave_id=slave, transaction_id=transaction)
73+
super().__init__(dev_id=slave, transaction_id=transaction)
7474
self.address = address
7575
self.count = 16
7676

@@ -105,7 +105,7 @@ def __init__(self, address, slave=1, transaction=0):
105105
106106
:param address: The address to start reading from
107107
"""
108-
super().__init__(address=address, count=16, slave_id=slave, transaction_id=transaction)
108+
super().__init__(address=address, count=16, dev_id=slave, transaction_id=transaction)
109109

110110

111111
# --------------------------------------------------------------------------- #

examples/modbus_forwarder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async def run_forwarder(args):
5656
)
5757
args.client.connect()
5858
assert args.client.connected
59-
# If required to communicate with a specified client use slave=<slave_id>
59+
# If required to communicate with a specified client use slave=<device id>
6060
# in RemoteSlaveContext
6161
# For e.g to forward the requests to slave with slave address 1 use
6262
# store = RemoteSlaveContext(client, slave=1)

examples/server_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async def run_async_server(args):
152152
# custom_functions=[], # allow custom handling
153153
framer=args.framer, # The framer strategy to use
154154
# ignore_missing_slaves=True, # ignore request to a missing slave
155-
# broadcast_enable=False, # treat slave_id 0 as broadcast address,
155+
# broadcast_enable=False, # treat slave 0 as broadcast address,
156156
# timeout=1, # waiting time for request to complete
157157
)
158158
elif args.comm == "udp":
@@ -167,7 +167,7 @@ async def run_async_server(args):
167167
# custom_functions=[], # allow custom handling
168168
framer=args.framer, # The framer strategy to use
169169
# ignore_missing_slaves=True, # ignore request to a missing slave
170-
# broadcast_enable=False, # treat slave_id 0 as broadcast address,
170+
# broadcast_enable=False, # treat slave 0 as broadcast address,
171171
# timeout=1, # waiting time for request to complete
172172
)
173173
elif args.comm == "serial":
@@ -186,7 +186,7 @@ async def run_async_server(args):
186186
baudrate=args.baudrate, # The baud rate to use for the serial device
187187
# handle_local_echo=False, # Handle local echo of the USB-to-RS485 adaptor
188188
# ignore_missing_slaves=True, # ignore request to a missing slave
189-
# broadcast_enable=False, # treat slave_id 0 as broadcast address,
189+
# broadcast_enable=False, # treat slave 0 as broadcast address,
190190
)
191191
elif args.comm == "tls":
192192
address = (args.host if args.host else "", args.port if args.port else None)
@@ -207,7 +207,7 @@ async def run_async_server(args):
207207
), # The key file path for TLS (used if sslctx is None)
208208
# password="none", # The password for for decrypting the private key file
209209
# ignore_missing_slaves=True, # ignore request to a missing slave
210-
# broadcast_enable=False, # treat slave_id 0 as broadcast address,
210+
# broadcast_enable=False, # treat slave 0 as broadcast address,
211211
# timeout=1, # waiting time for request to complete
212212
)
213213
return server

examples/server_sync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def run_sync_server(args):
7878
# custom_functions=[], # allow custom handling
7979
framer=args.framer, # The framer strategy to use
8080
# ignore_missing_slaves=True, # ignore request to a missing slave
81-
# broadcast_enable=False, # treat slave_id 0 as broadcast address,
81+
# broadcast_enable=False, # treat slave 0 as broadcast address,
8282
# timeout=1, # waiting time for request to complete
8383
)
8484
elif args.comm == "udp":
@@ -90,7 +90,7 @@ def run_sync_server(args):
9090
# custom_functions=[], # allow custom handling
9191
framer=args.framer, # The framer strategy to use
9292
# ignore_missing_slaves=True, # ignore request to a missing slave
93-
# broadcast_enable=False, # treat slave_id 0 as broadcast address,
93+
# broadcast_enable=False, # treat slave 0 as broadcast address,
9494
# timeout=1, # waiting time for request to complete
9595
)
9696
elif args.comm == "serial":
@@ -109,7 +109,7 @@ def run_sync_server(args):
109109
baudrate=args.baudrate, # The baud rate to use for the serial device
110110
# handle_local_echo=False, # Handle local echo of the USB-to-RS485 adaptor
111111
# ignore_missing_slaves=True, # ignore request to a missing slave
112-
# broadcast_enable=False, # treat slave_id 0 as broadcast address,
112+
# broadcast_enable=False, # treat slave 0 as broadcast address,
113113
)
114114
elif args.comm == "tls":
115115
address = ("", args.port) if args.port else None
@@ -130,7 +130,7 @@ def run_sync_server(args):
130130
), # The key file path for TLS (used if sslctx is None)
131131
# password=None, # The password for for decrypting the private key file
132132
# ignore_missing_slaves=True, # ignore request to a missing slave
133-
# broadcast_enable=False, # treat slave_id 0 as broadcast address,
133+
# broadcast_enable=False, # treat slave 0 as broadcast address,
134134
# timeout=1, # waiting time for request to complete
135135
)
136136
return server

0 commit comments

Comments
 (0)