Exemplo n.º 1
0
            private string readFieldData()
            {
                string str = "";

                localMsgDef = localMsgDefs[localMesgIndex];
                foreach (localField localField in localMsgDef.localFields)
                {
                    str = file.readValue(localField);
                    globalField globalField = localField.GlobalField;
                    if (globalField.foutMarge >= 0)
                    {
                        Int64 value = file.getLastValue();
                        if (file.isLastValueValid)
                        {
                            if (localField.lastGoodValue == Int64.MinValue)
                            {
                                localField.lastGoodValue = value;
                            }
                            else
                            if (Math.Abs(localField.lastGoodValue - value) > globalField.foutMarge)
                            {
                                return("");
                            }
                            else
                            {
                                localField.lastGoodValue = value;
                            }
                        }
                        else
                        {
                            if (globalField.name == "software_version" || globalField.name == "device_index") //verplicht veld
                            {
                                return("");
                            }
                        }
                    }

                    if (globalField.name == "timestamp")
                    {
                        str = FIT.timestampToLocalTime(UInt32.Parse(str));
                    }
                    recordString += ";" + str;
                    switch (globalField.name)
                    {
                    case "timestamp": timestamp = file._Uint32; break;

                    case "position_lat": position_lat = file._int32; break;

                    case "position_long": position_long = file._int32; break;

                    case "altitude": altitude = file._Uint16; break;

                    case "distance": distance = file._Uint32; break;

                    case "speed": speed = file._Uint16; break;

                    case "power": power = file._Uint16; break;

                    case "cadence": cadence = file._byte; break;

                    case "event": _event = file._enum; break;

                    case "event_type": _event_type = file._enum; break;
                    }
                }
                return(recordString);
            }
Exemplo n.º 2
0
        private void closeSession(StreamWriter outFile, localMsgDef[] localMsgDefs, UInt32 TravelEndTimestamp)//, DateTime dt, UInt32 start_position_lat, UInt32 start_position_long, UInt32 total_elapsed_time, UInt32 total_timer_time, UInt32 total_distance, UInt32 total_calories, UInt32 avg_speed, UInt32 max_speed, UInt32 avg_power, UInt32 max_power, UInt32 total_ascent, UInt32 total_descent, UInt32 avg_heart_rate, UInt32 max_heart_rate, UInt32 avg_cadence, UInt32 max_cadence)
        {
            int _event = 0;
            int i      = 0;

            for (i = 0; i < 16; i++)
            {
                if (localMsgDefs[i] == null)
                {
                    break;
                }
                if (localMsgDefs[i].globalMesgIndex == FIT.FIT_MESG_NUM_EVENT)
                {
                    _event = i;
                }
                if (localMsgDefs[i].globalMesgIndex == FIT.FIT_MESG_NUM_SESSION)
                {
                    return;
                }
            }
            outFile.WriteLine(string.Format("def;{0};0;0;18;31;253;4;134;2;4;134;3;4;133;4;4;133;7;4;134;8;4;134;9;4;134;10;4;134;29;4;133;30;4;133;31;4;133;32;4;133;254;2;132;11;2;132;13;2;132;14;2;132;15;2;132;20;2;132;21;2;132;22;2;132;23;2;132;25;2;132;26;2;132;0;1;0;1;1;0;5;1;0;6;1;0;16;1;2;17;1;2;18;1;2;19;1;2", i + 64));
            outFile.WriteLine(string.Format("data;{0};{1};708788214;627355257;56710458;6176,85;5831,27;52979,47;;;;;;0;997;;9,085;13,627;231;712;137;133;0;53;SESSION;STOP;CYCLING;255;154;180;76;116", i, FIT.timestampToLocalTime(TravelEndTimestamp)));
            outFile.WriteLine(string.Format("data;{0};{1};1;SESSION;STOP_DISABLE_ALL;1", _event, FIT.timestampToLocalTime(TravelEndTimestamp)));
            outFile.WriteLine(string.Format("def;{0};0;0;34;6;253;4;134;0;4;134;1;2;132;2;1;0;3;1;0;4;1;0", i + 1 + 64));
            outFile.WriteLine(string.Format("data;{0};{1};5831,27;1;0;ACTIVITY;STOP", i + 1, FIT.timestampToLocalTime(TravelEndTimestamp)));
        }