summaryrefslogtreecommitdiff
path: root/src/rhctl/audio_switch.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/rhctl/audio_switch.go')
-rw-r--r--src/rhctl/audio_switch.go26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/rhctl/audio_switch.go b/src/rhctl/audio_switch.go
index bb94f61..07e0270 100644
--- a/src/rhctl/audio_switch.go
+++ b/src/rhctl/audio_switch.go
@@ -79,14 +79,20 @@ type SwitchUpdate struct {
Data string
}
+type SwitchState struct {
+ // TODO: fill this up with data
+}
+
type AudioSwitch struct {
- port *SerialPort
- timeout time.Duration
- current *SwitchCommand
- timer *time.Timer
- unit SwitchUnitID
- Commands chan *SwitchCommand
- Updates chan SwitchUpdate
+ port *SerialPort
+ timeout time.Duration
+ current *SwitchCommand
+ timer *time.Timer
+ unit SwitchUnitID
+ state SwitchState
+ StateChanges chan SwitchState
+ Commands chan *SwitchCommand
+ Updates chan SwitchUpdate
}
func (sw *AudioSwitch) handleData(data string) {
@@ -115,14 +121,19 @@ func (sw *AudioSwitch) handleData(data string) {
}
case "S0L":
sw.Updates <- SwitchUpdate{SwitchAudio, data}
+ // TODO: update state and send it out
case "S0P":
sw.Updates <- SwitchUpdate{SwitchGPI, data}
+ // TODO: update state and send it out
case "S0O":
sw.Updates <- SwitchUpdate{SwitchOC, data}
+ // TODO: update state and send it out
case "S0R":
sw.Updates <- SwitchUpdate{SwitchRelay, data}
+ // TODO: update state and send it out
case "S0S":
sw.Updates <- SwitchUpdate{SwitchSilence, data}
+ // TODO: update state and send it out
default:
rhl.Printf("Audioswitch: ignoring invalid data: %q", data)
}
@@ -172,6 +183,7 @@ func SwitchInit(conf *Config) (sw *AudioSwitch, err error) {
sw.timeout = conf.Audioswitch.Timeout.Duration
}
sw.unit = conf.Audioswitch.Unit
+ sw.StateChanges = make(chan SwitchState, 16)
sw.Commands = make(chan *SwitchCommand, 8)
sw.Updates = make(chan SwitchUpdate, 32)