1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Wayne.Lib.StateEngine;
- using Wayne.Lib.StateEngine.Generic;
- namespace SinochemInternetPlusApp.States.CarPlateManualMode
- {
- public class SendTrxDoneToCardReader : TimeoutState<FuelingPoint>
- {
- private byte sqNo;
- protected override void Enter(StateEntry stateEntry, ref Transition transition)
- {
- base.Enter(stateEntry, ref transition);
- Main.NotifyCardReaderTrxDone(out sqNo);
- }
- protected override void HandleNonTimeoutEvent(StateEngineEvent stateEngineEvent, ref Transition transition)
- {
- GenericEvent<CardReaderAckEventArgs> ackEvent = stateEngineEvent as GenericEvent<CardReaderAckEventArgs>;
- if (ackEvent != null && ackEvent.EventArgs != null)
- {
- if (ackEvent.EventArgs.Ack.MessageSeqNumber == sqNo)
- {
- ackEvent.Handled = true;
- Main.CardReaderDisabled = false;
- transition = new Transition(this, TransitionType.Done);
- }
- }
- }
- protected override void Timeout(ref Transition transition)
- {
- transition = new Transition(this, TransitionType.Timeout);
- }
- protected override int TimeoutInterval =>
- TimeoutValues.GetValueInMilliSec(TimeoutValues.FuelingPoint.CarPlateMode_SendTrxDoneToCardReader, 10);
- }
- }
|