mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
socket.inet_ntoa() does not like bytearray's
This commit is contained in:
parent
c05f9c1aab
commit
7ad5c34e20
|
@ -335,6 +335,8 @@ def pack_ip_addr(addr):
|
|||
|
||||
def unpack_ip_addr(addr):
|
||||
"""Given a six-octet BACnet address, return an IP address tuple."""
|
||||
if isinstance(addr, bytearray):
|
||||
addr = bytes(addr)
|
||||
return (socket.inet_ntoa(addr[0:4]), struct.unpack('!H', addr[4:6])[0])
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue
Block a user