Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
esi.h File Reference
#include <cstdint>
#include <expected>
#include <filesystem>
#include <nlohmann/json_fwd.hpp>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "etg/esi_unit.h"
Include dependency graph for esi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::etg::Text
 EtherCAT Slave Information (ESI) — the vendor's XML description of a device family. More...
 
struct  mm::etg::Property
 A name/value annotation (ETG.2000 PropertyType). More...
 
struct  mm::etg::Access
 An <Access> element together with its two restriction attributes. More...
 
struct  mm::etg::MailboxCoe
 CoE mailbox capabilities (Mailbox/CoE attributes). More...
 
struct  mm::etg::EsiObject
 One object-dictionary object (ETG.2000 ObjectType). More...
 
struct  mm::etg::EsiObject::Flags
 The <Flags> block of an object (ObjectType/Flags, EtherCATBase.xsd:323). More...
 
struct  mm::etg::EsiObject::Info
 Value metadata for an object or one of its subindices (ETG.2000 ObjectInfoType). More...
 
struct  mm::etg::EsiObject::Info::SubItem
 Out-of-line definition of the recursive ObjectInfoType/SubItem; see the declaration inside EsiObject::Info. More...
 
struct  mm::etg::EsiDataType
 A dictionary-scoped type definition (ETG.2000 DataTypeType). More...
 
struct  mm::etg::EsiDataType::SubItem
 A member of a composite type (ETG.2000 SubItemType). More...
 
struct  mm::etg::EsiDataType::SubItem::Flags
 The <Flags> block of a SubItem (SubItemType/Flags, EtherCATBase.xsd:115-169). More...
 
struct  mm::etg::EsiDataType::ArrayInfo
 One dimension of an array type (ETG.2000 ArrayInfoType). More...
 
struct  mm::etg::EsiDataType::EnumInfo
 One enumerator of an enumerated type (ETG.2000 EnumInfoType). More...
 
struct  mm::etg::EsiDictionary
 A CoE object dictionary (ETG.2000 DictionaryType). More...
 
struct  mm::etg::EsiProfile
 A device or module profile (ETG.2000 ProfileType). More...
 
struct  mm::etg::EsiPdo
 A process-data object (ETG.2000 PdoType) — an <RxPdo>, <TxPdo>, or <SafetyParaMapping>, which all reuse the same schema type. More...
 
struct  mm::etg::EsiPdo::Entry
 One entry mapped into a PDO (ETG.2000 EntryType). More...
 
struct  mm::etg::EsiSlots
 The <Slots> block of a modular device (ETG.5001). More...
 
struct  mm::etg::EsiSlots::Slot
 One slot: a position that a module plugs into (ETG.2000 SlotType). More...
 
struct  mm::etg::EsiSlots::ModulePdoGroup
 A PDO index base for one module PDO group (Slots/ModulePdoGroup). More...
 
struct  mm::etg::EsiDevice
 One device description (ETG.2000 DeviceType) — the dictionary-relevant subset. More...
 
struct  mm::etg::EsiModule
 One module description (ETG.2000 ModuleType). More...
 
struct  mm::etg::EsiFile
 A parsed ESI file. More...
 
struct  mm::etg::EsiFile::Vendor
 The vendor block (ETG.2000 VendorType). More...
 

Namespaces

namespace  mm
 
namespace  mm::etg
 

Enumerations

enum class  mm::etg::AccessMode : uint8_t { mm::etg::Ro , mm::etg::Rw , mm::etg::Wo }
 SDO access mode — the text of a <Access> element. Spec default Ro. More...
 
enum class  mm::etg::StateRestriction : uint8_t {
  mm::etg::None , mm::etg::PreOp , mm::etg::PreOpSafeOp , mm::etg::PreOpOp ,
  mm::etg::SafeOp , mm::etg::SafeOpOp , mm::etg::Op
}
 AL-state restriction on a read or a write (Access/@ReadRestrictions, Access/@WriteRestrictions). More...
 
