From c53db9bb92878e7d356fdf606ce924c6212aba87 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Sat, 5 Oct 2013 08:28:18 +0000 Subject: [PATCH] more sensor and net messages --- go/r3events/basicevents.go | 30 ++++++++++++++++++++++++++++++ go/r3events/marshal_events.go | 16 ++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/go/r3events/basicevents.go b/go/r3events/basicevents.go index 73776cb..9877598 100644 --- a/go/r3events/basicevents.go +++ b/go/r3events/basicevents.go @@ -46,6 +46,36 @@ type IlluminationSensorUpdate struct { Ts int64 } +type DustSensorUpdate struct { + Sensorindex int + Value int64 + Ts int64 +} + +type RelativeHumiditySensorUpdate struct { + Sensorindex int + Percent int + Ts int64 +} + +type NetDHCPACK struct { + Mac String + IP String + Name String + Ts int64 +} + +type NetGWStatUpdate struct { + WifiRX int32 + WifiTX int32 + EthernetRX int32 + EthernetTX int32 + InternetRX int32 + InternetTX int32 + NumNeigh int32 + Ts int64 +} + type TimeTick struct { Ts int64 } diff --git a/go/r3events/marshal_events.go b/go/r3events/marshal_events.go index 830ff6b..041452c 100644 --- a/go/r3events/marshal_events.go +++ b/go/r3events/marshal_events.go @@ -63,6 +63,14 @@ func UnmarshalByteByte2Event(data [][]byte) (event interface{}, category string, event := IlluminationSensorUpdate{} err = json.Unmarshal(data[1], &event) category = "sensors" + case "DustSensorUpdate": + event := DustSensorUpdate{} + err = json.Unmarshal(data[1], &event) + category = "sensors" + case "RelativeHumiditySensorUpdate": + event := RelativeHumiditySensorUpdate{} + err = json.Unmarshal(data[1], &event) + category = "sensors" case "TimeTick": event := TimeTick{} err = json.Unmarshal(data[1], &event) @@ -79,6 +87,14 @@ func UnmarshalByteByte2Event(data [][]byte) (event interface{}, category string, event := SomethingReallyIsMoving{} err = json.Unmarshal(data[1], &event) category = "movement" + case "NetDHCPACK": + event := NetDHCPACK{} + err = json.Unmarshal(data[1], &event) + category = "network" + case "NetGWStatUpdate": + event := NetGWStatUpdate{} + err = json.Unmarshal(data[1], &event) + category = "network" default: event = nil err = errors.New("cannot unmarshal unknown type") -- 1.7.10.4