-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.go
51 lines (37 loc) · 1.04 KB
/
App.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
// A DEMO of displaying images on the Spheramid LED matrix, and tap gestures
import (
"fmt"
"github.com/ninjasphere/go-ninja/api"
"github.com/ninjasphere/go-ninja/support"
"github.com/ninjasphere/sphere-go-led-controller/remote"
)
var info = ninja.LoadModuleInfo("./package.json")
// init is a Go standard that runs first
func init() {
}
type RuntimeConfig struct {
}
type App struct {
support.AppSupport
led *remote.Matrix
textData string
}
// Start the app (called by the system)
func (a *App) Start(cfg *RuntimeConfig) error {
// save some text to display (to show we can access app data from LED pane)
a.textData = "OK!"
fmt.Println("Making new pane...")
// The pane must implement the remote.pane interface
pane := NewAuroraPane(a.Conn)
// Export our pane over TCP
a.led = remote.NewTCPMatrix(pane, fmt.Sprintf("%s:%d", "localhost", 3115))
// TODO: try a second NewMatrix - see if we can swipe between them
return nil
}
// Stop the app.
func (a *App) Stop() error {
a.led.Close()
a.led = nil
return nil
}