mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
improved gui. cleanups.
This commit is contained in:
parent
92e54a76a7
commit
6c1264015c
3 changed files with 8 additions and 16 deletions
8
pyPlc.py
8
pyPlc.py
|
@ -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()
|
||||||
|
|
|
@ -402,7 +402,6 @@ class pyPlcHomeplug():
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -34,7 +34,6 @@ class pyPlcWorker():
|
||||||
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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue