From 5c6591d57124ced94be5637aa370e69e10870c10 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Sat, 5 Oct 2013 01:18:26 +0000 Subject: [PATCH] looser parsing --- go/r3-eventbroker_zmq/sockettoevent.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/go/r3-eventbroker_zmq/sockettoevent.go b/go/r3-eventbroker_zmq/sockettoevent.go index 3836580..a7a21bf 100644 --- a/go/r3-eventbroker_zmq/sockettoevent.go +++ b/go/r3-eventbroker_zmq/sockettoevent.go @@ -32,12 +32,12 @@ func parseSocketInputLine_State(lines [][]byte, ps *pubsub.PubSub, ts int64) { ps.Pub(r3events.DoorLockUpdate{true, ts}, "door") case "opened": ps.Pub(r3events.DoorLockUpdate{false, ts}, "door") - case "manual": //movement + case "manual", "manual_movement": //movement case "error": ps.Pub(r3events.DoorProblemEvent{100, ts}, "door") case "reset": ps.Pub(r3events.DoorLockUpdate{true, ts}, "door") - case "timeout": //after open | after close + case "timeout", "timeout_after_open", "timeout_after_close": ps.Pub(r3events.DoorProblemEvent{10, ts}, "door") case "opening": case "closing": @@ -57,7 +57,8 @@ func ParseSocketInputLine(lines [][]byte, ps *pubsub.PubSub, keylookup_socket *z parseSocketInputLine_State(lines[1:], ps, ts) case "Status:": if len(lines) < 3 { return } - ps.Pub(r3events.DoorLockUpdate{string(lines[1]) == "closed,", ts}, "door") + if len(lines[1]) < 4 { return } + ps.Pub(r3events.DoorLockUpdate{string(lines[1])[0:4] != "open", ts}, "door") ps.Pub(r3events.DoorAjarUpdate{string(lines[len(lines)-1]) == "shut", ts}, "door") case "Info(card):": if len(lines) < 3 { return } -- 1.7.10.4