sensor

package
v0.0.0-...-27f3ab6 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(Sensor)

type Command

type Command struct {
	Name         string
	Arguments    []string
	Interval     time.Duration
	MessageStore store.Store
	// contains filtered or unexported fields
}

func (*Command) AddCallback

func (c *Command) AddCallback(clbId interface{}, clb Callback)

func (*Command) Call

func (c *Command) Call(sensor Sensor)

func (*Command) LastMessage

func (c *Command) LastMessage() []byte

func (*Command) RemoveCallback

func (c *Command) RemoveCallback(clbId interface{})

func (*Command) Run

func (c *Command) Run(ctx context.Context) error

type MQTT

type MQTT struct {
	Client       MQTTSubscriber
	Topic        string
	QOS          byte
	MessageStore store.Store
	// contains filtered or unexported fields
}

func (*MQTT) AddCallback

func (c *MQTT) AddCallback(clbId interface{}, clb Callback)

func (*MQTT) Call

func (c *MQTT) Call(sensor Sensor)

func (*MQTT) LastMessage

func (m *MQTT) LastMessage() []byte

func (*MQTT) Purge

func (m *MQTT) Purge()

when the mqtt connection is lost, you have to call this function

func (*MQTT) Reinitialise

func (m *MQTT) Reinitialise()

after the mqtt connection is reestablished, you have to call this function

func (*MQTT) RemoveCallback

func (c *MQTT) RemoveCallback(clbId interface{})

func (*MQTT) Run

func (m *MQTT) Run(ctx context.Context) error

type MQTTSubscriber

type MQTTSubscriber interface {
	Subscribe(topic string, qos byte, clb func(string, byte, []byte))
}

type Rest

type Rest struct {
	HttpClient   *http.Client
	Method       string
	Url          string
	Header       map[string][]string
	Body         func() io.Reader
	Interval     time.Duration
	MessageStore store.Store
	// contains filtered or unexported fields
}

func (*Rest) AddCallback

func (c *Rest) AddCallback(clbId interface{}, clb Callback)

func (*Rest) Call

func (c *Rest) Call(sensor Sensor)

func (*Rest) LastMessage

func (r *Rest) LastMessage() []byte

func (*Rest) RemoveCallback

func (c *Rest) RemoveCallback(clbId interface{})

func (*Rest) Run

func (r *Rest) Run(ctx context.Context) error

type Sensor

type Sensor interface {
	Run(ctx context.Context) error
	AddCallback(clbId interface{}, clb Callback)
	RemoveCallback(clbId interface{})
	LastMessage() []byte
}

type Static

type Static struct {
	MessageStore store.Store
	// contains filtered or unexported fields
}

func (*Static) AddCallback

func (c *Static) AddCallback(clbId interface{}, clb Callback)

func (*Static) Call

func (c *Static) Call(sensor Sensor)

func (*Static) LastMessage

func (s *Static) LastMessage() []byte

func (*Static) RemoveCallback

func (c *Static) RemoveCallback(clbId interface{})

func (*Static) Run

func (s *Static) Run(ctx context.Context) error

func (*Static) Set

func (s *Static) Set(state []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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