clock

package
v3.7.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: GPL-2.0 Imports: 12 Imported by: 10

Documentation

Index

Constants

View Source
const (
	Normal    = iota // Display current time
	Countdown = iota // Display countdown timer only
	Countup   = iota // Count time up
	Off       = iota // (Mostly) blank screen
	Paused    = iota // Paused countdown timer(s)
)

Clock engine state constants

View Source
const Version = "3.0.0"

Version is the current clock engine version

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client A clock osc client

func (*Client) SendCount

func (client *Client) SendCount(message CountMessage) error

SendCount Send a /clock/count message

func (*Client) SendDisplay

func (client *Client) SendDisplay(message DisplayMessage) error

SendDisplay Send a /clock/display message

func (*Client) SendStart

func (client *Client) SendStart(message CountdownMessage) error

SendStart Send a /clock/countdown/start message

func (*Client) String

func (client *Client) String() string

Print the connection info of a Client

type ClientOptions

type ClientOptions struct {
	Connect string `long:"clock-client-connect" description:"Address to send clock osc messages to" default:"255.255.255.255:1245"` // Address to connect to with OSC
}

ClientOptions common options for client instances

func (ClientOptions) MakeClient

func (options ClientOptions) MakeClient() (*Client, error)

MakeClient Create a clock OSC client

type CountMessage

type CountMessage struct {
	ColorRed   float32
	ColorGreen float32
	ColorBlue  float32
	Symbol     string
	Count      int32
	Unit       string
}

CountMessage is a legacy message format for /qmsk/clock/count

func (CountMessage) MarshalOSC

func (message CountMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a CountMessage to osc.Message

func (*CountMessage) SetTimeRemaining

func (message *CountMessage) SetTimeRemaining(seconds float32)

SetTimeRemaining sets the remaining time for CountMessage and formats the unit

func (*CountMessage) UnmarshalOSC

func (message *CountMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to CountMessage

type CountdownMessage

type CountdownMessage struct {
	Seconds int32
}

CountdownMessage is for /clock/countdown/start

func (CountdownMessage) MarshalOSC

func (message CountdownMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a CountdownMessage to osc.Message

func (*CountdownMessage) UnmarshalOSC

func (message *CountdownMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to CountdownMessage

type DisplayMessage

type DisplayMessage struct {
	ColorRed   float32
	ColorGreen float32
	ColorBlue  float32
	Text       string
}

DisplayMessage is for /clock/display

func (DisplayMessage) MarshalOSC

func (message DisplayMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a DisplayMessage to osc.Message

func (*DisplayMessage) UnmarshalOSC

func (message *DisplayMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to DisplayMessage

type Engine

type Engine struct {
	Hours   string
	Minutes string
	Seconds string

	Tally      string
	TallyRed   uint8
	TallyGreen uint8
	TallyBlue  uint8

	Leds int
	Dots bool
	// contains filtered or unexported fields
}

Engine contains the state machine for clock-8001

func MakeEngine

func MakeEngine(options *EngineOptions) (*Engine, error)

MakeEngine creates a clock engine

func (*Engine) Kill

func (engine *Engine) Kill()

Kill blanks the clock display

func (*Engine) ModifyCountdown

func (engine *Engine) ModifyCountdown(delta time.Duration)

ModifyCountdown adds or removes time from primary countdown

func (*Engine) ModifyCountdown2

func (engine *Engine) ModifyCountdown2(delta time.Duration)

ModifyCountdown2 adds or removes time from primary countdown

func (*Engine) Normal

func (engine *Engine) Normal()

Normal returns main display to normal clock

func (*Engine) Pause

func (engine *Engine) Pause()

Pause pauses both countdowns

func (*Engine) Resume

func (engine *Engine) Resume()

Resume resumes both countdowns if they have been paused

func (*Engine) StartCountdown

func (engine *Engine) StartCountdown(timer time.Duration)

StartCountdown starts a primary countdown timer

func (*Engine) StartCountdown2

func (engine *Engine) StartCountdown2(timer time.Duration)

StartCountdown2 starts a secondary countdown timer

func (*Engine) StartCountup

func (engine *Engine) StartCountup()

StartCountup starts counting time up from this moment

func (*Engine) StopCountdown

func (engine *Engine) StopCountdown()

StopCountdown stops the primary countdown

func (*Engine) StopCountdown2

func (engine *Engine) StopCountdown2()

StopCountdown2 stops the secondary countdown

func (*Engine) Update

func (engine *Engine) Update()

Update Hours, Minutes and Seconds

type EngineOptions

type EngineOptions struct {
	Flash           int    `long:"flash" description:"Flashing interval when countdown reached zero (ms), 0 disables" default:"500"`
	Timezone        string `short:"t" long:"local-time" description:"Local timezone" default:"Europe/Helsinki"`
	ListenAddr      string `long:"osc-listen" description:"Address to listen for incoming osc messages" default:"0.0.0.0:1245"`
	Timeout         int    `short:"d" long:"timeout" description:"Timeout for OSC message updates in milliseconds" default:"1000"`
	Connect         string `short:"o" long:"osc-dest" description:"Address to send OSC feedback to" default:"255.255.255.255:1245"`
	CountdownRed    uint8  `long:"cd-red" description:"Red component of secondary countdown color" default:"255"`
	CountdownGreen  uint8  `long:"cd-green" description:"Green component of secondary countdown color" default:"0"`
	CountdownBlue   uint8  `long:"cd-blue" description:"Blue component of secondary countdown color" default:"0"`
	DisableOSC      bool   `long:"disable-osc" description:"Disable OSC control and feedback"`
	DisableFeedback bool   `long:"disable-feedback" description:"Disable OSC feedback"`
}

EngineOptions contains all common options for clock.Engines

type Message

type Message struct {
	Type             string
	Data             string
	CountMessage     *CountMessage
	CountdownMessage *CountdownMessage
	DisplayMessage   *DisplayMessage
}

Message is a generic clock message for decoded osc data

type Server

type Server struct {
	Debug bool
	// contains filtered or unexported fields
}

Server is a clock osc server and listens for incoming osc messages

func MakeServer

func MakeServer(oscServer *osc.Server) *Server

MakeServer creates a clock.Server instance from osc.Server instance

func (*Server) Listen

func (server *Server) Listen() chan Message

Listen adds a new listener for the decoded incoming osc messages

type TimeMessage

type TimeMessage struct {
	Time string
}

TimeMessage is for /clock/settime

func (TimeMessage) MarshalOSC

func (message TimeMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a TimeMessage to osc.Message

func (*TimeMessage) UnmarshalOSC

func (message *TimeMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to TimeMessage

Jump to

Keyboard shortcuts

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