mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
added reading and interpreting of EXI trace file
This commit is contained in:
parent
19fbeec864
commit
cd6654030f
1 changed files with 22 additions and 7 deletions
|
@ -207,6 +207,7 @@ def testDecoder(strHex, pre="DH", comment=""):
|
||||||
print("Decoder test for " + comment + " with data " + strHex)
|
print("Decoder test for " + comment + " with data " + strHex)
|
||||||
decoded=exiDecode(strHex, pre)
|
decoded=exiDecode(strHex, pre)
|
||||||
print(decoded)
|
print(decoded)
|
||||||
|
if (len(comment)>0):
|
||||||
strExpected = comment
|
strExpected = comment
|
||||||
if (decoded.find(strExpected)>0):
|
if (decoded.find(strExpected)>0):
|
||||||
print("---pass---")
|
print("---pass---")
|
||||||
|
@ -214,10 +215,24 @@ def testDecoder(strHex, pre="DH", comment=""):
|
||||||
print("---***!!!FAIL!!!***---")
|
print("---***!!!FAIL!!!***---")
|
||||||
nFail+=1
|
nFail+=1
|
||||||
|
|
||||||
|
def testReadExiFromFile():
|
||||||
|
file1 = open('results\\tmp.txt', 'r')
|
||||||
|
Lines = file1.readlines()
|
||||||
|
for myLine in Lines:
|
||||||
|
if (myLine[0:9]=="[SNIFFER]"):
|
||||||
|
posOfEqualsign = myLine.find("=")
|
||||||
|
s = myLine[posOfEqualsign+1:] # The part after the "=" contains the EXI hex data.
|
||||||
|
s = s.replace(" ", "") # Remove blanks
|
||||||
|
s = s.replace("\n", "") # Remove line feeds
|
||||||
|
#print(s)
|
||||||
|
testDecoder(s, "DD", "")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
nFail=0
|
nFail=0
|
||||||
print("Testing exiConnector...")
|
print("Testing exiConnector...")
|
||||||
|
testReadExiFromFile()
|
||||||
|
exit()
|
||||||
#testByteArrayConversion("123456")
|
#testByteArrayConversion("123456")
|
||||||
#testByteArrayConversion("1234567")
|
#testByteArrayConversion("1234567")
|
||||||
#testByteArrayConversion("ABCDEF")
|
#testByteArrayConversion("ABCDEF")
|
||||||
|
|
Loading…
Reference in a new issue