PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::io Namespace Reference

Classes

struct  GSDMLBitDataItem
 One bit-defined logical signal within a GSDML DataItem. More...
 
struct  IoSignal
 Describes one logical process-data signal available from a GSDML device. More...
 
class  IoSignalCatalog
 Builds and owns the logical sensor and actuator signals described by a GSDML device. More...
 

Enumerations

enum class  IoSignalDirection { Sensor , Actuator }
 Logical direction of a process-data signal from the controller's perspective. More...
 
enum class  IoSignalValueType {
  Boolean , SignedInteger , UnsignedInteger , FloatingPoint ,
  Unsupported
}
 Logical value category used when exposing a signal to higher layers. More...
 

Functions

IoSignalValueType ClassifyDataType (std::string_view dataType) noexcept
 Classify a GSDML DataType into a logical connector value category.
 
bool IsReservedSignal (std::string_view textId, std::string_view name) noexcept
 Determine whether a DataItem should be hidden from the normal signal catalogue.
 
bool IsReservedSignal (std::string_view textId, std::string_view bitId, std::string_view name) noexcept
 Determine whether a DataItem should be hidden from the normal signal catalogue.
 
 TEST (IoSignalTypeTests, ClassifiesAllDoubleCompatibleScalarTypes)
 
 TEST (IoSignalTypeTests, ClassifiesUnsupportedAndUnknownTypes)
 
 TEST (IoSignalReservedTests, DetectsReservedTextIdsCaseInsensitively)
 
 TEST (IoSignalReservedTests, DoesNotMisclassifyNormalSignals)
 
 TEST (IoSignalTests, DirectionAccessorsReportCorrectDirection)
 
 TEST (IoSignalTests, DoubleCompatibilityAccessorMirrorsFlag)
 
 TEST (IoSignalCatalogTests, EmptyDeviceProducesEmptyCatalogue)
 
 TEST (IoSignalCatalogTests, SeparatesInputAndOutputSignals)
 
 TEST (IoSignalCatalogTests, CalculatesIndependentInputAndOutputOffsets)
 
 TEST (IoSignalCatalogTests, ZeroLengthDataItemDoesNotAdvanceOffset)
 
 TEST (IoSignalCatalogTests, NegativeDataItemLengthThrows)
 
 TEST (IoSignalCatalogTests, EmptyTextIdUsesFallbackName)
 
 TEST (IoSignalCatalogTests, FiltersReservedItems)
 
 TEST (IoSignalCatalogTests, ReservedItemStillAdvancesOffset)
 
 TEST (IoSignalCatalogTests, KeepsUnsupportedSignalsWithCompatibilityFalse)
 
 TEST (IoSignalCatalogTests, SupportedScalarSignalsAreDoubleCompatible)
 
 TEST (IoSignalCatalogTests, PreservesModuleAndSubmoduleMetadata)
 
 TEST (IoSignalCatalogTests, CombinesAndNormalizesPossibleModuleSlots)
 
 TEST (IoSignalCatalogTests, CombinesAndNormalizesPossibleInlineSubmoduleSlots)
 
 TEST (IoSignalCatalogTests, IncludesAllModulesWhenNoModuleReferencesExist)
 
 TEST (IoSignalCatalogTests, UsesOnlyReferencedModulesWhenReferencesExist)
 
 TEST (IoSignalCatalogTests, MergesDuplicateModuleReferences)
 
 TEST (IoSignalCatalogTests, ResolvesGlobalSubmoduleReference)
 
 TEST (IoSignalCatalogTests, PrefersInlineSubmoduleOverDuplicateGlobalReference)
 
 TEST (IoSignalCatalogTests, UnknownModuleReferenceThrows)
 
 TEST (IoSignalCatalogTests, MergesDuplicateSubmoduleReferences)
 
 TEST (IoSignalCatalogTests, UnknownSubmoduleReferenceThrows)
 
 TEST (IoSignalCatalogTests, IncludesDapVirtualSubmoduleSignals)
 
 TEST (IoSignalCatalogTests, RetainsDuplicateSignalNamesAcrossSubmodules)
 
 TEST (IoSignalCatalogTests, MaintainsDeterministicCatalogueOrder)
 
 TEST (IoSignalCatalogTests, ExpandsBitDataItemsIntoIndividualSignals)
 
 TEST (IoSignalCatalogTests, BitSignalsAreBooleanAndDoubleCompatible)
 
 TEST (IoSignalCatalogTests, BitDataItemDoesNotCreateParentSignal)
 
 TEST (IoSignalCatalogTests, ConvertsBitOffsetToByteAndBitOffset)
 
 TEST (IoSignalCatalogTests, BitSignalsRetainParentDataItemOffset)
 

