Documentation ¶
Index ¶
- Variables
- type Camera
- type CameraGroup
- type CameraInfo
- type Connection
- func (c *Connection) BytesToTelemetryStruct(data []byte) (*TelemetryData, error)
- func (c *Connection) BytesToTelemetryStructFiltered(data []byte, fields []string) *TelemetryData
- func (c *Connection) Connect() error
- func (c *Connection) Disconnect() error
- func (c *Connection) GetHeader() (*utils.Header, error)
- func (c *Connection) GetRawSessionData() ([]byte, error)
- func (c *Connection) GetRawTelemetryData() ([]byte, error)
- func (c *Connection) GetSessionData() (*SessionData, error)
- func (c *Connection) GetTelemetryData() (*TelemetryData, error)
- func (c *Connection) GetTelemetryDataFiltered(fields []string) (*TelemetryData, error)
- func (c *Connection) IsConnected() bool
- func (c *Connection) SendCommand() error
- func (c *Connection) SetMaxFPS(maxFPS int)
- func (c *Connection) WaitForDataReady(timeOut time.Duration) ([]byte, error)
- type Driver
- type DriverInfo
- type Frequency
- type Radio
- type RadioInfo
- type ResultFastestLap
- type ResultPosition
- type Sector
- type Session
- type SessionData
- type SessionInfo
- type SplitTimeInfo
- type TelemetryData
- func (d *TelemetryData) AddIrBitfieldVar(irVar *irBitfieldVar) error
- func (d *TelemetryData) AddIrBoolVar(irVar *irBoolVar) error
- func (d *TelemetryData) AddIrCharVar(irVar *irCharVar) error
- func (d *TelemetryData) AddIrDoubleVar(irVar *irDoubleVar) error
- func (d *TelemetryData) AddIrFloatVar(irVar *irFloatVar) error
- func (d *TelemetryData) AddIrIntVar(irVar *irIntVar) error
- type TelemetryOptions
- type TelemetryReader
- func (tr *TelemetryReader) GetAllDataPoints() ([]*TelemetryData, error)
- func (tr *TelemetryReader) GetHeader() (*utils.Header, error)
- func (tr *TelemetryReader) GetSessionData() (*SessionData, error)
- func (tr *TelemetryReader) GetVarHeaders() ([]*utils.VarHeader, error)
- func (tr *TelemetryReader) GetsubHeader() (*utils.DiskSubHeader, error)
- func (tr *TelemetryReader) Read() error
- func (tr *TelemetryReader) ReadAllDataPoints() ([]*TelemetryData, error)
- func (tr *TelemetryReader) ReadDataPointN(i int) (*TelemetryData, error)
- func (tr *TelemetryReader) ReadHeader() (*utils.Header, error)
- func (tr *TelemetryReader) ReadSessionData() (*SessionData, error)
- func (tr *TelemetryReader) ReadSubHeader() (*utils.DiskSubHeader, error)
- func (tr *TelemetryReader) ReadVarHeaders() ([]*utils.VarHeader, error)
- type WeekendInfo
- type WeekendOptions
Constants ¶
This section is empty.
Variables ¶
var (
ErrEmptySessionData = errors.New("Empty session data")
)
Functions ¶
This section is empty.
Types ¶
type CameraGroup ¶
type CameraInfo ¶
type CameraInfo struct {
Groups []CameraGroup `yaml:"Groups"`
}
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection() (*Connection, error)
func (*Connection) BytesToTelemetryStruct ¶
func (c *Connection) BytesToTelemetryStruct(data []byte) (*TelemetryData, error)
@TODO: should this accept an io.Reader?
func (*Connection) BytesToTelemetryStructFiltered ¶
func (c *Connection) BytesToTelemetryStructFiltered(data []byte, fields []string) *TelemetryData
@TODO: should this accept an io.Reader? @TODO: this shouldn't be on the connection because it can also be used by disk based telemetry (.ibt)
func (*Connection) Connect ¶
func (c *Connection) Connect() error
func (*Connection) Disconnect ¶
func (c *Connection) Disconnect() error
func (*Connection) GetRawSessionData ¶
func (c *Connection) GetRawSessionData() ([]byte, error)
func (*Connection) GetRawTelemetryData ¶
func (c *Connection) GetRawTelemetryData() ([]byte, error)
func (*Connection) GetSessionData ¶
func (c *Connection) GetSessionData() (*SessionData, error)
func (*Connection) GetTelemetryData ¶
func (c *Connection) GetTelemetryData() (*TelemetryData, error)
func (*Connection) GetTelemetryDataFiltered ¶
func (c *Connection) GetTelemetryDataFiltered(fields []string) (*TelemetryData, error)
func (*Connection) IsConnected ¶
func (c *Connection) IsConnected() bool
func (*Connection) SendCommand ¶
func (c *Connection) SendCommand() error
func (*Connection) SetMaxFPS ¶
func (c *Connection) SetMaxFPS(maxFPS int)
func (*Connection) WaitForDataReady ¶
func (c *Connection) WaitForDataReady(timeOut time.Duration) ([]byte, error)
type Driver ¶
type Driver struct { CarIdx int `yaml:"CarIdx"` UserName string `yaml:"UserName"` AbbrevName string `yaml:"AbbrevName"` Initials string `yaml:"Initials"` UserID int `yaml:"UserID"` TeamID int `yaml:"TeamID"` TeamName string `yaml:"TeamName"` // Or shoud CarNumber be an int? CarNumber string `yaml:"CarNumber"` CarNumberRaw int `yaml:"CarNumberRaw"` CarPath string `yaml:"CarPath"` CarClassID int `yaml:"CarClassID"` CarID int `yaml:"CarID"` CarScreenName string `yaml:"CarScreenName"` CarScreenNameShort string `yaml:"CarScreenNameShort"` CarClassShortName string `yaml:"CarClassShortName"` CarClassRelSpeed int `yaml:"CarClassRelSpeed"` CarClassLicenseLevel int `yaml:"CarClassLicenseLevel"` CarClassMaxFuel unit `yaml:"CarClassMaxFuel"` CarClassWeightPenalty unit `yaml:"CarClassWeightPenalty"` // CarClassColor: 0xffffff IRating int `yaml:"IRating"` LicLevel int `yaml:"LicLevel"` LicSubLevel int `yaml:"LicSubLevel"` LicString string `yaml:"LicString"` // LicColor: 0xfc8a27 IsSpectator intToBool `yaml:"IsSpectator"` // CarDesignStr: 0,FFFFFF,ED2129,2A3795 // HelmetDesignStr: 56,000000,000000,000000 // SuitDesignStr: 0,000000,000000,000000 // CarNumberDesignStr: 0,0,FFFFFF,777777,000000 CarSponsor_1 int `yaml:"CarSponsor_1"` CarSponsor_2 int `yaml:"CarSponsor_2"` }
type DriverInfo ¶
type DriverInfo struct { DriverCarIdx int `yaml:"DriverCarIdx"` DriverHeadPosX float32 `yaml:"DriverHeadPosX"` DriverHeadPosY float32 `yaml:"DriverHeadPosY"` DriverHeadPosZ float32 `yaml:"DriverHeadPosZ"` DriverCarIdleRPM float32 `yaml:"DriverCarIdleRPM"` DriverCarRedLine float32 `yaml:"DriverCarRedLine"` DriverCarFuelKgPerLtr float32 `yaml:"DriverCarFuelKgPerLtr"` DriverCarSLFirstRPM float32 `yaml:"DriverCarSLFirstRPM"` DriverCarSLShiftRPM float32 `yaml:"DriverCarSLShiftRPM"` DriverCarSLLastRPM float32 `yaml:"DriverCarSLLastRPM"` DriverCarSLBlinkRPM float32 `yaml:"DriverCarSLBlinkRPM"` DriverPitTrkPct float32 `yaml:"DriverPitTrkPct"` Drivers []Driver `yaml:"Drivers"` }
type Frequency ¶
type Frequency struct { FrequencyNum int `yaml:"FrequencyNum"` FrequencyName string `yaml:"FrequencyName"` Priority int `yaml:"Priority"` CarIdx int `yaml:"CarIdx"` EntryIdx int `yaml:"EntryIdx"` ClubID int `yaml:"ClubID"` CanScan intToBool `yaml:"CanScan"` CanSquawk intToBool `yaml:"CanSquawk"` Muted intToBool `yaml:"Muted"` IsMutable intToBool `yaml:"IsMutable"` IsDeletable intToBool `yaml:"IsDeletable"` }
type ResultFastestLap ¶
type ResultPosition ¶
type ResultPosition struct { CarIdx int `yaml:"CarIdx"` Position int `yaml:"Position"` ClassPosition int `yaml:"ClassPosition"` FastestTime float32 `yaml:"FastestTime"` Lap int `yaml:"Lap"` LastTime float32 `yaml:"LastTime"` LapsComplete int `yaml:"LapsComplete"` LapsDriven int `yaml:"LapsDriven"` ReasonOutId int `yaml:"ReasonOutId"` }
type Session ¶
type Session struct { SessionNum int `yaml:"SessionNum"` SessionLaps string `yaml:"SessionLaps"` SessionTime string `yaml:"SessionTime"` SessionNumLapsToAvg int `yaml:"SessionNumLapsToAvg"` SessionType string `yaml:"SessionType"` ResultsPositions []ResultPosition `yaml:"ResultsPositions"` ResultsFastestLap []ResultFastestLap `yaml:"ResultsFastestLap"` ResultsAverageLapTime float32 `yaml:"ResultsAverageLapTime"` ResultsNumCautionFlags int `yaml:"ResultsNumCautionFlags"` ResultsNumCautionLaps int `yaml:"ResultsNumCautionLaps"` ResultsNumLeadChanges int `yaml:"ResultsNumLeadChanges"` ResultsLapsComplete int `yaml:"ResultsLapsComplete"` ResultsOfficial int `yaml:"ResultsOfficial"` }
type SessionData ¶
type SessionData struct { WeekendInfo WeekendInfo `yaml:"WeekendInfo"` SessionInfo SessionInfo `yaml:"SessionInfo"` CameraInfo CameraInfo `yaml:"CameraInfo"` RadioInfo RadioInfo `yaml:"RadioInfo"` DriverInfo DriverInfo `yaml:"DriverInfo"` SplitTimeInfo SplitTimeInfo `yaml:"SplitTimeInfo"` }
func NewSessionDataFromBytes ¶
func NewSessionDataFromBytes(yamlData []byte) (*SessionData, error)
@TODO: should this accept an io.Reader?
type SessionInfo ¶
type SessionInfo struct {
Sessions []Session `yaml:"Sessions"`
}
type SplitTimeInfo ¶
type SplitTimeInfo struct {
Sectors []Sector `yaml:"Sectors"`
}
type TelemetryData ¶
type TelemetryData struct { // bools DriverMarker bool IsOnTrack bool IsReplayPlaying bool IsDiskLoggingEnabled bool IsDiskLoggingActive bool CarIdxOnPitRoad bool OnPitRoad bool LapDeltaToBestLap_OK bool LapDeltaToOptimalLap_OK bool LapDeltaToSessionBestLap_OK bool LapDeltaToSessionOptimalLap_OK bool LapDeltaToSessionLastlLap_OK bool IsOnTrackCar bool IsInGarage bool ReplayPlaySlowMotion bool // ints SessionNum int SessionState int SessionUniqueID int SessionLapsRemain int RadioTransmitCarIdx int RadioTransmitRadioIdx int RadioTransmitFrequencyIdx int ReplayFrameNum int ReplayFrameNumEnd int CarIdxLap int CarIdxTrackSurface int CarIdxGear int Gear int Lap int RaceLaps int LapBestLap int CamCarIdx int CamCameraNumber int CamGroupNumber int ReplayPlaySpeed int ReplaySessionNum int DisplayUnits int PlayerCarPosition int PlayerCarClassPosition int CarIdxPosition int CarIdxClassPosition int LapLasNLapSeq int LapBestNLapLap int EnterExitReset int DCLapStatus int DCDriversSoFar int // Only used in disk based telemetry WeatherType int Skies int // bitfields SessionFlags map[string]bool CamCameraState map[string]bool EngineWarnings map[string]bool // Only used in disk based telemetry data PitSvFlags map[string]bool // floats FrameRate float32 CpuUsageBG float32 CarIdxLapDistPct float32 CarIdxSteer float32 CarIdxRPM float32 SteeringWheelAngle float32 Throttle float32 Brake float32 Clutch float32 RPM float32 LapDist float32 LapDistPct float32 LapBestLapTime float32 LapLastLapTime float32 LapCurrentLapTime float32 LapDeltaToBestLap float32 LapDeltaToBestLap_DD float32 LapDeltaToOptimalLap float32 LapDeltaToOptimalLap_DD float32 LapDeltaToSessionBestLap float32 LapDeltaToSessionBestLap_DD float32 LapDeltaToSessionOptimalLap float32 LapDeltaToSessionOptimalLap_DD float32 LapDeltaToSessionLastlLap float32 LapDeltaToSessionLastlLap_DD float32 LongAccel float32 LatAccel float32 VertAccel float32 RollRate float32 PitchRate float32 YawRate float32 Speed float32 VelocityX float32 VelocityY float32 VelocityZ float32 Yaw float32 Pitch float32 Roll float32 PitRepairLeft float32 PitOptRepairLeft float32 SteeringWheelTorque float32 SteeringWheelPctTorque float32 SteeringWheelPctTorqueSign float32 SteeringWheelPctTorqueSignStops float32 SteeringWheelPctDamper float32 SteeringWheelAngleMax float32 ShiftIndicatorPct float32 ShiftPowerPct float32 ShiftGrindRPM float32 ThrottleRaw float32 BrakeRaw float32 SteeringWheelPeakForceNm float32 FuelLevel float32 FuelLevelPct float32 WaterTemp float32 WaterLevel float32 FuelPress float32 OilTemp float32 OilPress float32 OilLevel float32 Voltage float32 ManifoldPress float32 RRbrakeLinePress float32 RRcoldPressure float32 RRtempCL float32 RRtempCM float32 RRtempCR float32 RRwearL float32 RRwearM float32 RRwearR float32 LRbrakeLinePress float32 LRcoldPressure float32 LRtempCL float32 LRtempCM float32 LRtempCR float32 LRwearL float32 LRwearM float32 LRwearR float32 RFbrakeLinePress float32 RFcoldPressure float32 RFtempCL float32 RFtempCM float32 RFtempCR float32 RFwearL float32 RFwearM float32 RFwearR float32 LFbrakeLinePress float32 LFcoldPressure float32 LFtempCL float32 LFtempCM float32 LFtempCR float32 LFwearL float32 LFwearM float32 LFwearR float32 RRshockDefl float32 RRshockVel float32 LRshockDefl float32 LRshockVel float32 RFshockDefl float32 RFshockVel float32 LFshockDefl float32 LFshockVel float32 CarIdxF2Time float32 CarIdxEstTime float32 LapLastNLapTime float32 DcBrakeBias float32 LapBestNLapTime float32 // Only used in disk based telemetry Alt float32 TrackTemp float32 AirTemp float32 AirDensity float32 AirPressure float32 WindVel float32 WindDir float32 RelativeHumidity float32 LRtempL float32 LRtempM float32 LRtempR float32 RFspeed float32 RFpressure float32 DcABS float32 DcThrottleShape float32 DcFuelMixture float32 RRspeed float32 RRpressure float32 RRtempL float32 RRtempM float32 RRtempR float32 LRspeed float32 LRpressure float32 RFtempL float32 RFtempM float32 RFtempR float32 LFspeed float32 LFpressure float32 LFtempL float32 LFtempM float32 LFtempR float32 LFrideHeight float32 RFrideHeight float32 LRrideHeight float32 RRrideHeight float32 CFSRrideHeight float32 PitSvLRP float32 PitSvRRP float32 FogLevel float32 DcTractionControl float32 PitSvLFP float32 PitSvRFP float32 PitSvFuel float32 // Doubles SessionTime float64 SessionTimeRemain float64 ReplaySessionTime float64 // Only used in disk based telemetry Lat float64 Lon float64 // contains filtered or unexported fields }
func NewTelemetryData ¶
func NewTelemetryData() *TelemetryData
func (*TelemetryData) AddIrBitfieldVar ¶
func (d *TelemetryData) AddIrBitfieldVar(irVar *irBitfieldVar) error
func (*TelemetryData) AddIrBoolVar ¶
func (d *TelemetryData) AddIrBoolVar(irVar *irBoolVar) error
func (*TelemetryData) AddIrCharVar ¶
func (d *TelemetryData) AddIrCharVar(irVar *irCharVar) error
func (*TelemetryData) AddIrDoubleVar ¶
func (d *TelemetryData) AddIrDoubleVar(irVar *irDoubleVar) error
func (*TelemetryData) AddIrFloatVar ¶
func (d *TelemetryData) AddIrFloatVar(irVar *irFloatVar) error
func (*TelemetryData) AddIrIntVar ¶
func (d *TelemetryData) AddIrIntVar(irVar *irIntVar) error
type TelemetryOptions ¶
type TelemetryOptions struct {
TelemetryDiskFile string `yaml:"TelemetryDiskFile"`
}
type TelemetryReader ¶
type TelemetryReader struct {
// contains filtered or unexported fields
}
func NewTelemetryReader ¶
func NewTelemetryReader(data io.ReadSeeker) *TelemetryReader
NewTelemetryReader intializes a new TelemetryReader object based on an io.ReadSeeker
func (*TelemetryReader) GetAllDataPoints ¶
func (tr *TelemetryReader) GetAllDataPoints() ([]*TelemetryData, error)
GetVarBufs memoizes the ReadHeader function
func (*TelemetryReader) GetHeader ¶
func (tr *TelemetryReader) GetHeader() (*utils.Header, error)
GetHeader memoizes the ReadHeader function
func (*TelemetryReader) GetSessionData ¶
func (tr *TelemetryReader) GetSessionData() (*SessionData, error)
GetSessionData memoizes the ReadSubHeader function
func (*TelemetryReader) GetVarHeaders ¶
func (tr *TelemetryReader) GetVarHeaders() ([]*utils.VarHeader, error)
GetVarHeaders memoizes the ReadHeader function
func (*TelemetryReader) GetsubHeader ¶
func (tr *TelemetryReader) GetsubHeader() (*utils.DiskSubHeader, error)
GetHeader memoizes the ReadSubHeader function
func (*TelemetryReader) ReadAllDataPoints ¶
func (tr *TelemetryReader) ReadAllDataPoints() ([]*TelemetryData, error)
ReadAllDataPoints reads all datapoints (TelemetrydDat) from the file / memmap
func (*TelemetryReader) ReadDataPointN ¶
func (tr *TelemetryReader) ReadDataPointN(i int) (*TelemetryData, error)
ReadDataPointN reads a specific datapoint (TelemetryData)
func (*TelemetryReader) ReadHeader ¶
func (tr *TelemetryReader) ReadHeader() (*utils.Header, error)
ReadHeader tries to read the main header from the file
func (*TelemetryReader) ReadSessionData ¶
func (tr *TelemetryReader) ReadSessionData() (*SessionData, error)
func (*TelemetryReader) ReadSubHeader ¶
func (tr *TelemetryReader) ReadSubHeader() (*utils.DiskSubHeader, error)
ReadSubHeader reads the second header specialiy for telemtry data saved to .ibt files
func (*TelemetryReader) ReadVarHeaders ¶
func (tr *TelemetryReader) ReadVarHeaders() ([]*utils.VarHeader, error)
ReadVarHeaders reads the second header specialiy for telemtry data saved to .ibt files
type WeekendInfo ¶
type WeekendInfo struct { // TrackName string -> TrackName string `yaml:"TrackName"` // vim: s/\(\t\(.\{-}\) \).*/\0 `yaml:"\2"` TrackName string `yaml:"TrackName"` TrackID int `yaml:"TrackID"` TrackLength string `yaml:"TrackLength"` TrackDisplayName string `yaml:"TrackDisplayName"` TrackDisplayShortName string `yaml:"TrackDisplayShortName"` TrackConfigName string `yaml:"TrackConfigName"` TrackCity string `yaml:"TrackCity"` TrackCountry string `yaml:"TrackCountry"` TrackAltitude unit `yaml:"TrackAltitude"` TrackLatitude unit `yaml:"TrackLatitude"` TrackLongitude unit `yaml:"TrackLongitude"` TrackNumTurns int `yaml:"TrackNumTurns"` TrackPitSpeedLimit unit `yaml:"TrackPitSpeedLimit"` TrackType string `yaml:"TrackType"` TrackWeatherType string `yaml:"TrackWeatherType"` TrackSkies string `yaml:"TrackSkies"` TrackSurfaceTemp unit `yaml:"TrackSurfaceTemp"` TrackAirTemp unit `yaml:"TrackAirTemp"` TrackAirPressure unit `yaml:"TrackAirPressure"` TrackWindVel unit `yaml:"TrackWindVel"` TrackWindDir unit `yaml:"TrackWindDir"` TrackRelativeHumidity unit `yaml:"TrackRelativeHumidity"` TrackFogLevel unit `yaml:"TrackFogLevel"` SeriesID int `yaml:"SeriesID"` SeasonID int `yaml:"SeasonID"` SessionID int `yaml:"SessionID"` SubSessionID int `yaml:"SubSessionID"` LeagueID int `yaml:"LeagueID"` Official int `yaml:"Official"` RaceWeek int `yaml:"RaceWeek"` EventType string `yaml:"EventType"` Category string `yaml:"Category"` SimMode string `yaml:"SimMode"` TeamRacing int `yaml:"TeamRacing"` MinDrivers int `yaml:"MinDrivers"` MaxDrivers int `yaml:"MaxDrivers"` DCRuleSet string `yaml:"DCRuleSet"` QualifierMustStartRace intToBool `yaml:"QualifierMustStartRace"` NumCarClasses int `yaml:"NumCarClasses"` NumCarTypes int `yaml:"NumCarTypes"` WeekendOptions WeekendOptions `yaml:"WeekendOptions"` TelemetryOptions TelemetryOptions `yaml:"TelemetryOptions"` }
type WeekendOptions ¶
type WeekendOptions struct { NumStarters int `yaml:"NumStarters"` StartingGrid string `yaml:"StartingGrid"` QualifyScoring string `yaml:"QualifyScoring"` CourseCautions string `yaml:"CourseCautions"` StandingStart intToBool `yaml:"StandingStart"` Restarts string `yaml:"Restarts"` WeatherType string `yaml:"WeatherType"` Skies string `yaml:"Skies"` WindDirection unit `yaml:"WindDirection"` WindSpeed unit `yaml:"WindSpeed"` WeatherTemp unit `yaml:"WeatherTemp"` RelativeHumidity unit `yaml:"RelativeHumidity"` FogLevel unit `yaml:"FogLevel"` Unofficial intToBool `yaml:"Unofficial"` CommercialMode string `yaml:"CommercialMode"` NightMode intToBool `yaml:"NightMode"` IsFixedSetup intToBool `yaml:"IsFixedSetup"` StrictLapsChecking string `yaml:"StrictLapsChecking"` HasOpenRegistration intToBool `yaml:"HasOpenRegistration"` HardcoreLevel int `yaml:"HardcoreLevel"` }