From: Bernhard Tittelbach Date: Sat, 5 Oct 2013 08:28:18 +0000 (+0000) Subject: more sensor and net messages X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=c53db9bb92878e7d356fdf606ce924c6212aba87;p=svn42.git more sensor and net messages --- 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")