summaryrefslogtreecommitdiff
path: root/src/rhctl/telnet.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-04-02 23:13:25 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-04-02 23:13:25 (GMT)
commit2f34a5e62285a3c5334c270c6111e43fc12e8dbf (patch)
tree8931b4d9fa0262f3ccc61d6b59d28a7ebd2a34dd /src/rhctl/telnet.go
parentdf49dff4c6f96d1c2e032cc93e7b6bdb57f11833 (diff)
refactoring of server, switch states
Diffstat (limited to 'src/rhctl/telnet.go')
-rw-r--r--src/rhctl/telnet.go43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/rhctl/telnet.go b/src/rhctl/telnet.go
index e693e70..de98475 100644
--- a/src/rhctl/telnet.go
+++ b/src/rhctl/telnet.go
@@ -29,8 +29,8 @@ type TelnetInterface struct {
server *telgo.Server
}
-func telnetCmdStatus(c *telgo.Client, args []string, ctrl *SwitchControl) bool {
- ctrl.Commands <- &Command{Type: CmdStatus}
+func telnetCmdState(c *telgo.Client, args []string, ctrl *SwitchControl) bool {
+ ctrl.Commands <- &Command{Type: CmdState}
// TODO: implement this
return false
}
@@ -45,13 +45,13 @@ func telnetUpdateListener(c *telgo.Client, ctrl *SwitchControl) {
switch data.(type) {
case SwitchUpdate:
update := data.(SwitchUpdate)
- if !c.Sayln("audio-switch status(%v): %s", update.Type, update.Data) {
+ if !c.Sayln("audio-switch update(%v): %s", update.Type, update.Data) {
ctrl.Updates.Unsub(ch)
return
}
- case ServerStatus:
- status := data.(ServerStatus)
- if !c.Sayln("playout-server(%s): health=%s, channel=%s", status.Name, status.Health, status.Channel) {
+ case ServerState:
+ state := data.(ServerState)
+ if !c.Sayln("playout-server(%s): health=%s, channel=%s", state.Name, state.Health, state.Channel) {
ctrl.Updates.Unsub(ch)
return
}
@@ -79,10 +79,12 @@ func telnetCmdListen(c *telgo.Client, args []string, ctrl *SwitchControl) bool {
}
switch args[1] {
- case "status":
- ctrl.Updates.AddSub(ch, "status")
+ case "state":
+ ctrl.Updates.AddSub(ch, "state")
case "server":
- ctrl.Updates.AddSub(ch, "server:status")
+ ctrl.Updates.AddSub(ch, "server:state")
+ case "switch":
+ ctrl.Updates.AddSub(ch, "switch:state")
case "audio":
fallthrough
case "gpi":
@@ -140,20 +142,21 @@ func telnetHelp(c *telgo.Client, args []string) bool {
c.Sayln("usage: help [ <cmd> ]")
c.Sayln(" prints command overview or detailed info to <cmd>.")
return false
- case "status":
- c.Sayln("usage: status")
- c.Sayln(" show the status of the switch and servers")
+ case "state":
+ c.Sayln("usage: state")
+ c.Sayln(" show the state of the switch and servers")
return false
case "listen":
c.Sayln("usage: listen <type>")
c.Sayln(" subscribe to messages of type <type>. The following types are allowed:")
- c.Sayln(" - status overall status changes")
- c.Sayln(" - server status/health of the playout server")
+ c.Sayln(" - state overall state changes")
+ c.Sayln(" - server state/health of the playout server")
+ c.Sayln(" - switch state/health of switch")
c.Sayln(" - audio audio input/output mapping changes")
- c.Sayln(" - gpi general purpose input status messages")
- c.Sayln(" - oc open-collector status messages")
- c.Sayln(" - relay relay status messages")
- c.Sayln(" - silence status of the silence detector")
+ c.Sayln(" - gpi general purpose input state messages")
+ c.Sayln(" - oc open-collector state messages")
+ c.Sayln(" - relay relay state messages")
+ c.Sayln(" - silence state of the silence detector")
return false
case "server":
c.Sayln("usage: server <name>")
@@ -171,7 +174,7 @@ func telnetHelp(c *telgo.Client, args []string) bool {
c.Sayln(" available commands:")
c.Sayln(" quit close connection (or use Ctrl-D)")
c.Sayln(" help [ <cmd> ] print this, or help for specific command")
- c.Sayln(" status show status of switch and all servers")
+ c.Sayln(" state show state of switch and all servers")
c.Sayln(" listen <type> add listener for messages of type <type>")
c.Sayln(" server <name> switch to server <name>")
c.Sayln(" switch <cmd> [ [ <arg1> ] ... ] send command to switch")
@@ -194,7 +197,7 @@ func TelnetInit(conf *Config, ctrl *SwitchControl) (telnet *TelnetInterface) {
telnet = &TelnetInterface{}
cmdlist := make(telgo.CmdList)
- cmdlist["status"] = func(c *telgo.Client, args []string) bool { return telnetCmdStatus(c, args, ctrl) }
+ cmdlist["state"] = func(c *telgo.Client, args []string) bool { return telnetCmdState(c, args, ctrl) }
cmdlist["listen"] = func(c *telgo.Client, args []string) bool { return telnetCmdListen(c, args, ctrl) }
cmdlist["server"] = func(c *telgo.Client, args []string) bool { return telnetCmdServer(c, args, ctrl) }
cmdlist["switch"] = func(c *telgo.Client, args []string) bool { return telnetCmdSwitch(c, args, ctrl) }