s7

package
v0.0.0-...-2d02f19 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ControllerType_UNKNOWN = -0x1
	ControllerType_ANY     = 0x0
	ControllerType_S7_200  = 0x5
	ControllerType_S7_300  = 0x1
	ControllerType_S7_400  = 0x2
	ControllerType_S7_1200 = 0x3
	ControllerType_S7_1500 = 0x4
)
View Source
const (
	DATA_TYPE          = "dataType"
	STRING_LENGTH      = "stringLength"
	TRANSFER_SIZE_CODE = "transferSizeCode"
	BLOCK_NUMBER       = "blockNumber"
	BYTE_OFFSET        = "byteOffset"
	BIT_OFFSET         = "bitOffset"
	NUM_ELEMENTS       = "numElements"
	MEMORY_AREA        = "memoryArea"
)

Variables

This section is empty.

Functions

func NewDriver

func NewDriver(_options ...options.WithOption) plc4go.PlcDriver

Types

type Configuration

type Configuration struct {
	// contains filtered or unexported fields
}

func ParseFromOptions

func ParseFromOptions(localLog zerolog.Logger, options map[string][]string) (Configuration, error)

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) ConnectWithContext

func (c *Connection) ConnectWithContext(ctx context.Context) <-chan plc4go.PlcConnectionConnectResult

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 ControllerType

type ControllerType int

type Driver

type Driver struct {
	_default.DefaultDriver
	// contains filtered or unexported fields
}

func (*Driver) Close

func (d *Driver) Close() error

func (*Driver) GetConnectionWithContext

func (d *Driver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, driverOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult

func (*Driver) SetAwaitDisconnectComplete

func (d *Driver) SetAwaitDisconnectComplete(awaitComplete bool)

func (*Driver) SetAwaitSetupComplete

func (d *Driver) SetAwaitSetupComplete(awaitComplete bool)

type DriverContext

type DriverContext struct {
	PassiveMode    bool
	CallingTsapId  uint16
	CalledTsapId   uint16
	CotpTpduSize   model.COTPTpduSize
	PduSize        uint16
	MaxAmqCaller   uint16
	MaxAmqCallee   uint16
	ControllerType ControllerType
	// contains filtered or unexported fields
}

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, _options ...options.WithOption) *MessageCodec

func (*MessageCodec) GetCodec

func (m *MessageCodec) GetCodec() spi.MessageCodec

func (*MessageCodec) Receive

func (m *MessageCodec) Receive() (spi.Message, error)

func (*MessageCodec) Send

func (m *MessageCodec) Send(message spi.Message) error

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 PlcStringTag

type PlcStringTag struct {
	// contains filtered or unexported fields
}

func NewStringTag

func NewStringTag(memoryArea readWriteModel.MemoryArea, blockNumber uint16, byteOffset uint16, bitOffset uint8, numElements uint16, stringLength uint16, datatype readWriteModel.TransportSize) PlcStringTag

func (PlcStringTag) GetAddressString

func (m PlcStringTag) GetAddressString() string

func (PlcStringTag) GetArrayInfo

func (m PlcStringTag) GetArrayInfo() []apiModel.ArrayInfo

func (PlcStringTag) GetBitOffset

func (m PlcStringTag) GetBitOffset() uint8

func (PlcStringTag) GetBlockNumber

func (m PlcStringTag) GetBlockNumber() uint16

func (PlcStringTag) GetByteOffset

func (m PlcStringTag) GetByteOffset() uint16

func (PlcStringTag) GetDataType

func (m PlcStringTag) GetDataType() readWriteModel.TransportSize

func (PlcStringTag) GetMemoryArea

func (m PlcStringTag) GetMemoryArea() readWriteModel.MemoryArea

func (PlcStringTag) GetNumElements

func (m PlcStringTag) GetNumElements() uint16

func (PlcStringTag) GetQuantity

func (m PlcStringTag) GetQuantity() uint16

func (PlcStringTag) GetValueType

func (m PlcStringTag) GetValueType() apiValues.PlcValueType

func (PlcStringTag) Serialize

func (m PlcStringTag) Serialize() ([]byte, error)

func (PlcStringTag) SerializeWithWriteBuffer

func (m PlcStringTag) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (PlcStringTag) String

func (m PlcStringTag) String() string

type PlcTag

type PlcTag interface {
	apiModel.PlcTag
	utils.Serializable

	GetDataType() readWriteModel.TransportSize
	GetNumElements() uint16
	GetBlockNumber() uint16
	GetMemoryArea() readWriteModel.MemoryArea
	GetByteOffset() uint16
	GetBitOffset() uint8
}

func NewTag

func NewTag(memoryArea readWriteModel.MemoryArea, blockNumber uint16, byteOffset uint16, bitOffset uint8, numElements uint16, datatype readWriteModel.TransportSize) PlcTag

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(tpduGenerator *TpduGenerator, messageCodec spi.MessageCodec, tm transactions.RequestTransactionManager, _options ...options.WithOption) *Reader

func (*Reader) Read

func (m *Reader) Read(ctx context.Context, readRequest apiModel.PlcReadRequest) <-chan apiModel.PlcReadRequestResult

func (*Reader) ToPlc4xReadResponse

func (m *Reader) ToPlc4xReadResponse(response readWriteModel.S7Message, readRequest apiModel.PlcReadRequest) (apiModel.PlcReadResponse, error)

type TagHandler

type TagHandler struct {
	// contains filtered or unexported fields
}

func NewTagHandler

func NewTagHandler(_options ...options.WithOption) TagHandler

func (TagHandler) ParseQuery

func (m TagHandler) ParseQuery(query string) (apiModel.PlcQuery, error)

func (TagHandler) ParseTag

func (m TagHandler) ParseTag(tagAddress string) (apiModel.PlcTag, error)

type TagType

type TagType uint8
const (
	S7Tag       TagType = 0x00
	S7StringTag TagType = 0x01
)

func (TagType) GetName

func (i TagType) GetName() string

func (TagType) String

func (i TagType) String() string

type TpduGenerator

type TpduGenerator struct {
	// contains filtered or unexported fields
}

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(tpduGenerator *TpduGenerator, messageCodec spi.MessageCodec, tm transactions.RequestTransactionManager, _options ...options.WithOption) Writer

func (Writer) ToPlc4xWriteResponse

func (m Writer) ToPlc4xWriteResponse(response readWriteModel.S7Message, writeRequest apiModel.PlcWriteRequest) (apiModel.PlcWriteResponse, error)

func (Writer) Write

func (m Writer) Write(ctx context.Context, writeRequest apiModel.PlcWriteRequest) <-chan apiModel.PlcWriteRequestResult

Jump to

Keyboard shortcuts

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