@garmin/fitsdk 21.168.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/LICENSE.txt +338 -338
- package/package.json +23 -23
- package/src/accumulator.js +58 -58
- package/src/bit-stream.js +85 -85
- package/src/crc-calculator.js +55 -55
- package/src/decoder.js +839 -839
- package/src/encoder.js +323 -323
- package/src/fit.js +170 -170
- package/src/index.js +20 -20
- package/src/mesg-definition.js +270 -270
- package/src/output-stream.js +220 -220
- package/src/profile.js +27999 -27999
- package/src/stream.js +258 -258
- package/src/utils-hr-mesg.js +174 -174
- package/src/utils-internal.js +53 -53
- package/src/utils-memo-glob.js +64 -64
- package/src/utils.js +66 -66
package/src/fit.js
CHANGED
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright 2025 Garmin International, Inc.
|
|
3
|
-
// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
|
|
4
|
-
// may not use this file except in compliance with the Flexible and Interoperable Data
|
|
5
|
-
// Transfer (FIT) Protocol License.
|
|
6
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
7
|
-
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
|
|
8
|
-
// Profile Version = 21.
|
|
9
|
-
// Tag = production/release/21.
|
|
10
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const BaseType = {
|
|
14
|
-
ENUM: 0x00,
|
|
15
|
-
SINT8: 0x01,
|
|
16
|
-
UINT8: 0x02,
|
|
17
|
-
SINT16: 0x83,
|
|
18
|
-
UINT16: 0x84,
|
|
19
|
-
SINT32: 0x85,
|
|
20
|
-
UINT32: 0x86,
|
|
21
|
-
STRING: 0x07,
|
|
22
|
-
FLOAT32: 0x88,
|
|
23
|
-
FLOAT64: 0x89,
|
|
24
|
-
UINT8Z: 0x0A,
|
|
25
|
-
UINT16Z: 0x8B,
|
|
26
|
-
UINT32Z: 0x8C,
|
|
27
|
-
BYTE: 0x0D,
|
|
28
|
-
SINT64: 0x8E,
|
|
29
|
-
UINT64: 0x8F,
|
|
30
|
-
UINT64Z: 0x90
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const BaseTypeDefinitions = {
|
|
34
|
-
0x00: { size: 1, type: BaseType.ENUM, invalid: 0xFF },
|
|
35
|
-
0x01: { size: 1, type: BaseType.SINT8, invalid: 0x7F },
|
|
36
|
-
0x02: { size: 1, type: BaseType.UINT8, invalid: 0xFF },
|
|
37
|
-
0x83: { size: 2, type: BaseType.SINT16, invalid: 0x7FFF },
|
|
38
|
-
0x84: { size: 2, type: BaseType.UINT16, invalid: 0xFFFF },
|
|
39
|
-
0x85: { size: 4, type: BaseType.SINT32, invalid: 0x7FFFFFFF },
|
|
40
|
-
0x86: { size: 4, type: BaseType.UINT32, invalid: 0xFFFFFFFF },
|
|
41
|
-
0x07: { size: 1, type: BaseType.STRING, invalid: 0x00 },
|
|
42
|
-
0x88: { size: 4, type: BaseType.FLOAT32, invalid: 0xFFFFFFFF },
|
|
43
|
-
0x89: { size: 8, type: BaseType.FLOAT64, invalid: 0xFFFFFFFFFFFFFFFF },
|
|
44
|
-
0x0A: { size: 1, type: BaseType.UINT8Z, invalid: 0x00 },
|
|
45
|
-
0x8B: { size: 2, type: BaseType.UINT16Z, invalid: 0x0000 },
|
|
46
|
-
0x8C: { size: 4, type: BaseType.UINT32Z, invalid: 0x00000000 },
|
|
47
|
-
0x0D: { size: 1, type: BaseType.BYTE, invalid: 0xFF },
|
|
48
|
-
0x8E: { size: 8, type: BaseType.SINT64, invalid: 0x7FFFFFFFFFFFFFFF },
|
|
49
|
-
0x8F: { size: 8, type: BaseType.UINT64, invalid: 0xFFFFFFFFFFFFFFFF },
|
|
50
|
-
0x90: { size: 8, type: BaseType.UINT64Z, invalid: 0x0000000000000000 },
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const NumericFieldTypes = [
|
|
54
|
-
"sint8",
|
|
55
|
-
"uint8",
|
|
56
|
-
"sint16",
|
|
57
|
-
"uint16",
|
|
58
|
-
"sint32",
|
|
59
|
-
"uint32",
|
|
60
|
-
"float32",
|
|
61
|
-
"float64",
|
|
62
|
-
"uint8z",
|
|
63
|
-
"uint16z",
|
|
64
|
-
"uint32z",
|
|
65
|
-
"byte",
|
|
66
|
-
"sint64",
|
|
67
|
-
"uint64",
|
|
68
|
-
"uint64z"
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
const FieldTypeToBaseType = {
|
|
72
|
-
"enum": BaseType.UINT8,
|
|
73
|
-
"sint8": BaseType.SINT8,
|
|
74
|
-
"uint8": BaseType.UINT8,
|
|
75
|
-
"sint16": BaseType.SINT16,
|
|
76
|
-
"uint16": BaseType.UINT16,
|
|
77
|
-
"sint32": BaseType.SINT32,
|
|
78
|
-
"uint32": BaseType.UINT32,
|
|
79
|
-
"string": BaseType.STRING,
|
|
80
|
-
"float32": BaseType.FLOAT32,
|
|
81
|
-
"float64": BaseType.FLOAT64,
|
|
82
|
-
"uint8z": BaseType.UINT8Z,
|
|
83
|
-
"uint16z": BaseType.UINT16Z,
|
|
84
|
-
"uint32z": BaseType.UINT32Z,
|
|
85
|
-
"byte": BaseType.BYTE,
|
|
86
|
-
"sint64": BaseType.SINT64,
|
|
87
|
-
"uint64": BaseType.UINT64,
|
|
88
|
-
"uint64z": BaseType.UINT64Z
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const BaseTypeToFieldType = {
|
|
92
|
-
[BaseType.ENUM]: "enum",
|
|
93
|
-
[BaseType.SINT8]: "sint8",
|
|
94
|
-
[BaseType.UINT8]: "uint8",
|
|
95
|
-
[BaseType.SINT16]: "sint16",
|
|
96
|
-
[BaseType.UINT16]: "uint16",
|
|
97
|
-
[BaseType.SINT32]: "sint32",
|
|
98
|
-
[BaseType.UINT32]: "uint32",
|
|
99
|
-
[BaseType.STRING]: "string",
|
|
100
|
-
[BaseType.FLOAT32]: "float32",
|
|
101
|
-
[BaseType.FLOAT64]: "float64",
|
|
102
|
-
[BaseType.UINT8Z]: "uint8z",
|
|
103
|
-
[BaseType.UINT16Z]: "uint16z",
|
|
104
|
-
[BaseType.UINT32Z]: "uint32z",
|
|
105
|
-
[BaseType.BYTE]: "byte",
|
|
106
|
-
[BaseType.SINT64]: "sint64",
|
|
107
|
-
[BaseType.UINT64]: "uint64",
|
|
108
|
-
[BaseType.UINT64Z]: "uint64z",
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const isNullOrUndefined = (obj) => {
|
|
112
|
-
return obj == null;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const isObject = (obj) => {
|
|
116
|
-
return typeof obj === "object";
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const isBoolean = (obj) => {
|
|
120
|
-
return "boolean" === typeof obj;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const isDate = (obj) => {
|
|
124
|
-
return typeof obj === "object" && obj instanceof Date;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const isString = (obj) => {
|
|
128
|
-
return typeof obj === "string";
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const isNumeric = (obj) => {
|
|
132
|
-
return !isNaN(parseFloat(obj)) && isFinite(obj);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const isNotNumberStringDateOrBoolean = (obj) => {
|
|
136
|
-
return !isNumberStringDateOrBoolean(obj);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const isNumberStringDateOrBoolean = (obj) => {
|
|
140
|
-
if (isNullOrUndefined(obj)) {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (!isDate(obj) && !isString(obj) && !isNumeric(obj) && !isBoolean(obj)) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return true;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export default {
|
|
152
|
-
BaseType,
|
|
153
|
-
BaseTypeDefinitions,
|
|
154
|
-
NumericFieldTypes,
|
|
155
|
-
FieldTypeToBaseType,
|
|
156
|
-
BaseTypeToFieldType,
|
|
157
|
-
isNullOrUndefined,
|
|
158
|
-
isObject,
|
|
159
|
-
isBoolean,
|
|
160
|
-
isDate,
|
|
161
|
-
isString,
|
|
162
|
-
isNumeric,
|
|
163
|
-
isNumberStringDateOrBoolean,
|
|
164
|
-
isNotNumberStringDateOrBoolean,
|
|
165
|
-
MAX_FIELD_SIZE: 255,
|
|
166
|
-
MESG_DEFINITION_MASK: 0x40,
|
|
167
|
-
LOCAL_MESG_NUM_MASK: 0x0F,
|
|
168
|
-
ARCH_LITTLE_ENDIAN: 0x00,
|
|
169
|
-
DEV_DATA_MASK: 0x20,
|
|
170
|
-
};
|
|
1
|
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright 2025 Garmin International, Inc.
|
|
3
|
+
// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
|
|
4
|
+
// may not use this file except in compliance with the Flexible and Interoperable Data
|
|
5
|
+
// Transfer (FIT) Protocol License.
|
|
6
|
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
7
|
+
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
|
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const BaseType = {
|
|
14
|
+
ENUM: 0x00,
|
|
15
|
+
SINT8: 0x01,
|
|
16
|
+
UINT8: 0x02,
|
|
17
|
+
SINT16: 0x83,
|
|
18
|
+
UINT16: 0x84,
|
|
19
|
+
SINT32: 0x85,
|
|
20
|
+
UINT32: 0x86,
|
|
21
|
+
STRING: 0x07,
|
|
22
|
+
FLOAT32: 0x88,
|
|
23
|
+
FLOAT64: 0x89,
|
|
24
|
+
UINT8Z: 0x0A,
|
|
25
|
+
UINT16Z: 0x8B,
|
|
26
|
+
UINT32Z: 0x8C,
|
|
27
|
+
BYTE: 0x0D,
|
|
28
|
+
SINT64: 0x8E,
|
|
29
|
+
UINT64: 0x8F,
|
|
30
|
+
UINT64Z: 0x90
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const BaseTypeDefinitions = {
|
|
34
|
+
0x00: { size: 1, type: BaseType.ENUM, invalid: 0xFF },
|
|
35
|
+
0x01: { size: 1, type: BaseType.SINT8, invalid: 0x7F },
|
|
36
|
+
0x02: { size: 1, type: BaseType.UINT8, invalid: 0xFF },
|
|
37
|
+
0x83: { size: 2, type: BaseType.SINT16, invalid: 0x7FFF },
|
|
38
|
+
0x84: { size: 2, type: BaseType.UINT16, invalid: 0xFFFF },
|
|
39
|
+
0x85: { size: 4, type: BaseType.SINT32, invalid: 0x7FFFFFFF },
|
|
40
|
+
0x86: { size: 4, type: BaseType.UINT32, invalid: 0xFFFFFFFF },
|
|
41
|
+
0x07: { size: 1, type: BaseType.STRING, invalid: 0x00 },
|
|
42
|
+
0x88: { size: 4, type: BaseType.FLOAT32, invalid: 0xFFFFFFFF },
|
|
43
|
+
0x89: { size: 8, type: BaseType.FLOAT64, invalid: 0xFFFFFFFFFFFFFFFF },
|
|
44
|
+
0x0A: { size: 1, type: BaseType.UINT8Z, invalid: 0x00 },
|
|
45
|
+
0x8B: { size: 2, type: BaseType.UINT16Z, invalid: 0x0000 },
|
|
46
|
+
0x8C: { size: 4, type: BaseType.UINT32Z, invalid: 0x00000000 },
|
|
47
|
+
0x0D: { size: 1, type: BaseType.BYTE, invalid: 0xFF },
|
|
48
|
+
0x8E: { size: 8, type: BaseType.SINT64, invalid: 0x7FFFFFFFFFFFFFFF },
|
|
49
|
+
0x8F: { size: 8, type: BaseType.UINT64, invalid: 0xFFFFFFFFFFFFFFFF },
|
|
50
|
+
0x90: { size: 8, type: BaseType.UINT64Z, invalid: 0x0000000000000000 },
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const NumericFieldTypes = [
|
|
54
|
+
"sint8",
|
|
55
|
+
"uint8",
|
|
56
|
+
"sint16",
|
|
57
|
+
"uint16",
|
|
58
|
+
"sint32",
|
|
59
|
+
"uint32",
|
|
60
|
+
"float32",
|
|
61
|
+
"float64",
|
|
62
|
+
"uint8z",
|
|
63
|
+
"uint16z",
|
|
64
|
+
"uint32z",
|
|
65
|
+
"byte",
|
|
66
|
+
"sint64",
|
|
67
|
+
"uint64",
|
|
68
|
+
"uint64z"
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const FieldTypeToBaseType = {
|
|
72
|
+
"enum": BaseType.UINT8,
|
|
73
|
+
"sint8": BaseType.SINT8,
|
|
74
|
+
"uint8": BaseType.UINT8,
|
|
75
|
+
"sint16": BaseType.SINT16,
|
|
76
|
+
"uint16": BaseType.UINT16,
|
|
77
|
+
"sint32": BaseType.SINT32,
|
|
78
|
+
"uint32": BaseType.UINT32,
|
|
79
|
+
"string": BaseType.STRING,
|
|
80
|
+
"float32": BaseType.FLOAT32,
|
|
81
|
+
"float64": BaseType.FLOAT64,
|
|
82
|
+
"uint8z": BaseType.UINT8Z,
|
|
83
|
+
"uint16z": BaseType.UINT16Z,
|
|
84
|
+
"uint32z": BaseType.UINT32Z,
|
|
85
|
+
"byte": BaseType.BYTE,
|
|
86
|
+
"sint64": BaseType.SINT64,
|
|
87
|
+
"uint64": BaseType.UINT64,
|
|
88
|
+
"uint64z": BaseType.UINT64Z
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const BaseTypeToFieldType = {
|
|
92
|
+
[BaseType.ENUM]: "enum",
|
|
93
|
+
[BaseType.SINT8]: "sint8",
|
|
94
|
+
[BaseType.UINT8]: "uint8",
|
|
95
|
+
[BaseType.SINT16]: "sint16",
|
|
96
|
+
[BaseType.UINT16]: "uint16",
|
|
97
|
+
[BaseType.SINT32]: "sint32",
|
|
98
|
+
[BaseType.UINT32]: "uint32",
|
|
99
|
+
[BaseType.STRING]: "string",
|
|
100
|
+
[BaseType.FLOAT32]: "float32",
|
|
101
|
+
[BaseType.FLOAT64]: "float64",
|
|
102
|
+
[BaseType.UINT8Z]: "uint8z",
|
|
103
|
+
[BaseType.UINT16Z]: "uint16z",
|
|
104
|
+
[BaseType.UINT32Z]: "uint32z",
|
|
105
|
+
[BaseType.BYTE]: "byte",
|
|
106
|
+
[BaseType.SINT64]: "sint64",
|
|
107
|
+
[BaseType.UINT64]: "uint64",
|
|
108
|
+
[BaseType.UINT64Z]: "uint64z",
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const isNullOrUndefined = (obj) => {
|
|
112
|
+
return obj == null;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const isObject = (obj) => {
|
|
116
|
+
return typeof obj === "object";
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const isBoolean = (obj) => {
|
|
120
|
+
return "boolean" === typeof obj;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const isDate = (obj) => {
|
|
124
|
+
return typeof obj === "object" && obj instanceof Date;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const isString = (obj) => {
|
|
128
|
+
return typeof obj === "string";
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const isNumeric = (obj) => {
|
|
132
|
+
return !isNaN(parseFloat(obj)) && isFinite(obj);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const isNotNumberStringDateOrBoolean = (obj) => {
|
|
136
|
+
return !isNumberStringDateOrBoolean(obj);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const isNumberStringDateOrBoolean = (obj) => {
|
|
140
|
+
if (isNullOrUndefined(obj)) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!isDate(obj) && !isString(obj) && !isNumeric(obj) && !isBoolean(obj)) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return true;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export default {
|
|
152
|
+
BaseType,
|
|
153
|
+
BaseTypeDefinitions,
|
|
154
|
+
NumericFieldTypes,
|
|
155
|
+
FieldTypeToBaseType,
|
|
156
|
+
BaseTypeToFieldType,
|
|
157
|
+
isNullOrUndefined,
|
|
158
|
+
isObject,
|
|
159
|
+
isBoolean,
|
|
160
|
+
isDate,
|
|
161
|
+
isString,
|
|
162
|
+
isNumeric,
|
|
163
|
+
isNumberStringDateOrBoolean,
|
|
164
|
+
isNotNumberStringDateOrBoolean,
|
|
165
|
+
MAX_FIELD_SIZE: 255,
|
|
166
|
+
MESG_DEFINITION_MASK: 0x40,
|
|
167
|
+
LOCAL_MESG_NUM_MASK: 0x0F,
|
|
168
|
+
ARCH_LITTLE_ENDIAN: 0x00,
|
|
169
|
+
DEV_DATA_MASK: 0x20,
|
|
170
|
+
};
|
package/src/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright 2025 Garmin International, Inc.
|
|
3
|
-
// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
|
|
4
|
-
// may not use this file except in compliance with the Flexible and Interoperable Data
|
|
5
|
-
// Transfer (FIT) Protocol License.
|
|
6
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
7
|
-
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
|
|
8
|
-
// Profile Version = 21.
|
|
9
|
-
// Tag = production/release/21.
|
|
10
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import CrcCalculator from "./crc-calculator.js";
|
|
14
|
-
import Decoder from "./decoder.js";
|
|
15
|
-
import Encoder from "./encoder.js";
|
|
16
|
-
import Profile from "./profile.js";
|
|
17
|
-
import Stream from "./stream.js";
|
|
18
|
-
import Utils from "./utils.js";
|
|
19
|
-
|
|
20
|
-
export { CrcCalculator, Decoder, Encoder, Stream, Profile, Utils };
|
|
1
|
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright 2025 Garmin International, Inc.
|
|
3
|
+
// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
|
|
4
|
+
// may not use this file except in compliance with the Flexible and Interoperable Data
|
|
5
|
+
// Transfer (FIT) Protocol License.
|
|
6
|
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
7
|
+
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
|
|
8
|
+
// Profile Version = 21.169.0Release
|
|
9
|
+
// Tag = production/release/21.169.0-0-g7105132
|
|
10
|
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import CrcCalculator from "./crc-calculator.js";
|
|
14
|
+
import Decoder from "./decoder.js";
|
|
15
|
+
import Encoder from "./encoder.js";
|
|
16
|
+
import Profile from "./profile.js";
|
|
17
|
+
import Stream from "./stream.js";
|
|
18
|
+
import Utils from "./utils.js";
|
|
19
|
+
|
|
20
|
+
export { CrcCalculator, Decoder, Encoder, Stream, Profile, Utils };
|