Enumeration Type Documentation

◆ IoSignalDirection

Logical direction of a process-data signal from the controller's perspective.

Enumerator
Sensor 

Data received from the PROFINET device and therefore exposed as a sensor.

Actuator 

Data sent to the PROFINET device and therefore exposed as an actuator.

Definition at line 29 of file IOSignal.h.

◆ IoSignalValueType

Logical value category used when exposing a signal to higher layers.

Enumerator
Boolean 

Boolean value, represented by the connector as 0.0 or 1.0.

SignedInteger 

Signed integer value.

UnsignedInteger 

Unsigned integer value.

FloatingPoint 

IEEE floating-point value.

Unsupported 

Data for which this catalogue does not define a numeric double representation.

Definition at line 39 of file IOSignal.h.

Function Documentation

◆ ClassifyDataType()

IoSignalValueType profinet::io::ClassifyDataType ( std::string_view  dataType)
noexcept

Classify a GSDML DataType into a logical connector value category.

Parameters
dataTypeGSDML DataType string.
Returns
Corresponding logical value type.

Definition at line 433 of file IOSignal.cpp.

References Boolean, FloatingPoint, SignedInteger, UnsignedInteger, and Unsupported.

Referenced by TEST(), and TEST().

+ Here is the caller graph for this function:

◆ IsReservedSignal() [1/2]

bool profinet::io::IsReservedSignal ( std::string_view  textId,
std::string_view  bitId,
std::string_view  name 
)
noexcept

Determine whether a DataItem should be hidden from the normal signal catalogue.

GSDML vendors commonly use name - for reserved bit process-data locations. Matching is deliberately limited to the character -

Parameters
textIdGSDML TextId.
bitIdGSDML BitId.
nameCurrent display name.
Returns
True when the signal is identified as reserved.

Definition at line 460 of file IOSignal.cpp.

◆ IsReservedSignal() [2/2]

bool profinet::io::IsReservedSignal ( std::string_view  textId,
std::string_view  name 
)
noexcept

Determine whether a DataItem should be hidden from the normal signal catalogue.

GSDML vendors commonly use TextIds such as T_ID_RESERVE_INPUT for reserved process-data locations. Matching is deliberately limited to the words RESERVE and RESERVED; arbitrary application names are not treated as reserved.

Parameters
textIdGSDML TextId.
nameCurrent display name.
Returns
True when the signal is identified as reserved.

Definition at line 465 of file IOSignal.cpp.

Referenced by TEST(), TEST(), profinet::gsdml::TEST_F(), and profinet::gsdml::TEST_F().

+ Here is the caller graph for this function:

◆ TEST() [1/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
BitDataItemDoesNotCreateParentSignal   
)
Test:
Verify a bit-defined DataItem is represented by its logical bits, not by an additional byte-valued signal.

Definition at line 789 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [2/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
BitSignalsAreBooleanAndDoubleCompatible   
)
Test:
Verify BitDataItems are exposed as boolean double-compatible signals.

Definition at line 759 of file test_IOSignal.cpp.

References Boolean, profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [3/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
BitSignalsRetainParentDataItemOffset   
)
Test:
Verify bit signals retain the byte offset of their parent DataItem.

Definition at line 867 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [4/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
CalculatesIndependentInputAndOutputOffsets   
)
Test:
Verify DataItem offsets accumulate independently for input and output process data.

Definition at line 220 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [5/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
CombinesAndNormalizesPossibleInlineSubmoduleSlots   
)
Test:
Verify inline submodule placement metadata combines all known subslot references.

