@garmin/fitsdk 21.171.0 → 21.188.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 +5 -0
- 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 +27 -14
- package/src/encoder.js +6 -11
- package/src/fit.js +35 -30
- package/src/index.js +2 -2
- package/src/mesg-definition.js +14 -7
- package/src/output-stream.js +2 -2
- package/src/profile.js +118 -6
- package/src/stream.js +2 -2
- package/src/utils-hr-mesg.js +2 -2
- package/src/utils-internal.js +2 -2
- package/src/utils-memo-glob.js +2 -2
- package/src/utils.js +2 -2
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
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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
|
@@ -30,6 +30,7 @@ const LOCAL_MESG_NUM_MASK = 0x0F;
|
|
|
30
30
|
const HEADER_WITH_CRC_SIZE = 14;
|
|
31
31
|
const HEADER_WITHOUT_CRC_SIZE = 12;
|
|
32
32
|
const CRC_SIZE = 2;
|
|
33
|
+
const PROFILE_VERSION_SCALE_CHANGE_VALUE = 2199;
|
|
33
34
|
|
|
34
35
|
const DecodeMode = Object.freeze({
|
|
35
36
|
NORMAL: "normal",
|
|
@@ -43,6 +44,7 @@ class Decoder {
|
|
|
43
44
|
#stream = null;
|
|
44
45
|
#accumulator = new Accumulator();
|
|
45
46
|
#messages = {};
|
|
47
|
+
#profileVersion = null;
|
|
46
48
|
#fieldsWithSubFields = [];
|
|
47
49
|
#fieldsToExpand = [];
|
|
48
50
|
|
|
@@ -200,7 +202,7 @@ class Decoder {
|
|
|
200
202
|
mergeHeartRates = true,
|
|
201
203
|
decodeMemoGlobs = false,
|
|
202
204
|
skipHeader = false,
|
|
203
|
-
dataOnly = false,} = {}) {
|
|
205
|
+
dataOnly = false, } = {}) {
|
|
204
206
|
|
|
205
207
|
this.#mesgListener = mesgListener;
|
|
206
208
|
this.#mesgDefinitionListener = mesgDefinitionListener;
|
|
@@ -217,6 +219,7 @@ class Decoder {
|
|
|
217
219
|
this.#localMessageDefinitions = [];
|
|
218
220
|
this.#developerDataDefinitions = {};
|
|
219
221
|
this.#messages = {};
|
|
222
|
+
this.#profileVersion = null;
|
|
220
223
|
|
|
221
224
|
const errors = [];
|
|
222
225
|
|
|
@@ -247,7 +250,7 @@ class Decoder {
|
|
|
247
250
|
errors.push(error);
|
|
248
251
|
}
|
|
249
252
|
finally {
|
|
250
|
-
return { messages: this.#messages, errors: errors };
|
|
253
|
+
return { messages: this.#messages, profileVersion: this.#profileVersion, errors: errors };
|
|
251
254
|
}
|
|
252
255
|
}
|
|
253
256
|
|
|
@@ -260,7 +263,8 @@ class Decoder {
|
|
|
260
263
|
|
|
261
264
|
this.#stream.crcCalculator = new CrcCalculator();
|
|
262
265
|
|
|
263
|
-
const { headerSize, dataSize } = Decoder.#readFileHeader(this.#stream, { decodeMode: this.#decodeMode });
|
|
266
|
+
const { headerSize, dataSize, profileVersion, } = Decoder.#readFileHeader(this.#stream, { decodeMode: this.#decodeMode });
|
|
267
|
+
this.#profileVersion ??= profileVersion;
|
|
264
268
|
|
|
265
269
|
// Read data messages and definitions
|
|
266
270
|
while (this.#stream.position < (position + headerSize + dataSize)) {
|
|
@@ -313,7 +317,7 @@ class Decoder {
|
|
|
313
317
|
const fieldDefinition = {
|
|
314
318
|
fieldDefinitionNumber: this.#stream.readByte(),
|
|
315
319
|
size: this.#stream.readByte(),
|
|
316
|
-
baseType: this.#stream.readByte()
|
|
320
|
+
baseType: this.#stream.readByte() & FIT.BaseTypeMask,
|
|
317
321
|
};
|
|
318
322
|
|
|
319
323
|
if (!(fieldDefinition.baseType in FIT.BaseTypeDefinitions)) {
|
|
@@ -515,7 +519,7 @@ class Decoder {
|
|
|
515
519
|
this.#developerDataDefinitions[message.developerDataIndex.rawFieldValue].fields.push({
|
|
516
520
|
developerDataIndex: message.developerDataIndex?.rawFieldValue,
|
|
517
521
|
fieldDefinitionNumber: message.fieldDefinitionNumber?.rawFieldValue,
|
|
518
|
-
fitBaseTypeId: message.fitBaseTypeId?.rawFieldValue ?? null,
|
|
522
|
+
fitBaseTypeId: message.fitBaseTypeId?.rawFieldValue & FIT.BaseTypeMask ?? null,
|
|
519
523
|
fieldName: message.fieldName?.rawFieldValue ?? null,
|
|
520
524
|
array: message.array?.rawFieldValue ?? null,
|
|
521
525
|
components: message.components?.rawFieldValue ?? null,
|
|
@@ -729,8 +733,8 @@ class Decoder {
|
|
|
729
733
|
return rawFieldValue;
|
|
730
734
|
}
|
|
731
735
|
|
|
732
|
-
const scale = Array.isArray(field?.scale ??
|
|
733
|
-
const offset = Array.isArray(field?.offset ??
|
|
736
|
+
const scale = Array.isArray(field?.scale ?? FIT.FIELD_DEFAULT_SCALE) ? field?.scale[0] : field?.scale ?? FIT.FIELD_DEFAULT_SCALE;
|
|
737
|
+
const offset = Array.isArray(field?.offset ?? FIT.FIELD_DEFAULT_OFFSET) ? field?.offset[0] : field?.offset ?? FIT.FIELD_DEFAULT_OFFSET;
|
|
734
738
|
|
|
735
739
|
try {
|
|
736
740
|
if (Array.isArray(rawFieldValue)) {
|
|
@@ -799,26 +803,27 @@ class Decoder {
|
|
|
799
803
|
static #readFileHeader(stream, { resetPosition = false, decodeMode = DecodeMode.NORMAL }) {
|
|
800
804
|
const position = stream.position;
|
|
801
805
|
|
|
802
|
-
if(decodeMode !== DecodeMode.NORMAL) {
|
|
803
|
-
if(decodeMode === DecodeMode.SKIP_HEADER) {
|
|
806
|
+
if (decodeMode !== DecodeMode.NORMAL) {
|
|
807
|
+
if (decodeMode === DecodeMode.SKIP_HEADER) {
|
|
804
808
|
stream.seek(HEADER_WITH_CRC_SIZE);
|
|
805
809
|
}
|
|
806
810
|
|
|
807
811
|
const headerSize = decodeMode === DecodeMode.SKIP_HEADER ? HEADER_WITH_CRC_SIZE : 0;
|
|
812
|
+
const dataSize = stream.length - headerSize - CRC_SIZE;
|
|
808
813
|
|
|
809
814
|
return {
|
|
810
815
|
headerSize,
|
|
811
|
-
dataSize
|
|
816
|
+
dataSize,
|
|
812
817
|
};
|
|
813
818
|
}
|
|
814
819
|
|
|
815
820
|
const fileHeader = {
|
|
816
821
|
headerSize: stream.readByte(),
|
|
817
822
|
protocolVersion: stream.readByte(),
|
|
818
|
-
profileVersion: stream.readUInt16(),
|
|
823
|
+
profileVersion: this.#expandProfileVersion(stream.readUInt16()),
|
|
819
824
|
dataSize: stream.readUInt32(),
|
|
820
825
|
dataType: stream.readString(4),
|
|
821
|
-
headerCRC:
|
|
826
|
+
headerCRC: null
|
|
822
827
|
};
|
|
823
828
|
|
|
824
829
|
if (fileHeader.headerSize === 14) {
|
|
@@ -835,6 +840,14 @@ class Decoder {
|
|
|
835
840
|
#throwError(error = "") {
|
|
836
841
|
throw Error(`FIT Runtime Error at byte ${this.#stream.position} ${error}`.trimEnd());
|
|
837
842
|
}
|
|
843
|
+
|
|
844
|
+
static #expandProfileVersion = (profileVersion) => {
|
|
845
|
+
const scale = profileVersion > PROFILE_VERSION_SCALE_CHANGE_VALUE ? 1000 : 100
|
|
846
|
+
return {
|
|
847
|
+
major: Math.floor(profileVersion / scale),
|
|
848
|
+
minor: profileVersion % scale
|
|
849
|
+
}
|
|
850
|
+
}
|
|
838
851
|
}
|
|
839
852
|
|
|
840
853
|
export default Decoder;
|
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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
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
|
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
|
@@ -17,40 +17,42 @@ const BaseType = {
|
|
|
17
17
|
ENUM: 0x00,
|
|
18
18
|
SINT8: 0x01,
|
|
19
19
|
UINT8: 0x02,
|
|
20
|
-
SINT16:
|
|
21
|
-
UINT16:
|
|
22
|
-
SINT32:
|
|
23
|
-
UINT32:
|
|
20
|
+
SINT16: 0x03,
|
|
21
|
+
UINT16: 0x04,
|
|
22
|
+
SINT32: 0x05,
|
|
23
|
+
UINT32: 0x06,
|
|
24
24
|
STRING: 0x07,
|
|
25
|
-
FLOAT32:
|
|
26
|
-
FLOAT64:
|
|
25
|
+
FLOAT32: 0x08,
|
|
26
|
+
FLOAT64: 0x09,
|
|
27
27
|
UINT8Z: 0x0A,
|
|
28
|
-
UINT16Z:
|
|
29
|
-
UINT32Z:
|
|
28
|
+
UINT16Z: 0x0B,
|
|
29
|
+
UINT32Z: 0x0C,
|
|
30
30
|
BYTE: 0x0D,
|
|
31
|
-
SINT64:
|
|
32
|
-
UINT64:
|
|
33
|
-
UINT64Z:
|
|
31
|
+
SINT64: 0x0E,
|
|
32
|
+
UINT64: 0x0F,
|
|
33
|
+
UINT64Z: 0x10
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
const BaseTypeMask = 0x1F;
|
|
37
|
+
|
|
36
38
|
const BaseTypeDefinitions = {
|
|
37
|
-
0x00: { size: 1, type: BaseType.ENUM, invalid: 0xFF },
|
|
38
|
-
0x01: { size: 1, type: BaseType.SINT8, invalid: 0x7F },
|
|
39
|
-
0x02: { size: 1, type: BaseType.UINT8, invalid: 0xFF },
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
0x07: { size: 1, type: BaseType.STRING, invalid: 0x00 },
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
0x0A: { size: 1, type: BaseType.UINT8Z, invalid: 0x00 },
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
0x0D: { size: 1, type: BaseType.BYTE, invalid: 0xFF },
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
0x00: { size: 1, type: BaseType.ENUM, baseTypeEndianFlag: 0x00, invalid: 0xFF },
|
|
40
|
+
0x01: { size: 1, type: BaseType.SINT8, baseTypeEndianFlag: 0x00, invalid: 0x7F },
|
|
41
|
+
0x02: { size: 1, type: BaseType.UINT8, baseTypeEndianFlag: 0x00, invalid: 0xFF },
|
|
42
|
+
0x03: { size: 2, type: BaseType.SINT16, baseTypeEndianFlag: 0x80, invalid: 0x7FFF },
|
|
43
|
+
0x04: { size: 2, type: BaseType.UINT16, baseTypeEndianFlag: 0x80, invalid: 0xFFFF },
|
|
44
|
+
0x05: { size: 4, type: BaseType.SINT32, baseTypeEndianFlag: 0x80, invalid: 0x7FFFFFFF },
|
|
45
|
+
0x06: { size: 4, type: BaseType.UINT32, baseTypeEndianFlag: 0x80, invalid: 0xFFFFFFFF },
|
|
46
|
+
0x07: { size: 1, type: BaseType.STRING, baseTypeEndianFlag: 0x00, invalid: 0x00 },
|
|
47
|
+
0x08: { size: 4, type: BaseType.FLOAT32, baseTypeEndianFlag: 0x80, invalid: 0xFFFFFFFF },
|
|
48
|
+
0x09: { size: 8, type: BaseType.FLOAT64, baseTypeEndianFlag: 0x80, invalid: 0xFFFFFFFFFFFFFFFF },
|
|
49
|
+
0x0A: { size: 1, type: BaseType.UINT8Z, baseTypeEndianFlag: 0x00, invalid: 0x00 },
|
|
50
|
+
0x0B: { size: 2, type: BaseType.UINT16Z, baseTypeEndianFlag: 0x80, invalid: 0x0000 },
|
|
51
|
+
0x0C: { size: 4, type: BaseType.UINT32Z, baseTypeEndianFlag: 0x80, invalid: 0x00000000 },
|
|
52
|
+
0x0D: { size: 1, type: BaseType.BYTE, baseTypeEndianFlag: 0x00, invalid: 0xFF },
|
|
53
|
+
0x0E: { size: 8, type: BaseType.SINT64, baseTypeEndianFlag: 0x80, invalid: 0x7FFFFFFFFFFFFFFF },
|
|
54
|
+
0x0F: { size: 8, type: BaseType.UINT64, baseTypeEndianFlag: 0x80, invalid: 0xFFFFFFFFFFFFFFFF },
|
|
55
|
+
0x10: { size: 8, type: BaseType.UINT64Z, baseTypeEndianFlag: 0x80, invalid: 0x0000000000000000 },
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
const NumericFieldTypes = [
|
|
@@ -158,6 +160,7 @@ const isNumberStringDateOrBoolean = (obj) => {
|
|
|
158
160
|
|
|
159
161
|
export default {
|
|
160
162
|
BaseType,
|
|
163
|
+
BaseTypeMask,
|
|
161
164
|
BaseTypeDefinitions,
|
|
162
165
|
NumericFieldTypes,
|
|
163
166
|
FloatingPointFieldTypes,
|
|
@@ -172,6 +175,8 @@ export default {
|
|
|
172
175
|
isNumberStringDateOrBoolean,
|
|
173
176
|
isNotNumberStringDateOrBoolean,
|
|
174
177
|
MAX_FIELD_SIZE: 255,
|
|
178
|
+
FIELD_DEFAULT_SCALE: 1,
|
|
179
|
+
FIELD_DEFAULT_OFFSET: 0,
|
|
175
180
|
MESG_DEFINITION_MASK: 0x40,
|
|
176
181
|
LOCAL_MESG_NUM_MASK: 0x0F,
|
|
177
182
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
|
@@ -56,14 +56,21 @@ 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,
|
|
70
|
+
baseTypeEndianFlag: baseTypeDef.baseTypeEndianFlag,
|
|
64
71
|
type: fieldProfile[1].type,
|
|
65
|
-
scale
|
|
66
|
-
offset
|
|
72
|
+
scale,
|
|
73
|
+
offset,
|
|
67
74
|
components: fieldProfile[1].components,
|
|
68
75
|
});
|
|
69
76
|
});
|
|
@@ -71,11 +78,11 @@ class MesgDefinition {
|
|
|
71
78
|
Object.keys(mesg.developerFields ?? {})?.sort()?.forEach((key) => {
|
|
72
79
|
const { developerDataIdMesg, fieldDescriptionMesg, } = this.#fieldDescriptionForKey(fieldDescriptions, key);
|
|
73
80
|
|
|
74
|
-
const baseTypeDef = FIT.BaseTypeDefinitions[fieldDescriptionMesg.fitBaseTypeId];
|
|
81
|
+
const baseTypeDef = FIT.BaseTypeDefinitions[fieldDescriptionMesg.fitBaseTypeId & FIT.BaseTypeMask];
|
|
75
82
|
|
|
76
83
|
this.developerFieldDefinitions.push({
|
|
77
84
|
key,
|
|
78
|
-
baseType: fieldDescriptionMesg.fitBaseTypeId,
|
|
85
|
+
baseType: fieldDescriptionMesg.fitBaseTypeId & FIT.BaseTypeMask,
|
|
79
86
|
fieldDefinitionNumber: fieldDescriptionMesg.fieldDefinitionNumber,
|
|
80
87
|
size: this.#fieldSize(mesg.developerFields[key], baseTypeDef),
|
|
81
88
|
developerDataIndex: developerDataIdMesg.developerDataIndex,
|
|
@@ -131,7 +138,7 @@ class MesgDefinition {
|
|
|
131
138
|
this.fieldDefinitions.forEach((fieldDefinition) => {
|
|
132
139
|
outputStream.writeUInt8(fieldDefinition.num);
|
|
133
140
|
outputStream.writeUInt8(fieldDefinition.size);
|
|
134
|
-
outputStream.writeUInt8(fieldDefinition.baseType);
|
|
141
|
+
outputStream.writeUInt8(fieldDefinition.baseType | fieldDefinition.baseTypeEndianFlag);
|
|
135
142
|
});
|
|
136
143
|
|
|
137
144
|
// Developer Field Definitions
|
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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
const Profile = {
|
|
14
14
|
version: {
|
|
15
15
|
major: 21,
|
|
16
|
-
minor:
|
|
16
|
+
minor: 188,
|
|
17
17
|
patch: 0,
|
|
18
18
|
type: "Release"
|
|
19
19
|
},
|
|
@@ -4763,7 +4763,7 @@ const Profile = {
|
|
|
4763
4763
|
subFields: []
|
|
4764
4764
|
},
|
|
4765
4765
|
253: {
|
|
4766
|
-
num: 253,
|
|
4766
|
+
num: 253,
|
|
4767
4767
|
name: "timestamp",
|
|
4768
4768
|
type: "dateTime",
|
|
4769
4769
|
baseType: "uint32",
|
|
@@ -7170,7 +7170,7 @@ const Profile = {
|
|
|
7170
7170
|
subFields: []
|
|
7171
7171
|
},
|
|
7172
7172
|
253: {
|
|
7173
|
-
num: 253,
|
|
7173
|
+
num: 253,
|
|
7174
7174
|
name: "timestamp",
|
|
7175
7175
|
type: "dateTime",
|
|
7176
7176
|
baseType: "uint32",
|
|
@@ -15771,7 +15771,7 @@ const Profile = {
|
|
|
15771
15771
|
subFields: []
|
|
15772
15772
|
},
|
|
15773
15773
|
253: {
|
|
15774
|
-
num: 253,
|
|
15774
|
+
num: 253,
|
|
15775
15775
|
name: "timestamp",
|
|
15776
15776
|
type: "dateTime",
|
|
15777
15777
|
baseType: "uint32",
|
|
@@ -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: {
|
|
@@ -24704,6 +24796,7 @@ types: {
|
|
|
24704
24796
|
4446: "hrmFit",
|
|
24705
24797
|
4472: "marqGen2Commander",
|
|
24706
24798
|
4477: "lilyAthlete", // aka the Lily 2 Active
|
|
24799
|
+
4525: "rallyX10", // Rally 110/210
|
|
24707
24800
|
4532: "fenix8Solar",
|
|
24708
24801
|
4533: "fenix8SolarLarge",
|
|
24709
24802
|
4534: "fenix8Small",
|
|
@@ -24716,14 +24809,25 @@ types: {
|
|
|
24716
24809
|
4586: "instinct3Amoled45mm",
|
|
24717
24810
|
4587: "instinct3Amoled50mm",
|
|
24718
24811
|
4588: "descentG2",
|
|
24812
|
+
4603: "venuX1",
|
|
24719
24813
|
4606: "hrm200",
|
|
24720
24814
|
4625: "vivoactive6",
|
|
24815
|
+
4631: "fenix8Pro",
|
|
24816
|
+
4633: "edge550",
|
|
24817
|
+
4634: "edge850",
|
|
24818
|
+
4643: "venu4",
|
|
24819
|
+
4644: "venu4s",
|
|
24721
24820
|
4647: "approachS44",
|
|
24821
|
+
4655: "edgeMtb",
|
|
24722
24822
|
4656: "approachS50",
|
|
24723
24823
|
4666: "fenixE",
|
|
24824
|
+
4745: "bounce2",
|
|
24724
24825
|
4759: "instinct3Solar50mm",
|
|
24725
24826
|
4775: "tactix8Amoled",
|
|
24726
24827
|
4776: "tactix8Solar",
|
|
24828
|
+
4879: "d2Mach2",
|
|
24829
|
+
4678: "instinctCrossoverAmoled",
|
|
24830
|
+
4944: "d2AirX15",
|
|
24727
24831
|
10007: "sdm4", // SDM4 footpod
|
|
24728
24832
|
10014: "edgeRemote",
|
|
24729
24833
|
20533: "tacxTrainingAppWin",
|
|
@@ -27756,6 +27860,12 @@ types: {
|
|
|
27756
27860
|
2: "threatApproaching",
|
|
27757
27861
|
3: "threatApproachingFast",
|
|
27758
27862
|
},
|
|
27863
|
+
sleepDisruptionSeverity: {
|
|
27864
|
+
0: "none",
|
|
27865
|
+
1: "low",
|
|
27866
|
+
2: "medium",
|
|
27867
|
+
3: "high",
|
|
27868
|
+
},
|
|
27759
27869
|
maxMetSpeedSource: {
|
|
27760
27870
|
0: "onboardGps",
|
|
27761
27871
|
1: "connectedGps",
|
|
@@ -27897,6 +28007,8 @@ MesgNum : {
|
|
|
27897
28007
|
TANK_UPDATE: 319,
|
|
27898
28008
|
TANK_SUMMARY: 323,
|
|
27899
28009
|
SLEEP_ASSESSMENT: 346,
|
|
28010
|
+
SLEEP_DISRUPTION_SEVERITY_PERIOD: 470,
|
|
28011
|
+
SLEEP_DISRUPTION_OVERNIGHT_SEVERITY: 471,
|
|
27900
28012
|
SKIN_TEMP_OVERNIGHT: 398,
|
|
27901
28013
|
PAD: 105,
|
|
27902
28014
|
}
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
package/src/utils-hr-mesg.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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
package/src/utils-internal.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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|
package/src/utils-memo-glob.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.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
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.
|
|
9
|
-
// Tag = production/release/21.
|
|
8
|
+
// Profile Version = 21.188.0Release
|
|
9
|
+
// Tag = production/release/21.188.0-0-g55050f8
|
|
10
10
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
12
|
|