11/////////////////////////////////////////////////////////////////////////////////////////////
2- // Copyright 2024 Garmin International, Inc.
2+ // Copyright 2025 Garmin International, Inc.
33// Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License; you
44// may not use this file except in compliance with the Flexible and Interoperable Data
55// Transfer (FIT) Protocol License.
66/////////////////////////////////////////////////////////////////////////////////////////////
77// ****WARNING**** This file is auto-generated! Do NOT edit this file.
8- // Profile Version = 21.158 .0Release
9- // Tag = production/release/21.158 .0-0-gc9428aa
8+ // Profile Version = 21.161 .0Release
9+ // Tag = production/release/21.161 .0-0-g58854c0
1010/////////////////////////////////////////////////////////////////////////////////////////////
1111
1212
@@ -48,6 +48,8 @@ class Decoder {
4848 #decodeMode = DecodeMode . NORMAL ;
4949
5050 #mesgListener = null ;
51+ #mesgDefinitionListener = null ;
52+ #fieldDescriptionListener = null ;
5153 #optExpandSubFields = true ;
5254 #optExpandComponents = true ;
5355 #optApplyScaleAndOffset = true ;
@@ -149,11 +151,28 @@ class Decoder {
149151 * @param {Object } message - The message
150152 */
151153
154+ /**
155+ * Message Definition Listener Callback
156+ *
157+ * @callback Decoder~mesgDefinitionListener
158+ * @param {Object } messageDefinition - The message Definition
159+ */
160+
161+ /**
162+ * Developer Field Description Listener Callback
163+ *
164+ * @callback Decoder~fieldDescriptionListener
165+ * @param {Number } key - The key associated with this pairing of of Developer Data Id and Field Description Mesgs
166+ * @param {Object } developerDataIdMesg - The Developer Data Id Mesg associated with this pairing
167+ * @param {Object } fieldDescriptionMesg - The Field Description Mesg associated with this pairing
168+ */
152169
153170 /**
154171 * Read the messages from the stream.
155172 * @param {Object= } [options] - Read options (optional)
156173 * @param {Decoder~mesgListener } [options.mesgListener=null] - (optional, default null) mesgListener(mesgNum, message)
174+ * @param {Decoder~mesgDefinitionListener } [options.mesgDefinitionListener=null] - (optional, default null) mesgDefinitionListener(mesgDefinition)
175+ * @param {Decoder~fieldDescriptionListener } [options.fieldDescriptionListener=null] - (optional, default null) fieldDescriptionListener(key, developerDataIdMesg, fieldDescriptionMesg)
157176 * @param {Boolean } [options.expandSubFields=true] - (optional, default true)
158177 * @param {Boolean } [options.expandComponents=true] - (optional, default true)
159178 * @param {Boolean } [options.applyScaleAndOffset=true] - (optional, default true)
@@ -167,6 +186,8 @@ class Decoder {
167186 */
168187 read ( {
169188 mesgListener = null ,
189+ mesgDefinitionListener = null ,
190+ fieldDescriptionListener = null ,
170191 expandSubFields = true ,
171192 expandComponents = true ,
172193 applyScaleAndOffset = true ,
@@ -178,6 +199,8 @@ class Decoder {
178199 dataOnly = false , } = { } ) {
179200
180201 this . #mesgListener = mesgListener ;
202+ this . #mesgDefinitionListener = mesgDefinitionListener ;
203+ this . #fieldDescriptionListener = fieldDescriptionListener ;
181204 this . #optExpandSubFields = expandSubFields
182205 this . #optExpandComponents = expandComponents ;
183206 this . #optApplyScaleAndOffset = applyScaleAndOffset ;
@@ -310,6 +333,8 @@ class Decoder {
310333 }
311334 }
312335
336+ this . #mesgDefinitionListener?. ( { ...messageDefinition } ) ;
337+
313338 let messageProfile = Profile . messages [ messageDefinition . globalMessageNumber ] ;
314339
315340 if ( messageProfile == null && this . #optIncludeUnknownData) {
@@ -414,6 +439,14 @@ class Decoder {
414439
415440 this . #messages[ messageDefinition . messagesKey ] . push ( message ) ;
416441 this . #mesgListener?. ( messageDefinition . globalMessageNumber , message ) ;
442+
443+ if ( mesgNum === Profile . MesgNum . FIELD_DESCRIPTION && this . #fieldDescriptionListener != null ) {
444+ const developerDataIdMesg = this . #messages. developerDataIdMesgs ?. find ( ( developerDataIdMesg ) => {
445+ return developerDataIdMesg . developerDataIndex === message . developerDataIndex ;
446+ } ) ?? { } ;
447+
448+ this . #fieldDescriptionListener( message . key , { ...developerDataIdMesg } , { ...message } ) ;
449+ }
417450 }
418451 }
419452
0 commit comments