Documentation ¶
Index ¶
- func DeviceID(p senml.Pack) string
- func Diff(a, b senml.Pack) []senml.Record
- func IsEqual(a, b senml.Record) bool
- func Round(val float64) float64
- func ToPack(object Lwm2mObject) senml.Pack
- func ToPacks(objects []Lwm2mObject) []senml.Pack
- type AirQuality
- type Battery
- type Conductivity
- type Device
- type DeviceInfo
- type DigitalInput
- type Distance
- type Energy
- type FillingLevel
- type Humidity
- type Illuminance
- type Lwm2mObject
- type PeopleCounter
- type Power
- type Presence
- type Pressure
- type Stopwatch
- type Temperature
- type Timer
- type WaterMeter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToPack ¶
func ToPack(object Lwm2mObject) senml.Pack
func ToPacks ¶
func ToPacks(objects []Lwm2mObject) []senml.Pack
Types ¶
type AirQuality ¶
type AirQuality struct { DeviceInfo CO2 *float64 `lwm2m:"17,ppm"` }
func NewAirQuality ¶
func NewAirQuality(deviceID string, co2 float64, ts time.Time) AirQuality
func (AirQuality) ID ¶
func (aq AirQuality) ID() string
func (AirQuality) MarshalJSON ¶
func (aq AirQuality) MarshalJSON() ([]byte, error)
func (AirQuality) ObjectID ¶
func (aq AirQuality) ObjectID() string
func (AirQuality) ObjectURN ¶
func (aq AirQuality) ObjectURN() string
func (AirQuality) Timestamp ¶
func (aq AirQuality) Timestamp() time.Time
type Battery ¶
type Battery struct { DeviceInfo BatteryLevel int `lwm2m:"1,%"` BatteryCapacity *float64 `lwm2m:"2,Ah"` BatteryVoltage *float64 `lwm2m:"3,V"` }
func (Battery) MarshalJSON ¶
type Conductivity ¶
type Conductivity struct { DeviceInfo SensorValue float64 `lwm2m:"5700,S/m"` SensorUnits *string `lwm2m:"5701"` }
func NewConductivity ¶
func NewConductivity(deviceID string, sensorValue float64, ts time.Time) Conductivity
func (Conductivity) ID ¶
func (c Conductivity) ID() string
func (Conductivity) MarshalJSON ¶
func (c Conductivity) MarshalJSON() ([]byte, error)
func (Conductivity) ObjectID ¶
func (c Conductivity) ObjectID() string
func (Conductivity) ObjectURN ¶
func (c Conductivity) ObjectURN() string
func (Conductivity) Timestamp ¶
func (c Conductivity) Timestamp() time.Time
type Device ¶
type Device struct { DeviceInfo BatteryLevel *int `json:"batteryLevel" lwm2m:"9,%"` //Contains the current battery level as a percentage (with a range from 0 to 100). PowerSourceVoltage *int `json:"powerSourceVoltage" lwm2m:"7,mV"` //Present voltage for each Available Power Sources Resource Instance. The unit used for this resource is in mV. DeviceType *string `json:"deviceType" lwm2m:"17"` //Type of the device (manufacturer specified string: e.g. smart meters / dev Class / ...) }
func (Device) MarshalJSON ¶
type DeviceInfo ¶
type DigitalInput ¶
type DigitalInput struct { DeviceInfo DigitalInputState bool `lwm2m:"5500"` DigitalInputCounter *int `lwm2m:"5501"` }
func NewDigitalInput ¶
func NewDigitalInput(deviceID string, digitalInputState bool, ts time.Time) DigitalInput
func (DigitalInput) ID ¶
func (d DigitalInput) ID() string
func (DigitalInput) MarshalJSON ¶
func (d DigitalInput) MarshalJSON() ([]byte, error)
func (DigitalInput) ObjectID ¶
func (d DigitalInput) ObjectID() string
func (DigitalInput) ObjectURN ¶
func (d DigitalInput) ObjectURN() string
func (DigitalInput) Timestamp ¶
func (d DigitalInput) Timestamp() time.Time
type Distance ¶
type Distance struct { DeviceInfo SensorValue float64 `lwm2m:"5700,m"` SensorUnits *string `lwm2m:"5701"` MinMeasuredValue *float64 `lwm2m:"5601"` MaxMeasuredValue *float64 `lwm2m:"5602"` MinRangeValue *float64 `lwm2m:"5603"` MaxRangeValue *float64 `lwm2m:"5604"` ApplicationType *string `lwm2m:"5750"` }
func (Distance) MarshalJSON ¶
type Energy ¶
type Energy struct { DeviceInfo SensorValue float64 `lwm2m:"5700,Wh"` }
func (Energy) MarshalJSON ¶
type FillingLevel ¶
type FillingLevel struct { DeviceInfo ContainerHeight int64 `lwm2m:"1,cm"` ActualFillingPercentage *float64 `lwm2m:"2,%"` ActualFillingLevel *int64 `lwm2m:"3,cm"` HighThreshold *float64 `lwm2m:"4"` ContainerFull *bool `lwm2m:"5"` LowThreshold *float64 `lwm2m:"6"` ContainerEmpty *bool `lwm2m:"7"` }
func NewFillingLevel ¶
func NewFillingLevel(deviceID string, sensorValue float64, ts time.Time) FillingLevel
func (FillingLevel) ID ¶
func (f FillingLevel) ID() string
func (FillingLevel) MarshalJSON ¶
func (f FillingLevel) MarshalJSON() ([]byte, error)
func (FillingLevel) ObjectID ¶
func (f FillingLevel) ObjectID() string
func (FillingLevel) ObjectURN ¶
func (f FillingLevel) ObjectURN() string
func (FillingLevel) Timestamp ¶
func (f FillingLevel) Timestamp() time.Time
type Humidity ¶
type Humidity struct { DeviceInfo SensorValue float64 `lwm2m:"5700,%RH"` }
func (Humidity) MarshalJSON ¶
type Illuminance ¶
type Illuminance struct { DeviceInfo SensorValue float64 `lwm2m:"5700,lux"` }
func NewIlluminance ¶
func NewIlluminance(deviceID string, sensorValue float64, ts time.Time) Illuminance
func (Illuminance) ID ¶
func (i Illuminance) ID() string
func (Illuminance) MarshalJSON ¶
func (i Illuminance) MarshalJSON() ([]byte, error)
func (Illuminance) ObjectID ¶
func (i Illuminance) ObjectID() string
func (Illuminance) ObjectURN ¶
func (i Illuminance) ObjectURN() string
func (Illuminance) Timestamp ¶
func (i Illuminance) Timestamp() time.Time
type Lwm2mObject ¶
type PeopleCounter ¶
type PeopleCounter struct { DeviceInfo ActualNumberOfPersons int `lwm2m:"1"` DailyNumberOfPersons int `lwm2m:"2"` }
func NewPeopleCounter ¶
func NewPeopleCounter(deviceID string, actualNumberOfPersons int, ts time.Time) PeopleCounter
func (PeopleCounter) ID ¶
func (pc PeopleCounter) ID() string
func (PeopleCounter) MarshalJSON ¶
func (pc PeopleCounter) MarshalJSON() ([]byte, error)
func (PeopleCounter) ObjectID ¶
func (pc PeopleCounter) ObjectID() string
func (PeopleCounter) ObjectURN ¶
func (pc PeopleCounter) ObjectURN() string
func (PeopleCounter) Timestamp ¶
func (pc PeopleCounter) Timestamp() time.Time
type Power ¶
type Power struct { DeviceInfo SensorValue float64 `lwm2m:"5700,W"` }
func (Power) MarshalJSON ¶
type Presence ¶
type Presence struct { DeviceInfo DigitalInputState bool `lwm2m:"5500"` DigitalInputCounter *int `lwm2m:"5501"` }
func (Presence) MarshalJSON ¶
type Pressure ¶
type Pressure struct { DeviceInfo SensorValue float64 `lwm2m:"5700,Pa"` }
func (Pressure) MarshalJSON ¶
type Stopwatch ¶
type Stopwatch struct { DeviceInfo CumulativeTime float64 `json:"cumulativeTime" lwm2m:"5544,s"` //The total time in seconds that the timer input is true. OnOff *bool `json:"onOff,omitempty" lwm2m:"5850"` //On/off control. Boolean value where True is On and False is Off DigitalInputCounter int32 `json:"digitalInputCounter" lwm2m:"5501"` //The cumulative value of active state detected. }
func (Stopwatch) MarshalJSON ¶
type Temperature ¶
type Temperature struct { DeviceInfo SensorValue float64 `lwm2m:"5700,Cel"` MinMeasuredValue *float64 `lwm2m:"5601,Cel"` MaxMeasuredValue *float64 `lwm2m:"5602,Cel"` MinRangeValue *float64 `lwm2m:"5603,Cel"` MaxRangeValue *float64 `lwm2m:"5604,Cel"` SensorUnits *string `lwm2m:"5701"` ApplicationType *string `lwm2m:"5750"` }
func NewTemperature ¶
func NewTemperature(deviceID string, sensorValue float64, ts time.Time) Temperature
func (Temperature) ID ¶
func (t Temperature) ID() string
func (Temperature) MarshalJSON ¶
func (t Temperature) MarshalJSON() ([]byte, error)
func (Temperature) ObjectID ¶
func (t Temperature) ObjectID() string
func (Temperature) ObjectURN ¶
func (t Temperature) ObjectURN() string
func (Temperature) Timestamp ¶
func (t Temperature) Timestamp() time.Time
type Timer ¶
type Timer struct { DeviceInfo DelayDuration float64 `json:"delayDuration" lwm2m:"5521,s"` OnOff bool `json:"onOff" lwm2m:"5850"` RemainingTime *float64 `json:"remainingTime,omitempty" lwm2m:"5538,s"` CumulativeTime *float64 `json:"cumulativeTime,omitempty" lwm2m:"5544,s"` }
func (Timer) MarshalJSON ¶
type WaterMeter ¶
type WaterMeter struct { DeviceInfo CumulatedWaterVolume float64 `lwm2m:"1,m3"` TypeOfMeter *string `lwm2m:"3"` CumulatedPulseValue *int `lwm2m:"4"` PulseRatio *int `lwm2m:"5"` MinimumFlowRate *float64 `lwm2m:"7,m3/s"` MaximumFlowRate *float64 `lwm2m:"8,m3/s"` LeakSuspected *bool `lwm2m:"9"` LeakDetected *bool `lwm2m:"10"` BackFlowDetected *bool `lwm2m:"11"` BlockedMeter *bool `lwm2m:"12"` FraudDetected *bool `lwm2m:"13"` }
func NewWaterMeter ¶
func NewWaterMeter(deviceID string, cumulatedWaterVolume float64, ts time.Time) WaterMeter
func (WaterMeter) ID ¶
func (w WaterMeter) ID() string
func (WaterMeter) MarshalJSON ¶
func (w WaterMeter) MarshalJSON() ([]byte, error)
func (WaterMeter) ObjectID ¶
func (w WaterMeter) ObjectID() string
func (WaterMeter) ObjectURN ¶
func (w WaterMeter) ObjectURN() string
func (WaterMeter) Timestamp ¶
func (w WaterMeter) Timestamp() time.Time
Click to show internal directories.
Click to hide internal directories.