diff --git a/fsmPev.py b/fsmPev.py index 95665fd..7a10454 100644 --- a/fsmPev.py +++ b/fsmPev.py @@ -56,6 +56,44 @@ class fsmPev(): self.exiLogFile.write(strDateTime + "=" + schema + " " + s +"\n") # write the EXI data to the exiLogFile return exidata + def prettifyState(self, statenumber): + s="unknownState" + if (statenumber == stateNotYetInitialized): + s = "NotYetInitialized" + if (statenumber == stateConnecting): + s = "Connecting" + if (statenumber == stateConnected): + s = "Connected" + if (statenumber == stateWaitForSupportedApplicationProtocolResponse): + s = "WaitForSupportedApplicationProtocolResponse" + if (statenumber == stateWaitForSessionSetupResponse): + s = "WaitForSessionSetupResponse" + if (statenumber == stateWaitForServiceDiscoveryResponse): + s = "WaitForServiceDiscoveryResponse" + if (statenumber == stateWaitForServicePaymentSelectionResponse): + s = "WaitForServicePaymentSelectionResponse" + if (statenumber == stateWaitForContractAuthenticationResponse): + s = "WaitForContractAuthenticationResponse" + if (statenumber == stateWaitForChargeParameterDiscoveryResponse): + s = "WaitForChargeParameterDiscoveryResponse" + if (statenumber == stateWaitForCableCheckResponse): + s = "WaitForCableCheckResponse" + if (statenumber == stateWaitForPreChargeResponse): + s = "WaitForPreChargeResponse" + if (statenumber == stateWaitForPowerDeliveryResponse): + s = "WaitForPowerDeliveryResponse" + if (statenumber == stateWaitForCurrentDemandResponse): + s = "WaitForCurrentDemandResponse" + if (statenumber == stateWaitForWeldingDetectionResponse): + s = "WaitForWeldingDetectionResponse" + if (statenumber == stateWaitForSessionStopResponse): + s = "WaitForSessionStopResponse" + if (statenumber == stateChargingFinished): + s = "ChargingFinished" + if (statenumber == stateSequenceTimeout): + s = "SequenceTimeout" + return s + def sendChargeParameterDiscoveryReq(self): soc = str(self.hardwareInterface.getSoc()) msg = addV2GTPHeader(self.exiEncode("EDE_"+self.sessionId + "_" + soc)) # EDE for Encode, Din, ChargeParameterDiscovery. @@ -84,7 +122,7 @@ class fsmPev(): self.Tcp.transmit(msg) def enterState(self, n): - print("from " + str(self.state) + " entering " + str(n)) + self.addToTrace("from " + str(self.state) + ":" + self.prettifyState(self.state) + " entering " + str(n) + ":" + self.prettifyState(n)) self.state = n self.cyclesInState = 0 diff --git a/pevNoGui.py b/pevNoGui.py index 254c02c..5009ff6 100755 --- a/pevNoGui.py +++ b/pevNoGui.py @@ -6,8 +6,12 @@ import pyPlcWorker from pyPlcModes import * import sys # for argv +startTime_ms = round(time.time()*1000) + def cbAddToTrace(s): - print(s) + currentTime_ms = round(time.time()*1000) + dT_ms = currentTime_ms - startTime_ms + print("[" + str(dT_ms) + "ms] " + s) def cbShowStatus(s, selection=""): pass diff --git a/pyPlc.py b/pyPlc.py index 7a55b0e..266efbb 100644 --- a/pyPlc.py +++ b/pyPlc.py @@ -12,6 +12,8 @@ import pyPlcWorker from pyPlcModes import * import sys # for argv +startTime_ms = round(time.time()*1000) + def storekeyname(event): global nKeystrokes global lastKey @@ -26,7 +28,9 @@ def inkey(): lastKey = '' def cbAddToTrace(s): - print(s) + currentTime_ms = round(time.time()*1000) + dT_ms = currentTime_ms - startTime_ms + print("[" + str(dT_ms) + "ms] " + s) def cbShowStatus(s, selection=""): #print(s)