Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
108 changes: 54 additions & 54 deletions Dynastream/Fit/AccumulatedField.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
#region Copyright
/////////////////////////////////////////////////////////////////////////////////////////////
// Copyright 2025 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.188.0Release
// Tag = production/release/21.188.0-0-g55050f8
/////////////////////////////////////////////////////////////////////////////////////////////
#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;
}
}
}
#region Copyright
/////////////////////////////////////////////////////////////////////////////////////////////
// Copyright 2026 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.194.0Release
// Tag = production/release/21.194.0-0-g65135fc
/////////////////////////////////////////////////////////////////////////////////////////////

#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;
}
}
}
148 changes: 74 additions & 74 deletions Dynastream/Fit/Accumulator.cs
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
#region Copyright
/////////////////////////////////////////////////////////////////////////////////////////////
// Copyright 2025 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.188.0Release
// Tag = production/release/21.188.0-0-g55050f8
/////////////////////////////////////////////////////////////////////////////////////////////
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Dynastream.Fit
{
public class Accumulator
{
List<AccumulatedField> accumulatedFields;
public Accumulator()
{
accumulatedFields = new List<AccumulatedField>();
}
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);
}
}
}
#region Copyright
/////////////////////////////////////////////////////////////////////////////////////////////
// Copyright 2026 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.194.0Release
// Tag = production/release/21.194.0-0-g65135fc
/////////////////////////////////////////////////////////////////////////////////////////////

#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dynastream.Fit
{
public class Accumulator
{
List<AccumulatedField> accumulatedFields;

public Accumulator()
{
accumulatedFields = new List<AccumulatedField>();
}

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);
}
}
}
Loading
Loading