98 std::uint16_t
raw = 0;
247 std::optional<ExtChannelDiagnosis>
ext;
311 if (e.base.properties.maintenanceRequired)
325 if (e.base.properties.naintenanceDemanded)
336 [[nodiscard]] std::vector<const AnyChannelDiagnosis*>
GetByChannel(std::uint16_t channel)
const
338 std::vector<const AnyChannelDiagnosis*> result;
341 if (e.base.channelNumber == channel)
343 result.push_back(&e);
377 std::uint16_t subslot = 0);
391 std::uint16_t subslot = 0);
std::string DecodeChannelErrorType(std::uint16_t errorType)
Decode a ChannelErrorType to a human-readable string.
ChannelDirection
Data direction, packed into ChannelProperties bits 11-12.
@ Output
Output direction.
@ Bidirectional
Bidirectional.
@ Manufacturer
Manufacturer-specific direction.
DiagnosisData ParseDiagnosisSimple(const Bytes &data, std::uint32_t api=0, std::uint16_t slot=0, std::uint16_t subslot=0)
Parse a simple, fixed-format diagnosis block.
DiagnosisData ParseDiagnosisBlock(const Bytes &data, std::uint32_t api=0, std::uint16_t slot=0, std::uint16_t subslot=0)
Parse a full DiagnosisData block from raw bytes.
ChannelType
Channel type, packed into ChannelProperties bits 0-1.
@ Reserved
Reserved value.
@ All
All channels of the submodule.
@ Submodule
The whole submodule.
@ Specific
A specific, individually addressed channel.
ChannelAccumulative
Accumulative info, packed into ChannelProperties bits 2-4.
@ AdditionalFault
Additional fault.
ChannelSpecifier
Diagnosis specifier, packed into ChannelProperties bits 8-10.
@ Appears
Diagnosis appears.
@ Disappears
Diagnosis disappears.
@ AllDisappears
All diagnosis of the submodule disappears.
@ DisappearsOther
Diagnosis disappears but others remain.
std::string DecodeExtChannelErrorType(std::uint16_t channelErrorType, std::uint16_t extErrorType)
Decode an ExtChannelErrorType given its ChannelErrorType context.
@ Bit15AndExternalChannelDiagnosisOfChannelNumber
Check diagnosis is in external channel diagnosis (bit 15 of ChannelNumber + 0x02).
@ Bit15OfChannelNumber
Check diagnosis is accumulative (bit 15 of ChannelNumber).
@ Bit15AndQualifiedChannelDiagnosisOfChannelNumber
Check diagnosis is in qualified channel diagnosis (bit 15 of ChannelNumber + 0x03).
std::vector< std::uint8_t > Bytes
Generic byte buffer alias used throughout the library for raw wire data.
PROFINET protocol wire-format structures and serialization helpers.
Any diagnosis entry (USI 0x8000, 0x8002, or 0x8003).
bool IsExtChannelDiagnosis() const
Whether this is the ExtChannelDiagnosis variant.
bool IsQualifiedChannelDiagnosis() const
Whether this is the QualifiedChannelDiagnosis variant.
std::uint16_t usi
The USI that determined which entry type was parsed.
bool IsChannelDiagnosis() const
Whether this is the plain ChannelDiagnosis variant.
ChannelDiagnosis base
Common fields, always populated.
bool operator==(const AnyChannelDiagnosis &) const =default
Compares two AnyChannelDiagnosis for equality.
std::optional< QualifiedChannelDiagnosis > qualified
Qualified fields, populated only for USI 0x8003.
std::optional< ExtChannelDiagnosis > ext
Extended fields, populated only for USI 0x8002/0x8003.
ChannelDiagnosis entry (USI 0x8000).
std::uint16_t subslot
Subslot number.
std::uint16_t channelNumber
Channel number, with the accumulative bit packed into bit 15.
std::string errorTypeName
Human-readable name for ErrorType.
bool operator==(const ChannelDiagnosis &) const =default
Compares two ChannelDiagnosis for equality.
bool IsSubmoduleLevel() const
Whether this diagnosis applies to the whole submodule.
std::uint16_t slot
Slot number.
std::uint16_t errorType
Channel error type code.
ChannelProperties properties
Decoded channel properties.
std::uint32_t api
API number.
Parsed ChannelProperties word (16 bits).
std::string SpecifierName() const
Human-readable name for Specifier.
std::string DirectionName() const
Human-readable name for Direction.
bool maintenanceRequired
Maintenance required flag (bit 5).
bool naintenanceDemanded
Maintenance demanded flag (bit 6).
std::string ChannelTypeName() const
Human-readable name for ChannelTypeValue.
ChannelAccumulative accumulative
Accumulative info (bits 2-4).
ChannelType channelTypeValue
Channel type (bits 0-1).
ChannelDirection direction
Data direction (bits 11-12).
ChannelSpecifier specifier
Diagnosis specifier (bits 8-10).
static ChannelProperties FromUint16(std::uint16_t value)
Decode a raw 16-bit ChannelProperties value.
std::uint16_t raw
Raw 16-bit ChannelProperties value.
bool operator==(const ChannelProperties &) const =default
Compares two ChannelProperties for equality.
Complete diagnosis data for one slot/subslot.
bool HasMaintenanceRequired() const
Whether any entry has its maintenance-required flag set.
bool HasMaintenanceDemanded() const
Whether any entry has its maintenance-demanded flag set.
std::vector< AnyChannelDiagnosis > entries
Parsed diagnosis entries.
std::vector< const AnyChannelDiagnosis * > GetByChannel(std::uint16_t channel) const
Find every entry for a specific channel number.
bool operator==(const DiagnosisData &) const =default
Compares two DiagnosisData for equality.
Bytes rawData
Raw, undecoded source data.
std::uint32_t api
API number.
std::uint16_t subslot
Subslot number.
bool HasErrors() const
Whether any diagnosis entries were found.
std::uint16_t slot
Slot number.
ExtChannelDiagnosis entry (USI 0x8002).
std::uint32_t extAddValue
Extended channel additional value.
std::string extErrorTypeName
Human-readable name for ExtErrorType.
std::uint16_t extErrorType
Extended channel error type code.
QualifiedChannelDiagnosis entry (USI 0x8003).
std::uint32_t qualifier
Qualifier bitmask providing additional severity/context info.