summaryrefslogtreecommitdiff
path: root/cmd/dolmetschctld
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dolmetschctld')
-rw-r--r--cmd/dolmetschctld/statemachine.go17
-rw-r--r--cmd/dolmetschctld/telnet.go5
2 files changed, 16 insertions, 6 deletions
diff --git a/cmd/dolmetschctld/statemachine.go b/cmd/dolmetschctld/statemachine.go
index b8946d6..b1e74c7 100644
--- a/cmd/dolmetschctld/statemachine.go
+++ b/cmd/dolmetschctld/statemachine.go
@@ -94,8 +94,14 @@ type getOriginal2InterpreterRatioReq struct {
resCh chan float32
}
+type getStateRes struct {
+ state State
+ ratio float32
+ language Language
+}
+
type getStateReq struct {
- resCh chan State
+ resCh chan getStateRes
}
type StateMachine struct {
@@ -250,7 +256,7 @@ func (sm *StateMachine) run() {
case req := <-sm.getOriginal2InterpreterRatioCh:
req.resCh <- sm.original2InterpreterRatio
case req := <-sm.getStateCh:
- req.resCh <- sm.state
+ req.resCh <- getStateRes{sm.state, sm.original2InterpreterRatio, sm.language}
case ev := <-sm.mixerEventCh:
sm.handleMixerEvent(ev)
sm.reconcile(false)
@@ -339,10 +345,11 @@ func (sm *StateMachine) GetOriginal2InterpreterRatio() float32 {
return <-resCh
}
-func (sm *StateMachine) GetState() State {
- resCh := make(chan State)
+func (sm *StateMachine) GetState() (State, float32, Language) {
+ resCh := make(chan getStateRes)
sm.getStateCh <- getStateReq{resCh}
- return <-resCh
+ res := <-resCh
+ return res.state, res.ratio, res.language
}
func (sm *StateMachine) Shutdown() {
diff --git a/cmd/dolmetschctld/telnet.go b/cmd/dolmetschctld/telnet.go
index a7ede85..8ea6a61 100644
--- a/cmd/dolmetschctld/telnet.go
+++ b/cmd/dolmetschctld/telnet.go
@@ -79,7 +79,10 @@ func telnetCmdState(c *telgo.Client, args []string, sm *StateMachine) bool {
c.Sayln("usage: state")
return false
}
- c.Sayln("current state: %s", sm.GetState())
+ state, ratio, lang := sm.GetState()
+ c.Sayln("current state: %s", state)
+ c.Sayln("current ratio: %s", ratio)
+ c.Sayln("current language: %s", lang)
return false
}