fit

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package fit provides a full-featured implementation of the Garmin FIT SDK.

The FIT (Flexible and Interoperable Data Transfer) protocol is used by Garmin and other fitness device manufacturers to store activity, workout, and other fitness-related data.

Profile Version = 21.188.0 Copyright 2025 Garmin International, Inc. Licensed under the Flexible and Interoperable Data Transfer (FIT) Protocol License

Index

Constants

View Source
const (
	ProtocolVersionMajorShift = 4
	ProtocolVersionMajorMask  = 0x0F << ProtocolVersionMajorShift
	ProtocolVersionMinorMask  = 0x0F

	ProtocolVersion10  = 1 << ProtocolVersionMajorShift
	ProtocolVersion20  = 2 << ProtocolVersionMajorShift
	ProtocolVersionMax = ProtocolVersion20

	ProfileVersionMajor = 21
	ProfileVersionMinor = 188
	ProfileVersionScale = 1000
	ProfileVersion      = ProfileVersionMajor*ProfileVersionScale + ProfileVersionMinor
)

Version constants

View Source
const (
	FileHeaderSize    = 14
	FileHeaderSizeOld = 12
	FileCRCSize       = 2
	HeaderDataType    = ".FIT"
)

File header constants

View Source
const (
	HeaderSize           = 1
	HeaderTimeRecBit     = 0x80
	HeaderTimeTypeMask   = 0x60
	HeaderTimeTypeShift  = 5
	HeaderTimeOffsetMask = 0x1F
	HeaderTypeDefBit     = 0x40
	HeaderDevDataBit     = 0x20
	HeaderTypeMask       = 0x0F
	MaxLocalMesgs        = HeaderTypeMask + 1
)

Record header constants

View Source
const (
	FieldNumInvalid      = 0xFF
	FieldNumMessageIndex = 254
	FieldNumTimestamp    = 253
	FieldNumPartNumber   = 250
)

Field number constants

View Source
const (
	BaseTypeNumMask    = 0x1F
	BaseTypeEndianFlag = 0x80
)
View Source
const (
	EnumInvalid    uint8   = 0xFF
	Sint8Invalid   int8    = 0x7F
	Uint8Invalid   uint8   = 0xFF
	Sint16Invalid  int16   = 0x7FFF
	Uint16Invalid  uint16  = 0xFFFF
	Sint32Invalid  int32   = 0x7FFFFFFF
	Uint32Invalid  uint32  = 0xFFFFFFFF
	Sint64Invalid  int64   = 0x7FFFFFFFFFFFFFFF
	Uint64Invalid  uint64  = 0xFFFFFFFFFFFFFFFF
	Float32Invalid float32 = math.MaxFloat32
	Float64Invalid float64 = math.MaxFloat64
	Uint8zInvalid  uint8   = 0x00
	Uint16zInvalid uint16  = 0x0000
	Uint32zInvalid uint32  = 0x00000000
	Uint64zInvalid uint64  = 0x0000000000000000
	ByteInvalid    byte    = 0xFF
)

Invalid values for each type

View Source
const (
	ArchEndianMask   = 0x01
	ArchEndianLittle = 0
	ArchEndianBig    = 1
)

Architecture constants

View Source
const (
	// Event message fields
	EventFieldEvent      = 0
	EventFieldEventType  = 1
	EventFieldData16     = 2
	EventFieldData       = 3
	EventFieldEventGroup = 4

	// DeviceInfo message fields
	DeviceInfoFieldDeviceIndex         = 0
	DeviceInfoFieldDeviceType          = 1
	DeviceInfoFieldManufacturer        = 2
	DeviceInfoFieldSerialNumber        = 3
	DeviceInfoFieldProduct             = 4
	DeviceInfoFieldSoftwareVersion     = 5
	DeviceInfoFieldHardwareVersion     = 6
	DeviceInfoFieldCumOperatingTime    = 7
	DeviceInfoFieldBatteryVoltage      = 10
	DeviceInfoFieldBatteryStatus       = 11
	DeviceInfoFieldSensorPosition      = 18
	DeviceInfoFieldDescriptor          = 19
	DeviceInfoFieldAntTransmissionType = 20
	DeviceInfoFieldAntDeviceNumber     = 21
	DeviceInfoFieldAntNetwork          = 22
	DeviceInfoFieldSourceType          = 25
	DeviceInfoFieldProductName         = 27

	// Record message fields
	RecordFieldTimestamp                  = 253
	RecordFieldPositionLat                = 0
	RecordFieldPositionLong               = 1
	RecordFieldAltitude                   = 2
	RecordFieldHeartRate                  = 3
	RecordFieldCadence                    = 4
	RecordFieldDistance                   = 5
	RecordFieldSpeed                      = 6
	RecordFieldPower                      = 7
	RecordFieldCompressedSpeedDistance    = 8
	RecordFieldGrade                      = 9
	RecordFieldResistance                 = 10
	RecordFieldTimeFromCourse             = 11
	RecordFieldCycleLength                = 12
	RecordFieldTemperature                = 13
	RecordFieldSpeed1s                    = 17
	RecordFieldCycles                     = 18
	RecordFieldTotalCycles                = 19
	RecordFieldCompressedAccumulatedPower = 28
	RecordFieldAccumulatedPower           = 29
	RecordFieldEnhancedSpeed              = 73
	RecordFieldEnhancedAltitude           = 78
)

Field number constants for commonly referenced fields

View Source
const (
	SubfieldIndexActiveSubfield = 65534 // Determine active subfield dynamically
	SubfieldIndexMainField      = 65535 // Use the main field (no subfield)
)

Constants for subfield handling

View Source
const (
	SemicirclesPerDegree = float64(1<<31) / 180.0
	DegreesPerSemicircle = 180.0 / float64(1<<31)
)

Semicircles conversion constants

View Source
const FitEpochSeconds int64 = 631065600

FitEpochSeconds is the number of seconds from Unix epoch to FIT epoch

View Source
const SubSportVirtual = SubSportVirtualActivity

SubSportVirtual is an alias for backwards compatibility

Variables

View Source
var (
	ErrNotFIT           = errors.New("not a valid FIT file")
	ErrCRCMismatch      = errors.New("CRC mismatch")
	ErrInvalidHeader    = errors.New("invalid file header")
	ErrInvalidLocalMesg = errors.New("invalid local message number")
	ErrInvalidBaseType  = errors.New("invalid base type")
	ErrUnexpectedEOF    = errors.New("unexpected end of file")
)

Common decoder errors

View Source
var (
	ErrEncoderNotOpen     = errors.New("encoder not open")
	ErrEncoderAlreadyOpen = errors.New("encoder already open")
	ErrInvalidMessage     = errors.New("invalid message")
)

Common encoder errors

View Source
var (
	ErrEndOfStream      = errors.New("end of stream reached")
	ErrInvalidData      = errors.New("invalid data")
	ErrBufferTooSmall   = errors.New("buffer too small")
	ErrSeekNotSupported = errors.New("seek not supported")
)

Common errors

View Source
var BaseTypes = map[BaseType]BaseTypeInfo{
	BaseTypeEnum & BaseTypeNumMask:    {Size: 1, Name: "enum", Invalid: 0xFF, GoType: "uint8"},
	BaseTypeSint8 & BaseTypeNumMask:   {Size: 1, Name: "sint8", Invalid: 0x7F, GoType: "int8"},
	BaseTypeUint8 & BaseTypeNumMask:   {Size: 1, Name: "uint8", Invalid: 0xFF, GoType: "uint8"},
	BaseTypeSint16 & BaseTypeNumMask:  {Size: 2, Name: "sint16", Invalid: 0x7FFF, GoType: "int16"},
	BaseTypeUint16 & BaseTypeNumMask:  {Size: 2, Name: "uint16", Invalid: 0xFFFF, GoType: "uint16"},
	BaseTypeSint32 & BaseTypeNumMask:  {Size: 4, Name: "sint32", Invalid: 0x7FFFFFFF, GoType: "int32"},
	BaseTypeUint32 & BaseTypeNumMask:  {Size: 4, Name: "uint32", Invalid: 0xFFFFFFFF, GoType: "uint32"},
	BaseTypeString & BaseTypeNumMask:  {Size: 1, Name: "string", Invalid: 0x00, GoType: "string"},
	BaseTypeFloat32 & BaseTypeNumMask: {Size: 4, Name: "float32", Invalid: 0xFFFFFFFF, GoType: "float32"},
	BaseTypeFloat64 & BaseTypeNumMask: {Size: 8, Name: "float64", Invalid: 0xFFFFFFFFFFFFFFFF, GoType: "float64"},
	BaseTypeUint8z & BaseTypeNumMask:  {Size: 1, Name: "uint8z", Invalid: 0x00, GoType: "uint8"},
	BaseTypeUint16z & BaseTypeNumMask: {Size: 2, Name: "uint16z", Invalid: 0x0000, GoType: "uint16"},
	BaseTypeUint32z & BaseTypeNumMask: {Size: 4, Name: "uint32z", Invalid: 0x00000000, GoType: "uint32"},
	BaseTypeByte & BaseTypeNumMask:    {Size: 1, Name: "byte", Invalid: 0xFF, GoType: "byte"},
	BaseTypeSint64 & BaseTypeNumMask:  {Size: 8, Name: "sint64", Invalid: 0x7FFFFFFFFFFFFFFF, GoType: "int64"},
	BaseTypeUint64 & BaseTypeNumMask:  {Size: 8, Name: "uint64", Invalid: 0xFFFFFFFFFFFFFFFF, GoType: "uint64"},
	BaseTypeUint64z & BaseTypeNumMask: {Size: 8, Name: "uint64z", Invalid: 0x0000000000000000, GoType: "uint64"},
}

BaseTypes maps base type numbers to their information

View Source
var DefaultProfile = InitDefaultProfile()

DefaultProfile is the global default profile instance

View Source
var EventNames = map[Event]string{
	EventTimer:                 "timer",
	EventWorkout:               "workout",
	EventWorkoutStep:           "workout_step",
	EventPowerDown:             "power_down",
	EventPowerUp:               "power_up",
	EventOffCourse:             "off_course",
	EventSession:               "session",
	EventLap:                   "lap",
	EventCoursePoint:           "course_point",
	EventBattery:               "battery",
	EventVirtualPartnerPace:    "virtual_partner_pace",
	EventHrHighAlert:           "hr_high_alert",
	EventHrLowAlert:            "hr_low_alert",
	EventSpeedHighAlert:        "speed_high_alert",
	EventSpeedLowAlert:         "speed_low_alert",
	EventCadHighAlert:          "cad_high_alert",
	EventCadLowAlert:           "cad_low_alert",
	EventPowerHighAlert:        "power_high_alert",
	EventPowerLowAlert:         "power_low_alert",
	EventRecoveryHr:            "recovery_hr",
	EventBatteryLow:            "battery_low",
	EventTimeDurationAlert:     "time_duration_alert",
	EventDistanceDurationAlert: "distance_duration_alert",
	EventCalorieDurationAlert:  "calorie_duration_alert",
	EventActivity:              "activity",
	EventFitnessEquipment:      "fitness_equipment",
	EventLength:                "length",
	EventUserMarker:            "user_marker",
	EventSportPoint:            "sport_point",
	EventCalibration:           "calibration",
	EventFrontGearChange:       "front_gear_change",
	EventRearGearChange:        "rear_gear_change",
	EventRiderPositionChange:   "rider_position_change",
	EventElevHighAlert:         "elev_high_alert",
	EventElevLowAlert:          "elev_low_alert",
	EventCommTimeout:           "comm_timeout",
	EventRadarThreatAlert:      "radar_threat_alert",
}

EventNames maps event IDs to their names

View Source
var EventTypeNames = map[EventType]string{
	EventTypeStart:                  "start",
	EventTypeStop:                   "stop",
	EventTypeConsecutiveDepreciated: "consecutive_depreciated",
	EventTypeMarker:                 "marker",
	EventTypeStopAll:                "stop_all",
	EventTypeBeginDepreciated:       "begin_depreciated",
	EventTypeEndDepreciated:         "end_depreciated",
	EventTypeEndAllDepreciated:      "end_all_depreciated",
	EventTypeStopDisable:            "stop_disable",
	EventTypeStopDisableAll:         "stop_disable_all",
}

EventTypeNames maps event type IDs to their names

View Source
var FileNames = map[File]string{
	FileDevice:           "device",
	FileSettings:         "settings",
	FileSport:            "sport",
	FileActivity:         "activity",
	FileWorkout:          "workout",
	FileCourse:           "course",
	FileSchedules:        "schedules",
	FileWeight:           "weight",
	FileTotals:           "totals",
	FileGoals:            "goals",
	FileBloodPressure:    "blood_pressure",
	FileMonitoringA:      "monitoring_a",
	FileActivitySummary:  "activity_summary",
	FileMonitoringDaily:  "monitoring_daily",
	FileMonitoringB:      "monitoring_b",
	FileSegment:          "segment",
	FileSegmentList:      "segment_list",
	FileExdConfiguration: "exd_configuration",
}

FileNames maps file types to their names

View Source
var GarminProductNames = map[GarminProduct]string{}/* 474 elements not displayed */

GarminProductNames maps product IDs to their names

View Source
var ManufacturerNames = map[Manufacturer]string{
	ManufacturerGarmin:            "garmin",
	ManufacturerSuunto:            "suunto",
	ManufacturerWahooFitness:      "wahoo_fitness",
	ManufacturerPolarElectro:      "polar_electro",
	ManufacturerZwift:             "zwift",
	ManufacturerStagesCycling:     "stages_cycling",
	ManufacturerStryd:             "stryd",
	ManufacturerCoros:             "coros",
	ManufacturerTacx:              "tacx",
	ManufacturerFaveroElectronics: "favero_electronics",
	ManufacturerDevelopment:       "development",
}

ManufacturerNames maps manufacturer IDs to their names

View Source
var MesgNumNames = map[MesgNum]string{}/* 109 elements not displayed */

MesgNumNames maps message numbers to their names

View Source
var SportNames = map[Sport]string{
	SportGeneric:          "generic",
	SportRunning:          "running",
	SportCycling:          "cycling",
	SportTransition:       "transition",
	SportFitnessEquipment: "fitness_equipment",
	SportSwimming:         "swimming",
	SportBasketball:       "basketball",
	SportSoccer:           "soccer",
	SportTennis:           "tennis",
	SportTraining:         "training",
	SportWalking:          "walking",
	SportRowing:           "rowing",
	SportHiking:           "hiking",
	SportMultisport:       "multisport",
	SportGolf:             "golf",
	SportDiving:           "diving",
	SportHiit:             "hiit",
	SportMeditation:       "meditation",
	SportAll:              "all",
}

SportNames maps sport types to their names

View Source
var SubSportNames = map[SubSport]string{
	SubSportGeneric:             "generic",
	SubSportTreadmill:           "treadmill",
	SubSportStreet:              "street",
	SubSportTrail:               "trail",
	SubSportTrack:               "track",
	SubSportSpin:                "spin",
	SubSportIndoorCycling:       "indoor_cycling",
	SubSportRoad:                "road",
	SubSportMountain:            "mountain",
	SubSportDownhill:            "downhill",
	SubSportRecumbent:           "recumbent",
	SubSportCyclocross:          "cyclocross",
	SubSportHandCycling:         "hand_cycling",
	SubSportTrackCycling:        "track_cycling",
	SubSportIndoorRowing:        "indoor_rowing",
	SubSportElliptical:          "elliptical",
	SubSportStairClimbing:       "stair_climbing",
	SubSportLapSwimming:         "lap_swimming",
	SubSportOpenWater:           "open_water",
	SubSportFlexibilityTraining: "flexibility_training",
	SubSportStrengthTraining:    "strength_training",
	SubSportWarmUp:              "warm_up",
	SubSportMatch:               "match",
	SubSportExercise:            "exercise",
	SubSportChallenge:           "challenge",
	SubSportIndoorSkiing:        "indoor_skiing",
	SubSportCardioTraining:      "cardio_training",
	SubSportVirtual:             "virtual",
	SubSportAll:                 "all",
}

SubSportNames maps sub sport IDs to their names

Functions

func ApplyScaleOffset

func ApplyScaleOffset(raw any, scale, offset float64) float64

ApplyScaleOffset applies scale and offset to a raw value value = (raw / scale) - offset

func CalculateCRC

func CalculateCRC(data []byte) uint16

CalculateCRC computes the CRC-16 of the given data

func CalculateCRCRange

func CalculateCRCRange(data []byte, start, end int) uint16

CalculateCRCRange computes the CRC-16 of a range within the data

func DegreesToSemicircles

func DegreesToSemicircles(degrees float64) int32

DegreesToSemicircles converts degrees to semicircles

func ExpandComponents

func ExpandComponents(value uint64, components []FieldComponent) map[uint8]float64

ExpandComponents expands a field value into component fields Returns a map of field number to expanded value

func FormatDuration

func FormatDuration(seconds float64) string

FormatDuration formats a duration in seconds to HH:MM:SS

func FormatPace

func FormatPace(metersPerSecond float64, metric bool) string

FormatPace formats speed (m/s) as pace (min/km or min/mi)

func GetActiveSubfieldIndex

func GetActiveSubfieldIndex(fieldProfile *FieldProfile, getFieldValue func(fieldNum uint8) (int64, bool)) int

GetActiveSubfieldIndex returns the index of the active subfield for a field Returns SubfieldIndexMainField if no subfield is active

func GetBaseTypeInvalid

func GetBaseTypeInvalid(baseType BaseType) uint64

GetBaseTypeInvalid returns the invalid value for a base type

func GetBaseTypeSize

func GetBaseTypeSize(baseType BaseType) uint8

GetBaseTypeSize returns the size in bytes for a base type

func GetGarminProductName

func GetGarminProductName(p GarminProduct) string

GetGarminProductName returns the name for a product ID

func GetMesgNumName

func GetMesgNumName(num MesgNum) string

GetMesgNumName returns the name for a message number

func GetScaleOffset

func GetScaleOffset(fieldProfile *FieldProfile, getFieldValue func(fieldNum uint8) (int64, bool)) (scale, offset float64)

GetScaleOffset returns the appropriate scale and offset for a field considering any active subfield

func GetUint8OrDefault

func GetUint8OrDefault(v uint8, def uint8) uint8

GetUint8OrDefault returns the value or default if invalid

func GetUint16OrDefault

func GetUint16OrDefault(v uint16, def uint16) uint16

GetUint16OrDefault returns the value or default if invalid

func GetUint32OrDefault

func GetUint32OrDefault(v uint32, def uint32) uint32

GetUint32OrDefault returns the value or default if invalid

func IsBaseTypeNumeric

func IsBaseTypeNumeric(baseType BaseType) bool

IsBaseTypeNumeric returns true if the base type is numeric

func IsInvalidInt8

func IsInvalidInt8(v int8) bool

IsInvalidInt8 checks if an int8 value is invalid

func IsInvalidInt16

func IsInvalidInt16(v int16) bool

IsInvalidInt16 checks if an int16 value is invalid

func IsInvalidInt32

func IsInvalidInt32(v int32) bool

IsInvalidInt32 checks if an int32 value is invalid

func IsInvalidUint8

func IsInvalidUint8(v uint8) bool

IsInvalidUint8 checks if a uint8 value is invalid

func IsInvalidUint16

func IsInvalidUint16(v uint16) bool

IsInvalidUint16 checks if a uint16 value is invalid

func IsInvalidUint32

func IsInvalidUint32(v uint32) bool

IsInvalidUint32 checks if a uint32 value is invalid

func LocalMesgNum added in v1.0.1

func LocalMesgNum(header byte) byte

LocalMesgNum extracts the local message number from a message header byte. For compressed timestamp headers, the local message number is in bits 5-6. For normal headers, it's in bits 0-3.

func ReverseScaleOffset

func ReverseScaleOffset(value, scale, offset float64) int64

ReverseScaleOffset converts a scaled value back to raw raw = (value + offset) * scale

func ScaleOffsetInt added in v1.0.1

func ScaleOffsetInt(raw int64, scale, offset float64) float64

ScaleOffsetInt applies scale and offset to an integer raw value. Formula: result = (float64(raw) / scale) - offset

func SemicirclesToDegrees

func SemicirclesToDegrees(semicircles int32) float64

SemicirclesToDegrees converts semicircles to degrees

func ToKilometers

func ToKilometers(meters float64) float64

ToKilometers converts meters to kilometers

func ToKilometersPerHour

func ToKilometersPerHour(mps float64) float64

ToKilometersPerHour converts m/s to km/h

func ToMeters

func ToMeters(distance uint32, scale float64) float64

ToMeters converts distance in centimeters to meters

func ToMetersPerSecond

func ToMetersPerSecond(speed uint16, scale float64) float64

ToMetersPerSecond converts speed in mm/s to m/s

func ToMiles

func ToMiles(meters float64) float64

ToMiles converts meters to miles

func ToMilesPerHour

func ToMilesPerHour(mps float64) float64

ToMilesPerHour converts m/s to mph

Types

type Accumulator

type Accumulator struct {
	// contains filtered or unexported fields
}

Accumulator tracks accumulated field values

func NewAccumulator

func NewAccumulator() *Accumulator

NewAccumulator creates a new accumulator

func (*Accumulator) Accumulate

func (a *Accumulator) Accumulate(mesgNum MesgNum, fieldNum uint8, value uint32, bits int) uint32

Accumulate accumulates a value and returns the result

func (*Accumulator) Set

func (a *Accumulator) Set(mesgNum MesgNum, fieldNum uint8, value uint32)

Set sets an accumulated value

type ActivityClass added in v1.0.1

type ActivityClass byte

Activityclass type

const (
	ActivityClassLevel    ActivityClass = 0x7F // 0 to 100
	ActivityClassLevelMax ActivityClass = 100
	ActivityClassAthlete  ActivityClass = 0x80
	ActivityClassInvalid  ActivityClass = 0xFF
)

type ActivityLevel

type ActivityLevel uint8

ActivityLevel defines activity level

const (
	ActivityLevelLow     ActivityLevel = 0
	ActivityLevelMedium  ActivityLevel = 1
	ActivityLevelHigh    ActivityLevel = 2
	ActivityLevelInvalid ActivityLevel = 0xFF
)

type ActivityMesg

type ActivityMesg struct {
	Timestamp      DateTime
	TotalTimerTime uint32 // 1000 * s + 0
	NumSessions    uint16
	Type           ActivityType
	Event          Event
	EventType      EventType
	LocalTimestamp LocalDateTime
	EventGroup     uint8
}

ActivityMesg represents the activity message (message 34)

func (*ActivityMesg) GetMesgNum

func (m *ActivityMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*ActivityMesg) GetName

func (m *ActivityMesg) GetName() string

GetName implements the Message interface

func (*ActivityMesg) GetTimestamp

func (m *ActivityMesg) GetTimestamp() time.Time

GetTimestamp returns the timestamp as time.Time

func (*ActivityMesg) GetTotalTimerTimeScaled

func (m *ActivityMesg) GetTotalTimerTimeScaled() float64

GetTotalTimerTimeScaled returns total timer time in seconds

type ActivityMesgListener

type ActivityMesgListener func(mesg *ActivityMesg)

ActivityMesgListener is called for each activity message

type ActivitySubtype

type ActivitySubtype uint8

ActivitySubtype defines activity subtype

const (
	ActivitySubtypeGeneric       ActivitySubtype = 0
	ActivitySubtypeTreadmill     ActivitySubtype = 1
	ActivitySubtypeStreet        ActivitySubtype = 2
	ActivitySubtypeTrail         ActivitySubtype = 3
	ActivitySubtypeTrack         ActivitySubtype = 4
	ActivitySubtypeSpin          ActivitySubtype = 5
	ActivitySubtypeIndoorCycling ActivitySubtype = 6
	ActivitySubtypeRoad          ActivitySubtype = 7
	ActivitySubtypeMountain      ActivitySubtype = 8
	ActivitySubtypeDownhill      ActivitySubtype = 9
	ActivitySubtypeRecumbent     ActivitySubtype = 10
	ActivitySubtypeCyclocross    ActivitySubtype = 11
	ActivitySubtypeHandCycling   ActivitySubtype = 12
	ActivitySubtypeTrackCycling  ActivitySubtype = 13
	ActivitySubtypeIndoorRowing  ActivitySubtype = 14
	ActivitySubtypeElliptical    ActivitySubtype = 15
	ActivitySubtypeStairClimbing ActivitySubtype = 16
	ActivitySubtypeLapSwimming   ActivitySubtype = 17
	ActivitySubtypeOpenWater     ActivitySubtype = 18
	ActivitySubtypeAll           ActivitySubtype = 254
	ActivitySubtypeInvalid       ActivitySubtype = 0xFF
)

type ActivityType

type ActivityType uint8

ActivityType constants

const (
	ActivityTypeGeneric          ActivityType = 0
	ActivityTypeRunning          ActivityType = 1
	ActivityTypeCycling          ActivityType = 2
	ActivityTypeTransition       ActivityType = 3
	ActivityTypeFitnessEquipment ActivityType = 4
	ActivityTypeSwimming         ActivityType = 5
	ActivityTypeWalking          ActivityType = 6
	ActivityTypeSedentary        ActivityType = 8
	ActivityTypeAll              ActivityType = 254
	ActivityTypeInvalid          ActivityType = 0xFF
)

type AnalogWatchfaceLayout added in v1.0.1

type AnalogWatchfaceLayout byte

Analogwatchfacelayout type

const (
	AnalogWatchfaceLayoutMinimal     AnalogWatchfaceLayout = 0
	AnalogWatchfaceLayoutTraditional AnalogWatchfaceLayout = 1
	AnalogWatchfaceLayoutModern      AnalogWatchfaceLayout = 2
	AnalogWatchfaceLayoutInvalid     AnalogWatchfaceLayout = 0xFF
)

type AntNetwork added in v1.0.1

type AntNetwork byte

Antnetwork type

const (
	AntNetworkPublic  AntNetwork = 0
	AntNetworkAntplus AntNetwork = 1
	AntNetworkAntfs   AntNetwork = 2
	AntNetworkPrivate AntNetwork = 3
	AntNetworkInvalid AntNetwork = 0xFF
)

type AntplusDeviceType added in v1.0.1

type AntplusDeviceType uint8

Antplusdevicetype type

const (
	AntplusDeviceTypeAntfs                   AntplusDeviceType = 1
	AntplusDeviceTypeBikePower               AntplusDeviceType = 11
	AntplusDeviceTypeEnvironmentSensorLegacy AntplusDeviceType = 12
	AntplusDeviceTypeMultiSportSpeedDistance AntplusDeviceType = 15
	AntplusDeviceTypeControl                 AntplusDeviceType = 16
	AntplusDeviceTypeFitnessEquipment        AntplusDeviceType = 17
	AntplusDeviceTypeBloodPressure           AntplusDeviceType = 18
	AntplusDeviceTypeGeocacheNode            AntplusDeviceType = 19
	AntplusDeviceTypeLightElectricVehicle    AntplusDeviceType = 20
	AntplusDeviceTypeEnvSensor               AntplusDeviceType = 25
	AntplusDeviceTypeRacquet                 AntplusDeviceType = 26
	AntplusDeviceTypeControlHub              AntplusDeviceType = 27
	AntplusDeviceTypeMuscleOxygen            AntplusDeviceType = 31
	AntplusDeviceTypeShifting                AntplusDeviceType = 34
	AntplusDeviceTypeBikeLightMain           AntplusDeviceType = 35
	AntplusDeviceTypeBikeLightShared         AntplusDeviceType = 36
	AntplusDeviceTypeExd                     AntplusDeviceType = 38
	AntplusDeviceTypeBikeRadar               AntplusDeviceType = 40
	AntplusDeviceTypeBikeAero                AntplusDeviceType = 46
	AntplusDeviceTypeWeightScale             AntplusDeviceType = 119
	AntplusDeviceTypeHeartRate               AntplusDeviceType = 120
	AntplusDeviceTypeBikeSpeedCadence        AntplusDeviceType = 121
	AntplusDeviceTypeBikeCadence             AntplusDeviceType = 122
	AntplusDeviceTypeBikeSpeed               AntplusDeviceType = 123
	AntplusDeviceTypeStrideSpeedDistance     AntplusDeviceType = 124
	AntplusDeviceTypeInvalid                 AntplusDeviceType = 0xFF
)

type AttitudeStage added in v1.0.1

type AttitudeStage byte

Attitudestage type

const (
	AttitudeStageFailed   AttitudeStage = 0
	AttitudeStageAligning AttitudeStage = 1
	AttitudeStageDegraded AttitudeStage = 2
	AttitudeStageValid    AttitudeStage = 3
	AttitudeStageInvalid  AttitudeStage = 0xFF
)

type AttitudeValidity added in v1.0.1

type AttitudeValidity uint16

Attitudevalidity type

const (
	AttitudeValidityTrackAngleHeadingValid AttitudeValidity = 0x0001
	AttitudeValidityPitchValid             AttitudeValidity = 0x0002
	AttitudeValidityRollValid              AttitudeValidity = 0x0004
	AttitudeValidityLateralBodyAccelValid  AttitudeValidity = 0x0008
	AttitudeValidityNormalBodyAccelValid   AttitudeValidity = 0x0010
	AttitudeValidityTurnRateValid          AttitudeValidity = 0x0020
	AttitudeValidityHwFail                 AttitudeValidity = 0x0040
	AttitudeValidityMagInvalid             AttitudeValidity = 0x0080
	AttitudeValidityNoGps                  AttitudeValidity = 0x0100
	AttitudeValidityGpsInvalid             AttitudeValidity = 0x0200
	AttitudeValiditySolutionCoasting       AttitudeValidity = 0x0400
	AttitudeValidityTrueTrackAngle         AttitudeValidity = 0x0800
	AttitudeValidityMagneticHeading        AttitudeValidity = 0x1000
	AttitudeValidityInvalid                AttitudeValidity = 0xFFFF
)

type AutoActivityDetect

type AutoActivityDetect uint32

AutoActivityDetect defines auto activity detect type

const (
	AutoActivityDetectNone       AutoActivityDetect = 0x00000000
	AutoActivityDetectRunning    AutoActivityDetect = 0x00000001
	AutoActivityDetectCycling    AutoActivityDetect = 0x00000002
	AutoActivityDetectSwimming   AutoActivityDetect = 0x00000004
	AutoActivityDetectWalking    AutoActivityDetect = 0x00000008
	AutoActivityDetectElliptical AutoActivityDetect = 0x00000020
	AutoActivityDetectSedentary  AutoActivityDetect = 0x00000400
)

type AutoSyncFrequency

type AutoSyncFrequency uint8

AutoSyncFrequency defines auto sync frequency type

const (
	AutoSyncFrequencyNever        AutoSyncFrequency = 0
	AutoSyncFrequencyOccasionally AutoSyncFrequency = 1
	AutoSyncFrequencyFrequent     AutoSyncFrequency = 2
	AutoSyncFrequencyOnceADay     AutoSyncFrequency = 3
	AutoSyncFrequencyRemote       AutoSyncFrequency = 4
	AutoSyncFrequencyInvalid      AutoSyncFrequency = 0xFF
)

type AutolapTrigger added in v1.0.1

type AutolapTrigger byte

Autolaptrigger type

const (
	AutolapTriggerTime             AutolapTrigger = 0
	AutolapTriggerDistance         AutolapTrigger = 1
	AutolapTriggerPositionStart    AutolapTrigger = 2
	AutolapTriggerPositionLap      AutolapTrigger = 3
	AutolapTriggerPositionWaypoint AutolapTrigger = 4
	AutolapTriggerPositionMarked   AutolapTrigger = 5
	AutolapTriggerOff              AutolapTrigger = 6
	AutolapTriggerAutoSelect       AutolapTrigger = 13
	AutolapTriggerInvalid          AutolapTrigger = 0xFF
)

type Autoscroll added in v1.0.1

type Autoscroll byte

Autoscroll type

const (
	AutoscrollNone    Autoscroll = 0
	AutoscrollSlow    Autoscroll = 1
	AutoscrollMedium  Autoscroll = 2
	AutoscrollFast    Autoscroll = 3
	AutoscrollInvalid Autoscroll = 0xFF
)

type BacklightMode

type BacklightMode uint8

BacklightMode defines backlight mode type

const (
	BacklightModeOff                                 BacklightMode = 0
	BacklightModeManual                              BacklightMode = 1
	BacklightModeKeyAndMessages                      BacklightMode = 2
	BacklightModeAutoBrightness                      BacklightMode = 3
	BacklightModeSmartNotifications                  BacklightMode = 4
	BacklightModeKeyAndMessagesNight                 BacklightMode = 5
	BacklightModeKeyAndMessagesAndSmartNotifications BacklightMode = 6
	BacklightModeInvalid                             BacklightMode = 0xFF
)

