|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
PNIO application error with error codes. More...
#include <exceptions.h>
Inheritance diagram for profinet::PNIOError:
Collaboration diagram for profinet::PNIOError:Public Member Functions | |
| PNIOError (const std::string &message, std::uint8_t errorCode, std::uint8_t errorDecode, std::uint8_t errorCode1, std::uint8_t errorCode2) | |
| Construct directly from the four raw error-status bytes. | |
| bool | IsCmError () const |
| Whether this error came from the PNIO-CM (connection management) table. | |
| std::string | BlockName () const |
| Human-readable name of the PNIO-CM block referenced by ErrorCode1. | |
Public Member Functions inherited from profinet::RPCError | |
| RPCError (const std::string &message) | |
| Construct with a human-readable message. | |
Public Member Functions inherited from profinet::ProfinetError | |
| ProfinetError (const std::string &message) | |
| Construct with a human-readable message. | |
Static Public Member Functions | |
| static PNIOError | FromBytes (std::span< const std::uint8_t, 4 > data) |
| Create a PNIOError from a raw 4-byte error status. | |
| static PNIOError | FromArgsStatus (std::uint32_t argsStatus) |
| Create a PNIOError from the little-endian ArgsStatus field carried in a DCE/RPC PDU. | |
Public Attributes | |
| std::uint8_t | errorCode = 0 |
| Raw ErrorCode byte (see class-level. | |
| std::uint8_t | errorDecode = 0 |
| Raw ErrorDecode byte; selects which ErrorCode1/ErrorCode2 table applies. | |
| std::uint8_t | errorCode1 = 0 |
| Raw ErrorCode1 byte (category / block type). | |
| std::uint8_t | errorCode2 = 0 |
| Raw ErrorCode2 byte (specific error within the category). | |
Static Private Member Functions | |
| static std::string | DecodePnioCmError (const std::uint8_t &errorCode1, const std::uint8_t &errorCode2) |
| Decodes a PROFINET Communication Manager (CM) error. | |
| static std::string | DecodePnioError (const std::uint8_t &errorCode1, const std::uint8_t &errorCode2) |
| Decodes a PROFINET IO (PNIO) error. | |
| static std::string | DecodePnioRWError (const std::uint8_t &errorCode1, const std::uint8_t &errorCode2) |
| Decodes a PROFINET Read/Write (PNIO RW) error. | |
| static PNIOError | CreateFromCodes (std::uint8_t errorCode, std::uint8_t errorDecode, std::uint8_t errorCode1, std::uint8_t errorCode2) |
| Shared implementation for FromBytes()/FromArgsStatus(): look up the error message and construct the PNIOError. | |
Friends | |
| class | PNIOErrorDirectTests |
| Test fixture for PNIO error unit tests, directly calling the functions. | |
PNIO application error with error codes.
Error code structure (4 bytes):
Definition at line 691 of file exceptions.h.
|
inline |
Construct directly from the four raw error-status bytes.
| message | Human-readable message describing the error. |
| errorCode | Raw ErrorCode byte. |
| errorDecode | Raw ErrorDecode byte. |
| errorCode1 | Raw ErrorCode1 byte. |
| errorCode2 | Raw ErrorCode2 byte. |
Definition at line 712 of file exceptions.h.
| std::string profinet::PNIOError::BlockName | ( | ) | const |
Human-readable name of the PNIO-CM block referenced by ErrorCode1.
Definition at line 651 of file exceptions.cpp.
References errorCode1, profinet::GetPnioCmErrorCode1Name(), and IsCmError().
Here is the call graph for this function:
|
staticprivate |
Shared implementation for FromBytes()/FromArgsStatus(): look up the error message and construct the PNIOError.
| errorCode | Raw ErrorCode byte. |
| errorDecode | Raw ErrorDecode byte. |
| errorCode1 | Raw ErrorCode1 byte. |
| errorCode2 | Raw ErrorCode2 byte. |
Definition at line 621 of file exceptions.cpp.
References DecodePnioCmError(), DecodePnioError(), DecodePnioRWError(), errorCode, errorCode1, errorCode2, errorDecode, profinet::Hex2(), profinet::Pnio, profinet::PnioCm, and profinet::PnioRw.
Referenced by profinet::PNIOErrorDirectTests::CreateFromCodes(), FromArgsStatus(), and FromBytes().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Decodes a PROFINET Communication Manager (CM) error.
Interprets the first two PROFINET error-code bytes as a CM error and returns a human-readable description. The first error-code byte selects the CM error category, while the second byte is decoded using the corresponding category-specific error-code enumeration.
Response-specific CM error categories are identified by appending "(in response)" to the decoded error message. If the first error-code byte is not recognized, an "Unknown CM error" message is returned.
| errorCode1 | First PROFINET CM error code byte identifying the error category. |
| errorCode2 | Second PROFINET CM error code byte identifying the specific error within the selected category. |
Definition at line 542 of file exceptions.cpp.
References profinet::AlarmCr, profinet::AlarmCrResponse, profinet::Ar, profinet::ArResponse, profinet::CmDev, errorCode1, errorCode2, profinet::ExpectedSubmodule, profinet::FaultyBlock, profinet::GetPnioCmErrorCode1Name(), profinet::GetPnioCmErrorMessage(), profinet::Iocr, and profinet::IocrResponse.
Referenced by CreateFromCodes(), and profinet::PNIOErrorDirectTests::DecodePnioCm().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Decodes a PROFINET IO (PNIO) error.
Interprets the first two PROFINET error-code bytes as a PNIO error. The first error-code byte selects the PNIO error category, while the second byte is decoded using the corresponding category-specific error-code enumeration.
If the first error-code byte is not recognized, a generic "Unknown PNIO error" message is returned.
| errorCode1 | First PROFINET PNIO error code byte identifying the error category. |
| errorCode2 | Second PROFINET PNIO error code byte identifying the specific error within the selected category. |
Definition at line 579 of file exceptions.cpp.
References errorCode1, errorCode2, profinet::GetPnioErrorMessage(), profinet::PrmServer, and profinet::Rmpm.
Referenced by CreateFromCodes(), and profinet::PNIOErrorDirectTests::DecodePnio().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Decodes a PROFINET Read/Write (PNIO RW) error.
Interprets the first two PROFINET error-code bytes as a PNIO Read/Write error. The first error-code byte selects the error category, while the second byte is decoded using the corresponding category-specific error-code enumeration.
If the first error-code byte is not recognized, a generic "Unknown PNIORW error" message is returned.
| errorCode1 | First PROFINET PNIO RW error code byte identifying the error category. |
| errorCode2 | Second PROFINET PNIO RW error code byte identifying the specific error within the selected category. |
Definition at line 595 of file exceptions.cpp.
References profinet::Access, profinet::Application, errorCode1, errorCode2, profinet::GetPnioRwErrorMessage(), profinet::InvalidIndex, profinet::Resource, and profinet::WriteLength.
Referenced by CreateFromCodes(), and profinet::PNIOErrorDirectTests::DecodePnioRw().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Create a PNIOError from the little-endian ArgsStatus field carried in a DCE/RPC PDU.
| argsStatus | Raw args status field as read from the wire (little-endian). |
Definition at line 522 of file exceptions.cpp.
References profinet::ByteAt(), profinet::ByteSwap(), CreateFromCodes(), errorCode, errorCode1, errorCode2, and errorDecode.
Referenced by profinet::rpc::RPCCon::Connect(), profinet::rpc::RPCCon::Read(), profinet::rpc::RPCCon::ReadImplicit(), profinet::rpc::RPCCon::SendControl(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::rpc::RPCCon::Write(), and profinet::rpc::RPCCon::WriteMultiple().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Create a PNIOError from a raw 4-byte error status.
| data | Span view containing exactly 4 bytes: ErrorCode, ErrorDecode, ErrorCode1, ErrorCode2. |
Definition at line 506 of file exceptions.cpp.
References CreateFromCodes().
Referenced by profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), profinet::TEST(), and profinet::TEST().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Whether this error came from the PNIO-CM (connection management) table.
Definition at line 737 of file exceptions.h.
References errorDecode, and profinet::PnioCm.
Referenced by BlockName().
Here is the caller graph for this function:
|
friend |
Test fixture for PNIO error unit tests, directly calling the functions.
Definition at line 748 of file exceptions.h.
| std::uint8_t profinet::PNIOError::errorCode = 0 |
Raw ErrorCode byte (see class-level.
).
Definition at line 695 of file exceptions.h.
Referenced by CreateFromCodes(), and FromArgsStatus().
| std::uint8_t profinet::PNIOError::errorCode1 = 0 |
Raw ErrorCode1 byte (category / block type).
Definition at line 701 of file exceptions.h.
Referenced by BlockName(), CreateFromCodes(), DecodePnioCmError(), DecodePnioError(), DecodePnioRWError(), profinet::rpc::RPCCon::EnumerateIndices(), and FromArgsStatus().
| std::uint8_t profinet::PNIOError::errorCode2 = 0 |
Raw ErrorCode2 byte (specific error within the category).
Definition at line 704 of file exceptions.h.
Referenced by CreateFromCodes(), DecodePnioCmError(), DecodePnioError(), DecodePnioRWError(), profinet::rpc::RPCCon::EnumerateIndices(), and FromArgsStatus().
| std::uint8_t profinet::PNIOError::errorDecode = 0 |
Raw ErrorDecode byte; selects which ErrorCode1/ErrorCode2 table applies.
Definition at line 698 of file exceptions.h.
Referenced by CreateFromCodes(), FromArgsStatus(), and IsCmError().