modbus

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 23 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 BatchReadMode plugin.EncodeMode = "batchRead"

Variables

This section is empty.

Functions

func InitRestAPI added in v0.8.0

func InitRestAPI()

Types

type ConnectionConfig added in v0.8.0

type ConnectionConfig struct {
	Enable        bool   `json:"enable"`        //当前连接是否可用
	Address       string `json:"address"`       // 地址:例如:127.0.0.1:502
	Mode          string `json:"mode"`          // 连接模式:rtuovertcp、rtu
	BaudRate      uint   `json:"baudRate"`      // 波特率(仅串口模式)
	DataBits      uint   `json:"dataBits"`      // 数据位(仅串口模式)
	StopBits      uint   `json:"stopBits"`      // 停止位(仅串口模式)
	Parity        uint   `json:"parity"`        // 奇偶性校验(仅串口模式)
	BatchReadLen  uint16 `json:"batchReadLen"`  // 最长连续读个数
	BatchWriteLen uint16 `json:"batchWriteLen"` // 支持连续写的最大长度
	MinInterval   uint16 `json:"minInterval"`   // 最小读取间隔
	Timeout       uint16 `json:"timeout"`       // 请求超时
	Retry         int    `json:"retry"`         // 重试次数
	Virtual       bool   `json:"virtual"`       //虚拟设备功能
}

ConnectionConfig 连接器配置

type Plugin

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

Plugin 驱动插件

func (*Plugin) Connector

func (p *Plugin) Connector(deviceId 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, ls *lua.LState)

Initialize 插件初始化

type Point added in v0.8.0

type Point struct {
	config.Point
	//冗余设备相关信息
	DeviceId string

	//点位采集周期
	Duration     string `json:"duration"`
	Address      uint16
	RegisterType primaryTable `json:"primaryTable"`
	//该配置无需设置
	Quantity uint16 `json:"-"`
	Bit      uint8  `json:"bit"`
	BitLen   uint8  `json:"bitLen"`
	RawType  string `json:"rawType"`
	ByteSwap bool   `json:"byteSwap"`
	WordSwap bool   `json:"wordSwap"`
	//写操作是否强制要求多寄存器写接口。某些设备点位虽然只占据一个寄存器地址,但要求采用多寄存器写接口
	MultiWrite bool `json:"multiWrite"`
}

Point modbus点位

Jump to

Keyboard shortcuts

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