_default

package
v0.0.0-...-0e1c8c5 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package _default contains default implementations for interfaces defined within the spi

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultPlcConnectionCloseResult

func NewDefaultPlcConnectionCloseResult(connection plc4go.PlcConnection, err error) plc4go.PlcConnectionCloseResult

func NewDefaultPlcConnectionCloseResultWithTraces

func NewDefaultPlcConnectionCloseResultWithTraces(connection plc4go.PlcConnection, err error, traces []tracer.TraceEntry) plc4go.PlcConnectionCloseResult

func NewDefaultPlcConnectionPingResult

func NewDefaultPlcConnectionPingResult(err error) plc4go.PlcConnectionPingResult

func WithCustomMessageHandler

func WithCustomMessageHandler(customMessageHandler CustomMessageHandler) options.WithOption

func WithDefaultTtl

func WithDefaultTtl(defaultTtl time.Duration) options.WithOption

WithDefaultTtl ttl is time.Second * 10 by default

func WithPlcTagHandler

func WithPlcTagHandler(tagHandler spi.PlcTagHandler) options.WithOption

func WithPlcValueHandler

func WithPlcValueHandler(plcValueHandler spi.PlcValueHandler) options.WithOption

Types

type CustomMessageHandler

type CustomMessageHandler func(codec DefaultCodecRequirements, message spi.Message) bool

type DefaultBrowser

type DefaultBrowser interface {
	spi.PlcBrowser
}

func NewDefaultBrowser

func NewDefaultBrowser(defaultBrowserRequirements DefaultBrowserRequirements, _options ...options.WithOption) DefaultBrowser

type DefaultBrowserRequirements

type DefaultBrowserRequirements interface {
	BrowseQuery(ctx context.Context, interceptor func(result apiModel.PlcBrowseItem) bool, queryName string, query apiModel.PlcQuery) (apiModel.PlcResponseCode, []apiModel.PlcBrowseItem)
}

DefaultBrowserRequirements adds required methods to Browser that are needed when using DefaultBrowser

type DefaultCodec

DefaultCodec is a default codec implementation which has so sensitive defaults for message handling and a built-in worker

func NewDefaultCodec

func NewDefaultCodec(requirements DefaultCodecRequirements, transportInstance transports.TransportInstance, options ...options.WithOption) DefaultCodec

NewDefaultCodec is the factory for a DefaultCodec

type DefaultCodecRequirements

type DefaultCodecRequirements interface {
	GetCodec() spi.MessageCodec
	Send(message spi.Message) error
	Receive() (spi.Message, error)
}

DefaultCodecRequirements adds required methods to MessageCodec that are needed when using DefaultCodec

type DefaultConnection

type DefaultConnection interface {
	utils.Serializable
	plc4go.PlcConnection
	spi.TransportInstanceExposer
	spi.HandlerExposer
	SetConnected(connected bool)
	GetTtl() time.Duration
}

DefaultConnection should be used as an embedded struct. All defined methods here have default implementations

func NewDefaultConnection

func NewDefaultConnection(requirements DefaultConnectionRequirements, options ...options.WithOption) DefaultConnection

NewDefaultConnection is the factory for a DefaultConnection

type DefaultConnectionMetadata

type DefaultConnectionMetadata struct {
	ConnectionAttributes map[string]string
	ProvidesReading      bool
	ProvidesWriting      bool
	ProvidesSubscribing  bool
	ProvidesBrowsing     bool
}

DefaultConnectionMetadata implements the model.PlcConnectionMetadata interface

func (*DefaultConnectionMetadata) CanBrowse

func (m *DefaultConnectionMetadata) CanBrowse() bool

func (*DefaultConnectionMetadata) CanRead

func (m *DefaultConnectionMetadata) CanRead() bool

func (*DefaultConnectionMetadata) CanSubscribe

func (m *DefaultConnectionMetadata) CanSubscribe() bool

func (*DefaultConnectionMetadata) CanWrite

func (m *DefaultConnectionMetadata) CanWrite() bool

func (*DefaultConnectionMetadata) GetConnectionAttributes

func (m *DefaultConnectionMetadata) GetConnectionAttributes() map[string]string

func (*DefaultConnectionMetadata) Serialize

func (d *DefaultConnectionMetadata) Serialize() ([]byte, error)

func (*DefaultConnectionMetadata) SerializeWithWriteBuffer

func (d *DefaultConnectionMetadata) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*DefaultConnectionMetadata) String

func (d *DefaultConnectionMetadata) String() string

type DefaultConnectionRequirements

type DefaultConnectionRequirements interface {
	// GetConnection should return the implementing connection when using DefaultConnection
	GetConnection() plc4go.PlcConnection
	// GetMessageCodec should return the spi.MessageCodec in use
	GetMessageCodec() spi.MessageCodec
	// ConnectWithContext is declared here for Connect redirection
	ConnectWithContext(ctx context.Context) <-chan plc4go.PlcConnectionConnectResult
}

DefaultConnectionRequirements defines the required at a implementing connection when using DefaultConnection additional options can be set using the functions returning WithOption (e.g. WithDefaultTtl, WithPlcTagHandler...)

type DefaultDriver

type DefaultDriver interface {
	fmt.Stringer
	plc4go.PlcDriver
	spi.PlcDiscoverer
	GetPlcTagHandler() spi.PlcTagHandler
}

func NewDefaultDriver

func NewDefaultDriver(defaultDriverRequirements DefaultDriverRequirements, protocolCode string, protocolName string, defaultTransport string, plcTagHandler spi.PlcTagHandler) DefaultDriver

type DefaultDriverRequirements

type DefaultDriverRequirements interface {
	GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, driverOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult
	DiscoverWithContext(callback context.Context, event func(event apiModel.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error
}

type DefaultPlcConnectionCloseResult

type DefaultPlcConnectionCloseResult interface {
	plc4go.PlcConnectionCloseResult
	GetTraces() []tracer.TraceEntry
}

type DefaultPlcConnectionConnectResult

type DefaultPlcConnectionConnectResult interface {
	plc4go.PlcConnectionConnectResult
}

func NewDefaultPlcConnectionConnectResult

func NewDefaultPlcConnectionConnectResult(connection plc4go.PlcConnection, err error) DefaultPlcConnectionConnectResult

type DefaultPlcConnectionPingResult

type DefaultPlcConnectionPingResult interface {
	plc4go.PlcConnectionPingResult
}

type Expectation deprecated

type Expectation interface {
	spi.Expectation
}

Deprecated: don't use it in productive code

type Message deprecated

type Message interface {
	spi.Message
}

Deprecated: don't use it in productive code

type MessageCodec deprecated

type MessageCodec interface {
	spi.MessageCodec
	spi.TransportInstanceExposer
}

Deprecated: don't use it in productive code

type PlcConnection deprecated

type PlcConnection interface {
	plc4go.PlcConnection
}

Deprecated: don't use it in productive code

type PlcConnectionConnectResult deprecated

type PlcConnectionConnectResult interface {
	plc4go.PlcConnectionConnectResult
}

Deprecated: don't use it in productive code

type PlcQuery deprecated

type PlcQuery interface {
	apiModel.PlcQuery
}

Deprecated: don't use it in productive code

type PlcTagHandler deprecated

type PlcTagHandler interface {
	spi.PlcTagHandler
}

Deprecated: don't use it in productive code

type TransportInstance deprecated

type TransportInstance interface {
	transports.TransportInstance
}

Deprecated: don't use it in productive code

Jump to

Keyboard shortcuts

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