The following software is required to build the source:

In order to define a new Ecu or to modify an Ecu definition an XML editor that supports XML schema documents is also required

  • Xml Notepad is one such editor
  • Visual Studio 2005 or 2008 also supports such editing

Building the source code

  • Get a copy of the source code
  • Build the DnEcuDiag.Tools solution
    • In the DnEcuDiag.Tools folder open a command prompt and execute the build.msbuild script
  • Build the DnEcuDiag solution
    • In the DnEcuDiag folder open a command prompt and execute the build.msbuild script
    • Alternately open the solution and build from visual studio

Adding a new language

To add a new language to the DnEcuDiag application the following steps are required:

  • Navigate to DnEcuDiag\Forms


  • Select a form to localise and open it in the designer. This will display the default language of English


  • Select the language that you wish to add from the language drop down box


  • Save the form and build DnEcuDiag. Repeat this step for all of the forms of the application that are to be localised. The building of the application  solution will automatically generate the required localisation resource files in excel 97 compatible format.
  • Browse to the DnEcuDiag\ResourceFiles folder of the current working folder. In the DnEcuDiag\ResourceFiles folder you will find a new excel file corresponding to the language that was added to the application for example fr.xls. Column B is the text that should be changed to the localised language version.


  • After the contents of the excel resource file has been modified rebuild DnEcuDiag from the command line with the MSBuild script or directly from Visual Studio. This will replace all of the localised content of the form.
  • You may need to layout the localised form to take the difference in text length into consideration between the default of English and that of the localised version.

Adding Or Modifying an Ecu Definition

Ecu are defined using a structured XML documents. They are contained within the application namespace structure under DnEcuDiag\EcuDefinitions. They are sub categorised by language the build process is able to generate localised versions of the Ecu’s if required.


There are currently three classes of Ecu’s that are supported by the DnEcuDiag metadata these are:

  • KwpEcu
    • This Ecu class defines an Ecu that conforms to the KWP2000 protocol.
    • The schema for this type of Ecu is defined in  KwpEcu.xsd
  • Kwp81
    • This Ecu class defines an Ecu that conforms to the ISO9141 protocol or also referred to as Kwp81.
    • The schema for this type of Ecu is defined in  Kwp81Ecu.xsd
  • Kwp71
    • This Ecu class defines an Ecu that conforms to the Kwp71 protocol.
    • The schema for this type of Ecu is defined in  Kwp71Ecu.xsd

The steps required to create an Ecu are as follows:

  • Create a new xml file in the DnEcuDiag\EcuDefinitions\xx folder. Where xx is the ISO language code of the localised version of the ecu that you want to create.
  • With the schemas referenced by your xml editor start the ecu definition by opening an element of the correct type for example <KwpEcu  for a Kwp2000 ecu.


  • The schema will guide the process for defining an ecu if the schema editor that you are using is capable of schema validation.
  • After the ecu metadata is defined the next step is to create a conversion class that will perform the conversion from the stream of bytes from the ecu to the correct value for a given sensor or property of the ecu.
  • The conversion class that is to be used by a specific ecu is defined by the <ConvertorType element of the ecu definition. This value must specify the namespace qualified name of the class that will perform the conversion.


  • The conversion class must be derived from Convertor and IConvertor.


  • The Convertor class is a base class that contains some useful byte array conversion methods. The interface IConvertor defines the interface that the convertor must implement to be used as the convertor for a given ecu.


  • The final step to defining a new ecu is to write some unit tests for the ecu that you have just created. There are a number of unit tests defined for the set of ecu’s that are included in the source code. Writing a unit test will require some detailed knowledge of the ecu protocols as there is a mocked interface device used to mock the request responses from the ecu.

Last edited Jan 3, 2011 at 6:48 PM by dgoslin, version 24


No comments yet.