ads

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 16 Imported by: 0

README

ADS Go

Go Reference

ci

This is a library to interact with Beckhoff ADS/AMS systems.

Usage

There's an example TwinCAT3 project in PLCTestProject and several examples in the examples folder.

import (
	ads "github.com/expo21xx/go-ads"
)

client, err := ads.NewClient("192.168.0.5", "192.168.0.5.1.1", ads.AMSPortR0PLCTC3, ads.WithLoadSymbolsOnStart())
if err != nil {
    log.Fatal(err)
}
defer client.Close(context.Background())

err = client.Connect(context.Background())
if err != nil {
    log.Fatal(err)
}

adsState, deviceState, err := client.ReadState(context.Background())
if err != nil {
    log.Fatal(err)
}
fmt.Printf("ADSState: %x | DeviceState: %x\n", adsState, deviceState)

Symbols

The easiest way to work with the data is by the symbol name. These can either be dynamically loaded (and watched for changes) or statically loaded from a .tpy file. These are NOT mutually exclusive, but loading symbols at runtime will override any static symbols with the same name.

Creating a client with ads.WithLoadSymbolsOnStart() will load the symbols from the server automatically after connecting.

client, err := ads.NewClient("192.168.0.5", "192.168.0.5.1.1", ads.AMSPortR0PLCTC3, ads.WithLoadSymbolsOnStart())

Creating a client with ads.WithMonitorSymbols() will create a device notification that will download the new symbols whenever a new version is available.

client, err := ads.NewClient("192.168.0.5", "192.168.0.5.1.1", ads.AMSPortR0PLCTC3, ads.WithMonitorSymbols())

Loading symbols from a .tpy file can be done using

client, err := ads.NewClient(...)

file, err := os.Open("/path/to/tpy/file")
defer file.Close()
if err != nil {
    log.Fatal(err)
}

err = client.LoadTPYData(file, false) // set to true to load routing information

If the second parameter is set to true and the .tpy file contains routing information, the client will use the routing information (AMS Net ID and Port) from the file.

Symbols can also be downloaded on demand with the FetchSymbols function:

client, err := ads.NewClient(...)
err = client.FetchSymbols(context.Background())

Documentation

Index

Constants

View Source
const (
	ADSStateInvalid      = 0
	ADSStateidle         = 1
	ADSStatereset        = 2
	ADSStateInit         = 3
	ADSStateStart        = 4
	ADSStateRun          = 5
	ADSStateStop         = 6
	ADSStateSavecfg      = 7
	ADSStateLoadcfg      = 8
	ADSStatePowerfailure = 9
	ADSStatePowergood    = 10
	ADSStateError        = 11
	ADSStateShutdown     = 12
	ADSStateSuspend      = 13
	ADSStateResume       = 14
	// system is in config mode
	ADSStateConfig = 15
	// system should restart in config mode
	ADSStateReconfig  = 16
	ADSStateMaxstates = 17
)

From the C++ API https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_adsdll2/index.html&id=4279787267115190858

View Source
const (
	ADSTransNoTrans     = 0
	ADSTransClientCycle = 1
	ADSTransClient1Req  = 2
	ADSTransServerCycle = 3
	ADSTransServerOnCha = 4
)

From the C++ API https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_adsdll2/index.html&id=4279787267115190858

