コード例 #1
0
        public static void Stop()
        {
            var now = new DateTime(System.DateTime.Now);

            TerminateLap();

            sessionMesg.SetTimestamp(now);
            sessionMesg.SetSport(Sport.Cycling);
            sessionMesg.SetSubSport(SubSport.VirtualActivity);
            sessionMesg.SetTotalDistance(State.TripTotalKm * 1000);
            sessionMesg.SetTotalElapsedTime(State.TripTotalTime);
            sessionMesg.SetFirstLapIndex(0);
            sessionMesg.SetNumLaps(numLaps);
            sessionMesg.SetEvent(Event.Session);
            sessionMesg.SetEventType(EventType.Stop);
            sessionMesg.SetEventGroup(0);

            activityMesg = new ActivityMesg();
            activityMesg.SetTimestamp(now);
            activityMesg.SetTotalTimerTime(State.TripTotalTime);
            activityMesg.SetNumSessions(1);
            activityMesg.SetType(Activity.Manual);
            activityMesg.SetEvent(Event.Activity);
            activityMesg.SetEventType(EventType.Stop);
            activityMesg.SetEventGroup(0);

            encoder.Write(sessionMesg);
            encoder.Write(activityMesg);

            encoder.Close();
            fitDest.Close();
        }
コード例 #2
0
ファイル: FitWriter.cs プロジェクト: dmwnz/beamng-cycling
        public static void Stop(DateTime?time = null)
        {
            Trace.TraceInformation("Stop()");
            var now = time ?? DateTime.UtcNow;

            TerminateLap(time);

            if (!isPaused)
            {
                Pause(time);
            }

            sessionMesg.SetTimestamp(new Dynastream.Fit.DateTime(now));
            sessionMesg.SetSport(Sport.Cycling);
            sessionMesg.SetSubSport(SubSport.VirtualActivity);
            sessionMesg.SetTotalDistance(totalDistance);
            sessionMesg.SetTotalElapsedTime((float)(now - startTime).TotalSeconds);
            sessionMesg.SetTotalTimerTime((float)totalTimerTime.TotalSeconds);
            sessionMesg.SetFirstLapIndex(0);
            sessionMesg.SetNumLaps(numLaps);
            sessionMesg.SetEvent(Event.Session);
            sessionMesg.SetEventType(EventType.Stop);
            sessionMesg.SetEventGroup(0);
            sessionMesg.SetStartTime(new Dynastream.Fit.DateTime(startTime));

            activityMesg = new ActivityMesg();
            activityMesg.SetTimestamp(new Dynastream.Fit.DateTime(now));
            activityMesg.SetTotalTimerTime((float)totalTimerTime.TotalSeconds);
            activityMesg.SetNumSessions(1);
            activityMesg.SetType(Activity.Manual);
            activityMesg.SetEvent(Event.Activity);
            activityMesg.SetEventType(EventType.Stop);
            activityMesg.SetEventGroup(0);

            encoder.Write(sessionMesg);
            encoder.Write(activityMesg);

            encoder.Close();
            fitDest.Close();

            csvFile.Close();
        }