Documentation
¶
Index ¶
Constants ¶
View Source
const ( CarLocationUnknown = accbroadcast.CarLocationUnknown CarLocationTrack = accbroadcast.CarLocationTrack CarLocationPitLane = accbroadcast.CarLocationPitLane CarLocationPitEntry = accbroadcast.CarLocationPitEntry CarLocationPitExit = accbroadcast.CarLocationPitExit CarLocationPitBox = 5 )
View Source
const ( PracticeSession SessionType = 0 QualifyingSession = 4 SuperpoleSession = 9 RaceSession = 10 HotlapSession = 11 HotstintSession = 12 HotlapSuperpoleSession = 13 ReplaySession = 14 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Car ¶
type Car struct { CarId int IsConnected bool CarModel *accdata.CarModel TeamName string RaceNumber int CurrentDriverIndex int Drivers []*Driver IsInPit bool Location int // one of the CarLocation... constants Gear int // R = -1, N = 0, 1 = 1, 2 = 2, ... SpeedKmh int Position int // Official P/Q/R position (1-based) CupPosition int // Official P/Q/R position (1-based) TrackPosition int // Position on track (1-based) SplinePosition float32 // Track position between 0.0 and 1.0 Laps int Delta time.Duration // Realtime delta to best session lap BestSessionLap *Lap LastLap *Lap CurrentLap *Lap // contains filtered or unexported fields }
func NewCar ¶
func NewCar(msg *accbroadcast.MsgEntryListCar) *Car
func (*Car) UpdateFromEntryList ¶
func (c *Car) UpdateFromEntryList(msg *accbroadcast.MsgEntryListCar)
func (*Car) UpdateFromRealtime ¶
func (c *Car) UpdateFromRealtime(msg *accbroadcast.MsgRealtimeCarUpdate, state *State)
type Lap ¶
type Lap struct { LapTime time.Duration // Negative duration indicates unknown time DriverIndex int // Driver who drove the lap SplitTimes []time.Duration // Always has 3 elements; negative durations indicate unknown times IsValid bool }
func NewLap ¶
func NewLap(msg *accbroadcast.MsgLap) *Lap
type MiniCar ¶
type MiniCar struct { CarId int Gear int SpeedKmh int SplinePosition float32 Delta_ms time.Duration CurrentLap_ms time.Duration }
MiniCar is a subset of Car properties that are updated continuously
func NewMiniCar ¶
type SessionType ¶
type SessionType byte
func (SessionType) ToString ¶
func (st SessionType) ToString() string
type State ¶
type State struct { SessionType SessionType TimeRemaining time.Duration FocusedCarPosition int FocusedCarId int FocusedBestLap time.Duration FocusedLastLap time.Duration FocusedCurrentLap time.Duration FocusedLapDelta time.Duration TrackGaps []CarGap // Indexed on CarId Cars map[int]*Car SessionTypeUpdates chan string TimeRemainingUpdates chan time.Duration FocusedCarUpdates chan *Car PositionUpdates chan int CarUpdates chan *Car BestLapUpdates chan time.Duration LastLapUpdates chan time.Duration CurrentLapUpdates chan time.Duration LapDeltaUpdates chan time.Duration TrackGapUpdates chan []CarGap MiniCarUpdates chan *MiniCar PitEvents chan *PitEvent // contains filtered or unexported fields }
func NewState ¶
func NewState(client *accbroadcast.Client) *State
Click to show internal directories.
Click to hide internal directories.