librmonitor

package module
v0.0.0-...-f7f4ea1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

librmonitor

Go library for handling RMonitor protocol messages.

RMonitor is a popular text protocol for communicating race information over serial or TCP connection.

Used by software such as MyLaps Orbits, Westhold Race Manager, Tag Heuer and more.

Docs

Mostly self-explanatory.

Each message type is represented as a struct. For each message type, there is a corresponding ToX method to parse a line (and its string parts) into a message type.

There's a top-level Parse method as well that takes in any string message and attempts to convert to corresponding message type.

Data

In data/sebring.txt there is test data to parse, newline delimited text.

Simulator

In cmd/simulator is a simulator app that reads from a text file and serves RMonitor clients on a TCP port and address of your choice. The default data in data/sebring.txt is a good starting point for this, but you can substitute any file of your own.

License

Apache License 2.0, see LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoQuote

func NoQuote(s string) string

func Parse

func Parse(raw string) any

Types

type A

type A struct {
	RegistrationNumber string `json:"registrationNumber"`
	Number             string `json:"number"`
	TransponderNumber  string `json:"transponderNumber"`
	FirstName          string `json:"firstName"`
	LastName           string `json:"lastName"`
	Nationality        string `json:"nationality"`
	ClassNumber        string `json:"classNumber"`
	// contains filtered or unexported fields
}

func ToA

func ToA(raw string, parts []string) A

func (A) Raw

func (m A) Raw() string

type B

type B struct {
	UniqueNumber string `json:"uniqueNumber"`
	Description  string `json:"description"`
	// contains filtered or unexported fields
}

func ToB

func ToB(raw string, parts []string) B

func (B) Raw

func (m B) Raw() string

type C

type C struct {
	UniqueNumber string `json:"uniqueNumber"`
	Description  string `json:"description"`
	// contains filtered or unexported fields
}

func ToC

func ToC(raw string, parts []string) C

func (C) Raw

func (m C) Raw() string

type Comp

type Comp struct {
	RegistrationNumber string `json:"registrationNumber"`
	Number             string `json:"number"`
	ClassNumber        string `json:"classNumber"`
	FirstName          string `json:"firstName"`
	LastName           string `json:"lastName"`
	Nationality        string `json:"nationality"`
	AdditionalData     string `json:"additionalData"`
	// contains filtered or unexported fields
}

func ToComp

func ToComp(raw string, parts []string) Comp

func (Comp) Raw

func (m Comp) Raw() string

type Cor

type Cor struct {
	RegistrationNumber string `json:"registrationNumber"`
	Number             string `json:"number"`
	Laps               string `json:"laps"`
	TotalTime          string `json:"totalTime"`
	Correction         string `json:"correction"`
	// contains filtered or unexported fields
}

func ToCor

func ToCor(raw string, parts []string) Cor

func (Cor) Raw

func (m Cor) Raw() string

type E

type E struct {
	Description string `json:"description"`
	Value       string `json:"value"`
	// contains filtered or unexported fields
}

func ToE

func ToE(raw string, parts []string) E

func (E) Raw

func (m E) Raw() string

type F

type F struct {
	LapsToGo   string `json:"lapsToGo"`
	TimeToGo   string `json:"timeToGo"`
	TimeOfDay  string `json:"timeOfDay"`
	RaceTime   string `json:"raceTime"`
	FlagStatus string `json:"flagStatus"`
	// contains filtered or unexported fields
}

func ToF

func ToF(raw string, parts []string) F

func (F) Raw

func (m F) Raw() string

type G

type G struct {
	Position           string `json:"position"`
	RegistrationNumber string `json:"registrationNumber"`
	Laps               string `json:"laps"`
	TotalTime          string `json:"totalTime"`
	// contains filtered or unexported fields
}

func ToG

func ToG(raw string, parts []string) G

func (G) Raw

func (m G) Raw() string

type H

type H struct {
	Position           string `json:"position"`
	RegistrationNumber string `json:"registrationNumber"`
	BestLap            string `json:"bestLap"`
	BestLaptime        string `json:"bestLaptime"`
	// contains filtered or unexported fields
}

