tcx

package module
v0.0.0-...-84b8274 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2014 License: MIT Imports: 6 Imported by: 5 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Garmin *.tcx parsing for Go

Some basic utilities for marshaling and unmarshaling Garmin *.tcx (xml) in to and out of Go structs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBytes

func ToBytes(file TCXDB) ([]byte, error)

Types

type Activities

type Activities struct {
	Act []Activity `xml:"Activity"`
}

func ReadActivities

func ReadActivities(path string) (acts *Activities, err error)

type Activity

type Activity struct {
	Sport   string `xml:"Sport,attr,omitempty"`
	Id      time.Time
	Laps    []Lap  `xml:"Lap,omitempty"`
	Creator Device `xml:"Creator,omitempty"`
}

func ReadActivity

func ReadActivity(path string) (act *Activity, err error)

type Author

type Author struct {
	Name       string `xml:",omitempty"`
	Build      Build  `xml:",omitempty"`
	LangID     string `xml:",omitempty"`
	PartNumber string `xml:",omitempty"`
}

func (Author) String

func (a Author) String() string

type Build

type Build struct {
	Version BuildVersion `xml:"Version,omitempty"`
	Type    string       `xml:",omitempty"`
	Time    string       `xml:",omitempty"`
	Builder string       `xml:",omitempty"`
}

type BuildVersion

type BuildVersion struct {
	VersionMajor int `xml:",omitempty"`
	VersionMinor int `xml:",omitempty"`
	BuildMajor   int `xml:",omitempty"`
	BuildMinor   int `xml:",omitempty"`
}

type Device

type Device struct {
	Name      string       `xml:",omitempty"`
	UnitId    int          `xml:",omitempty"`
	ProductID string       `xml:",omitempty"`
	Version   BuildVersion `xml:",omitempty"`
}

type Lap

type Lap struct {
	Start         string  `xml:"StartTime,attr"`
	TotalTime     float64 `xml:"TotalTimeSeconds,omitempty"`
	Dist          float64 `xml:"DistanceMeters,omitempty"`
	Calories      float64 `xml:",omitempty"`
	MaxSpeed      float64 `xml:"MaximumSpeed,omitempty"`
	AvgHr         float64 `xml:"AverageHeartRateBpm>Value,omitempty"`
	MaxHr         float64 `xml:"MaximumHeartRateBpm>Value,omitempty"`
	Intensity     string  `xml:",omitempty"`
	TriggerMethod string  `xml:",omitempty"`
	Trk           *Track  `xml:"Track"`
}

func ReadLap

func ReadLap(path string) (lap *Lap, err error)

func (Lap) MatchTime

func (lap Lap) MatchTime(sec float64) error

Match lap time to "sec" (in-place)

type LapZeroDistError

type LapZeroDistError struct{}

func (*LapZeroDistError) Error

func (l *LapZeroDistError) Error() string

type LapZeroTimeError

type LapZeroTimeError struct{}

func (*LapZeroTimeError) Error

func (l *LapZeroTimeError) Error() string

type TCXDB

type TCXDB struct {
	XMLName xml.Name    `xml:"TrainingCenterDatabase"`
	Acts    *Activities `xml:"Activities"`
	Auth    Author      `xml:"Author"`
}

func ReadFile

func ReadFile(path string) (db *TCXDB, err error)

type Track

type Track struct {
	Pt []Trackpoint `xml:"Trackpoint"`
}

func ReadTpts

func ReadTpts(path string) (track *Track, err error)

type TrackSpline

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

func Spline

func Spline(trk *Track) *TrackSpline

func (*TrackSpline) Alt

func (t *TrackSpline) Alt(dist float64) float64

func (*TrackSpline) Lat

func (t *TrackSpline) Lat(dist float64) float64

func (*TrackSpline) Long

func (t *TrackSpline) Long(dist float64) float64

func (*TrackSpline) Speed

func (t *TrackSpline) Speed(dist float64) float64

type Trackpoint

type Trackpoint struct {
	Time  time.Time
	Lat   float64 `xml:"Position>LatitudeDegrees"`
	Long  float64 `xml:"Position>LongitudeDegrees"`
	Alt   float64 `xml:"AltitudeMeters,omitempty"`
	Dist  float64 `xml:"DistanceMeters,omitempty"`
	HR    float64 `xml:"HeartRateBpm>Value,omitempty"`
	Cad   float64 `xml:"Cadence,omitempty"`
	Speed float64 `xml:"Extensions>TPX>Speed,omitempty"`
	Power float64 `xml:"Extensions>TPX>Watts,omitempty"`
}

Jump to

Keyboard shortcuts

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