6. Sample Code for C++

6.1. Getting Started

Open the Visual Studio 2015 Solution (”SrcCppEniBuilderForCpp.sln”) and do the following things:

  • Remove unavailable projects (EcResources, EcEniEngine, …)

  • Compile the solution (Output folder of the “Debug” configuration is the root folder, where all the binaries are located)

  • Run “EniBuilderForCpp.exe” with parameter “C:myEniBuilderDirconfig_simple.xml”, which will generate an ENI file based on the EBI file settings

6.2. Architecture

EniBuilderForCpp contains the following components:

_images/architecture_2.png
  1. Sample Code
    EniBuilderForCpp.exe
    • Win32 Console Application, which parses the command line parameters and loads the EniBuilderCpp.dll

    EniBuilderCpp.dll
    • Win32 Managed Code Library, which exports a wrapper class named “CEniBuilderCpp”. This class converts the data from C++ to C# and back

    EniBuilderCSharp.dll
    • C# Class Libaray, which loads the “EniEngine” for generating the ENI file

  2. CTK
    EniEngine (EcEniEngine.dll)
    • EthterCAT Slave Information File (ESI)

    • EtherCAT Network Information File (ENI)

    • ENI Generation (PDO, MDP, CoE, DC, Hot Connect, …)

    • EniBuilder Input File Format (.ebi)

    Resources (EcResources.dll)
    • Language Manager

    • Logger

6.3. Command line interface

The command line interface supports the following commands:

Name of the EBI file

Specify the path to the EBI file which contains all information for generating the ENI file.

/APPDATA =”Path to AppData directory” (optional)

Specify the path to the AppData directory. It contains a subfolder “EtherCAT” with all ESI files and it is also the path for the logfile.

/INDENTXMLFILES (optional)

Activates indenting of XML files (makes exported XML files readable, but increases size).

/IGNOREREVISION (optional)

Deactivates the revision check, if slave was not found and tries to find a compatible slave.