type BacklightTimeout added in v1.0.1

type BacklightTimeout uint8

Backlighttimeout type

const (
	BacklightTimeoutInfinite BacklightTimeout = 0 // Backlight stays on forever.
	BacklightTimeoutInvalid  BacklightTimeout = 0xFF
)

type BaseType

type BaseType uint8

BaseType represents the FIT base types

const (
	BaseTypeEnum    BaseType = 0x00
	BaseTypeSint8   BaseType = 0x01
	BaseTypeUint8   BaseType = 0x02
	BaseTypeSint16  BaseType = 0x83
	BaseTypeUint16  BaseType = 0x84
	BaseTypeSint32  BaseType = 0x85
	BaseTypeUint32  BaseType = 0x86
	BaseTypeString  BaseType = 0x07
	BaseTypeFloat32 BaseType = 0x88
	BaseTypeFloat64 BaseType = 0x89
	BaseTypeUint8z  BaseType = 0x0A
	BaseTypeUint16z BaseType = 0x8B
	BaseTypeUint32z BaseType = 0x8C
	BaseTypeByte    BaseType = 0x0D
	BaseTypeSint64  BaseType = 0x8E
	BaseTypeUint64  BaseType = 0x8F
	BaseTypeUint64z BaseType = 0x90
)

type BaseTypeInfo

type BaseTypeInfo struct {
	Size    uint8
	Name    string
	Invalid uint64
	GoType  string
}

BaseTypeInfo contains information about a base type

type BatteryStatus

type BatteryStatus uint8

BatteryStatus constants

const (
	BatteryStatusNew      BatteryStatus = 1
	BatteryStatusGood     BatteryStatus = 2
	BatteryStatusOk       BatteryStatus = 3
	BatteryStatusLow      BatteryStatus = 4
	BatteryStatusCritical BatteryStatus = 5
	BatteryStatusCharging BatteryStatus = 6
	BatteryStatusUnknown  BatteryStatus = 7
	BatteryStatusInvalid  BatteryStatus = 0xFF
)

type BikeProfileMesg

type BikeProfileMesg struct {
	MessageIndex             uint16
	Name                     string
	Sport                    Sport
	SubSport                 SubSport
	Odometer                 uint32 // 100 * m
	BikeSpdAntId             uint16
	BikeCadAntId             uint16
	BikeSpdcadAntId          uint16
	BikePowerAntId           uint16
	CustomWheelsize          uint16 // 1000 * m
	AutoWheelsize            uint16 // 1000 * m
	BikeWeight               uint16 // 10 * kg
	PowerCalFactor           uint16 // 10 * %
	AutoWheelCal             Bool
	AutoPowerZero            Bool
	ID                       uint8
	SpdEnabled               Bool
	CadEnabled               Bool
	SpdcadEnabled            Bool
	PowerEnabled             Bool
	CrankLength              uint8 // 2 * mm - 110
	Enabled                  Bool
	BikeSpdAntIdTransType    uint8
	BikeCadAntIdTransType    uint8
	BikeSpdcadAntIdTransType uint8
	BikePowerAntIdTransType  uint8
	OdometerRollover         uint8
	FrontGearNum             uint8
	FrontGear                []uint8
	RearGearNum              uint8
	RearGear                 []uint8
	ShimanoDi2Enabled        Bool
}

BikeProfileMesg represents the bike_profile message (message 6)

func (*BikeProfileMesg) GetBikeWeightScaled

func (m *BikeProfileMesg) GetBikeWeightScaled() float64

GetBikeWeightScaled returns bike weight in kg

func (*BikeProfileMesg) GetMesgNum

func (m *BikeProfileMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*BikeProfileMesg) GetName

func (m *BikeProfileMesg) GetName() string

GetName implements the Message interface

type BloodPressureMesg

type BloodPressureMesg struct {
	Timestamp            DateTime
	SystolicPressure     uint16 // mmHg
	DiastolicPressure    uint16 // mmHg
	MeanArterialPressure uint16 // mmHg
	Map3SampleMean       uint16 // mmHg
	MapMorningValues     uint16 // mmHg
	MapEveningValues     uint16 // mmHg
	HeartRate            uint8  // bpm
	HeartRateType        HrType
	Status               BpStatus
	UserProfileIndex     uint16
}

BloodPressureMesg represents the blood_pressure message (message 51)

func (*BloodPressureMesg) GetMesgNum

func (m *BloodPressureMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*BloodPressureMesg) GetName

func (m *BloodPressureMesg) GetName() string

GetName implements the Message interface

type BodyLocation added in v1.0.1

type BodyLocation byte

Bodylocation type

const (
	BodyLocationLeftLeg               BodyLocation = 0
	BodyLocationLeftCalf              BodyLocation = 1
	BodyLocationLeftShin              BodyLocation = 2
	BodyLocationLeftHamstring         BodyLocation = 3
	BodyLocationLeftQuad              BodyLocation = 4
	BodyLocationLeftGlute             BodyLocation = 5
	BodyLocationRightLeg              BodyLocation = 6
	BodyLocationRightCalf             BodyLocation = 7
	BodyLocationRightShin             BodyLocation = 8
	BodyLocationRightHamstring        BodyLocation = 9
	BodyLocationRightQuad             BodyLocation = 10
	BodyLocationRightGlute            BodyLocation = 11
	BodyLocationTorsoBack             BodyLocation = 12
	BodyLocationLeftLowerBack         BodyLocation = 13
	BodyLocationLeftUpperBack         BodyLocation = 14
	BodyLocationRightLowerBack        BodyLocation = 15
	BodyLocationRightUpperBack        BodyLocation = 16
	BodyLocationTorsoFront            BodyLocation = 17
	BodyLocationLeftAbdomen           BodyLocation = 18
	BodyLocationLeftChest             BodyLocation = 19
	BodyLocationRightAbdomen          BodyLocation = 20
	BodyLocationRightChest            BodyLocation = 21
	BodyLocationLeftArm               BodyLocation = 22
	BodyLocationLeftShoulder          BodyLocation = 23
	BodyLocationLeftBicep             BodyLocation = 24
	BodyLocationLeftTricep            BodyLocation = 25
	BodyLocationLeftBrachioradialis   BodyLocation = 26 // Left anterior forearm
	BodyLocationLeftForearmExtensors  BodyLocation = 27 // Left posterior forearm
	BodyLocationRightArm              BodyLocation = 28
	BodyLocationRightShoulder         BodyLocation = 29
	BodyLocationRightBicep            BodyLocation = 30
	BodyLocationRightTricep           BodyLocation = 31
	BodyLocationRightBrachioradialis  BodyLocation = 32 // Right anterior forearm
	BodyLocationRightForearmExtensors BodyLocation = 33 // Right posterior forearm
	BodyLocationNeck                  BodyLocation = 34
	BodyLocationThroat                BodyLocation = 35
	BodyLocationWaistMidBack          BodyLocation = 36
	BodyLocationWaistFront            BodyLocation = 37
	BodyLocationWaistLeft             BodyLocation = 38
	BodyLocationWaistRight            BodyLocation = 39
	BodyLocationInvalid               BodyLocation = 0xFF
)

type Bool

type Bool uint8

Bool is the FIT boolean type

const (
	BoolFalse   Bool = 0
	BoolTrue    Bool = 1
	BoolInvalid Bool = 0xFF
)

type BpStatus

type BpStatus uint8

BpStatus defines blood pressure status

const (
	BpStatusNoError                 BpStatus = 0
	BpStatusErrorIncompleteData     BpStatus = 1
	BpStatusErrorNoMeasurement      BpStatus = 2
	BpStatusErrorDataOutOfRange     BpStatus = 3
	BpStatusErrorIrregularHeartRate BpStatus = 4
	BpStatusInvalid                 BpStatus = 0xFF
)

type BufferedMesgBroadcaster

type BufferedMesgBroadcaster struct {
	FileId      *FileIdMesg
	Activity    *ActivityMesg
	Sessions    []*SessionMesg
	Laps        []*LapMesg
	Records     []*RecordMesg
	Events      []*EventMesg
	DeviceInfos []*DeviceInfoMesg
	UserProfile *UserProfileMesg
	Sports      []*SportMesg
	Lengths     []*LengthMesg
	Hrvs        []*HrvMesg
	AllMessages []Message
}

BufferedMesgBroadcaster collects messages during decoding for later processing

func NewBufferedMesgBroadcaster

func NewBufferedMesgBroadcaster() *BufferedMesgBroadcaster

NewBufferedMesgBroadcaster creates a new buffered message broadcaster

func (*BufferedMesgBroadcaster) ConnectToDecoder

func (b *BufferedMesgBroadcaster) ConnectToDecoder(decoder *Decoder)

ConnectToDecoder registers the buffered broadcaster as a listener on the decoder

func (*BufferedMesgBroadcaster) GetLapCount

func (b *BufferedMesgBroadcaster) GetLapCount() int

GetLapCount returns the number of lap messages

func (*BufferedMesgBroadcaster) GetRecordCount

func (b *BufferedMesgBroadcaster) GetRecordCount() int

GetRecordCount returns the number of record messages

func (*BufferedMesgBroadcaster) GetSport

func (b *BufferedMesgBroadcaster) GetSport() Sport

GetSport returns the primary sport of the activity

func (*BufferedMesgBroadcaster) GetStartTime

func (b *BufferedMesgBroadcaster) GetStartTime() DateTime

GetStartTime returns the activity start timestamp

func (*BufferedMesgBroadcaster) GetSubSport

func (b *BufferedMesgBroadcaster) GetSubSport() SubSport

GetSubSport returns the primary sub-sport of the activity

func (*BufferedMesgBroadcaster) GetTotalDistance

func (b *BufferedMesgBroadcaster) GetTotalDistance() float64

GetTotalDistance returns the total distance from the activity in meters

func (*BufferedMesgBroadcaster) GetTotalElapsedTime

func (b *BufferedMesgBroadcaster) GetTotalElapsedTime() float64

GetTotalElapsedTime returns the total elapsed time from the activity in seconds

func (*BufferedMesgBroadcaster) GetTotalTimerTime

func (b *BufferedMesgBroadcaster) GetTotalTimerTime() float64

GetTotalTimerTime returns the total timer time from the activity in seconds

func (*BufferedMesgBroadcaster) OnMesg

func (b *BufferedMesgBroadcaster) OnMesg(mesgNum MesgNum, mesg Message)

OnMesg handles a decoded message and stores it

type CRCCalculator

type CRCCalculator struct {
	// contains filtered or unexported fields
}

CRCCalculator computes CRC-16 checksums for FIT data

func NewCRCCalculator

func NewCRCCalculator() *CRCCalculator

NewCRCCalculator creates a new CRC calculator initialized to 0

func (*CRCCalculator) AddByte

func (c *CRCCalculator) AddByte(b byte) uint16

AddByte adds a single byte to the CRC calculation

func (*CRCCalculator) AddBytes

func (c *CRCCalculator) AddBytes(data []byte) uint16

AddBytes adds multiple bytes to the CRC calculation

func (*CRCCalculator) Get

func (c *CRCCalculator) Get() uint16

Get returns the current CRC value

func (*CRCCalculator) Reset

func (c *CRCCalculator) Reset()

Reset resets the CRC to 0

type CameraEventType added in v1.0.1

type CameraEventType byte

Cameraeventtype type

const (
	CameraEventTypeVideoStart                  CameraEventType = 0 // Start of video recording
	CameraEventTypeVideoSplit                  CameraEventType = 1 // Mark of video file split (end of one file, beginning of the other)
	CameraEventTypeVideoEnd                    CameraEventType = 2 // End of video recording
	CameraEventTypePhotoTaken                  CameraEventType = 3 // Still photo taken
	CameraEventTypeVideoSecondStreamStart      CameraEventType = 4
	CameraEventTypeVideoSecondStreamSplit      CameraEventType = 5
	CameraEventTypeVideoSecondStreamEnd        CameraEventType = 6
	CameraEventTypeVideoSplitStart             CameraEventType = 7 // Mark of video file split start
	CameraEventTypeVideoSecondStreamSplitStart CameraEventType = 8
	CameraEventTypeVideoPause                  CameraEventType = 11 // Mark when a video recording has been paused
	CameraEventTypeVideoSecondStreamPause      CameraEventType = 12
	CameraEventTypeVideoResume                 CameraEventType = 13 // Mark when a video recording has been resumed
	CameraEventTypeVideoSecondStreamResume     CameraEventType = 14
	CameraEventTypeInvalid                     CameraEventType = 0xFF
)

type CameraOrientationType added in v1.0.1

type CameraOrientationType byte

Cameraorientationtype type

const (
	CameraOrientationTypeCameraOrientation0   CameraOrientationType = 0
	CameraOrientationTypeCameraOrientation90  CameraOrientationType = 1
	CameraOrientationTypeCameraOrientation180 CameraOrientationType = 2
	CameraOrientationTypeCameraOrientation270 CameraOrientationType = 3
	CameraOrientationTypeInvalid              CameraOrientationType = 0xFF
)

type CapabilitiesMesg

type CapabilitiesMesg struct {
	Languages             []uint8
	Sports                []SportBits0
	WorkoutsSupported     WorkoutCapabilities
	ConnectivitySupported ConnectivityCapabilities
}

CapabilitiesMesg represents the capabilities message (message 1)

func (*CapabilitiesMesg) GetMesgNum

func (m *CapabilitiesMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*CapabilitiesMesg) GetName

func (m *CapabilitiesMesg) GetName() string

GetName implements the Message interface

type ClimbProEvent

type ClimbProEvent uint8

ClimbProEvent defines ClimbPro event type

const (
	ClimbProEventApproach ClimbProEvent = 0
	ClimbProEventStart    ClimbProEvent = 1
	ClimbProEventComplete ClimbProEvent = 2
	ClimbProEventInvalid  ClimbProEvent = 0xFF
)

type ClimbProMesg

type ClimbProMesg struct {
	Timestamp     DateTime
	PositionLat   int32 // semicircles
	PositionLong  int32 // semicircles
	ClimbProEvent ClimbProEvent
	ClimbNumber   uint16
	ClimbCategory uint8
	CurrentDist   float32 // m
}

ClimbProMesg represents the climb_pro message (message 317)

func (*ClimbProMesg) GetMesgNum

func (m *ClimbProMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*ClimbProMesg) GetName

func (m *ClimbProMesg) GetName() string

GetName implements the Message interface

type ClimbProMesgListener

type ClimbProMesgListener func(mesg *ClimbProMesg)

ClimbProMesgListener is called for each climb_pro message

type CommTimeoutType added in v1.0.1

type CommTimeoutType uint16

Commtimeouttype type

const (
	CommTimeoutTypeWildcardPairingTimeout CommTimeoutType = 0 // Timeout pairing to any device
	CommTimeoutTypePairingTimeout         CommTimeoutType = 1 // Timeout pairing to previously paired device
	CommTimeoutTypeConnectionLost         CommTimeoutType = 2 // Temporary loss of communications
	CommTimeoutTypeConnectionTimeout      CommTimeoutType = 3 // Connection closed due to extended bad communications
	CommTimeoutTypeInvalid                CommTimeoutType = 0xFFFF
)

type ConnectivityCapabilities

type ConnectivityCapabilities uint32

ConnectivityCapabilities defines connectivity capabilities type

const (
	ConnectivityCapabilitiesBluetooth                       ConnectivityCapabilities = 0x00000001
	ConnectivityCapabilitiesBluetoothLe                     ConnectivityCapabilities = 0x00000002
	ConnectivityCapabilitiesAnt                             ConnectivityCapabilities = 0x00000004
	ConnectivityCapabilitiesActivityUpload                  ConnectivityCapabilities = 0x00000008
	ConnectivityCapabilitiesCourseDownload                  ConnectivityCapabilities = 0x00000010
	ConnectivityCapabilitiesWorkoutDownload                 ConnectivityCapabilities = 0x00000020
	ConnectivityCapabilitiesLiveTrack                       ConnectivityCapabilities = 0x00000040
	ConnectivityCapabilitiesWeatherConditions               ConnectivityCapabilities = 0x00000080
	ConnectivityCapabilitiesWeatherAlerts                   ConnectivityCapabilities = 0x00000100
	ConnectivityCapabilitiesGpsEphemerisDownload            ConnectivityCapabilities = 0x00000200
	ConnectivityCapabilitiesExplicitArchive                 ConnectivityCapabilities = 0x00000400
	ConnectivityCapabilitiesSetupIncomplete                 ConnectivityCapabilities = 0x00000800
	ConnectivityCapabilitiesContinueSyncAfterSoftwareUpdate ConnectivityCapabilities = 0x00001000
	ConnectivityCapabilitiesConnectIqAppDownload            ConnectivityCapabilities = 0x00002000
	ConnectivityCapabilitiesGolfCourseDownload              ConnectivityCapabilities = 0x00004000
	ConnectivityCapabilitiesDeviceInitiatesSync             ConnectivityCapabilities = 0x00008000
	ConnectivityCapabilitiesConnectIqWatchAppDownload       ConnectivityCapabilities = 0x00010000
	ConnectivityCapabilitiesConnectIqWidgetDownload         ConnectivityCapabilities = 0x00020000
	ConnectivityCapabilitiesConnectIqWatchFaceDownload      ConnectivityCapabilities = 0x00040000
	ConnectivityCapabilitiesConnectIqDataFieldDownload      ConnectivityCapabilities = 0x00080000
	ConnectivityCapabilitiesConnectIqAppManagment           ConnectivityCapabilities = 0x00100000
	ConnectivityCapabilitiesSwingSensor                     ConnectivityCapabilities = 0x00200000
	ConnectivityCapabilitiesSwingSensorRemote               ConnectivityCapabilities = 0x00400000
	ConnectivityCapabilitiesIncidentDetection               ConnectivityCapabilities = 0x00800000
	ConnectivityCapabilitiesAudioPrompts                    ConnectivityCapabilities = 0x01000000
	ConnectivityCapabilitiesWifiVerification                ConnectivityCapabilities = 0x02000000
	ConnectivityCapabilitiesTrueUp                          ConnectivityCapabilities = 0x04000000
	ConnectivityCapabilitiesFindMyWatch                     ConnectivityCapabilities = 0x08000000
	ConnectivityCapabilitiesRemoteManualSync                ConnectivityCapabilities = 0x10000000
	ConnectivityCapabilitiesLiveTrackAutoStart              ConnectivityCapabilities = 0x20000000
	ConnectivityCapabilitiesLiveTrackMessaging              ConnectivityCapabilities = 0x40000000
	ConnectivityCapabilitiesInstantInput                    ConnectivityCapabilities = 0x80000000
)

type ConnectivityMesg

type ConnectivityMesg struct {
	BluetoothEnabled            Bool
	BluetoothLeEnabled          Bool
	AntEnabled                  Bool
	Name                        string
	LiveTrackingEnabled         Bool
	WeatherConditionsEnabled    Bool
	WeatherAlertsEnabled        Bool
	AutoActivityUploadEnabled   Bool
	CourseDownloadEnabled       Bool
	WorkoutDownloadEnabled      Bool
	GpsEphemerisDownloadEnabled Bool
	IncidentDetectionEnabled    Bool
	GrouptrackEnabled           Bool
}

ConnectivityMesg represents the connectivity message (message 127)

func (*ConnectivityMesg) GetMesgNum

func (m *ConnectivityMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*ConnectivityMesg) GetName

func (m *ConnectivityMesg) GetName() string

GetName implements the Message interface

type CourseMesg

type CourseMesg struct {
	Sport        Sport
	Name         string
	Capabilities uint32
	SubSport     SubSport
}

CourseMesg represents the course message (message 31)

func (*CourseMesg) GetMesgNum

func (m *CourseMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*CourseMesg) GetName

func (m *CourseMesg) GetName() string

GetName implements the Message interface

type CourseMesgListener

type CourseMesgListener func(mesg *CourseMesg)

CourseMesgListener is called for each course message

type CoursePoint

type CoursePoint uint8

CoursePoint type constants

const (
	CoursePointGeneric        CoursePoint = 0
	CoursePointSummit         CoursePoint = 1
	CoursePointValley         CoursePoint = 2
	CoursePointWater          CoursePoint = 3
	CoursePointFood           CoursePoint = 4
	CoursePointDanger         CoursePoint = 5
	CoursePointLeft           CoursePoint = 6
	CoursePointRight          CoursePoint = 7
	CoursePointStraight       CoursePoint = 8
	CoursePointFirstAid       CoursePoint = 9
	CoursePointFourthCategory CoursePoint = 10
	CoursePointThirdCategory  CoursePoint = 11
	CoursePointSecondCategory CoursePoint = 12
	CoursePointFirstCategory  CoursePoint = 13
	CoursePointHorsCategory   CoursePoint = 14
	CoursePointSprint         CoursePoint = 15
	CoursePointLeftFork       CoursePoint = 16
	CoursePointRightFork      CoursePoint = 17
	CoursePointMiddleFork     CoursePoint = 18
	CoursePointSlightLeft     CoursePoint = 19
	CoursePointSharpLeft      CoursePoint = 20
	CoursePointSlightRight    CoursePoint = 21
	CoursePointSharpRight     CoursePoint = 22
	CoursePointUTurn          CoursePoint = 23
	CoursePointSegmentStart   CoursePoint = 24
	CoursePointSegmentEnd     CoursePoint = 25
	CoursePointInvalid        CoursePoint = 0xFF
)

type CoursePointMesg

type CoursePointMesg struct {
	MessageIndex uint16
	Timestamp    DateTime
	PositionLat  int32
	PositionLong int32
	Distance     uint32 // 100 * m
	Type         CoursePoint
	Name         string
	Favorite     uint8
}

CoursePointMesg represents the course_point message (message 32)

func (*CoursePointMesg) GetDistanceScaled

func (m *CoursePointMesg) GetDistanceScaled() float64

GetDistanceScaled returns distance in meters

func (*CoursePointMesg) GetMesgNum

func (m *CoursePointMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*CoursePointMesg) GetName

func (m *CoursePointMesg) GetName() string

GetName implements the Message interface

func (*CoursePointMesg) GetPositionLatDegrees

func (m *CoursePointMesg) GetPositionLatDegrees() float64

GetPositionLatDegrees returns latitude in degrees

func (*CoursePointMesg) GetPositionLongDegrees

func (m *CoursePointMesg) GetPositionLongDegrees() float64

GetPositionLongDegrees returns longitude in degrees

type CoursePointMesgListener

type CoursePointMesgListener func(mesg *CoursePointMesg)

CoursePointMesgListener is called for each course_point message

type DateMode

type DateMode uint8

DateMode defines date mode type

const (
	DateModeDayMonth DateMode = 0
	DateModeMonthDay DateMode = 1
	DateModeInvalid  DateMode = 0xFF
)

type DateTime

type DateTime uint32

DateTime represents a FIT datetime value

const DateTimeInvalid DateTime = 0xFFFFFFFF

DateTimeInvalid represents an invalid DateTime value

const DateTimeMin DateTime = 0x10000000

DateTimeMin is the minimum valid DateTime (system time if < this value)

func NewDateTime

func NewDateTime(t time.Time) DateTime

NewDateTime creates a DateTime from a Go time.Time

func (DateTime) IsValid

func (dt DateTime) IsValid() bool

IsValid returns true if the DateTime is valid

func (DateTime) Time

func (dt DateTime) Time() time.Time

Time converts the FIT DateTime to a Go time.Time

type DayOfWeek added in v1.0.1

type DayOfWeek byte

Dayofweek type

const (
	DayOfWeekSunday    DayOfWeek = 0
	DayOfWeekMonday    DayOfWeek = 1
	DayOfWeekTuesday   DayOfWeek = 2
	DayOfWeekWednesday DayOfWeek = 3
	DayOfWeekThursday  DayOfWeek = 4
	DayOfWeekFriday    DayOfWeek = 5
	DayOfWeekSaturday  DayOfWeek = 6
	DayOfWeekInvalid   DayOfWeek = 0xFF
)

type DecodeMode

type DecodeMode int

DecodeMode specifies how the decoder should process the file

const (
	// DecodeModeNormal performs full validation including CRC
	DecodeModeNormal DecodeMode = iota
	// DecodeModeSkipHeader skips header validation
	DecodeModeSkipHeader
	// DecodeModeDataOnly decodes only data, no header validation
	DecodeModeDataOnly
)

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder reads and decodes FIT files

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder creates a new decoder from an io.Reader

func (*Decoder) CheckIntegrity

func (d *Decoder) CheckIntegrity() bool

CheckIntegrity validates the file structure and CRC

func (*Decoder) Decode

func (d *Decoder) Decode() (*FitFile, error)

Decode decodes the FIT file and returns the decoded data

func (*Decoder) IsFIT

func (d *Decoder) IsFIT() bool

IsFIT returns true if the file appears to be a valid FIT file

func (*Decoder) SetMesgListener

func (d *Decoder) SetMesgListener(listener MesgListener) *Decoder

SetMesgListener sets a callback for each decoded message

func (*Decoder) SetOptions

func (d *Decoder) SetOptions(opts *DecoderOptions) *Decoder

SetOptions sets the decoder options

type DecoderOptions

type DecoderOptions struct {
	// ApplyScaleAndOffset applies scale/offset to numeric values
	ApplyScaleAndOffset bool
	// ConvertTimestamps converts FIT timestamps to time.Time
	ConvertTimestamps bool
	// ConvertTypesToStrings converts enum values to strings
	ConvertTypesToStrings bool
	// EnableCRCCheck validates file CRC
	EnableCRCCheck bool
	// ExpandSubFields expands sub-fields
	ExpandSubFields bool
	// ExpandComponents expands component fields
	ExpandComponents bool
	// MergeHeartRates merges HR data from hrv messages
	MergeHeartRates bool
	// DecodeMode specifies decoding mode
	DecodeMode DecodeMode
}

DecoderOptions configures the decoder behavior

func DefaultDecoderOptions

func DefaultDecoderOptions() *DecoderOptions

DefaultDecoderOptions returns the default decoder options

type DeveloperDataIdMesg

type DeveloperDataIdMesg struct {
	DeveloperId        []byte
	ApplicationId      []byte
	ManufacturerId     Manufacturer
	DeveloperDataIndex uint8
	ApplicationVersion uint32
}

DeveloperDataIdMesg represents the developer_data_id message (message 207)

func (*DeveloperDataIdMesg) GetMesgNum

func (m *DeveloperDataIdMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*DeveloperDataIdMesg) GetName

func (m *DeveloperDataIdMesg) GetName() string

GetName implements the Message interface

type DeveloperField

type DeveloperField struct {
	Num                uint8
	DeveloperDataIndex uint8
	Name               string
	Value              any
	Units              string
}

DeveloperField represents a developer-defined field

type DeveloperFieldDefinition

type DeveloperFieldDefinition struct {
	FieldNum           uint8
	Size               uint8
	DeveloperDataIndex uint8
}

DeveloperFieldDefinition represents a developer field in a message definition

type DeviceIndex added in v1.0.1

type DeviceIndex uint8

Deviceindex type

const (
	DeviceIndexCreator DeviceIndex = 0 // Creator of the file is always device index 0.
	DeviceIndexInvalid DeviceIndex = 0xFF
)

type DeviceInfoMesg

type DeviceInfoMesg struct {
	Timestamp           DateTime
	DeviceIndex         uint8
	DeviceType          DeviceType
	Manufacturer        Manufacturer
	SerialNumber        uint32
	Product             uint16
	SoftwareVersion     uint16
	HardwareVersion     uint8
	CumOperatingTime    uint32
	BatteryVoltage      uint16
	BatteryStatus       BatteryStatus
	SensorPosition      uint8
	Descriptor          string
	AntTransmissionType uint8
	AntDeviceNumber     uint16
	AntNetwork          uint8
	SourceType          SourceType
	ProductName         string
}

DeviceInfoMesg represents the device_info message (message 23)

func (*DeviceInfoMesg) GetBatteryVoltageScaled

func (m *DeviceInfoMesg) GetBatteryVoltageScaled() float64

GetBatteryVoltageScaled returns battery voltage in volts

func (*DeviceInfoMesg) GetMesgNum

func (m *DeviceInfoMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*DeviceInfoMesg) GetName

func (m *DeviceInfoMesg) GetName() string

GetName implements the Message interface

func (*DeviceInfoMesg) GetSoftwareVersionScaled

func (m *DeviceInfoMesg) GetSoftwareVersionScaled() float64

GetSoftwareVersionScaled returns the software version scaled

func (*DeviceInfoMesg) GetTimestamp

func (m *DeviceInfoMesg) GetTimestamp() time.Time

GetTimestamp returns the timestamp as time.Time

type DeviceInfoMesgListener

type DeviceInfoMesgListener func(mesg *DeviceInfoMesg)

DeviceInfoMesgListener is called for each device_info message

type DeviceSettingsMesg

type DeviceSettingsMesg struct {
	ActiveTimeZone                      uint8
	UTCOffset                           uint32
	TimeOffset                          []uint32 // s
	TimeMode                            []TimeMode
	TimeZoneOffset                      []int8 // 4 * hr
	BacklightMode                       BacklightMode
	ActivityTrackerEnabled              Bool
	ClockTime                           DateTime
	PagesEnabled                        []uint16
	MoveAlertEnabled                    Bool
	DateMode                            DateMode
	DisplayOrientation                  DisplayOrientation
	MountingSide                        Side
	DefaultPage                         []uint16
	AutosyncMinSteps                    uint16
	AutosyncMinTime                     uint16 // minutes
	LactateThresholdAutodetectEnabled   Bool
	BleAutoUploadEnabled                Bool
	AutoSyncFrequency                   AutoSyncFrequency
	AutoActivityDetect                  AutoActivityDetect
	NumberOfScreens                     uint8
	SmartNotificationDisplayOrientation DisplayOrientation
	TapInterface                        Switch
}

DeviceSettingsMesg represents the device_settings message (message 2)

func (*DeviceSettingsMesg) GetMesgNum

func (m *DeviceSettingsMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*DeviceSettingsMesg) GetName

func (m *DeviceSettingsMesg) GetName() string

GetName implements the Message interface

type DeviceType

type DeviceType uint8

DeviceType constants

const (
	DeviceTypeAntfs                   DeviceType = 1
	DeviceTypeBikePower               DeviceType = 11
	DeviceTypeEnvironmentSensorLegacy DeviceType = 12
	DeviceTypeMultiSportSpeedDistance DeviceType = 15
	DeviceTypeControl                 DeviceType = 16
	DeviceTypeFitnessEquipment        DeviceType = 17
	DeviceTypeBloodPressure           DeviceType = 18
	DeviceTypeGeocacheNode            DeviceType = 19
	DeviceTypeLightElectricVehicle    DeviceType = 20
	DeviceTypeEnvSensor               DeviceType = 25
	DeviceTypeRacquet                 DeviceType = 26
	DeviceTypeControlHub              DeviceType = 27
	DeviceTypeMuscleOxygen            DeviceType = 31
	DeviceTypeShifting                DeviceType = 34
	DeviceTypeBikeLightMain           DeviceType = 35
	DeviceTypeBikeLightShared         DeviceType = 36
	DeviceTypeExd                     DeviceType = 38
	DeviceTypeBikeRadar               DeviceType = 40
	DeviceTypeBikeAero                DeviceType = 46
	DeviceTypeWeightScale             DeviceType = 119
	DeviceTypeHeartRate               DeviceType = 120
	DeviceTypeBikeSpeedCadence        DeviceType = 121
	DeviceTypeBikeCadence             DeviceType = 122
	DeviceTypeBikeSpeed               DeviceType = 123
	DeviceTypeStrideSpeedDistance     DeviceType = 124
	DeviceTypeInvalid                 DeviceType = 0xFF
)
const DeviceTypeLocalDevice DeviceType = 0

DeviceTypeLocalDevice is used for local device info

type DigitalWatchfaceLayout added in v1.0.1

type DigitalWatchfaceLayout byte

Digitalwatchfacelayout type

const (
	DigitalWatchfaceLayoutTraditional DigitalWatchfaceLayout = 0
	DigitalWatchfaceLayoutModern      DigitalWatchfaceLayout = 1
	DigitalWatchfaceLayoutBold        DigitalWatchfaceLayout = 2
	DigitalWatchfaceLayoutInvalid     DigitalWatchfaceLayout = 0xFF
)

type DisplayHeart added in v1.0.1

type DisplayHeart byte

Displayheart type

const (
	DisplayHeartBpm     DisplayHeart = 0
	DisplayHeartMax     DisplayHeart = 1
	DisplayHeartReserve DisplayHeart = 2
	DisplayHeartInvalid DisplayHeart = 0xFF
)

