@garmin/fitsdk 21.168.0 → 21.170.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 +333 -323
- package/src/fit.js +179 -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 +27901 -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 +46 -66
package/src/utils.js
CHANGED
|
@@ -1,66 +1,46 @@
|
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
sint32: 133,
|
|
48
|
-
uint32: 134,
|
|
49
|
-
string: 7,
|
|
50
|
-
float32: 136,
|
|
51
|
-
float64: 137,
|
|
52
|
-
uint8z: 10,
|
|
53
|
-
uint16z: 139,
|
|
54
|
-
uint32z: 140,
|
|
55
|
-
byte: 13,
|
|
56
|
-
sint64: 142,
|
|
57
|
-
uint64: 143,
|
|
58
|
-
uint64z: 144,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
FIT_EPOCH_MS,
|
|
63
|
-
convertDateTimeToDate,
|
|
64
|
-
convertDateToDateTime,
|
|
65
|
-
FitBaseType,
|
|
66
|
-
};
|
|
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.170.0Release
|
|
9
|
+
// Tag = production/release/21.170.0-0-g5991e72
|
|
10
|
+
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import FIT from "./fit.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The millisecond offset between UNIX and FIT Epochs (631065600000).
|
|
17
|
+
* @const {number}
|
|
18
|
+
*/
|
|
19
|
+
const FIT_EPOCH_MS = 631065600000;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Convert a FIT DateTime to a JavaScript Date
|
|
23
|
+
* @param {number} datetime - Seconds since FIT EPOCH
|
|
24
|
+
* @returns {Date} A JavaScript Date object
|
|
25
|
+
*/
|
|
26
|
+
const convertDateTimeToDate = (datetime) => {
|
|
27
|
+
return new Date((datetime ?? 0) * 1000 + FIT_EPOCH_MS);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Convert a JavaScript Date to a FIT DateTime
|
|
32
|
+
* @param {Date} A JavaScript Date object
|
|
33
|
+
* @return {number} datetime - Seconds since FIT EPOCH
|
|
34
|
+
*/
|
|
35
|
+
const convertDateToDateTime = (date) => {
|
|
36
|
+
return (date.getTime() - FIT_EPOCH_MS) / 1000;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
FIT_EPOCH_MS,
|
|
41
|
+
convertDateTimeToDate,
|
|
42
|
+
convertDateToDateTime,
|
|
43
|
+
FitBaseType: FIT.BaseType,
|
|
44
|
+
BaseTypeToFieldType: FIT.BaseTypeToFieldType,
|
|
45
|
+
FieldTypeToBaseType: FIT.FieldTypeToBaseType,
|
|
46
|
+
};
|