Documentation ¶
Index ¶
- Constants
- Variables
- func Drain(r io.ReadCloser)
- func ErrsFilter(errs ...error) func(args ...interface{}) error
- func LogIfErr(args ...interface{})
- func NewProtocolDriver() deviceModels.ProtocolDriver
- type BLAddr
- type ConfigMap
- type Driver
- func (driver *Driver) HandleReadCommands(_ string, _ map[string]coreModels.ProtocolProperties, ...) ([]*deviceModels.CommandValue, error)
- func (driver *Driver) HandleWriteCommands(_ string, _ map[string]coreModels.ProtocolProperties, ...) error
- func (driver *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *deviceModels.AsyncValues) error
- func (driver *Driver) Stop(force bool) error
- type SpaceSkipReader
- type TempoDecodeError
- type TempoDiscCurrent
Constants ¶
const ( ConfigListenAddr = "ListenAddress" ConfigDecodingMode = "DecodingMode" ModeStrict = "strict" ModeNonStandard = "non-standard" )
Variables ¶
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")) )
var IgnoreEOF = ErrsFilter(io.EOF)
IgnoreEOF ignores EOF errors.
Functions ¶
func ErrsFilter ¶
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 ConfigMap ¶
func GetDriverConfig ¶
func GetDriverConfig() ConfigMap
type Driver ¶
type Driver struct { Logger logger.LoggingClient AsyncCh chan<- *deviceModels.AsyncValues // contains filtered or unexported fields }
func (*Driver) HandleReadCommands ¶
func (driver *Driver) HandleReadCommands(_ string, _ map[string]coreModels.ProtocolProperties, _ []deviceModels.CommandRequest) ([]*deviceModels.CommandValue, error)
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.
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 ¶
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.