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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址