mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
endless PreCharge for testing
This commit is contained in:
parent
6fd0f72666
commit
7839bb335d
1 changed files with 9 additions and 1 deletions
10
fsmPev.py
10
fsmPev.py
|
@ -167,6 +167,9 @@ class fsmPev():
|
||||||
self.enterState(0)
|
self.enterState(0)
|
||||||
|
|
||||||
def stateFunctionWaitForPreChargeResponse(self):
|
def stateFunctionWaitForPreChargeResponse(self):
|
||||||
|
if (self.DelayCycles>0):
|
||||||
|
self.DelayCycles-=1
|
||||||
|
return
|
||||||
if (len(self.rxData)>0):
|
if (len(self.rxData)>0):
|
||||||
print("In state WaitForPreChargeResponse, received " + prettyHexMessage(self.rxData))
|
print("In state WaitForPreChargeResponse, received " + prettyHexMessage(self.rxData))
|
||||||
exidata = removeV2GTPHeader(self.rxData)
|
exidata = removeV2GTPHeader(self.rxData)
|
||||||
|
@ -176,7 +179,11 @@ class fsmPev():
|
||||||
if (strConverterResult.find("PreChargeRes")>0):
|
if (strConverterResult.find("PreChargeRes")>0):
|
||||||
# todo: check the request content, and fill response parameters
|
# todo: check the request content, and fill response parameters
|
||||||
print("PreCharge aknowledge received.")
|
print("PreCharge aknowledge received.")
|
||||||
print("As Demo, we stay in PreCharge until the timeout elapses.")
|
print("As Demo, we stay in PreCharge forever.")
|
||||||
|
msg = addV2GTPHeader(exiEncode("EDG_"+self.sessionId)) # EDG for Encode, Din, PreCharge
|
||||||
|
print("responding " + prettyHexMessage(msg))
|
||||||
|
self.Tcp.transmit(msg)
|
||||||
|
self.DelayCycles=15 # wait with the next evaluation approx half a second
|
||||||
if (self.isTooLong()):
|
if (self.isTooLong()):
|
||||||
self.enterState(0)
|
self.enterState(0)
|
||||||
|
|
||||||
|
@ -216,6 +223,7 @@ class fsmPev():
|
||||||
self.state = stateNotYetInitialized
|
self.state = stateNotYetInitialized
|
||||||
self.sessionId = "DEAD55AADEAD55AA"
|
self.sessionId = "DEAD55AADEAD55AA"
|
||||||
self.cyclesInState = 0
|
self.cyclesInState = 0
|
||||||
|
self.DelayCycles = 0
|
||||||
self.rxData = []
|
self.rxData = []
|
||||||
# we do NOT call the reInit, because we want to wait with the connection until external trigger comes
|
# we do NOT call the reInit, because we want to wait with the connection until external trigger comes
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue