Documentation
¶
Index ¶
- Constants
- func ByteSize(dataType string) int
- func NewProfinetIODriver() driver.Driver
- type ParsedAddress
- type ProfinetDecoder
- type ProfinetIODriver
- func (d *ProfinetIODriver) Connect(ctx context.Context) error
- func (d *ProfinetIODriver) Disconnect() error
- func (d *ProfinetIODriver) GetConnectionMetrics() (connectionSeconds int64, reconnectCount int64, localAddr string, ...)
- func (d *ProfinetIODriver) GetMetrics() model.ChannelMetrics
- func (d *ProfinetIODriver) Health() driver.HealthStatus
- func (d *ProfinetIODriver) Init(cfg model.DriverConfig) error
- func (d *ProfinetIODriver) ReadPoints(ctx context.Context, points []model.Point) (map[string]model.Value, error)
- func (d *ProfinetIODriver) SetDeviceConfig(config map[string]any) error
- func (d *ProfinetIODriver) SetSlaveID(_ uint8) error
- func (d *ProfinetIODriver) WritePoint(ctx context.Context, p model.Point, value any) error
- type ProfinetScheduler
- type ProfinetTransport
- func (t *ProfinetTransport) Connect(ctx context.Context) error
- func (t *ProfinetTransport) Disconnect() error
- func (t *ProfinetTransport) GetConnectionMetrics() (connectionSeconds int64, reconnectCount int64, localAddr string, ...)
- func (t *ProfinetTransport) IsConnected() bool
- func (t *ProfinetTransport) ReadIO(ctx context.Context, slot, subslot, index, length int) ([]byte, error)
- func (t *ProfinetTransport) RecordSuccess()
- func (t *ProfinetTransport) SetDeviceConfig(cfg deviceConfig)
- func (t *ProfinetTransport) WriteIO(ctx context.Context, slot, subslot, index int, data []byte) error
Constants ¶
View Source
const ( EndianBig = "BE" EndianLittle = "LE" )
Endian constants for address suffix #ENDIAN.
Variables ¶
This section is empty.
Functions ¶
func NewProfinetIODriver ¶
Types ¶
type ParsedAddress ¶
type ParsedAddress struct {
Slot int
SubSlot int
Index int
Bit int // -1 when not a bit address
Endian string
IsBit bool
}
ParsedAddress represents SLOT:SUB_SLOT:INDEX[.BIT][#ENDIAN].
func ParseAddress ¶
func ParseAddress(addr string) (*ParsedAddress, error)
ParseAddress parses Profinet IO point address format.
type ProfinetDecoder ¶
type ProfinetDecoder struct{}
ProfinetDecoder encodes/decodes IO data by datatype and endianness.
func NewProfinetDecoder ¶
func NewProfinetDecoder() *ProfinetDecoder
func (*ProfinetDecoder) DecodeValue ¶
func (d *ProfinetDecoder) DecodeValue(data []byte, dataType string, addr *ParsedAddress) (any, error)
func (*ProfinetDecoder) EncodeValue ¶
func (d *ProfinetDecoder) EncodeValue(value any, dataType string, addr *ParsedAddress) ([]byte, error)
type ProfinetIODriver ¶
type ProfinetIODriver struct {
// contains filtered or unexported fields
}
ProfinetIODriver implements PROFINET IO acyclic read/write as IO-Controller.
func (*ProfinetIODriver) Disconnect ¶
func (d *ProfinetIODriver) Disconnect() error
func (*ProfinetIODriver) GetConnectionMetrics ¶
func (*ProfinetIODriver) GetMetrics ¶
func (d *ProfinetIODriver) GetMetrics() model.ChannelMetrics
func (*ProfinetIODriver) Health ¶
func (d *ProfinetIODriver) Health() driver.HealthStatus
func (*ProfinetIODriver) Init ¶
func (d *ProfinetIODriver) Init(cfg model.DriverConfig) error
func (*ProfinetIODriver) ReadPoints ¶
func (*ProfinetIODriver) SetDeviceConfig ¶
func (d *ProfinetIODriver) SetDeviceConfig(config map[string]any) error
func (*ProfinetIODriver) SetSlaveID ¶
func (d *ProfinetIODriver) SetSlaveID(_ uint8) error
func (*ProfinetIODriver) WritePoint ¶
type ProfinetScheduler ¶
type ProfinetScheduler struct {
// contains filtered or unexported fields
}
ProfinetScheduler reads/writes points via transport and decoder.
func NewProfinetScheduler ¶
func NewProfinetScheduler(transport *ProfinetTransport, decoder *ProfinetDecoder) *ProfinetScheduler
func (*ProfinetScheduler) GetStats ¶
func (s *ProfinetScheduler) GetStats() (total, success, failure int64)
func (*ProfinetScheduler) ReadPoints ¶
func (*ProfinetScheduler) WritePoint ¶
type ProfinetTransport ¶
type ProfinetTransport struct {
// contains filtered or unexported fields
}
ProfinetTransport manages TCP connection to IO devices.
func NewProfinetTransport ¶
func NewProfinetTransport(channelCfg channelConfig) *ProfinetTransport
func (*ProfinetTransport) Disconnect ¶
func (t *ProfinetTransport) Disconnect() error
func (*ProfinetTransport) GetConnectionMetrics ¶
func (*ProfinetTransport) IsConnected ¶
func (t *ProfinetTransport) IsConnected() bool
func (*ProfinetTransport) RecordSuccess ¶
func (t *ProfinetTransport) RecordSuccess()
func (*ProfinetTransport) SetDeviceConfig ¶
func (t *ProfinetTransport) SetDeviceConfig(cfg deviceConfig)
Click to show internal directories.
Click to hide internal directories.