summaryrefslogtreecommitdiff
path: root/src/rhctl/playout_server.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/rhctl/playout_server.go')
-rw-r--r--src/rhctl/playout_server.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rhctl/playout_server.go b/src/rhctl/playout_server.go
index b6054c6..b0cf433 100644
--- a/src/rhctl/playout_server.go
+++ b/src/rhctl/playout_server.go
@@ -25,6 +25,8 @@ import (
"fmt"
"strings"
"time"
+
+ "code.helsinki.at/goserial"
)
type ServerHealth bool
@@ -61,7 +63,7 @@ type ServerState struct {
type PlayoutServer struct {
name string
- device *SerialPort
+ device *goserial.Port
hbtimeout time.Duration
hbtimer *time.Timer
hbthreshold uint
@@ -90,7 +92,7 @@ func (srv *PlayoutServer) handleHeartbeat() {
srv.StateChanges <- srv.state
rhl.Printf("Server(%s): is back from the dead!", srv.name)
if srv.state.Channel == "" {
- srv.device.tx <- ServerChannelReq
+ srv.device.TX <- ServerChannelReq
}
}
}
@@ -145,7 +147,7 @@ func (srv *PlayoutServer) Run() {
select {
case <-stop:
return
- case data := <-srv.device.rx:
+ case data := <-srv.device.RX:
srv.handleMessage(data)
case <-srv.hbtimer.C:
srv.handleHBTimeout()
@@ -153,10 +155,10 @@ func (srv *PlayoutServer) Run() {
if srv.state.Health == ServerDead {
srv.StateChanges <- srv.state
} else {
- srv.device.tx <- ServerChannelReq
+ srv.device.TX <- ServerChannelReq
}
case update := <-srv.SwitchUpdates:
- srv.device.tx <- update.Data
+ srv.device.TX <- update.Data
}
}
}
@@ -181,7 +183,7 @@ func ServerInit(name string, conf *Config) (srv *PlayoutServer, err error) {
srv.UpdateRequest = make(chan bool, 8)
srv.SwitchUpdates = make(chan SwitchUpdate, 32)
- if srv.device, err = SerialOpen(conf.Servers[name].Device, conf.Servers[name].Baudrate, "\n"); err != nil {
+ if srv.device, err = goserial.Open(conf.Servers[name].Device, conf.Servers[name].Baudrate, "\n"); err != nil {
err = fmt.Errorf("Server(%s): error opening serial port: %s", srv.name, err)
return
}