-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.go
More file actions
44 lines (32 loc) · 971 Bytes
/
server.go
File metadata and controls
44 lines (32 loc) · 971 Bytes
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
package main
import (
"github.com/franeklubi/ledgend"
"github.com/franeklubi/ledserv"
. "github.com/kowmat/ledgendarify/animserv"
"log"
)
const (
BROADCAST_DELAY float64 = 1000
JSON_ENDPOINT string = "/json"
LEDSERV_PORT uint16 = 10107 // the standard ledgend port
PORT uint16 = 10108
LEDS uint16 = 150
FPS int64 = 60
)
var (
instruction_channel chan Instruction = make(chan Instruction, 100)
)
func main() {
// initializing ledserv's server
send, err := ledserv.InitServer(LEDSERV_PORT)
if ( err != nil ) {
log.Fatal(err)
}
// broadcasting server's ip to a potential client
ledserv.Broadcast(BROADCAST_DELAY)
// creating the empty initial buffer
buffer := ledgend.GenSyncBuffer(LEDS)
go Sender(send, &buffer, FPS)
go InstructionWatcher(instruction_channel, &buffer)
SetupServer(instruction_channel, PORT, JSON_ENDPOINT)
}