Definition at line 433 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [6/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
CombinesAndNormalizesPossibleModuleSlots   
)
Test:
Verify module placement metadata combines allowed, fixed and used slots without duplicates.

Definition at line 412 of file test_IOSignal.cpp.

References profinet::gsdml::GSDMLModuleReference::allowedSlots, profinet::gsdml::GSDMLModuleReference::fixedSlots, profinet::io::IoSignalCatalog::FromGsdml(), profinet::gsdml::GSDMLModuleReference::moduleId, profinet::gsdml::GSDMLDevice::moduleReferences, profinet::gsdml::GSDMLDevice::modules, and profinet::gsdml::GSDMLModuleReference::usedSlots.

+ Here is the call graph for this function:

◆ TEST() [7/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
ConvertsBitOffsetToByteAndBitOffset   
)
Test:
Verify BitDataItem offsets are converted into process-data byte and bit offsets.

Definition at line 816 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [8/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
EmptyDeviceProducesEmptyCatalogue   
)
Test:
Verify a completely empty GSDML device produces an empty catalogue.

Definition at line 188 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml().

+ Here is the call graph for this function:

◆ TEST() [9/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
EmptyTextIdUsesFallbackName   
)
Test:
Verify an empty TextId gets a deterministic non-empty fallback display name.

Definition at line 283 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [10/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
ExpandsBitDataItemsIntoIndividualSignals   
)
Test:
Verify that BitDataItems become individual logical boolean signals.

Definition at line 714 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [11/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
FiltersReservedItems   
)
Test:
Verify reserved process-data items are omitted while other items remain.

Definition at line 298 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [12/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
IncludesAllModulesWhenNoModuleReferencesExist   
)
Test:
Verify a module with no DAP reference is still catalogued when no module reference list exists.

Definition at line 451 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [13/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
IncludesDapVirtualSubmoduleSignals   
)

◆ TEST() [14/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
KeepsUnsupportedSignalsWithCompatibilityFalse   
)
Test:
Verify unsupported DataItems remain visible but are marked non-double-compatible.

Definition at line 348 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), profinet::gsdml::GSDMLDevice::modules, and Unsupported.

+ Here is the call graph for this function:

◆ TEST() [15/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
MaintainsDeterministicCatalogueOrder   
)
Test:
Verify signal insertion order follows deterministic module/submodule and DataItem order.

Definition at line 665 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [16/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
MergesDuplicateModuleReferences   
)
Test:
Verify duplicate module references are merged into one module catalogue entry.

Definition at line 489 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), profinet::gsdml::GSDMLDevice::moduleReferences, and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [17/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
MergesDuplicateSubmoduleReferences   
)
Test:
Verify duplicate global submodule references are merged into one catalogue entry.

Definition at line 572 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), profinet::gsdml::GSDMLSubmodule::id, profinet::gsdml::GSDMLSubmodule::inputItems, profinet::gsdml::GSDMLDevice::moduleReferences, profinet::gsdml::GSDMLDevice::modules, and profinet::gsdml::GSDMLDevice::submodules.

+ Here is the call graph for this function:

◆ TEST() [18/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
NegativeDataItemLengthThrows   
)
Test:
Verify negative DataItem lengths are rejected instead of being converted to a huge unsigned size.

Definition at line 272 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [19/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
PrefersInlineSubmoduleOverDuplicateGlobalReference   
)
Test:
Verify inline submodules take precedence over duplicate global definitions.

Definition at line 540 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), profinet::gsdml::GSDMLSubmodule::id, profinet::gsdml::GSDMLSubmodule::inputItems, profinet::gsdml::GSDMLDevice::modules, profinet::gsdml::GSDMLSubmodule::name, and profinet::gsdml::GSDMLDevice::submodules.

+ Here is the call graph for this function:

◆ TEST() [20/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
PreservesModuleAndSubmoduleMetadata   
)
Test:
Verify module and submodule metadata is copied to every signal.

Definition at line 390 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [21/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
ReservedItemStillAdvancesOffset   
)
Test:
Verify a reserved DataItem still occupies its wire bytes when calculating later offsets.

Definition at line 325 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [22/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
ResolvesGlobalSubmoduleReference   
)

