modbus

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 20 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

Overview

Package modbus implements the Modbus TCP and RTU protocol drivers for CoreC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModbusRTUDriver

func NewModbusRTUDriver(config core.DriverConfig) (core.Driver, error)

NewModbusRTUDriver creates a new Modbus RTU driver from configuration.

func NewModbusRTUOverTCPDriver

func NewModbusRTUOverTCPDriver(config core.DriverConfig) (core.Driver, error)

NewModbusRTUOverTCPDriver creates a driver for Modbus RTU frames encapsulated in a TCP connection (common with serial-to-Ethernet gateways).

func NewModbusRTUOverUDPDriver

func NewModbusRTUOverUDPDriver(config core.DriverConfig) (core.Driver, error)

NewModbusRTUOverUDPDriver creates a driver for Modbus RTU frames encapsulated in a UDP connection.

func NewModbusTCPDriver

func NewModbusTCPDriver(config core.DriverConfig) (core.Driver, error)

NewModbusTCPDriver creates a new Modbus TCP driver from configuration.

func NewModbusTLSDriver

func NewModbusTLSDriver(config core.DriverConfig) (core.Driver, error)

NewModbusTLSDriver creates a new Modbus TCP-over-TLS driver.

func NewModbusUDPDriver

func NewModbusUDPDriver(config core.DriverConfig) (core.Driver, error)

NewModbusUDPDriver creates a driver for Modbus TCP-over-UDP.

Types

type ModbusNetDriver

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

ModbusNetDriver implements core.Driver for the host:port-based Modbus transports that do not need TLS: RTU-over-TCP, UDP, and RTU-over-UDP. The only difference between them is the URL scheme, supplied via urlScheme at construction time.

func (*ModbusNetDriver) Capabilities

func (b *ModbusNetDriver) Capabilities() core.DriverCapabilities

func (*ModbusNetDriver) Init

func (d *ModbusNetDriver) Init(ctx context.Context, config core.DriverConfig) error

func (*ModbusNetDriver) Read

func (b *ModbusNetDriver) Read(ctx context.Context, tags []string) ([]core.TagValue, error)

func (*ModbusNetDriver) SetLogger added in v0.0.4

func (b *ModbusNetDriver) SetLogger(l core.Logger)

SetLogger injects a structured logger into the driver. Called by the engine during AddDriver to wire the slog backend; tests can inject a capture logger to assert on log output.

func (*ModbusNetDriver) SetMetrics added in v0.0.4

func (b *ModbusNetDriver) SetMetrics(m core.Metrics)

SetMetrics injects a metrics backend into the driver. Called by the engine during AddDriver to wire the Prometheus backend; tests can inject a capture to assert on metric values.

func (*ModbusNetDriver) Subscribe

func (b *ModbusNetDriver) Subscribe(ctx context.Context, tags []string) (<-chan core.DataPoint, error)

func (*ModbusNetDriver) Write

func (b *ModbusNetDriver) Write(ctx context.Context, commands []core.WriteCommand) ([]core.WriteResult, error)

type ModbusRTUDriver

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

ModbusRTUDriver implements core.Driver for Modbus RTU over a serial line.

func (*ModbusRTUDriver) Capabilities

func (b *ModbusRTUDriver) Capabilities() core.DriverCapabilities

func (*ModbusRTUDriver) Init

func (d *ModbusRTUDriver) Init(ctx context.Context, config core.DriverConfig) error

func (*ModbusRTUDriver) Read

func (b *ModbusRTUDriver) Read(ctx context.Context, tags []string) ([]core.TagValue, error)

func (*ModbusRTUDriver) SetLogger added in v0.0.4

func (b *ModbusRTUDriver) SetLogger(l core.Logger)

SetLogger injects a structured logger into the driver. Called by the engine during AddDriver to wire the slog backend; tests can inject a capture logger to assert on log output.

func (*ModbusRTUDriver) SetMetrics added in v0.0.4

func (b *ModbusRTUDriver) SetMetrics(m core.Metrics)

SetMetrics injects a metrics backend into the driver. Called by the engine during AddDriver to wire the Prometheus backend; tests can inject a capture to assert on metric values.

func (*ModbusRTUDriver) Subscribe

func (b *ModbusRTUDriver) Subscribe(ctx context.Context, tags []string) (<-chan core.DataPoint, error)

func (*ModbusRTUDriver) Write

func (b *ModbusRTUDriver) Write(ctx context.Context, commands []core.WriteCommand) ([]core.WriteResult, error)

type ModbusTCPDriver

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

ModbusTCPDriver implements core.Driver for Modbus TCP protocol.

func (*ModbusTCPDriver) Capabilities

func (b *ModbusTCPDriver) Capabilities() core.DriverCapabilities

func (*ModbusTCPDriver) Init

func (d *ModbusTCPDriver) Init(ctx context.Context, config core.DriverConfig) error

func (*ModbusTCPDriver) Read

func (b *ModbusTCPDriver) Read(ctx context.Context, tags []string) ([]core.TagValue, error)

func (*ModbusTCPDriver) SetLogger added in v0.0.4

func (b *ModbusTCPDriver) SetLogger(l core.Logger)

SetLogger injects a structured logger into the driver. Called by the engine during AddDriver to wire the slog backend; tests can inject a capture logger to assert on log output.

func (*ModbusTCPDriver) SetMetrics added in v0.0.4

func (b *ModbusTCPDriver) SetMetrics(m core.Metrics)

SetMetrics injects a metrics backend into the driver. Called by the engine during AddDriver to wire the Prometheus backend; tests can inject a capture to assert on metric values.

func (*ModbusTCPDriver) Subscribe

func (b *ModbusTCPDriver) Subscribe(ctx context.Context, tags []string) (<-chan core.DataPoint, error)

func (*ModbusTCPDriver) Write

func (b *ModbusTCPDriver) Write(ctx context.Context, commands []core.WriteCommand) ([]core.WriteResult, error)

type ModbusTLSDriver

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

ModbusTLSDriver implements core.Driver for Modbus TCP over TLS (tcp+tls). The simonvetter/modbus library requires mutual-TLS (mTLS): a client certificate/key pair and a CA certificate pool for server validation.

func (*ModbusTLSDriver) Capabilities

func (b *ModbusTLSDriver) Capabilities() core.DriverCapabilities

func (*ModbusTLSDriver) Init

func (d *ModbusTLSDriver) Init(ctx context.Context, config core.DriverConfig) error

func (*ModbusTLSDriver) Read

func (b *ModbusTLSDriver) Read(ctx context.Context, tags []string) ([]core.TagValue, error)

func (*ModbusTLSDriver) SetLogger added in v0.0.4

func (b *ModbusTLSDriver) SetLogger(l core.Logger)

SetLogger injects a structured logger into the driver. Called by the engine during AddDriver to wire the slog backend; tests can inject a capture logger to assert on log output.

func (*ModbusTLSDriver) SetMetrics added in v0.0.4

func (b *ModbusTLSDriver) SetMetrics(m core.Metrics)

SetMetrics injects a metrics backend into the driver. Called by the engine during AddDriver to wire the Prometheus backend; tests can inject a capture to assert on metric values.

func (*ModbusTLSDriver) Subscribe

func (b *ModbusTLSDriver) Subscribe(ctx context.Context, tags []string) (<-chan core.DataPoint, error)

func (*ModbusTLSDriver) Write

func (b *ModbusTLSDriver) Write(ctx context.Context, commands []core.WriteCommand) ([]core.WriteResult, error)

Jump to

Keyboard shortcuts

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