diff --git a/.github/actions/publish-ui-dist/action.yaml b/.github/actions/publish-ui-dist/action.yaml
index f5433bfaf..7c9d34429 100644
--- a/.github/actions/publish-ui-dist/action.yaml
+++ b/.github/actions/publish-ui-dist/action.yaml
@@ -31,7 +31,8 @@ runs:
echo "BUILD_VERSION=$Env:GITHUB_RUN_NUMBER-$Env:GITHUB_RUN_ID" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "RUNNER_TOOL_CACHE=$Env:RUNNER_TOOL_CACHE" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
shell: pwsh
-
+
+ # dotnet publish src/ClientUI/ClientUI.csproj -c Release -f net7.0-windows10.0.19041.0 -p:RuntimeIdentifierOverride=win10-x64 -p:PublishSingleFile=true -p:SelfContained=true
- name: Publish ${{ inputs.os }}
run: dotnet publish ${{ github.workspace }}/src/ClientUI/ClientUI.csproj -c Release -f ${{ inputs.framework }} -p:RuntimeIdentifierOverride=${{ inputs.os }} -p:PublishSingleFile=true -p:SelfContained=true
shell: pwsh
diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml
index 9f744e6d1..5c70a54d3 100644
--- a/.github/workflows/pr-check.yml
+++ b/.github/workflows/pr-check.yml
@@ -42,7 +42,7 @@ jobs:
strategy:
matrix:
dotnet: [ '7.0.401' ]
- framework: ['net7.0-windows10.0.22621.0']
+ framework: ['net7.0-windows10.0.19041.0']
os: [ 'win10-x64' ]
steps:
diff --git a/.github/workflows/publish-latest.yaml b/.github/workflows/publish-latest.yaml
index 7dcac94ed..4d0a4b45b 100644
--- a/.github/workflows/publish-latest.yaml
+++ b/.github/workflows/publish-latest.yaml
@@ -45,7 +45,7 @@ jobs:
strategy:
matrix:
dotnet: [ '7.0.400' ]
- framework: ['net7.0-windows10.0.22621.0']
+ framework: ['net7.0-windows10.0.19041.0']
os: [ 'win10-x64' ]
steps:
diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml
index 6f02573f3..79811c06a 100644
--- a/.github/workflows/publish-release.yaml
+++ b/.github/workflows/publish-release.yaml
@@ -53,7 +53,7 @@ jobs:
strategy:
matrix:
dotnet: [ '7.0.400' ]
- framework: ['net7.0-windows10.0.22621.0']
+ framework: ['net7.0-windows10.0.19041.0']
os: [ 'win10-x64' ]
steps:
diff --git a/src/Api/Api.csproj b/src/Api/Api.csproj
index 5b9813ef8..33b270204 100644
--- a/src/Api/Api.csproj
+++ b/src/Api/Api.csproj
@@ -26,7 +26,7 @@
-
+
diff --git a/src/ClientUI/ClientUI.csproj b/src/ClientUI/ClientUI.csproj
index 86e56edc4..a297e2a1d 100644
--- a/src/ClientUI/ClientUI.csproj
+++ b/src/ClientUI/ClientUI.csproj
@@ -2,7 +2,7 @@
- $(TargetFrameworks);net7.0-windows10.0.22621.0
+ $(TargetFrameworks);net7.0-windows10.0.19041.0
Exe
@@ -60,14 +60,6 @@
-
-
-
-
- NU1603,NETSDK1023
-
-
-
diff --git a/src/Common/Common.csproj b/src/Common/Common.csproj
index de1b42be4..a32173bbb 100644
--- a/src/Common/Common.csproj
+++ b/src/Common/Common.csproj
@@ -8,26 +8,26 @@
-
+
-
-
-
+
+
+
-
+
-
+
-
-
-
-
+
+
+
+
diff --git a/src/ConsoleClient/ConsoleClient.csproj b/src/ConsoleClient/ConsoleClient.csproj
index f778d75ae..025ad9fbd 100644
--- a/src/ConsoleClient/ConsoleClient.csproj
+++ b/src/ConsoleClient/ConsoleClient.csproj
@@ -30,17 +30,15 @@
-
-
+
-
-
-
-
-
+
+
+
+
diff --git a/src/Conversion/Conversion.csproj b/src/Conversion/Conversion.csproj
index 44c2bcc47..247f685b8 100644
--- a/src/Conversion/Conversion.csproj
+++ b/src/Conversion/Conversion.csproj
@@ -6,6 +6,10 @@
$(NoWarn);1591
+
+
+
+
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/extensions.json b/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/extensions.json
deleted file mode 100644
index 180e233d1..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/extensions.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
- // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
-
- // List of extensions which should be recommended for users of this workspace.
- "recommendations": [
- "ms-dotnettools.csharp",
- "mechatroner.rainbow-csv"
- ],
- // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
- "unwantedRecommendations": [
-
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/launch.json b/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/launch.json
deleted file mode 100644
index 0f6f71f6d..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/launch.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- // Use IntelliSense to find out which attributes exist for C# debugging
- // Use hover for the description of the existing attributes
- // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
- "version": "0.2.0",
- "configurations": [
- {
- "name": ".NET Core Launch (console)",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "build",
- // If you have changed target frameworks, make sure to update the program path.
- "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/ActivityDecode.dll",
- "args": ["${workspaceFolder}/../../../examples/activity.fit"],
- "cwd": "${workspaceFolder}",
- // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
- "console": "internalConsole",
- "stopAtEntry": false
- },
- {
- "name": ".NET Core Attach",
- "type": "coreclr",
- "request": "attach",
- "processId": "${command:pickProcess}"
- }
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/tasks.json b/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/tasks.json
deleted file mode 100644
index 1df4bcb5f..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/.vscode/tasks.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "version": "2.0.0",
- "tasks": [
- {
- "label": "build",
- "command": "dotnet",
- "type": "process",
- "args": [
- "build",
- "${workspaceFolder}/ActivityDecode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "publish",
- "command": "dotnet",
- "type": "process",
- "args": [
- "publish",
- "${workspaceFolder}/ActivityDecode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "watch",
- "command": "dotnet",
- "type": "process",
- "args": [
- "watch",
- "run",
- "${workspaceFolder}/ActivityDecode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- }
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/ActivityDecode.csproj b/src/Garmin/FitSdk/Cookbook/ActivityDecode/ActivityDecode.csproj
deleted file mode 100644
index 4e1dba9cd..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/ActivityDecode.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Exe
- netcoreapp3.1
-
-
-
- ..\..\Dynastream.Fit.Portable.dll
-
-
-
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/ActivityParser.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/ActivityParser.cs
deleted file mode 100644
index c148d9327..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/ActivityParser.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Dynastream.Fit;
-using Extensions;
-
-public class ActivityParser
-{
- private FitMessages _messages;
- public bool IsActivityFile => _messages?.FileId != null ? (_messages?.FileId?.GetType() ?? File.Invalid) == File.Activity : false;
-
- public ActivityParser(FitMessages messages)
- {
- _messages = messages;
- }
-
- public List ParseSessions()
- {
- if (!IsActivityFile)
- {
- throw new Exception($"Expected FIT File Type: Activity, recieved File Type: {_messages?.FileId?.GetType()}");
- }
-
- // When there are no Sessions but there are Records create a Session message to recover as much data as possible
- if (_messages.Sessions.Count == 0 && _messages.Records.Count > 0)
- {
- Dynastream.Fit.DateTime startTime = _messages.Records[0].GetTimestamp();
- Dynastream.Fit.DateTime timestamp = _messages.Records[_messages.Records.Count - 1].GetTimestamp();
-
- var session = new SessionMesg();
- session.SetStartTime(startTime);
- session.SetTimestamp(timestamp);
- session.SetTotalElapsedTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
- session.SetTotalTimerTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
-
- _messages.Sessions.Add(session);
- }
-
- int recordsTaken = 0;
-
- var sessions = new List(_messages.Sessions.Count);
- foreach (SessionMesg sessionMesg in _messages.Sessions)
- {
- var session = new SessionMessages(sessionMesg)
- {
- Laps = _messages.Laps.Skip(sessionMesg.GetFirstLapIndex() ?? 0).Take(sessionMesg.GetNumLaps() ?? 0).ToList(),
-
- ClimbPros = _messages.ClimbPros.Where(climb => climb.Within(sessionMesg)).ToList(),
- Events = _messages.Events.Where(evt => evt.Within(sessionMesg)).ToList(),
- DeviceInfos = _messages.DeviceInfos.Where(deviceInfo => deviceInfo.Within(sessionMesg)).ToList(),
- Lengths = _messages.Lengths.Where(length => length.Overlaps(sessionMesg)).ToList(),
- Records = _messages.Records.Skip(recordsTaken).Where(record => record.Within(sessionMesg)).ToList(),
- SegmentLaps = _messages.SegmentLaps.Where(segmentLap => segmentLap.Overlaps(sessionMesg)).ToList(),
-
- TimerEvents = _messages.Events.Where(evt => evt.GetEvent() == Event.Timer && evt.Within(sessionMesg)).ToList(),
- FrontGearChangeEvents = _messages.Events.Where(evt => evt.GetEvent() == Event.FrontGearChange && evt.Within(sessionMesg)).ToList(),
- RearGearChangeEvents = _messages.Events.Where(evt => evt.GetEvent() == Event.RearGearChange && evt.Within(sessionMesg)).ToList(),
- RiderPositionChangeEvents = _messages.Events.Where(evt => evt.GetEvent() == Event.RiderPositionChange && evt.Within(sessionMesg)).ToList(),
-
- Activity = _messages.Activity,
- FileId = _messages.FileId,
- RecordFieldNames = _messages.RecordFieldNames,
- RecordDeveloperFieldNames = _messages.RecordDeveloperFieldNames,
- UserProfile = _messages.UserProfile,
- Workout = _messages.Workout,
- WorkoutSteps = _messages.WorkoutSteps,
- ZonesTarget = _messages.ZonesTarget,
- };
-
- recordsTaken += session.Records.Count;
- sessions.Add(session);
- }
-
- return sessions;
- }
-
- public List DevicesWhereBatteryStatusIsLow()
- {
- var batteryStatus = new List() { BatteryStatus.Critical, BatteryStatus.Low };
- var deviceInfos = new List();
-
- deviceInfos = _messages.DeviceInfos.Where(info => batteryStatus.Contains(info.GetBatteryStatus() ?? BatteryStatus.Unknown)).ToList();
- return deviceInfos;
- }
-}
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/Export.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/Export.cs
deleted file mode 100644
index 6753723c2..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/Export.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Dynastream.Fit;
-using Extensions;
-
-public class Export
-{
- private const string Unknown = "unknown";
- private const double MetersToYards = 1.09361;
- private const double DefaultPoolLength = 25.0;
-
- static public string RecordsToCSV(SessionMessages session)
- {
- var stringBuilder = new StringBuilder();
-
- // Add a comment row with: Sport Type, Sub Sport, Date/Time, Total Distance (meters), Calories, Duration (seconds)
- stringBuilder.AppendLine($"#Records,{session.Session.GetSport().ToString()},{session.Session.GetSubSport().ToString()},{session.Session.GetStartTime().GetDateTime().ToString("yyyy-MM-dd HH:mm:ss")},{session.Session.GetTotalDistance()},{session.Session.GetTotalCalories() ?? 0},{session.Session.GetTotalElapsedTime() ?? 0}");
-
- // Create the header row
- stringBuilder.Append("Seconds,");
- stringBuilder.Append($"{string.Join(",", session.RecordFieldNames)},");
-
- if (session.RecordDeveloperFieldNames.Count > 0)
- {
- stringBuilder.Append($"developerdata_{string.Join(",developerdata_", session.RecordDeveloperFieldNames).Replace(" ","_")},");
- }
-
- stringBuilder.Append("TimerEvent,Lap");
- stringBuilder.AppendLine();
-
- var lapQueue = new Queue(session.Laps);
- var lap = lapQueue.Count > 0 ? lapQueue.Dequeue() : null;
- var lapId = 1;
-
- uint firstTimeStamp = session.Records[0].GetTimestamp().GetTimeStamp();
-
- foreach (ExtendedRecordMesg record in session.Records)
- {
- while (lap != null && record.GetTimestamp().GetTimeStamp() > lap.GetTimestamp().GetTimeStamp())
- {
- lap = lapQueue.Count > 0 ? lapQueue.Dequeue() : null;
- lapId++;
- }
-
- stringBuilder.Append($"{record.GetTimestamp().GetTimeStamp() - firstTimeStamp},");
-
- foreach (string fieldName in session.RecordFieldNames)
- {
- var numFieldValues = record.GetNumFieldValues(fieldName);
- if (numFieldValues > 1)
- {
- for (int i = 0; i < numFieldValues; i++)
- {
- stringBuilder.Append($"{record.GetFieldValue(fieldName, i)}|");
- }
- stringBuilder.Length--;
- stringBuilder.Append($",");
- }
- else
- {
- stringBuilder.Append($"{record.GetFieldValue(fieldName)},");
- }
- }
-
- foreach (string devFieldName in session.RecordDeveloperFieldNames)
- {
- DeveloperField devField = record.DeveloperFields.Where(f => f.Name == devFieldName).FirstOrDefault();
- if (devField != null)
- {
- stringBuilder.Append($"{devField.GetValue(0)}");
- }
- stringBuilder.Append(",");
- }
-
- stringBuilder.Append($"{(record.EventType == EventType.Invalid ? "" : record.EventType.ToString())},");
- stringBuilder.Append($"{lapId}");
-
- stringBuilder.AppendLine();
- }
-
- return stringBuilder.ToString();
- }
-
- static public string LengthsToCSV(SessionMessages session)
- {
- var isMetric = session.Session.GetPoolLengthUnit() == DisplayMeasure.Metric;
- var unitConversion = isMetric ? 1.0 : MetersToYards;
- double poolLength = session.Session.GetPoolLength() ?? DefaultPoolLength;
- var poolLengthString = $"{Math.Round(poolLength * unitConversion)}";
- var totalDistance = Math.Round((session.Session.GetNumActiveLengths() ?? 0) * poolLength * unitConversion);
-
- var stringBuilder = new StringBuilder();
-
- // Add a comment row with: Sport Type, Sub Sport, Date/Time, Total Distance, Pool Length, Units, Calories, Duration (Seconds)
- stringBuilder.AppendLine($"#Lengths,{session.Session.GetSport().ToString()},{session.Session.GetSubSport().ToString()},{session.Session.GetStartTime().GetDateTime().ToString("yyyy-MM-dd HH:mm:ss")},{totalDistance},{poolLengthString},{(isMetric ? "meters" : "yards")},{session.Session.GetTotalCalories() ?? 0},{session.Session.GetTotalElapsedTime() ?? 0}");
-
- // Create the header row
- stringBuilder.AppendLine($"LENGTH TYPE,DURATION (seconds),DISTANCE ({(isMetric ? "meters" : "yards")}),PACE,STOKE COUNT,SWOLF,DPS,STROKE RATE,STROKE TYPE");
-
- foreach (LengthMesg length in session.Lengths)
- {
- var type = length.GetLengthType() ?? LengthType.Invalid;
- float elapsedTime = length.GetTotalElapsedTime() ?? 0;
- double speed = (length.GetAvgSpeed() ?? 0) * unitConversion;
- ushort? totalStrokes = length.GetTotalStrokes();
- var swolf = elapsedTime + (totalStrokes ?? 0);
- double? distancePerStroke = totalStrokes.HasValue ? Math.Round(poolLength * unitConversion / totalStrokes ?? 1, 2) : (double?)null;
-
- stringBuilder.Append($"{type.ToString()},");
- stringBuilder.Append($"{elapsedTime},");
- stringBuilder.Append($"{(type == LengthType.Active ? poolLengthString : "")},");
- stringBuilder.Append($"{(type == LengthType.Active ? Math.Round(speed, 2).ToString() : "")},");
- stringBuilder.Append($"{(type == LengthType.Active ? totalStrokes.ToString() : "")},");
- stringBuilder.Append($"{(type == LengthType.Active ? swolf.ToString() : "")},");
- stringBuilder.Append($"{(type == LengthType.Active ? distancePerStroke.ToString() : "")},");
- stringBuilder.Append($"{length.GetAvgSwimmingCadence().ToString() ?? ""},");
- stringBuilder.Append($"{length.GetSwimStroke().ToString() ?? ""}");
-
- stringBuilder.AppendLine();
- }
-
- return stringBuilder.ToString();
-
- }
-}
-
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/ExtendedRecordMesg.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/ExtendedRecordMesg.cs
deleted file mode 100644
index a39c9fe69..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/ExtendedRecordMesg.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using Dynastream.Fit;
-public class ExtendedRecordMesg : RecordMesg
-{
- public EventType EventType {get; private set;}
-
- public ExtendedRecordMesg(RecordMesg mesg) : base(mesg)
- {
- EventType = EventType.Invalid;
- }
-
- public ExtendedRecordMesg(EventMesg mesg)
- {
- SetTimestamp(mesg.GetTimestamp());
- EventType = mesg.GetEventType() ?? EventType.Invalid;
- }
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/Extensions.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/Extensions.cs
deleted file mode 100644
index 33765cf70..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/Extensions.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System;
-using System.Text;
-using Dynastream.Fit;
-
-namespace Extensions
-{
- public static class FitExtensions
- {
- public static System.DateTime FitEpoch = new System.DateTime(1989, 12, 31, 0, 0, 0, System.DateTimeKind.Utc);
- private const byte TimestampFieldId = 253;
-
- public static TimeSpan? TimezoneOffset(this ActivityMesg activity)
- {
- if (activity == null)
- {
- return null;
- }
-
- if (!activity.GetLocalTimestamp().HasValue)
- {
- return null;
- }
- return TimeSpan.FromSeconds((int)activity.GetLocalTimestamp() - (int)activity.GetTimestamp().GetTimeStamp());
- }
- public static System.DateTime LocalTimestampAsSystemDateTime(this ActivityMesg activity)
- {
- return new System.DateTime((long)(activity.GetLocalTimestamp() ?? 0) * 10000000L + FitEpoch.Ticks, DateTimeKind.Local);
- }
-
- public static Dynastream.Fit.DateTime LocalTimestampAsFitDateTime(this ActivityMesg activity)
- {
- return new Dynastream.Fit.DateTime(activity.GetLocalTimestamp() ?? 0);
- }
-
- public static Dynastream.Fit.DateTime GetTimestamp(this Mesg mesg)
- {
- Object val = mesg.GetFieldValue(TimestampFieldId);
- if (val == null)
- {
- return null;
- }
-
- return mesg.TimestampToDateTime(Convert.ToUInt32(val));
- }
-
- 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));
-
- }
- 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;
-
- }
-
- public static string GetValueAsString(this Mesg mesg, String name)
- {
- Field field = mesg.GetField(name, false);
- if(field == null)
- {
- return null;
- }
-
- byte[] data = (byte[])field.GetValue();
-
- return data != null ? Encoding.UTF8.GetString(data, 0, data.Length - 1) : null;
- }
-
- public static bool Overlaps(this Mesg mesg, SessionMesg session)
- {
- if(mesg.GetStartTime() == null || mesg.GetEndTime() == null || session.GetStartTime() == null || session.GetEndTime() == null)
- {
- return false;
- }
-
- return Math.Max(mesg.GetStartTime().GetTimeStamp(),session.GetStartTime().GetTimeStamp()) <=
- Math.Min(mesg.GetEndTime().GetTimeStamp(),session.GetEndTime().GetTimeStamp());
- }
-
- public static bool Within(this Mesg mesg, SessionMesg session)
- {
- if(mesg.GetTimestamp() == null || session.GetStartTime() == null || session.GetEndTime() == null)
- {
- return false;
- }
-
- return mesg.GetTimestamp().GetDateTime() >= session.GetStartTime().GetDateTime()
- && mesg.GetTimestamp().GetDateTime() <= session.GetEndTime().GetDateTime();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/FileTypeException.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/FileTypeException.cs
deleted file mode 100644
index 73e74bb67..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/FileTypeException.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System;
-
-public class FileTypeException : Exception
-{
- public FileTypeException()
- {
- }
-
- public FileTypeException(string message)
- : base(message)
- {
- }
-
- public FileTypeException(string message, Exception inner)
- : base(message, inner)
- {
- }
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/FitDecoder.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/FitDecoder.cs
deleted file mode 100644
index e707cac68..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/FitDecoder.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System.IO;
-
-using Dynastream.Fit;
-
-public class FitDecoder
-{
- public FitMessages Messages { get; private set; }
- private Stream inputStream;
- private Dynastream.Fit.File fileType;
-
- public FitDecoder(Stream stream, Dynastream.Fit.File fileType)
- {
- inputStream = stream;
- this.fileType = fileType;
-
- Messages = new FitMessages();
- }
-
- public bool Decode()
- {
- // Create the Decode Object
- Decode decoder = new Decode();
-
- // Check that this is a FIT file
- if (!decoder.IsFIT(inputStream))
- {
- throw new FileTypeException($"Expected FIT File Type: {fileType}, received a non FIT file.");
- }
-
- // Create the Message Broadcaster Object
- MesgBroadcaster mesgBroadcaster = new MesgBroadcaster();
-
- // Connect the the Decode and Message Broadcaster Objects
- decoder.MesgEvent += mesgBroadcaster.OnMesg;
- decoder.MesgDefinitionEvent += mesgBroadcaster.OnMesgDefinition;
- decoder.DeveloperFieldDescriptionEvent += OnDeveloperFieldDescriptionEvent;
-
- // Connect the Message Broadcaster Events to the Message Listener Delegates
- mesgBroadcaster.ActivityMesgEvent += OnActivityMesg;
- mesgBroadcaster.ClimbProMesgEvent += OnClimbProMesg;
- mesgBroadcaster.CourseMesgEvent += OnCourseMesg;
- mesgBroadcaster.CoursePointMesgEvent += OnCoursePointMesg;
- mesgBroadcaster.DeviceInfoMesgEvent += OnDeviceInfoMesg;
- mesgBroadcaster.EventMesgEvent += OnEventMesg;
- mesgBroadcaster.FileIdMesgEvent += OnFileIdMesg;
- mesgBroadcaster.HrMesgEvent += OnHrMesg;
- mesgBroadcaster.HrvMesgEvent += OnHrvMesg;
- mesgBroadcaster.LapMesgEvent += OnLapMesg;
- mesgBroadcaster.LengthMesgEvent += OnLengthMesg;
- mesgBroadcaster.RecordMesgEvent += OnRecordMesg;
- mesgBroadcaster.SegmentLapMesgEvent += OnSegmentLapMesg;
- mesgBroadcaster.SessionMesgEvent += OnSessionMesg;
- mesgBroadcaster.UserProfileMesgEvent += OnUserProfileMesg;
- mesgBroadcaster.WorkoutMesgEvent += OnWorkoutMesg;
- mesgBroadcaster.WorkoutStepMesgEvent += OnWorkoutStepMesg;
- mesgBroadcaster.ZonesTargetMesgEvent += OnZonesTargetMesg;
-
- // Decode the FIT File
- try
- {
- bool readOK = decoder.Read(inputStream);
-
- // If there are HR messages, merge the heart-rate data with the Record messages.
- if (readOK && Messages.HeartRates.Count > 0)
- {
- HrToRecordMesgWithoutPlugin.MergeHeartRates(Messages);
- }
-
- return readOK;
- }
- catch (FileTypeException ex)
- {
- throw (ex);
- }
- catch (FitException ex)
- {
- throw (ex);
- }
- catch (System.Exception ex)
- {
- throw (ex);
- }
- finally
- {
- }
- }
-
- public void OnActivityMesg(object sender, MesgEventArgs e)
- {
- Messages.Activity = (ActivityMesg)e.mesg;
- }
-
- public void OnClimbProMesg(object sender, MesgEventArgs e)
- {
- Messages.ClimbPros.Add(e.mesg as ClimbProMesg);
- }
-
- public void OnCourseMesg(object sender, MesgEventArgs e)
- {
- Messages.Course = (CourseMesg)e.mesg;
- }
-
- public void OnCoursePointMesg(object sender, MesgEventArgs e)
- {
- Messages.CoursePoints.Add(e.mesg as CoursePointMesg);
- }
-
- public void OnDeviceInfoMesg(object sender, MesgEventArgs e)
- {
- Messages.DeviceInfos.Add(e.mesg as DeviceInfoMesg);
- }
-
- public void OnEventMesg(object sender, MesgEventArgs e)
- {
- var eventMesg = e.mesg as EventMesg;
- Messages.Events.Add(eventMesg);
-
- if (eventMesg?.GetEvent() == Event.Timer && eventMesg?.GetTimestamp() != null)
- {
- Messages.Records.Add(new ExtendedRecordMesg(eventMesg));
- }
- }
-
- public void OnFileIdMesg(object sender, MesgEventArgs e)
- {
- Messages.FileId = (FileIdMesg)e.mesg;
- if ((e.mesg as FileIdMesg).GetType() != fileType)
- {
- throw new FileTypeException($"Expected FIT File Type: {fileType}, recieved File Type: {(e.mesg as FileIdMesg).GetType()}");
- }
- }
-
- public void OnHrMesg(object sender, MesgEventArgs e)
- {
- Messages.HeartRates.Add(e.mesg as HrMesg);
- }
-
- public void OnHrvMesg(object sender, MesgEventArgs e)
- {
- Messages.HeartRateVariabilites.Add(e.mesg as HrvMesg);
- }
-
- public void OnLapMesg(object sender, MesgEventArgs e)
- {
- Messages.Laps.Add(e.mesg as LapMesg);
- }
-
- public void OnLengthMesg(object sender, MesgEventArgs e)
- {
- Messages.Lengths.Add(e.mesg as LengthMesg);
- }
-
- public void OnRecordMesg(object sender, MesgEventArgs e)
- {
- Messages.Records.Add(new ExtendedRecordMesg(e.mesg as RecordMesg));
-
- foreach (Field field in e.mesg.Fields)
- {
- if (field.Name.ToLower() != "unknown")
- {
- Messages.RecordFieldNames.Add(field.Name);
- }
- }
-
- foreach (DeveloperField devField in e.mesg.DeveloperFields)
- {
- Messages.RecordDeveloperFieldNames.Add(devField.Name);
- }
- }
-
- public void OnSegmentLapMesg(object sender, MesgEventArgs e)
- {
- Messages.SegmentLaps.Add(e.mesg as SegmentLapMesg);
- }
-
- public void OnSessionMesg(object sender, MesgEventArgs e)
- {
- Messages.Sessions.Add(e.mesg as SessionMesg);
- }
-
- public void OnUserProfileMesg(object sender, MesgEventArgs e)
- {
- Messages.UserProfile = (UserProfileMesg)e.mesg;
- }
-
- public void OnWorkoutMesg(object sender, MesgEventArgs e)
- {
- Messages.Workout = (WorkoutMesg)e.mesg;
- }
-
- public void OnWorkoutStepMesg(object sender, MesgEventArgs e)
- {
- Messages.WorkoutSteps.Add(e.mesg as WorkoutStepMesg);
- }
-
- public void OnZonesTargetMesg(object sender, MesgEventArgs e)
- {
- Messages.ZonesTarget = (ZonesTargetMesg)e.mesg;
- }
-
- private void OnDeveloperFieldDescriptionEvent(object sender, DeveloperFieldDescriptionEventArgs e)
- {
- Messages.DeveloperFieldDescriptions.Add(e.Description as DeveloperFieldDescription);
- }
-}
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/FitMessages.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/FitMessages.cs
deleted file mode 100644
index b1521d8ff..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/FitMessages.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System.Collections.Generic;
-using Dynastream.Fit;
-
-public class FitMessages
-{
- public ActivityMesg Activity;
- public List ClimbPros = new List();
- public CourseMesg Course;
- public List CoursePoints = new List();
- public List DeviceInfos = new List();
- public List Events = new List();
- public FileIdMesg FileId;
- public List HeartRates = new List();
- public List HeartRateVariabilites = new List();
- public List Laps = new List();
- public List Lengths = new List();
- public List Records = new List();
- public List SegmentLaps = new List();
- public List Sessions = new List();
- public UserProfileMesg UserProfile;
- public WorkoutMesg Workout;
- public List WorkoutSteps = new List();
- public ZonesTargetMesg ZonesTarget;
- public List DeveloperFieldDescriptions = new List();
- public HashSet RecordFieldNames = new HashSet();
- public HashSet RecordDeveloperFieldNames = new HashSet();
-
- public FitMessages()
- {
- }
-}
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/HrToRecordMesgWithoutPlugin.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/HrToRecordMesgWithoutPlugin.cs
deleted file mode 100644
index a2d316ba1..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/HrToRecordMesgWithoutPlugin.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using Dynastream.Fit;
-
-public class HrToRecordMesgWithoutPlugin
-{
- public static void MergeHeartRates(FitMessages messages)
- {
- float? hr_anchor_event_timestamp = 0.0f;
- DateTime hr_anchor_timestamp = new DateTime(0);
- bool hr_anchor_set = false;
- byte? last_valid_hr = 0;
- DateTime last_valid_hr_time = new DateTime(0);
-
- DateTime record_range_start_time = new DateTime(messages.Records[0].GetTimestamp());
- int hr_start_index = 0;
- int hr_start_sub_index = 0;
-
- //
- // Update this foreach() to loop through just the Record messages
- //
- foreach (RecordMesg recordMesg in messages.Records)
- {
- long hrSum = 0;
- long hrSumCount = 0;
-
- // Obtain the time for which the record message is valid
- DateTime record_range_end_time = new DateTime(recordMesg.GetTimestamp());
-
- // Need to determine timestamp range which applies to this record
- bool findingInRangeHrMesgs = true;
-
- // Start searching HR mesgs where we left off
- int hr_mesg_counter = hr_start_index;
- int hr_sub_mesg_counter = hr_start_sub_index;
-
- //
- // Update this while() to loop through just the HR messages
- //
- while (findingInRangeHrMesgs && (hr_mesg_counter < messages.HeartRates.Count))
- {
- HrMesg hrMesg = new HrMesg(messages.HeartRates[hr_mesg_counter]);
-
- // Update HR timestamp anchor, if present
- if (hrMesg.GetTimestamp() != null && hrMesg.GetTimestamp().GetTimeStamp() != 0)
- {
- hr_anchor_timestamp = new DateTime(hrMesg.GetTimestamp());
- hr_anchor_set = true;
-
- if (hrMesg.GetFractionalTimestamp() != null)
- hr_anchor_timestamp.Add((double)hrMesg.GetFractionalTimestamp());
-
- if (hrMesg.GetNumEventTimestamp() == 1)
- {
- hr_anchor_event_timestamp = hrMesg.GetEventTimestamp(0);
- }
- else
- {
- throw new FitException("FIT HrToRecordMesgBroadcastPlugin Error: Anchor HR mesg must have 1 event_timestamp");
- }
- }
-
- if (hr_anchor_set == false)
- {
- // We cannot process any HR messages if we have not received a timestamp anchor
- throw new FitException("FIT HrToRecordMesgBroadcastPlugin Error: No anchor timestamp received in a HR mesg before diff HR mesgs");
- }
- else if (hrMesg.GetNumEventTimestamp() != hrMesg.GetNumFilteredBpm())
- {
- throw new FitException("FIT HrToRecordMesgBroadcastPlugin Error: HR mesg with mismatching event timestamp and filtered bpm");
- }
- for (int j = hr_sub_mesg_counter; j < hrMesg.GetNumEventTimestamp(); j++)
- {
- // Build up timestamp for each message using the anchor and event_timestamp
- DateTime hrMesgTime = new DateTime(hr_anchor_timestamp);
- float? event_timestamp = hrMesg.GetEventTimestamp(j);
-
- // Deal with roll over case
- if (event_timestamp < hr_anchor_event_timestamp)
- {
- if ((hr_anchor_event_timestamp - event_timestamp) > (1 << 21))
- {
- event_timestamp += (1 << 22);
- }
- else
- {
- throw new FitException("FIT HrToRecordMesgBroadcastPlugin Error: Anchor event_timestamp is greater than subsequent event_timestamp. This does not allow for correct delta calculation.");
- }
- }
- hrMesgTime.Add((double)(event_timestamp - hr_anchor_event_timestamp));
-
- // Check if hrMesgTime is gt record start time
- // and if hrMesgTime is lte to record end time
- if ((hrMesgTime.CompareTo(record_range_start_time) > 0) &&
- (hrMesgTime.CompareTo(record_range_end_time) <= 0))
- {
- hrSum += (long)hrMesg.GetFilteredBpm(j);
- hrSumCount++;
- last_valid_hr_time = new DateTime(hrMesgTime);
-
- }
- // check if hrMesgTime exceeds the record time
- else if (hrMesgTime.CompareTo(record_range_end_time) > 0)
- {
- // Remember where we left off
- hr_start_index = hr_mesg_counter;
- hr_start_sub_index = j;
- findingInRangeHrMesgs = false;
-
- if (hrSumCount > 0)
- {
- // Update record heart rate
- last_valid_hr = (byte?)System.Math.Round((((float)hrSum) / hrSumCount), System.MidpointRounding.AwayFromZero);
- recordMesg.SetHeartRate(last_valid_hr);
- messages.RecordFieldNames.Add("HeartRate");
- }
- // If no stored HR is available, fill in record messages with the
- // last valid filtered hr for a maximum of 5 seconds
- else if ((record_range_start_time.CompareTo(last_valid_hr_time) > 0) &&
- ((record_range_start_time.GetTimeStamp() - last_valid_hr_time.GetTimeStamp()) < 5))
- {
- recordMesg.SetHeartRate(last_valid_hr);
- messages.RecordFieldNames.Add("HeartRate");
- }
-
- // Reset HR average
- hrSum = 0;
- hrSumCount = 0;
-
- record_range_start_time = new DateTime(record_range_end_time);
-
- // Breaks out of looping within the event_timestamp array
- break;
- }
- }
-
- hr_mesg_counter++;
- hr_sub_mesg_counter = 0;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/Program.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/Program.cs
deleted file mode 100644
index 6130c0d7e..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/Program.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System;
-using System.IO;
-using Dynastream.Fit;
-using Extensions;
-
-namespace ActivityParse
-{
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("FIT Decode Example Application");
-
- if (args.Length != 1)
- {
- Console.WriteLine("Usage: decode.exe ");
- return;
- }
-
- try
- {
- // Attempt to open the input file
- FileStream fileStream = new FileStream(args[0], FileMode.Open);
- Console.WriteLine($"Opening {args[0]}");
-
- // Create our FIT Decoder
- FitDecoder fitDecoder = new FitDecoder(fileStream, Dynastream.Fit.File.Activity);
-
- // Decode the FIT file
- try
- {
- Console.WriteLine("Decoding...");
- fitDecoder.Decode();
- }
- catch (FileTypeException ex)
- {
- Console.WriteLine("DecodeDemo caught FileTypeException: " + ex.Message);
- return;
- }
- catch (FitException ex)
- {
- Console.WriteLine("DecodeDemo caught FitException: " + ex.Message);
- }
- catch (Exception ex)
- {
- Console.WriteLine("DecodeDemo caught Exception: " + ex.Message);
- }
- finally
- {
- fileStream.Close();
- }
-
- // Check the time zone offset in the Activity message.
- var timezoneOffset = fitDecoder.Messages.Activity.TimezoneOffset();
- Console.WriteLine($"The timezone offset for this activity file is {timezoneOffset?.TotalHours ?? 0} hours.");
-
- // Create the Activity Parser and group the messages into individual sessions.
- ActivityParser activityParser = new ActivityParser(fitDecoder.Messages);
- var sessions = activityParser.ParseSessions();
-
- // Export a CSV file for each Activity Session
- foreach (SessionMessages session in sessions)
- {
- if (session.Records.Count > 0)
- {
- var recordsCSV = Export.RecordsToCSV(session);
-
- var recordsPath = Path.Combine(Path.GetDirectoryName(args[0]), $"{Path.GetFileNameWithoutExtension(args[0])}_{session.Session.GetStartTime().GetDateTime().ToString("yyyyMMddHHmmss")}_{session.Session.GetSport()}_Records.csv");
-
- using (StreamWriter outputFile = new StreamWriter(recordsPath))
- {
- outputFile.WriteLine(recordsCSV);
- }
-
- Console.WriteLine($"The file {recordsPath} has been saved.");
- }
-
- if (session.Session.GetSport() == Sport.Swimming && session.Session.GetSubSport() == SubSport.LapSwimming && session.Lengths.Count > 0)
- {
- var lengthsCSV = Export.LengthsToCSV(session);
-
- var lengthsPath = Path.Combine(Path.GetDirectoryName(args[0]), $"{Path.GetFileNameWithoutExtension(args[0])}_{session.Session.GetStartTime().GetDateTime().ToString("yyyyMMddHHmmss")}_{session.Session.GetSport()}_Lengths.csv");
-
- using (StreamWriter outputFile = new StreamWriter(lengthsPath))
- {
- outputFile.WriteLine(lengthsCSV);
- }
-
- Console.WriteLine($"The file {lengthsPath} has been saved.");
- }
- }
-
- // How are the sensor batteries?
- var deviceInfos = activityParser.DevicesWhereBatteryStatusIsLow();
- foreach (DeviceInfoMesg info in deviceInfos)
- {
- Console.WriteLine($"Device Type {info.GetAntplusDeviceType()} has a low battery.");
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine($"Exception {ex}");
- }
- }
- }
-}
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityDecode/SessionMessages.cs b/src/Garmin/FitSdk/Cookbook/ActivityDecode/SessionMessages.cs
deleted file mode 100644
index 1f6610ce1..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityDecode/SessionMessages.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System.Collections.Generic;
-using Dynastream.Fit;
-
-public class SessionMessages
-{
- public ActivityMesg Activity;
- public List ClimbPros = new List();
- public List DeviceInfos = new List();
- public List Events = new List();
- public FileIdMesg FileId;
- public List Laps = new List();
- public List Lengths = new List();
- public List Records = new List();
- public HashSet RecordFieldNames = new HashSet();
- public HashSet RecordDeveloperFieldNames = new HashSet();
- public List SegmentLaps = new List();
- public SessionMesg Session;
- public UserProfileMesg UserProfile;
- public WorkoutMesg Workout;
- public List WorkoutSteps = new List();
- public ZonesTargetMesg ZonesTarget;
-
- public List TimerEvents = new List();
- public List FrontGearChangeEvents = new List();
- public List RearGearChangeEvents = new List();
- public List RiderPositionChangeEvents = new List();
-
- public SessionMessages(SessionMesg session)
- {
- Session = session;
- }
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/extensions.json b/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/extensions.json
deleted file mode 100644
index 8c76df3fe..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/extensions.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
- // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
-
- // List of extensions which should be recommended for users of this workspace.
- "recommendations": [
- "ms-dotnettools.csharp"
- ],
- // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
- "unwantedRecommendations": [
-
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/launch.json b/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/launch.json
deleted file mode 100644
index 0e9683a02..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/launch.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- // Use IntelliSense to find out which attributes exist for C# debugging
- // Use hover for the description of the existing attributes
- // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
- "version": "0.2.0",
- "configurations": [
- {
- "name": ".NET Core Launch (console)",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "build",
- // If you have changed target frameworks, make sure to update the program path.
- "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/ActivityEncode.dll",
- "args": [],
- "cwd": "${workspaceFolder}",
- // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
- "console": "internalConsole",
- "stopAtEntry": false
- },
- {
- "name": ".NET Core Attach",
- "type": "coreclr",
- "request": "attach",
- "processId": "${command:pickProcess}"
- }
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/tasks.json b/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/tasks.json
deleted file mode 100644
index 5c455a310..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityEncode/.vscode/tasks.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "version": "2.0.0",
- "tasks": [
- {
- "label": "build",
- "command": "dotnet",
- "type": "process",
- "args": [
- "build",
- "${workspaceFolder}/ActivityEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "publish",
- "command": "dotnet",
- "type": "process",
- "args": [
- "publish",
- "${workspaceFolder}/ActivityEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "watch",
- "command": "dotnet",
- "type": "process",
- "args": [
- "watch",
- "run",
- "${workspaceFolder}/ActivityEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- }
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityEncode/ActivityEncode.csproj b/src/Garmin/FitSdk/Cookbook/ActivityEncode/ActivityEncode.csproj
deleted file mode 100644
index 2700d3e31..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityEncode/ActivityEncode.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Exe
- netcoreapp3.1
-
-
-
- ..\..\Dynastream.Fit.Portable.dll
-
-
-
diff --git a/src/Garmin/FitSdk/Cookbook/ActivityEncode/Program.cs b/src/Garmin/FitSdk/Cookbook/ActivityEncode/Program.cs
deleted file mode 100644
index 48c4c2fe6..000000000
--- a/src/Garmin/FitSdk/Cookbook/ActivityEncode/Program.cs
+++ /dev/null
@@ -1,433 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Dynastream.Fit;
-
-namespace ActivityEncode
-{
- class Program
- {
- static void Main(string[] args)
- {
- CreateTimeBasedActivity();
- CreateLapSwimActivity();
- }
- static public void CreateTimeBasedActivity()
- {
- const double TwoPI = Math.PI * 2.0;
- const double SemicirclesPerMeter = 107.173;
- const string FileName = "ActivityEncodeRecipe.fit";
-
- var messages = new List();
-
- // The starting timestamp for the activity
- var startTime = new Dynastream.Fit.DateTime(System.DateTime.UtcNow);
-
- // Timer Events are a BEST PRACTICE for FIT ACTIVITY files
- var eventMesgStart = new EventMesg();
- eventMesgStart.SetTimestamp(startTime);
- eventMesgStart.SetEvent(Event.Timer);
- eventMesgStart.SetEventType(EventType.Start);
- messages.Add(eventMesgStart);
-
- // Create the Developer Id message for the developer data fields.
- var developerIdMesg = new DeveloperDataIdMesg();
- // It is a BEST PRACTICE to reuse the same Guid for all FIT files created by your platform
- byte[] appId = new Guid("00010203-0405-0607-0809-0A0B0C0D0E0F").ToByteArray();
- for (int i = 0; i < appId.Length; i++)
- {
- developerIdMesg.SetApplicationId(i, appId[i]);
- }
- developerIdMesg.SetDeveloperDataIndex(0);
- developerIdMesg.SetApplicationVersion(110);
- messages.Add(developerIdMesg);
-
- // Create the Developer Data Field Descriptions
- var doughnutsFieldDescMesg = new FieldDescriptionMesg();
- doughnutsFieldDescMesg.SetDeveloperDataIndex(0);
- doughnutsFieldDescMesg.SetFieldDefinitionNumber(0);
- doughnutsFieldDescMesg.SetFitBaseTypeId(FitBaseType.Float32);
- doughnutsFieldDescMesg.SetFieldName(0, "Doughnuts Earned");
- doughnutsFieldDescMesg.SetUnits(0, "doughnuts");
- doughnutsFieldDescMesg.SetNativeMesgNum(MesgNum.Session);
- messages.Add(doughnutsFieldDescMesg);
-
- FieldDescriptionMesg hrFieldDescMesg = new FieldDescriptionMesg();
- hrFieldDescMesg.SetDeveloperDataIndex(0);
- hrFieldDescMesg.SetFieldDefinitionNumber(1);
- hrFieldDescMesg.SetFitBaseTypeId(FitBaseType.Uint8);
- hrFieldDescMesg.SetFieldName(0, "Heart Rate");
- hrFieldDescMesg.SetUnits(0, "bpm");
- hrFieldDescMesg.SetNativeFieldNum(RecordMesg.FieldDefNum.HeartRate);
- hrFieldDescMesg.SetNativeMesgNum(MesgNum.Record);
- messages.Add(hrFieldDescMesg);
-
- // Every FIT ACTIVITY file MUST contain Record messages
- var timestamp = new Dynastream.Fit.DateTime(startTime);
-
- // Create one hour (3600 seconds) of Record data
- for (uint i = 0; i <= 3600; i++)
- {
- // Create a new Record message and set the timestamp
- var recordMesg = new RecordMesg();
- recordMesg.SetTimestamp(timestamp);
-
- // Fake Record Data of Various Signal Patterns
- recordMesg.SetDistance(i); // Ramp
- recordMesg.SetSpeed(1); // Flatline
- recordMesg.SetHeartRate((byte)((Math.Sin(TwoPI * (0.01 * i + 10)) + 1.0) * 127.0)); // Sine
- recordMesg.SetCadence((byte)(i % 255)); // Sawtooth
- recordMesg.SetPower((ushort)((i % 255) < 127 ? 150 : 250)); // Square
- recordMesg.SetAltitude((float)Math.Abs(((double)i % 255.0) - 127.0)); // Triangle
- recordMesg.SetPositionLat(0);
- recordMesg.SetPositionLong((int)Math.Round(i * SemicirclesPerMeter));
-
- // Add a Developer Field to the Record Message
- var hrDevField = new DeveloperField(hrFieldDescMesg, developerIdMesg);
- recordMesg.SetDeveloperField(hrDevField);
- hrDevField.SetValue((byte)((Math.Sin(TwoPI * (0.01 * i + 10)) + 1.0) * 127.0)); // Sine
-
- // Write the Rercord message to the output stream
- messages.Add(recordMesg);
-
- // Increment the timestamp by one second
- timestamp.Add(1);
- }
-
- // Timer Events are a BEST PRACTICE for FIT ACTIVITY files
- var eventMesgStop = new EventMesg();
- eventMesgStop.SetTimestamp(timestamp);
- eventMesgStop.SetEvent(Event.Timer);
- eventMesgStop.SetEventType(EventType.StopAll);
- messages.Add(eventMesgStop);
-
- // Every FIT ACTIVITY file MUST contain at least one Lap message
- var lapMesg = new LapMesg();
- lapMesg.SetMessageIndex(0);
- lapMesg.SetTimestamp(timestamp);
- lapMesg.SetStartTime(startTime);
- lapMesg.SetTotalElapsedTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
- lapMesg.SetTotalTimerTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
- messages.Add(lapMesg);
-
- // Every FIT ACTIVITY file MUST contain at least one Session message
- var sessionMesg = new SessionMesg();
- sessionMesg.SetMessageIndex(0);
- sessionMesg.SetTimestamp(timestamp);
- sessionMesg.SetStartTime(startTime);
- sessionMesg.SetTotalElapsedTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
- sessionMesg.SetTotalTimerTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
- sessionMesg.SetSport(Sport.StandUpPaddleboarding);
- sessionMesg.SetSubSport(SubSport.Generic);
- sessionMesg.SetFirstLapIndex(0);
- sessionMesg.SetNumLaps(1);
-
- // Add a Developer Field to the Session message
- var doughnutsEarnedDevField = new DeveloperField(doughnutsFieldDescMesg, developerIdMesg);
- doughnutsEarnedDevField.SetValue(sessionMesg.GetTotalElapsedTime() / 1200.0f);
- sessionMesg.SetDeveloperField(doughnutsEarnedDevField);
- messages.Add(sessionMesg);
-
- // Every FIT ACTIVITY file MUST contain EXACTLY one Activity message
- var activityMesg = new ActivityMesg();
- activityMesg.SetTimestamp(timestamp);
- activityMesg.SetNumSessions(1);
- var timezoneOffset = (int)TimeZoneInfo.Local.BaseUtcOffset.TotalSeconds;
- activityMesg.SetLocalTimestamp((uint)((int)timestamp.GetTimeStamp() + timezoneOffset));
- activityMesg.SetTotalTimerTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
- messages.Add(activityMesg);
-
- CreateActivityFile(messages, FileName, startTime);
-
- }
-
- static public void CreateLapSwimActivity()
- {
- // Example Swim Data representing a 500 yard pool swim using different strokes and drills.
- var swimData = new List>()
- {
- new Dictionary(){{"type", "Active"},{"duration",20U},{"stroke","Freestyle"},{"strokes",30U}},
- new Dictionary(){{"type", "Active"},{"duration",25U},{"stroke","Freestyle"},{"strokes",20U}},
- new Dictionary(){{"type", "Active"},{"duration",30U},{"stroke","Freestyle"},{"strokes",10U}},
- new Dictionary(){{"type", "Active"},{"duration",35U},{"stroke","Freestyle"},{"strokes",20U}},
- new Dictionary(){{"type", "Lap"}},
- new Dictionary(){{"type", "Idle"},{"duration",60U}},
- new Dictionary(){{"type", "Lap"}},
- new Dictionary(){{"type", "Active"},{"duration",20U},{"stroke","Backstroke"},{"strokes",30U}},
- new Dictionary(){{"type", "Active"},{"duration",25U},{"stroke","Backstroke"},{"strokes",20U}},
- new Dictionary(){{"type", "Active"},{"duration",30U},{"stroke","Backstroke"},{"strokes",10U}},
- new Dictionary(){{"type", "Active"},{"duration",35U},{"stroke","Backstroke"},{"strokes",20U}},
- new Dictionary(){{"type", "Lap"}},
- new Dictionary(){{"type", "Idle"},{"duration",60U}},
- new Dictionary(){{"type", "Lap"}},
- new Dictionary(){{"type", "Active"},{"duration",20U},{"stroke","Breaststroke"},{"strokes",30U}},
- new Dictionary(){{"type", "Active"},{"duration",25U},{"stroke","Breaststroke"},{"strokes",20U}},
- new Dictionary(){{"type", "Active"},{"duration",30U},{"stroke","Breaststroke"},{"strokes",10U}},
- new Dictionary(){{"type", "Active"},{"duration",35U},{"stroke","Breaststroke"},{"strokes",20U}},
- new Dictionary(){{"type", "Lap"}},
- new Dictionary(){{"type", "Idle"},{"duration",60U}},
- new Dictionary(){{"type", "Lap"}},
- new Dictionary(){{"type", "Active"},{"duration",20U},{"stroke","Butterfly"},{"strokes",30U}},
- new Dictionary(){{"type", "Active"},{"duration",25U},{"stroke","Butterfly"},{"strokes",20U}},
- new Dictionary(){{"type", "Active"},{"duration",30U},{"stroke","Butterfly"},{"strokes",10U}},
- new Dictionary(){{"type", "Active"},{"duration",35U},{"stroke","Butterfly"},{"strokes",20U}},
- new Dictionary(){{"type", "Lap"}},
- new Dictionary(){{"type", "Idle"},{"duration",60U}},
- new Dictionary(){{"type", "Lap"}},
- new Dictionary(){{"type", "Active"},{"duration",40U},{"stroke","Drill"}},
- new Dictionary(){{"type", "Active"},{"duration",40U},{"stroke","Drill"}},
- new Dictionary(){{"type", "Active"},{"duration",40U},{"stroke","Drill"}},
- new Dictionary(){{"type", "Active"},{"duration",40U},{"stroke","Drill"}},
- new Dictionary(){{"type", "Lap"}},
- };
-
- const string FileName = "ActivityEncodeRecipeLapSwim.fit";
- var messages = new List();
-
- // The starting timestamp for the activity
- var startTime = new Dynastream.Fit.DateTime(System.DateTime.UtcNow);
-
-
- // Timer Events are a BEST PRACTICE for FIT ACTIVITY files
- var eventMesgStart = new EventMesg();
- eventMesgStart.SetTimestamp(startTime);
- eventMesgStart.SetEvent(Event.Timer);
- eventMesgStart.SetEventType(EventType.Start);
- messages.Add(eventMesgStart);
-
- //
- // Create a Length or Lap message for each item in the sample swim data. Calculate
- // distance, duration, and stroke count for each lap and the overall session.
- //
-
- // Session Accumulators
- uint sessionTotalElapsedTime = 0;
- float sessionDistance = 0;
- ushort sessionNumLengths = 0;
- ushort sessionNumActiveLengths = 0;
- ushort sessionTotalStrokes = 0;
- ushort sessionNumLaps = 0;
-
- // Lap accumulators
- uint lapTotalElapsedTime = 0;
- float lapDistance = 0;
- ushort lapNumActiveLengths = 0;
- ushort lapNumLengths = 0;
- ushort lapFirstLengthIndex = 0;
- ushort lapTotalStrokes = 0;
- var lapStartTime = new Dynastream.Fit.DateTime(startTime);
-
- var poolLength = 22.86f;
- var poolLengthUnit = DisplayMeasure.Statute;
- var timestamp = new Dynastream.Fit.DateTime(startTime);
- ushort messageIndex = 0;
-
- foreach (var swimLength in swimData)
- {
- string type = (string)swimLength["type"];
-
- if (type.Equals("Lap"))
- {
- // Create a Lap message, set its fields, and write it to the file
- var lapMesg = new LapMesg();
- lapMesg.SetMessageIndex(sessionNumLaps);
- lapMesg.SetTimestamp(timestamp);
- lapMesg.SetStartTime(lapStartTime);
- lapMesg.SetTotalElapsedTime(lapTotalElapsedTime);
- lapMesg.SetTotalTimerTime(lapTotalElapsedTime);
- lapMesg.SetTotalDistance(lapDistance);
- lapMesg.SetFirstLengthIndex(lapFirstLengthIndex);
- lapMesg.SetNumActiveLengths(lapNumActiveLengths);
- lapMesg.SetNumLengths(lapNumLengths);
- lapMesg.SetTotalStrokes(lapTotalStrokes);
- lapMesg.SetAvgStrokeDistance(lapDistance / lapTotalStrokes);
- lapMesg.SetSport(Sport.Swimming);
- lapMesg.SetSubSport(SubSport.LapSwimming);
- messages.Add(lapMesg);
-
- sessionNumLaps++;
-
- // Reset the Lap accumulators
- lapFirstLengthIndex = messageIndex;
- lapNumActiveLengths = 0;
- lapNumLengths = 0;
- lapTotalElapsedTime = 0;
- lapDistance = 0;
- lapTotalStrokes = 0;
- lapStartTime = new Dynastream.Fit.DateTime(timestamp);
- }
- else
- {
- uint duration = (uint)swimLength["duration"];
- var lengthType = (LengthType)Enum.Parse(typeof(LengthType), type);
-
- // Create a Length message and its fields
- var lengthMesg = new LengthMesg();
- lengthMesg.SetMessageIndex(messageIndex++);
- lengthMesg.SetStartTime(timestamp);
- lengthMesg.SetTotalElapsedTime(duration);
- lengthMesg.SetTotalTimerTime(duration);
- lengthMesg.SetLengthType(lengthType);
-
- timestamp.Add(duration);
- lengthMesg.SetTimestamp(timestamp);
-
- // Create the Record message that pairs with the Length Message
- var recordMesg = new RecordMesg();
- recordMesg.SetTimestamp(timestamp);
- recordMesg.SetDistance(sessionDistance + poolLength);
-
- // Is this an Active Length?
- if (lengthType == LengthType.Active)
- {
- // Get the Active data from the model
- string stroke = swimLength.ContainsKey("stroke") ? (String)swimLength["stroke"] : "Freestyle";
- uint strokes = swimLength.ContainsKey("strokes") ? (uint)swimLength["strokes"] : 0;
- SwimStroke swimStroke = (SwimStroke)Enum.Parse(typeof(SwimStroke), stroke);
-
- // Set the Active data on the Length Message
- lengthMesg.SetAvgSpeed(poolLength / (float)duration);
- lengthMesg.SetSwimStroke(swimStroke);
-
- if (strokes > 0)
- {
- lengthMesg.SetTotalStrokes((ushort)strokes);
- lengthMesg.SetAvgSwimmingCadence((byte)(strokes * 60U / duration));
- }
-
- // Set the Active data on the Record Message
- recordMesg.SetSpeed(poolLength / (float)duration);
- if (strokes > 0)
- {
- recordMesg.SetCadence((byte)((strokes * 60U) / duration));
- }
-
- // Increment the "Active" accumulators
- sessionNumActiveLengths++;
- lapNumActiveLengths++;
- sessionDistance += poolLength;
- lapDistance += poolLength;
- sessionTotalStrokes += (ushort)strokes;
- lapTotalStrokes += (ushort)strokes;
- }
-
- // Write the messages to the file
- messages.Add(recordMesg);
- messages.Add(lengthMesg);
-
- // Increment the "Total" accumulators
- sessionTotalElapsedTime += duration;
- lapTotalElapsedTime += duration;
- sessionNumLengths++;
- lapNumLengths++;
- }
- }
-
- // Timer Events are a BEST PRACTICE for FIT ACTIVITY files
- var eventMesgStop = new EventMesg();
- eventMesgStop.SetTimestamp(timestamp);
- eventMesgStop.SetEvent(Event.Timer);
- eventMesgStop.SetEventType(EventType.StopAll);
- messages.Add(eventMesgStop);
-
- // Every FIT ACTIVITY file MUST contain at least one Session message
- var sessionMesg = new SessionMesg();
- sessionMesg.SetMessageIndex(0);
- sessionMesg.SetTimestamp(timestamp);
- sessionMesg.SetStartTime(startTime);
- sessionMesg.SetTotalElapsedTime(sessionTotalElapsedTime);
- sessionMesg.SetTotalTimerTime(sessionTotalElapsedTime);
- sessionMesg.SetTotalDistance(sessionDistance);
- sessionMesg.SetSport(Sport.Swimming);
- sessionMesg.SetSubSport(SubSport.LapSwimming);
- sessionMesg.SetFirstLapIndex(0);
- sessionMesg.SetNumLaps(sessionNumLaps);
- sessionMesg.SetPoolLength(poolLength);
- sessionMesg.SetPoolLengthUnit(poolLengthUnit);
- sessionMesg.SetNumLengths(sessionNumLengths);
- sessionMesg.SetNumActiveLengths(sessionNumActiveLengths);
- sessionMesg.SetTotalStrokes(sessionTotalStrokes);
- sessionMesg.SetAvgStrokeDistance(sessionDistance / sessionTotalStrokes);
- messages.Add(sessionMesg);
-
- // Every FIT ACTIVITY file MUST contain EXACTLY one Activity message
- var activityMesg = new ActivityMesg();
- activityMesg.SetTimestamp(timestamp);
- activityMesg.SetNumSessions(1);
- var timezoneOffset = (int)TimeZoneInfo.Local.BaseUtcOffset.TotalSeconds;
- activityMesg.SetLocalTimestamp((uint)((int)timestamp.GetTimeStamp() + timezoneOffset));
- activityMesg.SetTotalTimerTime(sessionTotalElapsedTime);
- messages.Add(activityMesg);
-
- CreateActivityFile(messages, FileName, startTime);
- }
-
- static void CreateActivityFile(List messages, String filename, Dynastream.Fit.DateTime startTime)
- {
- // The combination of file type, manufacturer id, product id, and serial number should be unique.
- // When available, a non-random serial number should be used.
- Dynastream.Fit.File fileType = Dynastream.Fit.File.Activity;
- ushort manufacturerId = Manufacturer.Development;
- ushort productId = 0;
- float softwareVersion = 1.0f;
-
- Random random = new Random();
- uint serialNumber = (uint)random.Next();
-
- // Every FIT file MUST contain a File ID message
- var fileIdMesg = new FileIdMesg();
- fileIdMesg.SetType(fileType);
- fileIdMesg.SetManufacturer(manufacturerId);
- fileIdMesg.SetProduct(productId);
- fileIdMesg.SetTimeCreated(startTime);
- fileIdMesg.SetSerialNumber(serialNumber);
-
- // A Device Info message is a BEST PRACTICE for FIT ACTIVITY files
- var deviceInfoMesg = new DeviceInfoMesg();
- deviceInfoMesg.SetDeviceIndex(DeviceIndex.Creator);
- deviceInfoMesg.SetManufacturer(Manufacturer.Development);
- deviceInfoMesg.SetProduct(productId);
- deviceInfoMesg.SetProductName("FIT Cookbook"); // Max 20 Chars
- deviceInfoMesg.SetSerialNumber(serialNumber);
- deviceInfoMesg.SetSoftwareVersion(softwareVersion);
- deviceInfoMesg.SetTimestamp(startTime);
-
- // Create the output stream, this can be any type of stream, including a file or memory stream. Must have read/write access
- FileStream fitDest = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
-
- // Create a FIT Encode object
- Encode encoder = new Encode(ProtocolVersion.V20);
-
- // Write the FIT header to the output stream
- encoder.Open(fitDest);
-
- // Write the messages to the file, in the proper sequence
- encoder.Write(fileIdMesg);
- encoder.Write(deviceInfoMesg);
-
- foreach (Mesg message in messages)
- {
- encoder.Write(message);
- }
-
- // Update the data size in the header and calculate the CRC
- encoder.Close();
-
- // Close the output stream
- fitDest.Close();
-
- Console.WriteLine($"Encoded FIT file {fitDest.Name}");
- }
- }
-}
diff --git a/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/extensions.json b/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/extensions.json
deleted file mode 100644
index 2ec794d54..000000000
--- a/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/extensions.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
- // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
-
- // List of extensions which should be recommended for users of this workspace.
- "recommendations": [
- "ms-dotnettools.csharp",
- ],
- // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
- "unwantedRecommendations": [
-
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/launch.json b/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/launch.json
deleted file mode 100644
index 3332041bc..000000000
--- a/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/launch.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- // Use IntelliSense to find out which attributes exist for C# debugging
- // Use hover for the description of the existing attributes
- // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
- "version": "0.2.0",
- "configurations": [
- {
- "name": ".NET Core Launch (console)",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "build",
- // If you have changed target frameworks, make sure to update the program path.
- "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/CourseEncode.dll",
- "args": [],
- "cwd": "${workspaceFolder}",
- // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
- "console": "internalConsole",
- "stopAtEntry": false
- },
- {
- "name": ".NET Core Attach",
- "type": "coreclr",
- "request": "attach",
- "processId": "${command:pickProcess}"
- }
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/tasks.json b/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/tasks.json
deleted file mode 100644
index e791fefee..000000000
--- a/src/Garmin/FitSdk/Cookbook/CourseEncode/.vscode/tasks.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "version": "2.0.0",
- "tasks": [
- {
- "label": "build",
- "command": "dotnet",
- "type": "process",
- "args": [
- "build",
- "${workspaceFolder}/CourseEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "publish",
- "command": "dotnet",
- "type": "process",
- "args": [
- "publish",
- "${workspaceFolder}/CourseEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "watch",
- "command": "dotnet",
- "type": "process",
- "args": [
- "watch",
- "run",
- "${workspaceFolder}/CourseEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- }
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/CourseEncode/CourseEncode.csproj b/src/Garmin/FitSdk/Cookbook/CourseEncode/CourseEncode.csproj
deleted file mode 100644
index 795570060..000000000
--- a/src/Garmin/FitSdk/Cookbook/CourseEncode/CourseEncode.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Exe
- netcoreapp3.1
-
-
-
- ..\..\Dynastream.Fit.Portable.dll
-
-
-
diff --git a/src/Garmin/FitSdk/Cookbook/CourseEncode/Program.cs b/src/Garmin/FitSdk/Cookbook/CourseEncode/Program.cs
deleted file mode 100644
index 3fe7e7956..000000000
--- a/src/Garmin/FitSdk/Cookbook/CourseEncode/Program.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Dynastream.Fit;
-
-namespace CourseEncode
-{
- class Program
- {
- public const ushort ProductId = 0;
-
- static void Main(string[] args)
- {
- EncodeCourse();
- }
-
- public static void EncodeCourse()
- {
- const string filename = "CourseEncodeRecipe.fit";
-
- // Example Record Data Defining a Course
- var courseData = new List>()
- {
- new Dictionary(){{"timestamp",961262849U},{"position_lat",463583114},{"position_long",-1131028903},{"altitude",329f},{"distance",0f},{"speed",0f}},
- new Dictionary(){{"timestamp",961262855U},{"position_lat",463583127},{"position_long",-1131031938},{"altitude",328.6f},{"distance",22.03f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262869U},{"position_lat",463583152},{"position_long",-1131038159},{"altitude",327.6f},{"distance",67.29f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262876U},{"position_lat",463583164},{"position_long",-1131041346},{"altitude",327f},{"distance",90.52f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262876U},{"position_lat",463583164},{"position_long",-1131041319},{"altitude",327f},{"distance",90.72f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262891U},{"position_lat",463588537},{"position_long",-1131041383},{"altitude",327f},{"distance",140.72f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262891U},{"position_lat",463588549},{"position_long",-1131041383},{"altitude",327f},{"distance",140.82f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262897U},{"position_lat",463588537},{"position_long",-1131038293},{"altitude",327.6f},{"distance",163.26f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262911U},{"position_lat",463588512},{"position_long",-1131032041},{"altitude",328.4f},{"distance",208.75f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262918U},{"position_lat",463588499},{"position_long",-1131028879},{"altitude",329f},{"distance",231.8f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262918U},{"position_lat",463588499},{"position_long",-1131028903},{"altitude",329f},{"distance",231.97f},{"speed",3.0f}},
- new Dictionary(){{"timestamp",961262933U},{"position_lat",463583127},{"position_long",-1131028903},{"altitude",329f},{"distance",281.96f},{"speed",3.0f}},
- };
-
- // Create the output stream, this can be any type of stream, including a file or memory stream. Must have read/write access.
- FileStream fitDest = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
-
- // Create a FIT Encode object
- Encode encoder = new Encode(ProtocolVersion.V10);
-
- // Write the FIT header to the output stream
- encoder.Open(fitDest);
-
- // Reference points for the course
- var firstRecord = courseData[0];
- var lastRecord = courseData[courseData.Count - 1];
- var halfwayRecord = courseData[courseData.Count / 2];
- var startTimestamp = (uint)firstRecord["timestamp"];
- var endTimestamp = (uint)lastRecord["timestamp"];
- var startDateTime = new Dynastream.Fit.DateTime(startTimestamp);
- var endDateTime = new Dynastream.Fit.DateTime(endTimestamp);
-
- // Every FIT file MUST contain a File ID message
- var fileIdMesg = new FileIdMesg();
- fileIdMesg.SetType(Dynastream.Fit.File.Course);
- fileIdMesg.SetManufacturer(Manufacturer.Development);
- fileIdMesg.SetProduct(ProductId);
- fileIdMesg.SetTimeCreated(startDateTime);
- fileIdMesg.SetSerialNumber(startDateTime.GetTimeStamp());
- encoder.Write(fileIdMesg);
-
- // Every FIT file MUST contain a Course message
- var courseMesg = new CourseMesg();
- courseMesg.SetName("Garmin Field Day");
- courseMesg.SetSport(Sport.Cycling);
- encoder.Write(courseMesg);
-
- // Every FIT COURSE file MUST contain a Lap message
- var lapMesg = new LapMesg();
- lapMesg.SetStartTime(startDateTime);
- lapMesg.SetTimestamp(startDateTime);
- lapMesg.SetTotalElapsedTime(endTimestamp - startTimestamp);
- lapMesg.SetTotalTimerTime(endTimestamp - startTimestamp);
- lapMesg.SetStartPositionLat((int)firstRecord["position_lat"]);
- lapMesg.SetStartPositionLong((int)firstRecord["position_long"]);
- lapMesg.SetEndPositionLat((int)lastRecord["position_lat"]);
- lapMesg.SetEndPositionLong((int)lastRecord["position_long"]);
- lapMesg.SetTotalDistance((float)lastRecord["distance"]);
- encoder.Write(lapMesg);
-
- // Timer Events are REQUIRED for FIT COURSE files
- var eventMesgStart = new EventMesg();
- eventMesgStart.SetTimestamp(startDateTime);
- eventMesgStart.SetEvent(Event.Timer);
- eventMesgStart.SetEventType(EventType.Start);
- encoder.Write(eventMesgStart);
-
- // Every FIT COURSE file MUST contain Record messages
- foreach (var record in courseData)
- {
- var timestamp = (uint)record["timestamp"];
- var latitude = (int)record["position_lat"];
- var longitude = (int)record["position_long"];
- var distance = (float)record["distance"];
- var speed = (float)record["speed"];
- var altitude = (float)record["altitude"];
-
- var recordMesg = new RecordMesg();
- recordMesg.SetTimestamp(new Dynastream.Fit.DateTime(timestamp));
- recordMesg.SetPositionLat(latitude);
- recordMesg.SetPositionLong(longitude);
- recordMesg.SetDistance(distance);
- recordMesg.SetSpeed(speed);
- recordMesg.SetAltitude(altitude);
- encoder.Write(recordMesg);
-
- // Add a Course Point at the halfway point of the route
- if (record == halfwayRecord)
- {
- var coursePointMesg = new CoursePointMesg();
- coursePointMesg.SetTimestamp(new Dynastream.Fit.DateTime(timestamp));
- coursePointMesg.SetName("Halfway");
- coursePointMesg.SetType(CoursePoint.Generic);
- coursePointMesg.SetPositionLat(latitude);
- coursePointMesg.SetPositionLong(longitude);
- coursePointMesg.SetDistance(distance);
- encoder.Write(coursePointMesg);
- }
- }
-
- // Timer Events are REQUIRED for FIT COURSE files
- var eventMesgStop = new EventMesg();
- eventMesgStop.SetTimestamp(endDateTime);
- eventMesgStop.SetEvent(Event.Timer);
- eventMesgStop.SetEventType(EventType.StopAll);
- encoder.Write(eventMesgStop);
-
- // Update the data size in the header and calculate the CRC
- encoder.Close();
-
- // Close the output stream
- fitDest.Close();
-
- Console.WriteLine($"Encoded FIT file {fitDest.Name}");
- }
- }
-}
diff --git a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/extensions.json b/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/extensions.json
deleted file mode 100644
index 8c76df3fe..000000000
--- a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/extensions.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
- // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
-
- // List of extensions which should be recommended for users of this workspace.
- "recommendations": [
- "ms-dotnettools.csharp"
- ],
- // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
- "unwantedRecommendations": [
-
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/launch.json b/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/launch.json
deleted file mode 100644
index 7ffbbcc81..000000000
--- a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/launch.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- // Use IntelliSense to find out which attributes exist for C# debugging
- // Use hover for the description of the existing attributes
- // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
- "version": "0.2.0",
- "configurations": [
- {
- "name": ".NET Core Launch (console)",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "build",
- // If you have changed target frameworks, make sure to update the program path.
- "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/WorkoutEncode.dll",
- "args": [],
- "cwd": "${workspaceFolder}",
- // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
- "console": "internalConsole",
- "stopAtEntry": false
- },
- {
- "name": ".NET Core Attach",
- "type": "coreclr",
- "request": "attach",
- "processId": "${command:pickProcess}"
- }
- ]
- }
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/tasks.json b/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/tasks.json
deleted file mode 100644
index b21e0977e..000000000
--- a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/.vscode/tasks.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "version": "2.0.0",
- "tasks": [
- {
- "label": "build",
- "command": "dotnet",
- "type": "process",
- "args": [
- "build",
- "${workspaceFolder}/WorkoutEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "publish",
- "command": "dotnet",
- "type": "process",
- "args": [
- "publish",
- "${workspaceFolder}/WorkoutEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- },
- {
- "label": "watch",
- "command": "dotnet",
- "type": "process",
- "args": [
- "watch",
- "run",
- "${workspaceFolder}/WorkoutEncode.csproj",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "problemMatcher": "$msCompile"
- }
- ]
-}
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/Program.cs b/src/Garmin/FitSdk/Cookbook/WorkoutEncode/Program.cs
deleted file mode 100644
index 5bbb8dfd7..000000000
--- a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/Program.cs
+++ /dev/null
@@ -1,339 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// The following FIT Protocol software provided may be used with FIT protocol
-// devices only and remains the copyrighted property of Garmin Canada Inc.
-// The software is being provided on an "as-is" basis and as an accommodation,
-// and therefore all warranties, representations, or guarantees of any kind
-// (whether express, implied or statutory) including, without limitation,
-// warranties of merchantability, non-infringement, or fitness for a particular
-// purpose, are specifically disclaimed.
-//
-// Copyright 2020 Garmin International, Inc.
-////////////////////////////////////////////////////////////////////////////////
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Dynastream.Fit;
-
-namespace WorkoutEncode
-{
- class Program
- {
- static void Main(string[] args)
- {
- CreateBikeTempoWorkout();
- CreateRun800RepeatsWorkout();
- CreateCustomTargetValuesWorkout();
- CreatePoolSwimWorkout();
- }
-
- static void CreateBikeTempoWorkout()
- {
- var workoutSteps = new List();
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Time,
- durationValue: 600000, // milliseconds
- targetType: WktStepTarget.HeartRate,
- targetValue: 1,
- intensity: Intensity.Warmup));
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Time,
- durationValue: 2400000, // milliseconds
- targetType: WktStepTarget.Power,
- targetValue: 3));
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- intensity: Intensity.Cooldown));
-
- var workoutMesg = new WorkoutMesg();
- workoutMesg.SetWktName("Tempo Bike");
- workoutMesg.SetSport(Sport.Cycling);
- workoutMesg.SetSubSport(SubSport.Invalid);
- workoutMesg.SetNumValidSteps((ushort)workoutSteps.Count);
-
- CreateWorkout(workoutMesg, workoutSteps);
- }
-
-
- static void CreateRun800RepeatsWorkout()
- {
- var workoutSteps = new List();
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Distance,
- durationValue: 400000, // centimeters
- targetType: WktStepTarget.HeartRate,
- targetValue: 1,
- intensity: Intensity.Warmup));
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Distance,
- durationValue: 80000, // centimeters
- targetType: WktStepTarget.HeartRate,
- targetValue: 4));
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Distance,
- durationValue: 20000, // centimeters
- targetType: WktStepTarget.HeartRate,
- targetValue: 2,
- intensity: Intensity.Rest));
-
- workoutSteps.Add(CreateWorkoutStepRepeat(messageIndex: workoutSteps.Count, repeatFrom: 1, repetitions: 5));
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Distance,
- durationValue: 100000, // centimeters
- targetType: WktStepTarget.HeartRate,
- targetValue: 2,
- intensity: Intensity.Cooldown));
-
- var workoutMesg = new WorkoutMesg();
- workoutMesg.SetWktName("Running 800m Repeats");
- workoutMesg.SetSport(Sport.Running);
- workoutMesg.SetSubSport(SubSport.Invalid);
- workoutMesg.SetNumValidSteps((ushort)workoutSteps.Count);
-
- CreateWorkout(workoutMesg, workoutSteps);
- }
-
- static void CreateCustomTargetValuesWorkout()
- {
- var workoutSteps = new List();
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Time,
- durationValue: 600000, // milliseconds
- targetType: WktStepTarget.HeartRate,
- customTargetValueLow: 235, // 135 + 100
- customTargetValueHigh: 255, // 155 + 100
- intensity: Intensity.Warmup));
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Time,
- durationValue: 2400000, // milliseconds
- targetType: WktStepTarget.Power,
- customTargetValueLow: 1175, // 175 + 1000
- customTargetValueHigh: 1195)); // 195 + 1000
-
- workoutSteps.Add(CreateWorkoutStep(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.Time,
- durationValue: 600000, // milliseconds
- targetType: WktStepTarget.Speed,
- customTargetValueLow: 5556, // 5.556 meters/second * 1000
- customTargetValueHigh: 6944, // 6.944 meters/second * 1000
- intensity: Intensity.Cooldown));
-
- var workoutMesg = new WorkoutMesg();
- workoutMesg.SetWktName("Custom Target Values");
- workoutMesg.SetSport(Sport.Cycling);
- workoutMesg.SetSubSport(SubSport.Invalid);
- workoutMesg.SetNumValidSteps((ushort)workoutSteps.Count);
-
- CreateWorkout(workoutMesg, workoutSteps);
- }
-
- static void CreatePoolSwimWorkout()
- {
- var workoutSteps = new List();
-
- // Warm Up 200 yds
- workoutSteps.Add(CreateWorkoutStepSwim(messageIndex: workoutSteps.Count,
- distance: 182.88f,
- intensity: Intensity.Warmup));
- // Rest until lap button pressed
- workoutSteps.Add(CreateWorkoutStepSwimRest(messageIndex: workoutSteps.Count));
-
- // Drill w/ kickboard 200 yds
- workoutSteps.Add(CreateWorkoutStepSwim(messageIndex: workoutSteps.Count,
- distance: 182.88f,
- swimStroke: SwimStroke.Drill,
- equipment: WorkoutEquipment.SwimKickboard));
- // Rest until lap button pressed
- workoutSteps.Add(CreateWorkoutStepSwimRest(messageIndex: workoutSteps.Count));
-
- // 5 x 100 yds on 2:00
- workoutSteps.Add(CreateWorkoutStepSwim(messageIndex: workoutSteps.Count,
- distance: 91.44f,
- swimStroke: SwimStroke.Freestyle));
-
- workoutSteps.Add(CreateWorkoutStepSwimRest(messageIndex: workoutSteps.Count,
- durationType: WktStepDuration.RepetitionTime,
- durationTime: 120.0f));
-
- workoutSteps.Add(CreateWorkoutStepRepeat(messageIndex: workoutSteps.Count, repeatFrom: 4, repetitions: 5));
-
- // Rest until lap button pressed
- workoutSteps.Add(CreateWorkoutStepSwimRest(messageIndex: workoutSteps.Count));
-
- // Cool Down 100 yds
- workoutSteps.Add(CreateWorkoutStepSwim(messageIndex: workoutSteps.Count,
- distance: 91.44f,
- intensity: Intensity.Cooldown));
-
- var workoutMesg = new WorkoutMesg();
- workoutMesg.SetWktName("Pool Swim");
- workoutMesg.SetSport(Sport.Swimming);
- workoutMesg.SetSubSport(SubSport.LapSwimming);
- workoutMesg.SetPoolLength(22.86f); // 25 yards
- workoutMesg.SetPoolLengthUnit(DisplayMeasure.Statute);
- workoutMesg.SetNumValidSteps((ushort)workoutSteps.Count);
-
- CreateWorkout(workoutMesg, workoutSteps);
- }
-
- static void CreateWorkout(WorkoutMesg workoutMesg, List workoutSteps)
- {
- // The combination of file type, manufacturer id, product id, and serial number should be unique.
- // When available, a non-random serial number should be used.
- Dynastream.Fit.File fileType = Dynastream.Fit.File.Workout;
- ushort manufacturerId = Manufacturer.Development;
- ushort productId = 0;
- Random random = new Random();
- uint serialNumber = (uint)random.Next();
-
- // Every FIT file MUST contain a File ID message
- var fileIdMesg = new FileIdMesg();
- fileIdMesg.SetType(fileType);
- fileIdMesg.SetManufacturer(manufacturerId);
- fileIdMesg.SetProduct(productId);
- fileIdMesg.SetTimeCreated(new Dynastream.Fit.DateTime(System.DateTime.UtcNow));
- fileIdMesg.SetSerialNumber(serialNumber);
-
- // Create the output stream, this can be any type of stream, including a file or memory stream. Must have read/write access
- FileStream fitDest = new FileStream($"{workoutMesg.GetWktNameAsString().Replace(' ', '_')}.fit", FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
-
- // Create a FIT Encode object
- Encode encoder = new Encode(ProtocolVersion.V10);
-
- // Write the FIT header to the output stream
- encoder.Open(fitDest);
-
- // Write the messages to the file, in the proper sequence
- encoder.Write(fileIdMesg);
- encoder.Write(workoutMesg);
-
- foreach (WorkoutStepMesg workoutStep in workoutSteps)
- {
- encoder.Write(workoutStep);
- }
-
- // Update the data size in the header and calculate the CRC
- encoder.Close();
-
- // Close the output stream
- fitDest.Close();
-
- Console.WriteLine($"Encoded FIT file {fitDest.Name}");
- }
-
- private static WorkoutStepMesg CreateWorkoutStep(int messageIndex, String name = null, String notes = null, Intensity intensity = Intensity.Active, WktStepDuration durationType = WktStepDuration.Open, uint? durationValue = null, WktStepTarget targetType = WktStepTarget.Open, uint targetValue = 0, uint? customTargetValueLow = null, uint? customTargetValueHigh = null)
- {
- if (durationType == WktStepDuration.Invalid)
- {
- return null;
- }
-
- var workoutStepMesg = new WorkoutStepMesg();
- workoutStepMesg.SetMessageIndex((ushort)messageIndex);
-
- if (name != null)
- {
- workoutStepMesg.SetWktStepName(name);
- }
-
- if (notes != null)
- {
- workoutStepMesg.SetNotes(notes);
- }
-
- workoutStepMesg.SetIntensity(intensity);
- workoutStepMesg.SetDurationType(durationType);
-
- if (durationValue.HasValue)
- {
- workoutStepMesg.SetDurationValue(durationValue);
- }
-
- if (targetType != WktStepTarget.Invalid && customTargetValueLow.HasValue && customTargetValueHigh.HasValue)
- {
- workoutStepMesg.SetTargetType(targetType);
- workoutStepMesg.SetTargetValue(0);
- workoutStepMesg.SetCustomTargetValueLow(customTargetValueLow);
- workoutStepMesg.SetCustomTargetValueHigh(customTargetValueHigh);
- }
- else if (targetType != WktStepTarget.Invalid)
- {
- workoutStepMesg.SetTargetType(targetType);
- workoutStepMesg.SetTargetValue(targetValue);
- workoutStepMesg.SetCustomTargetValueLow(0);
- workoutStepMesg.SetCustomTargetValueHigh(0);
- }
-
- return workoutStepMesg;
- }
-
- private static WorkoutStepMesg CreateWorkoutStepRepeat(int messageIndex, uint repeatFrom, uint repetitions)
- {
- var workoutStepMesg = new WorkoutStepMesg();
- workoutStepMesg.SetMessageIndex((ushort)messageIndex);
-
- workoutStepMesg.SetDurationType(WktStepDuration.RepeatUntilStepsCmplt);
- workoutStepMesg.SetDurationValue(repeatFrom);
-
- workoutStepMesg.SetTargetType(WktStepTarget.Open);
- workoutStepMesg.SetTargetValue(repetitions);
-
- return workoutStepMesg;
- }
-
- private static WorkoutStepMesg CreateWorkoutStepSwim(int messageIndex, float distance, String name = null, String notes = null, Intensity intensity = Intensity.Active, SwimStroke swimStroke = SwimStroke.Invalid, WorkoutEquipment? equipment = null)
- {
- var workoutStepMesg = new WorkoutStepMesg();
- workoutStepMesg.SetMessageIndex((ushort)messageIndex);
-
- if (name != null)
- {
- workoutStepMesg.SetWktStepName(name);
- }
-
- if (notes != null)
- {
- workoutStepMesg.SetNotes(notes);
- }
-
- workoutStepMesg.SetIntensity(intensity);
-
- workoutStepMesg.SetDurationType(WktStepDuration.Distance);
- workoutStepMesg.SetDurationDistance(distance);
-
- workoutStepMesg.SetTargetType(WktStepTarget.SwimStroke);
-
- workoutStepMesg.SetTargetStrokeType((byte)swimStroke);
-
- if (equipment.HasValue)
- {
- workoutStepMesg.SetEquipment(equipment);
- }
-
- return workoutStepMesg;
- }
-
- private static WorkoutStepMesg CreateWorkoutStepSwimRest(int messageIndex, WktStepDuration durationType = WktStepDuration.Open, float? durationTime = null)
- {
- var workoutStepMesg = new WorkoutStepMesg();
- workoutStepMesg.SetMessageIndex((ushort)messageIndex);
-
- workoutStepMesg.SetDurationType(durationType);
- workoutStepMesg.SetDurationTime(durationTime);
-
- workoutStepMesg.SetTargetType(WktStepTarget.Open);
-
- workoutStepMesg.SetIntensity(Intensity.Rest);
-
- return workoutStepMesg;
- }
- }
-}
diff --git a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/WorkoutEncode.csproj b/src/Garmin/FitSdk/Cookbook/WorkoutEncode/WorkoutEncode.csproj
deleted file mode 100644
index 2700d3e31..000000000
--- a/src/Garmin/FitSdk/Cookbook/WorkoutEncode/WorkoutEncode.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Exe
- netcoreapp3.1
-
-
-
- ..\..\Dynastream.Fit.Portable.dll
-
-
-
diff --git a/src/Garmin/FitSdk/Cookbook/readme.md b/src/Garmin/FitSdk/Cookbook/readme.md
deleted file mode 100644
index 2bf86504a..000000000
--- a/src/Garmin/FitSdk/Cookbook/readme.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# FIT SDK Cookbook
-
-The FIT SDK Cookbook contains examples of using the FIT SDK to solve real-world problems. There are recipes for encoding and decoding Activity, Workout, and Course files; and recipes that provide tips for working with the FIT SDK.
-
-The example projects provided in the cookbook are C# console apps written with .NET Core 3.1. All example projects in the cookbook use Visual Studio Code and can be compiled and executed on Windows, Mac, and Linux systems. The source code for the recipes is included with the FIT SDK and is located at /path/to/fit/sdk/cs/cookbook. The recipes are written in C#, but the concepts can be applied to the Java and C++ versions of the FIT SDK.
-
-The Cookbook projects reference the precompiled Dynastream.Fit.Portable.dll that is included with the FIT SDK. If needed, the C# FIT SDK source files can be directly included in the projects.
-
-## Prerequisites
-
-The following prerequisites are required for working with the example projects found in the cookbook.
-
-1. [Visual Studio Code](https://code.visualstudio.com/) with the [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) installed.
-2. The [NET Core SDK v3.1](https://dotnet.microsoft.com/download/dotnet-core) or later installed.
-
-## Using the recipes
-
-1. Open project folder in Visual Studio Code and install any extensions that are suggested for the project.
-2. To start debugging press F5, or from the menu choose Run -> Start debugging.
\ No newline at end of file
diff --git a/src/Garmin/FitSdk/Dynastream.Fit.Portable.dll b/src/Garmin/FitSdk/Dynastream.Fit.Portable.dll
deleted file mode 100644
index 801c47fbf..000000000
Binary files a/src/Garmin/FitSdk/Dynastream.Fit.Portable.dll and /dev/null differ
diff --git a/src/Garmin/FitSdk/Dynastream.Fit.Portable.pdb b/src/Garmin/FitSdk/Dynastream.Fit.Portable.pdb
deleted file mode 100644
index c20e619b1..000000000
Binary files a/src/Garmin/FitSdk/Dynastream.Fit.Portable.pdb and /dev/null differ
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/AccumulatedField.cs b/src/Garmin/FitSdk/Dynastream/Fit/AccumulatedField.cs
deleted file mode 100644
index 725b75fa3..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/AccumulatedField.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Dynastream.Fit
-{
- public class AccumulatedField
- {
- public int mesgNum;
- public int destFieldNum;
- private long lastValue;
- private long accumulatedValue;
-
- public AccumulatedField(int mesgNum, int destFieldNum)
- {
- this.mesgNum = mesgNum;
- this.destFieldNum = destFieldNum;
- this.lastValue = 0;
- this.accumulatedValue = 0;
- }
-
- public long Accumulate(long value, int bits)
- {
- long mask = (1L << bits) - 1;
-
- accumulatedValue += (value - lastValue) & mask;
- lastValue = value;
-
- return accumulatedValue;
- }
-
- public long Set(long value)
- {
- accumulatedValue = value;
- this.lastValue = value;
- return accumulatedValue;
- }
- }
-}
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/Accumulator.cs b/src/Garmin/FitSdk/Dynastream/Fit/Accumulator.cs
deleted file mode 100644
index b0e9d069e..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/Accumulator.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Dynastream.Fit
-{
- public class Accumulator
- {
- List accumulatedFields;
-
- public Accumulator()
- {
- accumulatedFields = new List();
- }
-
- public void Set(int mesgNum, int destFieldNum, long value)
- {
- AccumulatedField accumField = null;
- int i;
-
- for (i = 0; i < accumulatedFields.Count; i++)
- {
- accumField = accumulatedFields[i];
-
- if ((accumField.mesgNum == mesgNum) && (accumField.destFieldNum == destFieldNum))
- break;
- }
-
- if (i == accumulatedFields.Count)
- {
- accumField = new AccumulatedField(mesgNum, destFieldNum);
- accumulatedFields.Add(accumField);
- }
-
- accumField.Set(value);
- }
-
- public long Accumulate(int mesgNum, int destFieldNum, long value, int bits)
- {
- AccumulatedField accumField = null;
- int i;
- for (i = 0; i < accumulatedFields.Count; i++)
- {
- accumField = accumulatedFields[i];
-
- if ((accumField.mesgNum == mesgNum) && (accumField.destFieldNum == destFieldNum))
- break;
- }
-
- if (i == accumulatedFields.Count)
- {
- accumField = new AccumulatedField(mesgNum, destFieldNum);
- accumulatedFields.Add(accumField);
- }
-
- return accumField.Accumulate(value, bits);
- }
- }
-}
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/BufferedMesgBroadcaster.cs b/src/Garmin/FitSdk/Dynastream/Fit/BufferedMesgBroadcaster.cs
deleted file mode 100644
index 34153eeaa..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/BufferedMesgBroadcaster.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using System.IO;
-
-using Dynastream.Utility;
-using Dynastream.Fit;
-
-namespace Dynastream.Fit
-{
- public delegate void MesgBroadcastEventHandler(object sender, MesgBroadcastEventArgs e);
- public delegate void IncomingMesgEventHandler(object sender, IncomingMesgEventArgs e);
-
- public class MesgBroadcastEventArgs : EventArgs
- {
- public List mesgs = null;
-
- public MesgBroadcastEventArgs()
- {
- }
-
- public MesgBroadcastEventArgs(List newMesgs)
- {
- mesgs = newMesgs;
- }
- }
-
- public class IncomingMesgEventArgs : EventArgs
- {
- public Mesg mesg = null;
-
- public IncomingMesgEventArgs()
- {
- }
-
- public IncomingMesgEventArgs(Mesg newMesg)
- {
- mesg = new Mesg(newMesg);
- }
- }
-
- ///
- ///
- /// BufferedMesgBroadcaster intercepts the incoming messages
- /// from the given decode stream, buffers them, and offers
- /// an opportunity to edit the messages before broadcasting
- /// the messages to all registered listeners.
- ///
- ///
- /// To edit the messages, an IMesgBroadcastPlugin must be
- /// registered. All registered IMesgBroadcastPlugins are given
- /// the opportunity to see each message as they are decoded,
- /// as well as to see and edit the final list of
- /// messages before broadcast to listeners
- ///
- ///
- public class BufferedMesgBroadcaster : MesgBroadcaster
- {
- #region Fields
- private List mesgs = new List();
- public event MesgBroadcastEventHandler MesgBroadcastEvent;
- public event IncomingMesgEventHandler IncomingMesgEvent;
- #endregion
-
- #region Methods
-
- public void RegisterMesgBroadcastPlugin(IMesgBroadcastPlugin plugin)
- {
- MesgBroadcastEvent += plugin.OnBroadcast;
- IncomingMesgEvent += plugin.OnIncomingMesg;
- }
-
- public new void OnMesg(object sender, MesgEventArgs e)
- {
- // Notify any subscribers of either our general mesg event or specific profile mesg event
- mesgs.Add(e.mesg);
- if (IncomingMesgEvent != null)
- {
- IncomingMesgEvent(sender, new IncomingMesgEventArgs(e.mesg));
- }
- }
-
- public void Broadcast()
- {
- if (MesgBroadcastEvent != null)
- {
- MesgBroadcastEvent(this, new MesgBroadcastEventArgs(mesgs));
- }
-
- foreach (Mesg mesg in mesgs)
- {
- base.OnMesg(this, new MesgEventArgs(mesg));
- }
-
- }
- #endregion
- }
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/Crc.cs b/src/Garmin/FitSdk/Dynastream/Fit/Crc.cs
deleted file mode 100644
index e692c9204..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/Crc.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using System.IO;
-
-namespace Dynastream.Fit
-{
- ///
- /// Implements Dynastream CRC16 function
- ///
- public static class CRC
- {
- private static ushort[] crcTable = new ushort[]
- {
- 0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401,
- 0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400
- };
-
- #region Methods
- public static ushort Get16(ushort crc, byte data)
- {
- ushort tmp;
-
- // compute checksum of lower four bits of byte
- tmp = crcTable[crc & 0xF];
- crc = (ushort)((crc >> 4) & 0x0FFF);
- crc = (ushort)(crc ^ tmp ^ crcTable[data & 0xF]);
-
- // compute checksum of upper four bits of byte
- tmp = crcTable[crc & 0xF];
- crc = (ushort)((crc >> 4) & 0x0FFF);
- crc = (ushort)(crc ^ tmp ^ crcTable[(data >> 4) & 0xF]);
-
- return crc;
- }
-
- public static ushort Calc16(byte[] dataBlock, int size)
- {
- ushort crc = 0;
-
- for (int i = 0; i < size; i++)
- {
- crc = CRC.Get16(crc, dataBlock[i]);
- }
- return crc;
- }
- #endregion // Methods
- }
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/Decode.cs b/src/Garmin/FitSdk/Dynastream/Fit/Decode.cs
deleted file mode 100644
index 0ce7de389..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/Decode.cs
+++ /dev/null
@@ -1,507 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-
-namespace Dynastream.Fit
-{
- ///
- /// Event Args Class associated with the DeveloperFieldDescrtiption Event
- ///
- public class DeveloperFieldDescriptionEventArgs : EventArgs
- {
- public DeveloperFieldDescription Description { get; private set; }
-
- public DeveloperFieldDescriptionEventArgs(DeveloperFieldDescription description)
- {
- Description = description;
- }
- }
-
- ///
- /// This class will decode a .fit file reading the file header and any definition or data messages.
- ///
- public class Decode
- {
- private const long CRCSIZE = 2;
- private const uint INVALID_DATA_SIZE = 0;
-
- #region Fields
- private MesgDefinition[] localMesgDefs = new MesgDefinition[Fit.MaxLocalMesgs];
- private Header fileHeader;
- private uint timestamp = 0;
- private int lastTimeOffset = 0;
- private bool invalidDataSize = false;
- private Accumulator accumulator = new Accumulator();
-
- private readonly DeveloperDataLookup m_lookup = new DeveloperDataLookup();
- #endregion
-
- #region Properties
- public bool InvalidDataSize
- {
- get
- {
- return invalidDataSize;
- }
- set
- {
- invalidDataSize = value;
- }
- }
- #endregion
-
- #region Constructors
- public Decode()
- {
- }
- #endregion
-
- #region Methods
- public event MesgEventHandler MesgEvent;
- public event MesgDefinitionEventHandler MesgDefinitionEvent;
- public event EventHandler DeveloperFieldDescriptionEvent;
-
- ///
- /// Reads the file header to check if the file is FIT.
- /// Does not check CRC.
- /// Returns true if file is FIT.
- ///
- /// Seekable (file)stream to parse
- public bool IsFIT(Stream fitStream)
- {
- long position = fitStream.Position;
- bool status = false;
- try
- {
- // Does the header contain the flag string ".FIT"?
- Header header = new Header(fitStream);
- fitStream.Position = position;
- status = header.IsValid();
- }
- // If the header is malformed the ctor could throw an exception
- catch (FitException)
- {
- }
-
- fitStream.Position = position;
- return status;
- }
-
- ///
- /// Reads the FIT binary file header and crc to check compatibility and integrity.
- /// Also checks data reords size.
- /// Returns true if file is ok (not corrupt).
- ///
- /// Seekable (file)stream to parse.
- public bool CheckIntegrity(Stream fitStream)
- {
- bool isValid = true;
- long position = fitStream.Position;
- long fileSize = 0;
-
- try
- {
- while ((fitStream.Position < fitStream.Length) && isValid)
- {
- // Is there a valid header?
- Header header = new Header(fitStream);
- isValid = header.IsValid();
-
- // Get the file size from the header
- // When the data size is 0 set flags, don't calculate CRC
- if (header.DataSize > INVALID_DATA_SIZE)
- {
- fileSize = header.Size + header.DataSize + CRCSIZE;
-
- // Is the file CRC ok?
- // Need to rewind the header size because the header is part of the CRC calculation.
- byte[] data = new byte[fileSize];
- fitStream.Position = fitStream.Position - header.Size;
- fitStream.Read(data, 0, data.Length);
- isValid &= (CRC.Calc16(data, data.Length) == 0x0000);
- }
- else
- {
- invalidDataSize = true;
- isValid = false;
- }
- }
- }
- catch (FitException)
- {
- isValid = false;
- }
-
- fitStream.Position = position;
- return isValid;
- }
-
- ///
- /// Reads a FIT binary file.
- ///
- /// Seekable (file)stream to parse.
- ///
- /// Returns true if reading finishes successfully.
- ///
- public bool Read(Stream fitStream)
- {
- bool status = true;
- long position = fitStream.Position;
-
- while ((fitStream.Position < fitStream.Length) && status)
- {
- status = Read(fitStream, DecodeMode.Normal);
- }
-
- fitStream.Position = position;
-
- return status;
- }
-
- ///
- /// Reads a FIT binary file.
- ///
- /// Seekable (file)stream to parse.
- /// When true, skip file header. Also CRC will not be calculated.
- ///
- /// Returns true if reading finishes successfully.
- ///
- [Obsolete(
- "Arguments to this function are ambiguous, " +
- "use Read(stream, DecodeMode) instead. " +
- "Function will be removed after 20.30.00",
- false)]
- public bool Read(Stream fitStream, bool skipHeader)
- {
- return Read(fitStream, skipHeader ? DecodeMode.InvalidHeader : DecodeMode.Normal);
- }
-
-
- ///
- /// Reads a FIT binary File
- ///
- /// Seekable (file)stream to parse.
- /// Decode Mode to use for reading the file
- ///
- /// Returns true if reading finishes successfully.
- ///
- public bool Read(Stream fitStream, DecodeMode mode)
- {
- bool readOK = true;
- long fileSize = 0;
- long filePosition = fitStream.Position;
-
- try
- {
- // Attempt to read header
- if (mode == DecodeMode.Normal)
- {
- fileHeader = new Header(fitStream);
- readOK &= fileHeader.IsValid();
-
- // Get the file size from the header
- // When the data size is invalid set the file size to the fitstream length
- if (!invalidDataSize)
- {
- fileSize = fileHeader.Size + fileHeader.DataSize + CRCSIZE;
- }
- else
- {
- fileSize = fitStream.Length;
- }
-
- if (!readOK)
- {
- throw new FitException("FIT decode error: File is not FIT format. Check file header data type. Error at stream position: " + fitStream.Position);
- }
- if ((fileHeader.ProtocolVersion & Fit.ProtocolVersionMajorMask) > (Fit.ProtocolMajorVersion << Fit.ProtocolVersionMajorShift))
- {
- // The decoder does not support decode accross protocol major revisions
- throw new FitException(String.Format("FIT decode error: Protocol Version {0}.X not supported by SDK Protocol Ver{1}.{2} ", (fileHeader.ProtocolVersion & Fit.ProtocolVersionMajorMask) >> Fit.ProtocolVersionMajorShift, Fit.ProtocolMajorVersion, Fit.ProtocolMinorVersion));
- }
- }
- else if(mode == DecodeMode.InvalidHeader)
- {
- // When skipping the header force the stream position to be at the beginning of the data
- // Also the fileSize is the length of the filestream.
- fitStream.Position += Fit.HeaderWithCRCSize;
- fileSize = fitStream.Length;
- }
- else if (mode == DecodeMode.DataOnly)
- {
- // When the stream is only data move the position of the stream
- // to the start. FileSize is the length of the stream
- fitStream.Position = 0;
- fileSize = fitStream.Length;
- }
- else
- {
- throw new FitException("Invalid Decode Mode Provided to read");
- }
-
- // Read data messages and definitions
- while (fitStream.Position < (filePosition + fileSize - CRCSIZE))
- {
- DecodeNextMessage(fitStream);
- }
-
- // Is the file CRC ok?
- if ((mode == DecodeMode.Normal) && !invalidDataSize)
- {
- byte[] data = new byte[fileSize];
- fitStream.Position = filePosition;
- fitStream.Read(data, 0, data.Length);
- readOK &= (CRC.Calc16(data, data.Length) == 0x0000);
- fitStream.Position = filePosition + fileSize;
- }
- }
- catch (EndOfStreamException e)
- {
- readOK = false;
- Debug.WriteLine("{0} caught and ignored. ", e.GetType().Name);
- throw new FitException("Decode:Read - Unexpected End of File at stream position" + fitStream.Position, e);
- }
- catch (FitException e)
- {
- // When attempting to decode files with invalid data size this indicates the EOF.
- if (!invalidDataSize)
- {
- throw e;
- }
- }
- return readOK;
- }
-
- 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.GetMesg(MesgNum.Record).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 + " at stream position " + fitStream.Position);
- }
- int fieldsSize = localMesgDefs[localMesgNum].GetMesgSize() - 1;
- try
- {
- byte[] read = br.ReadBytes(fieldsSize);
- if( read.Length < fieldsSize )
- {
- throw new Exception("Field size mismatch, expected: " + fieldsSize + "received: " + read.Length);
- }
- mesgBuffer.Write(read, 0, fieldsSize);
- }
- catch (Exception 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);
- RaiseMesgEvent(newMesg);
- }
- // Is it a mesg def?
- else if ((nextByte & Fit.MesgDefinitionMask) == 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);
- int numBytes = numFields * 3; //3 Bytes per field
- try
- {
- byte[] read = br.ReadBytes(numBytes);
- if( read.Length < numBytes )
- {
- throw new Exception("Message Definition size mismatch, expected: " + numBytes + "received: " + read.Length);
- }
- mesgDefBuffer.Write(read, 0, numBytes);
-
- if ((nextByte & Fit.DevDataMask) == Fit.DevDataMask)
- {
- // Definition Contains Dev Data
- byte numDevFields = br.ReadByte();
- mesgDefBuffer.WriteByte(numDevFields);
-
- numBytes = numDevFields * 3;
- read = br.ReadBytes(numBytes);
- if( read.Length < numBytes )
- {
- throw new Exception("Message Definition size mismatch, expected: " + numBytes + "received: " + read.Length);
- }
-
- // Read Dev Data
- mesgDefBuffer.Write(read, 0, numBytes);
- }
- }
- catch (Exception e)
- {
- throw new FitException("Decode:DecodeNextMessage - Defn Message unexpected end of file. Wanted " + numBytes + " bytes at stream position " + fitStream.Position, e);
- }
-
- MesgDefinition newMesgDef = new MesgDefinition(mesgDefBuffer, m_lookup);
- localMesgDefs[newMesgDef.LocalMesgNum] = newMesgDef;
- if (MesgDefinitionEvent != null)
- {
- MesgDefinitionEvent(this, new MesgDefinitionEventArgs(newMesgDef));
- }
- }
- // Is it a data mesg?
- else if ((nextByte & Fit.MesgDefinitionMask) == 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 + " at stream position " + fitStream.Position);
- }
- int fieldsSize = localMesgDefs[localMesgNum].GetMesgSize() - 1;
- try
- {
- byte[] read = br.ReadBytes(fieldsSize);
- if( read.Length < fieldsSize )
- {
- throw new Exception("Field size mismatch, expected: " + fieldsSize + "received: " + read.Length);
- }
- mesgBuffer.Write(read, 0, fieldsSize);
- }
- catch (Exception 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)
- {
- object tsValue = timestampField.GetValue();
- if (tsValue != null)
- {
- timestamp = (uint)tsValue;
- lastTimeOffset = (int)timestamp & Fit.CompressedTimeMask;
- }
- }
-
- foreach (Field field in newMesg.FieldsList)
- {
- if (field.IsAccumulated)
- {
- int i;
- for (i = 0; i < field.GetNumValues(); i++)
- {
- long value = Convert.ToInt64(field.GetRawValue(i));
-
- foreach (Field fieldIn in newMesg.FieldsList)
- {
- foreach (FieldComponent fc in fieldIn.components)
- {
- if ((fc.fieldNum == field.Num) && (fc.accumulate))
- {
- value = (long) ((((value / field.Scale) - field.Offset) + fc.offset) * fc.scale);
- }
- }
- }
- accumulator.Set(newMesg.Num, field.Num, value);
- }
- }
- }
-
- // Now that the entire message is decoded we can evaluate subfields and expand any components
- newMesg.ExpandComponents(accumulator);
-
- RaiseMesgEvent(newMesg);
- }
- else
- {
- throw new FitException("Decode:Read - FIT decode error: Unexpected Record Header Byte 0x" + nextByte.ToString("X") + " at stream position: " + fitStream.Position);
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- private void RaiseMesgEvent(Mesg newMesg)
- {
- if ((newMesg.Num == MesgNum.DeveloperDataId) ||
- (newMesg.Num == MesgNum.FieldDescription))
- {
- HandleMetaData(newMesg);
- }
-
- if (MesgEvent != null)
- {
- MesgEvent(this, new MesgEventArgs(newMesg));
- }
- }
-
- private void HandleMetaData(Mesg newMesg)
- {
- if (newMesg.Num == MesgNum.DeveloperDataId)
- {
- var mesg = new DeveloperDataIdMesg(newMesg);
- m_lookup.Add(mesg);
- }
- else if (newMesg.Num == MesgNum.FieldDescription)
- {
- var mesg = new FieldDescriptionMesg(newMesg);
- DeveloperFieldDescription desc = m_lookup.Add(mesg);
- if (desc != null)
- {
- OnDeveloperFieldDescriptionEvent(
- new DeveloperFieldDescriptionEventArgs(desc));
- }
- }
- }
- #endregion
-
- protected virtual void OnDeveloperFieldDescriptionEvent(DeveloperFieldDescriptionEventArgs e)
- {
- EventHandler handler =
- DeveloperFieldDescriptionEvent;
-
- if (handler != null)
- {
- handler(this, e);
- }
- }
- } // class
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/DecodeMode.cs b/src/Garmin/FitSdk/Dynastream/Fit/DecodeMode.cs
deleted file mode 100644
index 05356d4a7..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/DecodeMode.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-namespace Dynastream.Fit
-{
- ///
- /// Mode used for Read Operations
- ///
- public enum DecodeMode
- {
- ///
- /// Indicates that file contains valid Header and CRC data
- ///
- Normal,
-
- ///
- /// Indicates that the Stream Contains a Header that is Corrupt
- ///
- InvalidHeader,
-
- ///
- /// Indicates that the Stream does not contain a Header or CRC
- ///
- DataOnly
- }
-}
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/Defines.cs b/src/Garmin/FitSdk/Dynastream/Fit/Defines.cs
deleted file mode 100644
index 5d6176940..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/Defines.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Dynastream.Fit
-{
- public enum ProtocolVersion
- {
- V10,
- V20
- }
-
- public static class ProtocolVersionExtensions
- {
- private class DetailedProtocolVersion
- {
- public byte MajorVersion { get; private set; }
- public byte MinorVersion { get; private set; }
-
- public byte Version
- {
- get
- {
- return (byte) ((MajorVersion << Fit.ProtocolVersionMajorShift) |
- MinorVersion);
- }
- }
-
- public DetailedProtocolVersion(byte major, byte minor)
- {
- MajorVersion = major;
- MinorVersion = minor;
- }
- }
-
- public static byte GetMajorVersion(this ProtocolVersion protocolVersion)
- {
- return s_versionMap[protocolVersion].MajorVersion;
- }
-
- public static byte GetMinorVersion(this ProtocolVersion protocolVersion)
- {
- return s_versionMap[protocolVersion].MinorVersion;
- }
-
- public static byte GetVersionByte(this ProtocolVersion protocolVersion)
-
- {
- return s_versionMap[protocolVersion].Version;
- }
-
- private static readonly Dictionary s_versionMap =
- new Dictionary
- {
- {ProtocolVersion.V10, new DetailedProtocolVersion(1, 0)},
- {ProtocolVersion.V20, new DetailedProtocolVersion(2, 0)}
- };
- }
-
-
- public class Fit
- {
- public const byte ProtocolVersionMajorShift = 4;
- public const byte ProtocolVersionMajorMask = (0x0F << ProtocolVersionMajorShift);
-
- public static readonly byte ProtocolVersion = Dynastream.Fit.ProtocolVersion.V20.GetVersionByte();
- public static readonly byte ProtocolMajorVersion = Dynastream.Fit.ProtocolVersion.V20.GetMajorVersion();
- public static readonly byte ProtocolMinorVersion = Dynastream.Fit.ProtocolVersion.V20.GetMinorVersion();
-
- public const ushort ProfileVersion = ((ProfileMajorVersion * 100) + ProfileMinorVersion);
- public const ushort ProfileMajorVersion = 21;
- public const ushort ProfileMinorVersion = 105;
-
- public const byte HeaderTypeMask = 0xF0;
- public const byte CompressedHeaderMask = 0x80;
- public const byte CompressedTimeMask = 0x1F;
- public const byte CompressedLocalMesgNumMask = 0x60;
-
- public const byte MesgDefinitionMask = 0x40;
- public const byte DevDataMask = 0x20;
- public const byte MesgHeaderMask = 0x00;
- public const byte LocalMesgNumMask = 0x0F;
- public const byte MaxLocalMesgs = LocalMesgNumMask + 1;
-
- public const byte MesgDefinitionReserved = 0x00;
- public const byte LittleEndian = 0x00;
- public const byte BigEndian = 0x01;
-
- public const ushort MaxMesgSize = 65535;
- public const byte MaxFieldSize = 255;
-
- public const byte HeaderWithCRCSize = 14;
- public const byte HeaderWithoutCRCSize = (HeaderWithCRCSize - 2);
-
- public const byte FieldNumInvalid = 255;
- public const byte FieldNumTimeStamp = 253;
-
- public const ushort SubfieldIndexMainField = SubfieldIndexActiveSubfield + 1;
- public const ushort SubfieldIndexActiveSubfield = 0xFFFE;
- public const string SubfieldNameMainField = "";
-
- public static FitType[] BaseType = new FitType[]
- {
- new FitType(false, 0x00, "enum", (byte)0xFF, 1, false, false),
- new FitType(false, 0x01, "sint8", (sbyte)0x7F, 1, true, true),
- new FitType(false, 0x02, "uint8", (byte)0xFF, 1, false, true),
- new FitType(true, 0x83, "sint16", (short)0x7FFF, 2, true, true),
- new FitType(true, 0x84, "uint16", (ushort)0xFFFF, 2, false, true),
- new FitType(true, 0x85, "sint32", (int)0x7FFFFFFF, 4, true, true),
- new FitType(true, 0x86, "uint32", (uint)0xFFFFFFFF, 4, false, true),
- new FitType(false, 0x07, "string", (byte)0x00, 1, false, false),
- new FitType(true, 0x88, "float32", BitConverter.ToSingle(new byte[] {0xFF, 0xFF, 0xFF, 0xFF}, 0), 4, true, false),
- new FitType(true, 0x89, "float64", BitConverter.ToDouble(new byte[] {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 0), 8, true, false),
- new FitType(false, 0x0A, "uint8z", (byte)0x00, 1, false, true),
- new FitType(true, 0x8B, "uint16z", (ushort)0x0000, 2, false, true),
- new FitType(true, 0x8C, "uint32z", (uint)0x00000000, 4, false, true),
- new FitType(false, 0x0D, "byte", (byte)0xFF, 1, false, false),
- new FitType(true, 0x8E, "sint64", (long)0x7FFFFFFFFFFFFFFFL, 8, true, true),
- new FitType(true, 0x8F, "uint64", (ulong)0xFFFFFFFFFFFFFFFFL, 8, false, true),
- new FitType(true, 0x90, "uint64z", (ulong)0x0000000000000000L, 8, false, true),
- };
-
-
- public struct FitType
- {
- public bool endianAbility;
- public byte baseTypeField;
- public string typeName;
- public object invalidValue;
- public byte size;
- public bool isSigned;
- public bool isInteger;
-
- public FitType(bool endianAbility, byte baseTypeField, string typeName, object invalidValue, byte size, bool isSigned, bool isInt)
- {
- this.endianAbility = endianAbility;
- this.baseTypeField = baseTypeField;
- this.typeName = typeName;
- this.invalidValue = invalidValue;
- this.size = size;
- this.isSigned = isSigned;
- this.isInteger = isInt;
- }
- }
-
- // Index into the BaseTypes array
- public const byte Enum = 0x00;
- public const byte SInt8 = 0x01;
- public const byte UInt8 = 0x02;
- public const byte SInt16 = 0x03;
- public const byte UInt16 = 0x04;
- public const byte SInt32 = 0x05;
- public const byte UInt32 = 0x06;
- public const byte String = 0x07;
- public const byte Float32 = 0x08;
- public const byte Float64 = 0x09;
- public const byte UInt8z = 0x0A;
- public const byte UInt16z = 0x0B;
- public const byte UInt32z = 0x0C;
- public const byte Byte = 0x0D;
- public const byte SInt64 = 0x0E;
- public const byte UInt64 = 0x0F;
- public const byte UInt64z = 0x10;
-
- // And this with the type defn to get the index
- public const byte BaseTypeNumMask = 0x1F;
- }
-}
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperDataKey.cs b/src/Garmin/FitSdk/Dynastream/Fit/DeveloperDataKey.cs
deleted file mode 100644
index 7b1381dd2..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperDataKey.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.IO;
-
-namespace Dynastream.Fit
-{
- internal class DeveloperDataKey
- : IComparable
- {
- public byte DeveloperDataIndex { get; private set; }
- public byte FieldDefNum { get; private set; }
-
- public DeveloperDataKey(byte developerDataIndex, byte fieldDefNum)
- {
- DeveloperDataIndex = developerDataIndex;
- FieldDefNum = fieldDefNum;
- }
-
- ///
- /// Determines whether the specified is equal to the current .
- ///
- ///
- /// true if the specified is equal to the current ; otherwise, false.
- ///
- /// The to compare with the current .
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != GetType()) return false;
- return Equals(obj as DeveloperDataKey);
- }
-
- ///
- /// Determines whether the specified is equal to the current .
- ///
- ///
- /// true if the specified is equal to the current ; otherwise, false.
- ///
- ///
- /// The to compare with the current .
- ///
- protected bool Equals(DeveloperDataKey other)
- {
- return (DeveloperDataIndex == other.DeveloperDataIndex) &&
- (FieldDefNum == other.FieldDefNum);
- }
-
- ///
- /// Serves as a hash function for a particular type.
- ///
- ///
- /// A hash code for the current .
- ///
- public override int GetHashCode()
- {
- unchecked
- {
- return (DeveloperDataIndex.GetHashCode() * 397) ^
- FieldDefNum.GetHashCode();
- }
- }
-
- ///
- /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
- ///
- ///
- /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes in the sort order. Zero This instance occurs in the same position in the sort order as . Greater than zero This instance follows in the sort order.
- ///
- /// An object to compare with this instance. is not the same type as this instance.
- public int CompareTo(object obj)
- {
- var other = obj as DeveloperDataKey;
- if (other == null)
- {
- throw new InvalidOperationException("Cannot compare");
- }
-
- if (DeveloperDataIndex > other.DeveloperDataIndex) return 1;
- if (DeveloperDataIndex < other.DeveloperDataIndex) return -1;
- if (FieldDefNum > other.FieldDefNum) return 1;
- if (FieldDefNum < other.FieldDefNum) return -1;
- return 0;
- }
- }
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperDataLookup.cs b/src/Garmin/FitSdk/Dynastream/Fit/DeveloperDataLookup.cs
deleted file mode 100644
index 9a32e49d5..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperDataLookup.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-namespace Dynastream.Fit
-{
- internal class DeveloperDataLookup
- {
- private readonly Dictionary m_fieldDescriptionMesgs;
- private readonly Dictionary m_developerDataIdMesgs;
-
- public DeveloperDataLookup()
- {
- m_fieldDescriptionMesgs = new Dictionary();
- m_developerDataIdMesgs = new Dictionary();
- }
-
- public Tuple GetMesgs(DeveloperDataKey key)
- {
- DeveloperDataIdMesg devIdMesg;
- FieldDescriptionMesg descriptionMesg;
-
- m_developerDataIdMesgs.TryGetValue(key.DeveloperDataIndex, out devIdMesg);
- m_fieldDescriptionMesgs.TryGetValue(key, out descriptionMesg);
-
- if (devIdMesg != null && descriptionMesg != null)
- {
- return new Tuple(
- devIdMesg,
- descriptionMesg);
- }
-
- return null;
- }
-
- public void Add(DeveloperDataIdMesg mesg)
- {
- byte? index = mesg.GetDeveloperDataIndex();
- if (index == null)
- return;
-
- m_developerDataIdMesgs[index.Value] = mesg;
-
- // Remove all fields currently associated with this developer
- var keysToRemove =
- m_fieldDescriptionMesgs.Keys
- .Where(
- x =>
- x.DeveloperDataIndex ==
- index)
- .ToList();
- foreach (var key in keysToRemove)
- {
- m_fieldDescriptionMesgs.Remove(key);
- }
- }
-
- public DeveloperFieldDescription Add(FieldDescriptionMesg mesg)
- {
- DeveloperFieldDescription desc = null;
-
- byte? developerDataIndex = mesg.GetDeveloperDataIndex();
- byte? fieldDefinitionNumber = mesg.GetFieldDefinitionNumber();
- if ((developerDataIndex != null) &&
- (fieldDefinitionNumber != null))
- {
- var key = new DeveloperDataKey(
- (byte)developerDataIndex,
- (byte)fieldDefinitionNumber);
-
- m_fieldDescriptionMesgs[key] = mesg;
-
- // Build a Description of the pairing we just created
- var pair = GetMesgs(key);
- if (pair != null)
- {
- desc = new DeveloperFieldDescription(pair.Item1, pair.Item2);
- }
- }
-
- return desc;
- }
- }
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperField.cs b/src/Garmin/FitSdk/Dynastream/Fit/DeveloperField.cs
deleted file mode 100644
index f612e78fb..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperField.cs
+++ /dev/null
@@ -1,191 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.IO;
-
-namespace Dynastream.Fit
-{
- public class DeveloperField
- : FieldBase
- {
- #region Fields
- private readonly DeveloperFieldDefinition m_definition;
- #endregion
-
- #region Properties
-
- public bool IsDefined
- {
- get { return m_definition.IsDefined; }
- }
-
- public byte Num
- {
- get { return m_definition.FieldNum; }
- }
-
- public byte DeveloperDataIndex
- {
- get { return m_definition.DeveloperDataIndex; }
- }
-
- public uint AppVersion
- {
- get
- {
- if (m_definition.IsDefined)
- {
- return m_definition.DeveloperIdMesg.GetApplicationVersion() ?? 0;
- }
-
- return 0;
- }
- }
-
- public byte[] AppId
- {
- get
- {
- if (m_definition.IsDefined)
- {
- var msg = m_definition.DeveloperIdMesg;
- byte[] appId = new byte[msg.GetNumApplicationId()];
-
- for (int i = 0; i < appId.Length; i++)
- {
- appId[i] = msg.GetApplicationId(i) ?? 0xFF;
- }
-
- return appId;
- }
-
- return null;
- }
- }
-
- public override string Name
- {
- get
- {
- return m_definition.IsDefined ?
- m_definition.DescriptionMesg.GetFieldNameAsString(0) : null;
- }
- }
-
- public override byte Type
- {
- get
- {
- if (m_definition.IsDefined)
- {
- return m_definition.DescriptionMesg.GetFitBaseTypeId() ?? Fit.UInt8;
- }
-
- return Fit.UInt8;
- }
- }
-
- public override double Scale
- {
- get
- {
- if (m_definition.IsDefined)
- {
- return m_definition.DescriptionMesg.GetScale() ?? 1.0;
- }
-
- return 1.0;
- }
- }
-
- public override double Offset
- {
- get
- {
- if (m_definition.IsDefined)
- {
- return m_definition.DescriptionMesg.GetOffset() ?? 0.0;
- }
-
- return 0.0;
- }
- }
-
- public override string Units
- {
- get
- {
- return m_definition.IsDefined ?
- m_definition.DescriptionMesg.GetUnitsAsString(0) : null;
- }
- }
-
- ///
- /// Retrieve the Native Field Number that this Developer Field Overrides
- ///
- ///
- /// Native Field Number that is overridden if applicable,
- /// otherwise
- ///
- public byte NativeOverride
- {
- get
- {
- if (m_definition.IsDefined)
- {
- return m_definition.DescriptionMesg.GetNativeFieldNum() ?? Fit.FieldNumInvalid;
- }
-
- return Fit.FieldNumInvalid;
- }
- }
-
- #endregion
-
- #region Constructors
- public DeveloperField(DeveloperField other)
- : base(other)
- {
- m_definition = other.m_definition;
- }
-
- internal DeveloperField(DeveloperFieldDefinition definition)
- {
- m_definition = definition;
- }
-
- public DeveloperField(FieldDescriptionMesg description, DeveloperDataIdMesg developerDataIdMesg)
- {
- m_definition = new DeveloperFieldDefinition(description, developerDataIdMesg, 0);
- }
-
- #endregion
-
- #region Methods
- internal override Subfield GetSubfield(string subfieldName)
- {
- // Developer Fields do not currently support Sub Fields
- return null;
- }
-
- internal override Subfield GetSubfield(int subfieldIndex)
- {
- // Developer Fields do not currently support Sub Fields
- return null;
- }
-
- #endregion
- }
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperFieldDefinition.cs b/src/Garmin/FitSdk/Dynastream/Fit/DeveloperFieldDefinition.cs
deleted file mode 100644
index 00e6905ad..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperFieldDefinition.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-
-namespace Dynastream.Fit
-{
- ///
- /// Represents a Developer Field Definition
- ///
- internal class DeveloperFieldDefinition
- {
- private readonly FieldDescriptionMesg m_descriptionMesg;
- private readonly DeveloperDataIdMesg m_developerIdMesg;
-
- ///
- /// Gets a boolean indicating if the Field Definition has associated meta
- /// data
- ///
- public bool IsDefined
- {
- get { return !ReferenceEquals(m_descriptionMesg, null); }
- }
-
- ///
- /// Gets the Field Number associated with the Developer Field
- ///
- public byte FieldNum { get; private set; }
-
- ///
- /// Gets the Number of bytes associated with the Developer Field
- ///
- public byte Size { get; private set; }
-
- ///
- /// Gets the developer index of the Developer Field
- ///
- public byte DeveloperDataIndex { get; private set; }
-
- ///
- /// Gets the current description message for the field
- ///
- internal FieldDescriptionMesg DescriptionMesg
- {
- get { return m_descriptionMesg; }
- }
-
- ///
- /// Gets the Associated Developer Id for the message
- ///
- internal DeveloperDataIdMesg DeveloperIdMesg
- {
- get { return m_developerIdMesg; }
- }
-
- public DeveloperFieldDefinition(byte fieldNum, byte size, byte developerDataIndex)
- {
- m_descriptionMesg = null;
- FieldNum = fieldNum;
- Size = size;
- DeveloperDataIndex = developerDataIndex;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- /// If description parameter is invalid
- ///
- public DeveloperFieldDefinition(FieldDescriptionMesg desc, DeveloperDataIdMesg devId, byte size)
- {
- byte? fieldDefinitionNumber = desc.GetFieldDefinitionNumber();
- byte? developerDataIndex = desc.GetDeveloperDataIndex();
- if ((developerDataIndex != null) &&
- (fieldDefinitionNumber != null))
- {
- m_descriptionMesg = desc;
- m_developerIdMesg = devId;
- Size = size;
- FieldNum = (byte)fieldDefinitionNumber;
- DeveloperDataIndex = (byte)developerDataIndex;
- }
- else
- {
- throw new FitException("Description Message must have a valid developer data index and field definition number");
- }
- }
- }
-}
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperFieldDescription.cs b/src/Garmin/FitSdk/Dynastream/Fit/DeveloperFieldDescription.cs
deleted file mode 100644
index d1a539a30..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/DeveloperFieldDescription.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-
-
-#endregion
-
-using System;
-using System.Globalization;
-using System.IO;
-
-namespace Dynastream.Fit
-{
- public class DeveloperFieldDescription
- {
- private readonly DeveloperDataIdMesg m_developerDataId;
- private readonly FieldDescriptionMesg m_fieldDescription;
-
- ///
- /// Gets the Value of the Application Version for the Field Description
- ///
- public uint ApplicationVersion
- {
- get { return m_developerDataId.GetApplicationVersion() ?? uint.MaxValue; }
- }
-
- ///
- /// Gets the Value of the Application Id for the Field Description
- ///
- public Guid ApplicationId
- {
- get
- {
- // If the Application Id is not exactly 16 bytes
- // (see size of UUID) return Empty
- if (m_developerDataId.GetNumApplicationId() != 16)
- return Guid.Empty;
-
- // Read the App Id
- byte[] appId = new byte[m_developerDataId.GetNumApplicationId()];
- for (int i = 0; i < appId.Length; i++)
- {
- appId[i] = m_developerDataId.GetApplicationId(i) ?? 0xFF;
- }
-
- // The SDK Treats these UUIDs in Java format so we need to convert to
- // a CLS Compliant Array where the array is in the form
- // u32, u16, u16, u8, u8, u8, u8, u8, u8, u8, u8 and flipping from big endian to
- // little endian
- byte[] net = new byte[appId.Length];
- for (int i = 8; i < 16; i++)
- {
- net[i] = appId[i];
- }
-
- // Flip The endianness of the u32 and u16 values
- net[3] = appId[0];
- net[2] = appId[1];
- net[1] = appId[2];
- net[0] = appId[3];
- net[5] = appId[4];
- net[4] = appId[5];
- net[7] = appId[6];
- net[6] = appId[7];
- return new Guid(net);
- }
- }
-
- ///
- /// Gets the Value of the Field Definition Number for thbe Field Description
- ///
- public byte FieldDefinitionNumber
- {
- get { return m_fieldDescription.GetFieldDefinitionNumber() ?? byte.MaxValue; }
- }
-
- internal DeveloperFieldDescription(
- DeveloperDataIdMesg developerDataId,
- FieldDescriptionMesg fieldDescription)
- {
- m_developerDataId = developerDataId;
- m_fieldDescription = fieldDescription;
- }
- }
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/Encode.cs b/src/Garmin/FitSdk/Dynastream/Fit/Encode.cs
deleted file mode 100644
index f032efb54..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/Encode.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using System.IO;
-
-namespace Dynastream.Fit
-{
- ///
- /// Supports generating binary .FIT files. Header, Message Definition and Message
- /// data may be written.
- ///
- public class Encode
- {
- #region Fields
- private MesgDefinition[] lastMesgDef = new MesgDefinition[Fit.MaxLocalMesgs];
- private bool open = false;
- private Stream fitDest;
-
- private readonly IValidator validator;
-
- ///
- /// If default ctor is used Header object may be manipulated if desired before Open is called.
- ///
- public Header header;
- #endregion // Fields
-
- #region Properties
-
- #endregion // Properties
-
- #region Constructors
-
-
- [Obsolete("Encode supports multiple Protocol Versions. Use constructor that selects correct version")]
- public Encode()
- : this(null, ProtocolVersion.V10)
- {
- }
-
- [Obsolete("Encode supports multiple Protocol Versions. Use constructor that selects correct version")]
- public Encode(Stream fitDest)
- : this(fitDest, ProtocolVersion.V10)
- {
- }
-
- public Encode(ProtocolVersion version)
- : this(null, version)
- {
- }
-
- public Encode(Stream fitDest, ProtocolVersion version)
- {
- header = new Header(version);
- validator = new ProtocolValidator(version);
-
- if (fitDest != null)
- {
- Open(fitDest);
- }
- }
- #endregion // Constructors
-
- #region Methods
-
- public void Open(Stream fitDest)
- {
- this.fitDest = fitDest;
- open = true;
-
- // Write header so we are ready to append messages
- header.Write(this.fitDest);
- }
-
- public void OnMesgDefinition(MesgDefinition newMesgDefinition)
- {
- Write(newMesgDefinition);
- }
-
- public void OnMesg(Mesg newMesg)
- {
- Write(newMesg);
- }
-
- public void Write(MesgDefinition mesgDefinition)
- {
- if (open == false)
- {
- throw new FitException("Encode:Write - Encode not opened yet, must call Encode:Open()");
- }
-
- if (!validator.ValidateMesgDefn(mesgDefinition))
- {
- throw new FitException("Encode:Write - mesgDefinition contains incompatible protocol Features");
- }
-
- mesgDefinition.Write(fitDest);
- lastMesgDef[mesgDefinition.LocalMesgNum] = mesgDefinition;
- }
-
- public void Write(Mesg mesg)
- {
- if (open == false)
- {
- throw new FitException("Encode:Write - Encode not opened yet, must call Encode:Open()");
- }
-
- if (!validator.ValidateMesg(mesg))
- {
- throw new FitException("Encode:Write - mesg contains incompatible protocol Features");
- }
-
- // 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]);
- }
-
- public void Write(IEnumerable mesgs)
- {
- foreach (Mesg mesg in mesgs)
- {
- Write(mesg);
- }
- }
-
- ///
- /// Updates the data size and CRC in the file header
- /// Updates file CRC
- ///
- public void Close()
- {
- if (open == false)
- {
- throw new FitException("Encode:Close - Encode not opened yet, must call Encode:Open()");
- }
-
- // Rewrites the header now that the datasize is known
- header.DataSize = (uint)(fitDest.Length - header.Size);
- header.UpdateCRC();
- header.Write(fitDest);
-
- // Compute and write the file CRC to the end of the file
- byte[] data = new byte[fitDest.Length];
- fitDest.Position = 0;
- fitDest.Read(data, 0, data.Length);
- ushort fileCrc = CRC.Calc16(data, data.Length);
- byte[] buffer = BitConverter.GetBytes(fileCrc);
- fitDest.Write(buffer, 0, 2);
- }
- #endregion // Methods
- } // Class
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/Field.cs b/src/Garmin/FitSdk/Dynastream/Fit/Field.cs
deleted file mode 100644
index 4714a15c5..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/Field.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Dynastream.Fit
-{
- public class Field
- : FieldBase
- {
- #region Fields
- private string name;
- private byte type;
- private double scale;
- private double offset;
- private string units;
- private bool isAccumulated;
- private Profile.Type profileType;
-
- internal List subfields = new List();
- internal List components = new List();
- #endregion
-
- #region Properties
- public override string Name
- {
- get
- {
- return name;
- }
- }
-
- public byte Num { get; set; }
-
- public override byte Type
- {
- get
- {
- return type;
- }
- }
-
- public override double Scale
- {
- get
- {
- return scale;
- }
- }
-
- public override double Offset
- {
- get
- {
- return offset;
- }
- }
-
- public override string Units
- {
- get
- {
- return units;
- }
- }
-
- public bool IsAccumulated
- {
- get
- {
- return isAccumulated;
- }
- }
-
- public Profile.Type ProfileType
- {
- get
- {
- return profileType;
- }
- }
-
- public bool IsExpandedField { get; set; }
- #endregion
-
- #region Constructors
- public Field(Field other)
- : base(other)
- {
- if (other == null)
- {
- this.name = "unknown";
- this.Num = Fit.FieldNumInvalid;
- this.type = 0;
- this.scale = 1f;
- this.offset = 0f;
- this.units = "";
- this.isAccumulated = false;
- this.profileType = Profile.Type.Enum;
- this.IsExpandedField = false;
- return;
- }
-
- this.name = other.Name;
- this.Num = other.Num;
- this.type = other.Type;
- this.scale = other.Scale;
- this.offset = other.Offset;
- this.units = other.units;
- this.isAccumulated = other.isAccumulated;
- this.profileType = other.profileType;
- this.IsExpandedField = other.IsExpandedField;
-
- foreach (Subfield subfield in other.subfields)
- {
- this.subfields.Add(new Subfield(subfield));
- }
- foreach (FieldComponent component in other.components)
- {
- this.components.Add(new FieldComponent(component));
- }
- }
-
- internal Field(string name, byte num, byte type, double scale, double offset, string units, bool accumulated, Profile.Type profileType)
- {
- this.name = name;
- this.Num = num;
- this.type = type;
- this.scale = scale;
- this.offset = offset;
- this.units = units;
- this.isAccumulated = accumulated;
- this.profileType = profileType;
- this.IsExpandedField = false;
- }
-
- internal Field(byte num, byte type)
- : this("unknown", num, type, 1.0d, 0.0d, "", false, Profile.Type.NumTypes)
- {
- }
- #endregion
-
- #region Methods
-
- internal void SetType(byte value)
- {
- type = value;
- }
-
- internal override Subfield GetSubfield(string subfieldName)
- {
- return subfields.FirstOrDefault(subfield => subfield.Name == subfieldName);
- }
-
- internal override Subfield GetSubfield(int subfieldIndex)
- {
- // SubfieldIndexActiveSubfield and SubfieldIndexMainField
- // will be out of this range
- if (subfieldIndex >= 0 && subfieldIndex < subfields.Count)
- {
- return subfields[subfieldIndex];
- }
-
- return null;
-
- }
- #endregion
- }
-} // namespace
diff --git a/src/Garmin/FitSdk/Dynastream/Fit/FieldBase.cs b/src/Garmin/FitSdk/Dynastream/Fit/FieldBase.cs
deleted file mode 100644
index e690327e8..000000000
--- a/src/Garmin/FitSdk/Dynastream/Fit/FieldBase.cs
+++ /dev/null
@@ -1,803 +0,0 @@
-#region Copyright
-/////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2023 Garmin International, Inc.
-// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
-// may not use this file except in compliance with the Flexible and Interoperable Data
-// Transfer (FIT) Protocol License.
-/////////////////////////////////////////////////////////////////////////////////////////////
-// ****WARNING**** This file is auto-generated! Do NOT edit this file.
-// Profile Version = 21.105Release
-// Tag = production/release/21.105.00-0-gdc65d24
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Dynastream.Fit
-{
- public abstract class FieldBase
- {
- #region Fields
- private readonly List