View Source
const (
	// CommandInvalid .
	CommandInvalid = 0x0000

	// CommandADSReadDeviceInfo .
	CommandADSReadDeviceInfo = 0x0001

	// CommandADSRead .
	CommandADSRead = 0x0002

	// CommandADSWrite .
	CommandADSWrite = 0x0003

	// CommandADSReadState .
	CommandADSReadState = 0x0004

	// CommandADSWriteControl .
	CommandADSWriteControl = 0x0005

	// CommandADSAddDeviceNotification .
	CommandADSAddDeviceNotification = 0x0006

	// CommandADSDeletDeviceNotification .
	CommandADSDeletDeviceNotification = 0x0007

	// CommandADSDeviceNotification .
	CommandADSDeviceNotification = 0x0008

	// CommandADSReadWrite .
	CommandADSReadWrite = 0x0009
)
View Source
const (
	// ADSErrNoError (ERR_NOERROR): No error.
	ADSErrNoError = 0x00

	// ADSErrInternal (ERR_INTERNAL): Internal error.
	ADSErrInternal = 0x1

	// ADSErrTargetPortNotFound (ERR_TARGETPORTNOTFOUND): Target port not found – ADS server is not started or is not reachable.
	ADSErrTargetPortNotFound = 0x6

	// Invalid AMS port.
	ADSErrInvalidAMSPort = 0x18

	// ADSErrNOIO (ERR_NOIO): No IO.
	ADSErrNOIO = 0xA

	// Error class < device error >
	ADSErrDeviceError = (0x00 + errADSErrs)

	// Service is not supported by server
	ADSErrDeviceSrvNotSupp = (0x01 + errADSErrs)

	// invalid indexGroup
	ADSErrDeviceInvalidGrp = (0x02 + errADSErrs)

	// invalid indexOffset
	ADSErrDeviceInvaliIoffset = (0x03 + errADSErrs)

	// reading/writing not permitted
	ADSErrDeviceInvalidAccess = (0x04 + errADSErrs)

	// parameter size not correct
	ADSErrDeviceInvalidSize = (0x05 + errADSErrs)

	// invalid parameter value(s)
	ADSErrDeviceInvalidData = (0x06 + errADSErrs)

	// device is not in a ready state
	ADSErrDeviceNotReady = (0x07 + errADSErrs)

	// device is busy
	ADSErrDeviceBusy = (0x08 + errADSErrs)

	// invalid context (must be InWindows)
	ADSErrDeviceInvalidcontext = (0x09 + errADSErrs)

	// invalid parameter value(s)ut of memory
	ADSErrDeviceNoMemory = (0x0A + errADSErrs)

	// invalid parameter value(s)
	ADSErrDeviceInvalidParm = (0x0B + errADSErrs)

	// not found (files, ...)
	ADSErrDeviceNotFound = (0x0C + errADSErrs)

	// syntax error in comand or file
	ADSErrDeviceSyntax = (0x0D + errADSErrs)

	// objects do not match
	ADSErrDeviceIncompatible = (0x0E + errADSErrs)

	// object already exists
	ADSErrDeviceExists = (0x0F + errADSErrs)

	// symbol not found
	ADSErrDeviceSymbolNotFound = (0x10 + errADSErrs)

	// symbol version invalid, possibly caused by an 'onlinechange' -> try to release handle and get a new one
	ADSErrDeviceSymbolVersionInvalid = (0x11 + errADSErrs)

	// server is in invalid state*/
	ADSErrDeviceInvalidState = (0x12 + errADSErrs)

	// AdsTransMode not supported
	ADSErrDeviceTransmodeNotSupp = (0x13 + errADSErrs)

	// Notification handle is invalid, possibly caussed by an 'onlinechange' -> try to release handle and get a new one
	ADSErrDeviceNotifyHndInvalid = (0x14 + errADSErrs)

	// Notification client not registered*/
	ADSErrDeviceClientUnknown = (0x15 + errADSErrs)

	// no more notification handles
	ADSErrDeviceNomoreHdls = (0x16 + errADSErrs)

	// size for watch to big
	ADSErrDeviceInvalidWatchSize = (0x17 + errADSErrs)

	// device not initialized
	ADSErrDeviceNotInit = (0x18 + errADSErrs)

	// device has a timeout
	ADSErrDeviceTimeout = (0x19 + errADSErrs)

	// query interface failed
	ADSErrDeviceNoInterface = (0x1A + errADSErrs)

	// wrong interface required
	ADSErrDeviceInvalidInterface = (0x1B + errADSErrs)

	// class ID is invalid
	ADSErrDeviceInvalidClsID = (0x1C + errADSErrs)

	// object ID is invalid
	ADSErrDeviceInvalidObjID = (0x1D + errADSErrs)

	// request is pending
	ADSErrDevicePending = (0x1E + errADSErrs)

	// request is aborted
	ADSErrDeviceAborted = (0x1F + errADSErrs)

	// signal warningequest is aborted
	ADSErrDeviceWarning = (0x20 + errADSErrs)

	// invalid array index
	ADSErrDeviceInvalidArrayIdx = (0x21 + errADSErrs)

	// symbol not active, possibly caussed by an 'onlinechange' -> try to release handle and get a new one
	ADSErrDeviceSymbolNotActive = (0x22 + errADSErrs)

	// access denied
	ADSErrDeviceAccessDenied = (0x23 + errADSErrs)

	// no license found -> Activate license for TwinCAT 3 function
	ADSErrDeviceLicenseNotFound = (0x24 + errADSErrs)

	// license expired
	ADSErrDeviceLicenseExpired = (0x25 + errADSErrs)

	// license exceeded
	ADSErrDeviceLicenseExceeded = (0x26 + errADSErrs)

	// license invalid
	ADSErrDeviceLicenseInvalid = (0x27 + errADSErrs)

	// license invalid system id
	ADSErrDeviceLicenseSystemID = (0x28 + errADSErrs)

	// license not time limited
	ADSErrDeviceLicenseNoTimeLimit = (0x29 + errADSErrs)

	// license issue time in the future
	ADSErrDeviceLicenseFutureIssue = (0x2A + errADSErrs)

	// license time period to long
	ADSErrDeviceLicenseTimeToLong = (0x2B + errADSErrs)

	// exception in device specific code -> Check each device transistions
	ADSErrDeviceException = (0x2C + errADSErrs)

	// license file read twice
	ADSErrDeviceLicenseDuplicated = (0x2D + errADSErrs)

	// invalid signature
	ADSErrDeviceSignatureInvalid = (0x2E + errADSErrs)

	// public key certificate
	ADSErrDeviceCertificateInvalid = (0x2F + errADSErrs)

	// Error class < client error >
	ADSErrClientError = (0x40 + errADSErrs)

	// invalid parameter at service call
	ADSErrClientInvalidParm = (0x41 + errADSErrs)

	// callling list is empty
	ADSErrClientListEmpty = (0x42 + errADSErrs)

	// var connection already in use
	ADSErrClientVarUsed = (0x43 + errADSErrs)

	// invoke id in use
	ADSErrClientduplInvokeID = (0x44 + errADSErrs)

	// timeout elapsed -> Check ADS routes of sender and receiver and your [firewall setting](http://infosys.beckhoff.com/content/1033/tcremoteaccess/html/tcremoteaccess_firewall.html?id=12027)
	ADSErrClientSyncTimeout = (0x45 + errADSErrs)

	// error in win32 subsystem
	ADSErrClientW32Error = (0x46 + errADSErrs)

	// invalid client timeout value
	ADSErrClientTimeoutInvalid = (0x47 + errADSErrs)

	// ads dll
	ADSErrClientportNotOpen = (0x48 + errADSErrs)

	// ads dll
	ADSErrClientNoAMSAddr = (0x49 + errADSErrs)

	// Internal error in ads sync
	ADSErrClientSyncInternal = (0x50 + errADSErrs)

	// hash table overflow
	ADSErrClientAddHash = (0x51 + errADSErrs)

	// key not found in hash table
	ADSErrClientRemoveHash = (0x52 + errADSErrs)

	// no more symbols in cache
	ADSErrClientNoMoreSym = (0x53 + errADSErrs)

	// invalid response received
	ADSErrClientSyncResInvalid = (0x54 + errADSErrs)

	// sync port is locked
	ADSErrClientSyncPortLocked = (0x55 + errADSErrs)
)

