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

Complete parsed GSDML device profile. More...

#include <gsdml.h>

+ Collaboration diagram for profinet::gsdml::GSDMLDevice:

Public Member Functions

const GSDMLModuleFindModule (const std::string &moduleId) const
 Look up a module by its GSDML ID.
 
const GSDMLSubmoduleFindSubmodule (const std::string &submoduleId) const
 Look up a globally defined submodule.
 
std::vector< rpc::IOSlotBuildIoSlots (const std::vector< std::tuple< int, std::string, int, std::string > > &plugged={}) const
 Build I/O slot descriptions from the parsed GSDML configuration.
 

Public Attributes

std::string vendorName
 Vendor name from the GSDML's DeviceIdentity.
 
std::string deviceName
 Device name from the GSDML's DeviceIdentity / DeviceFunction.
 
std::uint16_t vendorId = 0
 PROFINET vendor ID from the GSDML's DeviceIdentity (VendorID attribute).
 
std::uint16_t deviceId = 0
 PROFINET device ID from the GSDML's DeviceIdentity (DeviceID attribute).
 
std::string dapModuleId
 The device access point's own (built-in) identifier to matchs with the submodule.
 
std::uint32_t dapSubmoduleIdentNumber = 0
 The device access point's own (built-in) submodule ident number.
 
std::uint32_t dapModuleIdentNumber = 0
 The device access point's own module ident number.
 
std::vector< int > dapSlots
 Slot numbers where the DAP may be fixed/plugged (from UseableModules/PlugSlots).
 
std::vector< GSDMLSubmoduledapSubmodules
 DAP virtual submodules.
 
std::vector< GSDMLSystemSubmodulesystemSubmodules
 System-defined submodules built into the DAP (e.g. interface, port 1).
 
std::map< std::string, GSDMLModulemodules
 Every module declared in the GSDML's ModuleList, keyed by GSDML ID.
 
std::map< std::string, GSDMLSubmodulesubmodules
 Every globally defined SubmoduleItem, keyed by GSDML ID.
 
std::vector< GSDMLModuleReferencemoduleReferences
 Modules referenced by the DAP's UseableModules list.
 

Detailed Description

Complete parsed GSDML device profile.

Definition at line 139 of file gsdml.h.

Member Function Documentation

◆ BuildIoSlots()

std::vector< rpc::IOSlot > profinet::gsdml::GSDMLDevice::BuildIoSlots ( const std::vector< std::tuple< int, std::string, int, std::string > > &  plugged = {}) const

Build I/O slot descriptions from the parsed GSDML configuration.

The generated list follows the behavior of the Python GSDMLDevice::build_io_slots() implementation:

  • DAP virtual submodules are added at slot 0 using subslots 1..N.
  • DAP system-defined submodules are added at their configured subslots.
  • An explicit plugged configuration overrides the GSDML-selected module/submodule configuration.
  • Without an explicit configuration, FixedInSlots/FixedInSubslots are used where present, otherwise UsedInSlots/UsedInSubslots are used.
  • AllowedInSlots/AllowedInSubslots constrain valid explicit assignments but do not themselves select a module or submodule.
  • All inline module submodules are included.
  • Module and submodule references are validated.
Parameters
pluggedExplicit module/submodule assignment. Each tuple contains: slot number, module ID, subslot number, and submodule ID. If empty, the configuration selected by FixedInSlots/UsedInSlots and FixedInSubslots/UsedInSubslots is resolved from the GSDML.
Returns
I/O slots suitable for cyclic I/O configuration.
Exceptions
std::invalid_argumentIf a module or submodule is unknown, or if a module is not allowed in the requested slot.

Definition at line 520 of file gsdml.cpp.

References dapModuleIdentNumber, dapSubmodules, FindSubmodule(), profinet::gsdml::GSDMLModule::id, profinet::rpc::IOSlot::inputIocs, profinet::rpc::IOSlot::inputIoData, profinet::gsdml::GSDMLSubmodule::inputLength, profinet::rpc::IOSlot::inputLength, profinet::rpc::IOSlot::moduleIdent, moduleReferences, profinet::rpc::IOSlot::outputIocs, profinet::rpc::IOSlot::outputIoData, profinet::gsdml::GSDMLSubmodule::outputLength, profinet::rpc::IOSlot::outputLength, profinet::rpc::IOSlot::slot, profinet::rpc::IOSlot::submoduleIdent, profinet::gsdml::GSDMLSubmodule::submoduleIdentNumber, profinet::gsdml::GSDMLModule::submoduleReferences, profinet::gsdml::GSDMLModule::submodules, profinet::rpc::IOSlot::subslot, and systemSubmodules.

+ Here is the call graph for this function:

◆ FindModule()

