1 // (c) Bernhard Tittelbach, 2013
6 pubsub "github.com/tuxychandru/pubsub"
12 r3events "svn.spreadspace.org/realraum/go.svn/r3-eventbroker_zmq/r3events"
15 func ParseZMQr3Event(lines [][]byte, ps *pubsub.PubSub) { //, brn *brain.Brain) {
16 //Debug_.Printf("ParseZMQr3Event: len: %d lines: %s", len(lines), lines)
20 switch string(lines[0]) {
21 case "PresenceUpdate":
22 evnt := new(r3events.PresenceUpdate)
23 err := json.Unmarshal(lines[1],evnt)
24 if err == nil {ps.Pub(*evnt, "presence")}
25 case "IlluminationSensorUpdate" :
26 evnt := new(r3events.IlluminationSensorUpdate)
27 err := json.Unmarshal(lines[1],evnt)
28 if err == nil {ps.Pub(*evnt, "sensors")}
29 case "TempSensorUpdate" :
30 evnt := new(r3events.TempSensorUpdate)
31 err := json.Unmarshal(lines[1],evnt)
32 if err == nil {ps.Pub(*evnt, "sensors")}
33 case "MovementSensorUpdate" :
34 evnt := new(r3events.MovementSensorUpdate)
35 err := json.Unmarshal(lines[1],evnt)
36 if err == nil {ps.Pub(*evnt, "movement")}
37 case "BoreDoomButtonPressEvent" :
38 evnt := new(r3events.BoreDoomButtonPressEvent)
39 err := json.Unmarshal(lines[1],evnt)
40 if err == nil {ps.Pub(*evnt, "buttons")}
41 case "DoorLockUpdate" :
42 evnt := new(r3events.DoorLockUpdate)
43 err := json.Unmarshal(lines[1],evnt)
44 if err == nil {ps.Pub(*evnt, "door")}
45 case "DoorAjarUpdate" :
46 evnt := new(r3events.DoorAjarUpdate)
47 err := json.Unmarshal(lines[1],evnt)
48 if err == nil {ps.Pub(*evnt, "door")}
49 case "DoorCommandEvent" :
50 evnt := new(r3events.DoorCommandEvent)
51 err := json.Unmarshal(lines[1],evnt)
52 if err == nil {ps.Pub(*evnt, "door")}