38 lines
861 B
Go
38 lines
861 B
Go
package main
|
|
|
|
import (
|
|
"git.timovolkmann.de/gyrogpsc/core"
|
|
"log"
|
|
"os"
|
|
"runtime"
|
|
)
|
|
|
|
const (
|
|
TCP_PORT = ":3010"
|
|
HTTP_PORT = ":3011"
|
|
SERIAL_PORT = "/dev/tty.usbmodem14201"
|
|
)
|
|
|
|
func main() {
|
|
log.Println("GOROOT:", runtime.GOROOT())
|
|
wd, _ := os.Getwd()
|
|
log.Println("WorkingDir:", wd)
|
|
|
|
log.Println("setup dispatcher")
|
|
dispatcher := core.NewDispatcher()
|
|
log.Println("initialize processing pipeline")
|
|
processor := core.NewPipeline(dispatcher, 50, 494)
|
|
processor.Run()
|
|
collectRoutines(processor)
|
|
log.Println("start http server")
|
|
core.FiberListen(dispatcher)
|
|
//core.HttpListenAndServe(dispatcher, HTTP_PORT)
|
|
}
|
|
|
|
func collectRoutines(proc core.Processor) {
|
|
// collect Sensor data from Serial UBX in Goroutine
|
|
go core.SerialCollector(proc, SERIAL_PORT)
|
|
// collect Sensor data from JSON over TCP in Goroutine
|
|
go core.TcpCollector(proc, TCP_PORT)
|
|
}
|