improved gui. cleanups.

This commit is contained in:
uhi22 2022-10-24 23:19:45 +02:00
parent 92e54a76a7
commit 6c1264015c
3 changed files with 8 additions and 16 deletions

View file

@ -32,7 +32,7 @@ def cbShowStatus(s, selection=""):
lblMode['text']=s
s=""
if (selection == "pevmac"):
lblPevMac['text']=s
lblPevMac['text']="PEV MAC " + s
s=""
if (len(s)>0):
lblStatus['text']=s
@ -40,9 +40,8 @@ def cbShowStatus(s, selection=""):
root = tk.Tk()
lastKey = ''
display = tk.Label(root, text='No Key', width=30) # A textual element in the graphical user interface
display.pack()
lblHelp = tk.Label(root, text="x=exit, t=testframe")
lblHelp = tk.Label(root, justify= "left")
lblHelp['text']="x=exit \nS=GET_SW \nP=PEV mode \nE=EVSE mode \nL=Listen mode \ns=SET_KEY \nG=GET_KEY (try twice) \nt=SET_KEY modified"
lblHelp.pack()
lblStatus = tk.Label(root, text="(Status)")
lblStatus.pack()
@ -52,7 +51,6 @@ lblMode = tk.Label(root, text="(mode)")
lblMode.pack()
# Bind the keyboard handler to all relevant elements:
display.bind('<Key>', storekeyname)
root.bind('<Key>', storekeyname)
cbShowStatus("initialized")
root.update()

View file

@ -401,8 +401,7 @@ class pyPlcHomeplug():
self.mytransmitbuffer[37]=0x43 #
def sendTestFrame(self, selection):
def sendTestFrame(self, selection):
if (selection=="1"):
self.composeSlacParamReq()
self.addToTrace("transmitting SLAC_PARAM.REQ...")
@ -420,13 +419,9 @@ class pyPlcHomeplug():
self.addToTrace("transmitting SET_KEY.REQ (key 0)")
self.transmit(self.mytransmitbuffer)
if (selection=="t"):
self.composeSetKey(2)
self.composeSetKey(2) # set key with modified content
self.addToTrace("transmitting SET_KEY.REQ (key 2)")
self.transmit(self.mytransmitbuffer)
if (selection=="D"):
self.composeDHCP()
self.addToTrace("transmitting broken DHCP")
self.transmit(self.mytransmitbuffer)
if (selection=="G"):
self.composeGetKey()
self.addToTrace("transmitting GET_KEY")
@ -600,10 +595,10 @@ class pyPlcHomeplug():
for ts, pkt in self.sniffer: # attention: for using this in non-blocking manner, we need the patch described above.
self.nPacketsReceived+=1
# print('%d' % (ts)) # the time stamp
# We received an ethernet package. Determine its type, and dispatch it to the related handler.
etherType = self.getEtherType(pkt)
if (etherType == 0x88E1): # it is a HomePlug message
self.myreceivebuffer = pkt
# self.showMacAddresses(pkt)
self.evaluateReceivedHomeplugPacket()
if (etherType == 0x86dd): # it is an IPv6 frame
self.ipv6.evaluateReceivedPacket(pkt)

View file

@ -33,8 +33,7 @@ class pyPlcWorker():
if (strAction == "E"):
self.hp.enterEvseMode()
if (strAction == "L"):
self.hp.enterListenMode()
self.addToTrace("UserAction " + strAction)
self.hp.enterListenMode()
# self.addToTrace("UserAction " + strAction)
self.hp.sendTestFrame(strAction)