4#include <gtest/gtest.h>
19TEST(ExceptionHierarchyTests, DcpErrorInheritsProfinetError)
21 EXPECT_TRUE((std::is_base_of_v<ProfinetError, DCPError>));
25TEST(ExceptionHierarchyTests, DcpTimeoutInheritsDcpError)
27 EXPECT_TRUE((std::is_base_of_v<DCPError, DCPTimeoutError>));
31TEST(ExceptionHierarchyTests, DcpDeviceNotFoundInheritsDcpError)
33 EXPECT_TRUE((std::is_base_of_v<DCPError, DCPDeviceNotFoundError>));
37TEST(ExceptionHierarchyTests, RpcErrorInheritsProfinetError)
39 EXPECT_TRUE((std::is_base_of_v<ProfinetError, RPCError>));
43TEST(ExceptionHierarchyTests, RpcTimeoutInheritsRpcError)
45 EXPECT_TRUE((std::is_base_of_v<RPCError, RPCTimeoutError>));
49TEST(ExceptionHierarchyTests, RpcFaultInheritsRpcError)
51 EXPECT_TRUE((std::is_base_of_v<RPCError, RPCFaultError>));
55TEST(ExceptionHierarchyTests, RpcConnectionInheritsRpcError)
57 EXPECT_TRUE((std::is_base_of_v<RPCError, RPCConnectionError>));
61TEST(ExceptionHierarchyTests, ValidationErrorInheritsProfinetError)
63 EXPECT_TRUE((std::is_base_of_v<ProfinetError, ValidationError>));
67TEST(ExceptionHierarchyTests, InvalidMacInheritsValidationError)
69 EXPECT_TRUE((std::is_base_of_v<ValidationError, InvalidMACError>));
73TEST(ExceptionHierarchyTests, InvalidIpInheritsValidationError)
75 EXPECT_TRUE((std::is_base_of_v<ValidationError, InvalidIPError>));
79TEST(ExceptionHierarchyTests, SocketErrorInheritsProfinetError)
81 EXPECT_TRUE((std::is_base_of_v<ProfinetError, SocketError>));
85TEST(ExceptionHierarchyTests, PermissionDeniedInheritsSocketError)
87 EXPECT_TRUE((std::is_base_of_v<SocketError, PermissionDeniedError>));
95TEST(RPCFaultErrorTests, FaultCodeDefault)
98 EXPECT_EQ(
error.faultCode, 0U);
102TEST(RPCFaultErrorTests, FaultCodeCustom)
105 EXPECT_EQ(
error.faultCode, 42U);
109TEST(RPCFaultErrorTests, Message)
112 EXPECT_STREQ(
error.what(),
"RPC fault occurred");
120TEST(ExceptionCatchingTests, CatchAllProfinetErrors)
129TEST(ExceptionCatchingTests, CatchDcpVariants)
136TEST(ExceptionCatchingTests, CatchRpcVariants)
149TEST(PNIOErrorTests, PnioErrorInheritsRpcError)
151 EXPECT_TRUE((std::is_base_of_v<RPCError, PNIOError>));
155TEST(PNIOErrorTests, DefaultValues)
158 EXPECT_EQ(
error.errorCode, 0);
159 EXPECT_EQ(
error.errorDecode, 0);
160 EXPECT_EQ(
error.errorCode1, 0);
161 EXPECT_EQ(
error.errorCode2, 0);
165TEST(PNIOErrorTests, CustomValues)
168 EXPECT_EQ(
error.errorCode, 0xDE);
169 EXPECT_EQ(
error.errorDecode, 0x80);
170 EXPECT_EQ(
error.errorCode1, 0xB2);
171 EXPECT_EQ(
error.errorCode2, 0x07);
175TEST(PNIOErrorTests, FromArgsStatusInvalidSlot)
178 constexpr std::uint32_t argsStatus = 0x07B280DE;
181 EXPECT_EQ(
error.errorCode, 0xDE);
182 EXPECT_EQ(
error.errorDecode, 0x80);
183 EXPECT_EQ(
error.errorCode1, 0xB2);
184 EXPECT_EQ(
error.errorCode2, 0x07);
185 EXPECT_NE(std::string(
error.what()).find(
"Invalid slot number"), std::string::npos);
189TEST(PNIOErrorTests, FromArgsStatusInvalidSubslot)
192 constexpr std::uint32_t argsStatus = 0x08B280DE;
195 EXPECT_EQ(
error.errorCode, 0xDE);
196 EXPECT_EQ(
error.errorDecode, 0x80);
197 EXPECT_EQ(
error.errorCode1, 0xB2);
198 EXPECT_EQ(
error.errorCode2, 0x08);
199 EXPECT_NE(std::string(
error.what()).find(
"Invalid subslot number"), std::string::npos);
203TEST(PNIOErrorTests, FromArgsStatusInvalidIndex)
206 constexpr std::uint32_t argsStatus = 0x00B080DE;
209 EXPECT_EQ(
error.errorCode, 0xDE);
210 EXPECT_EQ(
error.errorDecode, 0x80);
211 EXPECT_EQ(
error.errorCode1, 0xB0);
212 EXPECT_EQ(
error.errorCode2, 0x00);
213 EXPECT_NE(std::string(
error.what()).find(
"Index not supported"), std::string::npos);
217TEST(PNIOErrorTests, FromArgsStatusInvalidApi)
220 constexpr std::uint32_t argsStatus = 0x06B480DE;
223 EXPECT_EQ(
error.errorCode, 0xDE);
224 EXPECT_EQ(
error.errorDecode, 0x80);
225 EXPECT_EQ(
error.errorCode1, 0xB4);
226 EXPECT_EQ(
error.errorCode2, 0x06);
227 EXPECT_NE(std::string(
error.what()).find(
"Invalid API number"), std::string::npos);
231TEST(PNIOErrorTests, FromArgsStatusRmpmError)
235 constexpr std::uint32_t argsStatus = 0x014081DB;
238 EXPECT_EQ(
error.errorCode, 0xDB);
239 EXPECT_EQ(
error.errorDecode, 0x81);
240 EXPECT_EQ(
error.errorCode1, 0x40);
241 EXPECT_EQ(
error.errorCode2, 0x01);
242 EXPECT_NE(std::string(
error.what()).find(
"Unknown blocks in request"), std::string::npos);
246TEST(PNIOErrorTests, FromArgsStatusUnknownError)
249 constexpr std::uint32_t argsStatus = 0xFFB280DE;
252 EXPECT_EQ(
error.errorCode, 0xDE);
253 EXPECT_EQ(
error.errorCode2, 0xFF);
254 EXPECT_NE(std::string(
error.what()).find(
"Unknown"), std::string::npos);
261 const std::string result =
error.what();
262 EXPECT_NE(result.find(
"Test message"), std::string::npos);
266TEST(PNIOErrorTests, ErrorConstants)
281TEST(PNIOErrorTests, CreateFromCodesPnioCmAr)
283 const std::array<std::uint8_t, 4> data{
284 0x01, 0x40, 0x01, 0x00};
288 EXPECT_EQ(
error.errorCode, 0x01);
289 EXPECT_EQ(
error.errorDecode, 0x40);
290 EXPECT_EQ(
error.errorCode1, 0x01);
291 EXPECT_EQ(
error.errorCode2, 0x00);
292 EXPECT_EQ(std::string(
error.what()),
"Invalid AR type");
296TEST(PNIOErrorTests, CreateFromCodesPnioCmArResponse)
298 const std::array<std::uint8_t, 4> data{
299 0x01, 0x40, 0x81, 0x00};
303 EXPECT_EQ(
error.errorCode, 0x01);
304 EXPECT_EQ(
error.errorDecode, 0x40);
305 EXPECT_EQ(
error.errorCode1, 0x81);
306 EXPECT_EQ(
error.errorCode2, 0x00);
307 EXPECT_EQ(std::string(
error.what()),
"Invalid AR type (in response)");
311TEST(PNIOErrorTests, CreateFromCodesPnioCmIocr)
313 const std::array<std::uint8_t, 4> data{
314 0x01, 0x40, 0x02, 0x04};
318 EXPECT_EQ(std::string(
error.what()),
"Invalid IO data length");
322TEST(PNIOErrorTests, CreateFromCodesPnioCmIocrResponse)
324 const std::array<std::uint8_t, 4> data{
325 0x01, 0x40, 0x82, 0x04};
329 EXPECT_EQ(std::string(
error.what()),
"Invalid IO data length (in response)");
333TEST(PNIOErrorTests, CreateFromCodesPnioCmAlarmCr)
335 const std::array<std::uint8_t, 4> data{
336 0x01, 0x40, 0x03, 0x01};
340 EXPECT_EQ(std::string(
error.what()),
"Out of AlarmCR resources");
344TEST(PNIOErrorTests, CreateFromCodesPnioCmAlarmCrResponse)
346 const std::array<std::uint8_t, 4> data{
347 0x01, 0x40, 0x83, 0x01};
351 EXPECT_EQ(std::string(
error.what()),
"Out of AlarmCR resources (in response)");
355TEST(PNIOErrorTests, CreateFromCodesPnioCmExpectedSubmodule)
357 const std::array<std::uint8_t, 4> data{
358 0x01, 0x40, 0x04, 0x04};
362 EXPECT_EQ(std::string(
error.what()),
"IO data length mismatch");
366TEST(PNIOErrorTests, CreateFromCodesPnioCmDevice)
368 const std::array<std::uint8_t, 4> data{
369 0x01, 0x40, 0x3F, 0x02};
373 EXPECT_EQ(std::string(
error.what()),
"Device already owned");
377TEST(PNIOErrorTests, CreateFromCodesPnioCmFaultyBlock)
379 const std::array<std::uint8_t, 4> data{
380 0x01, 0x40, 0xFF, 0x00};
384 EXPECT_EQ(std::string(
error.what()),
"Faulty block structure");
388TEST(PNIOErrorTests, CreateFromCodesPnioCmUnknownErrorCode1)
390 const std::array<std::uint8_t, 4> data{
391 0x01, 0x40, 0x0A, 0x00};
395 EXPECT_EQ(std::string(
error.what()),
"Unknown CM error in Unknown (0x0A)");
403TEST(PNIOErrorTests, CreateFromCodesPnioRmpm)
405 const std::array<std::uint8_t, 4> data{
406 0x01, 0x81, 0x40, 0x02};
410 EXPECT_EQ(
error.errorCode, 0x01);
411 EXPECT_EQ(
error.errorDecode, 0x81);
412 EXPECT_EQ(
error.errorCode1, 0x40);
413 EXPECT_EQ(
error.errorCode2, 0x02);
414 EXPECT_EQ(std::string(
error.what()),
"Required IOCR block missing");
418TEST(PNIOErrorTests, CreateFromCodesPnioPrmServer)
420 const std::array<std::uint8_t, 4> data{
421 0x01, 0x81, 0x3D, 0x00};
425 EXPECT_EQ(std::string(
error.what()),
"Parameter server state conflict");
429TEST(PNIOErrorTests, CreateFromCodesPnioUnknownErrorCode1)
431 const std::array<std::uint8_t, 4> data{
432 0x01, 0x81, 0x0A, 0x00};
436 EXPECT_EQ(std::string(
error.what()),
"Unknown PNIO error");
444TEST(PNIOErrorTests, CreateFromCodesPnioRwInvalidIndex)
446 const std::array<std::uint8_t, 4> data{
447 0x01, 0x80, 0xB0, 0x05};
451 EXPECT_EQ(std::string(
error.what()),
452 "Index exists but has not been written");
456TEST(PNIOErrorTests, CreateFromCodesPnioRwWriteLength)
458 const std::array<std::uint8_t, 4> data{
459 0x01, 0x80, 0xB1, 0x03};
463 EXPECT_EQ(std::string(
error.what()),
464 "Write access denied (write protected)");
468TEST(PNIOErrorTests, CreateFromCodesPnioRwResource)
470 const std::array<std::uint8_t, 4> data{
471 0x01, 0x80, 0xB2, 0x08};
475 EXPECT_EQ(std::string(
error.what()),
"Invalid subslot number");
479TEST(PNIOErrorTests, CreateFromCodesPnioRwAccess)
481 const std::array<std::uint8_t, 4> data{
482 0x01, 0x80, 0xB3, 0x05};
486 EXPECT_EQ(std::string(
error.what()),
487 "Access denied (invalid state for access)");
491TEST(PNIOErrorTests, CreateFromCodesPnioRwApplication)
493 const std::array<std::uint8_t, 4> data{
494 0x01, 0x80, 0xB4, 0x08};
498 EXPECT_EQ(std::string(
error.what()),
"Alarm pending");
502TEST(PNIOErrorTests, CreateFromCodesPnioRwUnknownErrorCode1)
504 const std::array<std::uint8_t, 4> data{
505 0x01, 0x80, 0x0A, 0x00};
509 EXPECT_EQ(std::string(
error.what()),
"Unknown PNIORW error");
517TEST(PNIOErrorTests, CreateFromCodesUnknownErrorDecode)
519 const std::array<std::uint8_t, 4> data{
520 0x12, 0x7F, 0x34, 0x56};
524 EXPECT_EQ(
error.errorCode, 0x12);
525 EXPECT_EQ(
error.errorDecode, 0x7F);
526 EXPECT_EQ(
error.errorCode1, 0x34);
527 EXPECT_EQ(
error.errorCode2, 0x56);
528 EXPECT_EQ(std::string(
error.what()),
"Unknown error (Decode=0x7F)");
536TEST(PNIOErrorTests, FromBytesPreservesAllRawErrorBytes)
538 const std::array<std::uint8_t, 4> data{
539 0xDA, 0x40, 0x03, 0x01};
543 EXPECT_EQ(
error.errorCode, data[0]);
544 EXPECT_EQ(
error.errorDecode, data[1]);
545 EXPECT_EQ(
error.errorCode1, data[2]);
546 EXPECT_EQ(
error.errorCode2, data[3]);
550TEST(PNIOErrorTests, FromBytesUsesExpectedByteOrder)
552 const std::array<std::uint8_t, 4> data{
553 0xAA, 0x40, 0x01, 0x00};
557 EXPECT_EQ(
error.errorCode, 0xAA);
558 EXPECT_EQ(
error.errorDecode, 0x40);
559 EXPECT_EQ(
error.errorCode1, 0x01);
560 EXPECT_EQ(
error.errorCode2, 0x00);
568TEST(PNIOErrorTests, FromArgsStatusReversesByteOrder)
580 EXPECT_EQ(
error.errorCode, 0x01);
581 EXPECT_EQ(
error.errorDecode, 0x02);
582 EXPECT_EQ(
error.errorCode1, 0x03);
583 EXPECT_EQ(
error.errorCode2, 0x04);
584 EXPECT_EQ(std::string(
error.what()),
"Unknown error (Decode=0x02)");
588TEST(PNIOErrorTests, FromArgsStatusDecodesPnioCmError)
600 EXPECT_EQ(
error.errorCode, 0x01);
601 EXPECT_EQ(
error.errorDecode, 0x40);
602 EXPECT_EQ(
error.errorCode1, 0x01);
603 EXPECT_EQ(
error.errorCode2, 0x00);
604 EXPECT_EQ(std::string(
error.what()),
"Invalid AR type");
612TEST(PNIOErrorTests, IsCmErrorReturnsTrueForPnioCm)
614 const std::array<std::uint8_t, 4> data{
615 0x01, 0x40, 0x01, 0x00};
619 EXPECT_TRUE(
error.IsCmError());
623TEST(PNIOErrorTests, IsCmErrorReturnsFalseForPnioRw)
625 const std::array<std::uint8_t, 4> data{
626 0x01, 0x80, 0xB0, 0x00};
630 EXPECT_FALSE(
error.IsCmError());
634TEST(PNIOErrorTests, IsCmErrorReturnsFalseForPnio)
636 const std::array<std::uint8_t, 4> data{
637 0x01, 0x81, 0x40, 0x00};
641 EXPECT_FALSE(
error.IsCmError());
645TEST(PNIOErrorTests, IsCmErrorReturnsFalseForUnknownDecode)
647 const std::array<std::uint8_t, 4> data{
648 0x01, 0x7F, 0x01, 0x00};
652 EXPECT_FALSE(
error.IsCmError());
660TEST(PNIOErrorTests, BlockNameReturnsArBlock)
662 const std::array<std::uint8_t, 4> data{
663 0x01, 0x40, 0x01, 0x00};
667 EXPECT_EQ(
error.BlockName(),
"AR Block");
671TEST(PNIOErrorTests, BlockNameReturnsIocrBlock)
673 const std::array<std::uint8_t, 4> data{
674 0x01, 0x40, 0x02, 0x00};
678 EXPECT_EQ(
error.BlockName(),
"IOCR Block");
682TEST(PNIOErrorTests, BlockNameReturnsArResponseBlock)
684 const std::array<std::uint8_t, 4> data{
685 0x01, 0x40, 0x81, 0x00};
689 EXPECT_EQ(
error.BlockName(),
"AR Block Response");
693TEST(PNIOErrorTests, BlockNameReturnsUnknownForUnknownCmErrorCode1)
695 const std::array<std::uint8_t, 4> data{
696 0x01, 0x40, 0x0A, 0x00};
700 EXPECT_EQ(
error.BlockName(),
"Unknown (0x0A)");
704TEST(PNIOErrorTests, BlockNameReturnsEmptyForPnioRwError)
706 const std::array<std::uint8_t, 4> data{
707 0x01, 0x80, 0xB0, 0x00};
711 EXPECT_TRUE(
error.BlockName().empty());
715TEST(PNIOErrorTests, BlockNameReturnsEmptyForPnioError)
717 const std::array<std::uint8_t, 4> data{
718 0x01, 0x81, 0x40, 0x00};
722 EXPECT_TRUE(
error.BlockName().empty());
726TEST(PNIOErrorTests, BlockNameReturnsEmptyForUnknownDecode)
728 const std::array<std::uint8_t, 4> data{
729 0x01, 0x7F, 0x01, 0x00};
733 EXPECT_TRUE(
error.BlockName().empty());
741TEST(PNIOErrorTests, DirectConstructionPreservesMessageAndCodes)
750 EXPECT_EQ(std::string(
error.what()),
"test error");
751 EXPECT_EQ(
error.errorCode, 0xDA);
752 EXPECT_EQ(
error.errorDecode, 0x40);
753 EXPECT_EQ(
error.errorCode1, 0x03);
754 EXPECT_EQ(
error.errorCode2, 0x01);
758TEST(PNIOErrorTests, DirectConstructionIsCmError)
767 EXPECT_TRUE(
error.IsCmError());
771TEST(PNIOErrorTests, DirectConstructionIsNotCmError)
780 EXPECT_FALSE(
error.IsCmError());
786 const std::uint8_t errorCode,
787 const std::uint8_t errorDecode,
788 const std::uint8_t errorCode1,
789 const std::uint8_t errorCode2)
799 const std::uint8_t errorCode1,
800 const std::uint8_t errorCode2)
806 const std::uint8_t errorCode1,
807 const std::uint8_t errorCode2)
813 const std::uint8_t errorCode1,
814 const std::uint8_t errorCode2)
823 const auto error = CreateFromCodes(
829 EXPECT_EQ(
error.errorCode, 0x01);
830 EXPECT_EQ(
error.errorDecode, 0x40);
831 EXPECT_EQ(
error.errorCode1, 0x01);
832 EXPECT_EQ(
error.errorCode2, 0x00);
833 EXPECT_EQ(std::string(
error.what()),
"Invalid AR type");
839 const auto error = CreateFromCodes(
845 EXPECT_EQ(std::string(
error.what()),
"Invalid AR type (in response)");
851 const auto error = CreateFromCodes(
857 EXPECT_EQ(std::string(
error.what()),
"Invalid IO data length");
863 const auto error = CreateFromCodes(
869 EXPECT_EQ(std::string(
error.what()),
"Invalid IO data length (in response)");
875 const auto error = CreateFromCodes(
881 EXPECT_EQ(std::string(
error.what()),
"Out of AlarmCR resources");
887 const auto error = CreateFromCodes(
893 EXPECT_EQ(std::string(
error.what()),
"Out of AlarmCR resources (in response)");
899 const auto error = CreateFromCodes(
905 EXPECT_EQ(std::string(
error.what()),
"IO data length mismatch");
911 const auto error = CreateFromCodes(
917 EXPECT_EQ(std::string(
error.what()),
"Device already owned");
923 const auto error = CreateFromCodes(
929 EXPECT_EQ(std::string(
error.what()),
"Faulty block structure");
935 const auto error = CreateFromCodes(
941 EXPECT_EQ(std::string(
error.what()),
"Unknown CM error in Unknown (0x0A)");
947 const auto error = CreateFromCodes(
953 EXPECT_EQ(std::string(
error.what()),
"Required IOCR block missing");
959 const auto error = CreateFromCodes(
965 EXPECT_EQ(std::string(
error.what()),
"Parameter server state conflict");
971 const auto error = CreateFromCodes(
977 EXPECT_EQ(std::string(
error.what()),
"Unknown PNIO error");
983 const auto error = CreateFromCodes(
989 EXPECT_EQ(std::string(
error.what()),
"Index exists but has not been written");
995 const auto error = CreateFromCodes(
1001 EXPECT_EQ(std::string(
error.what()),
"Write access denied (write protected)");
1007 const auto error = CreateFromCodes(
1013 EXPECT_EQ(std::string(
error.what()),
"Invalid subslot number");
1019 const auto error = CreateFromCodes(
1025 EXPECT_EQ(std::string(
error.what()),
"Access denied (invalid state for access)");
1031 const auto error = CreateFromCodes(
1037 EXPECT_EQ(std::string(
error.what()),
"Alarm pending");
1043 const auto error = CreateFromCodes(
1049 EXPECT_EQ(std::string(
error.what()),
"Unknown PNIORW error");
1055 const auto error = CreateFromCodes(
1061 EXPECT_EQ(
error.errorCode, 0xDA);
1062 EXPECT_EQ(
error.errorDecode, 0x40);
1063 EXPECT_EQ(
error.errorCode1, 0x03);
1064 EXPECT_EQ(
error.errorCode2, 0x01);
1070 const auto error = CreateFromCodes(
1076 EXPECT_EQ(
error.errorCode, 0xCF);
1077 EXPECT_EQ(
error.errorDecode, 0x80);
1078 EXPECT_EQ(
error.errorCode1, 0xB3);
1079 EXPECT_EQ(
error.errorCode2, 0x06);
1085 const auto error = CreateFromCodes(
1091 EXPECT_EQ(
error.errorCode, 0xDB);
1092 EXPECT_EQ(
error.errorDecode, 0x81);
1093 EXPECT_EQ(
error.errorCode1, 0x40);
1094 EXPECT_EQ(
error.errorCode2, 0x04);
1100 EXPECT_EQ(DecodePnioCm(
static_cast<std::uint8_t
>(
PnioCmErrorCode1::Ar), 0x00),
"Invalid AR type");
1112 EXPECT_EQ(DecodePnioCm(
static_cast<std::uint8_t
>(
PnioCmErrorCode1::Ar), 0x01),
"AR already active");
1171 EXPECT_EQ(DecodePnioCm(
static_cast<std::uint8_t
>(
PnioCmErrorCode1::Iocr), 0x04),
"Invalid IO data length");
1213 EXPECT_EQ(DecodePnioCm(0x0A, 0x00),
"Unknown CM error in Unknown (0x0A)");
1219 EXPECT_EQ(DecodePnio(
static_cast<std::uint8_t
>(
PnioErrorCode1::Rmpm), 0x02),
"Required IOCR block missing");
1231 EXPECT_EQ(DecodePnio(0x0A, 0x00),
"Unknown PNIO error");
1254 EXPECT_EQ(DecodePnioRw(
static_cast<std::uint8_t
>(
PnioRwErrorCode1::Access), 0x05),
"Access denied (invalid state for access)");
1266 EXPECT_EQ(DecodePnioRw(0x0A, 0x00),
"Unknown PNIORW error");
Device not found via DCP.
static std::string DecodePnio(const std::uint8_t errorCode1, const std::uint8_t errorCode2)
static std::string DecodePnioCm(const std::uint8_t errorCode1, const std::uint8_t errorCode2)
static PNIOError CreateFromCodes(const std::uint8_t errorCode, const std::uint8_t errorDecode, const std::uint8_t errorCode1, const std::uint8_t errorCode2)
static std::string DecodePnioRw(const std::uint8_t errorCode1, const std::uint8_t errorCode2)
PNIO application error with error codes.
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 P...
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 std::string DecodePnioCmError(const std::uint8_t &errorCode1, const std::uint8_t &errorCode2)
Decodes a PROFINET Communication Manager (CM) error.
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.
Base exception for all PROFINET errors.
Failed to establish RPC connection.
RPC returned a fault response.
Declares exceptions and error types used by the PROFINET IO controller stack.
@ AlarmCr
AlarmCRBlock request.
@ ArResponse
ARBlock response.
@ CmDev
Connection management device.
@ ExpectedSubmodule
ExpectedSubmoduleBlock request.
@ IocrResponse
IOCRBlock response.
@ AlarmCrResponse
AlarmCRBlock response.
@ FaultyBlock
Faulty block structure.
TEST_F(AlarmListenerTests, InitializesWithEndpoint)
TEST(AlarmEndpointTests, DefaultTransportIsLayer2)
ErrorDecode
PROFINET error decode values.
@ Pnio
General PNIO error.
@ PnioRw
PNIO read/write error.
@ PnioCm
PNIO connection management error.
@ PrmServer
Parameter server error.
@ Rmpm
Runtime parameter and module management (RMPM) error.
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.
PnioCmArErrorCode2
PNIO-CM AR ErrorCode2 values.
@ InvalidSessionKey
The session key is invalid.
@ NoAlarmResources
No alarm resources are available.
@ NoConsumerResources
No consumer resources are available.
@ 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.