Documentation
¶
Index ¶
- Constants
- func NewOpcUaDriver() driver.Driver
- type ClientWrapper
- type DeviceSubscription
- type OpcUaDriver
- func (d *OpcUaDriver) Connect(ctx context.Context) error
- func (d *OpcUaDriver) Disconnect() error
- func (d *OpcUaDriver) GetConnectionMetrics() (connectionSeconds int64, reconnectCount int64, localAddr string, ...)
- func (d *OpcUaDriver) GetMetrics() model.ChannelMetrics
- func (d *OpcUaDriver) Health() driver.HealthStatus
- func (d *OpcUaDriver) Init(cfg model.DriverConfig) error
- func (d *OpcUaDriver) ReadPoints(ctx context.Context, points []model.Point) (map[string]model.Value, error)
- func (d *OpcUaDriver) ResetDeviceCollection(deviceID string)
- func (d *OpcUaDriver) Scan(ctx context.Context, params map[string]any) (any, error)
- func (d *OpcUaDriver) ScanObjects(ctx context.Context, config map[string]any) (any, error)
- func (d *OpcUaDriver) SetDeviceConfig(config map[string]any) error
- func (d *OpcUaDriver) SetSlaveID(slaveID uint8) error
- func (d *OpcUaDriver) WritePoint(ctx context.Context, point model.Point, value any) error
Constants ¶
View Source
const ( StateDisconnected driver.ConnState = driver.StateDisconnected StateConnecting driver.ConnState = driver.StateConnecting StateConnected driver.ConnState = driver.StateConnected StateRetrying driver.ConnState = driver.StateRetrying StateDead driver.ConnState = driver.StateDead )
Variables ¶
This section is empty.
Functions ¶
func NewOpcUaDriver ¶
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) Disconnect ¶
func (d *OpcUaDriver) Disconnect() error
func (*OpcUaDriver) GetConnectionMetrics ¶
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 (*OpcUaDriver) ResetDeviceCollection ¶
func (d *OpcUaDriver) ResetDeviceCollection(deviceID string)
func (*OpcUaDriver) ScanObjects ¶
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 ¶
WritePoint writes a value to an OPC-UA node with full type conversion and error handling
Click to show internal directories.
Click to hide internal directories.