Пример #1
0
        public void WriteLap(ILapSummary lap)
        {
            if (lap == null || lap.ElapsedTime == 0)
            {
                return;
            }

            var lapMsg = new LapMesg();

            lapMsg.SetStartTime(new DateTime(lap.StartTime));
            lapMsg.SetTotalElapsedTime(lap.ElapsedTime);
            lapMsg.SetTotalMovingTime(lap.MovingTime);
            lapMsg.SetTotalDistance(lap.Distance.GetValueAs(DistanceUnit.Meter));
            lapMsg.SetAvgSpeed(FitExtensions.GetValidSpeed(lap.AvgSpeed.GetValueAs(SpeedUnit.MeterPerSecond)));
            lapMsg.SetMaxSpeed(FitExtensions.GetValidSpeed(lap.MaxSpeed.GetValueAs(SpeedUnit.MeterPerSecond)));
            lapMsg.SetAvgHeartRate((byte)lap.AvgHeartRate);
            lapMsg.SetMaxHeartRate((byte)lap.MaxHeartRate);
            lapMsg.SetAvgPower((ushort)lap.AvgPower);
            lapMsg.SetMaxPower((ushort)lap.MaxPower);
            lapMsg.SetAvgCadence((byte)lap.AvgCadence);
            lapMsg.SetMaxCadence((byte)lap.MaxCadence);
            lapMsg.SetTotalAscent(Convert.ToUInt16(lap.Ascent));
            lapMsg.SetTotalDescent(Convert.ToUInt16(lap.Descent));
            _encoder.Write(lapMsg);
        }
Пример #2
0
        public void WriteSummary()
        {
            // Session message
            var sessionMsg = new SessionMesg();

            sessionMsg.SetStartTime(new DateTime(Activity.StartTime));
            sessionMsg.SetTotalElapsedTime(Activity.ElapsedTime);
            sessionMsg.SetTotalMovingTime(Activity.MovingTime);
            sessionMsg.SetSport(Activity.Sport);
            sessionMsg.SetTotalDistance(Activity.Distance.GetValueAs(DistanceUnit.Meter));
            sessionMsg.SetAvgSpeed(FitExtensions.GetValidSpeed(Activity.AvgSpeed.GetValueAs(SpeedUnit.MeterPerSecond)));
            sessionMsg.SetMaxSpeed(FitExtensions.GetValidSpeed(Activity.MaxSpeed.GetValueAs(SpeedUnit.MeterPerSecond)));
            sessionMsg.SetAvgHeartRate((byte)Activity.AvgHeartRate);
            sessionMsg.SetMaxHeartRate((byte)Activity.MaxHeartRate);
            sessionMsg.SetAvgPower((ushort)Activity.AvgPower);
            sessionMsg.SetMaxPower((ushort)Activity.MaxPower);
            sessionMsg.SetAvgCadence((byte)Activity.AvgCadence);
            sessionMsg.SetMaxCadence((byte)Activity.MaxCadence);
            sessionMsg.SetTotalAscent(Convert.ToUInt16(Activity.Ascent));
            sessionMsg.SetTotalDescent(Convert.ToUInt16(Activity.Descent));
            _encoder.Write(sessionMsg);
        }