diff options
Diffstat (limited to 'src/rhctl/audio_switch.go')
-rw-r--r-- | src/rhctl/audio_switch.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rhctl/audio_switch.go b/src/rhctl/audio_switch.go index 764a231..2a88b0d 100644 --- a/src/rhctl/audio_switch.go +++ b/src/rhctl/audio_switch.go @@ -49,7 +49,7 @@ type SwitchResponse struct { } type SwitchCommand struct { - Cmd string + Cmd SwitchCmdString Response chan<- SwitchResponse } @@ -89,6 +89,7 @@ type AudioSwitch struct { timeout time.Duration current *SwitchCommand timer *time.Timer + unit SwitchUnitID Commands chan *SwitchCommand Updates chan SwitchUpdate } @@ -158,7 +159,7 @@ func (sw *AudioSwitch) Run() { return case cmd := <-sw.Commands: sw.current = cmd - sw.port.tx <- cmd.Cmd + sw.port.tx <- cmd.Cmd.Generate(sw.unit) sw.timer = time.NewTimer(sw.timeout) case data := <-sw.port.rx: sw.handleData(data) @@ -173,6 +174,7 @@ func SwitchInit(conf *Config) (sw *AudioSwitch, err error) { if conf.Audioswitch.Timeout.Duration > 0 { sw.timeout = conf.Audioswitch.Timeout.Duration } + sw.unit = conf.Audioswitch.Unit sw.Commands = make(chan *SwitchCommand, 8) sw.Updates = make(chan SwitchUpdate, 32) |