Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrScreenNotFound is an error to represent when a screen is selected // that doesnt exist ErrScreenNotFound = errors.New("no screen found with that name") // ErrNoInitialRender is an error to represent when rendering a screen fails ErrNoInitialRender = errors.New("screen failed to perform initial render") )
Functions ¶
This section is empty.
Types ¶
type Display ¶
type Display interface { // SetScreen will set the current screen of the display // `name` must be on the of the strings returned from [GetScreens] SetScreen(name string) error // GetScreens will list all possible screen values GetScreens() []string // CurrentScreen will return the current [Screen] that is being rendered // and its formatted name CurrentScreen() (Screen, string, bool) // ClearScreen will stop the current [Screen] being rendered and reset it // to black ClearScreen() error // SetScreenConfig will update the configuration of a given [Screen] SetScreenConfig(name string, cfg map[string]string) error }
Display is the interface for setting the current Screen of the matrix display
func NewDisplay ¶
NewDisplay will construct a new Display. it will run the [Screen.Init] for each Screen, allowing them to register custom HTTP routes in the gin.RouterGroup
type HTMLAttribute ¶
HTMLAttribute represents an HTML element to be rendered on the dashboard
type HTMLLink ¶
type HTMLLink struct { // Text is the text the link should display Text string // Href is the HRef of the link Href string }
HTMLLink represents an `<a>` link in HTML
func (HTMLLink) GenerateHTML ¶
type HTMLText ¶
type HTMLText struct {
Content string
}
HTMLText renders plain HTML `<p>` to the screen
func (HTMLText) GenerateHTML ¶
type Screen ¶
type Screen interface { // Init allows the screen to initialize and register custom // HTTP routes in the given [gin.RouterGroup]. This method // should return a string that represents the formatted name // for this screen Init(r *gin.RouterGroup) (string, error) // Render will produce an [image.Image] to be displayed onto // the LED matrix. the [time.Duration] returned represents how // long the display should wait before calling again to update. // Values of [time.Duration] that are 0 or less will result in no // more update calls being made Render() (image.Image, time.Duration, error) // GetConfig returns the current configuration of the Screen GetConfig() map[string]string // UpdateConfig will update the configuration for the Screen UpdateConfig(map[string]string) error // GetHTMLPage returns the HTMLAtrributes that should // be rendered on the home page for control of the Screen GetHTMLPage() []HTMLAttribute }
Screen represents a service that produces an image.Image to be rendered to the LED matrix
Click to show internal directories.
Click to hide internal directories.