示例#1
0
        internal void Read(Stream fitSource, DeveloperDataLookup lookup)
        {
            fitSource.Position = 0;
            EndianBinaryReader br = new EndianBinaryReader(fitSource, false);

            header       = br.ReadByte();
            LocalMesgNum = (byte)(header & Fit.LocalMesgNumMask);

            byte reserved = br.ReadByte();

            architecture   = br.ReadByte();
            br.IsBigEndian = this.IsBigEndian;
            GlobalMesgNum  = br.ReadUInt16();
            NumFields      = br.ReadByte();
            for (int i = 0; i < NumFields; i++)
            {
                byte num  = br.ReadByte();
                byte size = br.ReadByte();
                byte type = br.ReadByte();

                FieldDefinition newField = new FieldDefinition(num, size, type);
                fieldDefs.Add(newField);
            }

            if (ContainsDevData)
            {
                byte devFldCount = br.ReadByte();
                for (int i = 0; i < devFldCount; i++)
                {
                    // Seek to the Size
                    byte num    = br.ReadByte();
                    byte size   = br.ReadByte();
                    byte devIdx = br.ReadByte();
                    DeveloperFieldDefinition defn;
                    var key = new DeveloperDataKey(devIdx, num);
                    Tuple <DeveloperDataIdMesg, FieldDescriptionMesg> tuple = lookup.GetMesgs(key);

                    if (tuple != null)
                    {
                        defn = new DeveloperFieldDefinition(tuple.Item2, tuple.Item1, size);
                    }
                    else
                    {
                        defn = new DeveloperFieldDefinition(num, size, devIdx);
                    }

                    m_devFieldDefs.Add(defn);
                }
            }
        }
示例#2
0
 internal MesgDefinition(
     Stream fitSource,
     DeveloperDataLookup lookup)
 {
     Read(fitSource, lookup);
 }