Beispiel #1
0
        public MesgDefinition(Mesg mesg)
        {
            LocalMesgNum = mesg.LocalNum;
             GlobalMesgNum = mesg.Num;
             architecture = Fit.LittleEndian;
             NumFields = (byte)mesg.fields.Count;

             foreach (Field field in mesg.fields)
             {
            fieldDefs.Add(new FieldDefinition(field));
             }
        }
Beispiel #2
0
 public Mesg(Mesg mesg)
 {
     if (mesg == null)
      {
     this.Name = "unknown";
     this.Num = (ushort)MesgNum.Invalid;
     return;
      }
      this.Name = mesg.Name;
      this.Num = mesg.Num;
      this.LocalNum = mesg.LocalNum;
      this.systemTimeOffset = mesg.systemTimeOffset;
      foreach (Field field in mesg.fields)
      {
     if (field.GetNumValues() > 0)
     {
        this.fields.Add(new Field(field));
     }
      }
 }
Beispiel #3
0
 public EventMesg(Mesg mesg)
     : base(mesg)
 {
 }
 public SlaveDeviceMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #5
0
 public PadMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #6
0
        public void DecodeNextMessage(Stream fitStream)
        {
            BinaryReader br = new BinaryReader(fitStream);
             byte nextByte = br.ReadByte();

             // Is it a compressed timestamp mesg?
             if ((nextByte & Fit.CompressedHeaderMask) == Fit.CompressedHeaderMask)
             {
            MemoryStream mesgBuffer = new MemoryStream();

            int timeOffset = nextByte & Fit.CompressedTimeMask;
            timestamp += (uint)((timeOffset - lastTimeOffset) & Fit.CompressedTimeMask);
            lastTimeOffset = timeOffset;
            Field timestampField = new Field(Profile.mesgs[Profile.RecordIndex].GetField("Timestamp"));
            timestampField.SetValue(timestamp);

            byte localMesgNum = (byte)((nextByte & Fit.CompressedLocalMesgNumMask) >> 5);
            mesgBuffer.WriteByte(localMesgNum);
            if (localMesgDefs[localMesgNum] == null)
            {
               throw new FitException("Decode:DecodeNextMessage - FIT decode error: Missing message definition for local message number " + localMesgNum + ".");
            }
            int fieldsSize = localMesgDefs[localMesgNum].GetMesgSize() - 1;
            try
            {
               mesgBuffer.Write(br.ReadBytes(fieldsSize), 0, fieldsSize);
            }
            catch (IOException e)
            {
               throw new FitException("Decode:DecodeNextMessage - Compressed Data Message unexpected end of file.  Wanted " + fieldsSize + " bytes at stream position " + fitStream.Position, e);
            }

            Mesg newMesg = new Mesg(mesgBuffer, localMesgDefs[localMesgNum]);
            newMesg.InsertField(0, timestampField);
            if (MesgEvent != null)
            {
               MesgEvent(this, new MesgEventArgs(newMesg));
            }
             }
             // Is it a mesg def?
             else if ((nextByte & Fit.HeaderTypeMask) == Fit.MesgDefinitionMask)
             {
            MemoryStream mesgDefBuffer = new MemoryStream();

            // Figure out number of fields (length) of our defn and build buffer
            mesgDefBuffer.WriteByte(nextByte);
            mesgDefBuffer.Write(br.ReadBytes(4), 0, 4);
            byte numfields = br.ReadByte();
            mesgDefBuffer.WriteByte(numfields);
            try
            {
               mesgDefBuffer.Write(br.ReadBytes(numfields * 3), 0, numfields * 3);
            }
            catch (IOException e)
            {
               throw new FitException("Decode:DecodeNextMessage - Defn Message unexpected end of file.  Wanted " + (numfields * 3) + " bytes at stream position " + fitStream.Position, e);
            }

            MesgDefinition newMesgDef = new MesgDefinition(mesgDefBuffer);
            localMesgDefs[newMesgDef.LocalMesgNum] = newMesgDef;
            if (MesgDefinitionEvent != null)
            {
               MesgDefinitionEvent(this, new MesgDefinitionEventArgs(newMesgDef));
            }
             }
             // Is it a data mesg?
             else if ((nextByte & Fit.HeaderTypeMask) == Fit.MesgHeaderMask)
             {
            MemoryStream mesgBuffer = new MemoryStream();

            byte localMesgNum = (byte)(nextByte & Fit.LocalMesgNumMask);
            mesgBuffer.WriteByte(localMesgNum);
            if (localMesgDefs[localMesgNum] == null)
            {
               throw new FitException("Decode:DecodeNextMessage - FIT decode error: Missing message definition for local message number " + localMesgNum + ".");
            }
            int fieldsSize = localMesgDefs[localMesgNum].GetMesgSize() - 1;
            try
            {
               mesgBuffer.Write(br.ReadBytes(fieldsSize), 0, fieldsSize);
            }
            catch (IOException e)
            {
               throw new FitException("Decode:DecodeNextMessage - Data Message unexpected end of file.  Wanted " + fieldsSize + " bytes at stream position " + fitStream.Position, e);
            }

            Mesg newMesg = new Mesg(mesgBuffer, localMesgDefs[localMesgNum]);
            // If the new message contains a timestamp field, record the value to use as
            // a reference for compressed timestamp headers
            Field timestampField = newMesg.GetField("Timestamp");
            if (timestampField != null)
            {
               timestamp = (uint)timestampField.GetValue();
               lastTimeOffset = (int)timestamp & Fit.CompressedTimeMask;
            }

            if (MesgEvent != null)
            {
               MesgEvent(this, new MesgEventArgs(newMesg));
            }
             }
             else
             {
            throw new FitException("Decode:Read - FIT decode error: Unexpected Record Header Byte 0x" + nextByte.ToString("X"));
             }
        }
Beispiel #7
0
 public WorkoutStepMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #8
0
 public WorkoutMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #9
0
 public BikeProfileMesg(Mesg mesg)
     : base(mesg)
 {
 }
 public WorkoutSessionMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #11
0
 public SportMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #12
0
 public DiveAlarmMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #13
0
 public DiveSummaryMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #14
0
 public HrvMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #15
0
 public MetZoneMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #16
0
 public SpeedZoneMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #17
0
 public SegmentPointMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #18
0
 public CapabilitiesMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #19
0
            /// <summary>
            /// Checks if the reference fields in a given message indicate the subfield (alternate)
            /// definition should be used
            /// </summary>
            /// <param name="mesg">message of interest</param>
            /// <returns>true if the subfield is active</returns>                  
            internal bool CanMesgSupport(Mesg mesg)
            {
                Field field = mesg.GetField(refFieldNum);

                if (field != null)
                {
                   object value = field.GetValue(0, Fit.SubfieldIndexMainField);
                   if (value == refFieldValue)
                   {
                  return true;
                   }
                }
                return false;
            }
Beispiel #20
0
 public WeatherAlertMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #21
0
 public DeviceSettingsMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #22
0
 public CoursePointMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #23
0
 public ScheduleMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #24
0
 public TimestampCorrelationMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #25
0
 public MonitoringMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #26
0
 public void OnMesg(Mesg newMesg)
 {
     Write(newMesg);
 }
 public NmeaSentenceMesg(Mesg mesg) : base(mesg)
 {
 }
 public BarometerDataMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #29
0
 public ActivityMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #30
0
 public DeviceSettingsMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #31
0
 public PowerZoneMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #32
0
 public LengthMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #33
0
 public CourseMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #34
0
 public AntChannelIdMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #35
0
 /// <summary>
 /// Checks if the reference fields in a given message indicate the subfield (alternate)
 /// definition should be used
 /// </summary>
 /// <param name="mesg">message of interest</param>
 /// <returns>true if the subfield is active</returns>
 public bool CanMesgSupport(Mesg mesg)
 {
     foreach (SubfieldMap map in maps)
      {
     if (map.CanMesgSupport(mesg))
     {
        return true;
     }
      }
      return false;
 }
Beispiel #36
0
 public ScheduleMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #37
0
 public SessionMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #38
0
 public EventMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #39
0
 public UserProfileMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #40
0
 public MonitoringMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #41
0
 public WeightScaleMesg(Mesg mesg)
     : base(mesg)
 {
 }
 public SegmentPointMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #43
0
 public SportMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #44
0
 public HrZoneMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #45
0
 public FieldCapabilitiesMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #46
0
 public SegmentIdMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #47