From https://github.com/Beckhoff/ADS/blob/master/AdsLib/standalone/AdsDef.h

View Source
const (
	ADSIndexGroupSymtab  uint32 = 0xF000
	ADSIndexGroupSymname uint32 = 0xF001
	ADSIndexGroupSymval  uint32 = 0xF002

	ADSIndexGroupSymHndByName    uint32 = 0xF003
	ADSIndexGroupSymValByName    uint32 = 0xF004
	ADSIndexGroupSymValByHnd     uint32 = 0xF005
	ADSIndexGroupSymReleaseHnd   uint32 = 0xF006
	ADSIndexGroupSymInfoByName   uint32 = 0xF007
	ADSIndexGroupSymVersion      uint32 = 0xF008
	ADSIndexGroupSymInfoByNameEx uint32 = 0xF009

	ADSIndexGroupSymDownload    uint32 = 0xF00A
	ADSIndexGroupSymUpload      uint32 = 0xF00B
	ADSIndexGroupSymUploadInfo  uint32 = 0xF00C
	ADSIndexGroupSymDownload2   uint32 = 0xF00D
	ADSIndexGroupSymDTUpload    uint32 = 0xF00E
	ADSIndexGroupSymUploadInfo2 uint32 = 0xF00F

	// notification of named handle
	ADSIndexGroupSymNote uint32 = 0xF010
)