type DisplayMeasure

type DisplayMeasure uint8

DisplayMeasure constants

const (
	DisplayMeasureMetric   DisplayMeasure = 0
	DisplayMeasureStatute  DisplayMeasure = 1
	DisplayMeasureNautical DisplayMeasure = 2
	DisplayMeasureInvalid  DisplayMeasure = 0xFF
)

type DisplayOrientation

type DisplayOrientation uint8

DisplayOrientation defines display orientation type

const (
	DisplayOrientationAuto             DisplayOrientation = 0
	DisplayOrientationPortrait         DisplayOrientation = 1
	DisplayOrientationLandscape        DisplayOrientation = 2
	DisplayOrientationPortraitFlipped  DisplayOrientation = 3
	DisplayOrientationLandscapeFlipped DisplayOrientation = 4
	DisplayOrientationInvalid          DisplayOrientation = 0xFF
)

type DisplayPosition added in v1.0.1

type DisplayPosition byte

Displayposition type

const (
	DisplayPositionDegree               DisplayPosition = 0  // dd.dddddd
	DisplayPositionDegreeMinute         DisplayPosition = 1  // dddmm.mmm
	DisplayPositionDegreeMinuteSecond   DisplayPosition = 2  // dddmmss
	DisplayPositionAustrianGrid         DisplayPosition = 3  // Austrian Grid (BMN)
	DisplayPositionBritishGrid          DisplayPosition = 4  // British National Grid
	DisplayPositionDutchGrid            DisplayPosition = 5  // Dutch grid system
	DisplayPositionHungarianGrid        DisplayPosition = 6  // Hungarian grid system
	DisplayPositionFinnishGrid          DisplayPosition = 7  // Finnish grid system Zone3 KKJ27
	DisplayPositionGermanGrid           DisplayPosition = 8  // Gausss Krueger (German)
	DisplayPositionIcelandicGrid        DisplayPosition = 9  // Icelandic Grid
	DisplayPositionIndonesianEquatorial DisplayPosition = 10 // Indonesian Equatorial LCO
	DisplayPositionIndonesianIrian      DisplayPosition = 11 // Indonesian Irian LCO
	DisplayPositionIndonesianSouthern   DisplayPosition = 12 // Indonesian Southern LCO
	DisplayPositionIndiaZone0           DisplayPosition = 13 // India zone 0
	DisplayPositionIndiaZoneIa          DisplayPosition = 14 // India zone IA
	DisplayPositionIndiaZoneIb          DisplayPosition = 15 // India zone IB
	DisplayPositionIndiaZoneIia         DisplayPosition = 16 // India zone IIA
	DisplayPositionIndiaZoneIib         DisplayPosition = 17 // India zone IIB
	DisplayPositionIndiaZoneIiia        DisplayPosition = 18 // India zone IIIA
	DisplayPositionIndiaZoneIiib        DisplayPosition = 19 // India zone IIIB
	DisplayPositionIndiaZoneIva         DisplayPosition = 20 // India zone IVA
	DisplayPositionIndiaZoneIvb         DisplayPosition = 21 // India zone IVB
	DisplayPositionIrishTransverse      DisplayPosition = 22 // Irish Transverse Mercator
	DisplayPositionIrishGrid            DisplayPosition = 23 // Irish Grid
	DisplayPositionLoran                DisplayPosition = 24 // Loran TD
	DisplayPositionMaidenheadGrid       DisplayPosition = 25 // Maidenhead grid system
	DisplayPositionMgrsGrid             DisplayPosition = 26 // MGRS grid system
	DisplayPositionNewZealandGrid       DisplayPosition = 27 // New Zealand grid system
	DisplayPositionNewZealandTransverse DisplayPosition = 28 // New Zealand Transverse Mercator
	DisplayPositionQatarGrid            DisplayPosition = 29 // Qatar National Grid
	DisplayPositionModifiedSwedishGrid  DisplayPosition = 30 // Modified RT-90 (Sweden)
	DisplayPositionSwedishGrid          DisplayPosition = 31 // RT-90 (Sweden)
	DisplayPositionSouthAfricanGrid     DisplayPosition = 32 // South African Grid
	DisplayPositionSwissGrid            DisplayPosition = 33 // Swiss CH-1903 grid
	DisplayPositionTaiwanGrid           DisplayPosition = 34 // Taiwan Grid
	DisplayPositionUnitedStatesGrid     DisplayPosition = 35 // United States National Grid
	DisplayPositionUtmUpsGrid           DisplayPosition = 36 // UTM/UPS grid system
	DisplayPositionWestMalayan          DisplayPosition = 37 // West Malayan RSO
	DisplayPositionBorneoRso            DisplayPosition = 38 // Borneo RSO
	DisplayPositionEstonianGrid         DisplayPosition = 39 // Estonian grid system
	DisplayPositionLatvianGrid          DisplayPosition = 40 // Latvian Transverse Mercator
	DisplayPositionSwedishRef99Grid     DisplayPosition = 41 // Reference Grid 99 TM (Swedish)
	DisplayPositionInvalid              DisplayPosition = 0xFF
)

type DisplayPower added in v1.0.1

type DisplayPower byte

Displaypower type

const (
	DisplayPowerWatts      DisplayPower = 0
	DisplayPowerPercentFtp DisplayPower = 1
	DisplayPowerInvalid    DisplayPower = 0xFF
)

type DiveAlarmType added in v1.0.1

type DiveAlarmType byte

Divealarmtype type

const (
	DiveAlarmTypeDepth   DiveAlarmType = 0 // Alarm when a certain depth is crossed
	DiveAlarmTypeTime    DiveAlarmType = 1 // Alarm when a certain time has transpired
	DiveAlarmTypeSpeed   DiveAlarmType = 2 // Alarm when a certain ascent or descent rate is exceeded
	DiveAlarmTypeInvalid DiveAlarmType = 0xFF
)

type DiveAlert added in v1.0.1

type DiveAlert byte

Divealert type

const (
	DiveAlertNdlReached                DiveAlert = 0
	DiveAlertGasSwitchPrompted         DiveAlert = 1
	DiveAlertNearSurface               DiveAlert = 2
	DiveAlertApproachingNdl            DiveAlert = 3
	DiveAlertPo2Warn                   DiveAlert = 4
	DiveAlertPo2CritHigh               DiveAlert = 5
	DiveAlertPo2CritLow                DiveAlert = 6
	DiveAlertTimeAlert                 DiveAlert = 7
	DiveAlertDepthAlert                DiveAlert = 8
	DiveAlertDecoCeilingBroken         DiveAlert = 9
	DiveAlertDecoComplete              DiveAlert = 10
	DiveAlertSafetyStopBroken          DiveAlert = 11
	DiveAlertSafetyStopComplete        DiveAlert = 12
	DiveAlertCnsWarning                DiveAlert = 13
	DiveAlertCnsCritical               DiveAlert = 14
	DiveAlertOtuWarning                DiveAlert = 15
	DiveAlertOtuCritical               DiveAlert = 16
	DiveAlertAscentCritical            DiveAlert = 17
	DiveAlertAlertDismissedByKey       DiveAlert = 18
	DiveAlertAlertDismissedByTimeout   DiveAlert = 19
	DiveAlertBatteryLow                DiveAlert = 20
	DiveAlertBatteryCritical           DiveAlert = 21
	DiveAlertSafetyStopStarted         DiveAlert = 22
	DiveAlertApproachingFirstDecoStop  DiveAlert = 23
	DiveAlertSetpointSwitchAutoLow     DiveAlert = 24
	DiveAlertSetpointSwitchAutoHigh    DiveAlert = 25
	DiveAlertSetpointSwitchManualLow   DiveAlert = 26
	DiveAlertSetpointSwitchManualHigh  DiveAlert = 27
	DiveAlertAutoSetpointSwitchIgnored DiveAlert = 28
	DiveAlertSwitchedToOpenCircuit     DiveAlert = 29
	DiveAlertSwitchedToClosedCircuit   DiveAlert = 30
	DiveAlertTankBatteryLow            DiveAlert = 32
	DiveAlertPo2CcrDilLow              DiveAlert = 33 // ccr diluent has low po2
	DiveAlertDecoStopCleared           DiveAlert = 34 // a deco stop has been cleared
	DiveAlertApneaNeutralBuoyancy      DiveAlert = 35 // Target Depth Apnea Alarm triggered
	DiveAlertApneaTargetDepth          DiveAlert = 36 // Neutral Buoyance Apnea Alarm triggered
	DiveAlertApneaSurface              DiveAlert = 37 // Surface Apnea Alarm triggered
	DiveAlertApneaHighSpeed            DiveAlert = 38 // High Speed Apnea Alarm triggered
	DiveAlertApneaLowSpeed             DiveAlert = 39 // Low Speed Apnea Alarm triggered
	DiveAlertInvalid                   DiveAlert = 0xFF
)

type DiveBacklightMode added in v1.0.1

type DiveBacklightMode byte

Divebacklightmode type

const (
	DiveBacklightModeAtDepth  DiveBacklightMode = 0
	DiveBacklightModeAlwaysOn DiveBacklightMode = 1
	DiveBacklightModeInvalid  DiveBacklightMode = 0xFF
)

type DiveGasMode added in v1.0.1

type DiveGasMode byte

Divegasmode type

const (
	DiveGasModeOpenCircuit          DiveGasMode = 0
	DiveGasModeClosedCircuitDiluent DiveGasMode = 1
	DiveGasModeInvalid              DiveGasMode = 0xFF
)

type DiveGasStatus added in v1.0.1

type DiveGasStatus byte

Divegasstatus type

const (
	DiveGasStatusDisabled   DiveGasStatus = 0
	DiveGasStatusEnabled    DiveGasStatus = 1
	DiveGasStatusBackupOnly DiveGasStatus = 2
	DiveGasStatusInvalid    DiveGasStatus = 0xFF
)

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder writes FIT files

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder creates a new encoder

func (*Encoder) Close

func (e *Encoder) Close() error

Close finalizes the FIT file by updating the header and writing CRC

func (*Encoder) Open

func (e *Encoder) Open() error

Open starts writing a FIT file by writing the header

func (*Encoder) Write

func (e *Encoder) Write(mesg Message) error

Write writes a message to the FIT file

type Endianness

type Endianness uint8

Endianness represents byte order

const (
	LittleEndian Endianness = 0
	BigEndian    Endianness = 1
)

type Event

type Event uint8

Event type constants

const (
	EventTimer                 Event = 0
	EventWorkout               Event = 3
	EventWorkoutStep           Event = 4
	EventPowerDown             Event = 5
	EventPowerUp               Event = 6
	EventOffCourse             Event = 7
	EventSession               Event = 8
	EventLap                   Event = 9
	EventCoursePoint           Event = 10
	EventBattery               Event = 11
	EventVirtualPartnerPace    Event = 12
	EventHrHighAlert           Event = 13
	EventHrLowAlert            Event = 14
	EventSpeedHighAlert        Event = 15
	EventSpeedLowAlert         Event = 16
	EventCadHighAlert          Event = 17
	EventCadLowAlert           Event = 18
	EventPowerHighAlert        Event = 19
	EventPowerLowAlert         Event = 20
	EventRecoveryHr            Event = 21
	EventBatteryLow            Event = 22
	EventTimeDurationAlert     Event = 23
	EventDistanceDurationAlert Event = 24
	EventCalorieDurationAlert  Event = 25
	EventActivity              Event = 26
	EventFitnessEquipment      Event = 27
	EventLength                Event = 28
	EventUserMarker            Event = 32
	EventSportPoint            Event = 33
	EventCalibration           Event = 36
	EventFrontGearChange       Event = 42
	EventRearGearChange        Event = 43
	EventRiderPositionChange   Event = 44
	EventElevHighAlert         Event = 45
	EventElevLowAlert          Event = 46
	EventCommTimeout           Event = 47
	EventRadarThreatAlert      Event = 75
	EventInvalid               Event = 0xFF
)

type EventMesg

type EventMesg struct {
	Timestamp           DateTime
	Event               Event
	EventType           EventType
	Data16              uint16
	Data                uint32
	EventGroup          uint8
	Score               uint16
	OpponentScore       uint16
	FrontGearNum        uint8
	FrontGear           uint8
	RearGearNum         uint8
	RearGear            uint8
	DeviceIndex         uint8
	RadarThreatLevelMax uint8
	RadarThreatCount    uint8
}

EventMesg represents the event message (message 21)

func (*EventMesg) GetMesgNum

func (m *EventMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*EventMesg) GetName

func (m *EventMesg) GetName() string

GetName implements the Message interface

func (*EventMesg) GetTimestamp

func (m *EventMesg) GetTimestamp() time.Time

GetTimestamp returns the timestamp as time.Time

type EventMesgListener

type EventMesgListener func(mesg *EventMesg)

EventMesgListener is called for each event message

type EventType

type EventType uint8

EventType constants

const (
	EventTypeStart                  EventType = 0
	EventTypeStop                   EventType = 1
	EventTypeConsecutiveDepreciated EventType = 2
	EventTypeMarker                 EventType = 3
	EventTypeStopAll                EventType = 4
	EventTypeBeginDepreciated       EventType = 5
	EventTypeEndDepreciated         EventType = 6
	EventTypeEndAllDepreciated      EventType = 7
	EventTypeStopDisable            EventType = 8
	EventTypeStopDisableAll         EventType = 9
	EventTypeInvalid                EventType = 0xFF
)

type ExdDataUnits added in v1.0.1

type ExdDataUnits byte

Exddataunits type

const (
	ExdDataUnitsNoUnits                        ExdDataUnits = 0
	ExdDataUnitsLaps                           ExdDataUnits = 1
	ExdDataUnitsMilesPerHour                   ExdDataUnits = 2
	ExdDataUnitsKilometersPerHour              ExdDataUnits = 3
	ExdDataUnitsFeetPerHour                    ExdDataUnits = 4
	ExdDataUnitsMetersPerHour                  ExdDataUnits = 5
	ExdDataUnitsDegreesCelsius                 ExdDataUnits = 6
	ExdDataUnitsDegreesFahrenheit              ExdDataUnits = 7
	ExdDataUnitsZone                           ExdDataUnits = 8
	ExdDataUnitsGear                           ExdDataUnits = 9
	ExdDataUnitsRpm                            ExdDataUnits = 10
	ExdDataUnitsBpm                            ExdDataUnits = 11
	ExdDataUnitsDegrees                        ExdDataUnits = 12
	ExdDataUnitsMillimeters                    ExdDataUnits = 13
	ExdDataUnitsMeters                         ExdDataUnits = 14
	ExdDataUnitsKilometers                     ExdDataUnits = 15
	ExdDataUnitsFeet                           ExdDataUnits = 16
	ExdDataUnitsYards                          ExdDataUnits = 17
	ExdDataUnitsKilofeet                       ExdDataUnits = 18
	ExdDataUnitsMiles                          ExdDataUnits = 19
	ExdDataUnitsTime                           ExdDataUnits = 20
	ExdDataUnitsEnumTurnType                   ExdDataUnits = 21
	ExdDataUnitsPercent                        ExdDataUnits = 22
	ExdDataUnitsWatts                          ExdDataUnits = 23
	ExdDataUnitsWattsPerKilogram               ExdDataUnits = 24
	ExdDataUnitsEnumBatteryStatus              ExdDataUnits = 25
	ExdDataUnitsEnumBikeLightBeamAngleMode     ExdDataUnits = 26
	ExdDataUnitsEnumBikeLightBatteryStatus     ExdDataUnits = 27
	ExdDataUnitsEnumBikeLightNetworkConfigType ExdDataUnits = 28
	ExdDataUnitsLights                         ExdDataUnits = 29
	ExdDataUnitsSeconds                        ExdDataUnits = 30
	ExdDataUnitsMinutes                        ExdDataUnits = 31
	ExdDataUnitsHours                          ExdDataUnits = 32
	ExdDataUnitsCalories                       ExdDataUnits = 33
	ExdDataUnitsKilojoules                     ExdDataUnits = 34
	ExdDataUnitsMilliseconds                   ExdDataUnits = 35
	ExdDataUnitsSecondPerMile                  ExdDataUnits = 36
	ExdDataUnitsSecondPerKilometer             ExdDataUnits = 37
	ExdDataUnitsCentimeter                     ExdDataUnits = 38
	ExdDataUnitsEnumCoursePoint                ExdDataUnits = 39
	ExdDataUnitsBradians                       ExdDataUnits = 40
	ExdDataUnitsEnumSport                      ExdDataUnits = 41
	ExdDataUnitsInchesHg                       ExdDataUnits = 42
	ExdDataUnitsMmHg                           ExdDataUnits = 43
	ExdDataUnitsMbars                          ExdDataUnits = 44
	ExdDataUnitsHectoPascals                   ExdDataUnits = 45
	ExdDataUnitsFeetPerMin                     ExdDataUnits = 46
	ExdDataUnitsMetersPerMin                   ExdDataUnits = 47
	ExdDataUnitsMetersPerSec                   ExdDataUnits = 48
	ExdDataUnitsEightCardinal                  ExdDataUnits = 49
	ExdDataUnitsInvalid                        ExdDataUnits = 0xFF
)

type ExdDescriptors added in v1.0.1

type ExdDescriptors byte

Exddescriptors type

const (
	ExdDescriptorsBikeLightBatteryStatus           ExdDescriptors = 0
	ExdDescriptorsBeamAngleStatus                  ExdDescriptors = 1
	ExdDescriptorsBateryLevel                      ExdDescriptors = 2
	ExdDescriptorsLightNetworkMode                 ExdDescriptors = 3
	ExdDescriptorsNumberLightsConnected            ExdDescriptors = 4
	ExdDescriptorsCadence                          ExdDescriptors = 5
	ExdDescriptorsDistance                         ExdDescriptors = 6
	ExdDescriptorsEstimatedTimeOfArrival           ExdDescriptors = 7
	ExdDescriptorsHeading                          ExdDescriptors = 8
	ExdDescriptorsTime                             ExdDescriptors = 9
	ExdDescriptorsBatteryLevel                     ExdDescriptors = 10
	ExdDescriptorsTrainerResistance                ExdDescriptors = 11
	ExdDescriptorsTrainerTargetPower               ExdDescriptors = 12
	ExdDescriptorsTimeSeated                       ExdDescriptors = 13
	ExdDescriptorsTimeStanding                     ExdDescriptors = 14
	ExdDescriptorsElevation                        ExdDescriptors = 15
	ExdDescriptorsGrade                            ExdDescriptors = 16
	ExdDescriptorsAscent                           ExdDescriptors = 17
	ExdDescriptorsDescent                          ExdDescriptors = 18
	ExdDescriptorsVerticalSpeed                    ExdDescriptors = 19
	ExdDescriptorsDi2BatteryLevel                  ExdDescriptors = 20
	ExdDescriptorsFrontGear                        ExdDescriptors = 21
	ExdDescriptorsRearGear                         ExdDescriptors = 22
	ExdDescriptorsGearRatio                        ExdDescriptors = 23
	ExdDescriptorsHeartRate                        ExdDescriptors = 24
	ExdDescriptorsHeartRateZone                    ExdDescriptors = 25
	ExdDescriptorsTimeInHeartRateZone              ExdDescriptors = 26
	ExdDescriptorsHeartRateReserve                 ExdDescriptors = 27
	ExdDescriptorsCalories                         ExdDescriptors = 28
	ExdDescriptorsGpsAccuracy                      ExdDescriptors = 29
	ExdDescriptorsGpsSignalStrength                ExdDescriptors = 30
	ExdDescriptorsTemperature                      ExdDescriptors = 31
	ExdDescriptorsTimeOfDay                        ExdDescriptors = 32
	ExdDescriptorsBalance                          ExdDescriptors = 33
	ExdDescriptorsPedalSmoothness                  ExdDescriptors = 34
	ExdDescriptorsPower                            ExdDescriptors = 35
	ExdDescriptorsFunctionalThresholdPower         ExdDescriptors = 36
	ExdDescriptorsIntensityFactor                  ExdDescriptors = 37
	ExdDescriptorsWork                             ExdDescriptors = 38
	ExdDescriptorsPowerRatio                       ExdDescriptors = 39
	ExdDescriptorsNormalizedPower                  ExdDescriptors = 40
	ExdDescriptorsTrainingStressScore              ExdDescriptors = 41
	ExdDescriptorsTimeOnZone                       ExdDescriptors = 42
	ExdDescriptorsSpeed                            ExdDescriptors = 43
	ExdDescriptorsLaps                             ExdDescriptors = 44
	ExdDescriptorsReps                             ExdDescriptors = 45
	ExdDescriptorsWorkoutStep                      ExdDescriptors = 46
	ExdDescriptorsCourseDistance                   ExdDescriptors = 47
	ExdDescriptorsNavigationDistance               ExdDescriptors = 48
	ExdDescriptorsCourseEstimatedTimeOfArrival     ExdDescriptors = 49
	ExdDescriptorsNavigationEstimatedTimeOfArrival ExdDescriptors = 50
	ExdDescriptorsCourseTime                       ExdDescriptors = 51
	ExdDescriptorsNavigationTime                   ExdDescriptors = 52
	ExdDescriptorsCourseHeading                    ExdDescriptors = 53
	ExdDescriptorsNavigationHeading                ExdDescriptors = 54
	ExdDescriptorsPowerZone                        ExdDescriptors = 55
	ExdDescriptorsTorqueEffectiveness              ExdDescriptors = 56
	ExdDescriptorsTimerTime                        ExdDescriptors = 57
	ExdDescriptorsPowerWeightRatio                 ExdDescriptors = 58
	ExdDescriptorsLeftPlatformCenterOffset         ExdDescriptors = 59
	ExdDescriptorsRightPlatformCenterOffset        ExdDescriptors = 60
	ExdDescriptorsLeftPowerPhaseStartAngle         ExdDescriptors = 61
	ExdDescriptorsRightPowerPhaseStartAngle        ExdDescriptors = 62
	ExdDescriptorsLeftPowerPhaseFinishAngle        ExdDescriptors = 63
	ExdDescriptorsRightPowerPhaseFinishAngle       ExdDescriptors = 64
	ExdDescriptorsGears                            ExdDescriptors = 65 // Combined gear information
	ExdDescriptorsPace                             ExdDescriptors = 66
	ExdDescriptorsTrainingEffect                   ExdDescriptors = 67
	ExdDescriptorsVerticalOscillation              ExdDescriptors = 68
	ExdDescriptorsVerticalRatio                    ExdDescriptors = 69
	ExdDescriptorsGroundContactTime                ExdDescriptors = 70
	ExdDescriptorsLeftGroundContactTimeBalance     ExdDescriptors = 71
	ExdDescriptorsRightGroundContactTimeBalance    ExdDescriptors = 72
	ExdDescriptorsStrideLength                     ExdDescriptors = 73
	ExdDescriptorsRunningCadence                   ExdDescriptors = 74
	ExdDescriptorsPerformanceCondition             ExdDescriptors = 75
	ExdDescriptorsCourseType                       ExdDescriptors = 76
	ExdDescriptorsTimeInPowerZone                  ExdDescriptors = 77
	ExdDescriptorsNavigationTurn                   ExdDescriptors = 78
	ExdDescriptorsCourseLocation                   ExdDescriptors = 79
	ExdDescriptorsNavigationLocation               ExdDescriptors = 80
	ExdDescriptorsCompass                          ExdDescriptors = 81
	ExdDescriptorsGearCombo                        ExdDescriptors = 82
	ExdDescriptorsMuscleOxygen                     ExdDescriptors = 83
	ExdDescriptorsIcon                             ExdDescriptors = 84
	ExdDescriptorsCompassHeading                   ExdDescriptors = 85
	ExdDescriptorsGpsHeading                       ExdDescriptors = 86
	ExdDescriptorsGpsElevation                     ExdDescriptors = 87
	ExdDescriptorsAnaerobicTrainingEffect          ExdDescriptors = 88
	ExdDescriptorsCourse                           ExdDescriptors = 89
	ExdDescriptorsOffCourse                        ExdDescriptors = 90
	ExdDescriptorsGlideRatio                       ExdDescriptors = 91
	ExdDescriptorsVerticalDistance                 ExdDescriptors = 92
	ExdDescriptorsVmg                              ExdDescriptors = 93
	ExdDescriptorsAmbientPressure                  ExdDescriptors = 94
	ExdDescriptorsPressure                         ExdDescriptors = 95
	ExdDescriptorsVam                              ExdDescriptors = 96
	ExdDescriptorsInvalid                          ExdDescriptors = 0xFF
)

type ExdDisplayType added in v1.0.1

type ExdDisplayType byte

Exddisplaytype type

const (
	ExdDisplayTypeNumerical         ExdDisplayType = 0
	ExdDisplayTypeSimple            ExdDisplayType = 1
	ExdDisplayTypeGraph             ExdDisplayType = 2
	ExdDisplayTypeBar               ExdDisplayType = 3
	ExdDisplayTypeCircleGraph       ExdDisplayType = 4
	ExdDisplayTypeVirtualPartner    ExdDisplayType = 5
	ExdDisplayTypeBalance           ExdDisplayType = 6
	ExdDisplayTypeStringList        ExdDisplayType = 7
	ExdDisplayTypeString            ExdDisplayType = 8
	ExdDisplayTypeSimpleDynamicIcon ExdDisplayType = 9
	ExdDisplayTypeGauge             ExdDisplayType = 10
	ExdDisplayTypeInvalid           ExdDisplayType = 0xFF
)

type ExdLayout added in v1.0.1

type ExdLayout byte

Exdlayout type

const (
	ExdLayoutFullScreen                ExdLayout = 0
	ExdLayoutHalfVertical              ExdLayout = 1
	ExdLayoutHalfHorizontal            ExdLayout = 2
	ExdLayoutHalfVerticalRightSplit    ExdLayout = 3
	ExdLayoutHalfHorizontalBottomSplit ExdLayout = 4
	ExdLayoutFullQuarterSplit          ExdLayout = 5
	ExdLayoutHalfVerticalLeftSplit     ExdLayout = 6
	ExdLayoutHalfHorizontalTopSplit    ExdLayout = 7
	ExdLayoutDynamic                   ExdLayout = 8 // The EXD may display the configured concepts in any layout it sees fit.
	ExdLayoutInvalid                   ExdLayout = 0xFF
)

type ExdQualifiers added in v1.0.1

type ExdQualifiers byte

Exdqualifiers type

const (
	ExdQualifiersNoQualifier              ExdQualifiers = 0
	ExdQualifiersInstantaneous            ExdQualifiers = 1
	ExdQualifiersAverage                  ExdQualifiers = 2
	ExdQualifiersLap                      ExdQualifiers = 3
	ExdQualifiersMaximum                  ExdQualifiers = 4
	ExdQualifiersMaximumAverage           ExdQualifiers = 5
	ExdQualifiersMaximumLap               ExdQualifiers = 6
	ExdQualifiersLastLap                  ExdQualifiers = 7
	ExdQualifiersAverageLap               ExdQualifiers = 8
	ExdQualifiersToDestination            ExdQualifiers = 9
	ExdQualifiersToGo                     ExdQualifiers = 10
	ExdQualifiersToNext                   ExdQualifiers = 11
	ExdQualifiersNextCoursePoint          ExdQualifiers = 12
	ExdQualifiersTotal                    ExdQualifiers = 13
	ExdQualifiersThreeSecondAverage       ExdQualifiers = 14
	ExdQualifiersTenSecondAverage         ExdQualifiers = 15
	ExdQualifiersThirtySecondAverage      ExdQualifiers = 16
	ExdQualifiersPercentMaximum           ExdQualifiers = 17
	ExdQualifiersPercentMaximumAverage    ExdQualifiers = 18
	ExdQualifiersLapPercentMaximum        ExdQualifiers = 19
	ExdQualifiersElapsed                  ExdQualifiers = 20
	ExdQualifiersSunrise                  ExdQualifiers = 21
	ExdQualifiersSunset                   ExdQualifiers = 22
	ExdQualifiersComparedToVirtualPartner ExdQualifiers = 23
	ExdQualifiersMaximum24H               ExdQualifiers = 24
	ExdQualifiersMinimum24H               ExdQualifiers = 25
	ExdQualifiersMinimum                  ExdQualifiers = 26
	ExdQualifiersFirst                    ExdQualifiers = 27
	ExdQualifiersSecond                   ExdQualifiers = 28
	ExdQualifiersThird                    ExdQualifiers = 29
	ExdQualifiersShifter                  ExdQualifiers = 30
	ExdQualifiersLastSport                ExdQualifiers = 31
	ExdQualifiersMoving                   ExdQualifiers = 32
	ExdQualifiersStopped                  ExdQualifiers = 33
	ExdQualifiersEstimatedTotal           ExdQualifiers = 34
	ExdQualifiersZone9                    ExdQualifiers = 242
	ExdQualifiersZone8                    ExdQualifiers = 243
	ExdQualifiersZone7                    ExdQualifiers = 244
	ExdQualifiersZone6                    ExdQualifiers = 245
	ExdQualifiersZone5                    ExdQualifiers = 246
	ExdQualifiersZone4                    ExdQualifiers = 247
	ExdQualifiersZone3                    ExdQualifiers = 248
	ExdQualifiersZone2                    ExdQualifiers = 249
	ExdQualifiersZone1                    ExdQualifiers = 250
	ExdQualifiersInvalid                  ExdQualifiers = 0xFF
)

type ExerciseCategory

type ExerciseCategory uint16

ExerciseCategory defines exercise category type

const (
	ExerciseCategoryBenchPress        ExerciseCategory = 0
	ExerciseCategoryCalfRaise         ExerciseCategory = 1
	ExerciseCategoryCardio            ExerciseCategory = 2
	ExerciseCategoryCarry             ExerciseCategory = 3
	ExerciseCategoryChop              ExerciseCategory = 4
	ExerciseCategoryCore              ExerciseCategory = 5
	ExerciseCategoryCrunch            ExerciseCategory = 6
	ExerciseCategoryCurl              ExerciseCategory = 7
	ExerciseCategoryDeadlift          ExerciseCategory = 8
	ExerciseCategoryFlye              ExerciseCategory = 9
	ExerciseCategoryHipRaise          ExerciseCategory = 10
	ExerciseCategoryHipStability      ExerciseCategory = 11
	ExerciseCategoryHipSwing          ExerciseCategory = 12
	ExerciseCategoryHyperextension    ExerciseCategory = 13
	ExerciseCategoryLateralRaise      ExerciseCategory = 14
	ExerciseCategoryLegCurl           ExerciseCategory = 15
	ExerciseCategoryLegRaise          ExerciseCategory = 16
	ExerciseCategoryLunge             ExerciseCategory = 17
	ExerciseCategoryOlympicLift       ExerciseCategory = 18
	ExerciseCategoryPlank             ExerciseCategory = 19
	ExerciseCategoryPlyo              ExerciseCategory = 20
	ExerciseCategoryPullUp            ExerciseCategory = 21
	ExerciseCategoryPushUp            ExerciseCategory = 22
	ExerciseCategoryRow               ExerciseCategory = 23
	ExerciseCategoryShoulderPress     ExerciseCategory = 24
	ExerciseCategoryShoulderStability ExerciseCategory = 25
	ExerciseCategoryShrug             ExerciseCategory = 26
	ExerciseCategorySitUp             ExerciseCategory = 27
	ExerciseCategorySquat             ExerciseCategory = 28
	ExerciseCategoryTotalBody         ExerciseCategory = 29
	ExerciseCategoryTricepsExtension  ExerciseCategory = 30
	ExerciseCategoryWarmUp            ExerciseCategory = 31
	ExerciseCategoryRun               ExerciseCategory = 32
	ExerciseCategoryUnknown           ExerciseCategory = 65534
	ExerciseCategoryInvalid           ExerciseCategory = 0xFFFF
)

type Field

type Field struct {
	Num      uint8
	Name     string
	Value    any
	RawValue any
	Units    string
	Scale    float64
	Offset   float64
}

Field represents a decoded field value

func (*Field) GetScaledValue

func (f *Field) GetScaledValue() float64

GetScaledValue returns the value with scale and offset applied

type FieldCapabilitiesMesg

type FieldCapabilitiesMesg struct {
	MessageIndex uint16
	File         File
	MesgNum      MesgNum
	FieldNum     uint8
	Count        uint16
}

FieldCapabilitiesMesg represents the field_capabilities message (message 39)

func (*FieldCapabilitiesMesg) GetMesgNum

func (m *FieldCapabilitiesMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*FieldCapabilitiesMesg) GetName

func (m *FieldCapabilitiesMesg) GetName() string

GetName implements the Message interface

type FieldComponent

