コード例 #1
0
        public TrackFileSection625M UnpackTrackSectionLaps()
        {
            if (this.PacketLength < TrackHeaderLength)
            {
                return(null);
            }

            TrackFileSection625M section = new TrackFileSection625M();

            ReadHeader(section, 0);
            section.LapCount        = this.PacketData[6];
            section.TrackPointCount = ReadInt16(25);
            section.StartPointIndex = ReadInt16(27);
            section.EndPointIndex   = ReadInt16(29);

            int offset = TrackHeaderLength;

            while (offset <= this.PacketLength - TrackLapLength)
            {
                Lap lap = new Lap();
                lap.EndTime           = TimeSpan.FromSeconds(FromGlobTime(ReadInt32(offset)));
                lap.LapTime           = TimeSpan.FromSeconds(FromGlobTime(ReadInt32(offset + 4)));
                lap.LapDistanceMeters = ReadInt32(offset + 8);
                lap.LapCalories       = ReadInt16(offset + 12);
                lap.MaximumSpeed      = FromGlobSpeed(ReadInt16(offset + 14));
                lap.MaximumHeartRate  = this.PacketData[offset + 16];
                lap.AverageHeartRate  = this.PacketData[offset + 17];
                //lap.StartPointIndex = ReadInt16(18);
                //lap.EndPointIndex = ReadInt16(20);
                section.Laps.Add(lap);
                offset += TrackLapLength;
            }
            return(section);
        }
コード例 #2
0
        public TrackFileSection625M UnpackTrackSection()
        {
            if (this.PacketLength < TrackHeaderLength)
            {
                return(null);
            }

            TrackFileSection625M section = new TrackFileSection625M();

            ReadHeader(section, 0);
            section.TrackPointCount = ReadInt16(25);
            section.StartPointIndex = ReadInt16(27);
            section.EndPointIndex   = ReadInt16(29);

            int offset = TrackHeaderLength;

            while (offset <= this.PacketLength - TrackPointLength)
            {
                TrackPoint point = new TrackPoint();
                point.Latitude     = (double)ReadLatLon(offset);
                point.Longitude    = (double)ReadLatLon(offset + 4);
                point.Altitude     = ReadInt16(offset + 8);
                point.Speed        = FromGlobSpeed(ReadInt16(offset + 10));
                point.HeartRate    = this.PacketData[offset + 12];
                point.IntervalTime = FromGlobTime(ReadInt16(offset + 13));
                section.TrackPoints.Add(point);
                offset += TrackPointLength;
            }
            return(section);
        }