enum class  mm::etg::Category : uint8_t { mm::etg::Mandatory , mm::etg::Optional , mm::etg::Conditional }
 Whether an entry must be implemented (Flags/Category). Spec default Optional. More...
 
enum class  mm::etg::PdoMapping : uint8_t { mm::etg::None , mm::etg::Tx , mm::etg::Rx , mm::etg::TxRx }
 PDO mappability (Flags/PdoMapping). Spec default None — not mappable. More...
 
enum class  mm::etg::SafetyMapping : uint8_t {
  mm::etg::None , mm::etg::SafeIn , mm::etg::SafeOut , mm::etg::SafeInOut ,
  mm::etg::SafeParam
}
 Safety mappability (Flags/SafetyMapping, ETG.5120). Spec default None. More...
 
enum class  mm::etg::SdoAccess : uint8_t { mm::etg::SubIndexAccess , mm::etg::CompleteAccess }
 SDO transfer granularity (Object/Flags/SdoAccess). More...
 

Functions

std::string_view mm::etg::esiText (const std::vector< Text > &texts, uint32_t lcId=kDefaultLcId)
 Picks the lcId text from texts, else the unlocalised/default one, else the first.
 
std::expected< EsiFile, std::string > mm::etg::parseEsi (std::string_view xml)
 Parses an ESI XML document.
 
std::expected< EsiFile, std::string > mm::etg::parseEsiFile (const std::filesystem::path &path)
 Reads path and parses it with parseEsi.
 
const EsiDevicemm::etg::findEsiDevice (const EsiFile &file, std::string_view type)
 Finds the device whose <Type> text equals type (case-sensitive).
 
const EsiDevicemm::etg::findEsiDeviceByProductCode (const EsiFile &file, uint32_t productCode, std::optional< uint32_t > revisionNo=std::nullopt)
 Finds the device with product code productCode, optionally pinned to a revision.
 
const EsiModulemm::etg::findEsiModule (const EsiFile &file, uint32_t moduleIdent)
 Finds the module with the given ModuleIdent.
 
std::vector< uint32_t > mm::etg::esiSlotModuleIdents (const EsiDevice &device)
 Returns every ModuleIdent referenced by any of device's slots, in slot order.
 
constexpr std::string_view mm::etg::accessModeName (AccessMode v)
 Symbolic names for the flag enums, in their ESI spelling ("ro", "m", "tr", …).
 
constexpr std::string_view mm::etg::categoryName (Category v)
 
constexpr std::string_view mm::etg::pdoMappingName (PdoMapping v)
 
constexpr std::string_view mm::etg::safetyMappingName (SafetyMapping v)
 
constexpr std::string_view mm::etg::sdoAccessName (SdoAccess v)
 
constexpr std::string_view mm::etg::stateRestrictionName (StateRestriction v)
 
void mm::etg::to_json (nlohmann::json &j, const Text &v)
 Serialises the model to JSON. Keys are lowerCamelCase mirrors of the member names; absent optionals are omitted rather than emitted as null.
 
void mm::etg::to_json (nlohmann::json &j, const Property &v)
 
void mm::etg::to_json (nlohmann::json &j, const Access &v)
 
void mm::etg::to_json (nlohmann::json &j, const MailboxCoe &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiObject::Flags &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiObject::Info &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiObject::Info::SubItem &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiObject &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiDataType::SubItem::Flags &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiDataType::SubItem &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiDataType::ArrayInfo &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiDataType::EnumInfo &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiDataType &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiDictionary &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiProfile &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiPdo::Entry &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiPdo &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiSlots::Slot &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiSlots::ModulePdoGroup &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiSlots &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiDevice &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiModule &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiFile::Vendor &v)
 
void mm::etg::to_json (nlohmann::json &j, const EsiFile &v)
 

Variables

constexpr uint32_t mm::etg::kDefaultLcId = 1033
 The default LcId — 1033, en-US.