ADS.ReturnCode (yaads v0.1.0)

Copy Markdown View Source

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

Each has a name, Beckhoff's identifier in snake case with its words spelled out, and the prefix of its group kept: ERR_TARGETPORTNOTFOUND is :target_port_not_found, ROUTERERR_MAILBOXFULL is :router_mailbox_full, ADSERR_DEVICE_SYMBOLNOTFOUND is :device_symbol_not_found, ADSERR_CLIENT_SYNCTIMEOUT is :client_sync_timeout and RTERR_INTERNAL is :rt_internal.

CodesGroup
0x0 to 0x1Ethe AMS router and transport
0x500 to 0x50Dthe router's resources
0x700 to 0x739the device: :device_...
0x740 to 0x756Beckhoff's client libraries: :client_...
0x1000 to 0x101Athe real-time system: :rt_...

Windows and .NET show them as HRESULTs, 0x9811_0000 plus the code, which name/1 takes too.

iex> ADS.ReturnCode.name(0x710)
:device_symbol_not_found
iex> ADS.ReturnCode.name(0x9811_0006)
:target_port_not_found
iex> ADS.ReturnCode.name(0x799)
1945
iex> ADS.ReturnCode.code(:device_symbol_version_invalid)
0x711

Summary

Types

The name of a return code, an atom; see the table of ADS.ReturnCode.

Functions

All return codes and their names.

The number of a return code, given by name or number.

The name of a return code, or the code itself if it has none.

Types

name()

@type name() :: atom()

The name of a return code, an atom; see the table of ADS.ReturnCode.

Functions

all()

@spec all() :: %{required(non_neg_integer()) => name()}

All return codes and their names.

code(code)

@spec code(name() | non_neg_integer()) :: non_neg_integer()

The number of a return code, given by name or number.

name(code)

@spec name(non_neg_integer()) :: name() | non_neg_integer()

The name of a return code, or the code itself if it has none.