cryocon

package
v0.0.0-...-efe4ef5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package cryocon provides utilities for working with temperature sensors Supports model 12, 14, 18i and maybe more

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPWrapper

type HTTPWrapper struct {
	// Sensor is the underlying sensor that is wrapped
	TemperatureMonitor

	// RouteTable maps goji patterns to http handlers
	RouteTable generichttp.RouteTable
}

HTTPWrapper provides HTTP bindings on top of the underlying Go interface BindRoutes must be called on it

func NewHTTPWrapper

func NewHTTPWrapper(m TemperatureMonitor) HTTPWrapper

NewHTTPWrapper returns a new HTTP wrapper with the route table pre-configured

func (HTTPWrapper) RT

RT satisfies the HTTPer interface

func (*HTTPWrapper) ReadAll

func (h *HTTPWrapper) ReadAll(w http.ResponseWriter, r *http.Request)

ReadAll reads all the channels and returns them as an array of f64 over JSON. Units of Celcius. NaN (no probe) encoded as -274.

func (*HTTPWrapper) ReadChan

func (h *HTTPWrapper) ReadChan(w http.ResponseWriter, r *http.Request)

ReadChan reads a single channel A~G (or so, may expand with future hardware) plucked from the URL and returns the value in Celcius as JSON

func (*HTTPWrapper) Version

func (h *HTTPWrapper) Version(w http.ResponseWriter, r *http.Request)

Version reads the version and sends it back as json

type TemperatureMonitor

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

TemperatureMonitor models a Model 12 or Model 14 temperature monitor

func NewTemperatureMonitor

func NewTemperatureMonitor(addr string) *TemperatureMonitor

NewTemperatureMonitor creates a new temperature monitor instance

func (*TemperatureMonitor) Identification

func (tm *TemperatureMonitor) Identification() (string, error)

Identification returns the identifying information from the monitor. it looks something like:

Cryocon Model 12/14 Rev <firmware rev code><hardware rev code>

func (*TemperatureMonitor) ReadAllChannels

func (tm *TemperatureMonitor) ReadAllChannels() ([]float64, error)

ReadAllChannels reads all of the temperature channels of the sensor in C. any unpopulated channels are NaN.

func (*TemperatureMonitor) ReadChannelLetter

func (tm *TemperatureMonitor) ReadChannelLetter(ch string) (float64, error)

ReadChannelLetter reads the temperature on a given channel in C, where the channel is something like "A"

Jump to

Keyboard shortcuts

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