0
        /// <summary>
        /// Static constructor to build the profile object
        /// </summary>
        static Profile()
        {
            ushort mesgIndex = 0;
             ushort fieldIndex, subfieldIndex;
             // FileId
             Mesg fileIdMesg = new Mesg("FileId", MesgNum.FileId);
             fieldIndex = 0;
             fileIdMesg.SetField(new Field("Type", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             fileIdMesg.SetField(new Field("Manufacturer", 1, 132, 1f, 0f, ""));
             fieldIndex++;
             fileIdMesg.SetField(new Field("Product", 2, 132, 1f, 0f, ""));
             subfieldIndex = 0;
             fileIdMesg.fields[fieldIndex].subfields.Add(new Subfield("GarminProduct", 132, 1f, 0f, ""));
             fileIdMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 1);
             fileIdMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 15);
             fileIdMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 13);
             subfieldIndex++;
             fieldIndex++;
             fileIdMesg.SetField(new Field("SerialNumber", 3, 140, 1f, 0f, ""));
             fieldIndex++;
             fileIdMesg.SetField(new Field("TimeCreated", 4, 134, 1f, 0f, ""));
             fieldIndex++;
             fileIdMesg.SetField(new Field("Number", 5, 132, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(fileIdMesg);
             FileIdIndex = mesgIndex;
             mesgIndex++;

             // FileCreator
             Mesg fileCreatorMesg = new Mesg("FileCreator", MesgNum.FileCreator);
             fieldIndex = 0;
             fileCreatorMesg.SetField(new Field("SoftwareVersion", 0, 132, 1f, 0f, ""));
             fieldIndex++;
             fileCreatorMesg.SetField(new Field("HardwareVersion", 1, 2, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(fileCreatorMesg);
             FileCreatorIndex = mesgIndex;
             mesgIndex++;

             // Software
             Mesg softwareMesg = new Mesg("Software", MesgNum.Software);
             fieldIndex = 0;
             softwareMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             softwareMesg.SetField(new Field("Version", 3, 132, 100f, 0f, ""));
             fieldIndex++;
             softwareMesg.SetField(new Field("PartNumber", 5, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(softwareMesg);
             SoftwareIndex = mesgIndex;
             mesgIndex++;

             // SlaveDevice
             Mesg slaveDeviceMesg = new Mesg("SlaveDevice", MesgNum.SlaveDevice);
             fieldIndex = 0;
             slaveDeviceMesg.SetField(new Field("Manufacturer", 0, 132, 1f, 0f, ""));
             fieldIndex++;
             slaveDeviceMesg.SetField(new Field("Product", 1, 132, 1f, 0f, ""));
             subfieldIndex = 0;
             slaveDeviceMesg.fields[fieldIndex].subfields.Add(new Subfield("GarminProduct", 132, 1f, 0f, ""));
             slaveDeviceMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 1);
             slaveDeviceMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 15);
             slaveDeviceMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 13);
             subfieldIndex++;
             fieldIndex++;
             mesgs.Add(slaveDeviceMesg);
             SlaveDeviceIndex = mesgIndex;
             mesgIndex++;

             // Capabilities
             Mesg capabilitiesMesg = new Mesg("Capabilities", MesgNum.Capabilities);
             fieldIndex = 0;
             capabilitiesMesg.SetField(new Field("Languages", 0, 10, 1f, 0f, ""));
             fieldIndex++;
             capabilitiesMesg.SetField(new Field("Sports", 1, 10, 1f, 0f, ""));
             fieldIndex++;
             capabilitiesMesg.SetField(new Field("WorkoutsSupported", 21, 140, 1f, 0f, ""));
             fieldIndex++;
             capabilitiesMesg.SetField(new Field("ConnectivitySupported", 23, 140, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(capabilitiesMesg);
             CapabilitiesIndex = mesgIndex;
             mesgIndex++;

             // FileCapabilities
             Mesg fileCapabilitiesMesg = new Mesg("FileCapabilities", MesgNum.FileCapabilities);
             fieldIndex = 0;
             fileCapabilitiesMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             fileCapabilitiesMesg.SetField(new Field("Type", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             fileCapabilitiesMesg.SetField(new Field("Flags", 1, 10, 1f, 0f, ""));
             fieldIndex++;
             fileCapabilitiesMesg.SetField(new Field("Directory", 2, 7, 1f, 0f, ""));
             fieldIndex++;
             fileCapabilitiesMesg.SetField(new Field("MaxCount", 3, 132, 1f, 0f, ""));
             fieldIndex++;
             fileCapabilitiesMesg.SetField(new Field("MaxSize", 4, 134, 1f, 0f, "bytes"));
             fieldIndex++;
             mesgs.Add(fileCapabilitiesMesg);
             FileCapabilitiesIndex = mesgIndex;
             mesgIndex++;

             // MesgCapabilities
             Mesg mesgCapabilitiesMesg = new Mesg("MesgCapabilities", MesgNum.MesgCapabilities);
             fieldIndex = 0;
             mesgCapabilitiesMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             mesgCapabilitiesMesg.SetField(new Field("File", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgCapabilitiesMesg.SetField(new Field("MesgNum", 1, 132, 1f, 0f, ""));
             fieldIndex++;
             mesgCapabilitiesMesg.SetField(new Field("CountType", 2, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgCapabilitiesMesg.SetField(new Field("Count", 3, 132, 1f, 0f, ""));
             subfieldIndex = 0;
             mesgCapabilitiesMesg.fields[fieldIndex].subfields.Add(new Subfield("NumPerFile", 132, 1f, 0f, ""));
             mesgCapabilitiesMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(2, 0);
             subfieldIndex++;
             mesgCapabilitiesMesg.fields[fieldIndex].subfields.Add(new Subfield("MaxPerFile", 132, 1f, 0f, ""));
             mesgCapabilitiesMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(2, 1);
             subfieldIndex++;
             mesgCapabilitiesMesg.fields[fieldIndex].subfields.Add(new Subfield("MaxPerFileType", 132, 1f, 0f, ""));
             mesgCapabilitiesMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(2, 2);
             subfieldIndex++;
             fieldIndex++;
             mesgs.Add(mesgCapabilitiesMesg);
             MesgCapabilitiesIndex = mesgIndex;
             mesgIndex++;

             // FieldCapabilities
             Mesg fieldCapabilitiesMesg = new Mesg("FieldCapabilities", MesgNum.FieldCapabilities);
             fieldIndex = 0;
             fieldCapabilitiesMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             fieldCapabilitiesMesg.SetField(new Field("File", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             fieldCapabilitiesMesg.SetField(new Field("MesgNum", 1, 132, 1f, 0f, ""));
             fieldIndex++;
             fieldCapabilitiesMesg.SetField(new Field("FieldNum", 2, 2, 1f, 0f, ""));
             fieldIndex++;
             fieldCapabilitiesMesg.SetField(new Field("Count", 3, 132, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(fieldCapabilitiesMesg);
             FieldCapabilitiesIndex = mesgIndex;
             mesgIndex++;

             // DeviceSettings
             Mesg deviceSettingsMesg = new Mesg("DeviceSettings", MesgNum.DeviceSettings);
             fieldIndex = 0;
             deviceSettingsMesg.SetField(new Field("ActiveTimeZone", 0, 2, 1f, 0f, ""));
             fieldIndex++;
             deviceSettingsMesg.SetField(new Field("UtcOffset", 1, 134, 1f, 0f, ""));
             fieldIndex++;
             deviceSettingsMesg.SetField(new Field("TimeZoneOffset", 5, 1, 4f, 0f, "hr"));
             fieldIndex++;
             mesgs.Add(deviceSettingsMesg);
             DeviceSettingsIndex = mesgIndex;
             mesgIndex++;

             // UserProfile
             Mesg userProfileMesg = new Mesg("UserProfile", MesgNum.UserProfile);
             fieldIndex = 0;
             userProfileMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("FriendlyName", 0, 7, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("Gender", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("Age", 2, 2, 1f, 0f, "years"));
             fieldIndex++;
             userProfileMesg.SetField(new Field("Height", 3, 2, 100f, 0f, "m"));
             fieldIndex++;
             userProfileMesg.SetField(new Field("Weight", 4, 132, 10f, 0f, "kg"));
             fieldIndex++;
             userProfileMesg.SetField(new Field("Language", 5, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("ElevSetting", 6, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("WeightSetting", 7, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("RestingHeartRate", 8, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             userProfileMesg.SetField(new Field("DefaultMaxRunningHeartRate", 9, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             userProfileMesg.SetField(new Field("DefaultMaxBikingHeartRate", 10, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             userProfileMesg.SetField(new Field("DefaultMaxHeartRate", 11, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             userProfileMesg.SetField(new Field("HrSetting", 12, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("SpeedSetting", 13, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("DistSetting", 14, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("PowerSetting", 16, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("ActivityClass", 17, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("PositionSetting", 18, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("TemperatureSetting", 21, 0, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("LocalId", 22, 132, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("GlobalId", 23, 13, 1f, 0f, ""));
             fieldIndex++;
             userProfileMesg.SetField(new Field("HeightSetting", 30, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(userProfileMesg);
             UserProfileIndex = mesgIndex;
             mesgIndex++;

             // HrmProfile
             Mesg hrmProfileMesg = new Mesg("HrmProfile", MesgNum.HrmProfile);
             fieldIndex = 0;
             hrmProfileMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             hrmProfileMesg.SetField(new Field("Enabled", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             hrmProfileMesg.SetField(new Field("HrmAntId", 1, 139, 1f, 0f, ""));
             fieldIndex++;
             hrmProfileMesg.SetField(new Field("LogHrv", 2, 0, 1f, 0f, ""));
             fieldIndex++;
             hrmProfileMesg.SetField(new Field("HrmAntIdTransType", 3, 10, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(hrmProfileMesg);
             HrmProfileIndex = mesgIndex;
             mesgIndex++;

             // SdmProfile
             Mesg sdmProfileMesg = new Mesg("SdmProfile", MesgNum.SdmProfile);
             fieldIndex = 0;
             sdmProfileMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             sdmProfileMesg.SetField(new Field("Enabled", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             sdmProfileMesg.SetField(new Field("SdmAntId", 1, 139, 1f, 0f, ""));
             fieldIndex++;
             sdmProfileMesg.SetField(new Field("SdmCalFactor", 2, 132, 10f, 0f, "%"));
             fieldIndex++;
             sdmProfileMesg.SetField(new Field("Odometer", 3, 134, 100f, 0f, "m"));
             fieldIndex++;
             sdmProfileMesg.SetField(new Field("SpeedSource", 4, 0, 1f, 0f, ""));
             fieldIndex++;
             sdmProfileMesg.SetField(new Field("SdmAntIdTransType", 5, 10, 1f, 0f, ""));
             fieldIndex++;
             sdmProfileMesg.SetField(new Field("OdometerRollover", 7, 2, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(sdmProfileMesg);
             SdmProfileIndex = mesgIndex;
             mesgIndex++;

             // BikeProfile
             Mesg bikeProfileMesg = new Mesg("BikeProfile", MesgNum.BikeProfile);
             fieldIndex = 0;
             bikeProfileMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("Name", 0, 7, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("Sport", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("SubSport", 2, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("Odometer", 3, 134, 100f, 0f, "m"));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikeSpdAntId", 4, 139, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikeCadAntId", 5, 139, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikeSpdcadAntId", 6, 139, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikePowerAntId", 7, 139, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("CustomWheelsize", 8, 132, 1000f, 0f, "m"));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("AutoWheelsize", 9, 132, 1000f, 0f, "m"));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikeWeight", 10, 132, 10f, 0f, "kg"));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("PowerCalFactor", 11, 132, 10f, 0f, "%"));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("AutoWheelCal", 12, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("AutoPowerZero", 13, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("Id", 14, 2, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("SpdEnabled", 15, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("CadEnabled", 16, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("SpdcadEnabled", 17, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("PowerEnabled", 18, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("CrankLength", 19, 2, 2f, -110f, "mm"));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("Enabled", 20, 0, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikeSpdAntIdTransType", 21, 10, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikeCadAntIdTransType", 22, 10, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikeSpdcadAntIdTransType", 23, 10, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("BikePowerAntIdTransType", 24, 10, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("OdometerRollover", 37, 2, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("FrontGearNum", 38, 10, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("FrontGear", 39, 10, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("RearGearNum", 40, 10, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("RearGear", 41, 10, 1f, 0f, ""));
             fieldIndex++;
             bikeProfileMesg.SetField(new Field("ShimanoDi2Enabled", 44, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(bikeProfileMesg);
             BikeProfileIndex = mesgIndex;
             mesgIndex++;

             // ZonesTarget
             Mesg zonesTargetMesg = new Mesg("ZonesTarget", MesgNum.ZonesTarget);
             fieldIndex = 0;
             zonesTargetMesg.SetField(new Field("MaxHeartRate", 1, 2, 1f, 0f, ""));
             fieldIndex++;
             zonesTargetMesg.SetField(new Field("ThresholdHeartRate", 2, 2, 1f, 0f, ""));
             fieldIndex++;
             zonesTargetMesg.SetField(new Field("FunctionalThresholdPower", 3, 132, 1f, 0f, ""));
             fieldIndex++;
             zonesTargetMesg.SetField(new Field("HrCalcType", 5, 0, 1f, 0f, ""));
             fieldIndex++;
             zonesTargetMesg.SetField(new Field("PwrCalcType", 7, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(zonesTargetMesg);
             ZonesTargetIndex = mesgIndex;
             mesgIndex++;

             // Sport
             Mesg sportMesg = new Mesg("Sport", MesgNum.Sport);
             fieldIndex = 0;
             sportMesg.SetField(new Field("Sport", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             sportMesg.SetField(new Field("SubSport", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             sportMesg.SetField(new Field("Name", 3, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(sportMesg);
             SportIndex = mesgIndex;
             mesgIndex++;

             // HrZone
             Mesg hrZoneMesg = new Mesg("HrZone", MesgNum.HrZone);
             fieldIndex = 0;
             hrZoneMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             hrZoneMesg.SetField(new Field("HighBpm", 1, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             hrZoneMesg.SetField(new Field("Name", 2, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(hrZoneMesg);
             HrZoneIndex = mesgIndex;
             mesgIndex++;

             // SpeedZone
             Mesg speedZoneMesg = new Mesg("SpeedZone", MesgNum.SpeedZone);
             fieldIndex = 0;
             speedZoneMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             speedZoneMesg.SetField(new Field("HighValue", 0, 132, 1000f, 0f, "m/s"));
             fieldIndex++;
             speedZoneMesg.SetField(new Field("Name", 1, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(speedZoneMesg);
             SpeedZoneIndex = mesgIndex;
             mesgIndex++;

             // CadenceZone
             Mesg cadenceZoneMesg = new Mesg("CadenceZone", MesgNum.CadenceZone);
             fieldIndex = 0;
             cadenceZoneMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             cadenceZoneMesg.SetField(new Field("HighValue", 0, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             cadenceZoneMesg.SetField(new Field("Name", 1, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(cadenceZoneMesg);
             CadenceZoneIndex = mesgIndex;
             mesgIndex++;

             // PowerZone
             Mesg powerZoneMesg = new Mesg("PowerZone", MesgNum.PowerZone);
             fieldIndex = 0;
             powerZoneMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             powerZoneMesg.SetField(new Field("HighValue", 1, 132, 1f, 0f, "watts"));
             fieldIndex++;
             powerZoneMesg.SetField(new Field("Name", 2, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(powerZoneMesg);
             PowerZoneIndex = mesgIndex;
             mesgIndex++;

             // MetZone
             Mesg metZoneMesg = new Mesg("MetZone", MesgNum.MetZone);
             fieldIndex = 0;
             metZoneMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             metZoneMesg.SetField(new Field("HighBpm", 1, 2, 1f, 0f, ""));
             fieldIndex++;
             metZoneMesg.SetField(new Field("Calories", 2, 132, 10f, 0f, "kcal / min"));
             fieldIndex++;
             metZoneMesg.SetField(new Field("FatCalories", 3, 2, 10f, 0f, "kcal / min"));
             fieldIndex++;
             mesgs.Add(metZoneMesg);
             MetZoneIndex = mesgIndex;
             mesgIndex++;

             // Goal
             Mesg goalMesg = new Mesg("Goal", MesgNum.Goal);
             fieldIndex = 0;
             goalMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("Sport", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("SubSport", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("StartDate", 2, 134, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("EndDate", 3, 134, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("Type", 4, 0, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("Value", 5, 134, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("Repeat", 6, 0, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("TargetValue", 7, 134, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("Recurrence", 8, 0, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("RecurrenceValue", 9, 132, 1f, 0f, ""));
             fieldIndex++;
             goalMesg.SetField(new Field("Enabled", 10, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(goalMesg);
             GoalIndex = mesgIndex;
             mesgIndex++;

             // Activity
             Mesg activityMesg = new Mesg("Activity", MesgNum.Activity);
             fieldIndex = 0;
             activityMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, ""));
             fieldIndex++;
             activityMesg.SetField(new Field("TotalTimerTime", 0, 134, 1000f, 0f, "s"));
             fieldIndex++;
             activityMesg.SetField(new Field("NumSessions", 1, 132, 1f, 0f, ""));
             fieldIndex++;
             activityMesg.SetField(new Field("Type", 2, 0, 1f, 0f, ""));
             fieldIndex++;
             activityMesg.SetField(new Field("Event", 3, 0, 1f, 0f, ""));
             fieldIndex++;
             activityMesg.SetField(new Field("EventType", 4, 0, 1f, 0f, ""));
             fieldIndex++;
             activityMesg.SetField(new Field("LocalTimestamp", 5, 134, 1f, 0f, ""));
             fieldIndex++;
             activityMesg.SetField(new Field("EventGroup", 6, 2, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(activityMesg);
             ActivityIndex = mesgIndex;
             mesgIndex++;

             // Session
             Mesg sessionMesg = new Mesg("Session", MesgNum.Session);
             fieldIndex = 0;
             sessionMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("Event", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("EventType", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("StartTime", 2, 134, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("StartPositionLat", 3, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             sessionMesg.SetField(new Field("StartPositionLong", 4, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             sessionMesg.SetField(new Field("Sport", 5, 0, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("SubSport", 6, 0, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalElapsedTime", 7, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalTimerTime", 8, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalDistance", 9, 134, 100f, 0f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalCycles", 10, 134, 1f, 0f, "cycles"));
             subfieldIndex = 0;
             sessionMesg.fields[fieldIndex].subfields.Add(new Subfield("TotalStrides", 134, 1f, 0f, "strides"));
             sessionMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(5, 1);
             sessionMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(5, 11);
             subfieldIndex++;
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalCalories", 11, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalFatCalories", 13, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgSpeed", 14, 132, 1000f, 0f, "m/s"));
             sessionMesg.fields[fieldIndex].components.Add(new FieldComponent(124, false, 16, 1000f, 0f)); // enhanced_avg_speed
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxSpeed", 15, 132, 1000f, 0f, "m/s"));
             sessionMesg.fields[fieldIndex].components.Add(new FieldComponent(125, false, 16, 1000f, 0f)); // enhanced_max_speed
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgHeartRate", 16, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxHeartRate", 17, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgCadence", 18, 2, 1f, 0f, "rpm"));
             subfieldIndex = 0;
             sessionMesg.fields[fieldIndex].subfields.Add(new Subfield("AvgRunningCadence", 2, 1f, 0f, "strides/min"));
             sessionMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(5, 1);
             subfieldIndex++;
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxCadence", 19, 2, 1f, 0f, "rpm"));
             subfieldIndex = 0;
             sessionMesg.fields[fieldIndex].subfields.Add(new Subfield("MaxRunningCadence", 2, 1f, 0f, "strides/min"));
             sessionMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(5, 1);
             subfieldIndex++;
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgPower", 20, 132, 1f, 0f, "watts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxPower", 21, 132, 1f, 0f, "watts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalAscent", 22, 132, 1f, 0f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalDescent", 23, 132, 1f, 0f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalTrainingEffect", 24, 2, 10f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("FirstLapIndex", 25, 132, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("NumLaps", 26, 132, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("EventGroup", 27, 2, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("Trigger", 28, 0, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("NecLat", 29, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             sessionMesg.SetField(new Field("NecLong", 30, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             sessionMesg.SetField(new Field("SwcLat", 31, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             sessionMesg.SetField(new Field("SwcLong", 32, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             sessionMesg.SetField(new Field("NormalizedPower", 34, 132, 1f, 0f, "watts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TrainingStressScore", 35, 132, 10f, 0f, "tss"));
             fieldIndex++;
             sessionMesg.SetField(new Field("IntensityFactor", 36, 132, 1000f, 0f, "if"));
             fieldIndex++;
             sessionMesg.SetField(new Field("LeftRightBalance", 37, 132, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgStrokeCount", 41, 134, 10f, 0f, "strokes/lap"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgStrokeDistance", 42, 132, 100f, 0f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("SwimStroke", 43, 0, 1f, 0f, "swim_stroke"));
             fieldIndex++;
             sessionMesg.SetField(new Field("PoolLength", 44, 132, 100f, 0f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("ThresholdPower", 45, 132, 1f, 0f, "watts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("PoolLengthUnit", 46, 0, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("NumActiveLengths", 47, 132, 1f, 0f, "lengths"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalWork", 48, 134, 1f, 0f, "J"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgAltitude", 49, 132, 5f, 500f, "m"));
             sessionMesg.fields[fieldIndex].components.Add(new FieldComponent(126, false, 16, 5f, 500f)); // enhanced_avg_altitude
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxAltitude", 50, 132, 5f, 500f, "m"));
             sessionMesg.fields[fieldIndex].components.Add(new FieldComponent(128, false, 16, 5f, 500f)); // enhanced_max_altitude
             fieldIndex++;
             sessionMesg.SetField(new Field("GpsAccuracy", 51, 2, 1f, 0f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgGrade", 52, 131, 100f, 0f, "%"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgPosGrade", 53, 131, 100f, 0f, "%"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgNegGrade", 54, 131, 100f, 0f, "%"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxPosGrade", 55, 131, 100f, 0f, "%"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxNegGrade", 56, 131, 100f, 0f, "%"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgTemperature", 57, 1, 1f, 0f, "C"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxTemperature", 58, 1, 1f, 0f, "C"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalMovingTime", 59, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgPosVerticalSpeed", 60, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgNegVerticalSpeed", 61, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxPosVerticalSpeed", 62, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxNegVerticalSpeed", 63, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MinHeartRate", 64, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TimeInHrZone", 65, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TimeInSpeedZone", 66, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TimeInCadenceZone", 67, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TimeInPowerZone", 68, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgLapTime", 69, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("BestLapIndex", 70, 132, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("MinAltitude", 71, 132, 5f, 500f, "m"));
             sessionMesg.fields[fieldIndex].components.Add(new FieldComponent(127, false, 16, 5f, 500f)); // enhanced_min_altitude
             fieldIndex++;
             sessionMesg.SetField(new Field("PlayerScore", 82, 132, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("OpponentScore", 83, 132, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("OpponentName", 84, 7, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("StrokeCount", 85, 132, 1f, 0f, "counts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("ZoneCount", 86, 132, 1f, 0f, "counts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxBallSpeed", 87, 132, 100f, 0f, "m/s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgBallSpeed", 88, 132, 100f, 0f, "m/s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgVerticalOscillation", 89, 132, 10f, 0f, "mm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgStanceTimePercent", 90, 132, 100f, 0f, "percent"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgStanceTime", 91, 132, 10f, 0f, "ms"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgFractionalCadence", 92, 2, 128f, 0f, "rpm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxFractionalCadence", 93, 2, 128f, 0f, "rpm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("TotalFractionalCycles", 94, 2, 128f, 0f, "cycles"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgTotalHemoglobinConc", 95, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MinTotalHemoglobinConc", 96, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxTotalHemoglobinConc", 97, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgSaturatedHemoglobinPercent", 98, 132, 10f, 0f, "%"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MinSaturatedHemoglobinPercent", 99, 132, 10f, 0f, "%"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxSaturatedHemoglobinPercent", 100, 132, 10f, 0f, "%"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgLeftTorqueEffectiveness", 101, 2, 2f, 0f, "percent"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgRightTorqueEffectiveness", 102, 2, 2f, 0f, "percent"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgLeftPedalSmoothness", 103, 2, 2f, 0f, "percent"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgRightPedalSmoothness", 104, 2, 2f, 0f, "percent"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgCombinedPedalSmoothness", 105, 2, 2f, 0f, "percent"));
             fieldIndex++;
             sessionMesg.SetField(new Field("SportIndex", 111, 2, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("TimeStanding", 112, 134, 1000f, 0f, "s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("StandCount", 113, 132, 1f, 0f, ""));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgLeftPco", 114, 1, 1f, 0f, "mm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgRightPco", 115, 1, 1f, 0f, "mm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgLeftPowerPhase", 116, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgLeftPowerPhasePeak", 117, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgRightPowerPhase", 118, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgRightPowerPhasePeak", 119, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgPowerPosition", 120, 132, 1f, 0f, "watts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxPowerPosition", 121, 132, 1f, 0f, "watts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgCadencePosition", 122, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxCadencePosition", 123, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             sessionMesg.SetField(new Field("EnhancedAvgSpeed", 124, 134, 1000f, 0f, "m/s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("EnhancedMaxSpeed", 125, 134, 1000f, 0f, "m/s"));
             fieldIndex++;
             sessionMesg.SetField(new Field("EnhancedAvgAltitude", 126, 134, 5f, 500f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("EnhancedMinAltitude", 127, 134, 5f, 500f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("EnhancedMaxAltitude", 128, 134, 5f, 500f, "m"));
             fieldIndex++;
             sessionMesg.SetField(new Field("AvgLevMotorPower", 129, 132, 1f, 0f, "watts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("MaxLevMotorPower", 130, 132, 1f, 0f, "watts"));
             fieldIndex++;
             sessionMesg.SetField(new Field("LevBatteryConsumption", 131, 2, 2f, 0f, "percent"));
             fieldIndex++;
             mesgs.Add(sessionMesg);
             SessionIndex = mesgIndex;
             mesgIndex++;

             // Lap
             Mesg lapMesg = new Mesg("Lap", MesgNum.Lap);
             fieldIndex = 0;
             lapMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("Event", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("EventType", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("StartTime", 2, 134, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("StartPositionLat", 3, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             lapMesg.SetField(new Field("StartPositionLong", 4, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             lapMesg.SetField(new Field("EndPositionLat", 5, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             lapMesg.SetField(new Field("EndPositionLong", 6, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalElapsedTime", 7, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalTimerTime", 8, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalDistance", 9, 134, 100f, 0f, "m"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalCycles", 10, 134, 1f, 0f, "cycles"));
             subfieldIndex = 0;
             lapMesg.fields[fieldIndex].subfields.Add(new Subfield("TotalStrides", 134, 1f, 0f, "strides"));
             lapMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(25, 1);
             lapMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(25, 11);
             subfieldIndex++;
             fieldIndex++;
             lapMesg.SetField(new Field("TotalCalories", 11, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalFatCalories", 12, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgSpeed", 13, 132, 1000f, 0f, "m/s"));
             lapMesg.fields[fieldIndex].components.Add(new FieldComponent(110, false, 16, 1000f, 0f)); // enhanced_avg_speed
             fieldIndex++;
             lapMesg.SetField(new Field("MaxSpeed", 14, 132, 1000f, 0f, "m/s"));
             lapMesg.fields[fieldIndex].components.Add(new FieldComponent(111, false, 16, 1000f, 0f)); // enhanced_max_speed
             fieldIndex++;
             lapMesg.SetField(new Field("AvgHeartRate", 15, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxHeartRate", 16, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgCadence", 17, 2, 1f, 0f, "rpm"));
             subfieldIndex = 0;
             lapMesg.fields[fieldIndex].subfields.Add(new Subfield("AvgRunningCadence", 2, 1f, 0f, "strides/min"));
             lapMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(25, 1);
             subfieldIndex++;
             fieldIndex++;
             lapMesg.SetField(new Field("MaxCadence", 18, 2, 1f, 0f, "rpm"));
             subfieldIndex = 0;
             lapMesg.fields[fieldIndex].subfields.Add(new Subfield("MaxRunningCadence", 2, 1f, 0f, "strides/min"));
             lapMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(25, 1);
             subfieldIndex++;
             fieldIndex++;
             lapMesg.SetField(new Field("AvgPower", 19, 132, 1f, 0f, "watts"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxPower", 20, 132, 1f, 0f, "watts"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalAscent", 21, 132, 1f, 0f, "m"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalDescent", 22, 132, 1f, 0f, "m"));
             fieldIndex++;
             lapMesg.SetField(new Field("Intensity", 23, 0, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("LapTrigger", 24, 0, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("Sport", 25, 0, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("EventGroup", 26, 2, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("NumLengths", 32, 132, 1f, 0f, "lengths"));
             fieldIndex++;
             lapMesg.SetField(new Field("NormalizedPower", 33, 132, 1f, 0f, "watts"));
             fieldIndex++;
             lapMesg.SetField(new Field("LeftRightBalance", 34, 132, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("FirstLengthIndex", 35, 132, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgStrokeDistance", 37, 132, 100f, 0f, "m"));
             fieldIndex++;
             lapMesg.SetField(new Field("SwimStroke", 38, 0, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("SubSport", 39, 0, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("NumActiveLengths", 40, 132, 1f, 0f, "lengths"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalWork", 41, 134, 1f, 0f, "J"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgAltitude", 42, 132, 5f, 500f, "m"));
             lapMesg.fields[fieldIndex].components.Add(new FieldComponent(112, false, 16, 5f, 500f)); // enhanced_avg_altitude
             fieldIndex++;
             lapMesg.SetField(new Field("MaxAltitude", 43, 132, 5f, 500f, "m"));
             lapMesg.fields[fieldIndex].components.Add(new FieldComponent(114, false, 16, 5f, 500f)); // enhanced_max_altitude
             fieldIndex++;
             lapMesg.SetField(new Field("GpsAccuracy", 44, 2, 1f, 0f, "m"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgGrade", 45, 131, 100f, 0f, "%"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgPosGrade", 46, 131, 100f, 0f, "%"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgNegGrade", 47, 131, 100f, 0f, "%"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxPosGrade", 48, 131, 100f, 0f, "%"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxNegGrade", 49, 131, 100f, 0f, "%"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgTemperature", 50, 1, 1f, 0f, "C"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxTemperature", 51, 1, 1f, 0f, "C"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalMovingTime", 52, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgPosVerticalSpeed", 53, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgNegVerticalSpeed", 54, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxPosVerticalSpeed", 55, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxNegVerticalSpeed", 56, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             lapMesg.SetField(new Field("TimeInHrZone", 57, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("TimeInSpeedZone", 58, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("TimeInCadenceZone", 59, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("TimeInPowerZone", 60, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("RepetitionNum", 61, 132, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("MinAltitude", 62, 132, 5f, 500f, "m"));
             lapMesg.fields[fieldIndex].components.Add(new FieldComponent(113, false, 16, 5f, 500f)); // enhanced_min_altitude
             fieldIndex++;
             lapMesg.SetField(new Field("MinHeartRate", 63, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             lapMesg.SetField(new Field("WktStepIndex", 71, 132, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("OpponentScore", 74, 132, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("StrokeCount", 75, 132, 1f, 0f, "counts"));
             fieldIndex++;
             lapMesg.SetField(new Field("ZoneCount", 76, 132, 1f, 0f, "counts"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgVerticalOscillation", 77, 132, 10f, 0f, "mm"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgStanceTimePercent", 78, 132, 100f, 0f, "percent"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgStanceTime", 79, 132, 10f, 0f, "ms"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgFractionalCadence", 80, 2, 128f, 0f, "rpm"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxFractionalCadence", 81, 2, 128f, 0f, "rpm"));
             fieldIndex++;
             lapMesg.SetField(new Field("TotalFractionalCycles", 82, 2, 128f, 0f, "cycles"));
             fieldIndex++;
             lapMesg.SetField(new Field("PlayerScore", 83, 132, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgTotalHemoglobinConc", 84, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             lapMesg.SetField(new Field("MinTotalHemoglobinConc", 85, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxTotalHemoglobinConc", 86, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgSaturatedHemoglobinPercent", 87, 132, 10f, 0f, "%"));
             fieldIndex++;
             lapMesg.SetField(new Field("MinSaturatedHemoglobinPercent", 88, 132, 10f, 0f, "%"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxSaturatedHemoglobinPercent", 89, 132, 10f, 0f, "%"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgLeftTorqueEffectiveness", 91, 2, 2f, 0f, "percent"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgRightTorqueEffectiveness", 92, 2, 2f, 0f, "percent"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgLeftPedalSmoothness", 93, 2, 2f, 0f, "percent"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgRightPedalSmoothness", 94, 2, 2f, 0f, "percent"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgCombinedPedalSmoothness", 95, 2, 2f, 0f, "percent"));
             fieldIndex++;
             lapMesg.SetField(new Field("TimeStanding", 98, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lapMesg.SetField(new Field("StandCount", 99, 132, 1f, 0f, ""));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgLeftPco", 100, 1, 1f, 0f, "mm"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgRightPco", 101, 1, 1f, 0f, "mm"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgLeftPowerPhase", 102, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgLeftPowerPhasePeak", 103, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgRightPowerPhase", 104, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgRightPowerPhasePeak", 105, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgPowerPosition", 106, 132, 1f, 0f, "watts"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxPowerPosition", 107, 132, 1f, 0f, "watts"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgCadencePosition", 108, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxCadencePosition", 109, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             lapMesg.SetField(new Field("EnhancedAvgSpeed", 110, 134, 1000f, 0f, "m/s"));
             fieldIndex++;
             lapMesg.SetField(new Field("EnhancedMaxSpeed", 111, 134, 1000f, 0f, "m/s"));
             fieldIndex++;
             lapMesg.SetField(new Field("EnhancedAvgAltitude", 112, 134, 5f, 500f, "m"));
             fieldIndex++;
             lapMesg.SetField(new Field("EnhancedMinAltitude", 113, 134, 5f, 500f, "m"));
             fieldIndex++;
             lapMesg.SetField(new Field("EnhancedMaxAltitude", 114, 134, 5f, 500f, "m"));
             fieldIndex++;
             lapMesg.SetField(new Field("AvgLevMotorPower", 115, 132, 1f, 0f, "watts"));
             fieldIndex++;
             lapMesg.SetField(new Field("MaxLevMotorPower", 116, 132, 1f, 0f, "watts"));
             fieldIndex++;
             lapMesg.SetField(new Field("LevBatteryConsumption", 117, 2, 2f, 0f, "percent"));
             fieldIndex++;
             mesgs.Add(lapMesg);
             LapIndex = mesgIndex;
             mesgIndex++;

             // Length
             Mesg lengthMesg = new Mesg("Length", MesgNum.Length);
             fieldIndex = 0;
             lengthMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("Event", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("EventType", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("StartTime", 2, 134, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("TotalElapsedTime", 3, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lengthMesg.SetField(new Field("TotalTimerTime", 4, 134, 1000f, 0f, "s"));
             fieldIndex++;
             lengthMesg.SetField(new Field("TotalStrokes", 5, 132, 1f, 0f, "strokes"));
             fieldIndex++;
             lengthMesg.SetField(new Field("AvgSpeed", 6, 132, 1000f, 0f, "m/s"));
             fieldIndex++;
             lengthMesg.SetField(new Field("SwimStroke", 7, 0, 1f, 0f, "swim_stroke"));
             fieldIndex++;
             lengthMesg.SetField(new Field("AvgSwimmingCadence", 9, 2, 1f, 0f, "strokes/min"));
             fieldIndex++;
             lengthMesg.SetField(new Field("EventGroup", 10, 2, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("TotalCalories", 11, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             lengthMesg.SetField(new Field("LengthType", 12, 0, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("PlayerScore", 18, 132, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("OpponentScore", 19, 132, 1f, 0f, ""));
             fieldIndex++;
             lengthMesg.SetField(new Field("StrokeCount", 20, 132, 1f, 0f, "counts"));
             fieldIndex++;
             lengthMesg.SetField(new Field("ZoneCount", 21, 132, 1f, 0f, "counts"));
             fieldIndex++;
             mesgs.Add(lengthMesg);
             LengthIndex = mesgIndex;
             mesgIndex++;

             // Record
             Mesg recordMesg = new Mesg("Record", MesgNum.Record);
             fieldIndex = 0;
             recordMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             recordMesg.SetField(new Field("PositionLat", 0, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             recordMesg.SetField(new Field("PositionLong", 1, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             recordMesg.SetField(new Field("Altitude", 2, 132, 5f, 500f, "m"));
             recordMesg.fields[fieldIndex].components.Add(new FieldComponent(78, false, 16, 5f, 500f)); // enhanced_altitude
             fieldIndex++;
             recordMesg.SetField(new Field("HeartRate", 3, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             recordMesg.SetField(new Field("Cadence", 4, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             recordMesg.SetField(new Field("Distance", 5, 134, 100f, 0f, "m"));
             fieldIndex++;
             recordMesg.SetField(new Field("Speed", 6, 132, 1000f, 0f, "m/s"));
             recordMesg.fields[fieldIndex].components.Add(new FieldComponent(73, false, 16, 1000f, 0f)); // enhanced_speed
             fieldIndex++;
             recordMesg.SetField(new Field("Power", 7, 132, 1f, 0f, "watts"));
             fieldIndex++;
             recordMesg.SetField(new Field("CompressedSpeedDistance", 8, 13, 1f, 0f, ""));
             recordMesg.fields[fieldIndex].components.Add(new FieldComponent(6, false, 12, 100f, 0f)); // speed
             recordMesg.fields[fieldIndex].components.Add(new FieldComponent(5, true, 12, 16f, 0f)); // distance
             fieldIndex++;
             recordMesg.SetField(new Field("Grade", 9, 131, 100f, 0f, "%"));
             fieldIndex++;
             recordMesg.SetField(new Field("Resistance", 10, 2, 1f, 0f, ""));
             fieldIndex++;
             recordMesg.SetField(new Field("TimeFromCourse", 11, 133, 1000f, 0f, "s"));
             fieldIndex++;
             recordMesg.SetField(new Field("CycleLength", 12, 2, 100f, 0f, "m"));
             fieldIndex++;
             recordMesg.SetField(new Field("Temperature", 13, 1, 1f, 0f, "C"));
             fieldIndex++;
             recordMesg.SetField(new Field("Speed1s", 17, 2, 16f, 0f, "m/s"));
             fieldIndex++;
             recordMesg.SetField(new Field("Cycles", 18, 2, 1f, 0f, "cycles"));
             recordMesg.fields[fieldIndex].components.Add(new FieldComponent(19, true, 8, 1f, 0f)); // total_cycles
             fieldIndex++;
             recordMesg.SetField(new Field("TotalCycles", 19, 134, 1f, 0f, "cycles"));
             fieldIndex++;
             recordMesg.SetField(new Field("CompressedAccumulatedPower", 28, 132, 1f, 0f, "watts"));
             recordMesg.fields[fieldIndex].components.Add(new FieldComponent(29, true, 16, 1f, 0f)); // accumulated_power
             fieldIndex++;
             recordMesg.SetField(new Field("AccumulatedPower", 29, 134, 1f, 0f, "watts"));
             fieldIndex++;
             recordMesg.SetField(new Field("LeftRightBalance", 30, 2, 1f, 0f, ""));
             fieldIndex++;
             recordMesg.SetField(new Field("GpsAccuracy", 31, 2, 1f, 0f, "m"));
             fieldIndex++;
             recordMesg.SetField(new Field("VerticalSpeed", 32, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             recordMesg.SetField(new Field("Calories", 33, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             recordMesg.SetField(new Field("VerticalOscillation", 39, 132, 10f, 0f, "mm"));
             fieldIndex++;
             recordMesg.SetField(new Field("StanceTimePercent", 40, 132, 100f, 0f, "percent"));
             fieldIndex++;
             recordMesg.SetField(new Field("StanceTime", 41, 132, 10f, 0f, "ms"));
             fieldIndex++;
             recordMesg.SetField(new Field("ActivityType", 42, 0, 1f, 0f, ""));
             fieldIndex++;
             recordMesg.SetField(new Field("LeftTorqueEffectiveness", 43, 2, 2f, 0f, "percent"));
             fieldIndex++;
             recordMesg.SetField(new Field("RightTorqueEffectiveness", 44, 2, 2f, 0f, "percent"));
             fieldIndex++;
             recordMesg.SetField(new Field("LeftPedalSmoothness", 45, 2, 2f, 0f, "percent"));
             fieldIndex++;
             recordMesg.SetField(new Field("RightPedalSmoothness", 46, 2, 2f, 0f, "percent"));
             fieldIndex++;
             recordMesg.SetField(new Field("CombinedPedalSmoothness", 47, 2, 2f, 0f, "percent"));
             fieldIndex++;
             recordMesg.SetField(new Field("Time128", 48, 2, 128f, 0f, "s"));
             fieldIndex++;
             recordMesg.SetField(new Field("StrokeType", 49, 0, 1f, 0f, ""));
             fieldIndex++;
             recordMesg.SetField(new Field("Zone", 50, 2, 1f, 0f, ""));
             fieldIndex++;
             recordMesg.SetField(new Field("BallSpeed", 51, 132, 100f, 0f, "m/s"));
             fieldIndex++;
             recordMesg.SetField(new Field("Cadence256", 52, 132, 256f, 0f, "rpm"));
             fieldIndex++;
             recordMesg.SetField(new Field("FractionalCadence", 53, 2, 128f, 0f, "rpm"));
             fieldIndex++;
             recordMesg.SetField(new Field("TotalHemoglobinConc", 54, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             recordMesg.SetField(new Field("TotalHemoglobinConcMin", 55, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             recordMesg.SetField(new Field("TotalHemoglobinConcMax", 56, 132, 100f, 0f, "g/dL"));
             fieldIndex++;
             recordMesg.SetField(new Field("SaturatedHemoglobinPercent", 57, 132, 10f, 0f, "%"));
             fieldIndex++;
             recordMesg.SetField(new Field("SaturatedHemoglobinPercentMin", 58, 132, 10f, 0f, "%"));
             fieldIndex++;
             recordMesg.SetField(new Field("SaturatedHemoglobinPercentMax", 59, 132, 10f, 0f, "%"));
             fieldIndex++;
             recordMesg.SetField(new Field("DeviceIndex", 62, 2, 1f, 0f, ""));
             fieldIndex++;
             recordMesg.SetField(new Field("LeftPco", 67, 1, 1f, 0f, "mm"));
             fieldIndex++;
             recordMesg.SetField(new Field("RightPco", 68, 1, 1f, 0f, "mm"));
             fieldIndex++;
             recordMesg.SetField(new Field("LeftPowerPhase", 69, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             recordMesg.SetField(new Field("LeftPowerPhasePeak", 70, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             recordMesg.SetField(new Field("RightPowerPhase", 71, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             recordMesg.SetField(new Field("RightPowerPhasePeak", 72, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             recordMesg.SetField(new Field("EnhancedSpeed", 73, 134, 1000f, 0f, "m/s"));
             fieldIndex++;
             recordMesg.SetField(new Field("EnhancedAltitude", 78, 134, 5f, 500f, "m"));
             fieldIndex++;
             recordMesg.SetField(new Field("BatterySoc", 81, 2, 2f, 0f, "percent"));
             fieldIndex++;
             recordMesg.SetField(new Field("MotorPower", 82, 132, 1f, 0f, "watts"));
             fieldIndex++;
             mesgs.Add(recordMesg);
             RecordIndex = mesgIndex;
             mesgIndex++;

             // Event
             Mesg eventMesg = new Mesg("Event", MesgNum.Event);
             fieldIndex = 0;
             eventMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             eventMesg.SetField(new Field("Event", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("EventType", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("Data16", 2, 132, 1f, 0f, ""));
             eventMesg.fields[fieldIndex].components.Add(new FieldComponent(3, false, 16, 1f, 0f)); // data
             fieldIndex++;
             eventMesg.SetField(new Field("Data", 3, 134, 1f, 0f, ""));
             subfieldIndex = 0;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("TimerTrigger", 0, 1f, 0f, ""));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 0);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("CoursePointIndex", 132, 1f, 0f, ""));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 10);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("BatteryLevel", 132, 1000f, 0f, "V"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 11);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("VirtualPartnerSpeed", 132, 1000f, 0f, "m/s"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 12);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("HrHighAlert", 2, 1f, 0f, "bpm"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 13);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("HrLowAlert", 2, 1f, 0f, "bpm"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 14);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("SpeedHighAlert", 134, 1000f, 0f, "m/s"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 15);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("SpeedLowAlert", 134, 1000f, 0f, "m/s"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 16);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("CadHighAlert", 132, 1f, 0f, "rpm"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 17);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("CadLowAlert", 132, 1f, 0f, "rpm"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 18);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("PowerHighAlert", 132, 1f, 0f, "watts"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 19);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("PowerLowAlert", 132, 1f, 0f, "watts"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 20);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("TimeDurationAlert", 134, 1000f, 0f, "s"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 23);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("DistanceDurationAlert", 134, 100f, 0f, "m"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 24);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("CalorieDurationAlert", 134, 1f, 0f, "calories"));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 25);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("FitnessEquipmentState", 0, 1f, 0f, ""));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 27);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("SportPoint", 134, 1f, 0f, ""));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 33);
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddComponent(new FieldComponent(7, false, 16, 1f, 0f)); // score
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddComponent(new FieldComponent(8, false, 16, 1f, 0f)); // opponent_score
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("GearChangeData", 134, 1f, 0f, ""));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 42);
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 43);
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddComponent(new FieldComponent(11, false, 8, 1f, 0f)); // rear_gear_num
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddComponent(new FieldComponent(12, false, 8, 1f, 0f)); // rear_gear
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddComponent(new FieldComponent(9, false, 8, 1f, 0f)); // front_gear_num
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddComponent(new FieldComponent(10, false, 8, 1f, 0f)); // front_gear
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("RiderPosition", 0, 1f, 0f, ""));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 44);
             subfieldIndex++;
             eventMesg.fields[fieldIndex].subfields.Add(new Subfield("CommTimeout", 132, 1f, 0f, ""));
             eventMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 47);
             subfieldIndex++;
             fieldIndex++;
             eventMesg.SetField(new Field("EventGroup", 4, 2, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("Score", 7, 132, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("OpponentScore", 8, 132, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("FrontGearNum", 9, 10, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("FrontGear", 10, 10, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("RearGearNum", 11, 10, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("RearGear", 12, 10, 1f, 0f, ""));
             fieldIndex++;
             eventMesg.SetField(new Field("DeviceIndex", 13, 2, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(eventMesg);
             EventIndex = mesgIndex;
             mesgIndex++;

             // DeviceInfo
             Mesg deviceInfoMesg = new Mesg("DeviceInfo", MesgNum.DeviceInfo);
             fieldIndex = 0;
             deviceInfoMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("DeviceIndex", 0, 2, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("DeviceType", 1, 2, 1f, 0f, ""));
             subfieldIndex = 0;
             deviceInfoMesg.fields[fieldIndex].subfields.Add(new Subfield("AntplusDeviceType", 2, 1f, 0f, ""));
             deviceInfoMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(25, 1);
             subfieldIndex++;
             deviceInfoMesg.fields[fieldIndex].subfields.Add(new Subfield("AntDeviceType", 2, 1f, 0f, ""));
             deviceInfoMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(25, 0);
             subfieldIndex++;
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("Manufacturer", 2, 132, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("SerialNumber", 3, 140, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("Product", 4, 132, 1f, 0f, ""));
             subfieldIndex = 0;
             deviceInfoMesg.fields[fieldIndex].subfields.Add(new Subfield("GarminProduct", 132, 1f, 0f, ""));
             deviceInfoMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(2, 1);
             deviceInfoMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(2, 15);
             deviceInfoMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(2, 13);
             subfieldIndex++;
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("SoftwareVersion", 5, 132, 100f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("HardwareVersion", 6, 2, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("CumOperatingTime", 7, 134, 1f, 0f, "s"));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("BatteryVoltage", 10, 132, 256f, 0f, "V"));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("BatteryStatus", 11, 2, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("SensorPosition", 18, 0, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("Descriptor", 19, 7, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("AntTransmissionType", 20, 10, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("AntDeviceNumber", 21, 139, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("AntNetwork", 22, 0, 1f, 0f, ""));
             fieldIndex++;
             deviceInfoMesg.SetField(new Field("SourceType", 25, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(deviceInfoMesg);
             DeviceInfoIndex = mesgIndex;
             mesgIndex++;

             // TrainingFile
             Mesg trainingFileMesg = new Mesg("TrainingFile", MesgNum.TrainingFile);
             fieldIndex = 0;
             trainingFileMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, ""));
             fieldIndex++;
             trainingFileMesg.SetField(new Field("Type", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             trainingFileMesg.SetField(new Field("Manufacturer", 1, 132, 1f, 0f, ""));
             fieldIndex++;
             trainingFileMesg.SetField(new Field("Product", 2, 132, 1f, 0f, ""));
             subfieldIndex = 0;
             trainingFileMesg.fields[fieldIndex].subfields.Add(new Subfield("GarminProduct", 132, 1f, 0f, ""));
             trainingFileMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 1);
             trainingFileMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 15);
             trainingFileMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 13);
             subfieldIndex++;
             fieldIndex++;
             trainingFileMesg.SetField(new Field("SerialNumber", 3, 140, 1f, 0f, ""));
             fieldIndex++;
             trainingFileMesg.SetField(new Field("TimeCreated", 4, 134, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(trainingFileMesg);
             TrainingFileIndex = mesgIndex;
             mesgIndex++;

             // Hrv
             Mesg hrvMesg = new Mesg("Hrv", MesgNum.Hrv);
             fieldIndex = 0;
             hrvMesg.SetField(new Field("Time", 0, 132, 1000f, 0f, "s"));
             fieldIndex++;
             mesgs.Add(hrvMesg);
             HrvIndex = mesgIndex;
             mesgIndex++;

             // Course
             Mesg courseMesg = new Mesg("Course", MesgNum.Course);
             fieldIndex = 0;
             courseMesg.SetField(new Field("Sport", 4, 0, 1f, 0f, ""));
             fieldIndex++;
             courseMesg.SetField(new Field("Name", 5, 7, 1f, 0f, ""));
             fieldIndex++;
             courseMesg.SetField(new Field("Capabilities", 6, 140, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(courseMesg);
             CourseIndex = mesgIndex;
             mesgIndex++;

             // CoursePoint
             Mesg coursePointMesg = new Mesg("CoursePoint", MesgNum.CoursePoint);
             fieldIndex = 0;
             coursePointMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             coursePointMesg.SetField(new Field("Timestamp", 1, 134, 1f, 0f, ""));
             fieldIndex++;
             coursePointMesg.SetField(new Field("PositionLat", 2, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             coursePointMesg.SetField(new Field("PositionLong", 3, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             coursePointMesg.SetField(new Field("Distance", 4, 134, 100f, 0f, "m"));
             fieldIndex++;
             coursePointMesg.SetField(new Field("Type", 5, 0, 1f, 0f, ""));
             fieldIndex++;
             coursePointMesg.SetField(new Field("Name", 6, 7, 1f, 0f, ""));
             fieldIndex++;
             coursePointMesg.SetField(new Field("Favorite", 8, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(coursePointMesg);
             CoursePointIndex = mesgIndex;
             mesgIndex++;

             // SegmentId
             Mesg segmentIdMesg = new Mesg("SegmentId", MesgNum.SegmentId);
             fieldIndex = 0;
             segmentIdMesg.SetField(new Field("Name", 0, 7, 1f, 0f, ""));
             fieldIndex++;
             segmentIdMesg.SetField(new Field("Uuid", 1, 7, 1f, 0f, ""));
             fieldIndex++;
             segmentIdMesg.SetField(new Field("Sport", 2, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentIdMesg.SetField(new Field("Enabled", 3, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentIdMesg.SetField(new Field("UserProfilePrimaryKey", 4, 134, 1f, 0f, ""));
             fieldIndex++;
             segmentIdMesg.SetField(new Field("DeviceId", 5, 134, 1f, 0f, ""));
             fieldIndex++;
             segmentIdMesg.SetField(new Field("DefaultRaceLeader", 6, 2, 1f, 0f, ""));
             fieldIndex++;
             segmentIdMesg.SetField(new Field("DeleteStatus", 7, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentIdMesg.SetField(new Field("SelectionType", 8, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(segmentIdMesg);
             SegmentIdIndex = mesgIndex;
             mesgIndex++;

             // SegmentLeaderboardEntry
             Mesg segmentLeaderboardEntryMesg = new Mesg("SegmentLeaderboardEntry", MesgNum.SegmentLeaderboardEntry);
             fieldIndex = 0;
             segmentLeaderboardEntryMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentLeaderboardEntryMesg.SetField(new Field("Name", 0, 7, 1f, 0f, ""));
             fieldIndex++;
             segmentLeaderboardEntryMesg.SetField(new Field("Type", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentLeaderboardEntryMesg.SetField(new Field("GroupPrimaryKey", 2, 134, 1f, 0f, ""));
             fieldIndex++;
             segmentLeaderboardEntryMesg.SetField(new Field("ActivityId", 3, 134, 1f, 0f, ""));
             fieldIndex++;
             segmentLeaderboardEntryMesg.SetField(new Field("SegmentTime", 4, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLeaderboardEntryMesg.SetField(new Field("ActivityIdString", 5, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(segmentLeaderboardEntryMesg);
             SegmentLeaderboardEntryIndex = mesgIndex;
             mesgIndex++;

             // SegmentPoint
             Mesg segmentPointMesg = new Mesg("SegmentPoint", MesgNum.SegmentPoint);
             fieldIndex = 0;
             segmentPointMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentPointMesg.SetField(new Field("PositionLat", 1, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentPointMesg.SetField(new Field("PositionLong", 2, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentPointMesg.SetField(new Field("Distance", 3, 134, 100f, 0f, "m"));
             fieldIndex++;
             segmentPointMesg.SetField(new Field("Altitude", 4, 132, 5f, 500f, "m"));
             fieldIndex++;
             segmentPointMesg.SetField(new Field("LeaderTime", 5, 134, 1000f, 0f, "s"));
             fieldIndex++;
             mesgs.Add(segmentPointMesg);
             SegmentPointIndex = mesgIndex;
             mesgIndex++;

             // SegmentLap
             Mesg segmentLapMesg = new Mesg("SegmentLap", MesgNum.SegmentLap);
             fieldIndex = 0;
             segmentLapMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("Event", 0, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("EventType", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("StartTime", 2, 134, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("StartPositionLat", 3, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("StartPositionLong", 4, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("EndPositionLat", 5, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("EndPositionLong", 6, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalElapsedTime", 7, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalTimerTime", 8, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalDistance", 9, 134, 100f, 0f, "m"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalCycles", 10, 134, 1f, 0f, "cycles"));
             subfieldIndex = 0;
             segmentLapMesg.fields[fieldIndex].subfields.Add(new Subfield("TotalStrokes", 134, 1f, 0f, "strokes"));
             segmentLapMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(23, 2);
             subfieldIndex++;
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalCalories", 11, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalFatCalories", 12, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgSpeed", 13, 132, 1000f, 0f, "m/s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxSpeed", 14, 132, 1000f, 0f, "m/s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgHeartRate", 15, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxHeartRate", 16, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgCadence", 17, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxCadence", 18, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgPower", 19, 132, 1f, 0f, "watts"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxPower", 20, 132, 1f, 0f, "watts"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalAscent", 21, 132, 1f, 0f, "m"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalDescent", 22, 132, 1f, 0f, "m"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("Sport", 23, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("EventGroup", 24, 2, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("NecLat", 25, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("NecLong", 26, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("SwcLat", 27, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("SwcLong", 28, 133, 1f, 0f, "semicircles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("Name", 29, 7, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("NormalizedPower", 30, 132, 1f, 0f, "watts"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("LeftRightBalance", 31, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("SubSport", 32, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalWork", 33, 134, 1f, 0f, "J"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgAltitude", 34, 132, 5f, 500f, "m"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxAltitude", 35, 132, 5f, 500f, "m"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("GpsAccuracy", 36, 2, 1f, 0f, "m"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgGrade", 37, 131, 100f, 0f, "%"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgPosGrade", 38, 131, 100f, 0f, "%"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgNegGrade", 39, 131, 100f, 0f, "%"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxPosGrade", 40, 131, 100f, 0f, "%"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxNegGrade", 41, 131, 100f, 0f, "%"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgTemperature", 42, 1, 1f, 0f, "C"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxTemperature", 43, 1, 1f, 0f, "C"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalMovingTime", 44, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgPosVerticalSpeed", 45, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgNegVerticalSpeed", 46, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxPosVerticalSpeed", 47, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxNegVerticalSpeed", 48, 131, 1000f, 0f, "m/s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TimeInHrZone", 49, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TimeInSpeedZone", 50, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TimeInCadenceZone", 51, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TimeInPowerZone", 52, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("RepetitionNum", 53, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MinAltitude", 54, 132, 5f, 500f, "m"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MinHeartRate", 55, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("ActiveTime", 56, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("WktStepIndex", 57, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("SportEvent", 58, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgLeftTorqueEffectiveness", 59, 2, 2f, 0f, "percent"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgRightTorqueEffectiveness", 60, 2, 2f, 0f, "percent"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgLeftPedalSmoothness", 61, 2, 2f, 0f, "percent"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgRightPedalSmoothness", 62, 2, 2f, 0f, "percent"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgCombinedPedalSmoothness", 63, 2, 2f, 0f, "percent"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("Status", 64, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("Uuid", 65, 7, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgFractionalCadence", 66, 2, 128f, 0f, "rpm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxFractionalCadence", 67, 2, 128f, 0f, "rpm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TotalFractionalCycles", 68, 2, 128f, 0f, "cycles"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("FrontGearShiftCount", 69, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("RearGearShiftCount", 70, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("TimeStanding", 71, 134, 1000f, 0f, "s"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("StandCount", 72, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgLeftPco", 73, 1, 1f, 0f, "mm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgRightPco", 74, 1, 1f, 0f, "mm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgLeftPowerPhase", 75, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgLeftPowerPhasePeak", 76, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgRightPowerPhase", 77, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgRightPowerPhasePeak", 78, 2, 0.7111111f, 0f, "degrees"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgPowerPosition", 79, 132, 1f, 0f, "watts"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxPowerPosition", 80, 132, 1f, 0f, "watts"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("AvgCadencePosition", 81, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             segmentLapMesg.SetField(new Field("MaxCadencePosition", 82, 2, 1f, 0f, "rpm"));
             fieldIndex++;
             mesgs.Add(segmentLapMesg);
             SegmentLapIndex = mesgIndex;
             mesgIndex++;

             // SegmentFile
             Mesg segmentFileMesg = new Mesg("SegmentFile", MesgNum.SegmentFile);
             fieldIndex = 0;
             segmentFileMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             segmentFileMesg.SetField(new Field("FileUuid", 1, 7, 1f, 0f, ""));
             fieldIndex++;
             segmentFileMesg.SetField(new Field("Enabled", 3, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentFileMesg.SetField(new Field("UserProfilePrimaryKey", 4, 134, 1f, 0f, ""));
             fieldIndex++;
             segmentFileMesg.SetField(new Field("LeaderType", 7, 0, 1f, 0f, ""));
             fieldIndex++;
             segmentFileMesg.SetField(new Field("LeaderGroupPrimaryKey", 8, 134, 1f, 0f, ""));
             fieldIndex++;
             segmentFileMesg.SetField(new Field("LeaderActivityId", 9, 134, 1f, 0f, ""));
             fieldIndex++;
             segmentFileMesg.SetField(new Field("LeaderActivityIdString", 10, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(segmentFileMesg);
             SegmentFileIndex = mesgIndex;
             mesgIndex++;

             // Workout
             Mesg workoutMesg = new Mesg("Workout", MesgNum.Workout);
             fieldIndex = 0;
             workoutMesg.SetField(new Field("Sport", 4, 0, 1f, 0f, ""));
             fieldIndex++;
             workoutMesg.SetField(new Field("Capabilities", 5, 140, 1f, 0f, ""));
             fieldIndex++;
             workoutMesg.SetField(new Field("NumValidSteps", 6, 132, 1f, 0f, ""));
             fieldIndex++;
             workoutMesg.SetField(new Field("WktName", 8, 7, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(workoutMesg);
             WorkoutIndex = mesgIndex;
             mesgIndex++;

             // WorkoutStep
             Mesg workoutStepMesg = new Mesg("WorkoutStep", MesgNum.WorkoutStep);
             fieldIndex = 0;
             workoutStepMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             workoutStepMesg.SetField(new Field("WktStepName", 0, 7, 1f, 0f, ""));
             fieldIndex++;
             workoutStepMesg.SetField(new Field("DurationType", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             workoutStepMesg.SetField(new Field("DurationValue", 2, 134, 1f, 0f, ""));
             subfieldIndex = 0;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("DurationTime", 134, 1000f, 0f, "s"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 0);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 28);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("DurationDistance", 134, 100f, 0f, "m"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 1);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("DurationHr", 134, 1f, 0f, "% or bpm"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 2);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 3);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("DurationCalories", 134, 1f, 0f, "calories"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 4);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("DurationStep", 134, 1f, 0f, ""));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 6);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 7);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 8);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 9);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 10);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 11);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 12);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 13);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("DurationPower", 134, 1f, 0f, "% or watts"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 14);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 15);
             subfieldIndex++;
             fieldIndex++;
             workoutStepMesg.SetField(new Field("TargetType", 3, 0, 1f, 0f, ""));
             fieldIndex++;
             workoutStepMesg.SetField(new Field("TargetValue", 4, 134, 1f, 0f, ""));
             subfieldIndex = 0;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("TargetHrZone", 134, 1f, 0f, ""));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 1);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("TargetPowerZone", 134, 1f, 0f, ""));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 4);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("RepeatSteps", 134, 1f, 0f, ""));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 6);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("RepeatTime", 134, 1000f, 0f, "s"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 7);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("RepeatDistance", 134, 100f, 0f, "m"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 8);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("RepeatCalories", 134, 1f, 0f, "calories"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 9);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("RepeatHr", 134, 1f, 0f, "% or bpm"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 10);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 11);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("RepeatPower", 134, 1f, 0f, "% or watts"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 12);
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(1, 13);
             subfieldIndex++;
             fieldIndex++;
             workoutStepMesg.SetField(new Field("CustomTargetValueLow", 5, 134, 1f, 0f, ""));
             subfieldIndex = 0;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("CustomTargetSpeedLow", 134, 1000f, 0f, "m/s"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 0);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("CustomTargetHeartRateLow", 134, 1f, 0f, "% or bpm"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 1);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("CustomTargetCadenceLow", 134, 1f, 0f, "rpm"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 3);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("CustomTargetPowerLow", 134, 1f, 0f, "% or watts"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 4);
             subfieldIndex++;
             fieldIndex++;
             workoutStepMesg.SetField(new Field("CustomTargetValueHigh", 6, 134, 1f, 0f, ""));
             subfieldIndex = 0;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("CustomTargetSpeedHigh", 134, 1000f, 0f, "m/s"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 0);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("CustomTargetHeartRateHigh", 134, 1f, 0f, "% or bpm"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 1);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("CustomTargetCadenceHigh", 134, 1f, 0f, "rpm"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 3);
             subfieldIndex++;
             workoutStepMesg.fields[fieldIndex].subfields.Add(new Subfield("CustomTargetPowerHigh", 134, 1f, 0f, "% or watts"));
             workoutStepMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(3, 4);
             subfieldIndex++;
             fieldIndex++;
             workoutStepMesg.SetField(new Field("Intensity", 7, 0, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(workoutStepMesg);
             WorkoutStepIndex = mesgIndex;
             mesgIndex++;

             // Schedule
             Mesg scheduleMesg = new Mesg("Schedule", MesgNum.Schedule);
             fieldIndex = 0;
             scheduleMesg.SetField(new Field("Manufacturer", 0, 132, 1f, 0f, ""));
             fieldIndex++;
             scheduleMesg.SetField(new Field("Product", 1, 132, 1f, 0f, ""));
             subfieldIndex = 0;
             scheduleMesg.fields[fieldIndex].subfields.Add(new Subfield("GarminProduct", 132, 1f, 0f, ""));
             scheduleMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 1);
             scheduleMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 15);
             scheduleMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(0, 13);
             subfieldIndex++;
             fieldIndex++;
             scheduleMesg.SetField(new Field("SerialNumber", 2, 140, 1f, 0f, ""));
             fieldIndex++;
             scheduleMesg.SetField(new Field("TimeCreated", 3, 134, 1f, 0f, ""));
             fieldIndex++;
             scheduleMesg.SetField(new Field("Completed", 4, 0, 1f, 0f, ""));
             fieldIndex++;
             scheduleMesg.SetField(new Field("Type", 5, 0, 1f, 0f, ""));
             fieldIndex++;
             scheduleMesg.SetField(new Field("ScheduledTime", 6, 134, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(scheduleMesg);
             ScheduleIndex = mesgIndex;
             mesgIndex++;

             // Totals
             Mesg totalsMesg = new Mesg("Totals", MesgNum.Totals);
             fieldIndex = 0;
             totalsMesg.SetField(new Field("MessageIndex", 254, 132, 1f, 0f, ""));
             fieldIndex++;
             totalsMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             totalsMesg.SetField(new Field("TimerTime", 0, 134, 1f, 0f, "s"));
             fieldIndex++;
             totalsMesg.SetField(new Field("Distance", 1, 134, 1f, 0f, "m"));
             fieldIndex++;
             totalsMesg.SetField(new Field("Calories", 2, 134, 1f, 0f, "kcal"));
             fieldIndex++;
             totalsMesg.SetField(new Field("Sport", 3, 0, 1f, 0f, ""));
             fieldIndex++;
             totalsMesg.SetField(new Field("ElapsedTime", 4, 134, 1f, 0f, "s"));
             fieldIndex++;
             totalsMesg.SetField(new Field("Sessions", 5, 132, 1f, 0f, ""));
             fieldIndex++;
             totalsMesg.SetField(new Field("ActiveTime", 6, 134, 1f, 0f, "s"));
             fieldIndex++;
             totalsMesg.SetField(new Field("SportIndex", 9, 2, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(totalsMesg);
             TotalsIndex = mesgIndex;
             mesgIndex++;

             // WeightScale
             Mesg weightScaleMesg = new Mesg("WeightScale", MesgNum.WeightScale);
             fieldIndex = 0;
             weightScaleMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("Weight", 0, 132, 100f, 0f, "kg"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("PercentFat", 1, 132, 100f, 0f, "%"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("PercentHydration", 2, 132, 100f, 0f, "%"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("VisceralFatMass", 3, 132, 100f, 0f, "kg"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("BoneMass", 4, 132, 100f, 0f, "kg"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("MuscleMass", 5, 132, 100f, 0f, "kg"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("BasalMet", 7, 132, 4f, 0f, "kcal/day"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("PhysiqueRating", 8, 2, 1f, 0f, ""));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("ActiveMet", 9, 132, 4f, 0f, "kcal/day"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("MetabolicAge", 10, 2, 1f, 0f, "years"));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("VisceralFatRating", 11, 2, 1f, 0f, ""));
             fieldIndex++;
             weightScaleMesg.SetField(new Field("UserProfileIndex", 12, 132, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(weightScaleMesg);
             WeightScaleIndex = mesgIndex;
             mesgIndex++;

             // BloodPressure
             Mesg bloodPressureMesg = new Mesg("BloodPressure", MesgNum.BloodPressure);
             fieldIndex = 0;
             bloodPressureMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("SystolicPressure", 0, 132, 1f, 0f, "mmHg"));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("DiastolicPressure", 1, 132, 1f, 0f, "mmHg"));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("MeanArterialPressure", 2, 132, 1f, 0f, "mmHg"));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("Map3SampleMean", 3, 132, 1f, 0f, "mmHg"));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("MapMorningValues", 4, 132, 1f, 0f, "mmHg"));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("MapEveningValues", 5, 132, 1f, 0f, "mmHg"));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("HeartRate", 6, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("HeartRateType", 7, 0, 1f, 0f, ""));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("Status", 8, 0, 1f, 0f, ""));
             fieldIndex++;
             bloodPressureMesg.SetField(new Field("UserProfileIndex", 9, 132, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(bloodPressureMesg);
             BloodPressureIndex = mesgIndex;
             mesgIndex++;

             // MonitoringInfo
             Mesg monitoringInfoMesg = new Mesg("MonitoringInfo", MesgNum.MonitoringInfo);
             fieldIndex = 0;
             monitoringInfoMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             monitoringInfoMesg.SetField(new Field("LocalTimestamp", 0, 134, 1f, 0f, "s"));
             fieldIndex++;
             monitoringInfoMesg.SetField(new Field("ActivityType", 1, 0, 1f, 0f, ""));
             fieldIndex++;
             monitoringInfoMesg.SetField(new Field("CyclesToDistance", 3, 132, 5000f, 0f, "m/cycle"));
             fieldIndex++;
             monitoringInfoMesg.SetField(new Field("CyclesToCalories", 4, 132, 5000f, 0f, "kcal/cycle"));
             fieldIndex++;
             monitoringInfoMesg.SetField(new Field("RestingMetabolicRate", 5, 132, 1f, 0f, "kcal / day"));
             fieldIndex++;
             mesgs.Add(monitoringInfoMesg);
             MonitoringInfoIndex = mesgIndex;
             mesgIndex++;

             // Monitoring
             Mesg monitoringMesg = new Mesg("Monitoring", MesgNum.Monitoring);
             fieldIndex = 0;
             monitoringMesg.SetField(new Field("Timestamp", 253, 134, 1f, 0f, "s"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("DeviceIndex", 0, 2, 1f, 0f, ""));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Calories", 1, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Distance", 2, 134, 100f, 0f, "m"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Cycles", 3, 134, 2f, 0f, "cycles"));
             subfieldIndex = 0;
             monitoringMesg.fields[fieldIndex].subfields.Add(new Subfield("Steps", 134, 1f, 0f, "steps"));
             monitoringMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(5, 6);
             monitoringMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(5, 1);
             subfieldIndex++;
             monitoringMesg.fields[fieldIndex].subfields.Add(new Subfield("Strokes", 134, 2f, 0f, "strokes"));
             monitoringMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(5, 2);
             monitoringMesg.fields[fieldIndex].subfields[subfieldIndex].AddMap(5, 5);
             subfieldIndex++;
             fieldIndex++;
             monitoringMesg.SetField(new Field("ActiveTime", 4, 134, 1000f, 0f, "s"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("ActivityType", 5, 0, 1f, 0f, ""));
             fieldIndex++;
             monitoringMesg.SetField(new Field("ActivitySubtype", 6, 0, 1f, 0f, ""));
             fieldIndex++;
             monitoringMesg.SetField(new Field("ActivityLevel", 7, 0, 1f, 0f, ""));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Distance16", 8, 132, 1f, 0f, "100 * m"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Cycles16", 9, 132, 1f, 0f, "2 * cycles (steps)"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("ActiveTime16", 10, 132, 1f, 0f, "s"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("LocalTimestamp", 11, 134, 1f, 0f, ""));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Temperature", 12, 131, 100f, 0f, "C"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("TemperatureMin", 14, 131, 100f, 0f, "C"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("TemperatureMax", 15, 131, 100f, 0f, "C"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("ActivityTime", 16, 132, 1f, 0f, "minutes"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("ActiveCalories", 19, 132, 1f, 0f, "kcal"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("CurrentActivityTypeIntensity", 24, 13, 1f, 0f, ""));
             monitoringMesg.fields[fieldIndex].components.Add(new FieldComponent(5, false, 5, 1f, 0f)); // activity_type
             monitoringMesg.fields[fieldIndex].components.Add(new FieldComponent(28, false, 3, 1f, 0f)); // intensity
             fieldIndex++;
             monitoringMesg.SetField(new Field("TimestampMin8", 25, 2, 1f, 0f, "min"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Timestamp16", 26, 132, 1f, 0f, "s"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("HeartRate", 27, 2, 1f, 0f, "bpm"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Intensity", 28, 2, 10f, 0f, ""));
             fieldIndex++;
             monitoringMesg.SetField(new Field("DurationMin", 29, 132, 1f, 0f, "min"));
             fieldIndex++;
             monitoringMesg.SetField(new Field("Duration", 30, 134, 1f, 0f, "s"));
             fieldIndex++;
             mesgs.Add(monitoringMesg);
             MonitoringIndex = mesgIndex;
             mesgIndex++;

             // MemoGlob
             Mesg memoGlobMesg = new Mesg("MemoGlob", MesgNum.MemoGlob);
             fieldIndex = 0;
             memoGlobMesg.SetField(new Field("PartIndex", 250, 134, 1f, 0f, ""));
             fieldIndex++;
             memoGlobMesg.SetField(new Field("Memo", 0, 13, 1f, 0f, ""));
             fieldIndex++;
             memoGlobMesg.SetField(new Field("MessageNumber", 1, 132, 1f, 0f, ""));
             fieldIndex++;
             memoGlobMesg.SetField(new Field("MessageIndex", 2, 132, 1f, 0f, ""));
             fieldIndex++;
             mesgs.Add(memoGlobMesg);
             MemoGlobIndex = mesgIndex;
             mesgIndex++;

             // Pad
             Mesg padMesg = new Mesg("Pad", MesgNum.Pad);
             fieldIndex = 0;
             mesgs.Add(padMesg);
             PadIndex = mesgIndex;
             mesgIndex++;

             //InvalidIndex; = FitTypeInvalid.uint16;
        }
Beispiel #48
0
 public void Write(Mesg mesg)
 {
     if (open == false)
      {
     throw new FitException("Encode:Write - Encode not opened yet, must call Encode:Open()");
      }
      // Fit file must always contain a defn message before data messages
      if ((lastMesgDef[mesg.LocalNum] == null) || !lastMesgDef[mesg.LocalNum].Supports(mesg))
      {
     Write(new MesgDefinition(mesg));
      }
      mesg.Write(fitDest, lastMesgDef[mesg.LocalNum]);
 }
Beispiel #49
0
 public HrvMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #50
0
 public GoalMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #51
0
 public CapabilitiesMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #52
0
 public ExdScreenConfigurationMesg(Mesg mesg) : base(mesg)
 {
 }
Beispiel #53
0
 public void OnMesg(Mesg newMesg)
 {
     Write(newMesg);
 }
Beispiel #54
0
 public HrmProfileMesg(Mesg mesg)
     : base(mesg)
 {
 }
 public SegmentLeaderboardEntryMesg(Mesg mesg)
     : base(mesg)
 {
 }
Beispiel #56
0
 public OneDSensorCalibrationMesg(Mesg mesg) : base(mesg)
 {
 }