func ToH

func ToH(raw string, parts []string) H

func (H) Raw

func (m H) Raw() string

type I

type I struct {
	TimeOfDay string `json:"timeOfDay"`
	Date      string `json:"date"`
	// contains filtered or unexported fields
}

func ToI

func ToI(raw string, parts []string) I

func (I) Raw

func (m I) Raw() string

type J

type J struct {
	RegistrationNumber string `json:"registrationNumber"`
	Laptime            string `json:"laptime"`
	TotalTime          string `json:"totalTime"`
	// contains filtered or unexported fields
}

func ToJ

func ToJ(raw string, parts []string) J

func (J) Raw

func (m J) Raw() string

type L

type L struct {
	CarNumber      string `json:"carNumber"`
	TimeLineNumber string `json:"timeLineNumber"`
	TimeLineName   string `json:"timeLineName"`
	DateOfCrossing string `json:"dateOfCrossing"`
	TimeOfCrossing string `json:"timeOfCrossing"`
	DriverId       string `json:"driverId"`
	ClassName      string `json:"className"`
	// contains filtered or unexported fields
}

func ToL

func ToL(raw string, parts []string) L

func (L) Raw

func (m L) Raw() string

type Message

type Message interface {
	Raw() string
}

type RMCA

type RMCA struct {
	RelayServerTime string `json:"relayServerTime"`
	// contains filtered or unexported fields
}

func ToRMCA

func ToRMCA(raw string, parts []string) RMCA

func (RMCA) Raw

func (m RMCA) Raw() string

type RMDTL

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

func ToRMDTL

func ToRMDTL(raw string, parts []string) RMDTL

func (RMDTL) Raw

func (m RMDTL) Raw() string

type RMHL

type RMHL struct {
	RacerId      string `json:"racerId"`
	LapNumber    string `json:"lapNumber"`
	RacePosition string `json:"racePosition"`
	LapTime      string `json:"lapTime"`
	FlagStatus   string `json:"flagStatus"`
	TotalTime    string `json:"totalTime"`
	// contains filtered or unexported fields
}

func ToRMHL

func ToRMHL(raw string, parts []string) RMHL

func (RMHL) Raw

func (m RMHL) Raw() string

type RMLT

type RMLT struct {
	RacerId     string `json:"racerId"`
	LastPassing string `json:"lastPassing"`
	// contains filtered or unexported fields
}

func ToRMLT

func ToRMLT(raw string, parts []string) RMLT

func (RMLT) Raw

func (m RMLT) Raw() string

type RMS

type RMS struct {
	SortMode string `json:"sortMode"`
	// contains filtered or unexported fields
}

func ToRMS

func ToRMS(raw string, parts []string) RMS

func (RMS) Raw

func (m RMS) Raw() string

type Simulator

type Simulator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func Simulate

func Simulate(addr *net.TCPAddr, source io.Reader, stopCh chan struct{}) (*Simulator, error)

func (*Simulator) ConnErrors

func (s *Simulator) ConnErrors() chan error

func (*Simulator) ConnNotifs

func (s *Simulator) ConnNotifs() chan string

func (*Simulator) Run

func (s *Simulator) Run()

type T

type T struct {
	TrackName      string `json:"trackName"`
	TrackShortName string `json:"trackShortName"`
	TrackDistance  string `json:"trackDistance"`

	SectionCount int `json:"sectionCount"`

	Sections []TSection `json:"sections"`
	// contains filtered or unexported fields
}

func ToT

func ToT(raw string, parts []string) T

func (T) Raw

func (m T) Raw() string

type TSection

type TSection struct {
	SectionName           string `json:"sectionName"`
	SectionStart          string `json:"sectionStart"`
	SectionEnd            string `json:"sectionEnd"`
	SectionDistanceInches string `json:"sectionDistanceInches"`
	// contains filtered or unexported fields
}

func (TSection) Raw

func (m TSection) Raw() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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