sensor

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SensorLabelFn = func(s Sensor) string {
	sensorCounter += 1
	cleanLabel := strings.ReplaceAll(strings.ToLower(fmt.Sprintf("%T_", s)), ".", "_")
	return strings.TrimPrefix(cleanLabel, "*") + strconv.Itoa(sensorCounter)
}

SensorLabelFn returns a unique label for a sensor.

Functions

This section is empty.

Types

type Sensor

type Sensor interface {
	// Stringer is for human-readable name
	fmt.Stringer
	// Label returns unique label value for the sensor.
	// Generally this method should not be defined by user,
	// intstead it will be defined in embedded `*base.Base`
	Label() string
	Template() string

	// Some additional functions to complement code generation
	// and setup for C code.
	NeedsDevice() bool
	CPPComponentType() string

	cluster.Provider
	appconfig.Provider
	devicetree.Applier
}

type Sensors

type Sensors []Sensor

func (*Sensors) UniqueClusters

func (s *Sensors) UniqueClusters() cluster.Clusters

UniqueClusters will return all unique clusters across all the sensors. Clusters might be configured for a specific sensor, so this method is mostly useful to *know* which clusters are available.

func (*Sensors) UnmarshalYAML

func (s *Sensors) UnmarshalYAML(value *yaml.Node) error

type Simple

type Simple struct {
	SensorName             string
	SensorLabel            string
	SensorTemplate         string
	SensorIncludes         []string
	SensorWriteFiles       []generator.WriteFile
	SensorNeedsDevice      bool
	SensorCPPComponentType string
	SensorClusters         cluster.Clusters
	SensorAppConfig        []appconfig.ConfigValue
	SensorAppOverlay       func(*devicetree.DeviceTree) error
}

func (*Simple) AppConfig

func (s *Simple) AppConfig() []appconfig.ConfigValue

func (*Simple) ApplyOverlay

func (s *Simple) ApplyOverlay(overlay *devicetree.DeviceTree) error

func (*Simple) CPPComponentType

func (s *Simple) CPPComponentType() string

func (*Simple) Clusters

func (s *Simple) Clusters() cluster.Clusters

func (*Simple) Includes

func (s *Simple) Includes() []string

func (*Simple) Label

func (s *Simple) Label() string

func (*Simple) NeedsDevice

func (s *Simple) NeedsDevice() bool

func (*Simple) String

func (s *Simple) String() string

func (*Simple) Template

func (s *Simple) Template() string

func (*Simple) WriteFiles

func (s *Simple) WriteFiles() []generator.WriteFile

type WithExtenders

type WithExtenders interface {
	Extenders() []generator.Extender
}

Jump to

Keyboard shortcuts

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