From https://github.com/Beckhoff/ADS/blob/master/AdsLib/standalone/AdsDef.h

View Source
const (
	ADSTCPServerPort = 0xBF02 // 48898

	AMSPortLogger    = 100
	AMSPortR0RTime   = 200
	AMSPortR0Trace   = (AMSPortR0RTime + 90)
	AMSPortR0IO      = 300
	AMSPortR0SPS     = 400
	AMSPortR0NC      = 500
	AMSPortR0ISG     = 550
	AMSPortR0PCS     = 600
	AMSPortR0PLC     = 801
	AMSPortR0PLCRTS1 = 801
	AMSPortR0PLCRTS2 = 811
	AMSPortR0PLCRTS3 = 821
	AMSPortR0PLCRTS4 = 831
	AMSPortR0PLCTC3  = 851
)

From: https://github.com/Beckhoff/ADS/blob/master/AdsLib/standalone/AdsDef.h

Variables

This section is empty.

Functions

func CommandIDToString

func CommandIDToString(cmd int) string

CommandIDToString .

func ErrCodeToString

func ErrCodeToString(c uint32) string

ErrCodeToString .

Types

type AddDeviceNotificationCmdRequest

type AddDeviceNotificationCmdRequest struct {
	// Index Group of the data, which should be sent per notification.
	IndexGroup uint32
	// Index Offset of the data, which should be sent per notification.
	IndexOffset uint32
	// Length of data in bytes, which should be sent per notification.
	Length           uint32
	TransmissionMode uint32
	// At the latest after this time, the ADS Device Notification is called. The unit is 1ms.
	MaxDelay uint32
	// The ADS server checks if the value changes in this time slice. The unit is 1ms.
	CycleTime uint32
}

AddDeviceNotificationCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id= A notification is created in an ADS device. Note: We recommend to announce not more than 550 notifications per device. Otherwise increase the payload by working with structures or use sum commands.

func (*AddDeviceNotificationCmdRequest) Bytes

Bytes .

func (*AddDeviceNotificationCmdRequest) FromBytes

func (r *AddDeviceNotificationCmdRequest) FromBytes(b []byte) error

FromBytes .

func (*AddDeviceNotificationCmdRequest) Tag

Tag .

type AddDeviceNotificationCmdResponse

type AddDeviceNotificationCmdResponse struct {
	Result             uint32
	NotificationHandle uint32
}

AddDeviceNotificationCmdResponse see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id= A notification is created in an ADS device. Note: We recommend to announce not more than 550 notifications per device. Otherwise increase the payload by working with structures or use sum commands.

type Client

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

Client is the primary way to communicate with an ADS/AMS system.

func NewClient

func NewClient(ip, netid string, port int, opts ...Option) (*Client, error)

NewClient .

func (*Client) AddDeviceNotification

func (c *Client) AddDeviceNotification(ctx context.Context, req *AddDeviceNotificationCmdRequest) (uint32, error)

AddDeviceNotification .

func (*Client) AddDeviceNotificationHandler

