modbus

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Coil            primaryTable = "COIL"             // 线圈
	DiscreteInput   primaryTable = "DISCRETE_INPUT"   // 离散输入
	InputRegister   primaryTable = "INPUT_REGISTER"   // 离散寄存器
	HoldingRegister primaryTable = "HOLDING_REGISTER" // 保持寄存器
)
View Source
const (
	// endianness of 16-bit registers
	LITTLE_ENDIAN Endianness = true
	BIG_ENDIAN    Endianness = false
	// word order of 32-bit registers
	LOW_WORD_FIRST  WordOrder = true
	HIGH_WORD_FIRST WordOrder = false
)

Variables

This section is empty.

Functions

func BytesToFloat32s

func BytesToFloat32s(endianness Endianness, wordOrder WordOrder, in []byte) (out []float32)

func BytesToFloat64s

func BytesToFloat64s(endianness Endianness, wordOrder WordOrder, in []byte) (out []float64)

func BytesToUint16

func BytesToUint16(endianness Endianness, in []byte) (out uint16)

func BytesToUint16s

func BytesToUint16s(endianness Endianness, in []byte) (out []uint16)

func BytesToUint32s

func BytesToUint32s(endianness Endianness, wordOrder WordOrder, in []byte) (out []uint32)

func BytesToUint64s

func BytesToUint64s(endianness Endianness, wordOrder WordOrder, in []byte) (out []uint64)

func DecodeBools

func DecodeBools(quantity uint16, in []byte) (out []bool)

func EncodeBools

func EncodeBools(in []bool) (out []byte)

func Float32ToBytes

func Float32ToBytes(endianness Endianness, wordOrder WordOrder, in float32) (out []byte)

func Float64ToBytes

func Float64ToBytes(endianness Endianness, wordOrder WordOrder, in float64) (out []byte)

func Uint16ToBytes

func Uint16ToBytes(endianness Endianness, in uint16) (out []byte)

func Uint16sToBytes

func Uint16sToBytes(endianness Endianness, in []uint16) (out []byte)

func Uint32ToBytes

func Uint32ToBytes(endianness Endianness, wordOrder WordOrder, in uint32) (out []byte)

func Uint64ToBytes

func Uint64ToBytes(endianness Endianness, wordOrder WordOrder, in uint64) (out []byte)

Types

type Endianness

type Endianness bool

type Plugin

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

Plugin 驱动插件

func (*Plugin) Connector

func (p *Plugin) Connector(deviceName, pointName string) (conn plugin.Connector, err error)

Connector 连接器

func (*Plugin) Destroy

func (p *Plugin) Destroy() error

Destroy 销毁驱动插件

func (*Plugin) Initialize

func (p *Plugin) Initialize(logger *zap.Logger, c config.Config, handler plugin.OnReceiveHandler, ls *lua.LState) (err error)

Initialize 插件初始化

func (*Plugin) ProtocolAdapter

func (p *Plugin) ProtocolAdapter() plugin.ProtocolAdapter

ProtocolAdapter 适配器

type Value

type Value struct {
	Value uint16 `json:"value"` // 寄存器值
	Mask  uint16 `json:"mask"`  // 掩码  为 0 时无效
}

Value 设定值及掩码

type WordOrder

type WordOrder bool

Jump to

Keyboard shortcuts

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