type FieldComponent struct {
	FieldNum       uint8   // Target field number for the component
	Bits           uint8   // Number of bits for this component
	Scale          float64 // Scale factor
	Offset         float64 // Offset value
	Accumulate     bool    // Whether to accumulate values
	AccumulateBits uint8   // Bits for accumulation
}

FieldComponent represents a component that can be extracted from a field

func GetComponents

func GetComponents(fieldProfile *FieldProfile, getFieldValue func(fieldNum uint8) (int64, bool)) []FieldComponent

GetComponents returns the components to expand for a field considering any active subfield

type FieldDefinition

type FieldDefinition struct {
	FieldDefNum uint8
	Size        uint8
	BaseType    BaseType
}

FieldDefinition represents a field in a message definition

type FieldDescriptionMesg

type FieldDescriptionMesg struct {
	DeveloperDataIndex    uint8
	FieldDefinitionNumber uint8
	FitBaseTypeId         uint8
	FieldName             string
	Array                 uint8
	Components            string
	Scale                 uint8
	Offset                int8
	Units                 string
	Bits                  string
	Accumulate            string
	FitBaseUnitId         FitBaseUnit
	NativeMesgNum         MesgNum
	NativeFieldNum        uint8
}

FieldDescriptionMesg represents the field_description message (message 206)

func (*FieldDescriptionMesg) GetMesgNum

func (m *FieldDescriptionMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*FieldDescriptionMesg) GetName

func (m *FieldDescriptionMesg) GetName() string

GetName implements the Message interface

type FieldProfile

type FieldProfile struct {
	Num        uint8
	Name       string
	Type       BaseType
	Scale      float64
	Offset     float64
	Units      string
	Subfields  []Subfield
	Components []FieldComponent
}

FieldProfile contains profile information for a field

type File

type File uint8

File type constants

const (
	FileDevice           File = 1
	FileSettings         File = 2
	FileSport            File = 3
	FileActivity         File = 4
	FileWorkout          File = 5
	FileCourse           File = 6
	FileSchedules        File = 7
	FileWeight           File = 9
	FileTotals           File = 10
	FileGoals            File = 11
	FileBloodPressure    File = 14
	FileMonitoringA      File = 15
	FileActivitySummary  File = 20
	FileMonitoringDaily  File = 28
	FileMonitoringB      File = 32
	FileSegment          File = 34
	FileSegmentList      File = 35
	FileExdConfiguration File = 40
	FileMfgRangeMin      File = 0xF7
	FileMfgRangeMax      File = 0xFE
	FileInvalid          File = 0xFF
)

type FileCapabilitiesMesg

type FileCapabilitiesMesg struct {
	MessageIndex uint16
	Type         File
	Flags        FileFlags
	Directory    string
	MaxCount     uint16
	MaxSize      uint32
}

FileCapabilitiesMesg represents the file_capabilities message (message 37)

func (*FileCapabilitiesMesg) GetMesgNum

func (m *FileCapabilitiesMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*FileCapabilitiesMesg) GetName

func (m *FileCapabilitiesMesg) GetName() string

GetName implements the Message interface

type FileCreatorMesg

type FileCreatorMesg struct {
	SoftwareVersion uint16
	HardwareVersion uint8
}

FileCreatorMesg represents the file_creator message (message 49)

func (*FileCreatorMesg) GetMesgNum

func (m *FileCreatorMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*FileCreatorMesg) GetName

func (m *FileCreatorMesg) GetName() string

GetName implements the Message interface

type FileFlags

type FileFlags uint8

FileFlags defines file flags type

const (
	FileFlagsRead    FileFlags = 0x02
	FileFlagsWrite   FileFlags = 0x04
	FileFlagsErase   FileFlags = 0x08
	FileFlagsInvalid FileFlags = 0xFF
)

type FileHeader

type FileHeader struct {
	Size            uint8
	ProtocolVersion uint8
	ProfileVersion  uint16
	DataSize        uint32
	DataType        string
	CRC             uint16
}

FileHeader represents the FIT file header

func (*FileHeader) GetProfileVersionMajor

func (h *FileHeader) GetProfileVersionMajor() uint16

GetProfileVersionMajor returns the major profile version

func (*FileHeader) GetProfileVersionMinor

func (h *FileHeader) GetProfileVersionMinor() uint16

GetProfileVersionMinor returns the minor profile version

func (*FileHeader) GetProtocolVersionMajor

func (h *FileHeader) GetProtocolVersionMajor() uint8

GetProtocolVersionMajor returns the major protocol version

func (*FileHeader) GetProtocolVersionMinor

func (h *FileHeader) GetProtocolVersionMinor() uint8

GetProtocolVersionMinor returns the minor protocol version

type FileIdMesg

type FileIdMesg struct {
	Type         File
	Manufacturer Manufacturer
	Product      uint16
	SerialNumber uint32
	TimeCreated  DateTime
	Number       uint16
	ProductName  string
}

FileIdMesg represents the file_id message (message 0)

func (*FileIdMesg) GetMesgNum

func (m *FileIdMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*FileIdMesg) GetName

func (m *FileIdMesg) GetName() string

GetName implements the Message interface

func (*FileIdMesg) GetTimeCreated

func (m *FileIdMesg) GetTimeCreated() time.Time

GetTimeCreated returns the time created as time.Time

type FileIdMesgListener

type FileIdMesgListener func(mesg *FileIdMesg)

FileIdMesgListener is called for each file_id message

type FitBaseUnit

type FitBaseUnit uint16

FitBaseUnit constants

const (
	FitBaseUnitOther    FitBaseUnit = 0
	FitBaseUnitKilogram FitBaseUnit = 1
	FitBaseUnitPound    FitBaseUnit = 2
	FitBaseUnitInvalid  FitBaseUnit = 0xFFFF
)

type FitFile

type FitFile struct {
	Header       *FileHeader
	FileId       *FileIdMesg
	FileCreator  *FileCreatorMesg
	Activities   []*ActivityMesg
	Sessions     []*SessionMesg
	Laps         []*LapMesg
	Records      []*RecordMesg
	Events       []*EventMesg
	DeviceInfos  []*DeviceInfoMesg
	UserProfiles []*UserProfileMesg
	Sports       []*SportMesg
	Workouts     []*WorkoutMesg
	Courses      []*CourseMesg
	CoursePoints []*CoursePointMesg
	Hrvs         []*HrvMesg
	HrZones      []*HrZoneMesg
	PowerZones   []*PowerZoneMesg
	ZonesTargets []*ZonesTargetMesg
	WeightScales []*WeightScaleMesg
	Lengths      []*LengthMesg

	DeveloperDataIds  []*DeveloperDataIdMesg
	FieldDescriptions []*FieldDescriptionMesg

	// UnknownMessages contains messages not mapped to typed structs
	UnknownMessages []*GenericMessage

	// AllMessages contains all decoded messages in order
	AllMessages []Message
}

FitFile represents a decoded FIT file

func DecodeFile

func DecodeFile(data []byte) (*FitFile, error)

DecodeFile decodes a FIT file from bytes

func NewFitFile

func NewFitFile() *FitFile

NewFitFile creates a new empty FitFile

type FitnessEquipmentState added in v1.0.1

type FitnessEquipmentState byte

Fitnessequipmentstate type

const (
	FitnessEquipmentStateReady   FitnessEquipmentState = 0
	FitnessEquipmentStateInUse   FitnessEquipmentState = 1
	FitnessEquipmentStatePaused  FitnessEquipmentState = 2
	FitnessEquipmentStateUnknown FitnessEquipmentState = 3 // lost connection to fitness equipment
	FitnessEquipmentStateInvalid FitnessEquipmentState = 0xFF
)

type GarminProduct

type GarminProduct uint16

GarminProduct represents Garmin product IDs

const (
	GarminProductHrm1                       GarminProduct = 1
	GarminProductAxh01                      GarminProduct = 2 // AXH01 HRM chipset
	GarminProductAxb01                      GarminProduct = 3
	GarminProductAxb02                      GarminProduct = 4
	GarminProductHrm2ss                     GarminProduct = 5
	GarminProductDsiAlf02                   GarminProduct = 6
	GarminProductHrm3ss                     GarminProduct = 7
	GarminProductHrmRunSingleByteProductId  GarminProduct = 8  // hrm_run model for HRM ANT+ messaging
	GarminProductBsm                        GarminProduct = 9  // BSM model for ANT+ messaging
	GarminProductBcm                        GarminProduct = 10 // BCM model for ANT+ messaging
	GarminProductAxs01                      GarminProduct = 11 // AXS01 HRM Bike Chipset model for ANT+ messaging
	GarminProductHrmTriSingleByteProductId  GarminProduct = 12 // hrm_tri model for HRM ANT+ messaging
	GarminProductHrm4RunSingleByteProductId GarminProduct = 13 // hrm4 run model for HRM ANT+ messaging
	GarminProductFr225SingleByteProductId   GarminProduct = 14 // fr225 model for HRM ANT+ messaging
	GarminProductGen3BsmSingleByteProductId GarminProduct = 15 // gen3_bsm model for Bike Speed ANT+ messaging
	GarminProductGen3BcmSingleByteProductId GarminProduct = 16 // gen3_bcm model for Bike Cadence ANT+ messaging
	GarminProductHrmFitSingleByteProductId  GarminProduct = 22
	GarminProductOhr                        GarminProduct = 255 // Garmin Wearable Optical Heart Rate Sensor
	GarminProductFr301China                 GarminProduct = 473
	GarminProductFr301Japan                 GarminProduct = 474
	GarminProductFr301Korea                 GarminProduct = 475
	GarminProductFr301Taiwan                GarminProduct = 494
	GarminProductFr405                      GarminProduct = 717 // Forerunner 405
	GarminProductFr50                       GarminProduct = 782 // Forerunner 50
	GarminProductFr405Japan                 GarminProduct = 987
	GarminProductFr60                       GarminProduct = 988 // Forerunner 60
	GarminProductDsiAlf01                   GarminProduct = 1011
	GarminProductFr310xt                    GarminProduct = 1018 // Forerunner 310
	GarminProductEdge500                    GarminProduct = 1036
	GarminProductFr110                      GarminProduct = 1124 // Forerunner 110
	GarminProductEdge800                    GarminProduct = 1169
	GarminProductEdge500Taiwan              GarminProduct = 1199
	GarminProductEdge500Japan               GarminProduct = 1213
	GarminProductChirp                      GarminProduct = 1253
	GarminProductFr110Japan                 GarminProduct = 1274
	GarminProductEdge200                    GarminProduct = 1325
	GarminProductFr910xt                    GarminProduct = 1328
	GarminProductEdge800Taiwan              GarminProduct = 1333
	GarminProductEdge800Japan               GarminProduct = 1334
	GarminProductAlf04                      GarminProduct = 1341
	GarminProductFr610                      GarminProduct = 1345
	GarminProductFr210Japan                 GarminProduct = 1360
	GarminProductVectorSs                   GarminProduct = 1380
	GarminProductVectorCp                   GarminProduct = 1381
	GarminProductEdge800China               GarminProduct = 1386
	GarminProductEdge500China               GarminProduct = 1387
	GarminProductApproachG10                GarminProduct = 1405
	GarminProductFr610Japan                 GarminProduct = 1410
	GarminProductEdge500Korea               GarminProduct = 1422
	GarminProductFr70                       GarminProduct = 1436
	GarminProductFr310xt4t                  GarminProduct = 1446
	GarminProductAmx                        GarminProduct = 1461
	GarminProductFr10                       GarminProduct = 1482
	GarminProductEdge800Korea               GarminProduct = 1497
	GarminProductSwim                       GarminProduct = 1499
	GarminProductFr910xtChina               GarminProduct = 1537
	GarminProductFenix                      GarminProduct = 1551
	GarminProductEdge200Taiwan              GarminProduct = 1555
	GarminProductEdge510                    GarminProduct = 1561
	GarminProductEdge810                    GarminProduct = 1567
	GarminProductTempe                      GarminProduct = 1570
	GarminProductFr910xtJapan               GarminProduct = 1600
	GarminProductFr620                      GarminProduct = 1623
	GarminProductFr220                      GarminProduct = 1632
	GarminProductFr910xtKorea               GarminProduct = 1664
	GarminProductFr10Japan                  GarminProduct = 1688
	GarminProductEdge810Japan               GarminProduct = 1721
	GarminProductVirbElite                  GarminProduct = 1735
	GarminProductEdgeTouring                GarminProduct = 1736 // Also Edge Touring Plus
	GarminProductEdge510Japan               GarminProduct = 1742
	GarminProductHrmTri                     GarminProduct = 1743 // Also HRM-Swim
	GarminProductHrmRun                     GarminProduct = 1752
	GarminProductFr920xt                    GarminProduct = 1765
	GarminProductEdge510Asia                GarminProduct = 1821
	GarminProductEdge810China               GarminProduct = 1822
	GarminProductEdge810Taiwan              GarminProduct = 1823
	GarminProductEdge1000                   GarminProduct = 1836
	GarminProductVivoFit                    GarminProduct = 1837
	GarminProductVirbRemote                 GarminProduct = 1853
	GarminProductVivoKi                     GarminProduct = 1885
	GarminProductFr15                       GarminProduct = 1903
	GarminProductVivoActive                 GarminProduct = 1907
	GarminProductEdge510Korea               GarminProduct = 1918
	GarminProductFr620Japan                 GarminProduct = 1928
	GarminProductFr620China                 GarminProduct = 1929
	GarminProductFr220Japan                 GarminProduct = 1930
	GarminProductFr220China                 GarminProduct = 1931
	GarminProductApproachS6                 GarminProduct = 1936
	GarminProductVivoSmart                  GarminProduct = 1956
	GarminProductFenix2                     GarminProduct = 1967
	GarminProductEpix                       GarminProduct = 1988
	GarminProductFenix3                     GarminProduct = 2050
	GarminProductEdge1000Taiwan             GarminProduct = 2052
	GarminProductEdge1000Japan              GarminProduct = 2053
	GarminProductFr15Japan                  GarminProduct = 2061
	GarminProductEdge520                    GarminProduct = 2067
	GarminProductEdge1000China              GarminProduct = 2070
	GarminProductFr620Russia                GarminProduct = 2072
	GarminProductFr220Russia                GarminProduct = 2073
	GarminProductVectorS                    GarminProduct = 2079
	GarminProductEdge1000Korea              GarminProduct = 2100
	GarminProductFr920xtTaiwan              GarminProduct = 2130
	GarminProductFr920xtChina               GarminProduct = 2131
	GarminProductFr920xtJapan               GarminProduct = 2132
	GarminProductVirbx                      GarminProduct = 2134
	GarminProductVivoSmartApac              GarminProduct = 2135
	GarminProductEtrexTouch                 GarminProduct = 2140
	GarminProductEdge25                     GarminProduct = 2147
	GarminProductFr25                       GarminProduct = 2148
	GarminProductVivoFit2                   GarminProduct = 2150
	GarminProductFr225                      GarminProduct = 2153
	GarminProductFr630                      GarminProduct = 2156
	GarminProductFr230                      GarminProduct = 2157
	GarminProductFr735xt                    GarminProduct = 2158
	GarminProductVivoActiveApac             GarminProduct = 2160
	GarminProductVector2                    GarminProduct = 2161
	GarminProductVector2s                   GarminProduct = 2162
	GarminProductVirbxe                     GarminProduct = 2172
	GarminProductFr620Taiwan                GarminProduct = 2173
	GarminProductFr220Taiwan                GarminProduct = 2174
	GarminProductTruswing                   GarminProduct = 2175
	GarminProductD2airvenu                  GarminProduct = 2187
	GarminProductFenix3China                GarminProduct = 2188
	GarminProductFenix3Twn                  GarminProduct = 2189
	GarminProductVariaHeadlight             GarminProduct = 2192
	GarminProductVariaTaillightOld          GarminProduct = 2193
	GarminProductEdgeExplore1000            GarminProduct = 2204
	GarminProductFr225Asia                  GarminProduct = 2219
	GarminProductVariaRadarTaillight        GarminProduct = 2225
	GarminProductVariaRadarDisplay          GarminProduct = 2226
	GarminProductEdge20                     GarminProduct = 2238
	GarminProductEdge520Asia                GarminProduct = 2260
	GarminProductEdge520Japan               GarminProduct = 2261
	GarminProductD2Bravo                    GarminProduct = 2262
	GarminProductApproachS20                GarminProduct = 2266
	GarminProductVivoSmart2                 GarminProduct = 2271
	GarminProductEdge1000Thai               GarminProduct = 2274
	GarminProductVariaRemote                GarminProduct = 2276
	GarminProductEdge25Asia                 GarminProduct = 2288
	GarminProductEdge25Jpn                  GarminProduct = 2289
	GarminProductEdge20Asia                 GarminProduct = 2290
	GarminProductApproachX40                GarminProduct = 2292
	GarminProductFenix3Japan                GarminProduct = 2293
	GarminProductVivoSmartEmea              GarminProduct = 2294
	GarminProductFr630Asia                  GarminProduct = 2310
	GarminProductFr630Jpn                   GarminProduct = 2311
	GarminProductFr230Jpn                   GarminProduct = 2313
	GarminProductHrm4Run                    GarminProduct = 2327
	GarminProductEpixJapan                  GarminProduct = 2332
	GarminProductVivoActiveHr               GarminProduct = 2337
	GarminProductVivoSmartGpsHr             GarminProduct = 2347
	GarminProductVivoSmartHr                GarminProduct = 2348
	GarminProductVivoSmartHrAsia            GarminProduct = 2361
	GarminProductVivoSmartGpsHrAsia         GarminProduct = 2362
	GarminProductVivoMove                   GarminProduct = 2368
	GarminProductVariaTaillight             GarminProduct = 2379
	GarminProductFr235Asia                  GarminProduct = 2396
	GarminProductFr235Japan                 GarminProduct = 2397
	GarminProductVariaVision                GarminProduct = 2398
	GarminProductVivoFit3                   GarminProduct = 2406
	GarminProductFenix3Korea                GarminProduct = 2407
	GarminProductFenix3Sea                  GarminProduct = 2408
	GarminProductFenix3Hr                   GarminProduct = 2413
	GarminProductVirbUltra30                GarminProduct = 2417
	GarminProductIndexSmartScale            GarminProduct = 2429
	GarminProductFr235                      GarminProduct = 2431
	GarminProductFenix3Chronos              GarminProduct = 2432
	GarminProductOregon7xx                  GarminProduct = 2441
	GarminProductRino7xx                    GarminProduct = 2444
	GarminProductEpixKorea                  GarminProduct = 2457
	GarminProductFenix3HrChn                GarminProduct = 2473
	GarminProductFenix3HrTwn                GarminProduct = 2474
	GarminProductFenix3HrJpn                GarminProduct = 2475
	GarminProductFenix3HrSea                GarminProduct = 2476
	GarminProductFenix3HrKor                GarminProduct = 2477
	GarminProductNautix                     GarminProduct = 2496
	GarminProductVivoActiveHrApac           GarminProduct = 2497
	GarminProductFr35                       GarminProduct = 2503
	GarminProductOregon7xxWw                GarminProduct = 2512
	GarminProductEdge820                    GarminProduct = 2530
	GarminProductEdgeExplore820             GarminProduct = 2531
	GarminProductFr735xtApac                GarminProduct = 2533
	GarminProductFr735xtJapan               GarminProduct = 2534
	GarminProductFenix5s                    GarminProduct = 2544
	GarminProductD2BravoTitanium            GarminProduct = 2547
	GarminProductVariaUt800                 GarminProduct = 2567 // Varia UT 800 SW
	GarminProductRunningDynamicsPod         GarminProduct = 2593
	GarminProductEdge820China               GarminProduct = 2599
	GarminProductEdge820Japan               GarminProduct = 2600
	GarminProductFenix5x                    GarminProduct = 2604
	GarminProductVivoFitJr                  GarminProduct = 2606
	GarminProductVivoSmart3                 GarminProduct = 2622
	GarminProductVivoSport                  GarminProduct = 2623
	GarminProductEdge820Taiwan              GarminProduct = 2628
	GarminProductEdge820Korea               GarminProduct = 2629
	GarminProductEdge820Sea                 GarminProduct = 2630
	GarminProductFr35Hebrew                 GarminProduct = 2650
	GarminProductApproachS60                GarminProduct = 2656
	GarminProductFr35Apac                   GarminProduct = 2667
	GarminProductFr35Japan                  GarminProduct = 2668
	GarminProductFenix3ChronosAsia          GarminProduct = 2675
	GarminProductVirb360                    GarminProduct = 2687
	GarminProductFr935                      GarminProduct = 2691
	GarminProductFenix5                     GarminProduct = 2697
	GarminProductVivoactive3                GarminProduct = 2700
	GarminProductEdge1030                   GarminProduct = 2713
	GarminProductFr35Sea                    GarminProduct = 2727
	GarminProductFr235ChinaNfc              GarminProduct = 2733
	GarminProductForetrex601701             GarminProduct = 2769
	GarminProductVivoMoveHr                 GarminProduct = 2772
	GarminProductVector3                    GarminProduct = 2787
	GarminProductFenix5Asia                 GarminProduct = 2796
	GarminProductFenix5sAsia                GarminProduct = 2797
	GarminProductFenix5xAsia                GarminProduct = 2798
	GarminProductApproachZ80                GarminProduct = 2806
	GarminProductFr35Korea                  GarminProduct = 2814
	GarminProductD2charlie                  GarminProduct = 2819
	GarminProductVivoSmart3Apac             GarminProduct = 2831
	GarminProductVivoSportApac              GarminProduct = 2832
	GarminProductFr935Asia                  GarminProduct = 2833
	GarminProductDescent                    GarminProduct = 2859
	GarminProductVivoFit4                   GarminProduct = 2878
	GarminProductFr645                      GarminProduct = 2886
	GarminProductFr645m                     GarminProduct = 2888
	GarminProductFr30                       GarminProduct = 2891
	GarminProductFenix5sPlus                GarminProduct = 2900
	GarminProductEdge130                    GarminProduct = 2909
	GarminProductEdge1030Asia               GarminProduct = 2924
	GarminProductVivosmart4                 GarminProduct = 2927
	GarminProductVivoMoveHrAsia             GarminProduct = 2945
	GarminProductApproachX10                GarminProduct = 2962
	GarminProductFr30Asia                   GarminProduct = 2977
	GarminProductVivoactive3mW              GarminProduct = 2988
	GarminProductFr645Asia                  GarminProduct = 3003
	GarminProductFr645mAsia                 GarminProduct = 3004
	GarminProductEdgeExplore                GarminProduct = 3011
	GarminProductGpsmap66                   GarminProduct = 3028
	GarminProductApproachS10                GarminProduct = 3049
	GarminProductVivoactive3mL              GarminProduct = 3066
	GarminProductFr245                      GarminProduct = 3076
	GarminProductFr245Music                 GarminProduct = 3077
	GarminProductApproachG80                GarminProduct = 3085
	GarminProductEdge130Asia                GarminProduct = 3092
	GarminProductEdge1030Bontrager          GarminProduct = 3095
	GarminProductFenix5Plus                 GarminProduct = 3110
	GarminProductFenix5xPlus                GarminProduct = 3111
	GarminProductEdge520Plus                GarminProduct = 3112
	GarminProductFr945                      GarminProduct = 3113
	GarminProductEdge530                    GarminProduct = 3121
	GarminProductEdge830                    GarminProduct = 3122
	GarminProductInstinctEsports            GarminProduct = 3126
	GarminProductFenix5sPlusApac            GarminProduct = 3134
	GarminProductFenix5xPlusApac            GarminProduct = 3135
	GarminProductEdge520PlusApac            GarminProduct = 3142
	GarminProductDescentT1                  GarminProduct = 3143
	GarminProductFr235lAsia                 GarminProduct = 3144
	GarminProductFr245Asia                  GarminProduct = 3145
	GarminProductVivoActive3mApac           GarminProduct = 3163
	GarminProductGen3Bsm                    GarminProduct = 3192 // gen3 bike speed sensor
	GarminProductGen3Bcm                    GarminProduct = 3193 // gen3 bike cadence sensor
	GarminProductVivoSmart4Asia             GarminProduct = 3218
	GarminProductVivoactive4Small           GarminProduct = 3224
	GarminProductVivoactive4Large           GarminProduct = 3225
	GarminProductVenu                       GarminProduct = 3226
	GarminProductMarqDriver                 GarminProduct = 3246
	GarminProductMarqAviator                GarminProduct = 3247
	GarminProductMarqCaptain                GarminProduct = 3248
	GarminProductMarqCommander              GarminProduct = 3249
	GarminProductMarqExpedition             GarminProduct = 3250
	GarminProductMarqAthlete                GarminProduct = 3251
	GarminProductDescentMk2                 GarminProduct = 3258
	GarminProductFr45                       GarminProduct = 3282
	GarminProductGpsmap66i                  GarminProduct = 3284
	GarminProductFenix6sSport               GarminProduct = 3287
	GarminProductFenix6s                    GarminProduct = 3288
	GarminProductFenix6Sport                GarminProduct = 3289
	GarminProductFenix6                     GarminProduct = 3290
	GarminProductFenix6x                    GarminProduct = 3291
	GarminProductHrmDual                    GarminProduct = 3299 // HRM-Dual
	GarminProductHrmPro                     GarminProduct = 3300 // HRM-Pro
	GarminProductVivoMove3Premium           GarminProduct = 3308
	GarminProductApproachS40                GarminProduct = 3314
	GarminProductFr245mAsia                 GarminProduct = 3321
	GarminProductEdge530Apac                GarminProduct = 3349
	GarminProductEdge830Apac                GarminProduct = 3350
	GarminProductVivoMove3                  GarminProduct = 3378
	GarminProductVivoActive4SmallAsia       GarminProduct = 3387
	GarminProductVivoActive4LargeAsia       GarminProduct = 3388
	GarminProductVivoActive4OledAsia        GarminProduct = 3389
	GarminProductSwim2                      GarminProduct = 3405
	GarminProductMarqDriverAsia             GarminProduct = 3420
	GarminProductMarqAviatorAsia            GarminProduct = 3421
	GarminProductVivoMove3Asia              GarminProduct = 3422
	GarminProductFr945Asia                  GarminProduct = 3441
	GarminProductVivoActive3tChn            GarminProduct = 3446
	GarminProductMarqCaptainAsia            GarminProduct = 3448
	GarminProductMarqCommanderAsia          GarminProduct = 3449
	GarminProductMarqExpeditionAsia         GarminProduct = 3450
	GarminProductMarqAthleteAsia            GarminProduct = 3451
	GarminProductIndexSmartScale2           GarminProduct = 3461
	GarminProductInstinctSolar              GarminProduct = 3466
	GarminProductFr45Asia                   GarminProduct = 3469
	GarminProductVivoactive3Daimler         GarminProduct = 3473
	GarminProductLegacyRey                  GarminProduct = 3498
	GarminProductLegacyDarthVader           GarminProduct = 3499
	GarminProductLegacyCaptainMarvel        GarminProduct = 3500
	GarminProductLegacyFirstAvenger         GarminProduct = 3501
	GarminProductFenix6sSportAsia           GarminProduct = 3512
	GarminProductFenix6sAsia                GarminProduct = 3513
	GarminProductFenix6SportAsia            GarminProduct = 3514
	GarminProductFenix6Asia                 GarminProduct = 3515
	GarminProductFenix6xAsia                GarminProduct = 3516
	GarminProductLegacyCaptainMarvelAsia    GarminProduct = 3535
	GarminProductLegacyFirstAvengerAsia     GarminProduct = 3536
	GarminProductLegacyReyAsia              GarminProduct = 3537
	GarminProductLegacyDarthVaderAsia       GarminProduct = 3538
	GarminProductDescentMk2s                GarminProduct = 3542
	GarminProductEdge130Plus                GarminProduct = 3558
	GarminProductEdge1030Plus               GarminProduct = 3570
	GarminProductRally200                   GarminProduct = 3578 // Rally 100/200 Power Meter Series
	GarminProductFr745                      GarminProduct = 3589
	GarminProductVenusqMusic                GarminProduct = 3596
	GarminProductVenusqMusicV2              GarminProduct = 3599
	GarminProductVenusq                     GarminProduct = 3600
	GarminProductLily                       GarminProduct = 3615
	GarminProductMarqAdventurer             GarminProduct = 3624
	GarminProductEnduro                     GarminProduct = 3638
	GarminProductSwim2Apac                  GarminProduct = 3639
	GarminProductMarqAdventurerAsia         GarminProduct = 3648
	GarminProductFr945Lte                   GarminProduct = 3652
	GarminProductDescentMk2Asia             GarminProduct = 3702 // Mk2 and Mk2i
	GarminProductVenu2                      GarminProduct = 3703
	GarminProductVenu2s                     GarminProduct = 3704
	GarminProductVenuDaimlerAsia            GarminProduct = 3737
	GarminProductMarqGolfer                 GarminProduct = 3739
	GarminProductVenuDaimler                GarminProduct = 3740
	GarminProductFr745Asia                  GarminProduct = 3794
	GarminProductVariaRct715                GarminProduct = 3808
	GarminProductLilyAsia                   GarminProduct = 3809
	GarminProductEdge1030PlusAsia           GarminProduct = 3812
	GarminProductEdge130PlusAsia            GarminProduct = 3813
	GarminProductApproachS12                GarminProduct = 3823
	GarminProductVenusqAsia                 GarminProduct = 3837
	GarminProductEdge1040                   GarminProduct = 3843
	GarminProductMarqGolferAsia             GarminProduct = 3850
	GarminProductVenu2Plus                  GarminProduct = 3851
	GarminProductGnss                       GarminProduct = 3865 // Airoha AG3335M Family
	GarminProductFr55                       GarminProduct = 3869
	GarminProductEnduroAsia                 GarminProduct = 3872
	GarminProductInstinct2                  GarminProduct = 3888
	GarminProductInstinct2s                 GarminProduct = 3889
	GarminProductFenix7s                    GarminProduct = 3905
	GarminProductFenix7                     GarminProduct = 3906
	GarminProductFenix7x                    GarminProduct = 3907
	GarminProductFenix7sApac                GarminProduct = 3908
	GarminProductFenix7Apac                 GarminProduct = 3909
	GarminProductFenix7xApac                GarminProduct = 3910
	GarminProductApproachG12                GarminProduct = 3927
	GarminProductDescentMk2sAsia            GarminProduct = 3930
	GarminProductApproachS42                GarminProduct = 3934
	GarminProductEpixGen2                   GarminProduct = 3943
	GarminProductEpixGen2Apac               GarminProduct = 3944
	GarminProductVenu2sAsia                 GarminProduct = 3949
	GarminProductVenu2Asia                  GarminProduct = 3950
	GarminProductFr945LteAsia               GarminProduct = 3978
	GarminProductVivoMoveSport              GarminProduct = 3982
	GarminProductVivomoveTrend              GarminProduct = 3983
	GarminProductApproachS12Asia            GarminProduct = 3986
	GarminProductFr255Music                 GarminProduct = 3990
	GarminProductFr255SmallMusic            GarminProduct = 3991
	GarminProductFr255                      GarminProduct = 3992
	GarminProductFr255Small                 GarminProduct = 3993
	GarminProductApproachG12Asia            GarminProduct = 4001
	GarminProductApproachS42Asia            GarminProduct = 4002
	GarminProductDescentG1                  GarminProduct = 4005
	GarminProductVenu2PlusAsia              GarminProduct = 4017
	GarminProductFr955                      GarminProduct = 4024
	GarminProductFr55Asia                   GarminProduct = 4033
	GarminProductEdge540                    GarminProduct = 4061
	GarminProductEdge840                    GarminProduct = 4062
	GarminProductVivosmart5                 GarminProduct = 4063
	GarminProductInstinct2Asia              GarminProduct = 4071
	GarminProductMarqGen2                   GarminProduct = 4105 // Adventurer, Athlete, Captain, Golfer
	GarminProductVenusq2                    GarminProduct = 4115
	GarminProductVenusq2music               GarminProduct = 4116
	GarminProductMarqGen2Aviator            GarminProduct = 4124
	GarminProductD2AirX10                   GarminProduct = 4125
	GarminProductHrmProPlus                 GarminProduct = 4130
	GarminProductDescentG1Asia              GarminProduct = 4132
	GarminProductTactix7                    GarminProduct = 4135
	GarminProductInstinctCrossover          GarminProduct = 4155
	GarminProductEdgeExplore2               GarminProduct = 4169
	GarminProductDescentMk3                 GarminProduct = 4222
	GarminProductDescentMk3i                GarminProduct = 4223
	GarminProductApproachS70                GarminProduct = 4233
	GarminProductFr265Large                 GarminProduct = 4257
	GarminProductFr265Small                 GarminProduct = 4258
	GarminProductVenu3                      GarminProduct = 4260
	GarminProductVenu3s                     GarminProduct = 4261
	GarminProductTacxNeoSmart               GarminProduct = 4265 // Neo Smart, Tacx
	GarminProductTacxNeo2Smart              GarminProduct = 4266 // Neo 2 Smart, Tacx
	GarminProductTacxNeo2tSmart             GarminProduct = 4267 // Neo 2T Smart, Tacx
	GarminProductTacxNeoSmartBike           GarminProduct = 4268 // Neo Smart Bike, Tacx
	GarminProductTacxSatoriSmart            GarminProduct = 4269 // Satori Smart, Tacx
	GarminProductTacxFlowSmart              GarminProduct = 4270 // Flow Smart, Tacx
	GarminProductTacxVortexSmart            GarminProduct = 4271 // Vortex Smart, Tacx
	GarminProductTacxBushidoSmart           GarminProduct = 4272 // Bushido Smart, Tacx
	GarminProductTacxGeniusSmart            GarminProduct = 4273 // Genius Smart, Tacx
	GarminProductTacxFluxFluxSSmart         GarminProduct = 4274 // Flux/Flux S Smart, Tacx
	GarminProductTacxFlux2Smart             GarminProduct = 4275 // Flux 2 Smart, Tacx
	GarminProductTacxMagnum                 GarminProduct = 4276 // Magnum, Tacx
	GarminProductEdge1040Asia               GarminProduct = 4305
	GarminProductEpixGen2Pro42              GarminProduct = 4312
	GarminProductEpixGen2Pro47              GarminProduct = 4313
	GarminProductEpixGen2Pro51              GarminProduct = 4314
	GarminProductFr965                      GarminProduct = 4315
	GarminProductEnduro2                    GarminProduct = 4341
	GarminProductFenix7sProSolar            GarminProduct = 4374
	GarminProductFenix7ProSolar             GarminProduct = 4375
	GarminProductFenix7xProSolar            GarminProduct = 4376
	GarminProductLily2                      GarminProduct = 4380
	GarminProductInstinct2x                 GarminProduct = 4394
	GarminProductVivoactive5                GarminProduct = 4426
	GarminProductFr165                      GarminProduct = 4432
	GarminProductFr165Music                 GarminProduct = 4433
	GarminProductEdge1050                   GarminProduct = 4440
	GarminProductDescentT2                  GarminProduct = 4442
	GarminProductHrmFit                     GarminProduct = 4446
	GarminProductMarqGen2Commander          GarminProduct = 4472
	GarminProductLilyAthlete                GarminProduct = 4477 // aka the Lily 2 Active
	GarminProductRallyX10                   GarminProduct = 4525 // Rally 110/210
	GarminProductFenix8Solar                GarminProduct = 4532
	GarminProductFenix8SolarLarge           GarminProduct = 4533
	GarminProductFenix8Small                GarminProduct = 4534
	GarminProductFenix8                     GarminProduct = 4536
	GarminProductD2Mach1Pro                 GarminProduct = 4556
	GarminProductEnduro3                    GarminProduct = 4575
	GarminProductInstincte40mm              GarminProduct = 4583
	GarminProductInstincte45mm              GarminProduct = 4584
	GarminProductInstinct3Solar45mm         GarminProduct = 4585
	GarminProductInstinct3Amoled45mm        GarminProduct = 4586
	GarminProductInstinct3Amoled50mm        GarminProduct = 4587
	GarminProductDescentG2                  GarminProduct = 4588
	GarminProductVenuX1                     GarminProduct = 4603
	GarminProductHrm200                     GarminProduct = 4606
	GarminProductVivoactive6                GarminProduct = 4625
	GarminProductFenix8Pro                  GarminProduct = 4631
	GarminProductEdge550                    GarminProduct = 4633
	GarminProductEdge850                    GarminProduct = 4634
	GarminProductVenu4                      GarminProduct = 4643
	GarminProductVenu4s                     GarminProduct = 4644
	GarminProductApproachs44                GarminProduct = 4647
	GarminProductEdgeMtb                    GarminProduct = 4655
	GarminProductApproachs50                GarminProduct = 4656
	GarminProductFenixE                     GarminProduct = 4666
	GarminProductInstinctCrossoverAmoled    GarminProduct = 4678
	GarminProductBounce2                    GarminProduct = 4745
	GarminProductInstinct3Solar50mm         GarminProduct = 4759
	GarminProductTactix8Amoled              GarminProduct = 4775
	GarminProductTactix8Solar               GarminProduct = 4776
	GarminProductD2Mach2                    GarminProduct = 4879
	GarminProductD2AirX15                   GarminProduct = 4944
	GarminProductSdm4                       GarminProduct = 10007 // SDM4 footpod
	GarminProductEdgeRemote                 GarminProduct = 10014
	GarminProductTacxTrainingAppWin         GarminProduct = 20533
	GarminProductTacxTrainingAppMac         GarminProduct = 20534
	GarminProductTacxTrainingAppMacCatalyst GarminProduct = 20565
	GarminProductTrainingCenter             GarminProduct = 20119
	GarminProductTacxTrainingAppAndroid     GarminProduct = 30045
	GarminProductTacxTrainingAppIos         GarminProduct = 30046
	GarminProductTacxTrainingAppLegacy      GarminProduct = 30047
	GarminProductConnectiqSimulator         GarminProduct = 65531
	GarminProductAndroidAntplusPlugin       GarminProduct = 65532
	GarminProductConnect                    GarminProduct = 65534 // Garmin Connect website
	GarminProductInvalid                    GarminProduct = 0xFFFF
)

