Skip to content

Commit f525048

Browse files
authored
Merge pull request #13 from garmin/production/awk/21.188.0_50
Garmin FIT SDK 21.188.0
2 parents 0e8f0ea + 35fb765 commit f525048

File tree

412 files changed

+96035
-71721
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+96035
-71721
lines changed
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
{
2-
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3-
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4-
5-
// List of extensions which should be recommended for users of this workspace.
6-
"recommendations": [
7-
"ms-dotnettools.csharp",
8-
"mechatroner.rainbow-csv"
9-
],
10-
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
11-
"unwantedRecommendations": [
12-
13-
]
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"ms-dotnettools.csharp",
8+
"mechatroner.rainbow-csv"
9+
],
10+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
11+
"unwantedRecommendations": [
12+
13+
]
1414
}
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
{
2-
// Use IntelliSense to find out which attributes exist for C# debugging
3-
// Use hover for the description of the existing attributes
4-
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"name": ".NET Core Launch (console)",
9-
"type": "coreclr",
10-
"request": "launch",
11-
"preLaunchTask": "build",
12-
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/ActivityDecode.dll",
14-
"args": [
15-
"${workspaceFolder}/Activity.fit"
16-
],
17-
"cwd": "${workspaceFolder}",
18-
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
19-
"console": "internalConsole",
20-
"stopAtEntry": false
21-
},
22-
{
23-
"name": ".NET Core Attach",
24-
"type": "coreclr",
25-
"request": "attach",
26-
"processId": "${command:pickProcess}"
27-
}
28-
]
1+
{
2+
// Use IntelliSense to find out which attributes exist for C# debugging
3+
// Use hover for the description of the existing attributes
4+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/ActivityDecode.dll",
14+
"args": [
15+
"${workspaceFolder}/Activity.fit"
16+
],
17+
"cwd": "${workspaceFolder}",
18+
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
19+
"console": "internalConsole",
20+
"stopAtEntry": false
21+
},
22+
{
23+
"name": ".NET Core Attach",
24+
"type": "coreclr",
25+
"request": "attach",
26+
"processId": "${command:pickProcess}"
27+
}
28+
]
2929
}
Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
{
2-
"version": "2.0.0",
3-
"tasks": [
4-
{
5-
"label": "build",
6-
"command": "dotnet",
7-
"type": "process",
8-
"args": [
9-
"build",
10-
"${workspaceFolder}/ActivityDecode.csproj",
11-
"/property:GenerateFullPaths=true",
12-
"/consoleloggerparameters:NoSummary"
13-
],
14-
"problemMatcher": "$msCompile"
15-
},
16-
{
17-
"label": "publish",
18-
"command": "dotnet",
19-
"type": "process",
20-
"args": [
21-
"publish",
22-
"${workspaceFolder}/ActivityDecode.csproj",
23-
"/property:GenerateFullPaths=true",
24-
"/consoleloggerparameters:NoSummary"
25-
],
26-
"problemMatcher": "$msCompile"
27-
},
28-
{
29-
"label": "watch",
30-
"command": "dotnet",
31-
"type": "process",
32-
"args": [
33-
"watch",
34-
"run",
35-
"${workspaceFolder}/ActivityDecode.csproj",
36-
"/property:GenerateFullPaths=true",
37-
"/consoleloggerparameters:NoSummary"
38-
],
39-
"problemMatcher": "$msCompile"
40-
}
41-
]
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/ActivityDecode.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/ActivityDecode.csproj",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"${workspaceFolder}/ActivityDecode.csproj",
36+
"/property:GenerateFullPaths=true",
37+
"/consoleloggerparameters:NoSummary"
38+
],
39+
"problemMatcher": "$msCompile"
40+
}
41+
]
4242
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<OutputType>Exe</OutputType>
4-
<TargetFramework>net8.0</TargetFramework>
5-
</PropertyGroup>
6-
<ItemGroup>
7-
<PackageReference Include="Garmin.FIT.Sdk" Version="*"/>
8-
</ItemGroup>
9-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageReference Include="Garmin.FIT.Sdk" Version="*"/>
8+
</ItemGroup>
9+
</Project>
Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
1-
/////////////////////////////////////////////////////////////////////////////////////////////
2-
// Copyright 2023 Garmin International, Inc.
3-
// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
4-
// may not use this file except in compliance with the Flexible and Interoperable Data
5-
// Transfer (FIT) Protocol License.
6-
/////////////////////////////////////////////////////////////////////////////////////////////
7-
8-
using System;
9-
using System.Collections.Generic;
10-
using System.Linq;
11-
using Dynastream.Fit;
12-
using Extensions;
13-
14-
public class ActivityParser
15-
{
16-
private FitMessages _messages;
17-
public bool IsActivityFile => _firstFileIdMesg != null ? (_firstFileIdMesg.GetType() ?? File.Invalid) == File.Activity : false;
18-
19-
public FileIdMesg _firstFileIdMesg => _messages.FileIdMesgs.FirstOrDefault();
20-
public ActivityMesg _activityMesg => _messages.ActivityMesgs.FirstOrDefault();
21-
22-
public ActivityParser(FitMessages messages)
23-
{
24-
_messages = messages;
25-
}
26-
27-
public List<SessionMessages> ParseSessions()
28-
{
29-
if (!IsActivityFile)
30-
{
31-
throw new Exception($"Expected FIT File Type: Activity, recieved File Type: {_firstFileIdMesg?.GetType()}");
32-
}
33-
34-
// Create a read/write list of session messages
35-
var sessionMesgs = new List<SessionMesg>(_messages.SessionMesgs);
36-
37-
// When there are no Sessions but there are Records create a Session message to recover as much data as possible
38-
if (sessionMesgs.Count == 0 && _messages.RecordMesgs.Count > 0)
39-
{
40-
Dynastream.Fit.DateTime startTime = _messages.RecordMesgs[0].GetTimestamp();
41-
Dynastream.Fit.DateTime timestamp = _messages.RecordMesgs[_messages.RecordMesgs.Count - 1].GetTimestamp();
42-
43-
var session = new SessionMesg();
44-
session.SetStartTime(startTime);
45-
session.SetTimestamp(timestamp);
46-
session.SetTotalElapsedTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
47-
session.SetTotalTimerTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
48-
49-
sessionMesgs.Add(session);
50-
}
51-
52-
int recordsTaken = 0;
53-
54-
var sessions = new List<SessionMessages>(sessionMesgs.Count);
55-
foreach (SessionMesg sessionMesg in sessionMesgs)
56-
{
57-
var session = new SessionMessages(sessionMesg)
58-
{
59-
Laps = _messages.LapMesgs.Skip(sessionMesg.GetFirstLapIndex() ?? 0).Take(sessionMesg.GetNumLaps() ?? 0).ToList(),
60-
61-
ClimbPros = _messages.ClimbProMesgs.Where(climb => climb.Within(sessionMesg)).ToList(),
62-
Events = _messages.EventMesgs.Where(evt => evt.Within(sessionMesg)).ToList(),
63-
DeviceInfos = _messages.DeviceInfoMesgs.Where(deviceInfo => deviceInfo.Within(sessionMesg)).ToList(),
64-
Lengths = _messages.LengthMesgs.Where(length => length.Overlaps(sessionMesg)).ToList(),
65-
Records = _messages.RecordMesgs.Skip(recordsTaken).Where(record => record.Within(sessionMesg)).ToList(),
66-
SegmentLaps = _messages.SegmentLapMesgs.Where(segmentLap => segmentLap.Overlaps(sessionMesg)).ToList(),
67-
68-
TimerEvents = _messages.EventMesgs.Where(evt => evt.GetEvent() == Event.Timer && evt.Within(sessionMesg)).ToList(),
69-
FrontGearChangeEvents = _messages.EventMesgs.Where(evt => evt.GetEvent() == Event.FrontGearChange && evt.Within(sessionMesg)).ToList(),
70-
RearGearChangeEvents = _messages.EventMesgs.Where(evt => evt.GetEvent() == Event.RearGearChange && evt.Within(sessionMesg)).ToList(),
71-
RiderPositionChangeEvents = _messages.EventMesgs.Where(evt => evt.GetEvent() == Event.RiderPositionChange && evt.Within(sessionMesg)).ToList(),
72-
73-
FileId = _firstFileIdMesg,
74-
Activity = _activityMesg,
75-
};
76-
77-
recordsTaken += session.Records.Count;
78-
sessions.Add(session);
79-
}
80-
81-
return sessions;
82-
}
83-
84-
public List<DeviceInfoMesg> DevicesWhereBatteryStatusIsLow()
85-
{
86-
var batteryStatus = new List<byte>() { BatteryStatus.Critical, BatteryStatus.Low };
87-
var deviceInfos = new List<DeviceInfoMesg>();
88-
89-
deviceInfos = _messages.DeviceInfoMesgs.Where(info => batteryStatus.Contains(info.GetBatteryStatus() ?? BatteryStatus.Unknown)).ToList();
90-
return deviceInfos;
91-
}
92-
}
1+
/////////////////////////////////////////////////////////////////////////////////////////////
2+
// Copyright 2023 Garmin International, Inc.
3+
// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
4+
// may not use this file except in compliance with the Flexible and Interoperable Data
5+
// Transfer (FIT) Protocol License.
6+
/////////////////////////////////////////////////////////////////////////////////////////////
7+
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Linq;
11+
using Dynastream.Fit;
12+
using Extensions;
13+
14+
public class ActivityParser
15+
{
16+
private FitMessages _messages;
17+
public bool IsActivityFile => _firstFileIdMesg != null ? (_firstFileIdMesg.GetType() ?? File.Invalid) == File.Activity : false;
18+
19+
public FileIdMesg _firstFileIdMesg => _messages.FileIdMesgs.FirstOrDefault();
20+
public ActivityMesg _activityMesg => _messages.ActivityMesgs.FirstOrDefault();
21+
22+
public ActivityParser(FitMessages messages)
23+
{
24+
_messages = messages;
25+
}
26+
27+
public List<SessionMessages> ParseSessions()
28+
{
29+
if (!IsActivityFile)
30+
{
31+
throw new Exception($"Expected FIT File Type: Activity, recieved File Type: {_firstFileIdMesg?.GetType()}");
32+
}
33+
34+
// Create a read/write list of session messages
35+
var sessionMesgs = new List<SessionMesg>(_messages.SessionMesgs);
36+
37+
// When there are no Sessions but there are Records create a Session message to recover as much data as possible
38+
if (sessionMesgs.Count == 0 && _messages.RecordMesgs.Count > 0)
39+
{
40+
Dynastream.Fit.DateTime startTime = _messages.RecordMesgs[0].GetTimestamp();
41+
Dynastream.Fit.DateTime timestamp = _messages.RecordMesgs[_messages.RecordMesgs.Count - 1].GetTimestamp();
42+
43+
var session = new SessionMesg();
44+
session.SetStartTime(startTime);
45+
session.SetTimestamp(timestamp);
46+
session.SetTotalElapsedTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
47+
session.SetTotalTimerTime(timestamp.GetTimeStamp() - startTime.GetTimeStamp());
48+
49+
sessionMesgs.Add(session);
50+
}
51+
52+
int recordsTaken = 0;
53+
54+
var sessions = new List<SessionMessages>(sessionMesgs.Count);
55+
foreach (SessionMesg sessionMesg in sessionMesgs)
56+
{
57+
var session = new SessionMessages(sessionMesg)
58+
{
59+
Laps = _messages.LapMesgs.Skip(sessionMesg.GetFirstLapIndex() ?? 0).Take(sessionMesg.GetNumLaps() ?? 0).ToList(),
60+
61+
ClimbPros = _messages.ClimbProMesgs.Where(climb => climb.Within(sessionMesg)).ToList(),
62+
Events = _messages.EventMesgs.Where(evt => evt.Within(sessionMesg)).ToList(),
63+
DeviceInfos = _messages.DeviceInfoMesgs.Where(deviceInfo => deviceInfo.Within(sessionMesg)).ToList(),
64+
Lengths = _messages.LengthMesgs.Where(length => length.Overlaps(sessionMesg)).ToList(),
65+
Records = _messages.RecordMesgs.Skip(recordsTaken).Where(record => record.Within(sessionMesg)).ToList(),
66+
SegmentLaps = _messages.SegmentLapMesgs.Where(segmentLap => segmentLap.Overlaps(sessionMesg)).ToList(),
67+
68+
TimerEvents = _messages.EventMesgs.Where(evt => evt.GetEvent() == Event.Timer && evt.Within(sessionMesg)).ToList(),
69+
FrontGearChangeEvents = _messages.EventMesgs.Where(evt => evt.GetEvent() == Event.FrontGearChange && evt.Within(sessionMesg)).ToList(),
70+
RearGearChangeEvents = _messages.EventMesgs.Where(evt => evt.GetEvent() == Event.RearGearChange && evt.Within(sessionMesg)).ToList(),
71+
RiderPositionChangeEvents = _messages.EventMesgs.Where(evt => evt.GetEvent() == Event.RiderPositionChange && evt.Within(sessionMesg)).ToList(),
72+
73+
FileId = _firstFileIdMesg,
74+
Activity = _activityMesg,
75+
};
76+
77+
recordsTaken += session.Records.Count;
78+
sessions.Add(session);
79+
}
80+
81+
return sessions;
82+
}
83+
84+
public List<DeviceInfoMesg> DevicesWhereBatteryStatusIsLow()
85+
{
86+
var batteryStatus = new List<byte>() { BatteryStatus.Critical, BatteryStatus.Low };
87+
var deviceInfos = new List<DeviceInfoMesg>();
88+
89+
deviceInfos = _messages.DeviceInfoMesgs.Where(info => batteryStatus.Contains(info.GetBatteryStatus() ?? BatteryStatus.Unknown)).ToList();
90+
return deviceInfos;
91+
}
92+
}

0 commit comments

Comments
 (0)