API Reference yaads v#0.1.0

Copy Markdown View Source

Modules

ADS

ADS, Beckhoff's Automation Device Specification, in pure Elixir, as a client: reading, writing and watching the variables of a TwinCAT PLC by name, over TCP or over Secure ADS (TLS).

AMS packets, which carry every ADS command and response: a 32-byte AMS header with the addresses of both ends, the command, flags, the length of the data, an error code and an invoke id, then the data. All numbers are little-endian.

A network adapter of a TwinCAT system, as its system service lists them, for ADS.Client.adapters/2: index group 701, SYSTEMSERVICE_IPHELPERAPI in Beckhoff's Tc2_Utilities, offset 1, IPHELPERAPI_ADAPTERSINFO, on AMS port 10000. A read of 4 bytes answers the size of the whole list; a read of less than that, :device_invalid_size.

X.509 certificates for Secure ADS, as DER binaries.

A connection to an ADS device, usually a TwinCAT PLC, over TCP or Secure ADS.

The code page of the strings of one byte to a character a TwinCAT system has: its PLC's STRINGs, the names and comments of its symbols and types, and the strings of its system service and router, such as its host name, routes and adapters. Windows-1252 unless told otherwise, with codepage: to ADS.Client, ADS.Discovery and the mix tasks, as Beckhoff's own libraries read them on Western Windows; a system on Windows of another language has that one's.

The nine ADS commands: the data of their requests and of the responses to them, inside AMS packets (see ADS.AMS). All numbers are little-endian.

A PLC's description of one of its data types: a structure and its members, an array, an enumeration and its values, or another name for a type.

Finding ADS devices on the network, and adding routes to them, over UDP port 48899, as TwinCAT's own Broadcast Search and Add Route do

AMS NetIds: six numbers from 0 to 255, written with dots like an IP address with two more parts, and sent as six bytes in that order.

The return codes of ADS, which a device or a router answers with when something goes wrong.

A route of a TwinCAT system, as its system service lists them, one entry at a time, for ADS.Client.routes/2: index group 803, SYSTEMSERVICE_ENUMREMOTE in Beckhoff's Tc2_Utilities, on AMS port 10000, the entry's index as the offset. After the last, the system answers :device_no_more_handles.

Secure ADS: ADS inside TLS 1.2, to port 8016, from TwinCAT 3.1 build 4024 on.

Sum commands: many reads, writes, or read-writes in one ADS read-write, to an index group of the system services with the number of them as index offset.

A PLC's description of one of its variables: its name, the name of its type, where it is, and how big.

The data types of a TwinCAT PLC, and their values as Elixir terms.

Mix Tasks

Finds the PLCs on the network, as mix ads.route does, and shows what one's system service answers: its version and state, its host name and its network adapters. It answers only to a machine it has a route for, which mix ads.route adds.

Finds the PLCs on the network, and adds a route on one for this machine with the login of a user on it, so that ADS.Client can connect; then connects, to see that it can