humidity

package
v0.0.0-...-6da897e Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	// contains filtered or unexported fields
}

Consumer is a consumer of relative humidities

func NewConsumer

func NewConsumer(sensor RelativeHumiditySensor, handlers ...Handler) *Consumer

NewConsumer returns a new Consumer with the configured handlers

func (*Consumer) Run

func (c *Consumer) Run(ctx context.Context) error

Run begins consuming from the sensor and handling each measurement. Blocks until either an error occurs or the context is completed.

type Handler

type Handler interface {
	// Handles an individual relative humidity measurement
	HandleRelativeHumidity(context.Context, *units.RelativeHumidity) error
}

Handler defines a handler of relative humidities

type RelativeHumiditySensor

type RelativeHumiditySensor interface {
	// Run begins reading from the sensor and blocks until either an error occurs or the context is completed
	Run(context.Context) error
	// RelativeHumidities returns a channel of relative humidity readings as they become available from the sensor
	RelativeHumidities() <-chan *units.RelativeHumidity
	// HumiditySpecs returns a collection of specified measurement ranges supported by the sensor
	RelativeHumiditySpecs() []*RelativeHumiditySpec
}

RelativeHumiditySensor defines a sensor for measuring relative humidity

type RelativeHumiditySpec

type RelativeHumiditySpec struct {
	// PercentageResolution is a value typically in the range of 0.0 (0%) to 1.0 (100%), though higher values may be feasible depending on conditions
	PercentageResolution float64
	// MinPercentage is a value typically in the range of 0.0 (0%) to 1.0 (100%), though higher values may be feasible depending on conditions
	MinPercentage float64
	// MaxPercentage is a value typically in the range of 0.0 (0%) to 1.0 (100%), though higher values may be feasible depending on conditions
	MaxPercentage float64
}

RelativeHumiditySpec is a specification of valid measurement ranges supported by the sensor

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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