Help us shape the future of Go! Take the 2026 Go Developer Survey

qpid

package module
v0.0.0-...-3f64f60 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2017 License: MIT Imports: 3 Imported by: 0

README

qpid

BBQ PID controller written in Go for Raspberry PI

BBQ Gopher Image courtesy of Monterey, MX Go User Group

Notes

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MessageMap = map[MessageType]string{
	Info:           "INFO",
	Warning:        "WARNING",
	Critical:       "CRITICAL",
	ThresholdAlert: "THRESHOLD ALERT",
}

MessageMap returns string values for MessageTypes

Functions

This section is empty.

Types

type AlertSink

type AlertSink interface {
	Listen(chan Notification)
}

AlertSink is an interface that must be implemented to receive Alerts from a Thresholder. There must be one AlertSink registered or Alert reporting will block TODO: Figure out a way around blocking or create a nullsink

type CookController

type CookController interface {
	GrillReporter
	FoodMonitors() []Monitor
	GrillMonitor() Monitor
	Run() error
	Stop() error
}

A CookController manages the cook. A new cook is started by calling Run()

type Grill

type Grill struct {
	GrillSensors  []Sensor
	MeatSensors   []Sensor
	FoodMonitors  []Monitor
	GrillMonitors []Monitor
	Reporter      GrillReporter
}

A Grill represents the cooking chamber of a BBQ cooker. It can contain one or more Sensors which report the current temperature.

type GrillReporter

type GrillReporter interface {
	Status() (GrillStatus, error)
	Notifications() chan Notification
	Metrics() chan GrillStatus
}

GrillReporter outputs metrics from a Grill

type GrillStatus

type GrillStatus struct {
	Time         time.Time
	GrillSensors []Sensor
	FoodSensors  []Sensor
	FanOn        bool
}

GrillStatus reports the temperatures of the Grill and Food probes at a point in time

type MessageType

type MessageType int

MessageType is a constant for different levels of messages

const (
	// Info is an informational message type
	Info MessageType = iota
	// Warning is an warning message type
	Warning
	// Critical is a critical message type
	Critical
	// ThresholdAlert is a message type to indicate a threshold has been reached
	ThresholdAlert
)

type MetricSink

type MetricSink interface {
	Listen(chan GrillStatus)
}

MetricSink is an interface that must be implemented to receive metrics from a GrillReporter. There must be one MetricSink registered or metric reporting will block TODO: Figure out a way around blocking or create a nullsink

type Monitor

type Monitor interface {
	Targeter
	Thresholder
}

A Monitor is a device that implements both the Thresholder and Targeter interfaces

type Notification

type Notification struct {
	Time        time.Time
	Message     string
	MessageType MessageType
	Source      Sourcer
}

An Notification is a message that can be sent from various devices

func (Notification) GoString

func (n Notification) GoString() string

GoString implements the GoStringer interface to allow notifications to be printed as strings

type NotificationSink

type NotificationSink interface {
	Listen(chan Notification)
}

NotificationSink is an interface that must be implemented to receive Notifications from a GrillReporter. There must be one NotificationSink registered or Notification reporting will block TODO: Figure out a way around blocking or create a nullsink

type Sensor

type Sensor interface {
	Temperature() (messages.Temp, error)
	Location() messages.Location
	Description() string
	Setpointer
}

Sensor is the interface to retrieve the current temperature of a probe

type Setpointer

type Setpointer interface {
	// Setpoint() returns the currently set desired temperature
	Setpoint() (messages.Temp, error)
}

A Setpointer can return the current target temperature

type Sourcer

type Sourcer interface {
	Source() string
}

Sourcer provides a string representing the source of an Alert

type Targeter

type Targeter interface {
	// Target sets the desired temperature, returns current and/or error
	Target(messages.Temp) (messages.Temp, error)
}

A Targeter sets the desired temperature for a device.

type Thresholder

type Thresholder interface {
	HighThreshold(messages.Temp) error
	LowThreshold(messages.Temp) error
	Alerts() chan Notification
}

A Thresholder watches a probe for high and low values, firing an Alert on the channel returned by Alerts()

Directories

Path Synopsis
cmd
grillctl command
qpid command

Jump to

Keyboard shortcuts

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