diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-09-24 22:11:26 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-09-24 22:11:26 (GMT) |
commit | a547fe88a42d1e0aebfc01d5d90dd21fc101fc2e (patch) | |
tree | 91881f9753215f7f19740b16798cc5c73421c386 /src/rhctl/audio_switch.go | |
parent | c2ac2add756be8be1f74827bdc943636187e8bbf (diff) |
some more marshaller
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 |