@garmin/fitsdk 21.171.0 → 21.178.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -76,6 +76,7 @@ const { messages, errors } = decoder.read({
76
76
  convertDateTimesToDates: true,
77
77
  includeUnknownData: false,
78
78
  mergeHeartRates: true
79
+ decodeMemoGlobs: false,
79
80
  });
80
81
  ````
81
82
  #### mesgListener = (messageNumber, message) => {}
@@ -178,6 +179,10 @@ When true unknown field values are stored in the message using the field id as t
178
179
  ````
179
180
  #### mergeHeartRates: true | false
180
181
  When true automatically merge heart rate values from HR messages into the Record messages. This option requires the applyScaleAndOffset and expandComponents options to be enabled. This option has no effect on the Record messages when no HR messages are present in the decoded messages.
182
+
183
+ #### decodeMemoGlobs: true | false
184
+ When true, the decoder will reconstruct strings from memoGlob messages. Each reconstructed string will overwrite the targeted message field.
185
+
181
186
  ## Creating Streams
182
187
  Stream objects contain the binary FIT data to be decoded. Streams objects can be created from byte-arrays, ArrayBuffers, and Node.js Buffers. Internally the Stream class uses an ArrayBuffer to manage the byte stream.
183
188
  #### From a Byte Array
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@garmin/fitsdk",
3
- "version": "21.171.0",
3
+ "version": "21.178.0",
4
4
  "description": "FIT JavaScript SDK",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
package/src/bit-stream.js CHANGED
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
package/src/decoder.js CHANGED
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -729,8 +729,8 @@ class Decoder {
729
729
  return rawFieldValue;
730
730
  }
731
731
 
732
- const scale = Array.isArray(field?.scale ?? 1) ? field?.scale[0] : field?.scale ?? 1;
733
- const offset = Array.isArray(field?.offset ?? 1) ? field?.offset[0] : field?.offset ?? 0;
732
+ const scale = Array.isArray(field?.scale ?? FIT.FIELD_DEFAULT_SCALE) ? field?.scale[0] : field?.scale ?? FIT.FIELD_DEFAULT_SCALE;
733
+ const offset = Array.isArray(field?.offset ?? FIT.FIELD_DEFAULT_OFFSET) ? field?.offset[0] : field?.offset ?? FIT.FIELD_DEFAULT_OFFSET;
734
734
 