const GSDMLModule * profinet::gsdml::GSDMLDevice::FindModule ( const std::string &  moduleId) const

Look up a module by its GSDML ID.

Parameters
moduleIdGSDML ID attribute of the module.
Returns
A pointer to the module, or nullptr if not found (valid as long as this GSDMLDevice is alive).

Definition at line 423 of file gsdml.cpp.

References modules.

◆ FindSubmodule()

const GSDMLSubmodule * profinet::gsdml::GSDMLDevice::FindSubmodule ( const std::string &  submoduleId) const

Look up a globally defined submodule.

Parameters
submoduleIdGSDML ID attribute of the submodule.
Returns
A pointer to the submodule, or nullptr if not found (valid as long as this GSDMLDevice is alive).

Definition at line 428 of file gsdml.cpp.

References submodules.

Referenced by BuildIoSlots().

+ Here is the caller graph for this function:

Member Data Documentation

◆ dapModuleId

std::string profinet::gsdml::GSDMLDevice::dapModuleId

The device access point's own (built-in) identifier to matchs with the submodule.

Definition at line 151 of file gsdml.h.

Referenced by profinet::gsdml::ParseGsdmlString().

◆ dapModuleIdentNumber

std::uint32_t profinet::gsdml::GSDMLDevice::dapModuleIdentNumber = 0

The device access point's own module ident number.

Definition at line 155 of file gsdml.h.

Referenced by BuildIoSlots(), and profinet::gsdml::ParseGsdmlString().

◆ dapSlots

std::vector<int> profinet::gsdml::GSDMLDevice::dapSlots

Slot numbers where the DAP may be fixed/plugged (from UseableModules/PlugSlots).

Definition at line 157 of file gsdml.h.

Referenced by profinet::gsdml::ParseGsdmlString().

◆ dapSubmoduleIdentNumber

std::uint32_t profinet::gsdml::GSDMLDevice::dapSubmoduleIdentNumber = 0

The device access point's own (built-in) submodule ident number.

Definition at line 153 of file gsdml.h.

Referenced by profinet::gsdml::ParseGsdmlString().

◆ dapSubmodules

std::vector<GSDMLSubmodule> profinet::gsdml::GSDMLDevice::dapSubmodules

DAP virtual submodules.

Definition at line 160 of file gsdml.h.

Referenced by BuildIoSlots(), and profinet::gsdml::ParseGsdmlString().

◆ deviceId

std::uint16_t profinet::gsdml::GSDMLDevice::deviceId = 0

PROFINET device ID from the GSDML's DeviceIdentity (DeviceID attribute).

Definition at line 148 of file gsdml.h.

Referenced by profinet::gsdml::ParseGsdmlString().

◆ deviceName

std::string profinet::gsdml::GSDMLDevice::deviceName

Device name from the GSDML's DeviceIdentity / DeviceFunction.

Definition at line 144 of file gsdml.h.

Referenced by profinet::gsdml::ParseGsdmlString().

◆ moduleReferences

std::vector<GSDMLModuleReference> profinet::gsdml::GSDMLDevice::moduleReferences

Modules referenced by the DAP's UseableModules list.

Definition at line 172 of file gsdml.h.

Referenced by BuildIoSlots(), and profinet::gsdml::ParseGsdmlString().

◆ modules

std::map<std::string, GSDMLModule> profinet::gsdml::GSDMLDevice::modules

Every module declared in the GSDML's ModuleList, keyed by GSDML ID.

Definition at line 166 of file gsdml.h.

Referenced by FindModule(), and profinet::gsdml::ParseGsdmlString().

◆ submodules

std::map<std::string, GSDMLSubmodule> profinet::gsdml::GSDMLDevice::submodules

Every globally defined SubmoduleItem, keyed by GSDML ID.

Definition at line 169 of file gsdml.h.

Referenced by FindSubmodule(), and profinet::gsdml::ParseGsdmlString().

◆ systemSubmodules

std::vector<GSDMLSystemSubmodule> profinet::gsdml::GSDMLDevice::systemSubmodules

System-defined submodules built into the DAP (e.g. interface, port 1).

Definition at line 163 of file gsdml.h.

Referenced by BuildIoSlots(), and profinet::gsdml::ParseGsdmlString().

◆ vendorId

std::uint16_t profinet::gsdml::GSDMLDevice::vendorId = 0

PROFINET vendor ID from the GSDML's DeviceIdentity (VendorID attribute).

Definition at line 146 of file gsdml.h.

Referenced by profinet::gsdml::ParseGsdmlString().

◆ vendorName

std::string profinet::gsdml::GSDMLDevice::vendorName

Vendor name from the GSDML's DeviceIdentity.

Definition at line 142 of file gsdml.h.

Referenced by profinet::gsdml::ParseGsdmlString().


The documentation for this struct was generated from the following files: