1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using SinochemCarplateService.Models;
- using System;
- using System.Collections.Generic;
- using Wayne.Lib;
- using Wayne.Lib.StateEngine;
- using Wayne.Lib.StateEngine.Generic;
- namespace SinochemInternetPlusApp.States.CarPlateMode
- {
- class CalculateMAC : TimeoutState<FuelingPoint>
- {
- private byte sqNo;
- protected override void Enter(StateEntry stateEntry, ref Transition transition)
- {
- base.Enter(stateEntry, ref transition);
- transition = new Transition(this, TransitionType.Done);
- return;
- DebugLog("Start to calculate MAC");
- //Main.GetMAC(new CarPlateTrxRequest()
- //{
- // amount = 10.00,
- // card_No = "08888118001000078417",
- // car_Number = "晋A12345",
- // gun = "2",
- //}, out sqNo);
- }
- protected override void HandleNonTimeoutEvent(StateEngineEvent stateEngineEvent, ref Transition transition)
- {
- if (stateEngineEvent.Type.Equals(EventType.DataSigned))
- {
- GenericEvent<SignedDataEventArgs> signDataEvent = stateEngineEvent as GenericEvent<SignedDataEventArgs>;
- if (signDataEvent != null && signDataEvent.EventArgs != null)
- {
- signDataEvent.Handled = true;
- DebugLog($" Signed Data arrived\n Mac Value: {signDataEvent.EventArgs.SignedDataResponse.MacValue}\n"); ;
- transition = new Transition(this, TransitionType.Done);
- }
- }
- //if (stateEngineEvent.Type is EventType)
- //{
- // switch ((EventType)stateEngineEvent.Type)
- // {
- // case EventType.ICCardReaderMACResponse:
- // transition = new Transition(this, TransitionType.ICCardReaderMACResponse);
- // stateEngineEvent.Handled = true;
- // break;
- // }
- //}
- }
- protected override void Timeout(ref Transition transition)
- {
- transition = new Transition(this, TransitionType.Timeout);
- }
- protected override int TimeoutInterval =>
- TimeoutValues.GetValueInMilliSec(TimeoutValues.FuelingPoint.CarPlateMode_CalculateMAC, 10);
- }
- }
|