func (c *Client) AddDeviceNotificationHandler(ctx context.Context, req *AddDeviceNotificationCmdRequest, dt string, cb func(interface{})) (func() error, error)

AddDeviceNotificationHandler .

func (*Client) AddDeviceNotificationHandlerByName

func (c *Client) AddDeviceNotificationHandlerByName(ctx context.Context, name string, opts *DeviceNotificationOpts, cb func(interface{})) (func() error, error)

AddDeviceNotificationHandlerByName .

func (*Client) AddSymbol

func (c *Client) AddSymbol(sym Symbol)

AddSymbol .

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

Close .

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

Connect .

func (*Client) DeleteDeviceNotification

func (c *Client) DeleteDeviceNotification(ctx context.Context, handle uint32) error

DeleteDeviceNotification .

func (*Client) FetchSymbols

func (c *Client) FetchSymbols(ctx context.Context) error

FetchSymbols .

func (*Client) GetSymbol

func (c *Client) GetSymbol(name string) (Symbol, bool)

GetSymbol .

func (*Client) LoadTPYData

func (c *Client) LoadTPYData(r io.Reader, loadRoutingInfo bool) error

LoadTPYData .

func (*Client) Read

func (c *Client) Read(ctx context.Context, indexGroup uint32, indexOffset uint32, length int) ([]byte, error)

Read .

func (*Client) ReadByName

func (c *Client) ReadByName(ctx context.Context, name string) (interface{}, error)

ReadByName .

func (*Client) ReadByNameBytes

func (c *Client) ReadByNameBytes(ctx context.Context, name string, size int) ([]byte, error)

ReadByNameBytes .

func (*Client) ReadDeviceInfo

func (c *Client) ReadDeviceInfo(ctx context.Context) (*ReadDeviceInfoCmdResponse, error)

ReadDeviceInfo .

func (*Client) ReadState

func (c *Client) ReadState(ctx context.Context) (adsState uint16, deviceState uint16, err error)

ReadState .

func (*Client) ReadWrite

func (c *Client) ReadWrite(ctx context.Context, indexGroup uint32, indexOffset uint32, data []byte) ([]byte, error)

ReadWrite .

func (*Client) ReadWriteByName

func (c *Client) ReadWriteByName(ctx context.Context, name string, data []byte) (interface{}, error)

ReadWriteByName .

func (*Client) ReadWriteWithLen added in v0.1.2

func (c *Client) ReadWriteWithLen(ctx context.Context, indexGroup uint32, indexOffset uint32, data []byte, readLength uint32) ([]byte, error)

ReadWriteWithLen

func (*Client) SendDeviceNotification

func (c *Client) SendDeviceNotification(ctx context.Context, n *DeviceNotificationCmdRequest) error

SendDeviceNotification .

func (*Client) Write

func (c *Client) Write(ctx context.Context, indexGroup uint32, indexOffset uint32, data []byte) error

Write .

func (*Client) WriteByName

func (c *Client) WriteByName(ctx context.Context, name string, data []byte) error

WriteByName .

func (*Client) WriteControl

func (c *Client) WriteControl(ctx context.Context, adsState uint16, deviceState uint16, data []byte) error

WriteControl .

type Cmd

type Cmd interface {
	Tag() int
	Bytes() []byte
	FromBytes([]byte) error
}

Cmd .

type DeleteDeviceNotificationCmdRequest

type DeleteDeviceNotificationCmdRequest struct {
	NotificationHandle uint32
}

DeleteDeviceNotificationCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id= One before defined notification is deleted in an ADS device.

func (*DeleteDeviceNotificationCmdRequest) Bytes

Bytes .

func (*DeleteDeviceNotificationCmdRequest) FromBytes

func (r *DeleteDeviceNotificationCmdRequest) FromBytes(b []byte) error

FromBytes .

func (*DeleteDeviceNotificationCmdRequest) Tag

Tag .

type DeleteDeviceNotificationCmdResponse

type DeleteDeviceNotificationCmdResponse struct {
	Result uint32
}

DeleteDeviceNotificationCmdResponse see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id= One before defined notification is deleted in an ADS device.

