18
18
from pymodbus .client .asynchronous .mixins import (AsyncModbusClientMixin ,
19
19
AsyncModbusSerialClientMixin )
20
20
from pymodbus .exceptions import ConnectionException
21
- from pymodbus .utilities import hexlify_packets
21
+ from pymodbus .compat import byte2int
22
22
23
23
LOGGER = logging .getLogger (__name__ )
24
24
@@ -74,7 +74,7 @@ def on_receive(self, *args):
74
74
75
75
if not data :
76
76
return
77
- LOGGER .debug ("recv: " + hexlify_packets ( data ))
77
+ LOGGER .debug ("recv: " + " " . join ([ hex ( byte2int ( x )) for x in data ] ))
78
78
unit = self .framer .decode_data (data ).get ("unit" , 0 )
79
79
self .framer .processIncomingPacket (data , self ._handle_response , unit = unit )
80
80
@@ -86,7 +86,7 @@ def execute(self, request=None):
86
86
"""
87
87
request .transaction_id = self .transaction .getNextTID ()
88
88
packet = self .framer .buildPacket (request )
89
- LOGGER .debug ("send: " + hexlify_packets ( packet ))
89
+ LOGGER .debug ("send: " + " " . join ([ hex ( byte2int ( x )) for x in packet ] ))
90
90
self .stream .write (packet )
91
91
return self ._build_response (request .transaction_id )
92
92
@@ -174,7 +174,7 @@ def callback(*args):
174
174
if waiting :
175
175
data = self .stream .connection .read (waiting )
176
176
LOGGER .debug (
177
- "recv: " + hexlify_packets ( data ))
177
+ "recv: " + " " . join ([ hex ( byte2int ( x )) for x in data ] ))
178
178
unit = self .framer .decode_data (data ).get ("uid" , 0 )
179
179
self .framer .processIncomingPacket (
180
180
data ,
@@ -185,7 +185,7 @@ def callback(*args):
185
185
break
186
186
187
187
packet = self .framer .buildPacket (request )
188
- LOGGER .debug ("send: " + hexlify_packets ( packet ))
188
+ LOGGER .debug ("send: " + " " . join ([ hex ( byte2int ( x )) for x in packet ] ))
189
189
self .stream .write (packet , callback = callback )
190
190
f = self ._build_response (request .transaction_id )
191
191
return f
0 commit comments