preview

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 6 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 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,
	sceneRepo *repositories.SceneRepository,
	dmxService *dmx.Service,
) *Service

NewService creates a new preview service.

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) InitializeWithScene

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

InitializeWithScene initializes a preview session with values from a scene.

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.

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