item

package
v0.0.0-...-52be9fe Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ON  = "ON"
	OFF = "OFF"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnItem

type AnItem struct {
	ID    string
	Label string
	Type  string
	Img   string
	Unit  string
	// contains filtered or unexported fields
}

func (*AnItem) AddListener

func (a *AnItem) AddListener(l ItemListener)

func (*AnItem) EnableHistory

func (a *AnItem) EnableHistory()

func (*AnItem) GetID

func (a *AnItem) GetID() string

func (*AnItem) GetImg

func (a *AnItem) GetImg() string

func (*AnItem) GetLabel

func (a *AnItem) GetLabel() string

func (*AnItem) GetLastValueChange

func (a *AnItem) GetLastValueChange() time.Time

func (*AnItem) GetLastValueUpdate

func (a *AnItem) GetLastValueUpdate() time.Time

func (*AnItem) GetType

func (a *AnItem) GetType() string

func (*AnItem) GetUnit

func (a *AnItem) GetUnit() string

func (*AnItem) GetValue

func (a *AnItem) GetValue() string

func (*AnItem) IsHistoryEnabled

func (a *AnItem) IsHistoryEnabled() bool

func (*AnItem) MarshalJSON

func (a *AnItem) MarshalJSON() ([]byte, error)

func (*AnItem) SetImg

func (a *AnItem) SetImg(img string)

func (*AnItem) SetLabel

func (a *AnItem) SetLabel(label string)

func (*AnItem) SetUnit

func (a *AnItem) SetUnit(unit string)

func (*AnItem) SetValue

func (a *AnItem) SetValue(value string) (string, bool)

type CallbackListener

type CallbackListener struct {
	CbFnc func(item Item, old string, new string)
}

func (*CallbackListener) OnValueChange

func (c *CallbackListener) OnValueChange(item Item, old string, new string)

type Item

type Item interface {
	GetID() string
	GetType() string
	GetValue() string
	SetValue(string) (string, bool)
	GetImg() string
	SetImg(img string)
	GetLabel() string
	SetLabel(label string)
	GetUnit() string
	SetUnit(unit string)
	GetLastValueUpdate() time.Time
	GetLastValueChange() time.Time
	EnableHistory()
	IsHistoryEnabled() bool

	AddListener(l ItemListener)
	MarshalJSON() ([]byte, error)
}

type ItemListener

type ItemListener interface {
	OnValueChange(item Item, old string, new string)
}

Jump to

Keyboard shortcuts

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