Пример #1
0
        public override void HandleEvent(IUnitTripService tripService, EventDTO evt)
        {
            if (evt.EventData == IgnitionEvent.IGNITION_ON)
            {
                // Ignition on when trip in progress - mark current trip as undetermined
                tripService.CurrentTrip.SetUndetermined();

                // Add the undetermined trip to the list
                tripService.AddCurrentTripToList();

                // Create a new trip from this start date
                tripService.CurrentTrip = _tripFactory.CreateNewTrip(tripService.UnitId, evt.DateTime.Value);
            }
            else
            {
                // Ingition Off - complete the trip
                tripService.CurrentTrip.Complete(evt.DateTime.Value);

                // Perform additional processing on the complete trip
                foreach (var processor in _tripProcessors)
                {
                    processor.Process(tripService.CurrentTrip);
                }

                // Add the undetermined trip to the list
                tripService.AddCurrentTripToList();

                // Finished
                tripService.SetState(TripState.Finished);
            }
        }
Пример #2
0
 public override void HandleEvent(IUnitTripService tripService, EventDTO evt)
 {
     // No action required if ignition off event and no trip in progress
     if (evt.EventData == IgnitionEvent.IGNITION_ON)
     {
         tripService.CurrentTrip = _tripFactory.CreateNewTrip(tripService.UnitId, evt.DateTime.Value);
         tripService.SetState(TripState.Started);
     }
 }
Пример #3
0
 public abstract void HandleEvent(IUnitTripService tripService, EventDTO evt);