Skip to content

Commit 1b06485

Browse files
committed
xdd: Implement option to load object dictionary from XDD file.
Signed-off-by: Taras Zaporozhets <zaporozhets.taras@gmail.com>
1 parent 9685880 commit 1b06485

5 files changed

Lines changed: 1970 additions & 2 deletions

File tree

canopen/objectdictionary/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def import_od(
7676
source: Union[str, TextIO, None],
7777
node_id: Optional[int] = None,
7878
) -> ObjectDictionary:
79-
"""Parse an EDS, DCF, or EPF file.
79+
"""Parse an EDS, DCF, EPF or XDD file.
8080
8181
:param source:
8282
The path to object dictionary file, a file like object, or an EPF XML tree.
@@ -106,9 +106,12 @@ def import_od(
106106
elif suffix == ".epf":
107107
from canopen.objectdictionary import epf
108108
return epf.import_epf(source)
109+
elif suffix == ".xdd":
110+
from canopen.objectdictionary import xdd
111+
return xdd.import_xdd(source, node_id)
109112
else:
110113
doc_type = suffix[1:]
111-
allowed = ", ".join(["eds", "dcf", "epf"])
114+
allowed = ", ".join(["eds", "dcf", "epf", "xdd"])
112115
raise ValueError(
113116
f"Cannot import from the {doc_type!r} format; "
114117
f"supported formats: {allowed}"

0 commit comments

Comments
 (0)