types

package
v0.0.0-...-cee4bc5 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinBatteryValue      = 0
	MaxBatteryValue      = 100
	MinBatteryChargeTime = time.Hour
	MaxBatteryChargeTime = 10 * time.Hour
)
View Source
const (
	MinDescriptionValue = 0
	MaxDescriptionValue = 256
)
View Source
const (
	Running = DeviceStatus(gpsgen.Running)
	Stopped = DeviceStatus(gpsgen.Stopped)
	Paused  = DeviceStatus(gpsgen.Stopped + 1)
)
View Source
const (
	MinElevationValue = 0
	MaxElevationValue = 10000
)
View Source
const (
	MinOfflineValue = 0
	MaxOfflineValue = 900
)
View Source
const (
	MinSpeedValue = 1
	MaxSpeedValue = 100
)

Variables

View Source
var (
	ErrInvalidMinValue      = errors.New("invalid minimum value")
	ErrInvalidMaxValue      = errors.New("invalid maximum value")
	ErrInvalidRangeValue    = errors.New("invalid range values")
	ErrInvalidMinChargeTime = errors.New("invalid minimum charge time")
	ErrInvalidMaxChargeTime = errors.New("invlaid maximum charge time")
	ErrInvalidMinAmplitude  = errors.New("invalid minimum amplitude")
	ErrInvalidMaxAmplitude  = errors.New("invalid maximum amplitude")
	ErrInvalidName          = errors.New("invalid name value")
	ErrInvalidID            = errors.New("invalid id")
)

Functions

This section is empty.

Types

type Battery

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

func ParseBattery

func ParseBattery(min float64, max float64, chargeTime time.Duration) (Battery, error)

func (Battery) ChargeTime

func (b Battery) ChargeTime() time.Duration

func (Battery) Max

func (b Battery) Max() float64

func (Battery) Min

func (b Battery) Min() float64

func (Battery) String

func (b Battery) String() string

func (Battery) Validate

func (b Battery) Validate() error

type Color

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

func ParseColor

func ParseColor(color string) (Color, error)

func RandomColor

func RandomColor() Color

func (Color) RGB

func (t Color) RGB() colorful.Color

func (Color) String

func (t Color) String() string

func (Color) Validate

func (t Color) Validate() error

type CustomID

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

func ParseCustomID

func ParseCustomID(id string) (CustomID, error)

func (CustomID) String

func (t CustomID) String() string

func (CustomID) Validate

func (t CustomID) Validate() error

type Description

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

func ParseDescription

func ParseDescription(val string) (Description, error)

func (Description) String

func (d Description) String() string

func (Description) Validate

func (d Description) Validate() error

type DeviceStatus

type DeviceStatus gpsgen.Status

func ParseDeviceStatus

func ParseDeviceStatus(status int) (DeviceStatus, error)

func (DeviceStatus) String

func (t DeviceStatus) String() string

func (DeviceStatus) Validate

func (t DeviceStatus) Validate() error

type Elevation

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

func ParseElevation

func ParseElevation(min, max float64, amplitude int, mode types.SensorMode) (Elevation, error)

func (Elevation) Amplitude

func (e Elevation) Amplitude() int

func (Elevation) Max

func (e Elevation) Max() float64

func (Elevation) Min

func (e Elevation) Min() float64

func (Elevation) Mode

func (e Elevation) Mode() types.SensorMode

func (Elevation) String

func (e Elevation) String() string

func (Elevation) Validate

func (e Elevation) Validate() error

type ID

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

func NewID

func NewID() ID

func ParseID

func ParseID(id string) (ID, error)

func (ID) IsEmpty

func (t ID) IsEmpty() bool

func (ID) String

func (t ID) String() string

func (ID) Validate

func (t ID) Validate() error

type Model

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

func ParseModel

func ParseModel(val string) (Model, error)

func RandomModel

func RandomModel() Model

func (Model) String

func (m Model) String() string

func (Model) Validate

func (m Model) Validate() error
type Navigator struct {
	Lon             float64 `json:"lon"`
	Lat             float64 `json:"lat"`
	Distance        float64 `json:"distance"`
	RouteID         string  `json:"routeId"`
	RouteDistance   float64 `json:"routeDistance"`
	RouteIndex      int     `json:"routeIndex"`
	TrackID         string  `json:"trackId"`
	TrackDistance   float64 `json:"trackDistance"`
	TrackIndex      int     `json:"trackIndex"`
	SegmentDistance float64 `json:"segmentDistance"`
	SegmentIndex    int     `json:"segmentIndex"`
	Units           string  `json:"units"`
}
func NavigatorFromProc(proc *gpsgen.Device) Navigator

type Offline

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

func ParseOffline

func ParseOffline(min int, max int) (Offline, error)

func (Offline) IsEmpty

func (o Offline) IsEmpty() bool

func (Offline) Max

func (o Offline) Max() int

func (Offline) Min

func (o Offline) Min() int

func (Offline) String

func (o Offline) String() string

func (Offline) Validate

func (o Offline) Validate() error

type Raw

type Raw = []byte

type Sensor

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

func NewSensor

func NewSensor(name string, min, max float64, amplitude int, mode int) (*Sensor, error)

func ParseSensor

func ParseSensor(id ID, name string, min, max float64, amplitude int, mode int) (*Sensor, error)

func (Sensor) Amplitude

func (s Sensor) Amplitude() int

func (Sensor) ID

func (s Sensor) ID() ID

func (Sensor) Max

func (s Sensor) Max() float64

func (Sensor) Min

func (s Sensor) Min() float64

func (Sensor) Mode

func (s Sensor) Mode() SensorMode

func (Sensor) Name

func (s Sensor) Name() string

func (Sensor) String

func (s Sensor) String() string

func (Sensor) Validate

func (s Sensor) Validate() error

type SensorMode

type SensorMode = stdtypes.SensorMode

type Speed

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

func ParseSpeed

func ParseSpeed(min float64, max float64, amplitude int) (Speed, error)

func (Speed) Amplitude

func (s Speed) Amplitude() int

func (Speed) Max

func (s Speed) Max() float64

func (Speed) Min

func (s Speed) Min() float64

func (Speed) String

func (s Speed) String() string

func (Speed) Validate

func (s Speed) Validate() error

Jump to

Keyboard shortcuts

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