Exemplo n.º 1
0
        static void OnMesg(object sender, MesgEventArgs e)
        {
            Mesg msg = e.mesg;

            if (msg.Num == MesgNum.Record)
            {
                RecordMesg recordMesg = new RecordMesg(msg);
                Console.Write("Data,{0},record,", msg.LocalNum);
                if (recordMesg.GetTimestamp() != null)
                {
                    Console.Write("timestamp,{0},s,", recordMesg.GetTimestamp().GetTimeStamp());
                }
                if ((recordMesg.GetDistance() != null) && (recordMesg.GetDistance() != (uint)Fit.BaseType[Fit.UInt32].invalidValue))
                {
                    Console.Write("distance, {0:0.0}, m,", recordMesg.GetDistance());
                }
                if ((recordMesg.GetSpeed() != null) && (recordMesg.GetSpeed() != (ushort)Fit.BaseType[Fit.UInt16].invalidValue))
                {
                    Console.Write("speed,{0:0.000},m/s,", recordMesg.GetSpeed());
                }
                if ((recordMesg.GetCadence() != null) && (recordMesg.GetCadence() != (byte)Fit.BaseType[Fit.UInt8].invalidValue))
                {
                    Console.Write("cadence,{0},rpm,", recordMesg.GetCadence());
                }
                if ((recordMesg.GetEnhancedSpeed() != null) && (recordMesg.GetEnhancedSpeed() != (uint)Fit.BaseType[Fit.UInt32].invalidValue))
                {
                    Console.Write("enhanced_speed,{0:0.000},m/s,", recordMesg.GetEnhancedSpeed());
                }
                if ((recordMesg.GetHeartRate() != null) && (recordMesg.GetHeartRate() != (byte)Fit.BaseType[Fit.UInt8].invalidValue))
                {
                    Console.Write("heart_rate,{0},bpm,", recordMesg.GetHeartRate());
                }
                Console.Write("\n");
            }
            else if (msg.Num == MesgNum.Hr)
            {
                HrMesg hrMesg = new HrMesg(msg);
                Console.Write("Data,{0},hr,", msg.LocalNum);
                int count;
                if ((hrMesg.GetTimestamp() != null) && (hrMesg.GetTimestamp().GetTimeStamp() != (uint)Fit.BaseType[Fit.UInt32].invalidValue))
                {
                    Console.Write("timestamp,{0},,", hrMesg.GetTimestamp().GetTimeStamp());
                }
                if (hrMesg.GetNumFilteredBpm() > 0)
                {
                    Console.Write("filtered_bpm,");
                    count = hrMesg.GetNumFilteredBpm();
                    for (int i = 0; i < count; i++)
                    {
                        Console.Write("{0}", hrMesg.GetFilteredBpm(i));
                        if (i < count - 1)
                        {
                            Console.Write("|");
                        }
                    }
                    Console.Write(",bpm,");
                }
                if (hrMesg.GetNumEventTimestamp12() > 0)
                {
                    Console.Write("event_timestamp_12,");
                    count = hrMesg.GetNumEventTimestamp12();
                    for (int i = 0; i < count; i++)
                    {
                        Console.Write("{0}", hrMesg.GetEventTimestamp12(i));
                        if (i < count - 1)
                        {
                            Console.Write("|");
                        }
                    }
                    Console.Write(",,");
                }
                if (hrMesg.GetNumEventTimestamp() > 0)
                {
                    Console.Write("event_timestamp,");
                    count = hrMesg.GetNumEventTimestamp();
                    for (int i = 0; i < count; i++)
                    {
                        Console.Write("{0:G}", hrMesg.GetEventTimestamp(i));
                        if (i < count - 1)
                        {
                            Console.Write("|");
                        }
                    }
                    Console.Write(",s,");
                }
                if (hrMesg.GetFractionalTimestamp() != null)
                {
                    Console.Write("fractional_timestamp,{0:0.######},s,", hrMesg.GetFractionalTimestamp());
                }
                Console.Write("\n");
            }
        }
