-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkoutStepFixer.cs
More file actions
25 lines (23 loc) · 928 Bytes
/
Copy pathWorkoutStepFixer.cs
File metadata and controls
25 lines (23 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using Dynastream.Fit;
class WorkoutStepFixer
{
public event MesgEventHandler? MesgEvent;
public void OnMesg(Mesg message)
{
if (message.Num == 27) // WorkoutStep message
{
// When workout step message is found, remove the notes
// The notes sometimes cause issues when writing the workout step to the merged file using Encode, this
// seems to be a bug in the FIT SDK
// As a workaround, the notes are removed from the workout step message as they are not needed for analysis
// purposes
WorkoutStepMesg workoutStepMesg = new(message);
workoutStepMesg.RemoveField(workoutStepMesg.GetField(WorkoutStepMesg.FieldDefNum.Notes));
MesgEvent?.Invoke(this, new MesgEventArgs(workoutStepMesg));
}
else
{
MesgEvent?.Invoke(this, new MesgEventArgs(message));
}
}
}