preview

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package preview provides preview session management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelUpdate added in v0.2.31

type ChannelUpdate struct {
	FixtureID    string
	ChannelIndex int
	Value        int
}

ChannelUpdate represents a single channel update.

type DMXOutput

type DMXOutput struct {
	Universe int
	Channels []int
}

DMXOutput represents DMX output for a universe.

type Service

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

Service handles preview session operations.

func NewService

func NewService(
	fixtureRepo *repositories.FixtureRepository,
	lookRepo *repositories.LookRepository,
	dmxService *dmx.Service,
) *Service

NewService creates a new preview service.

func (*Service) CancelAllProjectSessions added in v0.2.23

func (s *Service) CancelAllProjectSessions(ctx context.Context, projectID string)

CancelAllProjectSessions cancels all active preview sessions for a project. This should be called when activating looks or starting cue playback to ensure preview overrides don't interfere with look output. Preview mode uses channel overrides that take precedence over base look values, so if not cleared, stale preview values would override the newly activated look.

The ctx parameter is included for API consistency and future cancellation support, but is currently unused as the operation completes synchronously.

func (*Service) CancelSession

func (s *Service) CancelSession(ctx context.Context, sessionID string) (bool, error)

CancelSession cancels a preview session and removes its overrides.

func (*Service) CommitSession

func (s *Service) CommitSession(ctx context.Context, sessionID string) (bool, error)

CommitSession commits a preview session (keeps changes, cleans up session).

func (*Service) GetDMXOutput

func (s *Service) GetDMXOutput(sessionID string) []DMXOutput

GetDMXOutput returns the current DMX output for a session.

func (*Service) GetProjectSession

func (s *Service) GetProjectSession(projectID string) *Session

GetProjectSession returns the active session for a project.

func (*Service) GetSession

func (s *Service) GetSession(sessionID string) *Session

GetSession returns a session by ID.

func (*Service) InitializeWithLook added in v0.2.30

func (s *Service) InitializeWithLook(ctx context.Context, sessionID string, lookID string) (bool, error)

InitializeWithLook initializes a preview session with values from a look.

func (*Service) SetSessionUpdateCallback

func (s *Service) SetSessionUpdateCallback(callback func(session *Session, dmxOutput []DMXOutput))

SetSessionUpdateCallback sets the callback for session updates (for subscriptions).

func (*Service) StartSession

func (s *Service) StartSession(ctx context.Context, projectID string, userID *string) (*Session, error)

StartSession starts a new preview session for a project.

func (*Service) UpdateChannelValue

func (s *Service) UpdateChannelValue(ctx context.Context, sessionID string, fixtureID string, channelIndex int, value int) (bool, error)

UpdateChannelValue updates a channel value in a preview session.

func (*Service) UpdateChannelValues added in v0.2.31

func (s *Service) UpdateChannelValues(ctx context.Context, sessionID string, updates []ChannelUpdate) (bool, error)

UpdateChannelValues updates multiple channel values in a preview session atomically.

type Session

type Session struct {
	ID               string
	ProjectID        string
	UserID           *string
	IsActive         bool
	CreatedAt        time.Time
	ChannelOverrides map[string]int // Key: "universe:channel", Value: 0-255
}

Session represents an active preview session.

Jump to

Keyboard shortcuts

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