public static LapSummary ToSumary(this LapMesg msg) { var summary = new LapSummary { Distance = new Distance(msg.GetTotalDistance().GetValueOrDefault(0), DistanceUnit.Meter), ElapsedTime = Convert.ToInt32(msg.GetTotalElapsedTime().GetValueOrDefault(0)), MovingTime = Convert.ToInt32(msg.GetTotalTimerTime().GetValueOrDefault(0)), StartTime = msg.GetStartTime().GetDateTime(), AvgHeartRate = msg.GetAvgHeartRate().GetValueOrDefault(0), MaxHeartRate = msg.GetMaxHeartRate().GetValueOrDefault(0), AvgSpeed = new Speed(msg.GetAvgSpeed().GetValueOrDefault(0), SpeedUnit.MeterPerSecond), MaxSpeed = new Speed(msg.GetMaxSpeed().GetValueOrDefault(0), SpeedUnit.MeterPerSecond), AvgCadence = msg.GetAvgCadence().GetValueOrDefault(0), MaxCadence = msg.GetMaxCadence().GetValueOrDefault(0), AvgPower = msg.GetAvgPower().GetValueOrDefault(0), MaxPower = msg.GetMaxPower().GetValueOrDefault(0), Ascent = msg.GetTotalAscent().GetValueOrDefault(0), Descent = msg.GetTotalDescent().GetValueOrDefault(0) }; return(summary); }
public FitLap(LapMesg msg, int first, int last) { FirstRecord = first; LastRecord = last; AveAltitude = msg.GetAvgAltitude(); AveCadence = msg.GetAvgCadence(); AveCadencePosition = FitFile.GetByteList(msg.GetNumAvgCadencePosition(), msg.GetAvgCadencePosition); AveCombinedPedalSmoothness = msg.GetAvgCombinedPedalSmoothness(); AveFractionalCadence = msg.GetAvgFractionalCadence(); AveGrade = msg.GetAvgGrade(); AveHeartRate = msg.GetAvgHeartRate(); AveLeftPco = msg.GetAvgLeftPco(); AveLeftPedalSmoothness = msg.GetAvgLeftPedalSmoothness(); AveLeftPowerPhase = FitFile.GetFloatList(msg.GetNumAvgLeftPowerPhase(), msg.GetAvgLeftPowerPhase); AveLeftPowerPhasePeak = FitFile.GetFloatList(msg.GetNumAvgLeftPowerPhasePeak(), msg.GetAvgLeftPowerPhasePeak); AveLeftTorqueEffectiveness = msg.GetAvgLeftTorqueEffectiveness(); AveLevMotorPower = msg.GetAvgLevMotorPower(); AveNegGrade = msg.GetAvgNegGrade(); AveNegVerticalSpeed = msg.GetAvgNegVerticalSpeed(); AvePosGrade = msg.GetAvgPosGrade(); AvePosVerticalSpeed = msg.GetAvgPosVerticalSpeed(); AvePower = msg.GetAvgPower(); AvePowerPosition = FitFile.GetUShortList(msg.GetNumAvgPowerPosition(), msg.GetAvgPowerPosition); AveRightPco = msg.GetAvgRightPco(); AveRightPedalSmoothness = msg.GetAvgRightPedalSmoothness(); AveRightPowerPhase = FitFile.GetFloatList(msg.GetNumAvgRightPowerPhase(), msg.GetAvgRightPowerPhase); AveRightPowerPhasePeak = FitFile.GetFloatList(msg.GetNumAvgRightPowerPhasePeak(), msg.GetAvgRightPowerPhasePeak); AveRightTorqueEffectiveness = msg.GetAvgRightTorqueEffectiveness(); AveRunningCadence = msg.GetAvgRunningCadence(); AveSaturatedHemoglobinPercent = FitFile.GetFloatList(msg.GetNumAvgSaturatedHemoglobinPercent(), msg.GetAvgSaturatedHemoglobinPercent); AveSpeed = FitFile.GetSpeed(msg.GetAvgSpeed()); AveStanceTime = msg.GetAvgStanceTime(); AveStanceTimeBalance = msg.GetAvgStanceTimeBalance(); AveStanceTimePercent = msg.GetAvgStanceTimePercent(); AveStepLength = msg.GetAvgStepLength(); AveStrokeDistance = msg.GetAvgStrokeDistance(); AveTemperature = msg.GetAvgTemperature(); AveTotalHemoglobinConc = FitFile.GetFloatList(msg.GetNumAvgTotalHemoglobinConc(), msg.GetAvgTotalHemoglobinConc); AvgVam = msg.GetAvgVam(); AvgVerticalOscillation = msg.GetAvgVerticalOscillation(); AvgVerticalRatio = msg.GetAvgVerticalRatio(); EndPositionLat = FitFile.GetDegrees(msg.GetEndPositionLat()); EndPositionLong = FitFile.GetDegrees(msg.GetEndPositionLong()); EnhancedAvgAltitude = msg.GetEnhancedAvgAltitude(); EnhancedAvgSpeed = FitFile.GetSpeed(msg.GetEnhancedAvgSpeed()); EnhancedMaxAltitude = msg.GetEnhancedMaxAltitude(); EnhancedMaxSpeed = FitFile.GetSpeed(msg.GetEnhancedMaxSpeed()); EnhancedMinAltitude = msg.GetEnhancedMinAltitude(); Event = msg.GetEvent(); EventGroup = msg.GetEventGroup(); EventType = msg.GetEventType(); FirstLengthIndex = msg.GetFirstLengthIndex(); GpsAccuracy = msg.GetGpsAccuracy(); Intensity = msg.GetIntensity(); LapTrigger = msg.GetLapTrigger(); LeftRightBalance = msg.GetLeftRightBalance(); LevBatteryConsumption = msg.GetLevBatteryConsumption(); MaxAltitude = msg.GetMaxAltitude(); MaxCadence = msg.GetMaxCadence(); MaxCadencePosition = FitFile.GetByteList(msg.GetNumMaxCadencePosition(), msg.GetMaxCadencePosition); MaxFractionalCadence = msg.GetMaxFractionalCadence(); MaxHeartRate = msg.GetMaxHeartRate(); MaxLevMotorPower = msg.GetMaxLevMotorPower(); MaxNegGrade = msg.GetMaxNegGrade(); MaxNegVerticalSpeed = msg.GetMaxNegVerticalSpeed(); MaxPosGrade = msg.GetMaxPosGrade(); MaxPosVerticalSpeed = msg.GetMaxPosVerticalSpeed(); MaxPower = msg.GetMaxPower(); MaxPowerPosition = FitFile.GetUShortList(msg.GetNumMaxPowerPosition(), msg.GetMaxPowerPosition); MaxRunningCadence = msg.GetMaxRunningCadence(); MaxSaturatedHemoglobinPercent = FitFile.GetFloatList(msg.GetNumMaxSaturatedHemoglobinPercent(), msg.GetMaxSaturatedHemoglobinPercent); MaxSpeed = FitFile.GetSpeed(msg.GetMaxSpeed()); MaxTemperature = msg.GetMaxTemperature(); MaxTotalHemoglobinConc = FitFile.GetFloatList(msg.GetNumMaxTotalHemoglobinConc(), msg.GetMaxTotalHemoglobinConc); MinAltitude = msg.GetMinAltitude(); MinHeartRate = msg.GetMinHeartRate(); MinSaturatedHemoglobinPercent = FitFile.GetFloatList(msg.GetNumMinSaturatedHemoglobinPercent(), msg.GetMinSaturatedHemoglobinPercent); MinTotalHemoglobinConc = FitFile.GetFloatList(msg.GetNumMinTotalHemoglobinConc(), msg.GetMinTotalHemoglobinConc); NormalizedPower = msg.GetNormalizedPower(); NumActiveLengths = msg.GetNumActiveLengths(); NumLengths = msg.GetNumLengths(); OpponentScore = msg.GetOpponentScore(); PlayerScore = msg.GetPlayerScore(); RepetitionNum = msg.GetRepetitionNum(); Sport = msg.GetSport(); StandCount = msg.GetStandCount(); StartPositionLat = FitFile.GetDegrees(msg.GetStartPositionLat()); StartPositionLong = FitFile.GetDegrees(msg.GetStartPositionLong()); StartTime = FitFile.GetDateTime(msg.GetStartTime()); StrokeCounts = FitFile.GetUShortList(msg.GetNumStrokeCount(), msg.GetStrokeCount); SubSport = msg.GetSubSport(); SwimStroke = msg.GetSwimStroke(); TimeInCadenceZone = FitFile.GetFloatList(msg.GetNumTimeInCadenceZone(), msg.GetTimeInCadenceZone); TimeInHrZone = FitFile.GetFloatList(msg.GetNumTimeInHrZone(), msg.GetTimeInHrZone); TimeInPowerZone = FitFile.GetFloatList(msg.GetNumTimeInPowerZone(), msg.GetTimeInPowerZone); TimeInSpeedZone = FitFile.GetFloatList(msg.GetNumTimeInSpeedZone(), msg.GetTimeInSpeedZone); Timestamp = FitFile.GetDateTime(msg.GetTimestamp()); TimeStanding = msg.GetTimeStanding(); TotalAscent = msg.GetTotalAscent(); TotalCalories = msg.GetTotalCalories(); TotalCycles = msg.GetTotalCycles(); TotalDescent = msg.GetTotalDescent(); TotalDistance = FitFile.GetDistance(msg.GetTotalDistance()); TotalElapsedTime = FitFile.GetTimeSpan(msg.GetTotalElapsedTime()); TotalFatCalories = msg.GetTotalFatCalories(); TotalFractionalCycles = msg.GetTotalFractionalCycles(); TotalMovingTime = FitFile.GetTimeSpan(msg.GetTotalMovingTime()); TotalStrides = msg.GetTotalStrides(); TotalTimerTime = FitFile.GetTimeSpan(msg.GetTotalTimerTime()); TotalWork = FitFile.GetWork(msg.GetTotalWork()); WktStepIndex = msg.GetWktStepIndex(); ZoneCounts = FitFile.GetUShortList(msg.GetNumZoneCount(), msg.GetZoneCount); }