types

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package types provides the set of base types defined by the FIT protocol. Users of this package must validate base types parsed from a raw byte using the Known method before calling any other methods (except String).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base byte
const (
	BaseEnum    Base = 0x00
	BaseSint8   Base = 0x01 // 2's complement format
	BaseUint8   Base = 0x02
	BaseSint16  Base = 0x03 // 2's complement format
	BaseUint16  Base = 0x04
	BaseSint32  Base = 0x05 // 2's complement format
	BaseUint32  Base = 0x06
	BaseString  Base = 0x07 // Null terminated string encoded in UTF-8
	BaseFloat32 Base = 0x08
	BaseFloat64 Base = 0x09
	BaseUint8z  Base = 0x0A
	BaseUint16z Base = 0x0B
	BaseUint32z Base = 0x0C
	BaseByte    Base = 0x0D // Array of bytes. Field is invalid if all bytes are invalid
	BaseSint64  Base = 0x0E // 2's complement format
	BaseUint64  Base = 0x0F
	BaseUint64z Base = 0x10
)

func BaseFromString

func BaseFromString(s string) (Base, error)

func DecodeBase

func DecodeBase(b byte) Base

func (Base) Float

func (t Base) Float() bool

func (Base) GoInvalidValue

func (t Base) GoInvalidValue() string

func (Base) GoType

func (t Base) GoType() string

func (Base) Integer

func (t Base) Integer() bool

func (Base) Invalid

func (t Base) Invalid() interface{}

func (Base) Known

func (t Base) Known() bool

func (Base) PkgString

func (t Base) PkgString() string

func (Base) Signed

func (t Base) Signed() bool

func (Base) Size

func (t Base) Size() int

func (Base) String

func (t Base) String() string

type Fit

type Fit uint16

Bit-packing layout:

+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
| bF | bE | bD | bC | bB | bA | b9 | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
\_________________________________/\______________/\__/\________________________/

               Unused                    Kind      Array       Base type

func Make

func Make(kind Kind, array bool) Fit

func MakeNative

func MakeNative(b Base, array bool) Fit

func (Fit) Array

func (f Fit) Array() bool

func (Fit) BaseType

func (f Fit) BaseType() Base

func (Fit) GoInvalidValue

func (f Fit) GoInvalidValue() string

func (Fit) GoType

func (f Fit) GoType() string

func (Fit) Kind

func (f Fit) Kind() Kind

func (Fit) String

func (f Fit) String() string

func (Fit) Valid

func (f Fit) Valid() bool

func (Fit) ValueString

func (f Fit) ValueString() string

type Kind

type Kind byte
const (
	NativeFit Kind = 0x00 // Standard 	-> Fit base type/alias
	TimeUTC   Kind = 0x01 // Time UTC 	-> time.Time
	TimeLocal Kind = 0x02 // Time Local 	-> time.Time with Location
	Lat       Kind = 0x03 // Latitude 	-> fit.Latitude
	Lng       Kind = 0x04 // Longitude 	-> fit.Longitude
)

func (Kind) String

func (k Kind) String() string

Jump to

Keyboard shortcuts

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