Garmin product constants

type Gender

type Gender uint8

Gender constants

const (
	GenderFemale  Gender = 0
	GenderMale    Gender = 1
	GenderInvalid Gender = 0xFF
)

type GenericMessage

type GenericMessage struct {
	MesgNum         MesgNum
	LocalMesgNum    uint8
	Fields          map[uint8]*Field
	DeveloperFields []*DeveloperField
}

GenericMessage represents any FIT message with raw field values

func (*GenericMessage) GetField

func (m *GenericMessage) GetField(fieldNum uint8) *Field

GetField returns a field by its field definition number

func (*GenericMessage) GetFieldValue

func (m *GenericMessage) GetFieldValue(fieldNum uint8) any

GetFieldValue returns the value of a field by its number

func (*GenericMessage) GetMesgNum

func (m *GenericMessage) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*GenericMessage) GetName

func (m *GenericMessage) GetName() string

GetName implements the Message interface

type Goal

type Goal uint8

Goal defines goal type

const (
	GoalTime          Goal = 0
	GoalDistance      Goal = 1
	GoalCalories      Goal = 2
	GoalFrequency     Goal = 3
	GoalSteps         Goal = 4
	GoalAscent        Goal = 5
	GoalActiveMinutes Goal = 6
	GoalInvalid       Goal = 0xFF
)

type GoalMesg

type GoalMesg struct {
	MessageIndex    uint16
	Sport           Sport
	SubSport        SubSport
	StartDate       DateTime
	EndDate         DateTime
	Type            Goal
	Value           uint32
	Repeat          Bool
	TargetValue     uint32
	Recurrence      GoalRecurrence
	RecurrenceValue uint16
	Enabled         Bool
	Source          GoalSource
}

GoalMesg represents the goal message (message 15)

func (*GoalMesg) GetMesgNum

func (m *GoalMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*GoalMesg) GetName

func (m *GoalMesg) GetName() string

GetName implements the Message interface

type GoalRecurrence

type GoalRecurrence uint8

GoalRecurrence defines goal recurrence type

const (
	GoalRecurrenceOff     GoalRecurrence = 0
	GoalRecurrenceDaily   GoalRecurrence = 1
	GoalRecurrenceWeekly  GoalRecurrence = 2
	GoalRecurrenceMonthly GoalRecurrence = 3
	GoalRecurrenceYearly  GoalRecurrence = 4
	GoalRecurrenceCustom  GoalRecurrence = 5
	GoalRecurrenceInvalid GoalRecurrence = 0xFF
)

type GoalSource

type GoalSource uint8

GoalSource defines goal source type

const (
	GoalSourceAuto      GoalSource = 0
	GoalSourceCommunity GoalSource = 1
	GoalSourceUser      GoalSource = 2
	GoalSourceInvalid   GoalSource = 0xFF
)

type HrType

type HrType uint8

HrType defines HR type

const (
	HrTypeNormal    HrType = 0
	HrTypeIrregular HrType = 1
	HrTypeInvalid   HrType = 0xFF
)

type HrZoneCalc

type HrZoneCalc uint8

HrZoneCalc defines HR zone calculation type

const (
	HrZoneCalcCustom       HrZoneCalc = 0
	HrZoneCalcPercentMaxHr HrZoneCalc = 1
	HrZoneCalcPercentHrr   HrZoneCalc = 2
	HrZoneCalcPercentLthr  HrZoneCalc = 3
	HrZoneCalcInvalid      HrZoneCalc = 0xFF
)

type HrZoneMesg

type HrZoneMesg struct {
	MessageIndex uint16
	HighBpm      uint8
	Name         string
}

HrZoneMesg represents the hr_zone message (message 8)

func (*HrZoneMesg) GetMesgNum

func (m *HrZoneMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*HrZoneMesg) GetName

func (m *HrZoneMesg) GetName() string

GetName implements the Message interface

type HrmProfileMesg

type HrmProfileMesg struct {
	MessageIndex      uint16
	Enabled           Bool
	HrmAntId          uint16
	LogHrv            Bool
	HrmAntIdTransType uint8
}

UserProfileFullMesg represents the user_profile message with all fields (message 3) Extends UserProfileMesg with additional fields

func (*HrmProfileMesg) GetMesgNum

func (m *HrmProfileMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*HrmProfileMesg) GetName

func (m *HrmProfileMesg) GetName() string

GetName implements the Message interface

type HrvMesg

type HrvMesg struct {
	Time []uint16 // 1000 * s - RR intervals
}

HrvMesg represents the hrv message (message 78)

func (*HrvMesg) GetMesgNum

func (m *HrvMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*HrvMesg) GetName

func (m *HrvMesg) GetName() string

GetName implements the Message interface

func (*HrvMesg) GetTimeScaled

func (m *HrvMesg) GetTimeScaled() []float64

GetTimeScaled returns RR intervals in milliseconds

type HrvMesgListener

type HrvMesgListener func(mesg *HrvMesg)

HrvMesgListener is called for each hrv message

type HrvStatus added in v1.0.1

type HrvStatus byte

Hrvstatus type

const (
	HrvStatusNone       HrvStatus = 0
	HrvStatusPoor       HrvStatus = 1
	HrvStatusLow        HrvStatus = 2
	HrvStatusUnbalanced HrvStatus = 3
	HrvStatusBalanced   HrvStatus = 4
	HrvStatusInvalid    HrvStatus = 0xFF
)

type Intensity

type Intensity uint8

Intensity constants

const (
	IntensityActive   Intensity = 0
	IntensityRest     Intensity = 1
	IntensityWarmup   Intensity = 2
	IntensityCooldown Intensity = 3
	IntensityRecovery Intensity = 4
	IntensityInterval Intensity = 5
	IntensityOther    Intensity = 6
	IntensityInvalid  Intensity = 0xFF
)

type Language

type Language uint8

Language constants

const (
	LanguageEnglish  Language = 0
	LanguageFrench   Language = 1
	LanguageItalian  Language = 2
	LanguageGerman   Language = 3
	LanguageSpanish  Language = 4
	LanguageRussian  Language = 18
	LanguageJapanese Language = 27
	LanguageKorean   Language = 28
	LanguageChinese  Language = 26
	LanguageCustom   Language = 254
	LanguageInvalid  Language = 0xFF
)

type LapMesg

type LapMesg struct {
	MessageIndex        uint16
	Timestamp           DateTime
	Event               Event
	EventType           EventType
	StartTime           DateTime
	StartPositionLat    int32
	StartPositionLong   int32
	EndPositionLat      int32
	EndPositionLong     int32
	TotalElapsedTime    uint32 // 1000 * s
	TotalTimerTime      uint32 // 1000 * s
	TotalDistance       uint32 // 100 * m
	TotalCycles         uint32
	TotalCalories       uint16
	TotalFatCalories    uint16
	AvgSpeed            uint16 // 1000 * m/s
	MaxSpeed            uint16 // 1000 * m/s
	AvgHeartRate        uint8
	MaxHeartRate        uint8
	AvgCadence          uint8
	MaxCadence          uint8
	AvgPower            uint16
	MaxPower            uint16
	TotalAscent         uint16
	TotalDescent        uint16
	Intensity           Intensity
	LapTrigger          LapTrigger
	Sport               Sport
	SubSport            SubSport
	EventGroup          uint8
	NumLengths          uint16
	NormalizedPower     uint16
	LeftRightBalance    uint16
	FirstLengthIndex    uint16
	AvgStrokeDistance   uint16 // 100 * m
	SwimStroke          SwimStroke
	NumActiveLengths    uint16
	TotalWork           uint32
	AvgAltitude         uint16 // 5 * m + 500
	MaxAltitude         uint16 // 5 * m + 500
	MinAltitude         uint16 // 5 * m + 500
	GpsAccuracy         uint8
	AvgGrade            int16 // 100 * %
	AvgPosGrade         int16 // 100 * %
	AvgNegGrade         int16 // 100 * %
	MaxPosGrade         int16 // 100 * %
	MaxNegGrade         int16 // 100 * %
	AvgTemperature      int8
	MaxTemperature      int8
	EnhancedAvgSpeed    uint32 // 1000 * m/s
	EnhancedMaxSpeed    uint32 // 1000 * m/s
	EnhancedAvgAltitude uint32 // 5 * m + 500
	EnhancedMinAltitude uint32 // 5 * m + 500
	EnhancedMaxAltitude uint32 // 5 * m + 500
}

LapMesg represents the lap message (message 19)

func (*LapMesg) GetAvgSpeedScaled

func (m *LapMesg) GetAvgSpeedScaled() float64

GetAvgSpeedScaled returns average speed in m/s

func (*LapMesg) GetMaxSpeedScaled

func (m *LapMesg) GetMaxSpeedScaled() float64

GetMaxSpeedScaled returns max speed in m/s

func (*LapMesg) GetMesgNum

func (m *LapMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*LapMesg) GetName

func (m *LapMesg) GetName() string

GetName implements the Message interface

func (*LapMesg) GetStartTime

func (m *LapMesg) GetStartTime() time.Time

GetStartTime returns the start time as time.Time

func (*LapMesg) GetTimestamp

func (m *LapMesg) GetTimestamp() time.Time

GetTimestamp returns the timestamp as time.Time

func (*LapMesg) GetTotalDistanceScaled

func (m *LapMesg) GetTotalDistanceScaled() float64

GetTotalDistanceScaled returns total distance in meters

func (*LapMesg) GetTotalElapsedTimeScaled

func (m *LapMesg) GetTotalElapsedTimeScaled() float64

GetTotalElapsedTimeScaled returns total elapsed time in seconds

func (*LapMesg) GetTotalTimerTimeScaled

func (m *LapMesg) GetTotalTimerTimeScaled() float64

GetTotalTimerTimeScaled returns total timer time in seconds

type LapMesgListener

type LapMesgListener func(mesg *LapMesg)

LapMesgListener is called for each lap message

type LapTrigger

type LapTrigger uint8

LapTrigger constants

const (
	LapTriggerManual           LapTrigger = 0
	LapTriggerTime             LapTrigger = 1
	LapTriggerDistance         LapTrigger = 2
	LapTriggerPositionStart    LapTrigger = 3
	LapTriggerPositionLap      LapTrigger = 4
	LapTriggerPositionWaypoint LapTrigger = 5
	LapTriggerPositionMarked   LapTrigger = 6
	LapTriggerSessionEnd       LapTrigger = 7
	LapTriggerFitnessEquipment LapTrigger = 8
	LapTriggerInvalid          LapTrigger = 0xFF
)

type LeftRightBalance

type LeftRightBalance uint8

LeftRightBalance constants

const (
	LeftRightBalanceMask  LeftRightBalance = 0x7F
	LeftRightBalanceRight LeftRightBalance = 0x80
)

type LeftRightBalance100

type LeftRightBalance100 uint16

LeftRightBalance100 defines left-right balance with 100 offset

const (
	LeftRightBalance100Mask  LeftRightBalance100 = 0x3FFF
	LeftRightBalance100Right LeftRightBalance100 = 0x8000
)

type LengthMesg

type LengthMesg struct {
	MessageIndex               uint16
	Timestamp                  DateTime
	Event                      Event
	EventType                  EventType
	StartTime                  DateTime
	TotalElapsedTime           uint32 // 1000 * s
	TotalTimerTime             uint32 // 1000 * s
	TotalStrokes               uint16
	AvgSpeed                   uint16 // 1000 * m/s
	SwimStroke                 SwimStroke
	AvgSwimmingCadence         uint8
	EventGroup                 uint8
	TotalCalories              uint16
	LengthType                 uint8
	PlayerScore                uint16
	OpponentScore              uint16
	StrokeCount                []uint16
	ZoneCount                  []uint16
	EnhancedAvgRespirationRate uint16 // 100 * breaths/min
	EnhancedMaxRespirationRate uint16 // 100 * breaths/min
	AvgRespirationRate         uint8
	MaxRespirationRate         uint8
}

LengthMesg represents the length message for swimming (message 101)

func (*LengthMesg) GetMesgNum

func (m *LengthMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*LengthMesg) GetName

func (m *LengthMesg) GetName() string

GetName implements the Message interface

type LengthMesgListener

type LengthMesgListener func(mesg *LengthMesg)

LengthMesgListener is called for each length message

type LengthType added in v1.0.1

type LengthType byte

Lengthtype type

const (
	LengthTypeIdle    LengthType = 0 // Rest period. Length with no strokes
	LengthTypeActive  LengthType = 1 // Length with strokes.
	LengthTypeInvalid LengthType = 0xFF
)

type LocalDateTime

type LocalDateTime uint32

LocalDateTime represents a FIT local datetime value

const LocalDateTimeInvalid LocalDateTime = 0xFFFFFFFF

LocalDateTimeInvalid represents an invalid LocalDateTime value

func (LocalDateTime) Time

func (dt LocalDateTime) Time() time.Time

Time converts the FIT LocalDateTime to a Go time.Time

type LocalDeviceType added in v1.0.1

type LocalDeviceType uint8

Localdevicetype type

const (
	LocalDeviceTypeGps           LocalDeviceType = 0  // Onboard gps receiver
	LocalDeviceTypeGlonass       LocalDeviceType = 1  // Onboard glonass receiver
	LocalDeviceTypeGpsGlonass    LocalDeviceType = 2  // Onboard gps glonass receiver
	LocalDeviceTypeAccelerometer LocalDeviceType = 3  // Onboard sensor
	LocalDeviceTypeBarometer     LocalDeviceType = 4  // Onboard sensor
	LocalDeviceTypeTemperature   LocalDeviceType = 5  // Onboard sensor
	LocalDeviceTypeWhr           LocalDeviceType = 10 // Onboard wrist HR sensor
	LocalDeviceTypeSensorHub     LocalDeviceType = 12 // Onboard software package
	LocalDeviceTypeInvalid       LocalDeviceType = 0xFF
)

type Lru added in v1.0.1

type Lru struct {
	// contains filtered or unexported fields
}

Lru is an opinionated local message number redefiner. It caches message definitions and reuses local message numbers for identical definitions, mimicking LRU behavior.

func NewLru added in v1.0.1

func NewLru(size int) *Lru

NewLru creates a new LRU cache with the given size.

func (*Lru) Put added in v1.0.1

func (l *Lru) Put(item []byte) (byte, bool)

Put looks up an item and returns its index. If found, marks it as recently used. If not found and cache is full, replaces the least recently used item. Returns (index, isNewItem).

func (*Lru) Reset added in v1.0.1

func (l *Lru) Reset(size int)

Reset resets the LRU with a new size.

type Manufacturer

type Manufacturer uint16

Manufacturer type constants

const (
	ManufacturerGarmin                 Manufacturer = 1
	ManufacturerGarminFr405Antfs       Manufacturer = 2
	ManufacturerZephyr                 Manufacturer = 3
	ManufacturerDayton                 Manufacturer = 4
	ManufacturerIdt                    Manufacturer = 5
	ManufacturerSrm                    Manufacturer = 6
	ManufacturerQuarq                  Manufacturer = 7
	ManufacturerIbike                  Manufacturer = 8
	ManufacturerSaris                  Manufacturer = 9
	ManufacturerSparkHk                Manufacturer = 10
	ManufacturerTanita                 Manufacturer = 11
	ManufacturerEchowell               Manufacturer = 12
	ManufacturerDynastreamOem          Manufacturer = 13
	ManufacturerNautilus               Manufacturer = 14
	ManufacturerDynastrem              Manufacturer = 15
	ManufacturerTimex                  Manufacturer = 16
	ManufacturerMetrigear              Manufacturer = 17
	ManufacturerXelic                  Manufacturer = 18
	ManufacturerBeurer                 Manufacturer = 19
	ManufacturerCardioSport            Manufacturer = 20
	ManufacturerAAndD                  Manufacturer = 21
	ManufacturerHmm                    Manufacturer = 22
	ManufacturerSuunto                 Manufacturer = 23
	ManufacturerThitaElektronik        Manufacturer = 24
	ManufacturerGpulse                 Manufacturer = 25
	ManufacturerCleanMobile            Manufacturer = 26
	ManufacturerPedalBrain             Manufacturer = 27
	ManufacturerPeaksware              Manufacturer = 28
	ManufacturerSaxonar                Manufacturer = 29
	ManufacturerLemondFitness          Manufacturer = 30
	ManufacturerDexcom                 Manufacturer = 31
	ManufacturerWahooFitness           Manufacturer = 32
	ManufacturerOctaneFitness          Manufacturer = 33
	ManufacturerArchinoetics           Manufacturer = 34
	ManufacturerTheHurtBox             Manufacturer = 35
	ManufacturerCitizenSystems         Manufacturer = 36
	ManufacturerMagellan               Manufacturer = 37
	ManufacturerOsynce                 Manufacturer = 38
	ManufacturerHolux                  Manufacturer = 39
	ManufacturerConcept2               Manufacturer = 40
	ManufacturerShimano                Manufacturer = 41
	ManufacturerOneGiantLeap           Manufacturer = 42
	ManufacturerAceSensor              Manufacturer = 43
	ManufacturerBrimBrothers           Manufacturer = 44
	ManufacturerXplova                 Manufacturer = 45
	ManufacturerPerceptionDigital      Manufacturer = 46
	ManufacturerBf1systems             Manufacturer = 47
	ManufacturerPioneer                Manufacturer = 48
	ManufacturerSpantec                Manufacturer = 49
	ManufacturerMetalogics             Manufacturer = 50
	Manufacturer4iiiis                 Manufacturer = 51
	ManufacturerSeikoEpson             Manufacturer = 52
	ManufacturerSeikoEpsonOem          Manufacturer = 53
	ManufacturerIforPowell             Manufacturer = 54
	ManufacturerMaxwellGuider          Manufacturer = 55
	ManufacturerStarTrac               Manufacturer = 56
	ManufacturerBreakaway              Manufacturer = 57
	ManufacturerAlatechTechnologyLtd   Manufacturer = 58
	ManufacturerMioTechnologyEurope    Manufacturer = 59
	ManufacturerRotor                  Manufacturer = 60
	ManufacturerGeonaute               Manufacturer = 61
	ManufacturerIdBike                 Manufacturer = 62
	ManufacturerSpecialized            Manufacturer = 63
	ManufacturerWtek                   Manufacturer = 64
	ManufacturerPhysicalEnterprises    Manufacturer = 65
	ManufacturerNorthPoleEngineering   Manufacturer = 66
	ManufacturerBkool                  Manufacturer = 67
	ManufacturerCateye                 Manufacturer = 68
	ManufacturerStagesCycling          Manufacturer = 69
	ManufacturerSigmasport             Manufacturer = 70
	ManufacturerTomtom                 Manufacturer = 71
	ManufacturerPeripedal              Manufacturer = 72
	ManufacturerWattbike               Manufacturer = 73
	ManufacturerMoxy                   Manufacturer = 76
	ManufacturerCiclosport             Manufacturer = 77
	ManufacturerPowerbahn              Manufacturer = 78
	ManufacturerAcornProjectsAps       Manufacturer = 79
	ManufacturerLifebeam               Manufacturer = 80
	ManufacturerBontrager              Manufacturer = 81
	ManufacturerWellgo                 Manufacturer = 82
	ManufacturerScosche                Manufacturer = 83
	ManufacturerMagura                 Manufacturer = 84
	ManufacturerWoodway                Manufacturer = 85
	ManufacturerElite                  Manufacturer = 86
	ManufacturerNielsenKellerman       Manufacturer = 87
	ManufacturerDkCity                 Manufacturer = 88
	ManufacturerTacx                   Manufacturer = 89
	ManufacturerDirectionTechnology    Manufacturer = 90
	ManufacturerMagtonic               Manufacturer = 91
	Manufacturer1partcarbon            Manufacturer = 92
	ManufacturerInsideRideTechnologies Manufacturer = 93
	ManufacturerSoundOfMotion          Manufacturer = 94
	ManufacturerStryd                  Manufacturer = 95
	ManufacturerIcg                    Manufacturer = 96
	ManufacturerMiPulse                Manufacturer = 97
	ManufacturerBsxAthletics           Manufacturer = 98
	ManufacturerLook                   Manufacturer = 99
	ManufacturerCampagnoloSrl          Manufacturer = 100
	ManufacturerBodyBikeSmart          Manufacturer = 101
	ManufacturerPraxisworks            Manufacturer = 102
	ManufacturerLimitsTechnology       Manufacturer = 103
	ManufacturerTopactionTechnology    Manufacturer = 104
	ManufacturerCosinuss               Manufacturer = 105
	ManufacturerFitcare                Manufacturer = 106
	ManufacturerMagene                 Manufacturer = 107
	ManufacturerGiantManufacturingCo   Manufacturer = 108
	ManufacturerTigrasport             Manufacturer = 109
	ManufacturerSalutron               Manufacturer = 110
	ManufacturerTechnogym              Manufacturer = 111
	ManufacturerBrytonSensors          Manufacturer = 112
	ManufacturerLatitudeLimited        Manufacturer = 113
	ManufacturerSoaringTechnology      Manufacturer = 114
	ManufacturerIgpsport               Manufacturer = 115
	ManufacturerThinkrider             Manufacturer = 116
	ManufacturerGopherSport            Manufacturer = 117
	ManufacturerWaterRower             Manufacturer = 118
	ManufacturerOrangetheory           Manufacturer = 119
	ManufacturerInpeak                 Manufacturer = 120
	ManufacturerKinetic                Manufacturer = 121
	ManufacturerJohnsonHealthTech      Manufacturer = 122
	ManufacturerPolarElectro           Manufacturer = 123
	ManufacturerSeesense               Manufacturer = 124
	ManufacturerNciTechnology          Manufacturer = 125
	ManufacturerIqsquare               Manufacturer = 126
	ManufacturerLeomo                  Manufacturer = 127
	ManufacturerIfitCom                Manufacturer = 128
	ManufacturerCorosByte              Manufacturer = 129
	ManufacturerVersaDesign            Manufacturer = 130
	ManufacturerChileaf                Manufacturer = 131
	ManufacturerCycplus                Manufacturer = 132
	ManufacturerGravaaByte             Manufacturer = 133
	ManufacturerSigeyi                 Manufacturer = 134
	ManufacturerCoospo                 Manufacturer = 135
	ManufacturerGeoid                  Manufacturer = 136
	ManufacturerBosch                  Manufacturer = 137
	ManufacturerKyto                   Manufacturer = 138
	ManufacturerKineticSports          Manufacturer = 139
	ManufacturerDecathlon              Manufacturer = 140
	ManufacturerTqSystems              Manufacturer = 141
	ManufacturerTagHeuer               Manufacturer = 142
	ManufacturerKeiserFitness          Manufacturer = 143
	ManufacturerZwiftInc               Manufacturer = 144
	ManufacturerPorscheEp              Manufacturer = 145
	ManufacturerBlackbird              Manufacturer = 146
	ManufacturerMeilan                 Manufacturer = 147
	ManufacturerEzon                   Manufacturer = 148
	ManufacturerLaisi                  Manufacturer = 149
	ManufacturerMyzone                 Manufacturer = 150
	ManufacturerFaveroElectronics      Manufacturer = 263
	ManufacturerDevelopment            Manufacturer = 255
	ManufacturerHealthandlife          Manufacturer = 257
	ManufacturerLezyne                 Manufacturer = 258
	ManufacturerScribeLabs             Manufacturer = 259
	ManufacturerZwift                  Manufacturer = 260
	ManufacturerWatteam                Manufacturer = 261
	ManufacturerRecon                  Manufacturer = 262
	ManufacturerCoros                  Manufacturer = 294
	ManufacturerInvalid                Manufacturer = 0xFFFF
)

type MaxMetCategory added in v1.0.1

type MaxMetCategory byte

Maxmetcategory type

const (
	MaxMetCategoryGeneric MaxMetCategory = 0
	MaxMetCategoryCycling MaxMetCategory = 1
	MaxMetCategoryInvalid MaxMetCategory = 0xFF
)

type MesgBroadcaster

type MesgBroadcaster struct {
	// contains filtered or unexported fields
}

MesgBroadcaster dispatches decoded messages to registered typed listeners

func NewMesgBroadcaster

func NewMesgBroadcaster() *MesgBroadcaster

NewMesgBroadcaster creates a new message broadcaster

func (*MesgBroadcaster) AddActivityMesgListener

func (b *MesgBroadcaster) AddActivityMesgListener(listener ActivityMesgListener)

AddActivityMesgListener adds a listener for activity messages

func (*MesgBroadcaster) AddClimbProMesgListener

func (b *MesgBroadcaster) AddClimbProMesgListener(listener ClimbProMesgListener)

AddClimbProMesgListener adds a listener for climb_pro messages

func (*MesgBroadcaster) AddCourseMesgListener

func (b *MesgBroadcaster) AddCourseMesgListener(listener CourseMesgListener)

AddCourseMesgListener adds a listener for course messages

func (*MesgBroadcaster) AddCoursePointMesgListener

func (b *MesgBroadcaster) AddCoursePointMesgListener(listener CoursePointMesgListener)

AddCoursePointMesgListener adds a listener for course_point messages

func (*MesgBroadcaster) AddDeviceInfoMesgListener

func (b *MesgBroadcaster) AddDeviceInfoMesgListener(listener DeviceInfoMesgListener)

AddDeviceInfoMesgListener adds a listener for device_info messages

func (*MesgBroadcaster) AddEventMesgListener

func (b *MesgBroadcaster) AddEventMesgListener(listener EventMesgListener)

AddEventMesgListener adds a listener for event messages

func (*MesgBroadcaster) AddFileIdMesgListener

func (b *MesgBroadcaster) AddFileIdMesgListener(listener FileIdMesgListener)

AddFileIdMesgListener adds a listener for file_id messages

func (*MesgBroadcaster) AddHrvMesgListener

func (b *MesgBroadcaster) AddHrvMesgListener(listener HrvMesgListener)

AddHrvMesgListener adds a listener for hrv messages

func (*MesgBroadcaster) AddLapMesgListener

func (b *MesgBroadcaster) AddLapMesgListener(listener LapMesgListener)

AddLapMesgListener adds a listener for lap messages

func (*MesgBroadcaster) AddLengthMesgListener

func (b *MesgBroadcaster) AddLengthMesgListener(listener LengthMesgListener)

AddLengthMesgListener adds a listener for length messages

func (*MesgBroadcaster) AddMesgListener

func (b *MesgBroadcaster) AddMesgListener(listener MesgListener)

AddMesgListener adds a generic listener for all messages

func (*MesgBroadcaster) AddMonitoringMesgListener

func (b *MesgBroadcaster) AddMonitoringMesgListener(listener MonitoringMesgListener)

AddMonitoringMesgListener adds a listener for monitoring messages

func (*MesgBroadcaster) AddRecordMesgListener

func (b *MesgBroadcaster) AddRecordMesgListener(listener RecordMesgListener)

AddRecordMesgListener adds a listener for record messages

func (*MesgBroadcaster) AddSegmentLapMesgListener

func (b *MesgBroadcaster) AddSegmentLapMesgListener(listener SegmentLapMesgListener)

AddSegmentLapMesgListener adds a listener for segment_lap messages

func (*MesgBroadcaster) AddSessionMesgListener

func (b *MesgBroadcaster) AddSessionMesgListener(listener SessionMesgListener)