Exemplo n.º 2
0
 public FitRecord(RecordMesg msg, FitRecordList records)
 {
     AbsolutePressure           = msg.GetAbsolutePressure();
     AccumulatedPower           = msg.GetAccumulatedPower();
     ActivityType               = msg.GetActivityType();
     Altitude                   = msg.GetAltitude();
     BallSpeed                  = FitFile.GetSpeed(msg.GetBallSpeed());
     BatterySoc                 = msg.GetBatterySoc();
     Cadence256                 = msg.GetCadence256();
     Cadence                    = msg.GetCadence();
     Calories                   = msg.GetCalories();
     CnsLoad                    = msg.GetCnsLoad();
     CombinedPedalSmoothness    = msg.GetCombinedPedalSmoothness();
     CompressedAccumulatedPower = msg.GetCompressedAccumulatedPower();
     CompressedSpeedDistance    = FitFile.GetByteList(msg.GetNumCompressedSpeedDistance(), msg.GetCompressedSpeedDistance);
     CycleLength                = msg.GetCycleLength();
     Cycles                        = msg.GetCycles();
     Depth                         = msg.GetDepth();
     DeviceIndex                   = msg.GetDeviceIndex();
     Distance                      = FitFile.GetDistance(msg.GetDistance());
     EnhancedAltitude              = msg.GetEnhancedAltitude();
     EnhancedSpeed                 = FitFile.GetSpeed(msg.GetEnhancedSpeed());
     FractionalCadence             = msg.GetFractionalCadence();
     GpsAccuracy                   = msg.GetGpsAccuracy();
     Grade                         = msg.GetGrade();
     HeartRate                     = msg.GetHeartRate();
     LeftPco                       = msg.GetLeftPco();
     LeftPedalSmoothness           = msg.GetLeftPedalSmoothness();
     LeftPowerPhase                = FitFile.GetFloatList(msg.GetNumLeftPowerPhase(), msg.GetLeftPowerPhase);
     LeftPowerPhasePeak            = FitFile.GetFloatList(msg.GetNumLeftPowerPhasePeak(), msg.GetLeftPowerPhasePeak);
     LeftRightBalance              = msg.GetLeftRightBalance();
     LeftTorqueEffectiveness       = msg.GetLeftTorqueEffectiveness();
     MotorPower                    = msg.GetMotorPower();
     N2Load                        = msg.GetN2Load();
     NdlTime                       = msg.GetNdlTime();
     NextStopDepth                 = msg.GetNextStopDepth();
     NextStopTime                  = msg.GetNextStopTime();
     Latitude                      = FitFile.GetDegrees(msg.GetPositionLat());
     Longitude                     = FitFile.GetDegrees(msg.GetPositionLong());
     Power                         = msg.GetPower();
     Resistence                    = msg.GetResistance();
     RightPco                      = msg.GetRightPco();
     RightPedalSmoothness          = msg.GetRightPedalSmoothness();
     RightPowerPhase               = FitFile.GetFloatList(msg.GetNumRightPowerPhase(), msg.GetRightPowerPhase);
     RightPowerPhasePeak           = FitFile.GetFloatList(msg.GetNumRightPowerPhasePeak(), msg.GetRightPowerPhasePeak);
     RightTorqueEffectiveness      = msg.GetRightTorqueEffectiveness();
     SaturatedHemoglobinPercent    = msg.GetSaturatedHemoglobinPercent();
     SaturatedHemoglobinPercentMax = msg.GetSaturatedHemoglobinPercentMax();
     SaturatedHemoglobinPercentMin = msg.GetSaturatedHemoglobinPercentMin();
     Speed                         = FitFile.GetSpeed(msg.GetSpeed());
     Speed1s                       = FitFile.GetFloatList(msg.GetNumSpeed1s(), msg.GetSpeed1s);
     StanceTime                    = msg.GetStanceTime();
     StanceTimeBalance             = msg.GetStanceTimeBalance();
     StanceTimePercent             = msg.GetStanceTimePercent();
     StepLength                    = msg.GetStepLength();
     StrokeType                    = msg.GetStrokeType();
     Temperature                   = msg.GetTemperature();
     Time128                       = msg.GetTime128();
     TimeFromCourse                = FitFile.GetTimeSpan(msg.GetTimeFromCourse());
     Timestamp                     = FitFile.GetDateTime(msg.GetTimestamp());
     TotalCycles                   = msg.GetTotalCycles();
     TotalHemoglobinConc           = msg.GetTotalHemoglobinConc();
     TotalHemoglobinConcMax        = msg.GetTotalHemoglobinConcMax();
     TotalHemoglobinConcMin        = msg.GetTotalHemoglobinConcMin();
     VerticalOscillation           = msg.GetVerticalOscillation();
     VerticalRatio                 = msg.GetVerticalRatio();
     VerticalSpeed                 = FitFile.GetSpeed(msg.GetVerticalSpeed());
     Zone = msg.GetZone();
 }