Configuration File

class ingenialink.configuration_file.ConfigRegister(uid: str, subnode: int, dtype: RegDtype, access: RegAccess, storage: float | int | str | bool)[source]

Register class for ConfigurationFile (XCF) class.

classmethod from_register(register: Register, value: float | int | str | bool) ConfigRegister[source]

Creates a ConfigRegister from a register, and its value.

Returns:

ConfigRegister instance filled with register data

Raises:

ValueError – Register has no an identifier

classmethod from_xcf(element: Element) ConfigRegister[source]

Creates a register from register XML element.

Returns:

ConfigRegister filled with XML element data

to_xcf() Element[source]

Creates a XML element from class data.

Returns:

XML register element filled with class data

class ingenialink.configuration_file.ConfigurationFile(device: Device)[source]

Configuration file (XCF) class.

It can be generated from a XCF file or be exported to a XCF file.

add_config_register(config_register: ConfigRegister) None[source]

Add ConfigRegister to the XCF class.

Parameters:

config_register – register that will be added to the XCF

add_register(register: Register, value: float | int | str | bool) None[source]

Add register to the XCF class.

Parameters:
  • register – register that will be added to the XCF

  • value – value that will be added to the register in te XCF

contains_node(subnode: int) bool[source]

Check of configuration file contains register of the target subnode.

Parameters:

subnode – target subnode number

Returns:

True if contains target subnode registers, else False

classmethod create_empty_configuration(interface: Interface, part_number: str | None, product_code: int | None, revision_number: int | None, firmware_version: str | None, node_id: int | None = None) ConfigurationFile[source]

Create an empty XCF with the device info.

Parameters:
  • interface – drive interface

  • part_number – drive part number

  • product_code – drive product code

  • revision_number – drive firmware revision number

  • firmware_version – drive firmware version

  • node_id – drive node id. Only for CANopen drives

Returns:

creates a XCF instance

classmethod load_from_xcf(xcf_path: str) ConfigurationFile[source]

Creates a XCF instance from a XCF file.

Parameters:

xcf_path – XCF file path

Returns:

XCF instance with XCF file data

Raises:
  • FileNotFoundError – xcf_path file not found

  • NotImplementedError – Configuration file version not supported

save_to_xcf(xcf_path: str) None[source]

Save a file with the config file in the target path.

Parameters:

xcf_path – config file target path

Raises:

ValueError – the configuration has no registers

property device: Device

Configuration file device.

property registers: list[ConfigRegister]

Configuration file registers.

property version: str

Version string.

class ingenialink.configuration_file.Device(interface: Interface, part_number: str | None, product_code: int | None, revision_number: int | None, firmware_version: str | None, node_id: int | None = None)[source]

Device data for ConfigurationFile (XCF) class.

classmethod from_xcf(element: Element) Device[source]

Creates a Device instance from XML element.

Returns:

Device instance filled with XML element data.

to_xcf() Element[source]

Creates an XML element with class data.

Returns:

XML element filled with class data