summaryrefslogtreecommitdiff
path: root/src/rhctl/audio_switch.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-03-30 05:10:53 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2016-03-30 05:10:53 (GMT)
commitb2884f87b7a62dafabab754e1e64ea338e02d145 (patch)
treedcedbdbf7b4fb51b61ed3a74bff7a132879d2af5 /src/rhctl/audio_switch.go
parent1d0d0aea92c936bca8de0653b4c92a9bfd73f05c (diff)
added generator for switch commands
Diffstat (limited to 'src/rhctl/audio_switch.go')
-rw-r--r--src/rhctl/audio_switch.go6
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)