AddSessionMesgListener adds a listener for session messages

func (*MesgBroadcaster) AddSplitMesgListener

func (b *MesgBroadcaster) AddSplitMesgListener(listener SplitMesgListener)

AddSplitMesgListener adds a listener for split messages

func (*MesgBroadcaster) AddSportMesgListener

func (b *MesgBroadcaster) AddSportMesgListener(listener SportMesgListener)

AddSportMesgListener adds a listener for sport messages

func (*MesgBroadcaster) AddUserProfileMesgListener

func (b *MesgBroadcaster) AddUserProfileMesgListener(listener UserProfileMesgListener)

AddUserProfileMesgListener adds a listener for user_profile messages

func (*MesgBroadcaster) AddWorkoutMesgListener

func (b *MesgBroadcaster) AddWorkoutMesgListener(listener WorkoutMesgListener)

AddWorkoutMesgListener adds a listener for workout messages

func (*MesgBroadcaster) AddWorkoutStepMesgListener

func (b *MesgBroadcaster) AddWorkoutStepMesgListener(listener WorkoutStepMesgListener)

AddWorkoutStepMesgListener adds a listener for workout_step messages

func (*MesgBroadcaster) ConnectToDecoder

func (b *MesgBroadcaster) ConnectToDecoder(decoder *Decoder)

ConnectToDecoder registers the broadcaster as a listener on the decoder

func (*MesgBroadcaster) OnMesg

func (b *MesgBroadcaster) OnMesg(mesgNum MesgNum, mesg Message)

OnMesg handles a decoded message and dispatches to registered listeners This implements the MesgListener interface for use with Decoder

type MesgCapabilitiesMesg

type MesgCapabilitiesMesg struct {
	MessageIndex uint16
	File         File
	MesgNum      MesgNum
	CountType    MesgCount
	Count        uint16
}

MesgCapabilitiesMesg represents the mesg_capabilities message (message 38)

func (*MesgCapabilitiesMesg) GetMesgNum

func (m *MesgCapabilitiesMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*MesgCapabilitiesMesg) GetName

func (m *MesgCapabilitiesMesg) GetName() string

GetName implements the Message interface

type MesgCount

type MesgCount uint8

MesgCount defines message count type

const (
	MesgCountNumPerFile     MesgCount = 0
	MesgCountMaxPerFile     MesgCount = 1
	MesgCountMaxPerFileType MesgCount = 2
	MesgCountInvalid        MesgCount = 0xFF
)

type MesgListener

type MesgListener func(mesgNum MesgNum, mesg Message)

MesgListener is called for each decoded message

type MesgNum

type MesgNum uint16

MesgNum represents a FIT message number

const (
	MesgNumFileId                           MesgNum = 0
	MesgNumCapabilities                     MesgNum = 1
	MesgNumDeviceSettings                   MesgNum = 2
	MesgNumUserProfile                      MesgNum = 3
	MesgNumHrmProfile                       MesgNum = 4
	MesgNumSdmProfile                       MesgNum = 5
	MesgNumBikeProfile                      MesgNum = 6
	MesgNumZonesTarget                      MesgNum = 7
	MesgNumHrZone                           MesgNum = 8
	MesgNumPowerZone                        MesgNum = 9
	MesgNumMetZone                          MesgNum = 10
	MesgNumSport                            MesgNum = 12
	MesgNumTrainingSettings                 MesgNum = 13
	MesgNumGoal                             MesgNum = 15
	MesgNumSession                          MesgNum = 18
	MesgNumLap                              MesgNum = 19
	MesgNumRecord                           MesgNum = 20
	MesgNumEvent                            MesgNum = 21
	MesgNumDeviceInfo                       MesgNum = 23
	MesgNumWorkout                          MesgNum = 26
	MesgNumWorkoutStep                      MesgNum = 27
	MesgNumSchedule                         MesgNum = 28
	MesgNumWeightScale                      MesgNum = 30
	MesgNumCourse                           MesgNum = 31
	MesgNumCoursePoint                      MesgNum = 32
	MesgNumTotals                           MesgNum = 33
	MesgNumActivity                         MesgNum = 34
	MesgNumSoftware                         MesgNum = 35
	MesgNumFileCapabilities                 MesgNum = 37
	MesgNumMesgCapabilities                 MesgNum = 38
	MesgNumFieldCapabilities                MesgNum = 39
	MesgNumFileCreator                      MesgNum = 49
	MesgNumBloodPressure                    MesgNum = 51
	MesgNumSpeedZone                        MesgNum = 53
	MesgNumMonitoring                       MesgNum = 55
	MesgNumTrainingFile                     MesgNum = 72
	MesgNumHrv                              MesgNum = 78
	MesgNumAntRx                            MesgNum = 80
	MesgNumAntTx                            MesgNum = 81
	MesgNumAntChannelId                     MesgNum = 82
	MesgNumLength                           MesgNum = 101
	MesgNumMonitoringInfo                   MesgNum = 103
	MesgNumPad                              MesgNum = 105
	MesgNumSlaveDevice                      MesgNum = 106
	MesgNumConnectivity                     MesgNum = 127
	MesgNumWeatherConditions                MesgNum = 128
	MesgNumWeatherAlert                     MesgNum = 129
	MesgNumCadenceZone                      MesgNum = 131
	MesgNumHr                               MesgNum = 132
	MesgNumSegmentLap                       MesgNum = 142
	MesgNumMemoGlob                         MesgNum = 145
	MesgNumSegmentId                        MesgNum = 148
	MesgNumSegmentLeaderboardEntry          MesgNum = 149
	MesgNumSegmentPoint                     MesgNum = 150
	MesgNumSegmentFile                      MesgNum = 151
	MesgNumWorkoutSession                   MesgNum = 158
	MesgNumWatchfaceSettings                MesgNum = 159
	MesgNumGpsMetadata                      MesgNum = 160
	MesgNumCameraEvent                      MesgNum = 161
	MesgNumTimestampCorrelation             MesgNum = 162
	MesgNumGyroscopeData                    MesgNum = 164
	MesgNumAccelerometerData                MesgNum = 165
	MesgNumThreeDSensorCalibration          MesgNum = 167
	MesgNumVideoFrame                       MesgNum = 169
	MesgNumObdiiData                        MesgNum = 174
	MesgNumNmeaSentence                     MesgNum = 177
	MesgNumAviationAttitude                 MesgNum = 178
	MesgNumVideo                            MesgNum = 184
	MesgNumVideoTitle                       MesgNum = 185
	MesgNumVideoDescription                 MesgNum = 186
	MesgNumVideoClip                        MesgNum = 187
	MesgNumOhrSettings                      MesgNum = 188
	MesgNumExdScreenConfiguration           MesgNum = 200
	MesgNumExdDataFieldConfiguration        MesgNum = 201
	MesgNumExdDataConceptConfiguration      MesgNum = 202
	MesgNumFieldDescription                 MesgNum = 206
	MesgNumDeveloperDataId                  MesgNum = 207
	MesgNumMagnetometerData                 MesgNum = 208
	MesgNumBarometerData                    MesgNum = 209
	MesgNumOneDSensorCalibration            MesgNum = 210
	MesgNumMonitoringHrData                 MesgNum = 211
	MesgNumTimeInZone                       MesgNum = 216
	MesgNumSet                              MesgNum = 225
	MesgNumStressLevel                      MesgNum = 227
	MesgNumMaxMetData                       MesgNum = 229
	MesgNumDiveSettings                     MesgNum = 258
	MesgNumDiveGas                          MesgNum = 259
	MesgNumDiveAlarm                        MesgNum = 262
	MesgNumExerciseTitle                    MesgNum = 264
	MesgNumDiveSummary                      MesgNum = 268
	MesgNumSpo2Data                         MesgNum = 269
	MesgNumSleepLevel                       MesgNum = 275
	MesgNumJump                             MesgNum = 285
	MesgNumAadAccelFeatures                 MesgNum = 289
	MesgNumBeatIntervals                    MesgNum = 290
	MesgNumRespirationRate                  MesgNum = 297
	MesgNumHsaAccelerometerData             MesgNum = 302
	MesgNumHsaStepData                      MesgNum = 304
	MesgNumHsaSpo2Data                      MesgNum = 305
	MesgNumHsaStressData                    MesgNum = 306
	MesgNumHsaRespirationData               MesgNum = 307
	MesgNumHsaHeartRateData                 MesgNum = 308
	MesgNumSplit                            MesgNum = 312
	MesgNumSplitSummary                     MesgNum = 313
	MesgNumHsaBodyBatteryData               MesgNum = 314
	MesgNumHsaEvent                         MesgNum = 315
	MesgNumClimbPro                         MesgNum = 317
	MesgNumTankUpdate                       MesgNum = 319
	MesgNumTankSummary                      MesgNum = 323
	MesgNumSleepAssessment                  MesgNum = 346
	MesgNumHrvStatusSummary                 MesgNum = 370
	MesgNumHrvValue                         MesgNum = 371
	MesgNumRawBbi                           MesgNum = 372
	MesgNumDeviceAuxBatteryInfo             MesgNum = 375
	MesgNumHsaGyroscopeData                 MesgNum = 376
	MesgNumChronoShotSession                MesgNum = 387
	MesgNumChronoShotData                   MesgNum = 388
	MesgNumHsaConfigurationData             MesgNum = 389
	MesgNumDiveApneaAlarm                   MesgNum = 393
	MesgNumSkinTempOvernight                MesgNum = 398
	MesgNumHsaWristTemperatureData          MesgNum = 409
	MesgNumSleepDisruptionSeverityPeriod    MesgNum = 470
	MesgNumSleepDisruptionOvernightSeverity MesgNum = 471
	MesgNumMfgRangeMin                      MesgNum = 0xFF00
	MesgNumMfgRangeMax                      MesgNum = 0xFFFE
	MesgNumInvalid                          MesgNum = 0xFFFF
)

Message number constants

type MesgProfile

type MesgProfile struct {
	Num    MesgNum
	Name   string
	Fields map[uint8]FieldProfile
}

MesgProfile contains profile information for a message type

type Message

type Message interface {
	GetMesgNum() MesgNum
	GetName() string
}

Message is the interface that all FIT messages implement

type MessageDefinition

type MessageDefinition struct {
	LocalMesgNum        uint8
	Reserved            uint8
	Architecture        uint8
	GlobalMesgNum       MesgNum
	NumFields           uint8
	FieldDefinitions    []FieldDefinition
	NumDevFields        uint8
	DevFieldDefinitions []DeveloperFieldDefinition
}

MessageDefinition represents a FIT message definition

type MessageIndex added in v1.0.1

type MessageIndex uint16

Messageindex type

const (
	MessageIndexSelected MessageIndex = 0x8000 // message is selected if set
	MessageIndexReserved MessageIndex = 0x7000 // reserved (default 0)
	MessageIndexMask     MessageIndex = 0x0FFF // index
	MessageIndexInvalid  MessageIndex = 0xFFFF
)

type MessageValidator added in v1.0.1

type MessageValidator struct {
	// contains filtered or unexported fields
}

MessageValidator validates messages before encoding. It works with GenericMessage which exposes Fields and DeveloperFields.

func NewMessageValidator added in v1.0.1

func NewMessageValidator() *MessageValidator

NewMessageValidator creates a new validator.

func (*MessageValidator) Reset added in v1.0.1

func (v *MessageValidator) Reset()

Reset clears the validator state.

func (*MessageValidator) Validate added in v1.0.1

func (v *MessageValidator) Validate(mesg *GenericMessage) error

Validate checks a GenericMessage for encoding correctness.

type MonitoringInfoMesg

type MonitoringInfoMesg struct {
	Timestamp            DateTime
	LocalTimestamp       DateTime
	ActivityType         []ActivityType
	CyclesToDistance     []uint16 // 5000 * m/cycle
	CyclesToCalories     []uint16 // 5000 * kcal/cycle
	RestingMetabolicRate uint16   // kcal/day
}

MonitoringInfoMesg represents the monitoring_info message (message 103)

func (*MonitoringInfoMesg) GetMesgNum

func (m *MonitoringInfoMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*MonitoringInfoMesg) GetName

func (m *MonitoringInfoMesg) GetName() string

GetName implements the Message interface

type MonitoringMesg

type MonitoringMesg struct {
	Timestamp                    DateTime
	DeviceIndex                  uint8
	Calories                     uint16 // kcal
	Distance                     uint32 // 100 * m
	Cycles                       uint32 // 2 * cycles
	ActiveTime                   uint32 // 1000 * s
	ActivityType                 ActivityType
	ActivitySubtype              ActivitySubtype
	ActivityLevel                ActivityLevel
	Distance16                   uint16 // 100 * m
	Cycles16                     uint16 // 2 * cycles
	ActiveTime16                 uint16 // s
	LocalTimestamp               DateTime
	Temperature                  int16    // 100 * C
	TemperatureMin               int16    // 100 * C
	TemperatureMax               int16    // 100 * C
	ActivityTime                 []uint16 // minutes
	ActiveCalories               uint16   // kcal
	CurrentActivityTypeIntensity []byte
	TimestampMin8                uint8
	Timestamp16                  uint16
	HeartRate                    uint8 // bpm
	Intensity                    uint8 // 10 * intensity
	DurationMin                  uint16
	Duration                     uint32
	Ascent                       uint32 // 1000 * m
	Descent                      uint32 // 1000 * m
	ModerateActivityMinutes      uint16
	VigorousActivityMinutes      uint16
}

MonitoringMesg represents the monitoring message (message 55)

func (*MonitoringMesg) GetActiveTimeScaled

func (m *MonitoringMesg) GetActiveTimeScaled() float64

GetActiveTimeScaled returns active time in seconds

func (*MonitoringMesg) GetDistanceScaled

func (m *MonitoringMesg) GetDistanceScaled() float64

GetDistanceScaled returns distance in meters

func (*MonitoringMesg) GetMesgNum

func (m *MonitoringMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*MonitoringMesg) GetName

func (m *MonitoringMesg) GetName() string

GetName implements the Message interface

type MonitoringMesgListener

type MonitoringMesgListener func(mesg *MonitoringMesg)

MonitoringMesgListener is called for each monitoring message

type NapPeriodFeedback added in v1.0.1

type NapPeriodFeedback byte

Napperiodfeedback type

const (
	NapPeriodFeedbackNone                             NapPeriodFeedback = 0
	NapPeriodFeedbackMultipleNapsDuringDay            NapPeriodFeedback = 1
	NapPeriodFeedbackJetlagIdealTimingIdealDuration   NapPeriodFeedback = 2
	NapPeriodFeedbackJetlagIdealTimingLongDuration    NapPeriodFeedback = 3
	NapPeriodFeedbackJetlagLateTimingIdealDuration    NapPeriodFeedback = 4
	NapPeriodFeedbackJetlagLateTimingLongDuration     NapPeriodFeedback = 5
	NapPeriodFeedbackIdealTimingIdealDurationLowNeed  NapPeriodFeedback = 6
	NapPeriodFeedbackIdealTimingIdealDurationHighNeed NapPeriodFeedback = 7
	NapPeriodFeedbackIdealTimingLongDurationLowNeed   NapPeriodFeedback = 8
	NapPeriodFeedbackIdealTimingLongDurationHighNeed  NapPeriodFeedback = 9
	NapPeriodFeedbackLateTimingIdealDurationLowNeed   NapPeriodFeedback = 10
	NapPeriodFeedbackLateTimingIdealDurationHighNeed  NapPeriodFeedback = 11
	NapPeriodFeedbackLateTimingLongDurationLowNeed    NapPeriodFeedback = 12
	NapPeriodFeedbackLateTimingLongDurationHighNeed   NapPeriodFeedback = 13
	NapPeriodFeedbackIdealDurationLowNeed             NapPeriodFeedback = 14
	NapPeriodFeedbackIdealDurationHighNeed            NapPeriodFeedback = 15
	NapPeriodFeedbackLongDurationLowNeed              NapPeriodFeedback = 16
	NapPeriodFeedbackLongDurationHighNeed             NapPeriodFeedback = 17
	NapPeriodFeedbackInvalid                          NapPeriodFeedback = 0xFF
)

type NapSource added in v1.0.1

type NapSource byte

Napsource type

const (
	NapSourceAutomatic    NapSource = 0
	NapSourceManualDevice NapSource = 1
	NapSourceManualGc     NapSource = 2
	NapSourceInvalid      NapSource = 0xFF
)

type NoFlyTimeMode added in v1.0.1

type NoFlyTimeMode byte

Noflytimemode type

const (
	NoFlyTimeModeStandard    NoFlyTimeMode = 0 // Standard Diver Alert Network no-fly guidance
	NoFlyTimeModeFlat24Hours NoFlyTimeMode = 1 // Flat 24 hour no-fly guidance
	NoFlyTimeModeInvalid     NoFlyTimeMode = 0xFF
)

type OhrSettingsMesg

type OhrSettingsMesg struct {
	Enabled Switch
}

OhrSettingsMesg represents the ohr_settings message (message 188)

func (*OhrSettingsMesg) GetMesgNum

func (m *OhrSettingsMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*OhrSettingsMesg) GetName

func (m *OhrSettingsMesg) GetName() string

GetName implements the Message interface

type PowerZoneMesg

type PowerZoneMesg struct {
	MessageIndex uint16
	HighValue    uint16
	Name         string
}

PowerZoneMesg represents the power_zone message (message 9)

func (*PowerZoneMesg) GetMesgNum

func (m *PowerZoneMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*PowerZoneMesg) GetName

func (m *PowerZoneMesg) GetName() string

GetName implements the Message interface

type Profile

type Profile struct {
	Messages map[MesgNum]MesgProfile
}

Profile contains the complete FIT profile definition

func InitDefaultProfile

func InitDefaultProfile() *Profile

InitDefaultProfile creates a profile with common subfield definitions

type PwrZoneCalc

type PwrZoneCalc uint8

PwrZoneCalc defines power zone calculation type

const (
	PwrZoneCalcCustom     PwrZoneCalc = 0
	PwrZoneCalcPercentFtp PwrZoneCalc = 1
	PwrZoneCalcInvalid    PwrZoneCalc = 0xFF
)

type RadarThreatLevelType added in v1.0.1

type RadarThreatLevelType byte

Radarthreatleveltype type

const (
	RadarThreatLevelTypeThreatUnknown         RadarThreatLevelType = 0
	RadarThreatLevelTypeThreatNone            RadarThreatLevelType = 1
	RadarThreatLevelTypeThreatApproaching     RadarThreatLevelType = 2
	RadarThreatLevelTypeThreatApproachingFast RadarThreatLevelType = 3
	RadarThreatLevelTypeInvalid               RadarThreatLevelType = 0xFF
)

type RecordMesg

type RecordMesg struct {
	Timestamp                     DateTime
	PositionLat                   int32  // semicircles
	PositionLong                  int32  // semicircles
	Altitude                      uint16 // 5 * m + 500
	HeartRate                     uint8  // bpm
	Cadence                       uint8  // rpm
	Distance                      uint32 // 100 * m
	Speed                         uint16 // 1000 * m/s
	Power                         uint16 // watts
	CompressedSpeedDistance       []byte
	Grade                         int16 // 100 * %
	Resistance                    uint8
	TimeFromCourse                int32 // 1000 * s
	CycleLength                   uint8 // 100 * m
	Temperature                   int8  // C
	Speed1s                       []uint8
	Cycles                        uint8
	TotalCycles                   uint32
	CompressedAccumulatedPower    uint16
	AccumulatedPower              uint32 // watts
	LeftRightBalance              LeftRightBalance
	GpsAccuracy                   uint8 // m
	VerticalSpeed                 int16 // 1000 * m/s
	Calories                      uint16
	VerticalOscillation           uint16 // 10 * mm
	StanceTimePercent             uint16 // 100 * %
	StanceTime                    uint16 // 10 * ms
	ActivityType                  ActivityType
	LeftTorqueEffectiveness       uint8 // 2 * %
	RightTorqueEffectiveness      uint8 // 2 * %
	LeftPedalSmoothness           uint8 // 2 * %
	RightPedalSmoothness          uint8 // 2 * %
	CombinedPedalSmoothness       uint8 // 2 * %
	Time128                       uint8
	StrokeType                    SwimStroke
	Zone                          uint8
	BallSpeed                     uint16 // 100 * m/s
	Cadence256                    uint16 // 256 * rpm
	FractionalCadence             uint8  // 128 * rpm
	TotalHemoglobinConc           uint16 // 100 * g/dL
	TotalHemoglobinConcMin        uint16 // 100 * g/dL
	TotalHemoglobinConcMax        uint16 // 100 * g/dL
	SaturatedHemoglobinPercent    uint16 // 10 * %
	SaturatedHemoglobinPercentMin uint16 // 10 * %
	SaturatedHemoglobinPercentMax uint16 // 10 * %
	DeviceIndex                   uint8
	LeftPco                       int8 // mm
	RightPco                      int8 // mm
	LeftPowerPhase                []uint8
	LeftPowerPhasePeak            []uint8
	RightPowerPhase               []uint8
	RightPowerPhasePeak           []uint8
	EnhancedSpeed                 uint32 // 1000 * m/s
	EnhancedAltitude              uint32 // 5 * m + 500
	BatterySoc                    uint8  // 2 * %
	MotorPower                    uint16 // watts
	VerticalRatio                 uint16 // 100 * %
	StanceTimeBalance             uint16 // 100 * %
	StepLength                    uint16 // 10 * mm
	AbsolutePressure              uint32 // Pa
	Depth                         uint32 // 1000 * m
	NextStopDepth                 uint32 // 1000 * m
	NextStopTime                  uint32 // 1 * s
	TimeToSurface                 uint32 // 1 * s
	NdlTime                       uint32 // 1 * s
	CnsLoad                       uint8  // %
	N2Load                        uint16 // 1 * %
	RespirationRate               uint8  // breaths per minute
	EnhancedRespirationRate       uint16 // 100 * breaths/min
	Sdps                          uint16 // 100 * cm (Distance per stroke - Vaaka sensor)
	Grit                          float32
	Flow                          float32
	EbikeTravelRange              uint16 // km
	EbikeAssistMode               uint8
	EbikeAssistLevelPercent       uint8  // %
	AirTimeRemaining              uint32 // s
	PressureSac                   uint16 // 100 * L/min
	VolumeSac                     uint16 // 100 * L/min
	RmvPercentage                 uint16 // %
	CoreTemperature               uint16 // 100 * C
}

RecordMesg represents the record message (message 20)

func (*RecordMesg) GetAltitudeScaled

func (m *RecordMesg) GetAltitudeScaled() float64

GetAltitudeScaled returns altitude in meters

func (*RecordMesg) GetCadence256Scaled

func (m *RecordMesg) GetCadence256Scaled() float64

GetCadence256Scaled returns cadence from the 256 scale

func (*RecordMesg) GetDistanceScaled

func (m *RecordMesg) GetDistanceScaled() float64

GetDistanceScaled returns distance in meters

func (*RecordMesg) GetGradeScaled

func (m *RecordMesg) GetGradeScaled() float64

GetGradeScaled returns grade as percentage

func (*RecordMesg) GetMesgNum

func (m *RecordMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*RecordMesg) GetName

func (m *RecordMesg) GetName() string

GetName implements the Message interface

func (*RecordMesg) GetPositionLatDegrees

func (m *RecordMesg) GetPositionLatDegrees() float64

GetPositionLatDegrees returns latitude in degrees

func (*RecordMesg) GetPositionLongDegrees

func (m *RecordMesg) GetPositionLongDegrees() float64

GetPositionLongDegrees returns longitude in degrees

func (*RecordMesg) GetSpeedScaled

func (m *RecordMesg) GetSpeedScaled() float64

GetSpeedScaled returns speed in m/s

func (*RecordMesg) GetTimestamp

func (m *RecordMesg) GetTimestamp() time.Time

GetTimestamp returns the timestamp as time.Time

func (*RecordMesg) GetVerticalSpeedScaled

func (m *RecordMesg) GetVerticalSpeedScaled() float64

GetVerticalSpeedScaled returns vertical speed in m/s

func (*RecordMesg) HasPosition

func (m *RecordMesg) HasPosition() bool

HasPosition returns true if the record has valid GPS coordinates

type RecordMesgListener

type RecordMesgListener func(mesg *RecordMesg)

RecordMesgListener is called for each record message

type RiderPositionType added in v1.0.1

type RiderPositionType byte

Riderpositiontype type

const (
	RiderPositionTypeSeated               RiderPositionType = 0
	RiderPositionTypeStanding             RiderPositionType = 1
	RiderPositionTypeTransitionToSeated   RiderPositionType = 2
	RiderPositionTypeTransitionToStanding RiderPositionType = 3
	RiderPositionTypeInvalid              RiderPositionType = 0xFF
)

type Schedule

type Schedule uint8

Schedule defines schedule type

const (
	ScheduleWorkout Schedule = 0
	ScheduleCourse  Schedule = 1
	ScheduleInvalid Schedule = 0xFF
)

type ScheduleMesg

type ScheduleMesg struct {
	Manufacturer  Manufacturer
	Product       uint16
	SerialNumber  uint32
	TimeCreated   DateTime
	Completed     Bool
	Type          Schedule
	ScheduledTime DateTime
}

ScheduleMesg represents the schedule message (message 28)

func (*ScheduleMesg) GetMesgNum

func (m *ScheduleMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*ScheduleMesg) GetName

func (m *ScheduleMesg) GetName() string

GetName implements the Message interface

type SdmProfileMesg

type SdmProfileMesg struct {
	MessageIndex      uint16
	Enabled           Bool
	SdmAntId          uint16
	SdmCalFactor      uint16 // 10 * %
	Odometer          uint32 // 100 * m
	SpeedSource       Bool
	SdmAntIdTransType uint8
	OdometerRollover  uint8
}

SdmProfileMesg represents the sdm_profile message (message 5)

func (*SdmProfileMesg) GetMesgNum

func (m *SdmProfileMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SdmProfileMesg) GetName

func (m *SdmProfileMesg) GetName() string

GetName implements the Message interface

type SegmentDeleteStatus

type SegmentDeleteStatus uint8

SegmentDeleteStatus defines segment delete status

const (
	SegmentDeleteStatusDoNotDelete SegmentDeleteStatus = 0
	SegmentDeleteStatusDeleteOne   SegmentDeleteStatus = 1
	SegmentDeleteStatusDeleteAll   SegmentDeleteStatus = 2
	SegmentDeleteStatusInvalid     SegmentDeleteStatus = 0xFF
)

type SegmentFileMesg

type SegmentFileMesg struct {
	MessageIndex           uint16
	FileUUID               string
	Enabled                Bool
	UserProfilePrimaryKey  uint32
	LeaderType             []SegmentLeaderboardType
	LeaderGroupPrimaryKey  []uint32
	LeaderActivityId       []uint32
	LeaderActivityIdString string
	DefaultRaceLeader      uint8
}

SegmentFileMesg represents the segment_file message (message 151)

func (*SegmentFileMesg) GetMesgNum

func (m *SegmentFileMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SegmentFileMesg) GetName

func (m *SegmentFileMesg) GetName() string

GetName implements the Message interface

type SegmentIdMesg

type SegmentIdMesg struct {
	Name                  string
	UUID                  string
	Sport                 Sport
	Enabled               Bool
	UserProfilePrimaryKey uint32
	DeviceId              uint32
	DefaultRaceLeader     uint8
	DeleteStatus          SegmentDeleteStatus
	SelectionType         SegmentSelectionType
}

SegmentIdMesg represents the segment_id message (message 148)

func (*SegmentIdMesg) GetMesgNum

func (m *SegmentIdMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SegmentIdMesg) GetName

func (m *SegmentIdMesg) GetName() string

GetName implements the Message interface

type SegmentLapMesg

type SegmentLapMesg struct {
	MessageIndex                uint16
	Timestamp                   DateTime
	Event                       Event
	EventType                   EventType
	StartTime                   DateTime
	StartPositionLat            int32  // semicircles
	StartPositionLong           int32  // semicircles
	EndPositionLat              int32  // semicircles
	EndPositionLong             int32  // semicircles
	TotalElapsedTime            uint32 // 1000 * s
	TotalTimerTime              uint32 // 1000 * s
	TotalDistance               uint32 // 100 * m
	TotalCycles                 uint32
	TotalCalories               uint16
	TotalFatCalories            uint16
	AvgSpeed                    uint16 // 1000 * m/s
	MaxSpeed                    uint16 // 1000 * m/s
	AvgHeartRate                uint8
	MaxHeartRate                uint8
	AvgCadence                  uint8
	MaxCadence                  uint8
	AvgPower                    uint16 // watts
	MaxPower                    uint16 // watts
	TotalAscent                 uint16 // m
	TotalDescent                uint16 // m
	Sport                       Sport
	EventGroup                  uint8
	NecLat                      int32 // semicircles
	NecLong                     int32 // semicircles
	SwcLat                      int32 // semicircles
	SwcLong                     int32 // semicircles
	Name                        string
	NormalizedPower             uint16 // watts
	LeftRightBalance            LeftRightBalance100
	SubSport                    SubSport
	TotalWork                   uint32   // J
	AvgAltitude                 uint16   // 5 * m + 500
	MaxAltitude                 uint16   // 5 * m + 500
	GpsAccuracy                 uint8    // m
	AvgGrade                    int16    // 100 * %
	AvgPosGrade                 int16    // 100 * %
	AvgNegGrade                 int16    // 100 * %
	MaxPosGrade                 int16    // 100 * %
	MaxNegGrade                 int16    // 100 * %
	AvgTemperature              int8     // C
	MaxTemperature              int8     // C
	TotalMovingTime             uint32   // 1000 * s
	AvgPosVerticalSpeed         int16    // 1000 * m/s
	AvgNegVerticalSpeed         int16    // 1000 * m/s
	MaxPosVerticalSpeed         int16    // 1000 * m/s
	MaxNegVerticalSpeed         int16    // 1000 * m/s
	TimeInHrZone                []uint32 // 1000 * s
	TimeInSpeedZone             []uint32 // 1000 * s
	TimeInCadenceZone           []uint32 // 1000 * s
	TimeInPowerZone             []uint32 // 1000 * s
	RepetitionNum               uint16
	MinAltitude                 uint16 // 5 * m + 500
	MinHeartRate                uint8
	ActiveTime                  uint32 // 1000 * s
	WktStepIndex                uint16
	SportEvent                  SportEvent
	AvgLeftTorqueEffectiveness  uint8 // 2 * %
	AvgRightTorqueEffectiveness uint8 // 2 * %
	AvgLeftPedalSmoothness      uint8 // 2 * %
	AvgRightPedalSmoothness     uint8 // 2 * %
	AvgCombinedPedalSmoothness  uint8 // 2 * %
	Status                      SegmentLapStatus
	UUID                        string
	AvgFractionalCadence        uint8 // 128 * rpm
	MaxFractionalCadence        uint8 // 128 * rpm
	TotalFractionalCycles       uint8 // 128 * cycles
	FrontGearShiftCount         uint16
	RearGearShiftCount          uint16
	TimeStanding                uint32 // 1000 * s
	StandCount                  uint16
	AvgLeftPco                  int8     // mm
	AvgRightPco                 int8     // mm
	AvgLeftPowerPhase           []uint8  // 0.7111111 * degrees
	AvgLeftPowerPhasePeak       []uint8  // 0.7111111 * degrees
	AvgRightPowerPhase          []uint8  // 0.7111111 * degrees
	AvgRightPowerPhasePeak      []uint8  // 0.7111111 * degrees
	AvgPowerPosition            []uint16 // watts
	MaxPowerPosition            []uint16 // watts
	AvgCadencePosition          []uint8  // rpm
	MaxCadencePosition          []uint8  // rpm
	Manufacturer                Manufacturer
}

SegmentLapMesg represents the segment_lap message (message 142)

func (*SegmentLapMesg) GetMesgNum

func (m *SegmentLapMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SegmentLapMesg) GetName

func (m *SegmentLapMesg) GetName() string

GetName implements the Message interface

func (*SegmentLapMesg) GetTotalDistanceScaled

func (m *SegmentLapMesg) GetTotalDistanceScaled() float64

GetTotalDistanceScaled returns total distance in meters

func (*SegmentLapMesg) GetTotalElapsedTimeScaled

func (m *SegmentLapMesg) GetTotalElapsedTimeScaled() float64

GetTotalElapsedTimeScaled returns total elapsed time in seconds

type SegmentLapMesgListener

type SegmentLapMesgListener func(mesg *SegmentLapMesg)

SegmentLapMesgListener is called for each segment_lap message

type SegmentLapStatus

type SegmentLapStatus uint8

SegmentLapStatus defines segment lap status

