controls

package
v0.0.0-...-3ef6a19 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Control

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

func NewControl

func NewControl(client *wb.Client, device, control string, meta Meta) *Control

func (*Control) AddWatcher

func (c *Control) AddWatcher(f func(payload ControlWatcherPayload))

func (*Control) GetInfo

func (c *Control) GetInfo() ControlInfo

func (*Control) GetValue

func (c *Control) GetValue() string

func (*Control) SetValue

func (c *Control) SetValue(value string)

type ControlInfo

type ControlInfo struct {
	Name         string
	ValueTopic   string
	CommandTopic string
	Meta         Meta
}

type ControlWatcherPayload

type ControlWatcherPayload struct {
	NewValue string
	OldValue string
	Topic    string
}

type Meta

type Meta struct {
	Type      string                      `json:"type"`      // Тип контроля
	Units     string                      `json:"units"`     // Единицы измерения (только для type="value")
	Max       float64                     `json:"max"`       // Максимальное значение
	Min       float64                     `json:"min"`       // Минимальное значение
	Precision float64                     `json:"precision"` // Точность
	Order     int                         `json:"order"`     // Порядок отображения
	ReadOnly  bool                        `json:"readonly"`  // Только для чтения
	Title     MultilingualText            `json:"title"`     // Название (разные языки)
	Enum      map[string]MultilingualEnum `json:"enum"`      // Заголовки для enum
}

type MultilingualEnum

type MultilingualEnum struct {
	Title MultilingualText `json:"title"` // Название enum на разных языках
}

type MultilingualText

type MultilingualText map[string]string

MultilingualText хранит текстовые значения на разных языках

type PushbuttonControl

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

func NewPushbuttonControl

func NewPushbuttonControl(client *wb.Client, device, control string, meta Meta) *PushbuttonControl

func (*PushbuttonControl) GetInfo

func (c *PushbuttonControl) GetInfo() ControlInfo

func (*PushbuttonControl) Push

func (c *PushbuttonControl) Push()

type RangeControl

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

func NewRangeControl

func NewRangeControl(client *wb.Client, device, control string, meta Meta) *RangeControl

func (*RangeControl) AddWatcher

func (c *RangeControl) AddWatcher(f func(payload RangeControlWatcherPayload))

func (*RangeControl) GetInfo

func (c *RangeControl) GetInfo() ControlInfo

func (*RangeControl) GetValue

func (c *RangeControl) GetValue() int

func (*RangeControl) SetValue

func (c *RangeControl) SetValue(value int)

type RangeControlWatcherPayload

type RangeControlWatcherPayload struct {
	NewValue    int
	OldValue    int
	Topic       string
	ControlName string
}

type RgbControl

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

func NewRgbControl

func NewRgbControl(client *wb.Client, device, control string, meta Meta) *RgbControl

func (*RgbControl) AddWatcher

func (c *RgbControl) AddWatcher(f func(payload RgbControlWatcherPayload))

func (*RgbControl) GetInfo

func (c *RgbControl) GetInfo() ControlInfo

func (*RgbControl) GetValue

func (c *RgbControl) GetValue() RgbValue

func (*RgbControl) SetValue

func (c *RgbControl) SetValue(value RgbValue)

type RgbControlWatcherPayload

type RgbControlWatcherPayload struct {
	NewValue    RgbValue
	OldValue    RgbValue
	Topic       string
	ControlName string
}

type RgbValue

type RgbValue struct {
	Red   int
	Green int
	Blue  int
}

type SwitchControl

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

func NewSwitchControl

func NewSwitchControl(client *wb.Client, device, control string, meta Meta) *SwitchControl

func (*SwitchControl) AddWatcher

func (c *SwitchControl) AddWatcher(f func(payload SwitchControlWatcherPayload))

func (*SwitchControl) GetInfo

func (c *SwitchControl) GetInfo() ControlInfo

func (*SwitchControl) GetValue

func (c *SwitchControl) GetValue() bool

func (*SwitchControl) SetValue

func (c *SwitchControl) SetValue(value bool)

func (*SwitchControl) Toggle

func (c *SwitchControl) Toggle()

func (*SwitchControl) TurnOff

func (c *SwitchControl) TurnOff()

func (*SwitchControl) TurnOn

func (c *SwitchControl) TurnOn()

type SwitchControlWatcherPayload

type SwitchControlWatcherPayload struct {
	NewValue    bool
	OldValue    bool
	Topic       string
	ControlName string
}

type TextControl

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

func NewTextControl

func NewTextControl(client *wb.Client, device, control string, meta Meta) *TextControl

func (*TextControl) AddWatcher

func (c *TextControl) AddWatcher(f func(payload ControlWatcherPayload))

func (*TextControl) GetInfo

func (c *TextControl) GetInfo() ControlInfo

func (*TextControl) GetValue

func (c *TextControl) GetValue() string

func (*TextControl) SetValue

func (c *TextControl) SetValue(value string)

type ValueControl

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

func NewValueControl

func NewValueControl(client *wb.Client, device, control string, meta Meta) *ValueControl

func (*ValueControl) AddWatcher

func (c *ValueControl) AddWatcher(f func(payload ValueControlWatcherPayload))

func (*ValueControl) GetInfo

func (c *ValueControl) GetInfo() ControlInfo

func (*ValueControl) GetValue

func (c *ValueControl) GetValue() float64

type ValueControlWatcherPayload

type ValueControlWatcherPayload struct {
	NewValue    float64
	OldValue    float64
	Topic       string
	ControlName string
}

Jump to

Keyboard shortcuts

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