opcua

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: GPL-2.0, GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func NewOpcUaDriver

func NewOpcUaDriver() driver.Driver

Types

type ClientWrapper

type ClientWrapper struct {
	Client    *opcua.Client
	Endpoint  string
	Connected bool
	Config    map[string]any

	Subscriptions map[string]*DeviceSubscription // DeviceID -> Subscription
	// contains filtered or unexported fields
}

func (*ClientWrapper) NeedProbeCheck

func (w *ClientWrapper) NeedProbeCheck() bool

func (*ClientWrapper) ProbeConnection

func (w *ClientWrapper) ProbeConnection()

func (*ClientWrapper) RecordFailure

func (w *ClientWrapper) RecordFailure(err error)

func (*ClientWrapper) RecordSuccess

func (w *ClientWrapper) RecordSuccess()

type DeviceSubscription

type DeviceSubscription struct {
	Sub        *opcua.Subscription
	Cache      map[string]model.Value
	PointIDs   []string
	Points     map[string]model.Point
	HandleMap  map[uint32]string
	NextHandle uint32
	NotifyCh   chan *opcua.PublishNotificationData
	Ctx        context.Context
	Cancel     context.CancelFunc
	// contains filtered or unexported fields
}

type OpcUaDriver

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

func (*OpcUaDriver) Connect

func (d *OpcUaDriver) Connect(ctx context.Context) error

func (*OpcUaDriver) Disconnect

func (d *OpcUaDriver) Disconnect() error

func (*OpcUaDriver) GetConnectionMetrics

func (d *OpcUaDriver) GetConnectionMetrics() (connectionSeconds int64, reconnectCount int64, localAddr string, remoteAddr string, lastDisconnectTime time.Time)

func (*OpcUaDriver) GetMetrics

func (d *OpcUaDriver) GetMetrics() model.ChannelMetrics

GetMetrics 返回OPC-UA驱动的详细指标

func (*OpcUaDriver) Health

func (d *OpcUaDriver) Health() driver.HealthStatus

func (*OpcUaDriver) Init

func (d *OpcUaDriver) Init(cfg model.DriverConfig) error

func (*OpcUaDriver) ReadPoints

func (d *OpcUaDriver) ReadPoints(ctx context.Context, points []model.Point) (map[string]model.Value, error)

func (*OpcUaDriver) ResetDeviceCollection

func (d *OpcUaDriver) ResetDeviceCollection(deviceID string)

func (*OpcUaDriver) Scan

func (d *OpcUaDriver) Scan(ctx context.Context, params map[string]any) (any, error)

Scan implements Scanner interface for OPC-UA device discovery

func (*OpcUaDriver) ScanObjects

func (d *OpcUaDriver) ScanObjects(ctx context.Context, config map[string]any) (any, error)

func (*OpcUaDriver) SetDeviceConfig

func (d *OpcUaDriver) SetDeviceConfig(config map[string]any) error

func (*OpcUaDriver) SetSlaveID

func (d *OpcUaDriver) SetSlaveID(slaveID uint8) error

func (*OpcUaDriver) WritePoint

func (d *OpcUaDriver) WritePoint(ctx context.Context, point model.Point, value any) error

WritePoint writes a value to an OPC-UA node with full type conversion and error handling

Jump to

Keyboard shortcuts

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