lwm2m

package
v0.0.0-...-e50fb58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeviceID

func DeviceID(p senml.Pack) string

func Diff

func Diff(a, b senml.Pack) []senml.Record

func IsEqual

func IsEqual(a, b senml.Record) bool

func Round

func Round(val float64) float64

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 NewBattery

func NewBattery(deviceID string, batteryLevel int, ts time.Time) Battery

func (Battery) ID

func (b Battery) ID() string

func (Battery) MarshalJSON

func (b Battery) MarshalJSON() ([]byte, error)

func (Battery) ObjectID

func (b Battery) ObjectID() string

func (Battery) ObjectURN

func (b Battery) ObjectURN() string

func (Battery) Timestamp

func (b Battery) Timestamp() time.Time

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 NewDevice

func NewDevice(deviceID string, ts time.Time) Device

func (Device) ID

func (d Device) ID() string

func (Device) MarshalJSON

func (d Device) MarshalJSON() ([]byte, error)

func (Device) ObjectID

func (d Device) ObjectID() string

func (Device) ObjectURN

func (d Device) ObjectURN() string

func (Device) Timestamp

func (d Device) Timestamp() time.Time

type DeviceInfo

type DeviceInfo struct {
	ID_        string    `lwm2m:"-"`
	Timestamp_ time.Time `lwm2m:"-"`
}

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 NewDistance

func NewDistance(deviceID string, sensorValue float64, ts time.Time) Distance

func (Distance) ID

func (d Distance) ID() string

func (Distance) MarshalJSON

func (d Distance) MarshalJSON() ([]byte, error)

func (Distance) ObjectID

func (d Distance) ObjectID() string

func (Distance) ObjectURN

func (d Distance) ObjectURN() string

func (Distance) Timestamp

func (d Distance) Timestamp() time.Time

type Energy

type Energy struct {
	DeviceInfo
	SensorValue float64 `lwm2m:"5700,Wh"`
}

func NewEnergy

func NewEnergy(deviceID string, sensorValue float64, ts time.Time) Energy

func (Energy) ID

func (e Energy) ID() string

func (Energy) MarshalJSON

func (e Energy) MarshalJSON() ([]byte, error)

func (Energy) ObjectID

func (e Energy) ObjectID() string

func (Energy) ObjectURN

func (e Energy) ObjectURN() string

func (Energy) Timestamp

func (e Energy) Timestamp() time.Time

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 NewHumidity

func NewHumidity(deviceID string, sensorValue float64, ts time.Time) Humidity

func (Humidity) ID

func (h Humidity) ID() string

func (Humidity) MarshalJSON

func (h Humidity) MarshalJSON() ([]byte, error)

func (Humidity) ObjectID

func (h Humidity) ObjectID() string

func (Humidity) ObjectURN

func (h Humidity) ObjectURN() string

func (Humidity) Timestamp

func (h Humidity) Timestamp() time.Time

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 Lwm2mObject interface {
	ID() string
	ObjectID() string
	ObjectURN() string
	Timestamp() time.Time
}

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 NewPower

func NewPower(deviceID string, sensorValue float64, ts time.Time) Power

func (Power) ID

func (p Power) ID() string

func (Power) MarshalJSON

func (p Power) MarshalJSON() ([]byte, error)

func (Power) ObjectID

func (p Power) ObjectID() string

func (Power) ObjectURN

func (p Power) ObjectURN() string

func (Power) Timestamp

func (p Power) Timestamp() time.Time

type Presence

type Presence struct {
	DeviceInfo
	DigitalInputState   bool `lwm2m:"5500"`
	DigitalInputCounter *int `lwm2m:"5501"`
}

func NewPresence

func NewPresence(deviceID string, digitalInputState bool, ts time.Time) Presence

func (Presence) ID

func (d Presence) ID() string

func (Presence) MarshalJSON

func (d Presence) MarshalJSON() ([]byte, error)

func (Presence) ObjectID

func (d Presence) ObjectID() string

func (Presence) ObjectURN

func (d Presence) ObjectURN() string

func (Presence) Timestamp

func (d Presence) Timestamp() time.Time

type Pressure

type Pressure struct {
	DeviceInfo
	SensorValue float64 `lwm2m:"5700,Pa"`
}

func NewPressure

func NewPressure(deviceID string, sensorValue float64, ts time.Time) Pressure

func (Pressure) ID

func (p Pressure) ID() string

func (Pressure) MarshalJSON

func (p Pressure) MarshalJSON() ([]byte, error)

func (Pressure) ObjectID

func (p Pressure) ObjectID() string

func (Pressure) ObjectURN

func (p Pressure) ObjectURN() string

func (Pressure) Timestamp

func (p Pressure) Timestamp() time.Time

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 NewStopwatch

func NewStopwatch(deviceID string, sensorValue float64, ts time.Time) Stopwatch

func (Stopwatch) ID

func (d Stopwatch) ID() string

func (Stopwatch) MarshalJSON

func (d Stopwatch) MarshalJSON() ([]byte, error)

func (Stopwatch) ObjectID

func (d Stopwatch) ObjectID() string

func (Stopwatch) ObjectURN

func (d Stopwatch) ObjectURN() string

func (Stopwatch) Timestamp

func (d Stopwatch) Timestamp() time.Time

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 NewTimer

func NewTimer(deviceID string, sensorValue float64, ts time.Time) Timer

func (Timer) ID

func (d Timer) ID() string

func (Timer) MarshalJSON

func (d Timer) MarshalJSON() ([]byte, error)

func (Timer) ObjectID

func (d Timer) ObjectID() string

func (Timer) ObjectURN

func (d Timer) ObjectURN() string

func (Timer) Timestamp

func (d Timer) Timestamp() time.Time

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL