api

package
v0.0.0-...-507ebef Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Version returns the libdrag version

Types

type LibDragAPI

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

LibDragAPI provides a mobile-friendly interface

func NewLibDragAPI

func NewLibDragAPI() *LibDragAPI

func (*LibDragAPI) CompleteRace

func (api *LibDragAPI) CompleteRace(raceID string) error

CompleteRace manually marks a race as complete and cleans up resources

func (*LibDragAPI) GetActiveRaceCount

func (api *LibDragAPI) GetActiveRaceCount() int

GetActiveRaceCount returns the number of currently active races

func (*LibDragAPI) GetActiveRaceIDs

func (api *LibDragAPI) GetActiveRaceIDs() []string

GetActiveRaceIDs returns a list of all currently active race IDs

func (*LibDragAPI) GetAllRaceStatuses

func (api *LibDragAPI) GetAllRaceStatuses() map[string]string

GetAllRaceStatuses returns status information for all active races

func (*LibDragAPI) GetMaxConcurrentRaces

func (api *LibDragAPI) GetMaxConcurrentRaces() int

GetMaxConcurrentRaces returns the maximum number of concurrent races allowed

func (*LibDragAPI) GetRaceStatusJSONByID

func (api *LibDragAPI) GetRaceStatusJSONByID(raceID string) string

GetRaceStatusJSON returns race status as JSON (legacy method) GetRaceStatusJSONByID returns race status as JSON for a specific race

func (*LibDragAPI) GetResultsJSONByID

func (api *LibDragAPI) GetResultsJSONByID(raceID string) string

GetResultsJSON returns race results as JSON (legacy method) GetResultsJSONByID returns race results as JSON for a specific race

func (*LibDragAPI) GetShortRaceID

func (api *LibDragAPI) GetShortRaceID(raceID string) string

GetShortRaceID returns a short identifier for logging purposes

func (*LibDragAPI) GetTreeStatusJSONByID

func (api *LibDragAPI) GetTreeStatusJSONByID(raceID string) string

GetTreeStatusJSONByID returns christmas tree status as JSON for a specific race

func (*LibDragAPI) Initialize

func (api *LibDragAPI) Initialize() error

Initialize the libdrag system

func (*LibDragAPI) IsRaceCompleteByID

func (api *LibDragAPI) IsRaceCompleteByID(raceID string) bool

IsRaceComplete checks if the current race is finished (legacy method) IsRaceCompleteByID checks if a specific race is finished

func (*LibDragAPI) PublishEvent

func (api *LibDragAPI) PublishEvent(event events.Event)

PublishEvent publishes an event to the event bus (for testing or external components)

func (*LibDragAPI) RaceExists

func (api *LibDragAPI) RaceExists(raceID string) bool

RaceExists checks if a race with the given ID exists

func (*LibDragAPI) Reset

func (api *LibDragAPI) Reset() error

Reset clears all active races but keeps the API initialized

func (*LibDragAPI) SetMaxConcurrentRaces

func (api *LibDragAPI) SetMaxConcurrentRaces(max int)

SetMaxConcurrentRaces sets the maximum number of concurrent races allowed

func (*LibDragAPI) SetTestMode

func (api *LibDragAPI) SetTestMode(enabled bool)

SetTestMode enables fast mode for all timing systems (for testing)

func (*LibDragAPI) StartRaceWithID

func (api *LibDragAPI) StartRaceWithID() (string, error)

StartRaceWithID starts a new drag race and returns a unique race ID

func (*LibDragAPI) Stop

func (api *LibDragAPI) Stop() error

Stop shuts down the API and cleans up all active races

func (*LibDragAPI) Subscribe

func (api *LibDragAPI) Subscribe(eventType events.EventType, handler events.EventHandler) func()

Subscribe adds an event handler for a specific event type

func (*LibDragAPI) SubscribeAll

func (api *LibDragAPI) SubscribeAll(handler events.EventHandler) func()

SubscribeAll adds an event handler that receives all events

Jump to

Keyboard shortcuts

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