123456789101112131415161718192021222324252627282930313233343536373839 |
- using Wayne.Lib.StateEngine;
- using WayneChina_IcCardReader_SinoChem.MessageEntity;
- using WayneChina_IcCardReader_SinoChem.MessageEntity.Outgoing;
- namespace SinochemInternetPlusApp.States.ICCardMode
- {
- public class SendCalculateMacRequest : SendCardReaderCommandBase
- {
- protected override void Enter(StateEntry stateEntry, ref Transition transition)
- {
- base.Enter(stateEntry, ref transition);
- }
- protected override void HandleNonTimeoutEvent(StateEngineEvent stateEngineEvent, ref Transition transition)
- {
- //First step, an ACK expected.
- var e = stateEngineEvent as GenericEvent<CardReaderAckEventArgs>;
- if (e != null && e.EventArgs != null)
- {
- if (e.EventArgs.Ack.MessageSeqNumber == sqNo)
- {
- e.Handled = true;
- transition = new Transition(this, TransitionType.Done);
- }
- }
- }
- protected override IcCardReaderMessageBase CreateCommand()
- {
- DebugLog($"Is current Eps trx null? {Main.CurrentEpsTrx == null}");
- byte[] targetBytes = Main.GetMAC(Main.CurrentEpsTrx.Model);
- return new SignDataRequest(targetBytes);
- }
- protected override int TimeoutInterval =>
- TimeoutValues.GetValueInMilliSec(TimeoutValues.FuelingPoint.ICCardMode_SendCalculateMacRequest, 10);
- }
- }
|