Documentation
¶
Index ¶
- Constants
- func NewDefaultLogger(debug bool) *zap.SugaredLogger
- type Basic
- type Buzzer
- type ConnectionStatus
- type DataPoint
- type DataPoints
- type Logger
- type NullLogger
- func (l *NullLogger) Debug(args ...interface{})
- func (l *NullLogger) Debugf(format string, args ...interface{})
- func (l *NullLogger) Error(args ...interface{})
- func (l *NullLogger) Errorf(format string, args ...interface{})
- func (l *NullLogger) Info(args ...interface{})
- func (l *NullLogger) Infof(format string, args ...interface{})
- func (l *NullLogger) Warn(args ...interface{})
- func (l *NullLogger) Warnf(format string, args ...interface{})
- type Scale
- type State
- type Timer
- type Unit
- type WithBuzzer
- type WithTimer
Constants ¶
View Source
const ( // UnitUnknown denotes an unknown / invalid unit UnitUnknown = "--" // UnitGrams denotes metric units UnitGrams = "g" // UnitOz denotes imperial units UnitOz = "oz" )
Variables ¶
This section is empty.
Functions ¶
func NewDefaultLogger ¶ added in v1.0.2
func NewDefaultLogger(debug bool) *zap.SugaredLogger
NewDefaultLogger instantiates a new default logger
Types ¶
type Basic ¶
type Basic interface {
// ConnectionStatus returns the current connection status of the scale device
ConnectionStatus() ConnectionStatus
// BatteryLevel returns the current battery level
BatteryLevel() float64
// BatteryLevelRaw returns the current battery level in its raw form
BatteryLevelRaw() int
// Unit returns the current weight unit
Unit() Unit
// SetUnit sets the weight unit
SetUnit(unit Unit) error
// Tare tares the scale
Tare() error
// TogglePrecision toggles the weight precision between 0.1 and 0.01
TogglePrecision() error
// SetStateChangeHandler defines a handler function that is called upon state change
SetStateChangeHandler(fn func(status ConnectionStatus))
// SetStateChangeChannel defines a handler function that is called upon state change
SetStateChangeChannel(ch chan ConnectionStatus)
// SetDataHandler defines a handler function that is called upon retrieval of data
SetDataHandler(fn func(data DataPoint))
// SetDataChannel defines a handler function that is called upon retrieval of data
SetDataChannel(ch chan DataPoint)
// Close terminates the connection to the device
Close() error
}
Basic denotes a basic coffee scale
type Buzzer ¶
type Buzzer interface {
// IsBuzzingOnTouch returs if the buzzer (on user interaction) is on / off
IsBuzzingOnTouch() bool
// ToggleBuzzingOnTouch turns the buzzer (on user interaction) on / off
ToggleBuzzingOnTouch() error
// Buzz requests the scale to beep / buzz n times
Buzz(n int) error
}
Buzzer denotes audible signaling functionality
type ConnectionStatus ¶
ConnectionStatus denotes the current status of the bluetooth device
type DataPoints ¶
type DataPoints []DataPoint
DataPoints denotes a set of data points (usually part of a brew process)
type Logger ¶ added in v1.0.2
type Logger interface {
Error(args ...interface{})
Errorf(format string, args ...interface{})
Warn(args ...interface{})
Warnf(format string, args ...interface{})
Info(args ...interface{})
Infof(format string, args ...interface{})
Debug(args ...interface{})
Debugf(format string, args ...interface{})
}
Logger denotes a generic log interface that logging service must provide
type NullLogger ¶ added in v1.0.2
type NullLogger struct{}
NullLogger denotes a null-op logger that ignores all messages
func (*NullLogger) Debug ¶ added in v1.0.2
func (l *NullLogger) Debug(args ...interface{})
func (*NullLogger) Debugf ¶ added in v1.0.2
func (l *NullLogger) Debugf(format string, args ...interface{})
func (*NullLogger) Error ¶ added in v1.0.2
func (l *NullLogger) Error(args ...interface{})
func (*NullLogger) Errorf ¶ added in v1.0.2
func (l *NullLogger) Errorf(format string, args ...interface{})
func (*NullLogger) Info ¶ added in v1.0.2
func (l *NullLogger) Info(args ...interface{})
func (*NullLogger) Infof ¶ added in v1.0.2
func (l *NullLogger) Infof(format string, args ...interface{})
func (*NullLogger) Warn ¶ added in v1.0.2
func (l *NullLogger) Warn(args ...interface{})
func (*NullLogger) Warnf ¶ added in v1.0.2
func (l *NullLogger) Warnf(format string, args ...interface{})
type Timer ¶
type Timer interface {
// StartTimer starts the timer / stopwatch
StartTimer() error
// StopTimer stops the timer / stopwatch
StopTimer() error
// ResetTimer resets the timer / stopwatch
ResetTimer() error
// ElapsedTime returns the current timer value
ElapsedTime() time.Duration
}
Timer denotes timer / stopwatch functionality
type WithBuzzer ¶
WithBuzzer denotes a scale with buzzer functionality
Click to show internal directories.
Click to hide internal directories.