Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Theme = huh.ThemeCharm()
Functions ¶
func PromptConfig ¶
func PromptConfig(cfg *ModbusConfiguration) error
PromptConfig prompts to the user to configurate the modbus connection.
Types ¶
type Datapoint ¶
type Datapoint struct { SlaveId uint8 `json:"slaveId"` Name string `json:"name"` Description string `json:"description"` Addr uint16 `json:"addr"` DataType DataType `json:"data-type"` Flag Flag `json:"flag"` Unit string `json:"unit"` // Scaling specifies a scaling of the datapoint value. // For example if value can be negative, we have to scale // the unsigned value to be negative. Scaling *Scaling `json:"scaling"` // Value is the last read value. Value any `json:"-"` // Err is not-nil if the last read failed. Err error `json:"-"` }
Datapoint represents a value from a modbus server. It specifies the datatype, flags and unit.
func PromptTable ¶
func PromptTable(client *modbus.ModbusClient, datapoints []*Datapoint) ([]*Datapoint, error)
type KeyMap ¶
type KeyMap struct { Table table.KeyMap Add key.Binding Remove key.Binding Edit key.Binding Refresh key.Binding RefreshEverySec key.Binding StopRefresh key.Binding Write key.Binding Duplicate key.Binding MoveLineUp key.Binding MoveLineDown key.Binding AutoReload bool }
func DefaultKeyMap ¶
type ModbusConfiguration ¶
type ModbusConfiguration struct { Transport string `json:"transport,omitempty"` Addr string `json:"address,omitempty"` BaudRate uint `json:"baudrate,omitempty"` DataBits uint `json:"databits,omitempty"` Parity uint `json:"parity,omitempty"` StopBits uint `json:"stopbits,omitempty"` }
ModbusConfiguration represents a modbus client configuration
func (*ModbusConfiguration) ClientConfiguration ¶
func (c *ModbusConfiguration) ClientConfiguration() *modbus.ClientConfiguration
type Model ¶
type Model struct { *table.Model KeyMap KeyMap Help help.Model Status *Status MaxColumnWidth int Datapoints []*Datapoint LastEdited *Datapoint // contains filtered or unexported fields }
func (Model) SelectedDatapoint ¶
func (*Model) SetDatapoints ¶
SetDatapoints sets the datapoints which are shown
type Number ¶
type Number interface { constraints.Integer | constraints.Float }
type NumberAccessor ¶
type NumberAccessor[T Number] struct { // contains filtered or unexported fields }
func NewNumberAccessor ¶
func NewNumberAccessor[T Number](val *T) *NumberAccessor[T]
func (*NumberAccessor[T]) Get ¶
func (a *NumberAccessor[T]) Get() string
func (*NumberAccessor[T]) Set ¶
func (a *NumberAccessor[T]) Set(value string)
type RefreshTickMsg ¶
type RefreshTickMsg struct { }
Click to show internal directories.
Click to hide internal directories.