goADS

package module
v0.0.0-...-f0e7b10 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 15 Imported by: 4

README

goADS

Beckhoff ADS client package for the Go Programming Language

ADS stands for "Automation Device Specification" and describes a device- and Fieldbus-independent interface. The protocol is designed by Beckhoff and is documented here: http://infosys.beckhoff.com/content/1033/TcAdsCommon/HTML/TcAdsCommon_Intro.htm

Installing goADS

First make sure you have a working Go installation, see the installation guide at http://golang.org/doc/install.html

Now you should be able to install goADS by running go get github.com/stamp/goADS

Contribute

Please feel free to fork and help to develop this package

Documentation

Index

Constants

View Source
const (
	ADS_NoTransmission = 0
	ADS_ClientCycle    = 1
	ADS_ClientOnChange = 2
	ADS_ServerCycle    = 3
	ADS_ServerOnChange = 4
	ADS_Client1Reqest  = 5
)

}}} AddDeviceNotification - ADS command id: 6/*{{{*/

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output

func FlushLog

func FlushLog()

Call this before app shutdown

func SetLogWriter

func SetLogWriter(writer io.Writer) error

SetLogWriter uses a specified io.Writer to output library log. Use this func if you are not using Seelog logging system in your app.

func UseLogger

func UseLogger(newLogger seelog.LoggerInterface)

UseLogger uses a specified seelog.LoggerInterface to output library log. Use this func if you are using Seelog logging system in your app.

Types

type ADSAddDeviceNotification

type ADSAddDeviceNotification struct {
	Handle uint32
}

type ADSNotification

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

type ADSRead

type ADSRead struct {
	Data []byte
}

}}} Read - ADS command id: 2/*{{{*/

type ADSReadDeviceInfo

type ADSReadDeviceInfo struct {
	MajorVersion uint8
	MinorVersion uint8
	BuildVersion uint16
	DeviceName   string
}

ReadDeviceInfo - ADS command id: 1/*{{{*/

type ADSReadState

type ADSReadState struct {
	ADSState       uint16
	ADSDeviceState uint16
}

}}} ReadState - ADS command id: 4/*{{{*/

type ADSSymbol

type ADSSymbol struct {
	Self     *ADSSymbol
	FullName string
	Name     string
	DataType string
	Comment  string

	Area   uint32
	Offset uint32
	Length uint32

	Value   string
	Valid   bool
	Changed bool

	Childs map[string]ADSSymbol
	// contains filtered or unexported fields

} /*}}}*/

func (*ADSSymbol) AddDeviceNotification

func (symbol *ADSSymbol) AddDeviceNotification(callback func(*ADSSymbol))

func (*ADSSymbol) Find

func (data *ADSSymbol) Find(name string) (list []*ADSSymbol)

func (*ADSSymbol) FindChanged

func (data *ADSSymbol) FindChanged() (changed []*ADSSymbol)

return } [>}}}<]

func (*ADSSymbol) Read

func (symbol *ADSSymbol) Read()

Read a symbol and all sub values

func (*ADSSymbol) Walk

func (data *ADSSymbol) Walk()

for _, segment := range data.Childs { segment.Walk(data.Name) } } [>}}}<]

func (*ADSSymbol) Write

func (symbol *ADSSymbol) Write(value string) error

}}}

type ADSSymbolUploadDataType

type ADSSymbolUploadDataType struct {
	Name     string
	Area     uint32
	Offset   uint32
	DataType string
	Comment  string

	Value   string
	Changed bool

	Childs map[string]ADSSymbolUploadDataType

	In1         uint32
	Decoration  uint32
	In3         uint32
	Size        uint32
	In6         uint32
	In7         uint32
	ArrayLevels uint16
	In8         uint16
	// contains filtered or unexported fields

} /*}}}*/

func (*ADSSymbolUploadDataType) DebugWalk

func (data *ADSSymbolUploadDataType) DebugWalk()

type ADSSymbolUploadInfo

type ADSSymbolUploadInfo struct {
	SymbolCount    uint32
	SymbolLength   uint32
	DataTypeCount  uint32
	DataTypeLength uint32
	ExtraCount     uint32
	ExtraLength    uint32

} /*}}}*/

type ADSSymbolUploadSymbol

type ADSSymbolUploadSymbol struct {
	Name     string
	DataType string
	Comment  string

	Area   uint32
	Offset uint32
	Length uint32

	Extra1 uint32
	Extra2 uint32

	Childs map[string]ADSSymbolUploadDataType
	// contains filtered or unexported fields

} /*}}}*/

func (*ADSSymbolUploadSymbol) DebugWalk

func (data *ADSSymbolUploadSymbol) DebugWalk()

Print the whole symbol and data type lists

type AMSAddress

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

type Connection

type Connection struct {
	WaitGroup      sync.WaitGroup
	WaitGroupFinal sync.WaitGroup
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(ip string, netid string, port uint16) (conn *Connection, err error)

Connection

func (*Connection) AddDeviceNotification

func (conn *Connection) AddDeviceNotification(group uint32, offset uint32, length uint32, transmissionMode uint32, maxDelay uint32, cycleTime uint32, callback func([]byte)) (response ADSAddDeviceNotification, err error)

func (*Connection) Close

func (conn *Connection) Close()

func (*Connection) Connect

func (conn *Connection) Connect()

func (*Connection) DeleteDeviceNotification

func (conn *Connection) DeleteDeviceNotification(handle uint32)

}}} DeleteDeviceNotification - ADS command id: 7/*{{{*/

func (*Connection) DeviceNotification

func (conn *Connection) DeviceNotification(in []byte)

}}} DeviceNotification - ADS command id: 8/*{{{*/

func (*Connection) Find

func (conn *Connection) Find(name string) (list []*ADSSymbol)

func (*Connection) ParseTPY

func (conn *Connection) ParseTPY(path string) (symbols map[string]ADSSymbol)

func (*Connection) Read

func (conn *Connection) Read(group uint32, offset uint32, length uint32) (response ADSRead, err error)

func (*Connection) ReadDeviceInfo

func (conn *Connection) ReadDeviceInfo() (response ADSReadDeviceInfo, err error)

func (*Connection) ReadState

func (conn *Connection) ReadState() (response ADSReadState, err error)

func (*Connection) ReadWrite

func (conn *Connection) ReadWrite()

}}} ReadWrite TODO - ADS command id: 9/*{{{*/

func (*Connection) Set

func (conn *Connection) Set(name, value string)

func (*Connection) UploadSymbolInfo

func (conn *Connection) UploadSymbolInfo() (symbols map[string]ADSSymbol, structs map[string]ADSSymbolUploadDataType)

func (*Connection) UploadSymbolInfoDataTypes

func (conn *Connection) UploadSymbolInfoDataTypes(length uint32)

func (*Connection) UploadSymbolInfoSymbols

func (conn *Connection) UploadSymbolInfoSymbols(length uint32)

func (*Connection) Value

func (conn *Connection) Value(name string) (value string)

func (*Connection) Wait

func (conn *Connection) Wait()

func (*Connection) Write

func (conn *Connection) Write(group uint32, offset uint32, data []byte)

}}} Write - ADS command id: 3/*{{{*/

func (*Connection) WriteControl

func (conn *Connection) WriteControl()

}}} WriteControl TODO - ADS command id: 5/*{{{*/

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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