PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
diagnosis.h File Reference

PROFINET diagnosis data structures, error decoding, and parsers. More...

#include <cstdint>
#include <optional>
#include <string>
#include <vector>
#include "profinet/protocol.h"
+ Include dependency graph for diagnosis.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  profinet::diagnosis::ChannelProperties
 Parsed ChannelProperties word (16 bits). More...
 
struct  profinet::diagnosis::ChannelDiagnosis
 ChannelDiagnosis entry (USI 0x8000). More...
 
struct  profinet::diagnosis::ExtChannelDiagnosis
 ExtChannelDiagnosis entry (USI 0x8002). More...
 
struct  profinet::diagnosis::QualifiedChannelDiagnosis
 QualifiedChannelDiagnosis entry (USI 0x8003). More...
 
struct  profinet::diagnosis::AnyChannelDiagnosis
 Any diagnosis entry (USI 0x8000, 0x8002, or 0x8003). More...
 
struct  profinet::diagnosis::DiagnosisData
 Complete diagnosis data for one slot/subslot. More...
 

Namespaces

namespace  profinet
 
namespace  profinet::diagnosis
 

Enumerations

enum class  profinet::diagnosis::ChannelType : std::uint8_t { profinet::diagnosis::Reserved = 0 , profinet::diagnosis::Specific = 1 , profinet::diagnosis::All = 2 , profinet::diagnosis::Submodule = 3 }
 Channel type, packed into ChannelProperties bits 0-1. More...
 
enum class  profinet::diagnosis::ChannelAccumulative : std::uint8_t { profinet::diagnosis::No = 0 , profinet::diagnosis::MainFault = 1 , profinet::diagnosis::AdditionalFault = 2 }
 Accumulative info, packed into ChannelProperties bits 2-4. More...
 
enum class  profinet::diagnosis::ChannelSpecifier : std::uint8_t { profinet::diagnosis::AllDisappears = 0 , profinet::diagnosis::Appears = 1 , profinet::diagnosis::Disappears = 2 , profinet::diagnosis::DisappearsOther = 3 }
 Diagnosis specifier, packed into ChannelProperties bits 8-10. More...
 
enum class  profinet::diagnosis::ChannelDirection : std::uint8_t { profinet::diagnosis::Manufacturer = 0 , profinet::diagnosis::Input = 1 , profinet::diagnosis::Output = 2 , profinet::diagnosis::Bidirectional = 3 }
 Data direction, packed into ChannelProperties bits 11-12. More...
 

Functions

std::string profinet::diagnosis::DecodeChannelErrorType (std::uint16_t errorType)
 Decode a ChannelErrorType to a human-readable string.
 
std::string profinet::diagnosis::DecodeExtChannelErrorType (std::uint16_t channelErrorType, std::uint16_t extErrorType)
 Decode an ExtChannelErrorType given its ChannelErrorType context.
 
DiagnosisData profinet::diagnosis::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.
 
DiagnosisData profinet::diagnosis::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.
 

Detailed Description

PROFINET diagnosis data structures, error decoding, and parsers.

Defines the data structures and parsing helpers used to decode PROFINET diagnosis records. The implementation is ported from profinet-py's diagnosis.py and supports standard channel, extended channel, and qualified channel diagnosis formats.

The header provides:

  • ChannelProperties bit-field decoding and human-readable descriptions.
  • Channel diagnosis types for USI 0x8000, 0x8002, and 0x8003.
  • Human-readable decoding of channel and extended error types.
  • DiagnosisData for collecting parsed diagnosis entries and location data.
  • Maintenance-required and maintenance-demanded status helpers.
  • Channel-based diagnosis filtering.
  • Parsing of full diagnosis blocks with optional location information.
  • Parsing of the simpler fixed-format diagnosis block representation.

Parsing is designed to tolerate truncated or malformed diagnosis data without throwing, matching the behavior of the original profinet-py implementation.

Definition in file diagnosis.h.