driver

package
v0.0.0-...-f383108 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigListenAddr   = "ListenAddress"
	ConfigDecodingMode = "DecodingMode"
	ModeStrict         = "strict"
	ModeNonStandard    = "non-standard"
)

Variables

View Source
var (
	InvalidLength       = TempoDecodeError(errors.New("not enough data"))
	InvalidPreamble     = TempoDecodeError(errors.New("wrong preamble"))
	InvalidPDUType      = TempoDecodeError(errors.New("wrong PDU type"))
	InvalidManufacturer = TempoDecodeError(errors.New("wrong manufacturer ID"))
	InvalidTemperature  = TempoDecodeError(errors.New("temperature exceeds functional range"))
)
View Source
var IgnoreEOF = ErrsFilter(io.EOF)

IgnoreEOF ignores EOF errors.

Functions

func Drain

func Drain(r io.ReadCloser)

Drain reads r til EOF, then closes it.

func ErrsFilter

func ErrsFilter(errs ...error) func(args ...interface{}) error

ErrsFilter returns a decorator that filters out the given errors.

func LogIfErr

func LogIfErr(args ...interface{})

LogIfErr logs the last argument if it's a non-nil error.

func NewProtocolDriver

func NewProtocolDriver() deviceModels.ProtocolDriver

NewProtocolDriver returns the package-level driver instance.

Types

type BLAddr

type BLAddr [6]byte

func (BLAddr) String

func (m BLAddr) String() string

type ConfigMap

type ConfigMap map[string]string

func GetDriverConfig

func GetDriverConfig() ConfigMap

func (ConfigMap) Get

func (cm ConfigMap) Get(name string, v interface{}) error

type Driver

type Driver struct {
	Logger  logger.LoggingClient
	AsyncCh chan<- *deviceModels.AsyncValues
	// contains filtered or unexported fields
}

func (*Driver) HandleReadCommands

HandleReadCommands ignore all requests.

func (*Driver) HandleWriteCommands

func (driver *Driver) HandleWriteCommands(_ string, _ map[string]coreModels.ProtocolProperties,
	_ []deviceModels.CommandRequest, params []*deviceModels.CommandValue) error

HandleWriteCommands ignores all requests.

func (*Driver) Initialize

func (driver *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *deviceModels.AsyncValues) error

Initialize the driver.

func (*Driver) Stop

func (driver *Driver) Stop(force bool) error

Stop instructs the protocol-specific DS code to shutdown gracefully, or if the force parameter is 'true', immediately. The driver is responsible for closing any in-use channels, including the channel used to send async readings (if supported).

type SpaceSkipReader

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

SpaceSkipReader wraps a reader, skipping line breaks, carriage returns, tabs, and spaces ('\n', '\r', '\t', and ' ').

func NewSpaceSkipReader

func NewSpaceSkipReader(r io.Reader) *SpaceSkipReader

NewSpaceSkipReader returns a reader that skips newlines and spaces in an input stream.

func (*SpaceSkipReader) Read

func (r *SpaceSkipReader) Read(p []byte) (n int, err error)

Read reads bytes from the underlying reader and puts them in the buffer, skipping '\n', '\r, ' ', and '\t' along the way. It returns the number of bytes read but not skipped, along with the reader error encountered, if any.

If all bytes are skipped, Read may return (0, nil); do NOT consider this EOF.

type TempoDecodeError

type TempoDecodeError error

TempoDecodeError is the error type returned during unmarshalling if the input data cannot be decoded into TempoDiscCurrent.

type TempoDiscCurrent

type TempoDiscCurrent struct {
	MAC         BLAddr
	Name        string
	Temperature float32
}

TempoDiscCurrent is data derived from the announcement of current data from a Blue Maestro Tempo Disk sensor.

func (*TempoDiscCurrent) UnmarshalBinary

func (tcd *TempoDiscCurrent) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes advertisement data from Tempo Disks.

Jump to

Keyboard shortcuts

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