io

package
v0.0.0-...-945d024 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const InputError = math.MaxFloat32

InputError represents that the value is currently not available from the device

Variables

This section is empty.

Functions

func NewMeteredInput

func NewMeteredInput(input Input) *meteredInput

func NewMeteredOutput

func NewMeteredOutput(output Output) *meteredOutput

Types

type CacheInput

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

func NewCacheInput

func NewCacheInput(name string, cacheTime time.Duration, realInput Input, now func() time.Time) *CacheInput

func (*CacheInput) Degree

func (i *CacheInput) Degree() string

func (*CacheInput) Name

func (i *CacheInput) Name() string

func (*CacheInput) Type

func (i *CacheInput) Type() string

func (*CacheInput) Value

func (i *CacheInput) Value() float64

type DummyOutput

type DummyOutput struct {
	Name_ string
	Value bool
}

func (*DummyOutput) Get

func (d *DummyOutput) Get() bool

func (*DummyOutput) Name

func (d *DummyOutput) Name() string

func (*DummyOutput) Set

func (d *DummyOutput) Set(value bool) bool

type DummyTempSensor

type DummyTempSensor struct {
	Temperature float64
}

func (*DummyTempSensor) Degree

func (s *DummyTempSensor) Degree() string

func (*DummyTempSensor) Name

func (s *DummyTempSensor) Name() string

func (*DummyTempSensor) Type

func (s *DummyTempSensor) Type() string

func (*DummyTempSensor) Value

func (s *DummyTempSensor) Value() float64

type GPIOOutput

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

func NewGPIOOutput

func NewGPIOOutput(name, pin string, activeLow bool) *GPIOOutput

func (*GPIOOutput) Get

func (d *GPIOOutput) Get() bool

func (*GPIOOutput) Halt

func (d *GPIOOutput) Halt()

func (*GPIOOutput) Name

func (g *GPIOOutput) Name() string

func (*GPIOOutput) Set

func (g *GPIOOutput) Set(newState bool) bool

type Haltable

type Haltable interface {
	//Halt shuts down the device as appropriate. At least it shall Set() the device into the idle state.
	Halt()
}

Haltable is an interface which is expected to be implemented by outputs which need careful cleanup on system shutdown

type Input

type Input interface {
	//Name tells the human readable name of the input
	Name() string
	//Type tells the human readable type / nature of the input (i.e. "Temperature")
	Type() string
	//Degree tells the human readable degree of the input (i.e. "°C")
	Degree() string
	//Value tells the actual up-to-date value of the measured indicator
	Value() float64
}

Input represents any measurable property as a floating point number

type OneWireTemperatureInput

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

func NewOneWireTemperatureInput

func NewOneWireTemperatureInput(name, deviceId string) *OneWireTemperatureInput

func (*OneWireTemperatureInput) Degree

func (o *OneWireTemperatureInput) Degree() string

func (*OneWireTemperatureInput) Name

func (o *OneWireTemperatureInput) Name() string

func (*OneWireTemperatureInput) Type

func (o *OneWireTemperatureInput) Type() string

func (*OneWireTemperatureInput) Value

func (o *OneWireTemperatureInput) Value() float64

type OrOutput

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

type OrOutputMember

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

func NewOrOutput

func NewOrOutput(name string, realOutput Output, amount int) []OrOutputMember

func (*OrOutputMember) Get

func (o *OrOutputMember) Get() bool

func (*OrOutputMember) Name

func (o *OrOutputMember) Name() string

func (*OrOutputMember) Set

func (o *OrOutputMember) Set(value bool) bool

type Output

type Output interface {
	//Name tells the human readable name of the output
	Name() string
	//Set changes the device state. It returns a flag wether the change was effective (i.e. returns false if nothing changed)
	Set(bool) bool
	//Get tells the actual device state
	Get() bool
}

Output represents any controlled device which receives a single ON of OFF signal

type OutputDistributor

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

func NewOutputDistributor

func NewOutputDistributor(name string, realOutputs []Output) *OutputDistributor

func (*OutputDistributor) Get

func (m *OutputDistributor) Get() bool

func (*OutputDistributor) Name

func (m *OutputDistributor) Name() string

func (*OutputDistributor) Set

func (m *OutputDistributor) Set(value bool) bool

type Servo

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

func NewServo

func NewServo(name, pin, offDutyPercentage, onDutyPercentage string) *Servo

func (*Servo) Get

func (s *Servo) Get() bool

func (*Servo) Halt

func (s *Servo) Halt()

func (*Servo) Name

func (s *Servo) Name() string

func (*Servo) Set

func (s *Servo) Set(newState bool) bool

type TimerOutput

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

func NewTimerOutput

func NewTimerOutput(name string, output Output, now func() time.Time) TimerOutput

func (*TimerOutput) Degree

func (t *TimerOutput) Degree() string

func (*TimerOutput) Get

func (t *TimerOutput) Get() bool

func (*TimerOutput) Name

func (t *TimerOutput) Name() string

func (*TimerOutput) Set

func (t *TimerOutput) Set(value bool) bool

func (*TimerOutput) Type

func (t *TimerOutput) Type() string

func (*TimerOutput) Value

func (t *TimerOutput) Value() float64

Jump to

Keyboard shortcuts

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