senml

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

SenML Message Transformer

SenML Transformer provides Message Transformer for SenML messages. It supports JSON and CBOR content types - To transform Mainflux Message successfully, the payload must be either JSON or CBOR encoded SenML message.

Documentation

Index

Constants

View Source
const (
	// JSON represents SenML in JSON format content type.
	JSON = "application/senml+json"
	// CBOR represents SenML in CBOR format content type.
	CBOR = "application/senml+cbor"
)

Variables

This section is empty.

Functions

func TransformPayload added in v0.28.0

func TransformPayload(contentType string, payload []byte, created int64) ([]*protomfx.Record, error)

TransformPayload converts a SenML pack into one record per normalized SenML record. Records without a time value are assigned the created timestamp.

Types

type Message

type Message struct {
	Subtopic    string   `json:"subtopic,omitempty" db:"subtopic" bson:"subtopic,omitempty"`
	ThingID     string   `json:"thing_id,omitempty" db:"thing_id" bson:"thing_id"`
	Protocol    string   `json:"protocol,omitempty" db:"protocol" bson:"protocol"`
	Name        string   `json:"name,omitempty" db:"name" bson:"name,omitempty"`
	Unit        string   `json:"unit,omitempty" db:"unit" bson:"unit,omitempty"`
	Time        int64    `json:"time,omitempty" db:"time" bson:"time,omitempty"`
	UpdateTime  float64  `json:"update_time,omitempty" db:"update_time" bson:"update_time,omitempty"`
	Value       *float64 `json:"value,omitempty" db:"value" bson:"value,omitempty"`
	StringValue *string  `json:"string_value,omitempty" db:"string_value" bson:"string_value,omitempty"`
	DataValue   *string  `json:"data_value,omitempty" db:"data_value" bson:"data_value,omitempty"`
	BoolValue   *bool    `json:"bool_value,omitempty" db:"bool_value" bson:"bool_value,omitempty"`
	Sum         *float64 `json:"sum,omitempty" db:"sum" bson:"sum,omitempty"`
}

Message represents a resolved (normalized) SenML record.

Jump to

Keyboard shortcuts

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