Documentation ¶
Index ¶
- Constants
- func LuaToHex(L *lua.LState) int
- type Cue
- type Frame
- type FrameAction
- type LuaAction
- type LuaCue
- type LuaFrame
- type Master
- func (m *Master) AddIDsRecursively(c *Cue)
- func (cm *Master) DumpToFile(fileName string) error
- func (m *Master) EnQueueCue(ctx context.Context, c Cue, cs *Stack) *Cue
- func (cm *Master) GetCommands() config.UserCommandMap
- func (cm *Master) GetDefaultCueStack() *Stack
- func (cm *Master) GetLightManager() light.Manager
- func (m *Master) ProcessCue(ctx context.Context, c *Cue, wg *sync.WaitGroup)
- func (cm *Master) ProcessForever(ctx context.Context, wg *sync.WaitGroup)
- func (m *Master) ProcessFrame(ctx context.Context, cf *Frame, wg *sync.WaitGroup)
- func (m *Master) ProcessFrameAction(ctx context.Context, cfa *FrameAction, wg *sync.WaitGroup)
- func (m *Master) ProcessStack(ctx context.Context, cs *Stack, wg *sync.WaitGroup)
- func (cm *Master) SetCommands(c config.UserCommandMap)
- type MasterManager
- type MockMasterManager
- func (_m *MockMasterManager) AddIDsRecursively(c *Cue)
- func (_m *MockMasterManager) EnQueueCue(ctx context.Context, c Cue, cs *Stack) *Cue
- func (_m *MockMasterManager) GetCommands() config.UserCommandMap
- func (_m *MockMasterManager) GetDefaultCueStack() *Stack
- func (_m *MockMasterManager) GetLightManager() light.Manager
- func (_m *MockMasterManager) ProcessCue(ctx context.Context, c *Cue, wg *sync.WaitGroup)
- func (_m *MockMasterManager) ProcessForever(ctx context.Context, wg *sync.WaitGroup)
- func (_m *MockMasterManager) ProcessFrame(ctx context.Context, cf *Frame, wg *sync.WaitGroup)
- func (_m *MockMasterManager) ProcessFrameAction(ctx context.Context, cfa *FrameAction, wg *sync.WaitGroup)
- func (_m *MockMasterManager) ProcessStack(ctx context.Context, cs *Stack, wg *sync.WaitGroup)
- func (_m *MockMasterManager) SetCommands(_a0 config.UserCommandMap)
- type Source
- type Stack
Constants ¶
const ( SourceInputAPI = "http_api" SourceInputRPC = "rpc" SourceInputTrigger = "trigger" SourceInputJob = "job" SourceTypeCommand = "command" SourceTypeTrigger = "trigger" SourceTypeJSON = "json" )
Source describes what enqueued the cue
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cue ¶
type Cue struct { ID int64 `json:"id"` Frames []Frame `json:"frames"` Name string `json:"name"` Status string `json:"status"` WaitBefore time.Duration `json:"wait_before"` WaitAfter time.Duration `json:"wait_after"` StartedAt time.Time `json:"started_at"` FinishedAt time.Time `json:"finished_at"` RealDuration time.Duration `json:"real_duration"` Source Source `json:"source"` // contains filtered or unexported fields }
Cue is a cue.
func BuildCueFromUserCommand ¶
func BuildCueFromUserCommand(ctx context.Context, m MasterManager, command config.UserCommand, args []string) (*Cue, error)
BuildCueFromUserCommand processes a lua user command
func CommandToCue ¶
CommandToCue returns a cue based on a command.
func (*Cue) GetDuration ¶
GetDuration returns the sum of frame in a cue
func (*Cue) MarshalJSON ¶
MarshalJSON override that injects the expected duration.
type Frame ¶
type Frame struct { Actions []FrameAction `json:"actions"` ID int64 `json:"id"` }
Frame is a single 'animation frame' of a Cue
func (*Frame) GetDuration ¶
GetDuration returns the longest lasting Action within a CueFrame
func (*Frame) MarshalJSON ¶
MarshalJSON override that injects the expected duration.
type FrameAction ¶
type FrameAction struct { NewState light.TargetState `json:"new_state"` ID int64 `json:"id"` LightName string `json:"light_name"` Light light.Light `json:"light"` }
FrameAction is an action within a Cue(Frame) to be executed simultaneously
func (*FrameAction) MarshalJSON ¶
func (cfa *FrameAction) MarshalJSON() ([]byte, error)
MarshalJSON override that injects the full Light object.
type LuaCue ¶
type LuaCue struct {
Frames []LuaFrame
}
LuaCue is a minimal version of Cue that lua code returns
type LuaFrame ¶
type LuaFrame struct {
Actions []LuaAction
}
LuaFrame is a minimal version of Frame that lua code returns
type Master ¶
type Master struct { CueStacks []Stack `json:"cue_stacks"` LightManager light.Manager // contains filtered or unexported fields }
Master is the parent of all CueStacks, is a singleton
func (*Master) AddIDsRecursively ¶
AddIDsRecursively populates the ID fields on a cue, its frames, and their actions
func (*Master) DumpToFile ¶
DumpToFile write the CueMaster to a file
func (*Master) EnQueueCue ¶
EnQueueCue puts a cue on the queue it also assigns the cue (and subcomponents) an ID
func (*Master) GetCommands ¶
func (cm *Master) GetCommands() config.UserCommandMap
GetCommands retrieves the user command map
func (*Master) GetDefaultCueStack ¶
GetDefaultCueStack gives the first cuestack
func (*Master) GetLightManager ¶
GetLightManager returns a poitner to the light state manager
func (*Master) ProcessCue ¶
ProcessCue processes cue
func (*Master) ProcessForever ¶
ProcessForever runs all the cuestacks
func (*Master) ProcessFrame ¶
ProcessFrame processes the cueframe
func (*Master) ProcessFrameAction ¶
ProcessFrameAction does job stuff
func (*Master) ProcessStack ¶
ProcessStack processes cues
func (*Master) SetCommands ¶
func (cm *Master) SetCommands(c config.UserCommandMap)
SetCommands sets the user command map
type MasterManager ¶
type MasterManager interface { ProcessStack(ctx context.Context, cs *Stack, wg *sync.WaitGroup) ProcessCue(ctx context.Context, c *Cue, wg *sync.WaitGroup) ProcessFrame(ctx context.Context, cf *Frame, wg *sync.WaitGroup) ProcessFrameAction(ctx context.Context, cfa *FrameAction, wg *sync.WaitGroup) EnQueueCue(ctx context.Context, c Cue, cs *Stack) *Cue AddIDsRecursively(c *Cue) GetDefaultCueStack() *Stack ProcessForever(ctx context.Context, wg *sync.WaitGroup) GetLightManager() light.Manager SetCommands(config.UserCommandMap) GetCommands() config.UserCommandMap }
MasterManager is an interface
func InitializeMaster ¶
func InitializeMaster(cl clock.Clock, ls light.Manager) MasterManager
InitializeMaster initializes the cuemaster
type MockMasterManager ¶
MockMasterManager is an autogenerated mock type for the MasterManager type
func (*MockMasterManager) AddIDsRecursively ¶
func (_m *MockMasterManager) AddIDsRecursively(c *Cue)
AddIDsRecursively provides a mock function with given fields: c
func (*MockMasterManager) EnQueueCue ¶
EnQueueCue provides a mock function with given fields: ctx, c, cs
func (*MockMasterManager) GetCommands ¶
func (_m *MockMasterManager) GetCommands() config.UserCommandMap
GetCommands provides a mock function with given fields:
func (*MockMasterManager) GetDefaultCueStack ¶
func (_m *MockMasterManager) GetDefaultCueStack() *Stack
GetDefaultCueStack provides a mock function with given fields:
func (*MockMasterManager) GetLightManager ¶
func (_m *MockMasterManager) GetLightManager() light.Manager
GetLightManager provides a mock function with given fields:
func (*MockMasterManager) ProcessCue ¶
ProcessCue provides a mock function with given fields: ctx, c, wg
func (*MockMasterManager) ProcessForever ¶
func (_m *MockMasterManager) ProcessForever(ctx context.Context, wg *sync.WaitGroup)
ProcessForever provides a mock function with given fields: ctx, wg
func (*MockMasterManager) ProcessFrame ¶
ProcessFrame provides a mock function with given fields: ctx, cf, wg
func (*MockMasterManager) ProcessFrameAction ¶
func (_m *MockMasterManager) ProcessFrameAction(ctx context.Context, cfa *FrameAction, wg *sync.WaitGroup)
ProcessFrameAction provides a mock function with given fields: ctx, cfa, wg
func (*MockMasterManager) ProcessStack ¶
ProcessStack provides a mock function with given fields: ctx, cs, wg
func (*MockMasterManager) SetCommands ¶
func (_m *MockMasterManager) SetCommands(_a0 config.UserCommandMap)
SetCommands provides a mock function with given fields: _a0
type Source ¶
type Source struct { //http api? grpc? trigger? Input string `json:"input,omitempty"` //command? trigger? json? Type string `json:"type,omitempty"` //per-kind meta info Meta string `json:"meta,omitempty"` }
Source represents the source of a Cue
type Stack ¶
type Stack struct { Priority int `json:"priority"` Name string `json:"name"` Cues []Cue `json:"cues"` ProcessedCues []Cue `json:"processed_cues"` ActiveCue *Cue `json:"active_cue"` // contains filtered or unexported fields }
Stack is basically a precedence priority queue (really a CueQueue sigh)