Documentation
¶
Index ¶
- Constants
- func NewDriver(_options ...options.WithOption) plc4go.PlcDriver
- func NewLogixDriver(_options ...options.WithOption) plc4go.PlcDriver
- type Configuration
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) Connect(ctx context.Context) error
- func (c *Connection) GetConnection() plc4go.PlcConnection
- func (c *Connection) GetConnectionId() string
- func (c *Connection) GetMessageCodec() spi.MessageCodec
- func (c *Connection) GetMetadata() apiModel.PlcConnectionMetadata
- func (c *Connection) GetTracer() tracer.Tracer
- func (c *Connection) IsTraceEnabled() bool
- func (c *Connection) ReadRequestBuilder() apiModel.PlcReadRequestBuilder
- func (c *Connection) String() string
- func (c *Connection) WriteRequestBuilder() apiModel.PlcWriteRequestBuilder
- type Discoverer
- type Driver
- func (d *Driver) Close() error
- func (d *Driver) Discover(ctx context.Context, callback func(event apiModel.PlcDiscoveryItem), ...) error
- func (d *Driver) GetConnection(ctx context.Context, transportUrl url.URL, ...) (plc4go.PlcConnection, error)
- func (d *Driver) SetAwaitDisconnectComplete(awaitComplete bool)
- func (d *Driver) SetAwaitSetupComplete(awaitComplete bool)
- func (d *Driver) SupportsDiscovery() bool
- type DriverContext
- type MessageCodec
- func (m *MessageCodec) GetCodec() spi.MessageCodec
- func (m *MessageCodec) Receive(ctx context.Context) (spi.Message, error)
- func (m *MessageCodec) Send(ctx context.Context, interactionInfo string, message spi.Message) error
- func (d *MessageCodec) Serialize() ([]byte, error)
- func (d *MessageCodec) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error
- func (d *MessageCodec) String() string
- type PlcTag
- type Reader
- type SessionState
- type TagHandler
- type ValueHandler
- type Writer
Constants ¶
const ( DefaultSenderContext = "PLC4X " EmptySessionHandle = uint32(0) EmptyInterfaceHandle = uint32(0) )
const ( TAG = "tag" DATA_TYPE = "dataType" ARRAY = "array" )
const EipUdpDiscoveryDefaultPort = 44818
EipUdpDiscoveryDefaultPort is the UDP port EIP/CIP devices listen on for ListIdentity broadcast discovery requests (mirrors plc4j's Constants.EIPUDPDISCOVERYDEFAULTPORT).
Variables ¶
This section is empty.
Functions ¶
func NewDriver ¶
func NewDriver(_options ...options.WithOption) plc4go.PlcDriver
func NewLogixDriver ¶
func NewLogixDriver(_options ...options.WithOption) plc4go.PlcDriver
NewLogixDriver is a thin alias over the EIP driver that registers the "logix" protocol code and forces little-endian wire encoding - the Logix family always speaks LE on CIP, whereas generic EIP devices may go either way (mirror of plc4j's LogixDriver).
Types ¶
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
func ParseFromOptions ¶
type Connection ¶
type Connection struct {
_default.DefaultConnection
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection( messageCodec spi.MessageCodec, configuration Configuration, driverContext DriverContext, tagHandler spi.PlcTagHandler, tm transactions.RequestTransactionManager, connectionOptions map[string][]string, _options ...options.WithOption, ) *Connection
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) GetConnection ¶
func (c *Connection) GetConnection() plc4go.PlcConnection
func (*Connection) GetConnectionId ¶
func (c *Connection) GetConnectionId() string
func (*Connection) GetMessageCodec ¶
func (c *Connection) GetMessageCodec() spi.MessageCodec
func (*Connection) GetMetadata ¶
func (c *Connection) GetMetadata() apiModel.PlcConnectionMetadata
func (*Connection) GetTracer ¶
func (c *Connection) GetTracer() tracer.Tracer
func (*Connection) IsTraceEnabled ¶
func (c *Connection) IsTraceEnabled() bool
func (*Connection) ReadRequestBuilder ¶
func (c *Connection) ReadRequestBuilder() apiModel.PlcReadRequestBuilder
func (*Connection) String ¶
func (c *Connection) String() string
func (*Connection) WriteRequestBuilder ¶
func (c *Connection) WriteRequestBuilder() apiModel.PlcWriteRequestBuilder
type Discoverer ¶
type Discoverer struct {
// contains filtered or unexported fields
}
func NewDiscoverer ¶
func NewDiscoverer(_options ...options.WithOption) *Discoverer
func (*Discoverer) Close ¶
func (d *Discoverer) Close() error
func (*Discoverer) Discover ¶
func (d *Discoverer) Discover(ctx context.Context, callback func(event apiModel.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error
type Driver ¶
type Driver struct {
_default.DefaultDriver
// contains filtered or unexported fields
}
func (*Driver) Discover ¶
func (d *Driver) Discover(ctx context.Context, callback func(event apiModel.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error
func (*Driver) GetConnection ¶
func (*Driver) SetAwaitDisconnectComplete ¶
func (*Driver) SetAwaitSetupComplete ¶
func (*Driver) SupportsDiscovery ¶
type DriverContext ¶
func NewDriverContext ¶
func NewDriverContext(configuration Configuration) (DriverContext, error)
type MessageCodec ¶
type MessageCodec struct {
_default.DefaultCodec
// contains filtered or unexported fields
}
func NewMessageCodec ¶
func NewMessageCodec(transportInstance transports.TransportInstance, byteOrder binary.ByteOrder, _options ...options.WithOption) *MessageCodec
func (*MessageCodec) GetCodec ¶
func (m *MessageCodec) GetCodec() spi.MessageCodec
func (*MessageCodec) Serialize ¶
func (d *MessageCodec) Serialize() ([]byte, error)
func (*MessageCodec) SerializeWithWriteBuffer ¶
func (d *MessageCodec) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error
func (*MessageCodec) String ¶
func (d *MessageCodec) String() string
type PlcTag ¶
type PlcTag interface {
apiModel.PlcTag
utils.Serializable
GetTag() string
GetType() readWriteModel.CIPDataTypeCode
GetElementNb() uint16
// GetSelection reports what the address selects, which drives the CIP path and the element
// count. It is not what GetArrayInfo reports - see there.
GetSelection() []apiModel.ArrayInfo
}
func NewTag ¶
func NewTag(tag string, _type readWriteModel.CIPDataTypeCode, elementNb uint16) PlcTag
NewTag builds a tag selecting elementNb elements from the start of tag, which is the shape the element-count form described. An address selecting a range is built with NewTagWithSelection.
func NewTagWithSelection ¶
func NewTagWithSelection(tag string, _type readWriteModel.CIPDataTypeCode, selection []apiModel.ArrayInfo) PlcTag
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewReader ¶
func NewReader(messageCodec spi.MessageCodec, tm transactions.RequestTransactionManager, configuration Configuration, sessionState *SessionState, _options ...options.WithOption) *Reader
func (*Reader) Read ¶
func (m *Reader) Read(ctx context.Context, readRequest apiModel.PlcReadRequest) <-chan apiModel.PlcReadRequestResult
type SessionState ¶
type SessionState struct {
// contains filtered or unexported fields
}
SessionState is the per-connection EIP/CIP session context shared between the Connection (which fills it during the handshake) and Reader/Writer (which pick the messaging mode and addressing from it).
func NewSessionState ¶
func NewSessionState(log zerolog.Logger, configuration Configuration) *SessionState
type TagHandler ¶
type TagHandler struct {
// contains filtered or unexported fields
}
func NewTagHandler ¶
func NewTagHandler() TagHandler
func (TagHandler) ParseQuery ¶
func (m TagHandler) ParseQuery(query string) (apiModel.PlcQuery, error)
type ValueHandler ¶
type ValueHandler struct {
spiValues.DefaultValueHandler
}
func NewValueHandler ¶
func NewValueHandler(_options ...options.WithOption) ValueHandler
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func NewWriter ¶
func NewWriter(messageCodec spi.MessageCodec, tm transactions.RequestTransactionManager, configuration Configuration, sessionState *SessionState, _options ...options.WithOption) *Writer
func (*Writer) Write ¶
func (m *Writer) Write(ctx context.Context, writeRequest apiModel.PlcWriteRequest) <-chan apiModel.PlcWriteRequestResult