17 switch (errorDecodeName)
20 return "PNIO Connection Management";
23 return "PNIO Read/Write";
30 Hex2(
static_cast<std::uint8_t
>(errorDecodeName)) +
40 return "Invalid Index";
43 return "Write Length Error";
46 return "Resource Error";
49 return "Access Error";
52 return "Application Error";
56 Hex2(
static_cast<std::uint8_t
>(errorCodeRw1)) +
72 return "Alarm CR Block";
75 return "Expected Submodule Block";
78 return "Module Difference Block";
81 return "AR RPC Block";
84 return "IR Info Block";
87 return "SR Info Block";
93 return "IOD Control Request";
96 return "IOD Control Response";
99 return "AR Block Response";
102 return "IOCR Block Response";
105 return "Alarm CR Block Response";
108 return "Module Difference Block Response";
111 return "AR Server Block Response";
114 return "Parameter Server";
117 return "Connection Management Control";
120 return "Connection Management Device";
123 return "Connection Management RPC";
126 return "Faulty Record Data";
129 return "Faulty Application Relation";
132 return "Faulty Block Structure";
136 Hex2(
static_cast<std::uint8_t
>(errorCodeCm1)) +
146 return "Index not supported";
149 return "Index exists but has not been written";
152 return "Unknown Error (" +
153 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
163 return "Write length error";
166 return "Write data is too short";
169 return "Write data is too long";
172 return "Write access denied (write protected)";
175 return "Unknown Error (" +
176 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
186 return "Resource not available";
189 return "Invalid slot number";
192 return "Invalid subslot number";
195 return "Module has no data";
198 return "Unknown Error (" +
199 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
209 return "Access denied (invalid area)";
212 return "Access denied";
215 return "Access denied (invalid range)";
218 return "Access denied (invalid state for access)";
221 return "Access denied (local control)";
224 return "Unknown Error (" +
225 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
238 return "Write error";
241 return "Module failure";
244 return "Resource busy";
247 return "Version conflict";
250 return "Invalid API number";
253 return "Backup not allowed";
256 return "Alarm pending";
259 return "Unknown Error (" +
260 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
277 Hex2(
static_cast<std::uint8_t
>(errorCode1)) +
287 return "Invalid arguments length";
290 return "Unknown blocks in request";
293 return "Required IOCR block missing";
296 return "Wrong AlarmCR block count";
299 return "Out of AR resources";
302 return "Unknown Error (" +
303 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
313 return "Parameter server state conflict";
316 return "Unknown Error (" +
317 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
353 return "Unknown Error (" +
Hex2(errorCode2) +
")";
361 return "Invalid AR type";
364 return "AR already active";
367 return "Out of AR resources";
370 return "Out of provider resources";
373 return "Out of consumer resources";
376 return "Out of alarm resources";
379 return "Out of memory";
382 return "Invalid session key";
385 return "AR UUID conflict";
388 return "Unknown Error (" +
389 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
399 return "Invalid IOCR type";
402 return "Out of IOCR resources";
405 return "Invalid frame ID";
408 return "Invalid RT class";
411 return "Invalid IO data length";
414 return "Cycle time conflict";
417 return "Watchdog configuration error";
420 return "Unknown Error (" +
421 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
431 return "Invalid AlarmCR type";
434 return "Out of AlarmCR resources";
437 return "Unknown Error (" +
438 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
448 return "Invalid slot number";
451 return "Invalid subslot number";
454 return "Wrong module identification number";
457 return "Wrong submodule identification number";
460 return "IO data length mismatch";
463 return "Unknown Error (" +
464 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
474 return "Device state conflict";
477 return "Connection resource unavailable";
480 return "Device already owned";
483 return "AR set aborted";
486 return "Unknown Error (" +
487 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
497 return "Faulty block structure";
500 return "Unknown Error (" +
501 Hex2(
static_cast<std::uint8_t
>(errorCode2)) +
509 static constexpr std::size_t idxErrorCode = 0;
510 static constexpr std::size_t idxErrorDecode = 1;
511 static constexpr std::size_t idxErrorCode1 = 2;
512 static constexpr std::size_t idxErrorCode2 = 3;
517 data[idxErrorDecode],
519 data[idxErrorCode2]);
575std::string
DecodePnioError(
const std::uint8_t& errorCode1,
const std::uint8_t& errorCode2)
588 return "Unknown PNIO error";
613 return "Unknown PNIORW error";
618 const std::uint8_t errorCode,
619 const std::uint8_t errorDecode,
620 const std::uint8_t errorCode1,
621 const std::uint8_t errorCode2)
639 message =
"Unknown error (Decode=" +
PNIO application error with error codes.
std::uint8_t errorCode1
Raw ErrorCode1 byte (category / block type).
static PNIOError CreateFromCodes(std::uint8_t errorCode, std::uint8_t errorDecode, std::uint8_t errorCode1, std::uint8_t errorCode2)
std::uint8_t errorCode
Raw ErrorCode byte (see class-level.
std::uint8_t errorDecode
Raw ErrorDecode byte; selects which ErrorCode1/ErrorCode2 table applies.
std::string BlockName() const
Human-readable name of the PNIO-CM block referenced by ErrorCode1.
bool IsCmError() const
Whether this error came from the PNIO-CM (connection management) table.
static PNIOError FromBytes(std::span< const std::uint8_t, 4 > data)
Create a PNIOError from a raw 4-byte error status.
std::uint8_t errorCode2
Raw ErrorCode2 byte (specific error within the category).
static PNIOError FromArgsStatus(std::uint32_t argsStatus)
Create a PNIOError from the little-endian ArgsStatus field carried in a DCE/RPC PDU.
Declares exceptions and error types used by the PROFINET IO controller stack.
std::string Hex2(std::uint8_t value)
Format an 8-bit unsigned integer as a 2-digit hexadecimal string.
std::string GetPnioRwErrorCode1Name(PnioRwErrorCode1 errorCodeRw1)
Get the human-readable name for a PNIORW ErrorCode1.
PnioCmErrorCode1
PNIO-CM ErrorCode1 values.
@ ArServerResponse
ARServerBlock response.
@ CmCtl
Connection management control.
@ IodControlResponse
IODControl response.
@ PrmServer
Parameter server.
@ FaultyRecord
Faulty record data.
@ AlarmCr
AlarmCRBlock request.
@ CmRpc
Connection management RPC.
@ IodControlRequest
IODControl request.
@ ModuleDiff
ModuleDiffBlock.
@ ArResponse
ARBlock response.
@ CmDev
Connection management device.
@ ExpectedSubmodule
ExpectedSubmoduleBlock request.
@ IocrResponse
IOCRBlock response.
@ AlarmCrResponse
AlarmCRBlock response.
@ FaultyBlock
Faulty block structure.
@ FaultyAr
Faulty application relation.
@ ModuleDiffResponse
ModuleDiffBlock response.
PnioRwWriteLengthErrorCode2
PNIORW WriteLength ErrorCode2 values.
@ WriteProtected
Write access is denied because the data is write protected.
@ DataTooLong
Write data is too long.
@ WriteLengthError
General write length error.
@ DataTooShort
Write data is too short.
std::string DecodePnioCmError(const std::uint8_t &errorCode1, const std::uint8_t &errorCode2)
ErrorDecode
PROFINET error decode values.
@ Pnio
General PNIO error.
@ PnioRw
PNIO read/write error.
@ PnioCm
PNIO connection management error.
std::string GetPnioErrorMessage(PnioRmpmErrorCode2 errorCode2)
Get the human-readable message for an RMPM ErrorCode2.
std::string GetPnioCmErrorCode1Name(PnioCmErrorCode1 errorCodeCm1)
Get the human-readable name for a PNIO-CM ErrorCode1.
PnioPrmServerErrorCode2
PNIO Parameter Server ErrorCode2 values.
@ StateConflict
The parameter server is in an invalid state for the requested operation.
PnioRwAccessErrorCode2
PNIORW Access ErrorCode2 values.
@ InvalidArea
Access denied because the area is invalid.
@ AccessDenied
Access denied.
@ LocalControl
Access denied because of local control.
@ InvalidState
Access denied because the device is in an invalid state.
@ InvalidRange
Access denied because the range is invalid.
std::string GetPnioRwErrorMessage(PnioRwInvalidIndexErrorCode2 errorCode2)
Get the human-readable message for an InvalidIndex error.
std::string GetPnioErrorCode1Name(PnioErrorCode1 errorCode1)
Get the human-readable name of a PNIO ErrorCode1.
std::string DecodePnioError(const std::uint8_t &errorCode1, const std::uint8_t &errorCode2)
PnioErrorCode1
PNIO ErrorCode1 values.
@ PrmServer
Parameter server error.
@ Rmpm
Runtime parameter and module management (RMPM) error.
PnioCmIocrErrorCode2
PNIO-CM IOCR ErrorCode2 values.
@ NoIocrResources
No IOCR resources are available.
@ InvalidIocrType
Invalid IOCR type.
@ InvalidIoDataLength
The IO data length is invalid.
@ CycleTimeConflict
A cycle time conflict occurred.
@ InvalidFrameId
The frame ID is invalid.
@ WatchdogConfigurationError
The watchdog configuration is invalid.
@ InvalidRtClass
The RT class is invalid.
static constexpr int OneOctetShift
The bit-shift distance required to move data across a single octet.
static constexpr int ThreeOctetsShift
The bit-shift distance required to move data across three octets.
static constexpr int TwoOctetsShift
The bit-shift distance required to move data across two octets.
PnioRmpmErrorCode2
PNIO RMPM ErrorCode2 values.
@ WrongAlarmCrBlockCount
The number of AlarmCR blocks is incorrect.
@ RequiredIocrBlockMissing
A required IOCR block is missing.
@ OutOfArResources
No application relation resources are available.
@ InvalidArgumentsLength
Invalid arguments length.
@ UnknownBlocksInRequest
Unknown blocks were found in the request.
PnioRwInvalidIndexErrorCode2
PNIORW InvalidIndex ErrorCode2 values.
@ IndexNotWritten
Index exists but has not been written.
@ IndexNotSupported
Index is not supported.
std::string DecodePnioRWError(const std::uint8_t &errorCode1, const std::uint8_t &errorCode2)
PnioRwResourceErrorCode2
PNIORW Resource ErrorCode2 values.
@ ModuleHasNoData
Module has no data.
@ InvalidSlot
Slot number is invalid.
@ ResourceNotAvailable
Resource is not available.
@ InvalidSubslot
Subslot number is invalid.
PnioCmExpectedSubmoduleErrorCode2
PNIO-CM Expected Submodule ErrorCode2 values.
@ IoDataLengthMismatch
IO data length does not match the expected length.
@ WrongModuleIdentNumber
Module identification number does not match.
@ InvalidSlot
Invalid slot number.
@ InvalidSubslot
Invalid subslot number.
@ WrongSubmoduleIdentNumber
Submodule identification number does not match.
static constexpr std::uint8_t LowByteMask
Bitmask used to isolate the lowest significant byte (8 bits) of a larger integer.
PnioCmAlarmCrErrorCode2
PNIO-CM Alarm CR ErrorCode2 values.
@ NoAlarmCrResources
No Alarm CR resources are available.
@ InvalidAlarmCrType
Invalid Alarm CR type.
std::string GetPnioCmErrorMessage(PnioCmArErrorCode2 errorCode2)
Get the human-readable message for a PNIO-CM AR error.
PnioRwErrorCode1
PNIO read/write ErrorCode1 values.
@ WriteLength
Write length error.
@ Resource
Resource error.
@ Application
Application error.
@ InvalidIndex
Invalid or unsupported index.
PnioCmDeviceErrorCode2
PNIO-CM Device ErrorCode2 values.
@ ConnectionResourceUnavailable
No connection management resources are available.
@ DeviceStateConflict
Device state conflict.
@ ArSetAborted
The application relation set was aborted.
@ AlreadyOwned
The device is already owned.
std::string GetErrorDecodeName(ErrorDecode errorDecodeName)
Get the human-readable name for an ErrorDecode value.
PnioCmArErrorCode2
PNIO-CM AR ErrorCode2 values.
@ InvalidSessionKey
The session key is invalid.
@ NoAlarmResources
No alarm resources are available.
@ NoConsumerResources
No consumer resources are available.
@ InvalidArType
Invalid AR type.
@ ArAlreadyActive
AR is already active.
@ NoMemory
No memory is available.
@ NoArResources
No AR resources are available.
@ NoProviderResources
No provider resources are available.
@ ArUuidConflict
The AR UUID conflicts with an existing AR.
PnioRwApplicationErrorCode2
PNIORW Application ErrorCode2 values.
@ ModuleFailure
Module failure.
@ ResourceBusy
Resource is busy.
@ AlarmPending
An alarm is pending.
@ BackupNotAllowed
Backup is not allowed.
@ VersionConflict
Version conflict.
@ InvalidApi
API number is invalid.
PnioCmFaultyBlockErrorCode2
PNIO-CM Faulty Block ErrorCode2 values.
@ FaultyBlockStructure
Faulty block structure.
Declares Linux Ethernet, addressing, timing, and utility helpers used by the PROFINET stack.