"""Error codes.

:author: Stefan Lehmann <stlm@posteo.de>
:license: MIT, see license file or https://opensource.org/licenses/MIT
:created on: 2018-06-11 18:15:53

"""
from .errorcodes_nc import NC_ERROR_CODES

ERROR_CODES = {
    0: "no error",
    1: "Internal error",
    2: "No real time",
    3: "Allocation locked - memory error",
    4: "Mailbox full – the ADS message could not be sent.",
    5: "Wrong HMSG",
    6: "Target port not found - ADS Server not started",
    7: "Target machine not found - Missing ADS routes",
    8: "Unknown command ID",
    9: "Invalid task ID",
    10: "No IO",
    11: "Unknown AMS command",
    12: "Win 32 error",
    13: "Port not connected",
    14: "Invalid AMS length",
    15: "Invalid AMS Net ID",
    16: "Installation level is too low –TwinCAT 2 license error",
    17: "No debug available",
    18: "Port disabled",
    19: "Port already connected",
    20: "AMS Sync Win32 error",
    21: "AMS Sync Timeout",
    22: "AMS Sync AMS error",
    23: "No index map for AMS Sync available",
    24: "Invalid AMS port",
    25: "No memory",
    26: "TCP send error",
    27: "Host unreachable",
    28: "Invalid AMS fragment",
    29: "TLS send error, secure ADS connection failed",
    30: "Access denied, secure ADS access denied",
    1280: "ROUTERERR_NOLOCKEDMEMORY",
    1281: "ROUTERERR_RESIZEMEMORY",
    1282: "ROUTERERR_MAILBOXFULL",
    1283: "ROUTERERR_DEBUGBOXFULL",
    1284: "ROUTERERR_UNKNOWNPORTTYPE",
    1285: "ROUTERERR_NOTINITIALIZED",
    1286: "ROUTERERR_PORTALREADYINUSE",
    1287: "ROUTERERR_NOTREGISTERED",
    1288: "ROUTERERR_NOMOREQUEUES",
    1289: "ROUTERERR_INVALIDPORT",
    1290: "ROUTERERR_NOTACTIVATED",
    1291: "ROUTERERR_FRAGMENTBOXFULL",
    1292: "ROUTERERR_FRAGMENTTIMEOUT",
    1293: "ROUTERERR_TOBEREMOVED",
    1792: "error class <device error>",
    1793: "Service is not supported by server",
    1794: "invalid index group",
    1795: "invalid index offset",
    1796: "reading/writing not permitted",
    1797: "parameter size not correct",
    1798: "invalid parameter value(s)",
    1799: "device is not in a ready state",
    1800: "device is busy",
    1801: "invalid context (must be in Windows)",
    1802: "out of memory",
    1803: "invalid parameter value(s)",
    1804: "not found (files, ...)",
    1805: "syntax error in command or file",
    1806: "objects do not match",
    1807: "object already exists",
    1808: "symbol not found",
    1809: "symbol version invalid. Onlinechange. Release handle and get a new one",
    1810: "server is in invalid state",
    1811: "AdsTransMode not supported",
    1812: "Notification handle is invalid. Onlinechange. Release handle and get a new one",  # noqa: E501
    1813: "Notification client not registered",
    1814: "no more notification handles",
    1815: "size for watch too big",
    1816: "device not initialized",
    1817: "device has a timeout",
    1818: "query interface failed",
    1819: "wrong interface required",
    1820: "class ID is invalid",
    1821: "object ID is invalid",
    1822: "request is pending",
    1823: "request is aborted",
    1824: "signal warning",
    1825: "invalid array index",
    1826: "symbol not active. Onlinechange. Release handle and get a new one",
    1827: "access denied",
    1828: "missing license. Activate license for TwinCAT 3 function",
    1836: "exception occurred during system start. Check each device transitions",
    1856: "Error class <client error>",
    1857: "invalid parameter at service",
    1858: "polling list is empty",
    1859: "var connection already in use",
    1860: "invoke ID in use",
    1861: "timeout elapsed",
    1862: "error in win32 subsystem",
    1863: "Invalid client timeout value",
    1864: "ads-port not opened",
    1872: "internal error in ads sync",
    1873: "hash table overflow",
    1874: "key not found in hash",
    1875: "no more symbols in cache",
    1876: "invalid response received",
    1877: "sync port is locked",
    4096: "RTERR_INTERNAL",
    4097: "RTERR_BADTIMERPERIODS",
    4098: "RTERR_INVALIDTASKPTR",
    4099: "RTERR_INVALIDSTACKPTR",
    4100: "RTERR_PRIOEXISTS",
    4101: "RTERR_NOMORETCB",
    4102: "RTERR_NOMORESEMAS",
    4103: "RTERR_NOMOREQUEUES",
    4104: "TwinCAT reserved.",
    4105: "TwinCAT reserved.",
    4106: "TwinCAT reserved.",
    4107: "TwinCAT reserved.",
    4108: "TwinCAT reserved.",
    4109: "RTERR_EXTIRQALREADYDEF",
    4110: "RTERR_EXTIRQNOTDEF",
    4111: "RTERR_EXTIRQINSTALLFAILED",
    4112: "RTERR_IRQLNOTLESSOREQUAL",
    4119: "RTERR_VMXNOTSUPPORTED",
    4120: "RTERR_VMXDISABLED",
    4121: "RTERR_VMXCONTROLSMISSING",
    4122: "RTERR_VMXENABLEFAILS",
    10060: "A socket operation was attempted to an unreachable host",
    10061: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.",  # noqa: E501
    10065: "No connection could be made because the target machine actively refused it",
}

# Update the ERROR_CODES dictionary with NC_ERROR_CODES
ERROR_CODES.update(NC_ERROR_CODES)