diff options
Diffstat (limited to 'src/rhctl/audio_switch.go')
-rw-r--r-- | src/rhctl/audio_switch.go | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/rhctl/audio_switch.go b/src/rhctl/audio_switch.go index 4f1ef31..764a231 100644 --- a/src/rhctl/audio_switch.go +++ b/src/rhctl/audio_switch.go @@ -33,6 +33,16 @@ const ( SwitchError ) +func (c SwitchResult) String() string { + switch c { + case SwitchOK: + return "OK" + case SwitchError: + return "error" + } + return "unknown" +} + type SwitchResponse struct { Result SwitchResult Message string @@ -46,13 +56,29 @@ type SwitchCommand struct { type SwitchUpdateType uint8 const ( - SwitchStatus SwitchUpdateType = iota + SwitchAudio SwitchUpdateType = iota SwitchGPI SwitchOC SwitchRelay SwitchSilence ) +func (c SwitchUpdateType) String() string { + switch c { + case SwitchAudio: + return "audio" + case SwitchGPI: + return "gpi" + case SwitchOC: + return "oc" + case SwitchRelay: + return "relay" + case SwitchSilence: + return "silence" + } + return "unknown" +} + type SwitchUpdate struct { Type SwitchUpdateType Data string @@ -92,7 +118,7 @@ func (sw *AudioSwitch) handleData(data string) { rhl.Printf("Audioswitch: ignoring unexpected response: %q", data) } case "S0L": - sw.Updates <- SwitchUpdate{SwitchStatus, data} + sw.Updates <- SwitchUpdate{SwitchAudio, data} case "S0P": sw.Updates <- SwitchUpdate{SwitchGPI, data} case "S0O": |