ui

package module
v0.7.3-0...-e81e75e Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

ui

Frontend and backend for our UI's

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestID

func RequestID(ctx context.Context) string

RequestID pulls a request ID from a context.Context.

func WithRequestID

func WithRequestID(ctx context.Context, id string) context.Context

WithRequestID returns a new context.Context, based on ctx, with the request id set.

Types

type AVController

type AVController interface {
	RoomState(context.Context, string) (avcontrol.StateResponse, error)
	SetRoomState(context.Context, string, avcontrol.StateRequest) (avcontrol.StateResponse, error)
}

type AudioDeviceConfig

type AudioDeviceConfig struct {
	Name   string
	Volume StateControlConfig `json:"volume"`
	Mute   StateControlConfig `json:"mute"`
	Unmute StateControlConfig `json:"unmute"`
}

type AudioGroupConfig

type AudioGroupConfig struct {
	Name         string
	AudioDevices []AudioDeviceConfig
}

type CameraConfig

type CameraConfig struct {
	Name        string
	TiltUp      StateControlConfig
	TiltDown    StateControlConfig
	PanLeft     StateControlConfig
	PanRight    StateControlConfig
	PanTiltStop StateControlConfig
	ZoomIn      StateControlConfig
	ZoomOut     StateControlConfig
	ZoomStop    StateControlConfig
	Presets     []CameraPresetConfig
}

CameraConfig represents a Camera and its associated control endpoints

type CameraPresetConfig

type CameraPresetConfig struct {
	Name      string
	SetPreset StateControlConfig
}

CameraPresetConfig represents a preset on a camera

type Client

type Client interface {
	HandleMessage([]byte)
	OutgoingMessages() <-chan []byte
	Done() <-chan struct{}
	Close()
	Refresh()
}

type ClientBuilder

type ClientBuilder interface {
	New(ctx context.Context, room, controlGroup string) (Client, error)
}

type Config

type Config struct {
	ID            string
	ControlGroups map[string]ControlGroup
	States        map[string]State
}

Config represents the program for a room that can be used to control a room

type ControlGroup

type ControlGroup struct {
	// PowerOff represents the state the room needs to be in to be considered "off"
	PowerOff StateControlConfig

	// PowerOn is the state we set to turn on the room
	PowerOn StateControlConfig

	Displays    []DisplayConfig
	MediaAudio  AudioDeviceConfig
	AudioGroups []AudioGroupConfig
	Cameras     []CameraConfig
}

ControlGroup represents a group of Devices and inputs. These groups are used for logical grouping and displaying on different UIs

type DataService

type DataService interface {
	// UIForDevice returns the ui that should be used for the given room/id.
	UIForDevice(ctx context.Context, room, id string) (string, error)

	// ControlGroup takes the room and id of a device, and returns the control group that that devices should use.
	// TODO this should also take into account the divider sensors?
	// or maybe that should be some combo interface that takes this and key service?
	ControlGroup(ctx context.Context, room, id string) (string, error)

	// RoomAndControlGroup figures out which room and control group is associated with the given key.
	// TODO this function will have to get the room, device -> call ControlGroup
	RoomAndControlGroup(ctx context.Context, key string) (string, string, error)

	// Config returns the config for the given room.
	Config(ctx context.Context, room string) (Config, error)
}

type DisplayConfig

type DisplayConfig struct {
	Name string
	Icon string

	Blank   StateControlConfig
	Unblank StateControlConfig

	Sources []SourceConfig
}

DisplayConfig represents a Display and its associated controls for a given group

type Event

type Event struct {
	Key   string
	Value string
	Data  interface{}

	Tags   []string
	Room   string
	Device string
}

Event - i'm holding off on events for a few days

type EventPublisher

type EventPublisher interface {
	Publish(context.Context, Event) error
}

type GenericRequest

type GenericRequest struct {
	URL    *url.URL
	Method string
	Body   []byte
}

GenericRequest contains the information necessary to make a generic HTTP request in association with making state changes in a room

type SourceConfig

type SourceConfig struct {
	Name    string
	Icon    string
	Visible bool
	StateControlConfig

	// Sources represent sub-sources of the parent source
	Sources []SourceConfig
}

SourceConfig represents a source and its associated controls

type State

type State avcontrol.StateRequest

func (State) Copy

func (s State) Copy() State

type StateControlConfig

type StateControlConfig struct {
	MatchStates      []string
	StateTransitions []StateTransition
}

type StateTransition

type StateTransition struct {
	MatchStates []string
	Action      StateTransitionAction
}

type StateTransitionAction

type StateTransitionAction struct {
	SetStates []string
	Requests  []GenericRequest
}

Directories

Path Synopsis
cmd
ui
internal

Jump to

Keyboard shortcuts

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