-
-
Notifications
You must be signed in to change notification settings - Fork 1
API Reference
The public API surface of EdsDcfNet. All operations are available through the static CanOpenFile facade class plus extension methods on ObjectDictionary.
CanOpenFile is a static class with no state. Every method is self-contained.
using EdsDcfNet;Reads and parses an EDS file from disk.
ElectronicDataSheet ReadEds(string filePath)| Parameter | Description |
|---|---|
filePath |
Absolute or relative path to the .eds file |
Returns: ElectronicDataSheet
Throws: EdsParseException on parse errors, IOException on file access errors
Parses an EDS from a string (useful for unit testing or in-memory processing).
ElectronicDataSheet ReadEdsFromString(string content)Returns: ElectronicDataSheet
Throws: EdsParseException on parse errors
Serializes an ElectronicDataSheet to an EDS file (UTF-8 without BOM).
void WriteEds(ElectronicDataSheet eds, string filePath)Throws: EdsWriteException on serialization errors, IOException on file access errors
Serializes an ElectronicDataSheet to a string.
string WriteEdsToString(ElectronicDataSheet eds)Returns: The EDS file content as a string
Throws: EdsWriteException on serialization errors
Reads and parses a DCF file from disk.
DeviceConfigurationFile ReadDcf(string filePath)Returns: DeviceConfigurationFile
Throws: EdsParseException on parse errors
Parses a DCF from a string.
DeviceConfigurationFile ReadDcfFromString(string content)Returns: DeviceConfigurationFile
Throws: EdsParseException on parse errors
Serializes a DeviceConfigurationFile to a file (UTF-8 without BOM).
void WriteDcf(DeviceConfigurationFile dcf, string filePath)Throws: DcfWriteException on serialization errors, IOException on file access errors
Serializes a DeviceConfigurationFile to a string.
string WriteDcfToString(DeviceConfigurationFile dcf)Returns: The DCF file content as a string
Throws: DcfWriteException on serialization errors
Reads and parses a CPJ nodelist project file from disk.
NodelistProject ReadCpj(string filePath)Returns: NodelistProject
Throws: EdsParseException on parse errors
Parses a CPJ from a string.
NodelistProject ReadCpjFromString(string content)Returns: NodelistProject
Throws: EdsParseException on parse errors
Serializes a NodelistProject to a file (UTF-8 without BOM).
void WriteCpj(NodelistProject cpj, string filePath)Throws: IOException on file access errors
Serializes a NodelistProject to a string.
string WriteCpjToString(NodelistProject cpj)Returns: The CPJ file content as a string
Reads and parses a CiA 311 XDD (XML Device Description) file.
ElectronicDataSheet ReadXdd(string filePath)Returns: ElectronicDataSheet (same model as EDS; ApplicationProcess property populated when present)
Throws: EdsParseException on parse errors, IOException on file access errors
Parses an XDD from a string.
ElectronicDataSheet ReadXddFromString(string content)Returns: ElectronicDataSheet
Throws: EdsParseException on parse errors
Serializes an ElectronicDataSheet to a CiA 311 XDD file.
void WriteXdd(ElectronicDataSheet xdd, string filePath)Serializes an ElectronicDataSheet to an XDD string.
string WriteXddToString(ElectronicDataSheet xdd)Returns: The XDD file content as a string
Reads and parses a CiA 311 XDC (XML Device Configuration) file.
DeviceConfigurationFile ReadXdc(string filePath)Returns: DeviceConfigurationFile (same model as DCF)
Throws: EdsParseException on parse errors, IOException on file access errors
Parses an XDC from a string.
DeviceConfigurationFile ReadXdcFromString(string content)Returns: DeviceConfigurationFile
Throws: EdsParseException on parse errors
Serializes a DeviceConfigurationFile to a CiA 311 XDC file.
void WriteXdc(DeviceConfigurationFile xdc, string filePath)Serializes a DeviceConfigurationFile to an XDC string.
string WriteXdcToString(DeviceConfigurationFile xdc)Returns: The XDC file content as a string
Converts an EDS template to a configured DCF instance.
DeviceConfigurationFile EdsToDcf(
ElectronicDataSheet eds,
byte nodeId,
ushort baudrate = 250,
string? nodeName = null)| Parameter | Type | Default | Description |
|---|---|---|---|
eds |
ElectronicDataSheet |
— | Source EDS (not modified) |
nodeId |
byte |
— | Node address, must be 1–127 |
baudrate |
ushort |
250 |
Baud rate in kbit/s |
nodeName |
string? |
null |
Human-readable node name |
Returns: A fully independent DeviceConfigurationFile (deep copy of EDS)
Throws: ArgumentException if nodeId is outside 1–127, EdsParseException on $NODEID formula errors
| Property | Type | Description |
|---|---|---|
FileInfo |
EdsFileInfo |
[FileInfo] section metadata |
DeviceInfo |
DeviceInfo |
[DeviceInfo] section |
ObjectDictionary |
ObjectDictionary |
All OD objects |
Comments |
Comments? |
[Comments] section |
SupportedModules |
List<ModuleInfo> |
Modular device modules |
DynamicChannels |
DynamicChannels? |
CiA 302-4 dynamic channels |
Tools |
List<ToolInfo> |
Tool sections |
AdditionalSections |
Dictionary<string, Dictionary<string, string>> |
Unknown sections |
ApplicationProcess |
ApplicationProcess? |
Typed CiA 311 §6.4.5 model; null for EDS files or when element is absent |
All properties of ElectronicDataSheet, plus:
| Property | Type | Description |
|---|---|---|
DeviceCommissioning |
DeviceCommissioning |
[DeviceCommissioning] section |
ConnectedModules |
List<int> |
Plugged-in module slots |
| Property | Type | Description |
|---|---|---|
NodeId |
byte |
Node address (1–127) |
NodeName |
string |
Human-readable name |
Baudrate |
ushort |
Baud rate in kbit/s |
NetNumber |
uint |
Network number |
NetworkName |
string |
Network name |
CANopenManager |
bool |
Is the node a CANopen manager? |
LssSerialNumber |
uint? |
LSS serial number |
NodeRefd |
string? |
Node reference (e.g., database ID) |
NetRefd |
string? |
Network reference |
| Property | Type | Description |
|---|---|---|
VendorName |
string |
Manufacturer name |
VendorNumber |
uint |
Manufacturer ID (CiA assigned) |
ProductName |
string |
Device name |
ProductNumber |
uint |
Product code |
RevisionNumber |
uint |
Firmware revision |
OrderCode |
string |
Order/part number |
SupportedBaudRates |
BaudRates |
Supported baud rates |
SimpleBootUpMaster |
bool |
NMT master capability |
SimpleBootUpSlave |
bool |
NMT slave capability |
NrOfRxPdo |
ushort |
Number of RPDOs |
NrOfTxPdo |
ushort |
Number of TPDOs |
LssSupported |
bool |
LSS layer setting services |
CANopenSafetySupported |
bool |
EN 50325-5 safety support |
| Property | Type | Description |
|---|---|---|
Index |
ushort |
OD index (0x0000–0xFFFF) |
ParameterName |
string |
Object name |
ObjectType |
byte |
VAR=0x07, ARRAY=0x08, RECORD=0x09 |
DataType |
ushort? |
CiA data type code |
AccessType |
AccessType |
ro / wo / rw / rwr / rww / const |
DefaultValue |
string? |
EDS default value |
ParameterValue |
string? |
DCF configured value |
Denotation |
string? |
Optional label (DCF only) |
LowLimit |
string? |
Minimum allowed value |
HighLimit |
string? |
Maximum allowed value |
PdoMapping |
bool |
Can be mapped to PDO |
SrdoMapping |
bool |
Can be mapped to SRDO |
SubObjects |
Dictionary<byte, CanOpenSubObject> |
Sub-objects (ARRAY/RECORD) |
ObjectLinks |
List<ushort> |
Linked object indices |
ObjFlags |
uint |
Object flags bitfield |
| Property | Type | Description |
|---|---|---|
Networks |
List<NetworkTopology> |
List of network topologies |
AdditionalSections |
Dictionary<string, Dictionary<string, string>> |
Unknown sections |
| Property | Type | Description |
|---|---|---|
NetName |
string? |
Network name |
NetRefd |
string? |
Network reference |
EdsBaseName |
string? |
Base path for EDS/DCF files |
Nodes |
Dictionary<byte, NetworkNode> |
Nodes keyed by node ID |
| Property | Type | Description |
|---|---|---|
NodeId |
byte |
Node address (1–127) |
Present |
bool |
Physically present in the network |
Name |
string? |
Human-readable node name |
Refd |
string? |
Node reference |
DcfFileName |
string? |
Associated DCF file name |
Populated when reading XDD/XDC files that contain an ApplicationProcess element (CiA 311 §6.4.5).
| Property | Type | Description |
|---|---|---|
ParameterList |
List<ApParameter> |
Device parameters (mandatory when element present) |
DataTypeList |
ApDataTypeList? |
Complex type definitions (arrays, structs, enums, derived) |
FunctionTypeList |
List<ApFunctionType> |
Function type definitions |
FunctionInstanceList |
ApFunctionInstanceList? |
Function instances |
TemplateList |
ApTemplateList? |
Parameter and allowed-value templates |
ParameterGroupList |
List<ApParameterGroup> |
Parameter groups for HMI classification |
See Reading and Writing XDD/XDC Files for full usage examples.
using EdsDcfNet.Extensions;| Method | Returns | Description |
|---|---|---|
GetObject(ushort index) |
CanOpenObject? |
Get object by index, null if not found |
GetSubObject(ushort index, byte subIndex) |
CanOpenSubObject? |
Get sub-object, null if not found |
SetParameterValue(ushort index, string value) |
bool |
Set VAR value; returns false if not found |
SetParameterValue(ushort index, byte subIndex, string value) |
bool |
Set sub-object value; returns false if not found |
GetParameterValue(ushort index) |
string? |
Get VAR ParameterValue |
GetParameterValue(ushort index, byte subIndex) |
string? |
Get sub-object ParameterValue |
GetObjectsByType(ObjectCategory category) |
IEnumerable<CanOpenObject> |
Filter by Mandatory/Optional/Manufacturer |
GetPdoCommunicationParameters(bool transmit) |
IEnumerable<CanOpenObject> |
TPDO (0x1800–) or RPDO (0x1400–) com params |
GetPdoMappingParameters(bool transmit) |
IEnumerable<CanOpenObject> |
TPDO (0x1A00–) or RPDO (0x1600–) mappings |
| Exception | Namespace | Description |
|---|---|---|
EdsParseException |
EdsDcfNet.Exceptions |
Parse error with optional LineNumber and SectionName
|
EdsWriteException |
EdsDcfNet.Exceptions |
EDS write error with optional SectionName
|
DcfWriteException |
EdsDcfNet.Exceptions |
Write error with optional SectionName
|