◆ TEST() [23/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
RetainsDuplicateSignalNamesAcrossSubmodules   
)
Test:
Verify duplicated signal names are retained because the name alone is not a unique device key.

Definition at line 646 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [24/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
SeparatesInputAndOutputSignals   
)
Test:
Verify input and output DataItems become sensors and actuators respectively.

Definition at line 199 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [25/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
SupportedScalarSignalsAreDoubleCompatible   
)
Test:
Verify all supported scalar DataTypes are exposed as double-compatible signals.

Definition at line 367 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [26/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
UnknownModuleReferenceThrows   
)
Test:
Verify an unresolved module reference is reported instead of silently losing signals.

Definition at line 562 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::moduleReferences.

+ Here is the call graph for this function:

◆ TEST() [27/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
UnknownSubmoduleReferenceThrows   
)
Test:
Verify an unresolved global submodule reference is reported instead of silently losing signals.

Definition at line 598 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), profinet::gsdml::GSDMLDevice::moduleReferences, and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [28/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
UsesOnlyReferencedModulesWhenReferencesExist   
)
Test:
Verify that a non-empty module reference list limits catalogue construction to referenced modules.

Definition at line 470 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), profinet::gsdml::GSDMLDevice::moduleReferences, and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [29/35]

profinet::io::TEST ( IoSignalCatalogTests  ,
ZeroLengthDataItemDoesNotAdvanceOffset   
)
Test:
Verify a zero-length DataItem does not advance the following item's offset.

Definition at line 251 of file test_IOSignal.cpp.

References profinet::io::IoSignalCatalog::FromGsdml(), and profinet::gsdml::GSDMLDevice::modules.

+ Here is the call graph for this function:

◆ TEST() [30/35]

profinet::io::TEST ( IoSignalReservedTests  ,
DetectsReservedTextIdsCaseInsensitively   
)
Test:
Verify reserved detection handles the vendor naming style used in GSDML TextIds.

Definition at line 139 of file test_IOSignal.cpp.

References IsReservedSignal().

+ Here is the call graph for this function:

◆ TEST() [31/35]

profinet::io::TEST ( IoSignalReservedTests  ,
DoesNotMisclassifyNormalSignals   
)
Test:
Verify normal application names containing no reserved marker are retained.

Definition at line 150 of file test_IOSignal.cpp.

References IsReservedSignal().

+ Here is the call graph for this function:

◆ TEST() [32/35]

profinet::io::TEST ( IoSignalTests  ,
DirectionAccessorsReportCorrectDirection   
)
Test:
Verify sensor and actuator accessors expose the direction correctly.

Definition at line 162 of file test_IOSignal.cpp.

References Actuator, profinet::io::IoSignal::direction, profinet::io::IoSignal::IsActuator(), profinet::io::IoSignal::IsSensor(), and Sensor.

+ Here is the call graph for this function:

◆ TEST() [33/35]

profinet::io::TEST ( IoSignalTests  ,
DoubleCompatibilityAccessorMirrorsFlag   
)
Test:
Verify the connector compatibility accessor mirrors the stored compatibility flag.

Definition at line 176 of file test_IOSignal.cpp.

References profinet::io::IoSignal::doubleCompatible, and profinet::io::IoSignal::IsDoubleCompatible().

+ Here is the call graph for this function:

◆ TEST() [34/35]

profinet::io::TEST ( IoSignalTypeTests  ,
ClassifiesAllDoubleCompatibleScalarTypes   
)
Test:
Verify all integer and floating-point DataTypes intended for the connector are classified.

Definition at line 95 of file test_IOSignal.cpp.

References Boolean, ClassifyDataType(), FloatingPoint, SignedInteger, and UnsignedInteger.

+ Here is the call graph for this function:

◆ TEST() [35/35]

profinet::io::TEST ( IoSignalTypeTests  ,
ClassifiesUnsupportedAndUnknownTypes   
)
Test:
Verify data types without an explicitly supported numeric connector representation are rejected.

Definition at line 119 of file test_IOSignal.cpp.

References ClassifyDataType(), and Unsupported.

+ Here is the call graph for this function: