@garmin/fitsdk 21.161.0 → 21.169.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/package.json +1 -1
- package/src/accumulator.js +2 -2
- package/src/bit-stream.js +2 -2
- package/src/crc-calculator.js +2 -2
- package/src/decoder.js +12 -3
- package/src/encoder.js +4 -4
- package/src/fit.js +2 -2
- package/src/index.js +2 -2
- package/src/mesg-definition.js +7 -6
- package/src/output-stream.js +2 -2
- package/src/profile.js +749 -4
- package/src/stream.js +2 -2
- package/src/utils-hr-mesg.js +2 -2
- package/src/utils-internal.js +20 -2
- package/src/utils-memo-glob.js +65 -0
- package/src/utils.js +2 -2
package/package.json
CHANGED
package/src/accumulator.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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
package/src/crc-calculator.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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
|
@@ -15,6 +15,7 @@ import BitStream from "../src/bit-stream.js";
|
|
|
15
15
|
import CrcCalculator from "./crc-calculator.js";
|
|
16
16
|
import FIT from "./fit.js";
|
|
17
17
|
import HrMesgUtils from "./utils-hr-mesg.js";
|
|
18
|
+
import MemoGlobUtils from "./utils-memo-glob.js";
|
|
18
19
|
import Profile from "./profile.js";
|
|
19
20
|
import Stream from "./stream.js";
|
|
20
21
|
import Utils from "./utils.js";
|
|
@@ -57,6 +58,7 @@ class Decoder {
|
|
|
57
58
|
#optConvertDateTimesToDates = true;
|
|
58
59
|
#optIncludeUnknownData = false;
|
|
59
60
|
#optMergeHeartRates = true;
|
|
61
|
+
#optDecodeMemoGlobs = false;
|
|
60
62
|
|
|
61
63
|
/**
|
|
62
64
|
* Creates a FIT File Decoder
|
|
@@ -179,7 +181,8 @@ class Decoder {
|
|
|
179
181
|
* @param {Boolean} [options.convertTypesToStrings=true] - (optional, default true)
|
|
180
182
|
* @param {boolean} [options.convertDateTimesToDates=true] - (optional, default true)
|
|
181
183
|
* @param {Boolean} [options.includeUnknownData=false] - (optional, default false)
|
|
182
|
-
* @param {boolean} [options.mergeHeartRates=true] - (optional, default
|
|
184
|
+
* @param {boolean} [options.mergeHeartRates=true] - (optional, default true)
|
|
185
|
+
* @param {boolean} [options.decodeMemoGlobs=true] - (optional, default false)
|
|
183
186
|
* @param {boolean} [options.skipHeader=false] - (optional, default false)
|
|
184
187
|
* @param {boolean} [options.dataOnly=false] - (optional, default false)
|
|
185
188
|
* @return {Object} result - {messages:Array, errors:Array}
|
|
@@ -195,6 +198,7 @@ class Decoder {
|
|
|
195
198
|
convertDateTimesToDates = true,
|
|
196
199
|
includeUnknownData = false,
|
|
197
200
|
mergeHeartRates = true,
|
|
201
|
+
decodeMemoGlobs = false,
|
|
198
202
|
skipHeader = false,
|
|
199
203
|
dataOnly = false,} = {}) {
|
|
200
204
|
|
|
@@ -208,6 +212,7 @@ class Decoder {
|
|
|
208
212
|
this.#optConvertDateTimesToDates = convertDateTimesToDates;
|
|
209
213
|
this.#optIncludeUnknownData = includeUnknownData;
|
|
210
214
|
this.#optMergeHeartRates = mergeHeartRates;
|
|
215
|
+
this.#optDecodeMemoGlobs = decodeMemoGlobs;
|
|
211
216
|
|
|
212
217
|
this.#localMessageDefinitions = [];
|
|
213
218
|
this.#developerDataDefinitions = {};
|
|
@@ -233,6 +238,10 @@ class Decoder {
|
|
|
233
238
|
if (this.#optMergeHeartRates) {
|
|
234
239
|
HrMesgUtils.mergeHeartRates(this.#messages.hrMesgs, this.#messages.recordMesgs);
|
|
235
240
|
}
|
|
241
|
+
|
|
242
|
+
if (this.#optDecodeMemoGlobs) {
|
|
243
|
+
MemoGlobUtils.decodeMemoGlobs(this.#messages);
|
|
244
|
+
}
|
|
236
245
|
}
|
|
237
246
|
catch (error) {
|
|
238
247
|
errors.push(error);
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
|
@@ -212,8 +212,8 @@ class Encoder {
|
|
|
212
212
|
throw new Error();
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
const scale =
|
|
216
|
-
const offset =
|
|
215
|
+
const scale = fieldDefinition.components.length > 1 ? 1 : fieldDefinition.scale;
|
|
216
|
+
const offset = fieldDefinition.components.length > 1 ? 0 : fieldDefinition.offset;
|
|
217
217
|
|
|
218
218
|
return (value + offset) * scale;
|
|
219
219
|
}
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
package/src/mesg-definition.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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ import Profile from "./profile.js";
|
|
|
16
16
|
const textEncoder = new TextEncoder();
|
|
17
17
|
|
|
18
18
|
class MesgDefinition {
|
|
19
|
-
|
|
19
|
+
globalMessageNumber;
|
|
20
20
|
localMesgNum;
|
|
21
21
|
fieldDefinitions = [];
|
|
22
22
|
developerFieldDefinitions = [];
|
|
@@ -37,7 +37,7 @@ class MesgDefinition {
|
|
|
37
37
|
throw new Error(`mesgNum: ${mesgNum} could not be found in the Profile`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
this.
|
|
40
|
+
this.globalMessageNumber = mesgNum;
|
|
41
41
|
this.localMesgNum = 0;
|
|
42
42
|
|
|
43
43
|
Object.keys(mesg).forEach((fieldName) => {
|
|
@@ -64,6 +64,7 @@ class MesgDefinition {
|
|
|
64
64
|
type: fieldProfile[1].type,
|
|
65
65
|
scale: fieldProfile[1].scale,
|
|
66
66
|
offset: fieldProfile[1].offset,
|
|
67
|
+
components: fieldProfile[1].components,
|
|
67
68
|
});
|
|
68
69
|
});
|
|
69
70
|
|
|
@@ -121,7 +122,7 @@ class MesgDefinition {
|
|
|
121
122
|
outputStream.writeUInt8(FIT.ARCH_LITTLE_ENDIAN);
|
|
122
123
|
|
|
123
124
|
// Global Message Number
|
|
124
|
-
outputStream.writeUInt16(this.
|
|
125
|
+
outputStream.writeUInt16(this.globalMessageNumber);
|
|
125
126
|
|
|
126
127
|
// Field Count
|
|
127
128
|
outputStream.writeUInt8(this.fieldDefinitions.length);
|
|
@@ -146,7 +147,7 @@ class MesgDefinition {
|
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
equals(other) {
|
|
149
|
-
if (this.
|
|
150
|
+
if (this.globalMesgNumber !== other.globalMesgNumber
|
|
150
151
|
|| this.fieldDefinitions.length !== other.fieldDefinitions.length
|
|
151
152
|
|| this.developerFieldDefinitions.length !== other.developerFieldDefinitions.length) {
|
|
152
153
|
return false;
|
package/src/output-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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|