Example #1
0
        public static Dynastream.Fit.DateTime GetStartTime(this Mesg mesg)
        {
            Object val = mesg.GetFieldValue("StartTime");

            if (val == null)
            {
                return(null);
            }

            return(mesg.TimestampToDateTime(Convert.ToUInt32(val)));
        }
Example #2
0
        public static Dynastream.Fit.DateTime GetEndTime(this Mesg mesg)
        {
            var startTime = mesg.GetStartTime();

            if (startTime == null)
            {
                return(null);
            }

            Object val = mesg.GetFieldValue("TotalElapsedTime");

            if (val == null)
            {
                return(null);
            }

            startTime.Add(Convert.ToUInt32(val));
            return(startTime);
        }
Example #3
0
        private static void PrintField(Mesg mesg)
        {
            ushort activeSubfieldIndex;
            string name;
            string value;
            string units;

            //Loop through each field
            foreach (Field field in mesg.Fields)
            {
                if (mesg.GetFieldValue(field.Num) != null)
                {
                    //Set the name, value, and units to their standard values
                    name  = field.Name;
                    value = (field.GetValue()).ToString();
                    units = field.GetUnits();

                    //Checks if there is an active subfield and updates the name and units appropriately
                    activeSubfieldIndex = mesg.GetActiveSubFieldIndex(field.Num);
                    if (activeSubfieldIndex != Fit.SubfieldIndexMainField)
                    {
                        name  = field.GetName((byte)activeSubfieldIndex);
                        units = field.GetUnits((byte)activeSubfieldIndex);
                    }

                    //Checks if a field has multiple values and updates value appropriately
                    if (field.GetNumValues() > 1)
                    {
                        value = FieldArrayToString(field);
                    }

                    Console.Write("{0},{1},{2},", name, value, units);
                }
            }
            Console.WriteLine();
        }