Documentation
¶
Index ¶
- Constants
- Variables
- func NewLogger(runAsDamon bool) *zap.SugaredLogger
- type Config
- type GameController
- func (sgc *GameController) AddIndicator(indi Indicator)
- func (sgc *GameController) AddStrike() error
- func (sgc *GameController) ClearIndicators()
- func (sgc *GameController) ClearPorts() error
- func (sgc *GameController) ClearSeeds() error
- func (sgc *GameController) ClearSerialNumber()
- func (sgc *GameController) Close()
- func (sgc *GameController) GameOverBoom()
- func (sgc *GameController) GameOverWin()
- func (sgc *GameController) GetGameTime() time.Duration
- func (sgc *GameController) GetIndicators() []Indicator
- func (sgc *GameController) GetInstalledModules() [10]bool
- func (sgc *GameController) GetPorts() byte
- func (sgc *GameController) GetSerial() string
- func (sgc *GameController) GetStrikeRate() float32
- func (sgc *GameController) GetStrikes() int8
- func (sgc *GameController) ModFullUpdate(modnum int) error
- func (sgc *GameController) RandomPopulate()
- func (sgc *GameController) Run()
- func (sgc *GameController) SetGameTime(time time.Duration) error
- func (sgc *GameController) SetMaxStrikes(inmax uint8)
- func (sgc *GameController) SetModSeed(index uint8, seed uint16)
- func (sgc *GameController) SetNumBatteries(numbat uint8) error
- func (sgc *GameController) SetPorts(port byte) error
- func (sgc *GameController) SetSerial(serial string) error
- func (sgc *GameController) SetStrikeRate(rate float32) error
- func (sgc *GameController) SetStrikes(strikes int8, force ...bool) error
- func (sgc *GameController) StartGame() error
- func (sgc *GameController) StopGame() error
- func (sgc *GameController) UpdateModTime() error
- type Indicator
- type InterProcessCom
- type ShieldControl
- func (ssc *ShieldControl) AddStrike()
- func (ssc *ShieldControl) ClearDisplay()
- func (ssc *ShieldControl) Close()
- func (ssc *ShieldControl) ExploadSound()
- func (ssc *ShieldControl) GameWinSound()
- func (ssc *ShieldControl) ModSolvedSound()
- func (ssc *ShieldControl) NeedyWantSound()
- func (ssc *ShieldControl) RegisterM2CConsumer() chan bool
- func (ssc *ShieldControl) RegisterMFBConsumer() chan time.Duration
- func (ssc *ShieldControl) ResetStrike()
- func (ssc *ShieldControl) Run()
- func (ssc *ShieldControl) SetStrike(numstrike uint8)
- func (ssc *ShieldControl) TimerBeep(stopchannel chan bool, timertick chan bool)
- func (ssc *ShieldControl) WriteIdle()
- func (ssc *ShieldControl) WriteTime(intime time.Duration)
- type SideControl
- func (ssc *SideControl) ClearAll() error
- func (ssc *SideControl) ClearAllIndicator() error
- func (ssc *SideControl) ClearAllSideArt() error
- func (ssc *SideControl) ClearSerialNumber() error
- func (ssc *SideControl) Close()
- func (ssc *SideControl) SetIndicator(lit bool, indlabel [3]rune) error
- func (ssc *SideControl) SetSerialNumber(serialnumber string) error
- func (ssc *SideControl) SetSideArt(artcode byte) error
- func (ssc *SideControl) TestIfPresent() bool
Constants ¶
const ( GAMEPLAYMAXNUMPORT = 6 GAMEPLAYMAXTINDICATOR = 12 )
const ( // Side Panel addresses SIDE_PANEL byte = 0x50 )
Variables ¶
var ( VALID_INDICATORS []string = []string{"SND", "CLR", "CAR", "IND", "FRQ", "SIG", "NSA", "MSA", "TRN", "BOB", "FRK"} VALID_PORT_ID []string = []string{"DVI", "PAR", "PS2", "RJ4", "SER", "RCA"} )
Functions ¶
func NewLogger ¶
func NewLogger(runAsDamon bool) *zap.SugaredLogger
Types ¶
type Config ¶
type Config struct { // ConfigValues Network struct { UseMulticast bool MultiCastIP string MultiCastPort int } Shield struct { I2cBusNumber uint8 Strike1PinNum uint8 Strike2PinNum uint8 ModInterruptPinNum uint8 MfbStartPinNum uint8 SevenSegAddress uint8 } // contains filtered or unexported fields }
func NewConfig ¶
func NewConfig(logger *zap.SugaredLogger) *Config
type GameController ¶
type GameController struct {
// contains filtered or unexported fields
}
func NewGameCtrlr ¶
func NewGameCtrlr(log *zap.SugaredLogger, sidePanelActive bool) *GameController
Creates a new game controller takes in a variable called runAsDamon Which is a bool runAsDamon controls whether or not the
func (*GameController) AddIndicator ¶
func (sgc *GameController) AddIndicator(indi Indicator)
Adds a indicator to the list
func (*GameController) AddStrike ¶
func (sgc *GameController) AddStrike() error
Adds a strike to the current number of strikes
func (*GameController) ClearIndicators ¶
func (sgc *GameController) ClearIndicators()
Clears out the current indicators
func (*GameController) ClearPorts ¶
func (sgc *GameController) ClearPorts() error
clears all of the ports that are configured for the game
func (*GameController) ClearSeeds ¶
func (sgc *GameController) ClearSeeds() error
Clears the seed on all modules to turn off external displays
func (*GameController) ClearSerialNumber ¶
func (sgc *GameController) ClearSerialNumber()
func (*GameController) GameOverBoom ¶
func (sgc *GameController) GameOverBoom()
func (*GameController) GameOverWin ¶
func (sgc *GameController) GameOverWin()
func (*GameController) GetGameTime ¶
func (sgc *GameController) GetGameTime() time.Duration
Gets the current game time
func (*GameController) GetIndicators ¶
func (sgc *GameController) GetIndicators() []Indicator
Gets the currently configured indicators
func (*GameController) GetInstalledModules ¶
func (sgc *GameController) GetInstalledModules() [10]bool
func (*GameController) GetPorts ¶
func (sgc *GameController) GetPorts() byte
returns all of the ports that are configured for the game
func (*GameController) GetSerial ¶
func (sgc *GameController) GetSerial() string
func (*GameController) GetStrikeRate ¶
func (sgc *GameController) GetStrikeRate() float32
Get the srike reduction rate
func (*GameController) GetStrikes ¶
func (sgc *GameController) GetStrikes() int8
Gets the current amount of strikes
func (*GameController) ModFullUpdate ¶
func (sgc *GameController) ModFullUpdate(modnum int) error
Update the specified module with all of the game values
func (*GameController) RandomPopulate ¶
func (sgc *GameController) RandomPopulate()
populates each module with a random game
func (*GameController) Run ¶
func (sgc *GameController) Run()
Starts Game Controller Monitoring components
func (*GameController) SetGameTime ¶
func (sgc *GameController) SetGameTime(time time.Duration) error
Sets the game time to the given time
func (*GameController) SetMaxStrikes ¶
func (sgc *GameController) SetMaxStrikes(inmax uint8)
func (*GameController) SetModSeed ¶
func (sgc *GameController) SetModSeed(index uint8, seed uint16)
func (*GameController) SetNumBatteries ¶
func (sgc *GameController) SetNumBatteries(numbat uint8) error
func (*GameController) SetPorts ¶
func (sgc *GameController) SetPorts(port byte) error
Adds a port to the list only one of the two last bits can be set for Port the last six bits computes what ports are shown 1 = Port 0 = not used 1 = DVI 1 = Parallel 1 = PS/2 1 = RJ45 1 = Serial 1 = SteroRCA
func (*GameController) SetSerial ¶
func (sgc *GameController) SetSerial(serial string) error
Sets the current game serial number
func (*GameController) SetStrikeRate ¶
func (sgc *GameController) SetStrikeRate(rate float32) error
Set the strike reduction rate
func (*GameController) SetStrikes ¶
func (sgc *GameController) SetStrikes(strikes int8, force ...bool) error
Set the number of strikes
func (*GameController) UpdateModTime ¶
func (sgc *GameController) UpdateModTime() error
Updates the time on all module to the current game time
type InterProcessCom ¶
type InterProcessCom struct {
// contains filtered or unexported fields
}
func NewIPC ¶
func NewIPC(logger *zap.SugaredLogger, gamectrl *GameController) *InterProcessCom
Creates a new interprocess communicator
func (*InterProcessCom) Close ¶
func (sipc *InterProcessCom) Close() error
Safely closes the interprocess communicator
func (*InterProcessCom) Run ¶
func (sipc *InterProcessCom) Run()
func (*InterProcessCom) SyncStatus ¶
func (sipc *InterProcessCom) SyncStatus(stat *mktnecf.Status) error
type ShieldControl ¶
type ShieldControl struct {
// contains filtered or unexported fields
}
func NewShieldControl ¶
func NewShieldControl(logger *zap.SugaredLogger, cfg *Config) *ShieldControl
func (*ShieldControl) AddStrike ¶
func (ssc *ShieldControl) AddStrike()
Adds a strike to the display system and plays a sound
func (*ShieldControl) Close ¶
func (ssc *ShieldControl) Close()
Closes out all functions that are running safely
func (*ShieldControl) ExploadSound ¶
func (ssc *ShieldControl) ExploadSound()
plays the sound of an explosion
func (*ShieldControl) GameWinSound ¶
func (ssc *ShieldControl) GameWinSound()
plays the sound of an game win
func (*ShieldControl) ModSolvedSound ¶
func (ssc *ShieldControl) ModSolvedSound()
plays the sound of an module that has been solved
func (*ShieldControl) NeedyWantSound ¶
func (ssc *ShieldControl) NeedyWantSound()
plays the sound of an needy wanting attention
func (*ShieldControl) RegisterM2CConsumer ¶
func (ssc *ShieldControl) RegisterM2CConsumer() chan bool
Registers a consumer of the module to controller interrupt line The consumer will have a true sent down it when the interupt line is triggered
func (*ShieldControl) RegisterMFBConsumer ¶
func (ssc *ShieldControl) RegisterMFBConsumer() chan time.Duration
Registers a consumer of the module to the multifunction button Sends how long the button was held for
func (*ShieldControl) ResetStrike ¶
func (ssc *ShieldControl) ResetStrike()
Resets the strike to zero
func (*ShieldControl) Run ¶
func (ssc *ShieldControl) Run()
func (*ShieldControl) SetStrike ¶
func (ssc *ShieldControl) SetStrike(numstrike uint8)
Adds a strike to the display system and plays a sound
func (*ShieldControl) TimerBeep ¶
func (ssc *ShieldControl) TimerBeep(stopchannel chan bool, timertick chan bool)
TimeClockSignal Plays the per second beep takes the channel needed to stop the beep and a tick chan to trigger each tone on the game clock
func (*ShieldControl) WriteIdle ¶
func (ssc *ShieldControl) WriteIdle()
Writes the name of the game to the display
func (*ShieldControl) WriteTime ¶
func (ssc *ShieldControl) WriteTime(intime time.Duration)
Converts and writes the time to the display max it can display is 99:60 Will move to 49.50 when time is less then 1 minute
type SideControl ¶
type SideControl struct {
// contains filtered or unexported fields
}
func NewSideControl ¶
func NewSideControl(logger *zap.SugaredLogger, bus int) *SideControl
func (*SideControl) ClearAll ¶
func (ssc *SideControl) ClearAll() error
Clears Everything from the panel
func (*SideControl) ClearAllIndicator ¶
func (ssc *SideControl) ClearAllIndicator() error
Clears all set indicators from the panel
func (*SideControl) ClearAllSideArt ¶
func (ssc *SideControl) ClearAllSideArt() error
Clears all SideArt from the panel
func (*SideControl) ClearSerialNumber ¶
func (ssc *SideControl) ClearSerialNumber() error
Clears the serial number only works if the address of this instance is the RIGHT_PANEL address
func (*SideControl) Close ¶
func (ssc *SideControl) Close()
func (*SideControl) SetIndicator ¶
func (ssc *SideControl) SetIndicator(lit bool, indlabel [3]rune) error
Set Lit Indicator Max 2 per side Once one it set caling this function again will set the other indicator for that panel If both are set the last one will be replaced with the new value
func (*SideControl) SetSerialNumber ¶
func (ssc *SideControl) SetSerialNumber(serialnumber string) error
Set Serial Number
func (*SideControl) SetSideArt ¶
func (ssc *SideControl) SetSideArt(artcode byte) error
Set Side Art Will start setting art on that panel then once the panel is full it will overwrite the last panel first bit equals art type Battery or Port 0 = Battery 1 = Port for Battery the last 2 bits sets the battery type 0 = Battery 0 = not used 0 = not used 0 = not used 0 = not used 0 = not used 1 = 2xAA 1 = D only one of the two last bits can be set for Port the last six bits computes what ports are shown 1 = Port 0 = not used 1 = DVI 1 = Parallel 1 = PS/2 1 = RJ45 1 = Serial 1 = SteroRCA 0x8b would be a parallel port with PS/2 and RJ45
func (*SideControl) TestIfPresent ¶
func (ssc *SideControl) TestIfPresent() bool
Sends 1 byte of data to the module If the byte is not writen then the module is not installed
Source Files
¶
- config.go
- gamecontroller-callbackfunc.go
- gamecontroller-clears.go
- gamecontroller-gameend.go
- gamecontroller-infogetters.go
- gamecontroller-infomultipartset.go
- gamecontroller-infosetters.go
- gamecontroller-modupdates.go
- gamecontroller-outsideComCom.go
- gamecontroller.go
- interProcessCom.go
- logger.go
- shieldControl.go
- sideControl.go