Skip to content

Commit f9df9b4

Browse files
authored
Garmin FIT SDK 0.99.00
Fix for when the bytes written for a field value is not a multiple of the base type size.
1 parent 2dfe805 commit f9df9b4

File tree

14 files changed

+148
-52
lines changed

14 files changed

+148
-52
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@garmin-fit/sdk",
3-
"version": "0.94.1",
4-
"description": "FIT Node SDK",
3+
"version": "0.99.0",
4+
"description": "FIT JavaScript SDK",
55
"main": "src/index.js",
66
"type": "module",
77
"scripts": {
@@ -24,4 +24,4 @@
2424
"jest": {
2525
"transform": {}
2626
}
27-
}
27+
}

src/accumulator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/bit-stream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/crc-calculator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/decoder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/fit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

src/profile.js

Lines changed: 93 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

1313
const Profile = {
1414
version: {
1515
major: 21,
16-
minor: 94,
16+
minor: 99,
1717
patch: 0,
1818
type: "Release"
1919
},
@@ -12752,13 +12752,13 @@ const Profile = {
1275212752
name: "altitude",
1275312753
type: "uint16",
1275412754
array: "false",
12755-
scale: 5,
12756-
offset: 500,
12757-
units: "m",
12758-
bits: [],
12759-
components: [],
12755+
scale: [5, ],
12756+
offset: [500, ],
12757+
units: ["m", ],
12758+
bits: [16,],
12759+
components: ["6", ],
1276012760
isAccumulated: false,
12761-
hasComponents: false,
12761+
hasComponents: true,
1276212762
subFields: []
1276312763
},
1276412764
5: {
@@ -12775,6 +12775,20 @@ const Profile = {
1277512775
hasComponents: false,
1277612776
subFields: []
1277712777
},
12778+
6: {
12779+
num: 6, // Accumulated altitude along the segment at the described point
12780+
name: "enhancedAltitude",
12781+
type: "uint32",
12782+
array: "false",
12783+
scale: 5,
12784+
offset: 500,
12785+
units: "m",
12786+
bits: [],
12787+
components: [],
12788+
isAccumulated: false,
12789+
hasComponents: false,
12790+
subFields: []
12791+
},
1277812792
},
1277912793
},
1278012794
142: {
@@ -13305,27 +13319,27 @@ const Profile = {
1330513319
name: "avgAltitude",
1330613320
type: "uint16",
1330713321
array: "false",
13308-
scale: 5,
13309-
offset: 500,
13310-
units: "m",
13311-
bits: [],
13312-
components: [],
13322+
scale: [5, ],
13323+
offset: [500, ],
13324+
units: ["m", ],
13325+
bits: [16,],
13326+
components: ["91", ],
1331313327
isAccumulated: false,
13314-
hasComponents: false,
13328+
hasComponents: true,
1331513329
subFields: []
1331613330
},
1331713331
35: {
1331813332
num: 35,
1331913333
name: "maxAltitude",
1332013334
type: "uint16",
1332113335
array: "false",
13322-
scale: 5,
13323-
offset: 500,
13324-
units: "m",
13325-
bits: [],
13326-
components: [],
13336+
scale: [5, ],
13337+
offset: [500, ],
13338+
units: ["m", ],
13339+
bits: [16,],
13340+
components: ["92", ],
1332713341
isAccumulated: false,
13328-
hasComponents: false,
13342+
hasComponents: true,
1332913343
subFields: []
1333013344
},
1333113345
36: {
@@ -13585,13 +13599,13 @@ const Profile = {
1358513599
name: "minAltitude",
1358613600
type: "uint16",
1358713601
array: "false",
13588-
scale: 5,
13589-
offset: 500,
13590-
units: "m",
13591-
bits: [],
13592-
components: [],
13602+
scale: [5, ],
13603+
offset: [500, ],
13604+
units: ["m", ],
13605+
bits: [16,],
13606+
components: ["93", ],
1359313607
isAccumulated: false,
13594-
hasComponents: false,
13608+
hasComponents: true,
1359513609
subFields: []
1359613610
},
1359713611
55: {
@@ -14084,6 +14098,48 @@ const Profile = {
1408414098
hasComponents: false,
1408514099
subFields: []
1408614100
},
14101+
91: {
14102+
num: 91,
14103+
name: "enhancedAvgAltitude",
14104+
type: "uint32",
14105+
array: "false",
14106+
scale: 5,
14107+
offset: 500,
14108+
units: "m",
14109+
bits: [],
14110+
components: [],
14111+
isAccumulated: false,
14112+
hasComponents: false,
14113+
subFields: []
14114+
},
14115+
92: {
14116+
num: 92,
14117+
name: "enhancedMaxAltitude",
14118+
type: "uint32",
14119+
array: "false",
14120+
scale: 5,
14121+
offset: 500,
14122+
units: "m",
14123+
bits: [],
14124+
components: [],
14125+
isAccumulated: false,
14126+
hasComponents: false,
14127+
subFields: []
14128+
},
14129+
93: {
14130+
num: 93,
14131+
name: "enhancedMinAltitude",
14132+
type: "uint32",
14133+
array: "false",
14134+
scale: 5,
14135+
offset: 500,
14136+
units: "m",
14137+
bits: [],
14138+
components: [],
14139+
isAccumulated: false,
14140+
hasComponents: false,
14141+
subFields: []
14142+
},
1408714143
},
1408814144
},
1408914145
151: {
@@ -18028,6 +18084,7 @@ types: {
1802818084
47: "boxing",
1802918085
48: "floorClimbing",
1803018086
53: "diving",
18087+
64: "racket",
1803118088
254: "all", // All is for goals only to include all sports.
1803218089
},
1803318090
sportBits0: {
@@ -18159,6 +18216,8 @@ types: {
1815918216
67: "ultra", // Ultramarathon
1816018217
68: "indoorClimbing", // Climbing
1816118218
69: "bouldering", // Climbing
18219+
84: "pickleball", // Racket
18220+
85: "padel", // Racket
1816218221
254: "all",
1816318222
},
1816418223
sportEvent: {
@@ -18596,6 +18655,7 @@ types: {
1859618655
142: "tagHeuer",
1859718656
143: "keiserFitness",
1859818657
144: "zwiftByte",
18658+
145: "porscheEp",
1859918659
255: "development",
1860018660
257: "healthandlife",
1860118661
258: "lezyne",
@@ -18660,8 +18720,9 @@ types: {
1866018720
317: "raceRepublic",
1866118721
318: "fazua",
1866218722
319: "orekaTraining",
18663-
320: "isec", // Lishun Electric & Communication
18723+
320: "lsec", // Lishun Electric & Communication
1866418724
321: "lululemonStudio",
18725+
322: "shanyue",
1866518726
5759: "actigraphcorp",
1866618727
},
1866718728
garminProduct: {
@@ -19032,12 +19093,15 @@ types: {
1903219093
4033: "fr55Asia",
1903319094
4063: "vivosmart5",
1903419095
4071: "instinct2Asia",
19096+
4105: "marqGen2", // Adventurer, Athlete, Captain, Golfer
1903519097
4115: "venusq2",
1903619098
4116: "venusq2music",
19099+
4124: "marqGen2Aviator",
1903719100
4125: "d2AirX10",
1903819101
4130: "hrmProPlus",
1903919102
4132: "descentG1Asia",
1904019103
4135: "tactix7",
19104+
4155: "instinctCrossover",
1904119105
4169: "edgeExplore2",
1904219106
4265: "tacxNeoSmart", // Neo Smart, Tacx
1904319107
4266: "tacxNeo2Smart", // Neo 2 Smart, Tacx
@@ -19140,6 +19204,7 @@ types: {
1914019204
0x00000100: "training",
1914119205
0x00000200: "navigation",
1914219206
0x00000400: "bikeway",
19207+
0x00001000: "aviation", // Denote course files to be used as flight plans
1914319208
},
1914419209
weight: {
1914519210
0xFFFE: "calculating",

src/stream.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

@@ -169,7 +169,10 @@ class Stream {
169169
const baseTypeInvalid = FIT.BaseTypeDefinitions[baseType].invalid;
170170

171171
const arrayBuffer = this.readBytes(size);
172-
const count = size / baseTypeSize;
172+
173+
if (size % baseTypeSize !== 0) {
174+
return convertInvalidToNull ? null : baseTypeInvalid;
175+
}
173176

174177
if (baseType === FIT.BaseType.STRING) {
175178
const string = this.#textDecoder.decode(arrayBuffer).replace(/\uFFFD/g, "");
@@ -189,6 +192,8 @@ class Stream {
189192
const dataView = new DataView(arrayBuffer);
190193
let values = [];
191194

195+
const count = size / baseTypeSize;
196+
192197
for (let i = 0; i < count; i++) {
193198

194199
switch (baseType) {

src/utils-hr-mesg.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Transfer (FIT) Protocol License.
66
/////////////////////////////////////////////////////////////////////////////////////////////
77
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8-
// Profile Version = 21.94Release
9-
// Tag = production/akw/21.94.00-0-g0f668193
8+
// Profile Version = 21.99Release
9+
// Tag = production/release/21.99.00-0-gb5b0e7a
1010
/////////////////////////////////////////////////////////////////////////////////////////////
1111

1212

0 commit comments

Comments
 (0)