Documentation
¶
Overview ¶
Package plc4go contains the main API for plc4go (go part of plc4x)
Index ¶
- type PlcConnection
- type PlcConnectionPingResult
- type PlcDriver
- type PlcDriverManager
- type Transportdeprecated
- type WithDiscoveryOption
- func WithDiscoveryOptionDeviceName(deviceName string) WithDiscoveryOption
- func WithDiscoveryOptionLocalAddress(localAddress string) WithDiscoveryOption
- func WithDiscoveryOptionProtocol(protocolName string) WithDiscoveryOption
- func WithDiscoveryOptionProtocolSpecific(key string, value any) WithDiscoveryOption
- func WithDiscoveryOptionRemoteAddress(remoteAddress string) WithDiscoveryOption
- func WithDiscoveryOptionTransport(transportName string) WithDiscoveryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PlcConnection ¶
type PlcConnection interface {
fmt.Stringer
io.Closer
// Connect Initiate the connection to the PLC
Connect(ctx context.Context) error
// IsConnected Checks if the connection is currently still connected
IsConnected() bool
// Ping Executes a no-op operation to check if the current connection is still able to communicate
Ping(ctx context.Context) error
// GetMetadata Get some metadata regarding the current connection
GetMetadata() model.PlcConnectionMetadata
// ReadRequestBuilder Create a builder for assembling read-requests
ReadRequestBuilder() model.PlcReadRequestBuilder
// WriteRequestBuilder Create a builder for assembling write-requests
WriteRequestBuilder() model.PlcWriteRequestBuilder
// SubscriptionRequestBuilder Create a builder for assembling subscription-requests
SubscriptionRequestBuilder() model.PlcSubscriptionRequestBuilder
// UnsubscriptionRequestBuilder Create a builder for assembling unsubscription-requests
UnsubscriptionRequestBuilder() model.PlcUnsubscriptionRequestBuilder
// BrowseRequestBuilder Create a builder for assembling browser-requests
BrowseRequestBuilder() model.PlcBrowseRequestBuilder
}
type PlcConnectionPingResult ¶
type PlcDriver ¶
type PlcDriver interface {
fmt.Stringer
io.Closer
// GetProtocolCode Get the short code used to identify this driver (As used in the connection string)
GetProtocolCode() string
// GetProtocolName Get a human-readable name for this driver
GetProtocolName() string
// GetDefaultTransport If the driver has a default form of transport, provide this and make
// providing the transport code optional in the connection string
GetDefaultTransport() string
// CheckTagAddress Have the driver parse the query string and provide feedback if it's not a valid one
CheckTagAddress(tagAddress string) error
// CheckQuery Have the driver parse the query string and provide feedback if it's not a valid one
CheckQuery(query string) error
// GetConnection Establishes a connection to a given PLC using the information in the connectionString
// FIXME: this leaks spi in the signature move to spi driver or create interfaces. Can also be done by moving spi in a proper module
GetConnection(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, options map[string][]string) (PlcConnection, error)
// SupportsDiscovery returns true if this driver supports discovery
SupportsDiscovery() bool
// Discover TODO: document me
// FIXME: this leaks spi in the signature move to spi driver or create interfaces. Can also be done by moving spi in a proper module
Discover(ctx context.Context, callback func(event model.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error
}
type PlcDriverManager ¶
type PlcDriverManager interface {
io.Closer
// RegisterDriver Manually register a new driver
RegisterDriver(driver PlcDriver)
// ListDriverNames List the names of all drivers registered in the system
ListDriverNames() []string
// GetDriver Get access to a driver instance for a given driver-name
GetDriver(driverName string) (PlcDriver, error)
// GetConnection Get a connection to a remote PLC for a given plc4x connection-string
GetConnection(ctx context.Context, connectionString string) (PlcConnection, error)
// Discover Execute all available discovery methods on all available drivers using all transports
Discover(ctx context.Context, callback func(event model.PlcDiscoveryItem), discoveryOptions ...WithDiscoveryOption) error
}
PlcDriverManager is the main entry point for PLC4Go applications
func NewPlcDriverManager ¶
func NewPlcDriverManager(_options ...config.WithOption) PlcDriverManager
type Transport
deprecated
type Transport interface {
transports.Transport
}
Deprecated: don't use it in productive code
type WithDiscoveryOption ¶
type WithDiscoveryOption interface {
// contains filtered or unexported methods
}
WithDiscoveryOption is a marker interface for options regarding discovery FIXME: this is to avoid leaks spi in the signature move to spi driver or create interfaces. Can also be done by moving spi in a proper module
func WithDiscoveryOptionDeviceName ¶
func WithDiscoveryOptionDeviceName(deviceName string) WithDiscoveryOption
WithDiscoveryOptionDeviceName sets an option for a deviceName
func WithDiscoveryOptionLocalAddress ¶
func WithDiscoveryOptionLocalAddress(localAddress string) WithDiscoveryOption
WithDiscoveryOptionLocalAddress sets an option for a localAddress
func WithDiscoveryOptionProtocol ¶
func WithDiscoveryOptionProtocol(protocolName string) WithDiscoveryOption
WithDiscoveryOptionProtocol sets an option for a protocol
func WithDiscoveryOptionProtocolSpecific ¶
func WithDiscoveryOptionProtocolSpecific(key string, value any) WithDiscoveryOption
func WithDiscoveryOptionRemoteAddress ¶
func WithDiscoveryOptionRemoteAddress(remoteAddress string) WithDiscoveryOption
WithDiscoveryOptionRemoteAddress sets an option for a remoteAddress
func WithDiscoveryOptionTransport ¶
func WithDiscoveryOptionTransport(transportName string) WithDiscoveryOption
WithDiscoveryOptionTransport sets an option for a transportName