735
735
  try {
736
736
  if (Array.isArray(rawFieldValue)) {
package/src/encoder.js CHANGED
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -20,9 +20,6 @@ import Utils from "./utils.js";
20
20
  const HEADER_WITH_CRC_SIZE = 14;
21
21
  const HEADER_WITHOUT_CRC_SIZE = 12;
22
22
 
23
- const FIELD_DEFAULT_SCALE = 1;
24
- const FIELD_DEFAULT_OFFSET = 0;
25
-
26
23
  /**
27
24
  * A class for encoding FIT files.
28
25
  * @class
@@ -131,7 +128,7 @@ class Encoder {
131
128
  throw new Error("addDeveloperField() - one or more developerDataIndex values are null.", {
132
129
  cause: {
133
130
  key,
134
- developerDataIdMesg,
131
+ developerDataIdMesg,
135
132
  fieldDescriptionMesg
136
133
  }
137
134
  });
@@ -141,7 +138,7 @@ class Encoder {
141
138
  throw new Error("addDeveloperField() - developerDataIndex values do not match.", {
142
139
  cause: {
143
140
  key,
144
- developerDataIdMesg,
141
+ developerDataIdMesg,
145
142
  fieldDescriptionMesg
146
143
  }
147
144
  });
@@ -215,12 +212,10 @@ class Encoder {
215
212
  throw new Error();
216
213
  }
217
214
 
218
- const scale = fieldDefinition.components.length > 1 ? FIELD_DEFAULT_SCALE : fieldDefinition.scale;
219
- const offset = fieldDefinition.components.length > 1 ? FIELD_DEFAULT_OFFSET : fieldDefinition.offset;
220
- const hasScaleOrOffset = (scale != FIELD_DEFAULT_SCALE || offset != FIELD_DEFAULT_OFFSET);
215
+ const hasScaleOrOffset = (fieldDefinition.scale != FIT.FIELD_DEFAULT_SCALE || fieldDefinition.offset != FIT.FIELD_DEFAULT_OFFSET);
221
216
 
222
217
  if (hasScaleOrOffset) {
223
- const scaledValue = (value + offset) * scale;
218
+ const scaledValue = (value + fieldDefinition.offset) * fieldDefinition.scale;
224
219
 
225
220
  return FIT.FloatingPointFieldTypes.includes(fieldDefinition.type) ? scaledValue : Math.round(scaledValue);
226
221
  }
package/src/fit.js CHANGED
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -172,6 +172,8 @@ export default {
172
172
  isNumberStringDateOrBoolean,
173
173
  isNotNumberStringDateOrBoolean,
174
174
  MAX_FIELD_SIZE: 255,
175
+ FIELD_DEFAULT_SCALE: 1,
176
+ FIELD_DEFAULT_OFFSET: 0,
175
177
  MESG_DEFINITION_MASK: 0x40,
176
178
  LOCAL_MESG_NUM_MASK: 0x0F,
177
179
  ARCH_LITTLE_ENDIAN: 0x00,
package/src/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -56,14 +56,20 @@ class MesgDefinition {
56
56
  const baseType = FIT.FieldTypeToBaseType[fieldProfile[1].baseType];
57
57
  const baseTypeDef = FIT.BaseTypeDefinitions[baseType];
58
58
 
59
+ let scale = fieldProfile[1].components.length > 1 ? FIT.FIELD_DEFAULT_SCALE : fieldProfile[1].scale;
60
+ let offset = fieldProfile[1].components.length > 1 ? FIT.FIELD_DEFAULT_OFFSET : fieldProfile[1].offset;
61
+
62
+ scale = Array.isArray(scale) ? scale[0] : scale ?? FIT.FIELD_DEFAULT_SCALE;
63
+ offset = Array.isArray(offset) ? offset[0] : offset ?? FIT.FIELD_DEFAULT_OFFSET;
64
+
59
65
  this.fieldDefinitions.push({
60
66
  name: fieldName,
61
67
  num: fieldProfile[1].num,
62
68
  size: this.#fieldSize(mesg[fieldName], baseTypeDef),
63
69
  baseType: baseType,
64
70
  type: fieldProfile[1].type,
65
- scale: fieldProfile[1].scale,
66
- offset: fieldProfile[1].offset,
71
+ scale,
72
+ offset,
67
73
  components: fieldProfile[1].components,
68
74
  });
69
75
  });
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
package/src/profile.js CHANGED
@@ -5,15 +5,15 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
13
13
  const Profile = {
14
14
  version: {
15
15
  major: 21,
16
- minor: 171,
16
+ minor: 178,
17
17
  patch: 0,
18
18
  type: "Release"
19
19
  },
@@ -22980,6 +22980,95 @@ const Profile = {
22980
22980
  subFields: []
22981
22981
  },
22982
22982
  },
22983
+ },
22984
+ 470: {
22985
+ num: 470,
22986
+ name: "sleepDisruptionSeverityPeriod",
22987
+ messagesKey: "sleepDisruptionSeverityPeriodMesgs",
22988
+ fields: {
22989
+ 254: {
22990
+ num: 254,
22991
+ name: "messageIndex",
22992
+ type: "messageIndex",
22993
+ baseType: "uint16",
22994
+ array: false,
22995
+ scale: 1,
22996
+ offset: 0,
22997
+ units: "",
22998
+ bits: [],
22999
+ components: [],
23000
+ isAccumulated: false,
23001
+ hasComponents: false,
23002
+ subFields: []
23003
+ },
23004
+ 253: {
23005
+ num: 253,
23006
+ name: "timestamp",
23007
+ type: "dateTime",
23008
+ baseType: "uint32",
23009
+ array: false,
23010
+ scale: 1,
23011
+ offset: 0,
23012
+ units: "",
23013
+ bits: [],
23014
+ components: [],
23015
+ isAccumulated: false,
23016
+ hasComponents: false,
23017
+ subFields: []
23018
+ },
23019
+ 0: {
23020
+ num: 0,
23021
+ name: "severity",
23022
+ type: "sleepDisruptionSeverity",
23023
+ baseType: "enum",
23024
+ array: false,
23025
+ scale: 1,
23026
+ offset: 0,
23027
+ units: "",
23028
+ bits: [],
23029
+ components: [],
23030
+ isAccumulated: false,
23031
+ hasComponents: false,
23032
+ subFields: []
23033
+ },
23034
+ },
23035
+ },
23036
+ 471: {
23037
+ num: 471,
23038
+ name: "sleepDisruptionOvernightSeverity",
23039
+ messagesKey: "sleepDisruptionOvernightSeverityMesgs",
23040
+ fields: {
23041
+ 253: {
23042
+ num: 253,
23043
+ name: "timestamp",
23044
+ type: "dateTime",
23045
+ baseType: "uint32",
23046
+ array: false,
23047
+ scale: 1,
23048
+ offset: 0,
23049
+ units: "",
23050
+ bits: [],
23051
+ components: [],
23052
+ isAccumulated: false,
23053
+ hasComponents: false,
23054
+ subFields: []
23055
+ },
23056
+ 0: {
23057
+ num: 0,
23058
+ name: "severity",
23059
+ type: "sleepDisruptionSeverity",
23060
+ baseType: "enum",
23061
+ array: false,
23062
+ scale: 1,
23063
+ offset: 0,
23064
+ units: "",
23065
+ bits: [],
23066
+ components: [],
23067
+ isAccumulated: false,
23068
+ hasComponents: false,
23069
+ subFields: []
23070
+ },
23071
+ },
22983
23072
  },
22984
23073
  398: {
22985
23074
  num: 398,
@@ -23216,6 +23305,8 @@ types: {
23216
23305
  393: "diveApneaAlarm",
23217
23306
  398: "skinTempOvernight",
23218
23307
  409: "hsaWristTemperatureData", // Message number for the HSA wrist temperature data message
23308
+ 470: "sleepDisruptionSeverityPeriod",
23309
+ 471: "sleepDisruptionOvernightSeverity",
23219
23310
  0xFF00: "mfgRangeMin", // 0xFF00 - 0xFFFE reserved for manufacturer specific messages
23220
23311
  0xFFFE: "mfgRangeMax", // 0xFF00 - 0xFFFE reserved for manufacturer specific messages
23221
23312
  },
@@ -24271,6 +24362,7 @@ types: {
24271
24362
  333: "tektroRacingProducts",
24272
24363
  334: "daradInnovationCorporation",
24273
24364
  335: "cycloptim",
24365
+ 337: "runna",
24274
24366
  5759: "actigraphcorp",
24275
24367
  },
24276
24368
  garminProduct: {
@@ -24716,9 +24808,11 @@ types: {
24716
24808
  4586: "instinct3Amoled45mm",
24717
24809
  4587: "instinct3Amoled50mm",
24718
24810
  4588: "descentG2",
24811
+ 4603: "venuX1",
24719
24812
  4606: "hrm200",
24720
24813
  4625: "vivoactive6",
24721
24814
  4647: "approachS44",
24815
+ 4655: "edgeMtb",
24722
24816
  4656: "approachS50",
24723
24817
  4666: "fenixE",
24724
24818
  4759: "instinct3Solar50mm",
@@ -27756,6 +27850,12 @@ types: {
27756
27850
  2: "threatApproaching",
27757
27851
  3: "threatApproachingFast",
27758
27852
  },
27853
+ sleepDisruptionSeverity: {
27854
+ 0: "none",
27855
+ 1: "low",
27856
+ 2: "medium",
27857
+ 3: "high",
27858
+ },
27759
27859
  maxMetSpeedSource: {
27760
27860
  0: "onboardGps",
27761
27861
  1: "connectedGps",
@@ -27897,6 +27997,8 @@ MesgNum : {
27897
27997
  TANK_UPDATE: 319,
27898
27998
  TANK_SUMMARY: 323,
27899
27999
  SLEEP_ASSESSMENT: 346,
28000
+ SLEEP_DISRUPTION_SEVERITY_PERIOD: 470,
28001
+ SLEEP_DISRUPTION_OVERNIGHT_SEVERITY: 471,
27900
28002
  SKIN_TEMP_OVERNIGHT: 398,
27901
28003
  PAD: 105,
27902
28004
  }
package/src/stream.js CHANGED
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
 
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12
  import Profile from "./profile.js";
package/src/utils.js CHANGED
@@ -5,8 +5,8 @@
5
5
  // Transfer (FIT) Protocol License.
6
6
  /////////////////////////////////////////////////////////////////////////////////////////////
7
7
  // ****WARNING**** This file is auto-generated! Do NOT edit this file.
8
- // Profile Version = 21.171.0Release
9
- // Tag = production/release/21.171.0-0-g57fed75
8
+ // Profile Version = 21.178.0Release
9
+ // Tag = production/release/21.178.0-0-g3bea629
10
10
  /////////////////////////////////////////////////////////////////////////////////////////////
11
11
 
12
12