modbusrtu

package module
v0.0.0-...-d5b1c23 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

Types

type Activity

type Activity struct {
	// connection settings, e.g. baudrate, parity, etc.
	*Settings
}

func (*Activity) Eval

func (a *Activity) Eval(ctx activity.Context) (done bool, err error)

func (*Activity) Metadata

func (a *Activity) Metadata() *activity.Metadata

Metadata returns the activity's metadata

type Input

type Input struct {
	Operation   string      `md:"operation,required"` // Operation to perform ("ReadCoils", "ReadDiscreteInputs", "ReadInputRegisters", "ReadHoldingRegisters", "WriteSingleCoil", "WriteMultipleCoils", "WriteSingleRegister", "WriteMultipleRegisters")
	Address     uint16      `md:"address,required"`   // The address where to perform the operation
	NumElements uint16      `md:"numElements"`        // The number of coils/inputs/registers to be read/written
	Data        interface{} `md:"data"`               // The data needed to perform the operation
	ReturnAs    string      `md:"returnAs"`           // Return Type ("Default", "Bool", "Int8", "Int16", "Int32", "Int64", "Uint16", "Uint32", "Uint64", "Float32", "Float64")
}

func (*Input) FromMap

func (i *Input) FromMap(values map[string]interface{}) error

func (*Input) ToMap

func (i *Input) ToMap() map[string]interface{}

type Output

type Output struct {
	Result string      `md:"result"` // The result status of the operation sending. "OK" when success
	Data   interface{} `md:"data"`   // The data returned from the operation
}

func (*Output) FromMap

func (o *Output) FromMap(values map[string]interface{}) error

func (*Output) ToMap

func (o *Output) ToMap() map[string]interface{}

type Settings

type Settings struct {
	Device   string `md:"serialDevice,required"`
	SlaveID  uint8  `md:"slaveId,required"`
	BaudRate int    `md:"baudRate,required"`
	Timeout  int    `md:"timeout"`
	Parity   string `md:"parity"`
	DataBits int    `md:"dataBits"`
	StopBits int    `md:"stopBits"`
}

Jump to

Keyboard shortcuts

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