Reading/Parsing a .ddd (digital tachograph) file to XML in C#

Very late answer but this library is in C# and supports most parts of the digital tachograph spec.

https://github.com/jugglingcats/tachograph-reader

This library provides two classes that can read driver and vehicle card binary files and write to an XmlWriter. The XML is well structured and provides a clear representation of the content of the binary file for subsequent processing. Note that the code does not check the digital signatures in the file.

From the readme:

Usage is quite simple. There is a main class DataFileReader and two subclasses: VehicleUnitDataFile and DriverCardDataFile. You can create an instance of one of the sublasses using the following methods:

DataFile vudf=VehicleUnitDataFile.Create();
DataFile dcdf=DriverCardDataFile.Create();

Once you have a reader instance you can give it a binary file to read and an XML Writer:

vudf.Process("file.ddd", writer);

Most of the sections/features of both data file formats are catered for. It's possible to modify the data file formats using DriverCardData.config and VehicleUnitData.config. These are two XML files defining the structure of the data with features specific to the standard (such as cyclic buffer support).


To perform the conversion you need to know:

  • how to read binary data from a file
  • exactly what the file can contain (every single byte)
  • the desired output in Xml

Reading binary data from a file is fairly simple - the BinaryReader has all kinds of methods to access the data, especially if the data can be processed in a single forward pass (which seems to be the case). There are tons of BinaryReader examples out there.

What's more important is knowledge of what the data means. A single byte, with the value 0x20 could mean:

  • The SPACE character
  • The value 32
  • The byte could be the first byte of a UInt16 with an entirely different value
  • "The next block of data is 32 bytes long"
  • "The first block of data can be found at offset 32"
  • "The next block of data is metadata" (this byte indicating some sort of block type)
  • 32 bottles of beer on the wall

Without information about what each byte at each position means, you won't get anywhere.

Then with that information, and having read the file into some fitting class(es), the conversion to Xml could be as simple as passing the class to an XmlSerializer.