pm

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 Concentration

type Concentration struct {
	// UpperBoundSize is the upper bound of the size of particles included in the concentration
	UpperBoundSize units.Distance
	// Amount is the mass concentration of particulate matter in a volume of air
	Amount units.MassConcentration
}

Concentration is a measurement of particulate matter concentrations

type ConcentrationSpec

type ConcentrationSpec struct {
	// UpperBoundSize is the upper bound of the size of particles included in the concentration
	UpperBoundSize units.Distance
	// Resolution is the smallest increment of measurement from the sensor
	Resolution units.MassConcentration
	// MinConcentration is the minimum valid measurement from the sensor
	MinConcentration units.MassConcentration
	// MaxConcentration is the maximum valid measurement from the sensor
	MaxConcentration units.MassConcentration
}

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

type Consumer

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

Consumer is a consumer of particulate matter concentrations

func NewConsumer

func NewConsumer(sensor ParticulateMatterSensor, 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 concentration measurement
	HandlePMConcentration(context.Context, *Concentration) error
}

Handler defines a handler of particulate matter concentrations

type ParticulateMatterSensor

type ParticulateMatterSensor interface {
	// Run begins reading from the sensor and blocks until either an error occurs or the context is completed
	Run(context.Context) error
	// Concentrations returns a channel of PM concentration readings as they become available from the sensor
	Concentrations() <-chan *Concentration
	// ConcentrationSpecs returns a collection of specified measurement ranges supported by the sensor
	ConcentrationSpecs() []*ConcentrationSpec
}

ParticulateMatterSensor defines a sensor for measuring concentrations of particulate matter in air

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