This project aims to provide a TypeScript implementation of the Garmin FIT protocol. The current code base only contains a handful of utility classes and a partial FileEncoder. Below is a roadmap describing every task required to reach a publishable SDK.
- Basic utilities (
CRC16,Fit,ProtocolVersion) - Basic
FileEncoderskeleton -
FileDecoderimplementation - Streaming classes (
InputStream,OutputStream,DataInputStream,DataOutputStream,OutputStreamWriter) - Numeric helpers (
BigInteger,BigDecimal) - Field helpers (
FieldComponent,DeveloperField,DeveloperFieldDefinition,DeveloperDataIdMesg) - Complete message class implementations (see list below)
- Tests for each component
- Continuous integration & npm packaging
The repository currently lacks many classes required by the FIT specification. Below is an exhaustive list extracted from the protocol documentation and code references.
FileDecoder(implemented)BigInteger(implemented)BigDecimal(implemented)FieldComponent(implemented)DeveloperField(implemented)DeveloperDataIdMesg(implemented)FitBaseType(implemented)FitBaseUnit(implemented)
The following FIT messages require dedicated classes. All of them are present in the repository:
- FileIdMesg
- CapabilitiesMesg
- DeviceSettingsMesg
- UserProfileMesg
- HrmProfileMesg
- SdmProfileMesg
- BikeProfileMesg
- ZonesTargetMesg
- HrZoneMesg
- PowerZoneMesg
- MetZoneMesg
- SportMesg
- GoalMesg
- SessionMesg
- LapMesg
- RecordMesg
- EventMesg
- DeviceInfoMesg
- WorkoutMesg
- WorkoutStepMesg
- ScheduleMesg
- WeightScaleMesg
- CourseMesg
- CoursePointMesg
- TotalsMesg
- ActivityMesg
- SoftwareMesg
- FileCapabilitiesMesg
- MesgCapabilitiesMesg
- FieldCapabilitiesMesg
- FileCreatorMesg
- BloodPressureMesg
- SpeedZoneMesg
- MonitoringMesg
- TrainingFileMesg
- HrvMesg
- AntRxMesg
- AntTxMesg
- AntChannelIdMesg
- LengthMesg
- MonitoringInfoMesg
- PadMesg
- SlaveDeviceMesg
- ConnectivityMesg
- WeatherConditionsMesg
- WeatherAlertMesg
- CadenceZoneMesg
- HrMesg
- SegmentLapMesg
- MemoGlobMesg
- SegmentIdMesg
- SegmentLeaderboardEntryMesg
- SegmentPointMesg
- SegmentFileMesg
- WorkoutSessionMesg
- WatchfaceSettingsMesg
- GpsMetadataMesg
- CameraEventMesg
- TimestampCorrelationMesg
- GyroscopeDataMesg
- AccelerometerDataMesg
- ThreeDSensorCalibrationMesg
- VideoFrameMesg
- ObdiiDataMesg
- NmeaSentenceMesg
- AviationAttitudeMesg
- VideoMesg
- VideoTitleMesg
- VideoDescriptionMesg
- VideoClipMesg
- OhrSettingsMesg
- ExdScreenConfigurationMesg
- ExdDataFieldConfigurationMesg
- ExdDataConceptConfigurationMesg
- FieldDescriptionMesg
- DeveloperDataIdMesg
- MagnetometerDataMesg
- BarometerDataMesg
- OneDSensorCalibrationMesg
- MonitoringHrDataMesg
- TimeInZoneMesg
- SetMesg
- StressLevelMesg
- MaxMetDataMesg
- DiveSettingsMesg
- DiveGasMesg
- DiveAlarmMesg
- ExerciseTitleMesg
- DiveSummaryMesg
- SleepLevelMesg
- JumpMesg
- BeatIntervalsMesg
- RespirationRateMesg
- SplitMesg
- ClimbProMesg
- TankUpdateMesg
- TankSummaryMesg
- SleepAssessmentMesg
- HrvStatusSummaryMesg
- HrvValueMesg
- DeviceAuxBatteryInfoMesg
- DiveApneaAlarmMesg
- MfgRangeMinMesg
- MfgRangeMaxMesg
Each item below describes a self-contained Codex task. When all boxes are checked, the SDK can be published to npm.
- Stream Abstractions
- Implement
InputStreamandOutputStreamwrappers using Node streams. - Implement
DataInputStream,DataOutputStreamandOutputStreamWriterhelpers. - Integrate
BigIntegerandBigDecimalutilities for large numeric values
- Implement
- File Handling
- Write basic
FileEncoder(already present). - Finish
FileEncoder(record CRC during writes, manage message definitions). - Create
FileDecoderable to parse FIT headers and message records.
- Write basic
- Field and Message Structure
- Base
Field,SubFieldand definition classes. - Add
FieldComponentlogic. - Add
DeveloperFieldandDeveloperFieldDefinitionwith support forDeveloperDataIdMesg.
- Base
- Message Classes
- Implement each message type listed above under Message Types.
- Populate
Factorywith amesgsarray describing field layouts for every message.
- Profile Information
- Add enums (
FitBaseType,FitBaseUnit,Profile.Typeor equivalent) following the FIT profile. - Provide helpers to access profile version and message numbers.
- Add enums (
- Testing and Validation
- Unit tests for
FileEncoderandFileDecoder. - Unit tests for every message class (creation, encoding, decoding).
- Protocol validation via
ProtocolValidatoragainst all versions.
- Unit tests for
- Continuous Integration
- Set up GitHub Actions to run
npm testand TypeScript build on each pull request. - Enforce linting and code formatting.
- Set up GitHub Actions to run
- Packaging
- Generate
dist/with compiled JavaScript and type declarations.
- Generate
- Publish the package to npm with semantic versioning.
graph TD
FileEncoder --> OutputStream
DataOutputStream --> OutputStream
OutputStreamWriter --> OutputStream
FieldBase --> DataOutputStream
FieldBase --> DataInputStream
DataInputStream --> InputStream
FileDecoder --> InputStream
FieldBase --> BigInteger
FieldBase --> BigDecimal
OutputStream -->|wraps| Writable
InputStream -->|wraps| Readable
Factory --> Mesg
Mesg -->|extends| MessageTypes
Mesg --> DeveloperField
MesgDefinition --> DeveloperFieldDefinition
Profile --> MesgNum
Contributions are welcome. Each unchecked item in the roadmap can be tackled as a standalone pull request. Please include unit tests for new functionality and keep code style consistent with the existing files.