const (
	SegmentLapStatusEnd     SegmentLapStatus = 0
	SegmentLapStatusFail    SegmentLapStatus = 1
	SegmentLapStatusInvalid SegmentLapStatus = 0xFF
)

type SegmentLeaderboardEntryMesg

type SegmentLeaderboardEntryMesg struct {
	MessageIndex    uint16
	Name            string
	Type            SegmentLeaderboardType
	GroupPrimaryKey uint32
	ActivityId      uint32
	SegmentTime     uint32 // 1000 * s
}

SegmentLeaderboardEntryMesg represents the segment_leaderboard_entry message (message 149)

func (*SegmentLeaderboardEntryMesg) GetMesgNum

func (m *SegmentLeaderboardEntryMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SegmentLeaderboardEntryMesg) GetName

func (m *SegmentLeaderboardEntryMesg) GetName() string

GetName implements the Message interface

type SegmentLeaderboardType

type SegmentLeaderboardType uint8

SegmentLeaderboardType defines segment leaderboard type

const (
	SegmentLeaderboardTypeOverall      SegmentLeaderboardType = 0
	SegmentLeaderboardTypePersonalBest SegmentLeaderboardType = 1
	SegmentLeaderboardTypeConnections  SegmentLeaderboardType = 2
	SegmentLeaderboardTypeGroup        SegmentLeaderboardType = 3
	SegmentLeaderboardTypeChallenger   SegmentLeaderboardType = 4
	SegmentLeaderboardTypeKom          SegmentLeaderboardType = 5
	SegmentLeaderboardTypeQom          SegmentLeaderboardType = 6
	SegmentLeaderboardTypePr           SegmentLeaderboardType = 7
	SegmentLeaderboardTypeGoal         SegmentLeaderboardType = 8
	SegmentLeaderboardTypeRival        SegmentLeaderboardType = 9
	SegmentLeaderboardTypeClubLeader   SegmentLeaderboardType = 10
	SegmentLeaderboardTypeInvalid      SegmentLeaderboardType = 0xFF
)

type SegmentPointMesg

type SegmentPointMesg struct {
	MessageIndex uint16
	PositionLat  int32    // semicircles
	PositionLong int32    // semicircles
	Distance     uint32   // 100 * m
	Altitude     uint16   // 5 * m + 500
	LeaderTime   []uint32 // 1000 * s
}

SegmentPointMesg represents the segment_point message (message 150)

func (*SegmentPointMesg) GetMesgNum

func (m *SegmentPointMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SegmentPointMesg) GetName

func (m *SegmentPointMesg) GetName() string

GetName implements the Message interface

type SegmentSelectionType

type SegmentSelectionType uint8

SegmentSelectionType defines segment selection type

const (
	SegmentSelectionTypeStarred   SegmentSelectionType = 0
	SegmentSelectionTypeSuggested SegmentSelectionType = 1
	SegmentSelectionTypeInvalid   SegmentSelectionType = 0xFF
)

type SensorType added in v1.0.1

type SensorType byte

Sensortype type

const (
	SensorTypeAccelerometer SensorType = 0
	SensorTypeGyroscope     SensorType = 1
	SensorTypeCompass       SensorType = 2 // Magnetometer
	SensorTypeBarometer     SensorType = 3
	SensorTypeInvalid       SensorType = 0xFF
)

type SessionMesg

type SessionMesg struct {
	MessageIndex                 uint16
	Timestamp                    DateTime
	Event                        Event
	EventType                    EventType
	StartTime                    DateTime
	StartPositionLat             int32
	StartPositionLong            int32
	Sport                        Sport
	SubSport                     SubSport
	TotalElapsedTime             uint32 // 1000 * s
	TotalTimerTime               uint32 // 1000 * s
	TotalDistance                uint32 // 100 * m
	TotalCycles                  uint32
	TotalCalories                uint16
	TotalFatCalories             uint16
	AvgSpeed                     uint16 // 1000 * m/s
	MaxSpeed                     uint16 // 1000 * m/s
	AvgHeartRate                 uint8
	MaxHeartRate                 uint8
	AvgCadence                   uint8
	MaxCadence                   uint8
	AvgPower                     uint16
	MaxPower                     uint16
	TotalAscent                  uint16
	TotalDescent                 uint16
	NumLaps                      uint16
	NormalizedPower              uint16
	TrainingStressScore          uint16 // 10 * tss
	IntensityFactor              uint16 // 1000 * if
	LeftRightBalance             uint16
	AvgLeftTorqueEffectiveness   float32
	AvgRightTorqueEffectiveness  float32
	AvgLeftPedalSmoothness       float32
	AvgRightPedalSmoothness      float32
	AvgCombinedPedalSmoothness   float32
	AvgTemperature               int8
	MaxTemperature               int8
	TotalWork                    uint32
	AvgAltitude                  uint16 // 5 * m + 500
	MaxAltitude                  uint16 // 5 * m + 500
	MinAltitude                  uint16 // 5 * m + 500
	AvgGrade                     int16  // 100 * %
	MaxPosGrade                  int16  // 100 * %
	MaxNegGrade                  int16  // 100 * %
	TotalTrainingEffect          float32
	TotalAnaerobicTrainingEffect float32
	Trigger                      SessionTrigger
	FirstLapIndex                uint16
	SwimStroke                   SwimStroke
	PoolLength                   uint16 // 100 * m
	PoolLengthUnit               DisplayMeasure
	ThresholdPower               uint16
	EnhancedAvgSpeed             uint32 // 1000 * m/s
	EnhancedMaxSpeed             uint32 // 1000 * m/s
	EnhancedAvgAltitude          uint32 // 5 * m + 500
	EnhancedMinAltitude          uint32 // 5 * m + 500
	EnhancedMaxAltitude          uint32 // 5 * m + 500
}

SessionMesg represents the session message (message 18)

func (*SessionMesg) GetAvgSpeedScaled

func (m *SessionMesg) GetAvgSpeedScaled() float64

GetAvgSpeedScaled returns average speed in m/s

func (*SessionMesg) GetMaxSpeedScaled

func (m *SessionMesg) GetMaxSpeedScaled() float64

GetMaxSpeedScaled returns max speed in m/s

func (*SessionMesg) GetMesgNum

func (m *SessionMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SessionMesg) GetName

func (m *SessionMesg) GetName() string

GetName implements the Message interface

func (*SessionMesg) GetStartPositionLatDegrees

func (m *SessionMesg) GetStartPositionLatDegrees() float64

GetStartPositionLatDegrees returns start latitude in degrees

func (*SessionMesg) GetStartPositionLongDegrees

func (m *SessionMesg) GetStartPositionLongDegrees() float64

GetStartPositionLongDegrees returns start longitude in degrees

func (*SessionMesg) GetStartTime

func (m *SessionMesg) GetStartTime() time.Time

GetStartTime returns the start time as time.Time

func (*SessionMesg) GetTimestamp

func (m *SessionMesg) GetTimestamp() time.Time

GetTimestamp returns the timestamp as time.Time

func (*SessionMesg) GetTotalDistanceScaled

func (m *SessionMesg) GetTotalDistanceScaled() float64

GetTotalDistanceScaled returns total distance in meters

func (*SessionMesg) GetTotalElapsedTimeScaled

func (m *SessionMesg) GetTotalElapsedTimeScaled() float64

GetTotalElapsedTimeScaled returns total elapsed time in seconds

func (*SessionMesg) GetTotalTimerTimeScaled

func (m *SessionMesg) GetTotalTimerTimeScaled() float64

GetTotalTimerTimeScaled returns total timer time in seconds

type SessionMesgListener

type SessionMesgListener func(mesg *SessionMesg)

SessionMesgListener is called for each session message

type SessionTrigger

type SessionTrigger uint8

SessionTrigger constants

const (
	SessionTriggerActivityEnd      SessionTrigger = 0
	SessionTriggerManual           SessionTrigger = 1
	SessionTriggerAutoMultiSport   SessionTrigger = 2
	SessionTriggerFitnessEquipment SessionTrigger = 3
	SessionTriggerInvalid          SessionTrigger = 0xFF
)

type SetType added in v1.0.1

type SetType uint8

Settype type

const (
	SetTypeRest    SetType = 0
	SetTypeActive  SetType = 1
	SetTypeInvalid SetType = 0xFF
)

type Side

type Side uint8

Side defines side type

const (
	SideRight   Side = 0
	SideLeft    Side = 1
	SideInvalid Side = 0xFF
)

type SlaveDeviceMesg

type SlaveDeviceMesg struct {
	Manufacturer Manufacturer
	Product      uint16
}

SlaveDeviceMesg represents the slave_device message (message 106)

func (*SlaveDeviceMesg) GetMesgNum

func (m *SlaveDeviceMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SlaveDeviceMesg) GetName

func (m *SlaveDeviceMesg) GetName() string

GetName implements the Message interface

type SoftwareMesg

type SoftwareMesg struct {
	MessageIndex uint16
	Version      uint16 // 100 * version
	PartNumber   string
}

SoftwareMesg represents the software message (message 35)

func (*SoftwareMesg) GetMesgNum

func (m *SoftwareMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SoftwareMesg) GetName

func (m *SoftwareMesg) GetName() string

GetName implements the Message interface

func (*SoftwareMesg) GetVersionScaled

func (m *SoftwareMesg) GetVersionScaled() float64

GetVersionScaled returns software version

type SourceType

type SourceType uint8

SourceType constants

const (
	SourceTypeAnt                SourceType = 0
	SourceTypeAntplus            SourceType = 1
	SourceTypeBluetooth          SourceType = 2
	SourceTypeBluetoothLowEnergy SourceType = 3
	SourceTypeWifi               SourceType = 4
	SourceTypeLocal              SourceType = 5
	SourceTypeInvalid            SourceType = 0xFF
)

type SplitMesg

type SplitMesg struct {
	MessageIndex      uint16
	SplitType         SplitType
	TotalElapsedTime  uint32 // 1000 * s
	TotalTimerTime    uint32 // 1000 * s
	TotalDistance     uint32 // 100 * m
	AvgSpeed          uint32 // 1000 * m/s
	StartTime         DateTime
	TotalAscent       uint16 // m
	TotalDescent      uint16 // m
	StartPositionLat  int32  // semicircles
	StartPositionLong int32  // semicircles
	EndPositionLat    int32  // semicircles
	EndPositionLong   int32  // semicircles
	MaxSpeed          uint32 // 1000 * m/s
	AvgVertSpeed      int32  // 1000 * m/s
	EndTime           DateTime
	TotalCalories     uint32 // kcal
	StartElevation    uint32 // 5 * m + 500
	TotalMovingTime   uint32 // 1000 * s
}

SplitMesg represents the split message (message 312)

func (*SplitMesg) GetMesgNum

func (m *SplitMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SplitMesg) GetName

func (m *SplitMesg) GetName() string

GetName implements the Message interface

func (*SplitMesg) GetTotalDistanceScaled

func (m *SplitMesg) GetTotalDistanceScaled() float64

GetTotalDistanceScaled returns total distance in meters

func (*SplitMesg) GetTotalElapsedTimeScaled

func (m *SplitMesg) GetTotalElapsedTimeScaled() float64

GetTotalElapsedTimeScaled returns total elapsed time in seconds

type SplitMesgListener

type SplitMesgListener func(mesg *SplitMesg)

SplitMesgListener is called for each split message

type SplitSummaryMesg

type SplitSummaryMesg struct {
	MessageIndex    uint16
	SplitType       SplitType
	NumSplits       uint16
	TotalTimerTime  uint32 // 1000 * s
	TotalDistance   uint32 // 100 * m
	AvgSpeed        uint32 // 1000 * m/s
	MaxSpeed        uint32 // 1000 * m/s
	TotalAscent     uint16 // m
	TotalDescent    uint16 // m
	AvgHeartRate    uint8
	MaxHeartRate    uint8
	AvgVertSpeed    int32  // 1000 * m/s
	TotalCalories   uint32 // kcal
	TotalMovingTime uint32 // 1000 * s
}

SplitSummaryMesg represents the split_summary message (message 313)

func (*SplitSummaryMesg) GetMesgNum

func (m *SplitSummaryMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SplitSummaryMesg) GetName

func (m *SplitSummaryMesg) GetName() string

GetName implements the Message interface

type SplitType

type SplitType uint8

SplitType defines split type

const (
	SplitTypeAscentSplit      SplitType = 1
	SplitTypeDescentSplit     SplitType = 2
	SplitTypeIntervalActive   SplitType = 3
	SplitTypeIntervalRest     SplitType = 4
	SplitTypeIntervalWarmup   SplitType = 5
	SplitTypeIntervalCooldown SplitType = 6
	SplitTypeIntervalRecovery SplitType = 7
	SplitTypeIntervalOther    SplitType = 8
	SplitTypeClimbActive      SplitType = 9
	SplitTypeClimbRest        SplitType = 10
	SplitTypeSurfActive       SplitType = 11
	SplitTypeRunActive        SplitType = 12
	SplitTypeRunRest          SplitType = 13
	SplitTypeWorkoutRound     SplitType = 14
	SplitTypeRwdRun           SplitType = 17
	SplitTypeRwdWalk          SplitType = 18
	SplitTypeWindsurfActive   SplitType = 21
	SplitTypeRwdStand         SplitType = 22
	SplitTypeTransition       SplitType = 23
	SplitTypeSkiLiftActive    SplitType = 28
	SplitTypeSkiRunActive     SplitType = 29
	SplitTypeInvalid          SplitType = 0xFF
)

type Spo2MeasurementType added in v1.0.1

type Spo2MeasurementType byte

Spo2Measurementtype type

const (
	Spo2MeasurementTypeOffWrist        Spo2MeasurementType = 0
	Spo2MeasurementTypeSpotCheck       Spo2MeasurementType = 1
	Spo2MeasurementTypeContinuousCheck Spo2MeasurementType = 2
	Spo2MeasurementTypePeriodic        Spo2MeasurementType = 3
	Spo2MeasurementTypeInvalid         Spo2MeasurementType = 0xFF
)

type Sport

type Sport uint8

Sport type constants

const (
	SportGeneric               Sport = 0
	SportRunning               Sport = 1
	SportCycling               Sport = 2
	SportTransition            Sport = 3
	SportFitnessEquipment      Sport = 4
	SportSwimming              Sport = 5
	SportBasketball            Sport = 6
	SportSoccer                Sport = 7
	SportTennis                Sport = 8
	SportAmericanFootball      Sport = 9
	SportTraining              Sport = 10
	SportWalking               Sport = 11
	SportCrossCountrySkiing    Sport = 12
	SportAlpineSkiing          Sport = 13
	SportSnowboarding          Sport = 14
	SportRowing                Sport = 15
	SportMountaineering        Sport = 16
	SportHiking                Sport = 17
	SportMultisport            Sport = 18
	SportPaddling              Sport = 19
	SportFlying                Sport = 20
	SportEBiking               Sport = 21
	SportMotorcycling          Sport = 22
	SportBoating               Sport = 23
	SportDriving               Sport = 24
	SportGolf                  Sport = 25
	SportHangGliding           Sport = 26
	SportHorsebackRiding       Sport = 27
	SportHunting               Sport = 28
	SportFishing               Sport = 29
	SportInlineSkating         Sport = 30
	SportRockClimbing          Sport = 31
	SportSailing               Sport = 32
	SportIceSkating            Sport = 33
	SportSkyDiving             Sport = 34
	SportSnowshoeing           Sport = 35
	SportSnowmobiling          Sport = 36
	SportStandUpPaddleboarding Sport = 37
	SportSurfing               Sport = 38
	SportWakeboarding          Sport = 39
	SportWaterSkiing           Sport = 40
	SportKayaking              Sport = 41
	SportRafting               Sport = 42
	SportWindsurfing           Sport = 43
	SportKitesurfing           Sport = 44
	SportTactical              Sport = 45
	SportJumpmaster            Sport = 46
	SportBoxing                Sport = 47
	SportFloorClimbing         Sport = 48
	SportDiving                Sport = 53
	SportHiit                  Sport = 62
	SportRacket                Sport = 64
	SportWheelchairPushWalk    Sport = 65
	SportWheelchairPushRun     Sport = 66
	SportMeditation            Sport = 67
	SportWaterTubing           Sport = 76
	SportWakesurfing           Sport = 77
	SportAll                   Sport = 254
	SportInvalid               Sport = 255
)

type SportBits0

type SportBits0 uint8

SportBits0 defines sport bits 0 type

const (
	SportBits0Generic          SportBits0 = 0x01
	SportBits0Running          SportBits0 = 0x02
	SportBits0Cycling          SportBits0 = 0x04
	SportBits0Transition       SportBits0 = 0x08
	SportBits0FitnessEquipment SportBits0 = 0x10
	SportBits0Swimming         SportBits0 = 0x20
	SportBits0Basketball       SportBits0 = 0x40
	SportBits0Soccer           SportBits0 = 0x80
)

type SportEvent

type SportEvent uint8

SportEvent defines sport event type

const (
	SportEventUncategorized  SportEvent = 0
	SportEventGeocaching     SportEvent = 1
	SportEventFitness        SportEvent = 2
	SportEventRecreation     SportEvent = 3
	SportEventRace           SportEvent = 4
	SportEventSpecialEvent   SportEvent = 5
	SportEventTraining       SportEvent = 6
	SportEventTransportation SportEvent = 7
	SportEventTouring        SportEvent = 8
	SportEventInvalid        SportEvent = 0xFF
)

type SportMesg

type SportMesg struct {
	Sport    Sport
	SubSport SubSport
	Name     string
}

SportMesg represents the sport message (message 12)

func (*SportMesg) GetMesgNum

func (m *SportMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*SportMesg) GetName

func (m *SportMesg) GetName() string

GetName implements the Message interface

type SportMesgListener

type SportMesgListener func(mesg *SportMesg)

SportMesgListener is called for each sport message

type StreamReader

type StreamReader struct {
	// contains filtered or unexported fields
}

StreamReader provides methods for reading binary data from a stream

func NewStreamReader

func NewStreamReader(r io.Reader) *StreamReader

NewStreamReader creates a new stream reader from an io.Reader

func (*StreamReader) GetEndianness

func (sr *StreamReader) GetEndianness() Endianness

GetEndianness returns the current byte order

func (*StreamReader) Length

func (sr *StreamReader) Length() int64

Length returns the length of the stream, or -1 if unknown

func (*StreamReader) PeekByte

func (sr *StreamReader) PeekByte() (byte, error)

PeekByte reads a byte without advancing the position (requires seeking)

func (*StreamReader) Position

func (sr *StreamReader) Position() int64

Position returns the current position in the stream

func (*StreamReader) ReadByte

func (sr *StreamReader) ReadByte() (byte, error)

ReadByte reads a single byte from the stream

func (*StreamReader) ReadBytes

func (sr *StreamReader) ReadBytes(n int) ([]byte, error)

ReadBytes reads n bytes from the stream

func (*StreamReader) ReadFloat32

func (sr *StreamReader) ReadFloat32() (float32, error)

ReadFloat32 reads a 32-bit floating point number

func (*StreamReader) ReadFloat64

func (sr *StreamReader) ReadFloat64() (float64, error)

ReadFloat64 reads a 64-bit floating point number

func (*StreamReader) ReadInt8

func (sr *StreamReader) ReadInt8() (int8, error)

ReadInt8 reads a signed 8-bit integer

func (*StreamReader) ReadInt16

func (sr *StreamReader) ReadInt16() (int16, error)

ReadInt16 reads a signed 16-bit integer

func (*StreamReader) ReadInt32

func (sr *StreamReader) ReadInt32() (int32, error)

ReadInt32 reads a signed 32-bit integer

func (*StreamReader) ReadInt64

func (sr *StreamReader) ReadInt64() (int64, error)

ReadInt64 reads a signed 64-bit integer

func (*StreamReader) ReadString

func (sr *StreamReader) ReadString(length int) (string, error)

ReadString reads a null-terminated string of the given length

func (*StreamReader) ReadUint8

func (sr *StreamReader) ReadUint8() (uint8, error)

ReadUint8 reads an unsigned 8-bit integer

func (*StreamReader) ReadUint16

func (sr *StreamReader) ReadUint16() (uint16, error)

ReadUint16 reads an unsigned 16-bit integer

func (*StreamReader) ReadUint32

func (sr *StreamReader) ReadUint32() (uint32, error)

ReadUint32 reads an unsigned 32-bit integer

func (*StreamReader) ReadUint64

func (sr *StreamReader) ReadUint64() (uint64, error)

ReadUint64 reads an unsigned 64-bit integer

func (*StreamReader) ReadValue

func (sr *StreamReader) ReadValue(baseType BaseType, size uint8) (any, error)

ReadValue reads a value based on the base type

func (*StreamReader) Remaining

func (sr *StreamReader) Remaining() int64

Remaining returns the number of bytes remaining, or -1 if unknown

func (*StreamReader) Seek

func (sr *StreamReader) Seek(offset int64, whence int) (int64, error)

Seek moves to a position in the stream

func (*StreamReader) SetCRCCalculator

func (sr *StreamReader) SetCRCCalculator(calc *CRCCalculator)

SetCRCCalculator sets the CRC calculator for tracking CRC during reads

func (*StreamReader) SetEndianness

func (sr *StreamReader) SetEndianness(e Endianness)

SetEndianness sets the byte order for multi-byte reads

type StreamWriter

type StreamWriter struct {
	// contains filtered or unexported fields
}

StreamWriter provides methods for writing binary data to a stream

func NewStreamWriter

func NewStreamWriter(w io.Writer) *StreamWriter

NewStreamWriter creates a new stream writer

func (*StreamWriter) Position

func (sw *StreamWriter) Position() int64

Position returns the current position in the stream

func (*StreamWriter) Seek

func (sw *StreamWriter) Seek(offset int64, whence int) (int64, error)

Seek moves to a position in the stream

func (*StreamWriter) SetCRCCalculator

func (sw *StreamWriter) SetCRCCalculator(calc *CRCCalculator)

SetCRCCalculator sets the CRC calculator for tracking CRC during writes

func (*StreamWriter) SetEndianness

func (sw *StreamWriter) SetEndianness(e Endianness)

SetEndianness sets the byte order for multi-byte writes

func (*StreamWriter) WriteByte

func (sw *StreamWriter) WriteByte(b byte) error

WriteByte writes a single byte to the stream

func (*StreamWriter) WriteBytes

func (sw *StreamWriter) WriteBytes(data []byte) error

WriteBytes writes multiple bytes to the stream

func (*StreamWriter) WriteFloat32

func (sw *StreamWriter) WriteFloat32(v float32) error

WriteFloat32 writes a 32-bit floating point number

func (*StreamWriter) WriteFloat64

func (sw *StreamWriter) WriteFloat64(v float64) error

WriteFloat64 writes a 64-bit floating point number

func (*StreamWriter) WriteInt8

func (sw *StreamWriter) WriteInt8(v int8) error

WriteInt8 writes a signed 8-bit integer

func (*StreamWriter) WriteInt16

func (sw *StreamWriter) WriteInt16(v int16) error

WriteInt16 writes a signed 16-bit integer

func (*StreamWriter) WriteInt32

func (sw *StreamWriter) WriteInt32(v int32) error

WriteInt32 writes a signed 32-bit integer

func (*StreamWriter) WriteInt64

func (sw *StreamWriter) WriteInt64(v int64) error

WriteInt64 writes a signed 64-bit integer

func (*StreamWriter) WriteString

func (sw *StreamWriter) WriteString(s string, size int) error

WriteString writes a string with null terminator

func (*StreamWriter) WriteUint8

func (sw *StreamWriter) WriteUint8(v uint8) error

WriteUint8 writes an unsigned 8-bit integer

func (*StreamWriter) WriteUint16

func (sw *StreamWriter) WriteUint16(v uint16) error

WriteUint16 writes an unsigned 16-bit integer

func (*StreamWriter) WriteUint32

func (sw *StreamWriter) WriteUint32(v uint32) error

WriteUint32 writes an unsigned 32-bit integer

func (*StreamWriter) WriteUint64

func (sw *StreamWriter) WriteUint64(v uint64) error

WriteUint64 writes an unsigned 64-bit integer

type StrokeType added in v1.0.1

type StrokeType byte

Stroketype type

const (
	StrokeTypeNoEvent  StrokeType = 0
	StrokeTypeOther    StrokeType = 1 // stroke was detected but cannot be identified
	StrokeTypeServe    StrokeType = 2
	StrokeTypeForehand StrokeType = 3
	StrokeTypeBackhand StrokeType = 4
	StrokeTypeSmash    StrokeType = 5
	StrokeTypeInvalid  StrokeType = 0xFF
)

type SubSport

type SubSport uint8

SubSport type constants

const (
	SubSportGeneric              SubSport = 0
	SubSportTreadmill            SubSport = 1
	SubSportStreet               SubSport = 2
	SubSportTrail                SubSport = 3
	SubSportTrack                SubSport = 4
	SubSportSpin                 SubSport = 5
	SubSportIndoorCycling        SubSport = 6
	SubSportRoad                 SubSport = 7
	SubSportMountain             SubSport = 8
	SubSportDownhill             SubSport = 9
	SubSportRecumbent            SubSport = 10
	SubSportCyclocross           SubSport = 11
	SubSportHandCycling          SubSport = 12
	SubSportTrackCycling         SubSport = 13
	SubSportIndoorRowing         SubSport = 14
	SubSportElliptical           SubSport = 15
	SubSportStairClimbing        SubSport = 16
	SubSportLapSwimming          SubSport = 17
	SubSportOpenWater            SubSport = 18
	SubSportFlexibilityTraining  SubSport = 19
	SubSportStrengthTraining     SubSport = 20
	SubSportWarmUp               SubSport = 21
	SubSportMatch                SubSport = 22
	SubSportExercise             SubSport = 23
	SubSportChallenge            SubSport = 24
	SubSportIndoorSkiing         SubSport = 25
	SubSportCardioTraining       SubSport = 26
	SubSportIndoorWalking        SubSport = 27
	SubSportEBikeFitness         SubSport = 28
	SubSportBMX                  SubSport = 29
	SubSportCasualWalking        SubSport = 30
	SubSportSpeedWalking         SubSport = 31
	SubSportBikeToRunTransition  SubSport = 32
	SubSportRunToBikeTransition  SubSport = 33
	SubSportSwimToBikeTransition SubSport = 34
	SubSportATV                  SubSport = 35
	SubSportMotocross            SubSport = 36
	SubSportBackcountry          SubSport = 37
	SubSportResort               SubSport = 38
	SubSportRCDrone              SubSport = 39
	SubSportWingsuit             SubSport = 40
	SubSportWhitewater           SubSport = 41
	SubSportSkateSkiing          SubSport = 42
	SubSportYoga                 SubSport = 43
	SubSportPilates              SubSport = 44
	SubSportIndoorRunning        SubSport = 45
	SubSportGravelCycling        SubSport = 46
	SubSportEBikeMountain        SubSport = 47
	SubSportCommuting            SubSport = 48
	SubSportMixedSurface         SubSport = 49
	SubSportNavigate             SubSport = 50
	SubSportTrackMe              SubSport = 51
	SubSportMap                  SubSport = 52
	SubSportSingleGasDiving      SubSport = 53
	SubSportMultiGasDiving       SubSport = 54
	SubSportGaugeDiving          SubSport = 55
	SubSportApneaDiving          SubSport = 56
	SubSportApneaHunting         SubSport = 57
	SubSportVirtualActivity      SubSport = 58
	SubSportObstacle             SubSport = 59
	SubSportBreathing            SubSport = 62
	SubSportSailRace             SubSport = 65
	SubSportUltra                SubSport = 67
	SubSportIndoorClimbing       SubSport = 68
	SubSportBouldering           SubSport = 69
	SubSportHIIT                 SubSport = 70
	SubSportAMRAP                SubSport = 73
	SubSportEMOM                 SubSport = 74
	SubSportTabata               SubSport = 75
	SubSportPickleball           SubSport = 84
	SubSportPadel                SubSport = 85
	SubSportIndoorWheelchairWalk SubSport = 86
	SubSportIndoorWheelchairRun  SubSport = 87
	SubSportIndoorHandCycling    SubSport = 88
	SubSportSquash               SubSport = 94
	SubSportBadminton            SubSport = 95
	SubSportRacquetball          SubSport = 96
	SubSportTableTennis          SubSport = 97
	SubSportFlyCanopy            SubSport = 110
	SubSportFlyParaglide         SubSport = 111
	SubSportFlyParamotor         SubSport = 112
	SubSportFlyPressurized       SubSport = 113
	SubSportFlyNavigate          SubSport = 114
	SubSportFlyTimer             SubSport = 115
	SubSportFlyAltimeter         SubSport = 116
	SubSportFlyWX                SubSport = 117
	SubSportFlyVFR               SubSport = 118
	SubSportFlyIFR               SubSport = 119
	SubSportAll                  SubSport = 254
	SubSportInvalid              SubSport = 255
)

type Subfield

type Subfield struct {
	Name       string
	Type       BaseType
	Scale      float64
	Offset     float64
	Units      string
	RefMaps    []SubfieldMap    // Reference field mappings (OR logic between maps)
	Components []FieldComponent // Components to expand from this subfield
}

Subfield represents a conditional interpretation of a field based on another field's value

func GetActiveSubfield

func GetActiveSubfield(fieldProfile *FieldProfile, getFieldValue func(fieldNum uint8) (int64, bool)) *Subfield

GetActiveSubfield returns the active subfield for a field, or nil if none

func (*Subfield) CanMesgSupport

func (s *Subfield) CanMesgSupport(getFieldValue func(fieldNum uint8) (int64, bool)) bool

CanMesgSupport checks if this subfield is active for the given message

type SubfieldMap

type SubfieldMap struct {
	RefFieldNum   uint8 // Field number to check
	RefFieldValue int64 // Value that activates this subfield
}

SubfieldMap maps a reference field value to activate a subfield

type SwimStroke

type SwimStroke uint8

SwimStroke constants

const (
	SwimStrokeFreestyle    SwimStroke = 0
	SwimStrokeBackstroke   SwimStroke = 1
	SwimStrokeBreaststroke SwimStroke = 2
	SwimStrokeButterfly    SwimStroke = 3
	SwimStrokeDrill        SwimStroke = 4
	SwimStrokeMixed        SwimStroke = 5
	SwimStrokeIm           SwimStroke = 6
	SwimStrokeInvalid      SwimStroke = 0xFF
)

type Switch

type Switch uint8

Switch defines switch type

const (
	SwitchOff     Switch = 0
	SwitchOn      Switch = 1
	SwitchAuto    Switch = 2
	SwitchInvalid Switch = 0xFF
)

type TapSensitivity added in v1.0.1

type TapSensitivity byte

Tapsensitivity type

const (
	TapSensitivityHigh    TapSensitivity = 0
	TapSensitivityMedium  TapSensitivity = 1
	TapSensitivityLow     TapSensitivity = 2
	TapSensitivityInvalid TapSensitivity = 0xFF
)

type TimeInZoneMesg

type TimeInZoneMesg struct {
	MessageIndex             uint16
	Timestamp                DateTime
	ReferenceMesg            MesgNum
	ReferenceIndex           uint16
	TimeInHrZone             []uint32 // 1000 * s
	TimeInSpeedZone          []uint32 // 1000 * s
	TimeInCadenceZone        []uint32 // 1000 * s
	TimeInPowerZone          []uint32 // 1000 * s
	HrZoneHighBoundary       []uint8  // bpm
	SpeedZoneHighBoundary    []uint16 // 1000 * m/s
	CadenceZoneHighBndry     []uint8  // rpm
	PowerZoneHighBoundary    []uint16 // watts
	HrCalcType               HrZoneCalc
	MaxHeartRate             uint8
	RestingHeartRate         uint8
	ThresholdHeartRate       uint8
	PwrCalcType              PwrZoneCalc
	FunctionalThresholdPower uint16 // watts
}

TimeInZoneMesg represents the time_in_zone message (message 216)

func (*TimeInZoneMesg) GetMesgNum

func (m *TimeInZoneMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*TimeInZoneMesg) GetName

func (m *TimeInZoneMesg) GetName() string

GetName implements the Message interface

type TimeIntoDay added in v1.0.1

type TimeIntoDay uint32

Timeintoday type

const (
	TimeIntoDayInvalid TimeIntoDay = 0xFFFFFFFF
)

type TimeMode

type TimeMode uint8

TimeMode defines time mode type

const (
	TimeModeHour12            TimeMode = 0
	TimeModeHour24            TimeMode = 1
	TimeModeMilitary          TimeMode = 2
	TimeModeHour12WithSeconds TimeMode = 3
	TimeModeHour24WithSeconds TimeMode = 4
	TimeModeUtc               TimeMode = 5
	TimeModeInvalid           TimeMode = 0xFF
)

