summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dolmetschctl/dolmetschctl.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd/dolmetschctl/dolmetschctl.go b/cmd/dolmetschctl/dolmetschctl.go
index fb8cdf3..bfe9a92 100644
--- a/cmd/dolmetschctl/dolmetschctl.go
+++ b/cmd/dolmetschctl/dolmetschctl.go
@@ -84,7 +84,21 @@ func run(ctrl *controller.Controller, ws *websocket.Conn) error {
if !ok {
return fmt.Errorf("controller channel was closed.")
}
- log.Printf("got controller event: %v", ev)
+ if ev.Type != controller.ButtonPressed {
+ continue
+ }
+ lang := ""
+ switch ev.Button {
+ case 0:
+ lang = "en"
+ case 1:
+ lang = "de"
+ default:
+ lang = "none"
+ }
+ if err := ws.WriteJSON(types.WebSocketRequest{Command: "language", Args: []string{lang}}); err != nil {
+ return err
+ }
case msg, ok := <-wsCh:
if !ok {
return fmt.Errorf("websocket channel was closed.")