diff options
Diffstat (limited to 'src/rhctl/audio_switch.go')
-rw-r--r-- | src/rhctl/audio_switch.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/rhctl/audio_switch.go b/src/rhctl/audio_switch.go index a5c1a5c..f8c1cb1 100644 --- a/src/rhctl/audio_switch.go +++ b/src/rhctl/audio_switch.go @@ -34,8 +34,8 @@ const ( SwitchError ) -func (c SwitchResult) String() string { - switch c { +func (r SwitchResult) String() string { + switch r { case SwitchOK: return "OK" case SwitchError: @@ -44,6 +44,11 @@ func (c SwitchResult) String() string { return "unknown" } +func (r SwitchResult) MarshalText() (data []byte, err error) { + data = []byte(r.String()) + return +} + type SwitchResponse struct { Result SwitchResult Message string @@ -59,8 +64,8 @@ const ( SwitchSilence ) -func (c SwitchUpdateType) String() string { - switch c { +func (u SwitchUpdateType) String() string { + switch u { case SwitchAudio: return "audio" case SwitchGPI: @@ -75,6 +80,11 @@ func (c SwitchUpdateType) String() string { return "unknown" } +func (u SwitchUpdateType) MarshalText() (data []byte, err error) { + data = []byte(u.String()) + return +} + type SwitchUpdate struct { Type SwitchUpdateType Data string |