type TimeZone added in v1.0.1

type TimeZone byte

Timezone type

const (
	TimeZoneAlmaty                   TimeZone = 0
	TimeZoneBangkok                  TimeZone = 1
	TimeZoneBombay                   TimeZone = 2
	TimeZoneBrasilia                 TimeZone = 3
	TimeZoneCairo                    TimeZone = 4
	TimeZoneCapeVerdeIs              TimeZone = 5
	TimeZoneDarwin                   TimeZone = 6
	TimeZoneEniwetok                 TimeZone = 7
	TimeZoneFiji                     TimeZone = 8
	TimeZoneHongKong                 TimeZone = 9
	TimeZoneIslamabad                TimeZone = 10
	TimeZoneKabul                    TimeZone = 11
	TimeZoneMagadan                  TimeZone = 12
	TimeZoneMidAtlantic              TimeZone = 13
	TimeZoneMoscow                   TimeZone = 14
	TimeZoneMuscat                   TimeZone = 15
	TimeZoneNewfoundland             TimeZone = 16
	TimeZoneSamoa                    TimeZone = 17
	TimeZoneSydney                   TimeZone = 18
	TimeZoneTehran                   TimeZone = 19
	TimeZoneTokyo                    TimeZone = 20
	TimeZoneUsAlaska                 TimeZone = 21
	TimeZoneUsAtlantic               TimeZone = 22
	TimeZoneUsCentral                TimeZone = 23
	TimeZoneUsEastern                TimeZone = 24
	TimeZoneUsHawaii                 TimeZone = 25
	TimeZoneUsMountain               TimeZone = 26
	TimeZoneUsPacific                TimeZone = 27
	TimeZoneOther                    TimeZone = 28
	TimeZoneAuckland                 TimeZone = 29
	TimeZoneKathmandu                TimeZone = 30
	TimeZoneEuropeWesternWet         TimeZone = 31
	TimeZoneEuropeCentralCet         TimeZone = 32
	TimeZoneEuropeEasternEet         TimeZone = 33
	TimeZoneJakarta                  TimeZone = 34
	TimeZonePerth                    TimeZone = 35
	TimeZoneAdelaide                 TimeZone = 36
	TimeZoneBrisbane                 TimeZone = 37
	TimeZoneTasmania                 TimeZone = 38
	TimeZoneIceland                  TimeZone = 39
	TimeZoneAmsterdam                TimeZone = 40
	TimeZoneAthens                   TimeZone = 41
	TimeZoneBarcelona                TimeZone = 42
	TimeZoneBerlin                   TimeZone = 43
	TimeZoneBrussels                 TimeZone = 44
	TimeZoneBudapest                 TimeZone = 45
	TimeZoneCopenhagen               TimeZone = 46
	TimeZoneDublin                   TimeZone = 47
	TimeZoneHelsinki                 TimeZone = 48
	TimeZoneLisbon                   TimeZone = 49
	TimeZoneLondon                   TimeZone = 50
	TimeZoneMadrid                   TimeZone = 51
	TimeZoneMunich                   TimeZone = 52
	TimeZoneOslo                     TimeZone = 53
	TimeZoneParis                    TimeZone = 54
	TimeZonePrague                   TimeZone = 55
	TimeZoneReykjavik                TimeZone = 56
	TimeZoneRome                     TimeZone = 57
	TimeZoneStockholm                TimeZone = 58
	TimeZoneVienna                   TimeZone = 59
	TimeZoneWarsaw                   TimeZone = 60
	TimeZoneZurich                   TimeZone = 61
	TimeZoneQuebec                   TimeZone = 62
	TimeZoneOntario                  TimeZone = 63
	TimeZoneManitoba                 TimeZone = 64
	TimeZoneSaskatchewan             TimeZone = 65
	TimeZoneAlberta                  TimeZone = 66
	TimeZoneBritishColumbia          TimeZone = 67
	TimeZoneBoise                    TimeZone = 68
	TimeZoneBoston                   TimeZone = 69
	TimeZoneChicago                  TimeZone = 70
	TimeZoneDallas                   TimeZone = 71
	TimeZoneDenver                   TimeZone = 72
	TimeZoneKansasCity               TimeZone = 73
	TimeZoneLasVegas                 TimeZone = 74
	TimeZoneLosAngeles               TimeZone = 75
	TimeZoneMiami                    TimeZone = 76
	TimeZoneMinneapolis              TimeZone = 77
	TimeZoneNewYork                  TimeZone = 78
	TimeZoneNewOrleans               TimeZone = 79
	TimeZonePhoenix                  TimeZone = 80
	TimeZoneSantaFe                  TimeZone = 81
	TimeZoneSeattle                  TimeZone = 82
	TimeZoneWashingtonDc             TimeZone = 83
	TimeZoneUsArizona                TimeZone = 84
	TimeZoneChita                    TimeZone = 85
	TimeZoneEkaterinburg             TimeZone = 86
	TimeZoneIrkutsk                  TimeZone = 87
	TimeZoneKaliningrad              TimeZone = 88
	TimeZoneKrasnoyarsk              TimeZone = 89
	TimeZoneNovosibirsk              TimeZone = 90
	TimeZonePetropavlovskKamchatskiy TimeZone = 91
	TimeZoneSamara                   TimeZone = 92
	TimeZoneVladivostok              TimeZone = 93
	TimeZoneMexicoCentral            TimeZone = 94
	TimeZoneMexicoMountain           TimeZone = 95
	TimeZoneMexicoPacific            TimeZone = 96
	TimeZoneCapeTown                 TimeZone = 97
	TimeZoneWinkhoek                 TimeZone = 98
	TimeZoneLagos                    TimeZone = 99
	TimeZoneRiyahd                   TimeZone = 100
	TimeZoneVenezuela                TimeZone = 101
	TimeZoneAustraliaLh              TimeZone = 102
	TimeZoneSantiago                 TimeZone = 103
	TimeZoneManual                   TimeZone = 253
	TimeZoneAutomatic                TimeZone = 254
	TimeZoneInvalid                  TimeZone = 0xFF
)

type TimerTrigger added in v1.0.1

type TimerTrigger byte

Timertrigger type

const (
	TimerTriggerManual           TimerTrigger = 0
	TimerTriggerAuto             TimerTrigger = 1
	TimerTriggerFitnessEquipment TimerTrigger = 2
	TimerTriggerInvalid          TimerTrigger = 0xFF
)

type TimestampCorrelationMesg

type TimestampCorrelationMesg struct {
	Timestamp                 DateTime
	FractionalTimestamp       uint16 // 32768 * s
	SystemTimestamp           DateTime
	FractionalSystemTimestamp uint16 // 32768 * s
	LocalTimestamp            DateTime
	TimestampMs               uint16 // ms
	SystemTimestampMs         uint16 // ms
}

TimestampCorrelationMesg represents the timestamp_correlation message (message 162)

func (*TimestampCorrelationMesg) GetMesgNum

func (m *TimestampCorrelationMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*TimestampCorrelationMesg) GetName

func (m *TimestampCorrelationMesg) GetName() string

GetName implements the Message interface

type Tone added in v1.0.1

type Tone byte

Tone type

const (
	ToneOff            Tone = 0
	ToneTone           Tone = 1
	ToneVibrate        Tone = 2
	ToneToneAndVibrate Tone = 3
	ToneInvalid        Tone = 0xFF
)

type TotalsMesg

type TotalsMesg struct {
	MessageIndex uint16
	Timestamp    DateTime
	TimerTime    uint32 // s
	Distance     uint32 // m
	Calories     uint32 // kcal
	Sport        Sport
	ElapsedTime  uint32 // s
	Sessions     uint16
	ActiveTime   uint32 // s
}

TotalsMesg represents the totals message (message 33)

func (*TotalsMesg) GetMesgNum

func (m *TotalsMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*TotalsMesg) GetName

func (m *TotalsMesg) GetName() string

GetName implements the Message interface

type TurnType added in v1.0.1

type TurnType byte

Turntype type

const (
	TurnTypeArrivingIdx             TurnType = 0
	TurnTypeArrivingLeftIdx         TurnType = 1
	TurnTypeArrivingRightIdx        TurnType = 2
	TurnTypeArrivingViaIdx          TurnType = 3
	TurnTypeArrivingViaLeftIdx      TurnType = 4
	TurnTypeArrivingViaRightIdx     TurnType = 5
	TurnTypeBearKeepLeftIdx         TurnType = 6
	TurnTypeBearKeepRightIdx        TurnType = 7
	TurnTypeContinueIdx             TurnType = 8
	TurnTypeExitLeftIdx             TurnType = 9
	TurnTypeExitRightIdx            TurnType = 10
	TurnTypeFerryIdx                TurnType = 11
	TurnTypeRoundabout45Idx         TurnType = 12
	TurnTypeRoundabout90Idx         TurnType = 13
	TurnTypeRoundabout135Idx        TurnType = 14
	TurnTypeRoundabout180Idx        TurnType = 15
	TurnTypeRoundabout225Idx        TurnType = 16
	TurnTypeRoundabout270Idx        TurnType = 17
	TurnTypeRoundabout315Idx        TurnType = 18
	TurnTypeRoundabout360Idx        TurnType = 19
	TurnTypeRoundaboutNeg45Idx      TurnType = 20
	TurnTypeRoundaboutNeg90Idx      TurnType = 21
	TurnTypeRoundaboutNeg135Idx     TurnType = 22
	TurnTypeRoundaboutNeg180Idx     TurnType = 23
	TurnTypeRoundaboutNeg225Idx     TurnType = 24
	TurnTypeRoundaboutNeg270Idx     TurnType = 25
	TurnTypeRoundaboutNeg315Idx     TurnType = 26
	TurnTypeRoundaboutNeg360Idx     TurnType = 27
	TurnTypeRoundaboutGenericIdx    TurnType = 28
	TurnTypeRoundaboutNegGenericIdx TurnType = 29
	TurnTypeSharpTurnLeftIdx        TurnType = 30
	TurnTypeSharpTurnRightIdx       TurnType = 31
	TurnTypeTurnLeftIdx             TurnType = 32
	TurnTypeTurnRightIdx            TurnType = 33
	TurnTypeUturnLeftIdx            TurnType = 34
	TurnTypeUturnRightIdx           TurnType = 35
	TurnTypeIconInvIdx              TurnType = 36
	TurnTypeIconIdxCnt              TurnType = 37
	TurnTypeInvalid                 TurnType = 0xFF
)

type UserLocalId added in v1.0.1

type UserLocalId uint16

Userlocalid type

const (
	UserLocalIdLocalMin      UserLocalId = 0x0000
	UserLocalIdLocalMax      UserLocalId = 0x000F
	UserLocalIdStationaryMin UserLocalId = 0x0010
	UserLocalIdStationaryMax UserLocalId = 0x00FF
	UserLocalIdPortableMin   UserLocalId = 0x0100
	UserLocalIdPortableMax   UserLocalId = 0xFFFE
	UserLocalIdInvalid       UserLocalId = 0xFFFF
)

type UserProfileMesg

type UserProfileMesg struct {
	MessageIndex               uint16
	FriendlyName               string
	Gender                     Gender
	Age                        uint8
	Height                     uint8  // cm
	Weight                     uint16 // 10 * kg
	Language                   Language
	ElevSetting                DisplayMeasure
	WeightSetting              DisplayMeasure
	RestingHeartRate           uint8
	DefaultMaxRunningHeartRate uint8
	DefaultMaxBikingHeartRate  uint8
	DefaultMaxHeartRate        uint8
	HrSetting                  DisplayMeasure
	SpeedSetting               DisplayMeasure
	DistSetting                DisplayMeasure
	PowerSetting               DisplayMeasure
	ActivityClass              uint8
	PositionSetting            DisplayMeasure
	TemperatureSetting         DisplayMeasure
	LocalId                    uint16
	GlobalId                   []byte
	HeightSetting              DisplayMeasure
	UserRunningStepLength      uint16 // 1000 * m
	UserWalkingStepLength      uint16 // 1000 * m
	SleepTime                  uint32 // time of day in seconds
	WakeTime                   uint32 // time of day in seconds
}

UserProfileMesg represents the user_profile message (message 3)

func (*UserProfileMesg) GetMesgNum

func (m *UserProfileMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*UserProfileMesg) GetName

func (m *UserProfileMesg) GetName() string

GetName implements the Message interface

func (*UserProfileMesg) GetWeightScaled

func (m *UserProfileMesg) GetWeightScaled() float64

GetWeightScaled returns weight in kg

type UserProfileMesgListener

type UserProfileMesgListener func(mesg *UserProfileMesg)

UserProfileMesgListener is called for each user_profile message

type WatchfaceMode

type WatchfaceMode uint8

WatchfaceMode defines watchface mode type

const (
	WatchfaceModeDigital   WatchfaceMode = 0
	WatchfaceModeAnalog    WatchfaceMode = 1
	WatchfaceModeConnectIq WatchfaceMode = 2
	WatchfaceModeDisabled  WatchfaceMode = 3
	WatchfaceModeInvalid   WatchfaceMode = 0xFF
)

type WatchfaceSettingsMesg

type WatchfaceSettingsMesg struct {
	MessageIndex uint16
	Mode         WatchfaceMode
	Layout       []byte
}

WatchfaceSettingsMesg represents the watchface_settings message (message 159)

func (*WatchfaceSettingsMesg) GetMesgNum

func (m *WatchfaceSettingsMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*WatchfaceSettingsMesg) GetName

func (m *WatchfaceSettingsMesg) GetName() string

GetName implements the Message interface

type WaterType added in v1.0.1

type WaterType byte

Watertype type

const (
	WaterTypeFresh   WaterType = 0
	WaterTypeSalt    WaterType = 1
	WaterTypeEn13319 WaterType = 2
	WaterTypeCustom  WaterType = 3
	WaterTypeInvalid WaterType = 0xFF
)

type WeatherReport added in v1.0.1

type WeatherReport byte

Weatherreport type

const (
	WeatherReportCurrent        WeatherReport = 0
	WeatherReportHourlyForecast WeatherReport = 1
	WeatherReportDailyForecast  WeatherReport = 2
	WeatherReportInvalid        WeatherReport = 0xFF
)

type WeatherSevereType added in v1.0.1

type WeatherSevereType byte

Weatherseveretype type

const (
	WeatherSevereTypeUnspecified             WeatherSevereType = 0
	WeatherSevereTypeTornado                 WeatherSevereType = 1
	WeatherSevereTypeTsunami                 WeatherSevereType = 2
	WeatherSevereTypeHurricane               WeatherSevereType = 3
	WeatherSevereTypeExtremeWind             WeatherSevereType = 4
	WeatherSevereTypeTyphoon                 WeatherSevereType = 5
	WeatherSevereTypeInlandHurricane         WeatherSevereType = 6
	WeatherSevereTypeHurricaneForceWind      WeatherSevereType = 7
	WeatherSevereTypeWaterspout              WeatherSevereType = 8
	WeatherSevereTypeSevereThunderstorm      WeatherSevereType = 9
	WeatherSevereTypeWreckhouseWinds         WeatherSevereType = 10
	WeatherSevereTypeLesSuetesWind           WeatherSevereType = 11
	WeatherSevereTypeAvalanche               WeatherSevereType = 12
	WeatherSevereTypeFlashFlood              WeatherSevereType = 13
	WeatherSevereTypeTropicalStorm           WeatherSevereType = 14
	WeatherSevereTypeInlandTropicalStorm     WeatherSevereType = 15
	WeatherSevereTypeBlizzard                WeatherSevereType = 16
	WeatherSevereTypeIceStorm                WeatherSevereType = 17
	WeatherSevereTypeFreezingRain            WeatherSevereType = 18
	WeatherSevereTypeDebrisFlow              WeatherSevereType = 19
	WeatherSevereTypeFlashFreeze             WeatherSevereType = 20
	WeatherSevereTypeDustStorm               WeatherSevereType = 21
	WeatherSevereTypeHighWind                WeatherSevereType = 22
	WeatherSevereTypeWinterStorm             WeatherSevereType = 23
	WeatherSevereTypeHeavyFreezingSpray      WeatherSevereType = 24
	WeatherSevereTypeExtremeCold             WeatherSevereType = 25
	WeatherSevereTypeWindChill               WeatherSevereType = 26
	WeatherSevereTypeColdWave                WeatherSevereType = 27
	WeatherSevereTypeHeavySnowAlert          WeatherSevereType = 28
	WeatherSevereTypeLakeEffectBlowingSnow   WeatherSevereType = 29
	WeatherSevereTypeSnowSquall              WeatherSevereType = 30
	WeatherSevereTypeLakeEffectSnow          WeatherSevereType = 31
	WeatherSevereTypeWinterWeather           WeatherSevereType = 32
	WeatherSevereTypeSleet                   WeatherSevereType = 33
	WeatherSevereTypeSnowfall                WeatherSevereType = 34
	WeatherSevereTypeSnowAndBlowingSnow      WeatherSevereType = 35
	WeatherSevereTypeBlowingSnow             WeatherSevereType = 36
	WeatherSevereTypeSnowAlert               WeatherSevereType = 37
	WeatherSevereTypeArcticOutflow           WeatherSevereType = 38
	WeatherSevereTypeFreezingDrizzle         WeatherSevereType = 39
	WeatherSevereTypeStorm                   WeatherSevereType = 40
	WeatherSevereTypeStormSurge              WeatherSevereType = 41
	WeatherSevereTypeRainfall                WeatherSevereType = 42
	WeatherSevereTypeArealFlood              WeatherSevereType = 43
	WeatherSevereTypeCoastalFlood            WeatherSevereType = 44
	WeatherSevereTypeLakeshoreFlood          WeatherSevereType = 45
	WeatherSevereTypeExcessiveHeat           WeatherSevereType = 46
	WeatherSevereTypeHeat                    WeatherSevereType = 47
	WeatherSevereTypeWeather                 WeatherSevereType = 48
	WeatherSevereTypeHighHeatAndHumidity     WeatherSevereType = 49
	WeatherSevereTypeHumidexAndHealth        WeatherSevereType = 50
	WeatherSevereTypeHumidex                 WeatherSevereType = 51
	WeatherSevereTypeGale                    WeatherSevereType = 52
	WeatherSevereTypeFreezingSpray           WeatherSevereType = 53
	WeatherSevereTypeSpecialMarine           WeatherSevereType = 54
	WeatherSevereTypeSquall                  WeatherSevereType = 55
	WeatherSevereTypeStrongWind              WeatherSevereType = 56
	WeatherSevereTypeLakeWind                WeatherSevereType = 57
	WeatherSevereTypeMarineWeather           WeatherSevereType = 58
	WeatherSevereTypeWind                    WeatherSevereType = 59
	WeatherSevereTypeSmallCraftHazardousSeas WeatherSevereType = 60
	WeatherSevereTypeHazardousSeas           WeatherSevereType = 61
	WeatherSevereTypeSmallCraft              WeatherSevereType = 62
	WeatherSevereTypeSmallCraftWinds         WeatherSevereType = 63
	WeatherSevereTypeSmallCraftRoughBar      WeatherSevereType = 64
	WeatherSevereTypeHighWaterLevel          WeatherSevereType = 65
	WeatherSevereTypeAshfall                 WeatherSevereType = 66
	WeatherSevereTypeFreezingFog             WeatherSevereType = 67
	WeatherSevereTypeDenseFog                WeatherSevereType = 68
	WeatherSevereTypeDenseSmoke              WeatherSevereType = 69
	WeatherSevereTypeBlowingDust             WeatherSevereType = 70
	WeatherSevereTypeHardFreeze              WeatherSevereType = 71
	WeatherSevereTypeFreeze                  WeatherSevereType = 72
	WeatherSevereTypeFrost                   WeatherSevereType = 73
	WeatherSevereTypeFireWeather             WeatherSevereType = 74
	WeatherSevereTypeFlood                   WeatherSevereType = 75
	WeatherSevereTypeRipTide                 WeatherSevereType = 76
	WeatherSevereTypeHighSurf                WeatherSevereType = 77
	WeatherSevereTypeSmog                    WeatherSevereType = 78
	WeatherSevereTypeAirQuality              WeatherSevereType = 79
	WeatherSevereTypeBriskWind               WeatherSevereType = 80
	WeatherSevereTypeAirStagnation           WeatherSevereType = 81
	WeatherSevereTypeLowWater                WeatherSevereType = 82
	WeatherSevereTypeHydrological            WeatherSevereType = 83
	WeatherSevereTypeSpecialWeather          WeatherSevereType = 84
	WeatherSevereTypeInvalid                 WeatherSevereType = 0xFF
)

type WeatherSeverity added in v1.0.1

type WeatherSeverity byte

Weatherseverity type

const (
	WeatherSeverityUnknown   WeatherSeverity = 0
	WeatherSeverityWarning   WeatherSeverity = 1
	WeatherSeverityWatch     WeatherSeverity = 2
	WeatherSeverityAdvisory  WeatherSeverity = 3
	WeatherSeverityStatement WeatherSeverity = 4
	WeatherSeverityInvalid   WeatherSeverity = 0xFF
)

type WeatherStatus added in v1.0.1

type WeatherStatus byte

Weatherstatus type

const (
	WeatherStatusClear                  WeatherStatus = 0
	WeatherStatusPartlyCloudy           WeatherStatus = 1
	WeatherStatusMostlyCloudy           WeatherStatus = 2
	WeatherStatusRain                   WeatherStatus = 3
	WeatherStatusSnow                   WeatherStatus = 4
	WeatherStatusWindy                  WeatherStatus = 5
	WeatherStatusThunderstorms          WeatherStatus = 6
	WeatherStatusWintryMix              WeatherStatus = 7
	WeatherStatusFog                    WeatherStatus = 8
	WeatherStatusHazy                   WeatherStatus = 11
	WeatherStatusHail                   WeatherStatus = 12
	WeatherStatusScatteredShowers       WeatherStatus = 13
	WeatherStatusScatteredThunderstorms WeatherStatus = 14
	WeatherStatusUnknownPrecipitation   WeatherStatus = 15
	WeatherStatusLightRain              WeatherStatus = 16
	WeatherStatusHeavyRain              WeatherStatus = 17
	WeatherStatusLightSnow              WeatherStatus = 18
	WeatherStatusHeavySnow              WeatherStatus = 19
	WeatherStatusLightRainSnow          WeatherStatus = 20
	WeatherStatusHeavyRainSnow          WeatherStatus = 21
	WeatherStatusCloudy                 WeatherStatus = 22
	WeatherStatusInvalid                WeatherStatus = 0xFF
)

type Weight added in v1.0.1

type Weight uint16

Weight type

const (
	WeightCalculating Weight = 0xFFFE
	WeightInvalid     Weight = 0xFFFF
)

type WeightScaleMesg

type WeightScaleMesg struct {
	Timestamp         DateTime
	Weight            uint16 // 100 * kg
	PercentFat        uint16 // 100 * %
	PercentHydration  uint16 // 100 * %
	VisceralFatMass   uint16 // 100 * kg
	BoneMass          uint16 // 100 * kg
	MuscleMass        uint16 // 100 * kg
	BasalMet          uint16 // 4 * kcal/day
	PhysiqueRating    uint8
	ActiveMet         uint16 // 4 * kcal/day
	MetabolicAge      uint8
	VisceralFatRating uint8
	UserProfileIndex  uint16
}

WeightScaleMesg represents the weight_scale message (message 30)

func (*WeightScaleMesg) GetMesgNum

func (m *WeightScaleMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*WeightScaleMesg) GetName

func (m *WeightScaleMesg) GetName() string

GetName implements the Message interface

func (*WeightScaleMesg) GetPercentFatScaled

func (m *WeightScaleMesg) GetPercentFatScaled() float64

GetPercentFatScaled returns body fat percentage

func (*WeightScaleMesg) GetWeightScaled

func (m *WeightScaleMesg) GetWeightScaled() float64

GetWeightScaled returns weight in kg

type WktStepDuration

type WktStepDuration uint8

WktStepDuration defines the workout step duration type

const (
	WktStepDurationTime                               WktStepDuration = 0
	WktStepDurationDistance                           WktStepDuration = 1
	WktStepDurationHrLessThan                         WktStepDuration = 2
	WktStepDurationHrGreaterThan                      WktStepDuration = 3
	WktStepDurationCalories                           WktStepDuration = 4
	WktStepDurationOpen                               WktStepDuration = 5
	WktStepDurationRepeatUntilStepsCmplt              WktStepDuration = 6
	WktStepDurationRepeatUntilTime                    WktStepDuration = 7
	WktStepDurationRepeatUntilDistance                WktStepDuration = 8
	WktStepDurationRepeatUntilCalories                WktStepDuration = 9
	WktStepDurationRepeatUntilHrLessThan              WktStepDuration = 10
	WktStepDurationRepeatUntilHrGreaterThan           WktStepDuration = 11
	WktStepDurationRepeatUntilPowerLessThan           WktStepDuration = 12
	WktStepDurationRepeatUntilPowerGreaterThan        WktStepDuration = 13
	WktStepDurationPowerLessThan                      WktStepDuration = 14
	WktStepDurationPowerGreaterThan                   WktStepDuration = 15
	WktStepDurationTrainingPeaksTss                   WktStepDuration = 16
	WktStepDurationRepeatUntilPowerLastLapLessThan    WktStepDuration = 17
	WktStepDurationRepeatUntilMaxPowerLastLapLessThan WktStepDuration = 18
	WktStepDurationPower3sLessThan                    WktStepDuration = 19
	WktStepDurationPower10sLessThan                   WktStepDuration = 20
	WktStepDurationPower30sLessThan                   WktStepDuration = 21
	WktStepDurationPower3sGreaterThan                 WktStepDuration = 22
	WktStepDurationPower10sGreaterThan                WktStepDuration = 23
	WktStepDurationPower30sGreaterThan                WktStepDuration = 24
	WktStepDurationPowerLapLessThan                   WktStepDuration = 25
	WktStepDurationPowerLapGreaterThan                WktStepDuration = 26
	WktStepDurationRepeatUntilTrainingPeaksTss        WktStepDuration = 27
	WktStepDurationRepetitionTime                     WktStepDuration = 28
	WktStepDurationReps                               WktStepDuration = 29
	WktStepDurationTimeOnly                           WktStepDuration = 31
	WktStepDurationInvalid                            WktStepDuration = 0xFF
)

type WktStepTarget

type WktStepTarget uint8

WktStepTarget defines the workout step target type

const (
	WktStepTargetSpeed        WktStepTarget = 0
	WktStepTargetHeartRate    WktStepTarget = 1
	WktStepTargetOpen         WktStepTarget = 2
	WktStepTargetCadence      WktStepTarget = 3
	WktStepTargetPower        WktStepTarget = 4
	WktStepTargetGrade        WktStepTarget = 5
	WktStepTargetResistance   WktStepTarget = 6
	WktStepTargetPower3s      WktStepTarget = 7
	WktStepTargetPower10s     WktStepTarget = 8
	WktStepTargetPower30s     WktStepTarget = 9
	WktStepTargetPowerLap     WktStepTarget = 10
	WktStepTargetSwimStroke   WktStepTarget = 11
	WktStepTargetSpeedLap     WktStepTarget = 12
	WktStepTargetHeartRateLap WktStepTarget = 13
	WktStepTargetInvalid      WktStepTarget = 0xFF
)

type WorkoutCapabilities

type WorkoutCapabilities uint32

WorkoutCapabilities constants

const (
	WorkoutCapabilitiesInterval         WorkoutCapabilities = 0x00000001
	WorkoutCapabilitiesCustom           WorkoutCapabilities = 0x00000002
	WorkoutCapabilitiesFitnessEquipment WorkoutCapabilities = 0x00000004
	WorkoutCapabilitiesFirstbeat        WorkoutCapabilities = 0x00000008
	WorkoutCapabilitiesNewLeaf          WorkoutCapabilities = 0x00000010
	WorkoutCapabilitiesTcx              WorkoutCapabilities = 0x00000020
	WorkoutCapabilitiesSpeed            WorkoutCapabilities = 0x00000080
	WorkoutCapabilitiesHeartRate        WorkoutCapabilities = 0x00000100
	WorkoutCapabilitiesDistance         WorkoutCapabilities = 0x00000200
	WorkoutCapabilitiesCadence          WorkoutCapabilities = 0x00000400
	WorkoutCapabilitiesPower            WorkoutCapabilities = 0x00000800
	WorkoutCapabilitiesGrade            WorkoutCapabilities = 0x00001000
	WorkoutCapabilitiesResistance       WorkoutCapabilities = 0x00002000
	WorkoutCapabilitiesProtected        WorkoutCapabilities = 0x00004000
)

type WorkoutEquipment

type WorkoutEquipment uint8

WorkoutEquipment defines workout equipment type

const (
	WorkoutEquipmentNone          WorkoutEquipment = 0
	WorkoutEquipmentSwimFins      WorkoutEquipment = 1
	WorkoutEquipmentSwimKickboard WorkoutEquipment = 2
	WorkoutEquipmentSwimPaddles   WorkoutEquipment = 3
	WorkoutEquipmentSwimPullBuoy  WorkoutEquipment = 4
	WorkoutEquipmentSwimSnorkel   WorkoutEquipment = 5
	WorkoutEquipmentInvalid       WorkoutEquipment = 0xFF
)

type WorkoutHr added in v1.0.1

type WorkoutHr uint32

Workouthr type

const (
	WorkoutHrBpmOffset WorkoutHr = 100
	WorkoutHrInvalid   WorkoutHr = 0xFFFFFFFF
)

type WorkoutMesg

type WorkoutMesg struct {
	Sport          Sport
	Capabilities   WorkoutCapabilities
	NumValidSteps  uint16
	WktName        string
	SubSport       SubSport
	PoolLength     uint16 // 100 * m
	PoolLengthUnit DisplayMeasure
}

WorkoutMesg represents the workout message (message 26)

func (*WorkoutMesg) GetMesgNum

func (m *WorkoutMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*WorkoutMesg) GetName

func (m *WorkoutMesg) GetName() string

GetName implements the Message interface

type WorkoutMesgListener

type WorkoutMesgListener func(mesg *WorkoutMesg)

WorkoutMesgListener is called for each workout message

type WorkoutPower added in v1.0.1

type WorkoutPower uint32

Workoutpower type

const (
	WorkoutPowerWattsOffset WorkoutPower = 1000
	WorkoutPowerInvalid     WorkoutPower = 0xFFFFFFFF
)

type WorkoutStepMesg

type WorkoutStepMesg struct {
	MessageIndex              uint16
	WktStepName               string
	DurationType              WktStepDuration
	DurationValue             uint32
	TargetType                WktStepTarget
	TargetValue               uint32
	CustomTargetValueLow      uint32
	CustomTargetValueHigh     uint32
	Intensity                 Intensity
	Notes                     string
	Equipment                 WorkoutEquipment
	ExerciseCategory          ExerciseCategory
	ExerciseName              uint16
	ExerciseWeight            uint16 // 100 * kg
	WeightDisplayUnit         FitBaseUnit
	SecondaryTargetType       WktStepTarget
	SecondaryTargetValue      uint32
	SecondaryCustomTargetLow  uint32
	SecondaryCustomTargetHigh uint32
}

WorkoutStepMesg represents the workout_step message (message 27)

func (*WorkoutStepMesg) GetExerciseWeightScaled

func (m *WorkoutStepMesg) GetExerciseWeightScaled() float64

GetExerciseWeightScaled returns exercise weight in kg

func (*WorkoutStepMesg) GetMesgNum

func (m *WorkoutStepMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*WorkoutStepMesg) GetName

func (m *WorkoutStepMesg) GetName() string

GetName implements the Message interface

type WorkoutStepMesgListener

type WorkoutStepMesgListener func(mesg *WorkoutStepMesg)

WorkoutStepMesgListener is called for each workout_step message

type ZonesTargetMesg

type ZonesTargetMesg struct {
	MaxHeartRate             uint8
	ThresholdHeartRate       uint8
	FunctionalThresholdPower uint16
	HrCalcType               uint8
	PwrCalcType              uint8
}

ZonesTargetMesg represents the zones_target message (message 7)

func (*ZonesTargetMesg) GetMesgNum

func (m *ZonesTargetMesg) GetMesgNum() MesgNum

GetMesgNum implements the Message interface

func (*ZonesTargetMesg) GetName

func (m *ZonesTargetMesg) GetName() string

GetName implements the Message interface

Directories

Path Synopsis
examples
decode command
Decode Example - Demonstrates how to decode a FIT file
Decode Example - Demonstrates how to decode a FIT file
encode command
Encode Example - Demonstrates how to create a FIT file
Encode Example - Demonstrates how to create a FIT file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL