cue

package
v0.0.0-...-1392edb Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
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

func LuaToHex

func LuaToHex(L *lua.LState) int

LuaToHex is a lua helper to convert rgb to hex

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

func CommandToCue(ctx context.Context, m MasterManager, cmd string) (*Cue, error)

CommandToCue returns a cue based on a command.

func (*Cue) GetDuration

func (c *Cue) GetDuration() time.Duration

GetDuration returns the sum of frame in a cue

func (*Cue) MarshalJSON

func (c *Cue) MarshalJSON() ([]byte, error)

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

func (cf *Frame) GetDuration() time.Duration

GetDuration returns the longest lasting Action within a CueFrame

func (*Frame) MarshalJSON

func (cf *Frame) MarshalJSON() ([]byte, error)

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 LuaAction

type LuaAction struct {
	Light  string
	Color  string
	Timing string
}

LuaAction is a minimal version of Action that lua code returns

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

func (m *Master) AddIDsRecursively(c *Cue)

AddIDsRecursively populates the ID fields on a cue, its frames, and their actions

func (*Master) DumpToFile

func (cm *Master) DumpToFile(fileName string) error

DumpToFile write the CueMaster to a file

func (*Master) EnQueueCue

func (m *Master) EnQueueCue(ctx context.Context, c Cue, cs *Stack) *Cue

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

func (cm *Master) GetDefaultCueStack() *Stack

GetDefaultCueStack gives the first cuestack

func (*Master) GetLightManager

func (cm *Master) GetLightManager() light.Manager

GetLightManager returns a poitner to the light state manager

func (*Master) ProcessCue

func (m *Master) ProcessCue(ctx context.Context, c *Cue, wg *sync.WaitGroup)

ProcessCue processes cue

func (*Master) ProcessForever

func (cm *Master) ProcessForever(ctx context.Context, wg *sync.WaitGroup)

ProcessForever runs all the cuestacks

func (*Master) ProcessFrame

func (m *Master) ProcessFrame(ctx context.Context, cf *Frame, wg *sync.WaitGroup)

ProcessFrame processes the cueframe

func (*Master) ProcessFrameAction

func (m *Master) ProcessFrameAction(ctx context.Context, cfa *FrameAction, wg *sync.WaitGroup)

ProcessFrameAction does job stuff

func (*Master) ProcessStack

func (m *Master) ProcessStack(ctx context.Context, cs *Stack, wg *sync.WaitGroup)

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

type MockMasterManager struct {
	mock.Mock
}

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

func (_m *MockMasterManager) EnQueueCue(ctx context.Context, c Cue, cs *Stack) *Cue

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

func (_m *MockMasterManager) ProcessCue(ctx context.Context, c *Cue, wg *sync.WaitGroup)

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

func (_m *MockMasterManager) ProcessFrame(ctx context.Context, cf *Frame, wg *sync.WaitGroup)

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

func (_m *MockMasterManager) ProcessStack(ctx context.Context, cs *Stack, wg *sync.WaitGroup)

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)

Jump to

Keyboard shortcuts

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