6#include <nlohmann/json_fwd.hpp>
205 return "PreOP_SafeOP";
442 std::optional<int32_t>
sm;
443 std::optional<int32_t>
su;
512 std::optional<MailboxCoe>
coe;
534 std::optional<MailboxCoe>
coe;
575std::expected<EsiFile, std::string>
parseEsi(std::string_view xml);
579std::expected<EsiFile, std::string>
parseEsiFile(
const std::filesystem::path& path);
592 std::optional<uint32_t> revisionNo = std::nullopt);
std::expected< EsiFile, std::string > parseEsi(std::string_view xml)
Parses an ESI XML document.
Definition esi.cc:723
void to_json(nlohmann::json &j, const EniNetwork &network)
Serialises a network as JSON, for a client that renders rather than replays it.
Definition eni.cc:907
const EsiDevice * findEsiDeviceByProductCode(const EsiFile &file, uint32_t productCode, std::optional< uint32_t > revisionNo)
Finds the device with product code productCode, optionally pinned to a revision.
Definition esi.cc:797
constexpr std::string_view categoryName(Category v)
Definition esi.h:152
constexpr uint32_t kDefaultLcId
The default LcId — 1033, en-US.
Definition esi.h:62
const EsiModule * findEsiModule(const EsiFile &file, uint32_t moduleIdent)
Finds the module with the given ModuleIdent.
Definition esi.cc:817
@ None
No requirement; the element is not written and the command may share a frame.
StateRestriction
AL-state restriction on a read or a write (Access/@ReadRestrictions, Access/@WriteRestrictions).
Definition esi.h:94
SdoAccess
SDO transfer granularity (Object/Flags/SdoAccess).
Definition esi.h:114
constexpr std::string_view sdoAccessName(SdoAccess v)
Definition esi.h:194
constexpr std::string_view pdoMappingName(PdoMapping v)
Definition esi.h:164
AccessMode
SDO access mode — the text of a <Access> element. Spec default Ro.
Definition esi.h:86
constexpr std::string_view accessModeName(AccessMode v)
Symbolic names for the flag enums, in their ESI spelling ("ro", "m", "tr", …).
Definition esi.h:140
PdoMapping
PDO mappability (Flags/PdoMapping). Spec default None — not mappable.
Definition esi.h:103
std::string_view esiText(const std::vector< Text > &texts, uint32_t lcId)
Picks the lcId text from texts, else the unlocalised/default one, else the first.
Definition esi.cc:705
Category
Whether an entry must be implemented (Flags/Category). Spec default Optional.
Definition esi.h:97
SafetyMapping
Safety mappability (Flags/SafetyMapping, ETG.5120). Spec default None.
Definition esi.h:106
std::expected< EsiFile, std::string > parseEsiFile(const std::filesystem::path &path)
Reads path and parses it with parseEsi.
Definition esi.cc:774
constexpr std::string_view stateRestrictionName(StateRestriction v)
Definition esi.h:198
constexpr std::string_view safetyMappingName(SafetyMapping v)
Definition esi.h:178
std::vector< uint32_t > esiSlotModuleIdents(const EsiDevice &device)
Returns every ModuleIdent referenced by any of device's slots, in slot order.
Definition esi.cc:824
const EsiDevice * findEsiDevice(const EsiFile &file, std::string_view type)
Finds the device whose <Type> text equals type (case-sensitive).
Definition esi.cc:791
An <Access> element together with its two restriction attributes.
Definition esi.h:120
StateRestriction readRestrictions
Definition esi.h:122
AccessMode mode
Definition esi.h:121
StateRestriction writeRestrictions
Definition esi.h:123
One dimension of an array type (ETG.2000 ArrayInfoType).
Definition esi.h:368
int64_t lBound
Definition esi.h:369
int64_t elements
0 denotes a variable-length array.
Definition esi.h:370
One enumerator of an enumerated type (ETG.2000 EnumInfoType).
Definition esi.h:374
int64_t value
<Enum>, a HexDecValue.
Definition esi.h:376
std::vector< Text > texts
<Text> is maxOccurs="unbounded" and may carry LcId.
Definition esi.h:375
The <Flags> block of a SubItem (SubItemType/Flags, EtherCATBase.xsd:115-169).
Definition esi.h:336
std::optional< PdoMapping > pdoMapping
Definition esi.h:339
std::optional< uint32_t > attribute
Definition esi.h:341
std::optional< int32_t > setting
Definition esi.h:343
std::optional< SafetyMapping > safetyMapping
Definition esi.h:340
std::optional< Access > access
Definition esi.h:337
std::optional< Category > category
Definition esi.h:338
std::optional< int32_t > backup
Definition esi.h:342
A member of a composite type (ETG.2000 SubItemType).
Definition esi.h:330
std::string name
Definition esi.h:349
std::optional< int64_t > minValue
Definition esi.h:356
std::optional< int64_t > maxValue
Definition esi.h:357
std::optional< std::string > defaultString
Definition esi.h:359
std::string type
A DataType/Name reference, scoped to the enclosing dictionary.
Definition esi.h:351
int32_t bitOffs
Definition esi.h:354
int32_t bitSize
Definition esi.h:353
std::vector< uint8_t > defaultData
Definition esi.h:355
std::vector< Text > displayNames
Definition esi.h:350
std::optional< int64_t > defaultValue
Definition esi.h:358
std::vector< Text > comments
Definition esi.h:352
std::optional< uint8_t > subIdx
Definition esi.h:348
std::optional< Flags > flags
std::nullopt when there is no <Flags> at all.
Definition esi.h:360
std::vector< Property > properties
Bare <Property> children — no wrapper element.
Definition esi.h:361
A dictionary-scoped type definition (ETG.2000 DataTypeType).
Definition esi.h:328
std::optional< std::string > baseType
Definition esi.h:381
std::vector< Property > properties
Definition esi.h:387
int32_t bitSize
Definition esi.h:383
std::optional< uint32_t > index
Definition esi.h:379
std::vector< ArrayInfo > arrayInfo
Definition esi.h:384
std::vector< EnumInfo > enumInfo
Definition esi.h:386
std::vector< Text > comments
Definition esi.h:382
std::vector< SubItem > subItems
Definition esi.h:385
std::string name
Definition esi.h:380
One device description (ETG.2000 DeviceType) — the dictionary-relevant subset.
Definition esi.h:502
std::vector< EsiPdo > rxPdos
Definition esi.h:518
std::string type
Definition esi.h:503
std::optional< MailboxCoe > coe
Definition esi.h:512
std::string physics
Definition esi.h:510
std::string groupType
Definition esi.h:509
std::optional< uint32_t > serialNo
Definition esi.h:506
std::optional< uint32_t > productCode
Definition esi.h:504
std::vector< Text > comments
Definition esi.h:508
std::optional< uint32_t > revisionNo
Definition esi.h:505
EsiSlots slots
Definition esi.h:520
bool invisible
Definition esi.h:511
std::vector< EsiProfile > profiles
Definition esi.h:516
std::vector< EsiPdo > txPdos
Definition esi.h:519
std::vector< Text > names
Definition esi.h:507
A CoE object dictionary (ETG.2000 DictionaryType).
Definition esi.h:391
std::vector< UnitType > unitTypes
A dictionary-local override of the ETG.1004 unit catalogue; see UnitType.
Definition esi.h:393
std::vector< EsiObject > objects
Definition esi.h:395
std::vector< EsiDataType > dataTypes
Definition esi.h:394
The vendor block (ETG.2000 VendorType).
Definition esi.h:548
std::vector< Text > names
Definition esi.h:550
std::vector< Text > urls
Definition esi.h:551
A parsed ESI file.
Definition esi.h:546
std::vector< std::string > warnings
Definition esi.h:558
std::optional< std::string > version
The EtherCATInfo/@Version attribute.
Definition esi.h:554
std::vector< EsiModule > modules
Definition esi.h:557
std::vector< EsiDevice > devices
Definition esi.h:556
Vendor vendor
Definition esi.h:555
One module description (ETG.2000 ModuleType).
Definition esi.h:528
std::optional< std::string > moduleClass
Definition esi.h:531
std::vector< EsiPdo > safetyParaMappings
Definition esi.h:538
std::optional< EsiProfile > profile
A single optional, unlike EsiDevice::profiles.
Definition esi.h:535
std::vector< EsiPdo > rxPdos
Definition esi.h:536
std::vector< Text > names
Definition esi.h:533
uint32_t moduleIdent
Definition esi.h:529
std::vector< EsiPdo > txPdos
Definition esi.h:537
std::optional< MailboxCoe > coe
Definition esi.h:534
std::string type
Definition esi.h:530
std::optional< int32_t > modulePdoGroup
Index into EsiSlots::modulePdoGroups.
Definition esi.h:532
The <Flags> block of an object (ObjectType/Flags, EtherCATBase.xsd:323).
Definition esi.h:242
std::optional< Access > access
Definition esi.h:243
std::optional< uint32_t > attribute
SoE IDN attribute (IEC 61158-4-16).
Definition esi.h:247
std::optional< PdoMapping > pdoMapping
Definition esi.h:245
std::optional< SdoAccess > sdoAccess
Definition esi.h:249
std::optional< Category > category
Definition esi.h:244
std::optional< int32_t > backup
Definition esi.h:250
std::optional< std::string > transition
Obsolete per ETG.2000; carried, never interpreted.
Definition esi.h:248
std::optional< SafetyMapping > safetyMapping
Definition esi.h:246
std::optional< int32_t > setting
Definition esi.h:251
Out-of-line definition of the recursive ObjectInfoType/SubItem; see the declaration inside EsiObject:...
Definition esi.h:309
std::string name
Definition esi.h:310
Info info
Definition esi.h:311
Value metadata for an object or one of its subindices (ETG.2000 ObjectInfoType).
Definition esi.h:268
std::vector< uint8_t > maxData
Definition esi.h:279
std::optional< int64_t > defaultValue
Definition esi.h:283
std::optional< std::string > displayName
Plain xs:string at this level, not a NameType.
Definition esi.h:285
std::vector< SubItem > subItems
Definition esi.h:288
std::vector< uint8_t > defaultData
Definition esi.h:280
bool hasScaling
A <Scaling> child was seen; not modelled.
Definition esi.h:287
std::vector< uint8_t > minData
Definition esi.h:278
std::optional< uint32_t > unit
Packed ETG.1004 notation; see esiUnitSymbol.
Definition esi.h:286
std::optional< int64_t > maxValue
Definition esi.h:282
std::optional< std::string > defaultString
Definition esi.h:284
std::optional< int64_t > minValue
Definition esi.h:281
One object-dictionary object (ETG.2000 ObjectType).
Definition esi.h:224
bool overwrittenByModule
Definition esi.h:296
bool dependOnSlotGroup
Definition esi.h:295
std::vector< Text > names
Definition esi.h:298
uint32_t index
Definition esi.h:293
std::optional< Flags > flags
std::nullopt when the object has no <Flags> at all.
Definition esi.h:303
std::string type
A DataType/Name reference, scoped to the enclosing dictionary.
Definition esi.h:300
bool dependOnSlot
Definition esi.h:294
std::vector< Property > properties
Definition esi.h:304
int32_t bitSize
Definition esi.h:301
Info info
Definition esi.h:302
std::vector< Text > comments
Definition esi.h:299
One entry mapped into a PDO (ETG.2000 EntryType).
Definition esi.h:427
std::optional< std::string > dataType
Definition esi.h:432
std::vector< Text > names
Definition esi.h:431
uint8_t subIndex
Definition esi.h:429
int32_t bitLen
Definition esi.h:430
uint32_t index
Definition esi.h:428
bool isPadding() const
True for an alignment gap rather than a real mapped object.
Definition esi.h:435
A process-data object (ETG.2000 PdoType) — an <RxPdo>, <TxPdo>, or <SafetyParaMapping>,...
Definition esi.h:417
bool isVirtual
Definition esi.h:446
std::vector< Text > names
Definition esi.h:439
uint32_t index
Definition esi.h:438
bool mandatory
Definition esi.h:445
std::optional< int32_t > sm
Sync-manager this PDO is assigned to.
Definition esi.h:442
bool overwrittenByModule
Definition esi.h:447
std::optional< int32_t > su
Definition esi.h:443
std::vector< Entry > entries
Definition esi.h:441
std::vector< uint32_t > excludes
Indices of PDOs that cannot be enabled alongside this one.
Definition esi.h:440
bool fixed
Definition esi.h:444
A device or module profile (ETG.2000 ProfileType).
Definition esi.h:403
std::optional< int32_t > addInfo
Definition esi.h:405
std::optional< int32_t > profileNo
Optional: real modules omit it.
Definition esi.h:404
std::optional< int32_t > subAddInfo
Definition esi.h:406
std::optional< EsiDictionary > dictionary
Definition esi.h:408
std::optional< std::string > dictionaryFile
Definition esi.h:407
A PDO index base for one module PDO group (Slots/ModulePdoGroup).
Definition esi.h:479
std::optional< uint32_t > txPdo
Definition esi.h:482
std::optional< uint32_t > rxPdo
Definition esi.h:481
std::optional< int32_t > alignment
Definition esi.h:480
One slot: a position that a module plugs into (ETG.2000 SlotType).
Definition esi.h:457
uint32_t maxInstances
Definition esi.h:462
std::optional< uint32_t > slotIndexIncrement
Definition esi.h:465
std::optional< uint32_t > slotPdoIncrement
Definition esi.h:464
uint32_t minInstances
Definition esi.h:461
std::optional< uint32_t > defaultModuleIdent
The ident marked Default="1", if any.
Definition esi.h:460
std::optional< uint32_t > slotGroup
Definition esi.h:463
std::vector< Text > names
Definition esi.h:458
std::vector< uint32_t > moduleIdents
Definition esi.h:459
The <Slots> block of a modular device (ETG.5001).
Definition esi.h:451
std::vector< ModulePdoGroup > modulePdoGroups
Definition esi.h:486
uint32_t slotPdoIncrement
Index step between PDO objects of consecutive slots.
Definition esi.h:487
std::vector< Slot > slots
Definition esi.h:485
uint32_t slotIndexIncrement
Index step between all other objects of consecutive slots.
Definition esi.h:488
std::optional< uint32_t > maxSlotCount
Definition esi.h:489
bool downloadModuleIdentList
Definition esi.h:490
CoE mailbox capabilities (Mailbox/CoE attributes).
Definition esi.h:130
bool pdoAssign
Definition esi.h:132
bool sdoInfo
Definition esi.h:131
bool completeAccess
Definition esi.h:135
bool pdoConfig
Definition esi.h:133
bool pdoUpload
Definition esi.h:134
A name/value annotation (ETG.2000 PropertyType).
Definition esi.h:80
std::string value
Definition esi.h:82
std::string name
Definition esi.h:81
EtherCAT Slave Information (ESI) — the vendor's XML description of a device family.
Definition esi.h:56
std::string value
Definition esi.h:57
uint32_t lcId
0 when the LcId attribute is absent (treated as the default locale).
Definition esi.h:58