Documentation
¶
Overview ¶
Package opcua contains OPC-UA server implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrowsedNode ¶
type BrowsedNode struct {
NodeID string
DataType string
Description string
Unit string
Scale string
BrowseName string
}
BrowsedNode represents the details of a browsed OPC-UA node.
type Browser ¶
type Browser interface {
// Browse availlable Nodes for a given URI.
Browse(string, string) ([]BrowsedNode, error)
}
Browser represents the OPC-UA Server Nodes browser.
type Config ¶
type Config struct {
ServerURI string
NodeID string
Interval string `env:"MG_OPCUA_ADAPTER_INTERVAL_MS" envDefault:"1000"`
Policy string `env:"MG_OPCUA_ADAPTER_POLICY" envDefault:""`
Mode string `env:"MG_OPCUA_ADAPTER_MODE" envDefault:""`
CertFile string `env:"MG_OPCUA_ADAPTER_CERT_FILE" envDefault:""`
KeyFile string `env:"MG_OPCUA_ADAPTER_KEY_FILE" envDefault:""`
}
Config OPC-UA Server.
type RouteMapRepository ¶
type RouteMapRepository interface {
// Save stores/routes pair OPC-UA Server & Magistrala.
Save(context.Context, string, string) error
// Get returns the stored Magistrala route-map for a given OPC-UA pair.
Get(context.Context, string) (string, error)
// Remove route-map from cache.
Remove(context.Context, string) error
}
RouteMapRepository store route-map between the OPC-UA Server and Magistrala.
type Service ¶
type Service interface {
// CreateThing creates thingID:OPC-UA-nodeID route-map
CreateThing(ctx context.Context, thingID, nodeID string) error
// UpdateThing updates thingID:OPC-UA-nodeID route-map
UpdateThing(ctx context.Context, thingID, nodeID string) error
// RemoveThing removes thingID:OPC-UA-nodeID route-map
RemoveThing(ctx context.Context, thingID string) error
// CreateChannel creates channelID:OPC-UA-serverURI route-map
CreateChannel(ctx context.Context, chanID, serverURI string) error
// UpdateChannel updates channelID:OPC-UA-serverURI route-map
UpdateChannel(ctx context.Context, chanID, serverURI string) error
// RemoveChannel removes channelID:OPC-UA-serverURI route-map
RemoveChannel(ctx context.Context, chanID string) error
// ConnectThing creates thingID:channelID route-map
ConnectThing(ctx context.Context, chanID string, thingIDs []string) error
// DisconnectThing removes thingID:channelID route-map
DisconnectThing(ctx context.Context, chanID string, thingIDs []string) error
// Browse browses available nodes for a given OPC-UA Server URI and NodeID
Browse(ctx context.Context, serverURI, namespace, identifier, identifierType string) ([]BrowsedNode, error)
}
Service specifies an API that must be fullfiled by the domain service implementation, and all of its decorators (e.g. logging & metrics).
func New ¶
func New(sub Subscriber, brow Browser, thingsRM, channelsRM, connectRM RouteMapRepository, cfg Config, log *slog.Logger) Service
New instantiates the OPC-UA adapter implementation.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
|
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations. |
|
Package db contains the database implementation of opcua repository layer.
|
Package db contains the database implementation of opcua repository layer. |
|
Package events provides the domain concept definitions needed to support opcua events functionality.
|
Package events provides the domain concept definitions needed to support opcua events functionality. |
|
Package gopcua contains the OPC-UA client implementation.
|
Package gopcua contains the OPC-UA client implementation. |
Click to show internal directories.
Click to hide internal directories.