type DeviceNotificationCmdRequest

type DeviceNotificationCmdRequest struct {
	Stamps []StampHeader
}

DeviceNotificationCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html Data will carry forward independently from an ADS device to a Client. The data which are transferred at the Device Notification are multiple nested into one another. The Notification Stream contains an array with elements of type AdsStampHeader. This array again contains elements of type AdsNotificationSample.

func (*DeviceNotificationCmdRequest) Bytes

func (r *DeviceNotificationCmdRequest) Bytes() []byte

Bytes .

func (*DeviceNotificationCmdRequest) FromBytes

func (r *DeviceNotificationCmdRequest) FromBytes(b []byte) error

FromBytes .

func (*DeviceNotificationCmdRequest) Tag

Tag .

type DeviceNotificationOpts

type DeviceNotificationOpts struct {
	TransmissionMode uint32
	// At the latest after this time, the ADS Device Notification is called. The unit is 1ms.
	MaxDelay uint32
	// The ADS server checks if the value changes in this time slice. The unit is 1ms.
	CycleTime uint32
}

DeviceNotificationOpts .

type NetID

type NetID [6]byte

NetID .

func ParseNetIDFromString

func ParseNetIDFromString(str string) (NetID, error)

ParseNetIDFromString .

func (NetID) String

func (n NetID) String() string

type NetPort

type NetPort uint16

NetPort .

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option .

func WithLoadSymbolsOnStart

func WithLoadSymbolsOnStart() Option

WithLoadSymbolsOnStart .

func WithMonitorSymbols

func WithMonitorSymbols() Option

WithMonitorSymbols .

func WithSourceNetID

func WithSourceNetID(netID NetID) Option

WithSourceNetID .

func WithSourceNetPort

func WithSourceNetPort(port NetPort) Option

WithSourceNetPort .

type ReadCmdRequest

type ReadCmdRequest struct {
	IndexGroup  uint32
	IndexOffset uint32
	Length      uint32
}

ReadCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html With ADS Read data can be read from an ADS device. The data are addressed by the Index Group and the Index Offset

func (*ReadCmdRequest) Bytes

func (r *ReadCmdRequest) Bytes() []byte

Bytes .

func (*ReadCmdRequest) FromBytes

func (r *ReadCmdRequest) FromBytes(b []byte) error

FromBytes .

func (*ReadCmdRequest) Tag

func (r *ReadCmdRequest) Tag() int

Tag .

type ReadCmdResponse

type ReadCmdResponse struct {
	Result uint32
	Data   []byte
}

ReadCmdResponse see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html With ADS Read data can be read from an ADS device. The data are addressed by the Index Group and the Index Offset

type ReadDeviceInfoCmdRequest

type ReadDeviceInfoCmdRequest struct{}

ReadDeviceInfoCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html Reads the name and the version number of the ADS device.

func (*ReadDeviceInfoCmdRequest) Bytes

func (r *ReadDeviceInfoCmdRequest) Bytes() []byte

Bytes .

func (*ReadDeviceInfoCmdRequest) FromBytes

func (r *ReadDeviceInfoCmdRequest) FromBytes([]byte) error

FromBytes .

func (*ReadDeviceInfoCmdRequest) Tag

func (r *ReadDeviceInfoCmdRequest) Tag() int

Tag .

type ReadDeviceInfoCmdResponse

type ReadDeviceInfoCmdResponse struct {
	Result       uint32
	MajorVersion uint8
	MinorVersion uint8
	VersionBuild uint16
	DeviceName   string
}

ReadDeviceInfoCmdResponse see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html Reads the name and the version number of the ADS device.

type ReadStateCmdRequest

type ReadStateCmdRequest struct{}

ReadStateCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id= Reads the ADS status and the device status of an ADS device.

func (*ReadStateCmdRequest) Bytes

func (r *ReadStateCmdRequest) Bytes() []byte

Bytes .

func (*ReadStateCmdRequest) FromBytes

func (r *ReadStateCmdRequest) FromBytes(b []byte) error

