Example #1
0
        private Offtrack StartOfftrack(double sessionTime)
        {
            _previousOfftrack = _currentOfftrack;

            _currentOfftrack = new Offtrack(this.Driver.Id, sessionTime);
            this.Offtracks.Add(_currentOfftrack);
            this.Driver.OfftrackTotalCount = this.Offtracks.Count;

            return(_currentOfftrack);
        }
        private Offtrack StartOfftrack(double sessionTime)
        {
            _previousOfftrack = _currentOfftrack;

            _currentOfftrack = new Offtrack(this.Driver.Id, sessionTime);
            this.Offtracks.Add(_currentOfftrack);
            this.Driver.OfftrackTotalCount = this.Offtracks.Count;

            return _currentOfftrack;
        }
Example #3
0
        public Offtrack RegisterTrackStatus(TrackSurfaces status, double sessionTime)
        {
            if (status == TrackSurfaces.OffTrack)
            {
                // Currently offtrack
                if (_currentOfftrack == null)
                {
                    // Was not offtrack before - check how long ago they went ontrack again

                    // Is the previous offtrack long enough ago?
                    if (_previousOfftrack != null && _previousOfftrack.EndTime.HasValue &&
                        _previousOfftrack.EndTime.Value <= sessionTime - Properties.Settings.Default.OfftrackTimeout * 1000)
                    {
                        // Previous offtrack was less than OfftrackTimeout ago: ignore
                        return(null);
                    }

                    // Is the speed high enough? > 35 mph = 56.327
                    if (this.Driver.Live.Speed < MIN_OFFTRACK_SPEED)
                    {
                        // Too slow - ignore
                        return(null);
                    }

                    this.StartOfftrack(sessionTime);
                    return(_currentOfftrack);
                }
                else
                {
                    // Was already offtrack - ignore
                    return(null);
                }
            }
            else
            {
                // Not currently offtrack
                if (_currentOfftrack != null)
                {
                    // Driver just returned to track - set end time
                    _currentOfftrack.EndTime = sessionTime;

                    var cur = _currentOfftrack;
                    _currentOfftrack = null;
                    return(cur);
                }
            }
            return(null);
        }
        public Offtrack RegisterTrackStatus(TrackSurfaces status, double sessionTime)
        {
            if (status == TrackSurfaces.OffTrack)
            {
                // Currently offtrack
                if (_currentOfftrack == null)
                {
                    // Was not offtrack before - check how long ago they went ontrack again

                    // Is the previous offtrack long enough ago?
                    if (_previousOfftrack != null && _previousOfftrack.EndTime.HasValue &&
                        _previousOfftrack.EndTime.Value <= sessionTime - Properties.Settings.Default.OfftrackTimeout * 1000)
                    {
                        // Previous offtrack was less than OfftrackTimeout ago: ignore
                        return null;
                    }

                    // Is the speed high enough? > 35 mph = 56.327
                    if (this.Driver.Live.Speed < MIN_OFFTRACK_SPEED)
                    {
                        // Too slow - ignore
                        return null;
                    }

                    this.StartOfftrack(sessionTime);
                    return _currentOfftrack;
                }
                else
                {
                    // Was already offtrack - ignore
                    return null;
                }
            }
            else
            {
                // Not currently offtrack
                if (_currentOfftrack != null)
                {
                    // Driver just returned to track - set end time
                    _currentOfftrack.EndTime = sessionTime;

                    var cur = _currentOfftrack;
                    _currentOfftrack = null;
                    return cur;
                }
            }
            return null;
        }
Example #5
0
 public void Clear()
 {
     _previousOfftrack = null;
     _currentOfftrack  = null;
     this.Offtracks.Clear();
 }
 public void Clear()
 {
     _previousOfftrack = null;
     _currentOfftrack = null;
     this.Offtracks.Clear();
 }