device

package
v0.0.0-...-7d4cad4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InputDevice

type InputDevice interface {
	Init(players []string, threshold uint, falseStart uint) error // initialization of a device
	Start() error                                                 // start the device
	GetDist(playerID uint) (uint, error)                          // returns actual distance ridden by the given player
	GetPlayerCount() uint                                         // returns player count initialized
	Clean() error                                                 // resets players distance to 0
	Check() (int, error)                                          // checks if any player has exceeded the falseStart distance
	Close() error                                                 // performs cleanups: closes all devices, files etc.
}

InputDevice -

func SetupDevice

func SetupDevice(deviceConf string, samplingRate uint, failstartThreshold uint) (device InputDevice, err error)

SetupDevice parses device configuration string and returns proper InputDevice interface implementation already initiaited

type ShmReader

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

ShmReader represents SHM connection to read players distance; implements InputDevice

func (*ShmReader) Check

func (s *ShmReader) Check() (int, error)

Check checks whether in any of the input SHM files distance of the allowed falseStart was exceeded

func (*ShmReader) Clean

func (s *ShmReader) Clean() error

Clean triggers distance reset to 0 in the measuring program

func (*ShmReader) Close

func (s *ShmReader) Close() error

Close terminates counter companion program and closes all SHM files

func (*ShmReader) GetDist

func (s *ShmReader) GetDist(playerID uint) (uint, error)

GetDist reads current distance of a player from a SHM file

func (*ShmReader) GetPlayerCount

func (s *ShmReader) GetPlayerCount() uint

GetPlayerCount returns number of players that were defined

func (*ShmReader) Init

func (s *ShmReader) Init(ports []string, samplingRate uint, falseStart uint) error

Init creates SHM "sockets" where input device data will be written

func (*ShmReader) Start

func (s *ShmReader) Start() error

Start starts a counter program that will write distances into SHM files

Jump to

Keyboard shortcuts

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