mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
19 lines
No EOL
495 B
Python
19 lines
No EOL
495 B
Python
|
|
|
|
def twoCharHex(b):
|
|
strHex = "%0.2X" % b
|
|
return strHex
|
|
|
|
def showAsHex(mybytearray, description=""):
|
|
packetlength = len(mybytearray)
|
|
strHex = ""
|
|
for i in range(0, packetlength):
|
|
strHex = strHex + twoCharHex(mybytearray[i]) + " "
|
|
print(description + "(" + str(packetlength) + "bytes) = " + strHex)
|
|
|
|
def prettyMac(macByteArray):
|
|
s=""
|
|
for i in range(0, 5):
|
|
s = s + twoCharHex(macByteArray[i]) + ":"
|
|
s = s + twoCharHex(macByteArray[i])
|
|
return s |