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 lblMode['text']=s
s="" s=""
if (selection == "pevmac"): if (selection == "pevmac"):
lblPevMac['text']=s lblPevMac['text']="PEV MAC " + s
s="" s=""
if (len(s)>0): if (len(s)>0):
lblStatus['text']=s lblStatus['text']=s
@ -40,9 +40,8 @@ def cbShowStatus(s, selection=""):
root = tk.Tk() root = tk.Tk()
lastKey = '' lastKey = ''
display = tk.Label(root, text='No Key', width=30) # A textual element in the graphical user interface lblHelp = tk.Label(root, justify= "left")
display.pack() 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 = tk.Label(root, text="x=exit, t=testframe")
lblHelp.pack() lblHelp.pack()
lblStatus = tk.Label(root, text="(Status)") lblStatus = tk.Label(root, text="(Status)")
lblStatus.pack() lblStatus.pack()
@ -52,7 +51,6 @@ lblMode = tk.Label(root, text="(mode)")
lblMode.pack() lblMode.pack()
# Bind the keyboard handler to all relevant elements: # Bind the keyboard handler to all relevant elements:
display.bind('<Key>', storekeyname)
root.bind('<Key>', storekeyname) root.bind('<Key>', storekeyname)
cbShowStatus("initialized") cbShowStatus("initialized")
root.update() root.update()

View file

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

View file

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