-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen.go
31 lines (28 loc) · 1.09 KB
/
screen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package display
import (
"image"
"time"
"github.com/gin-gonic/gin"
)
// Screen represents a service that produces an [image.Image] to
// be rendered to the LED matrix
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
}