FromBytes .

func (*ReadStateCmdRequest) Tag

func (r *ReadStateCmdRequest) Tag() int

Tag .

type ReadStateCmdResponse

type ReadStateCmdResponse struct {
	Result      uint32
	ADSState    uint16
	DeviceState uint16
}

ReadStateCmdResponse see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id= Reads the ADS status and the device status of an ADS device.

type ReadWriteCmdRequest

type ReadWriteCmdRequest struct {
	IndexGroup  uint32
	IndexOffset uint32
	ReadLength  uint32
	Data        []byte
}

ReadWriteCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html With ADS ReadWrite data will be written to an ADS device. Additionally, data can be read from the ADS device. The data which can be read are addressed by the Index Group and the Index Offset

func (*ReadWriteCmdRequest) Bytes

func (r *ReadWriteCmdRequest) Bytes() []byte

Bytes .

func (*ReadWriteCmdRequest) FromBytes

func (r *ReadWriteCmdRequest) FromBytes(b []byte) error

FromBytes .

func (*ReadWriteCmdRequest) Tag

func (r *ReadWriteCmdRequest) Tag() int

Tag .

type ReadWriteCmdResponse

type ReadWriteCmdResponse struct {
	Result uint32
	Data   []byte
}

ReadWriteCmdResponse see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html With ADS ReadWrite data will be written to an ADS device. Additionally, data can be read from the ADS device. The data which can be read are addressed by the Index Group and the Index Offset

type Sample

type Sample struct {
	NotificationHandle uint32
	Data               []byte
}

Sample see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html

type Symbol

type Symbol struct {
	Name        string `xml:"Name"`
	Comment     string `xml:"Comment"`
	Type        string `xml:"Type"`
	IndexGroup  uint32 `xml:"IGroup"`
	IndexOffset uint32 `xml:"IOffset"`
	Size        uint32 `xml:"BitSize"`
	Flags       uint32 `xml:"Flags"`
}

Symbol . See: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_adsdll2/index.html&id=4279787267115190858

type WriteCmdRequest

type WriteCmdRequest struct {
	IndexGroup  uint32
	IndexOffset uint32
	Data        []byte
}

WriteCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id With ADS Write data can be written to an ADS device. The data are addressed by the Index Group and the Index Offset

func (*WriteCmdRequest) Bytes

func (r *WriteCmdRequest) Bytes() []byte

Bytes .

func (*WriteCmdRequest) FromBytes

func (r *WriteCmdRequest) FromBytes(b []byte) error

FromBytes .

func (*WriteCmdRequest) Tag

func (r *WriteCmdRequest) Tag() int

Tag .

type WriteCmdResponse

type WriteCmdResponse struct {
	Result uint32
}

WriteCmdResponse see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id With ADS Write data can be written to an ADS device. The data are addressed by the Index Group and the Index Offset

type WriteControlCmdRequest

type WriteControlCmdRequest struct {
	ADSState    uint16
	DeviceState uint16
	Data        []byte
}

WriteControlCmdRequest see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id= Changes the ADS status and the device status of an ADS device. Additionally it is possible to send data to the ADS device to transfer further information. These data were not analyzed from the current ADS devices (PLC, NC, ...)

func (*WriteControlCmdRequest) Bytes

func (r *WriteControlCmdRequest) Bytes() []byte

Bytes .

func (*WriteControlCmdRequest) FromBytes

func (r *WriteControlCmdRequest) FromBytes(b []byte) error

FromBytes .

func (*WriteControlCmdRequest) Tag

func (r *WriteControlCmdRequest) Tag() int

Tag .

type WriteControlCmdResponse

type WriteControlCmdResponse struct {
	Result uint32
}

WriteControlCmdResponse see: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/index.html&id= Changes the ADS status and the device status of an ADS device. Additionally it is possible to send data to the ADS device to transfer further information. These data were not analyzed from the current ADS devices (PLC, NC, ...)

Directories

Path Synopsis
examples
notifications command
simple command
tpy-file command

Jump to

Keyboard shortcuts

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