ADTF  3.13.0
Attached Files

Adding attached files to ADTFDAT recordings

The recorder can attach files to ADTFDAT recordings based on a XML configuration file. The XSD describing the format can be found at


Let's take a look at the following example:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<attachments xmlns="adtf/xsd/attachments">
<!-- add a file by relative or absolute path -->
<!-- this is the location within the archive -->
<!-- tags can be used to reference files via macros after extraction -->
<!-- you can add multiple tags to each entry -->
<!-- add a folder recursively -->
<!-- add files by wildcard -->
<!-- mind the trailing slash, this way the filenames names will be appended -->
<!-- multiple files will be seperated by ';' within a resolved tag value -->
<!-- add folders by wildcard -->
<!-- add a file with content directly from this file -->
<content>Hello, world!</content>
<!-- add a tag with a given value -->

By specifing this file in the Property 'attachment_configuration_file' of a recorder, these files will be attached to each recording. Please see ADTFDAT File Recorder for further properties regarding attached files handling.

Extracting attached files from ADTFDAT recordings

There are multiple ways to extract files from ADTFDAT recordings.

Extraction via Interface Call

The local interface adtf::services::bat::IPlayer::ExtractAttachedFiles and the RPC interface adtf::remote::bat::IPlayer::ExtractAttachedFiles allows a user to extract files at any given time.

Extraction via Property

If there is an ADTFDAT recording specified in the 'extract_attached_files_from' property of the ADTF Playback Service, then the files will be extracted during service initialization.

Mind that you also need to specify the 'extraction_destination_directory' property in this case.

Accessing Extracted Files

To access extracted files you can use the tags via macros. The ADTF Playback Service will define a macro in the form of $(AF:<tag_name>) for each tag. If a tag is referenced by multiple files the macro will resolve to a semi-colon seperated list. This way you can use these macros in your Properties (all kinds of Properties, but especially for Properties of Type cFilename, cFilepath, cFilenameList, and cFilepathList.

Using our example above the following macros would be available

  • $(AF:file1) with the path to file1.txt
  • $(AF:hello) with the path to hello.txt
  • $(AF:subfolder1) with the path to some/where/else
  • $(AF:subfolder2) with the path to wildcard_folder
  • $(AF:text_file_folder) with the path to text/files/from_folder3
  • $(AF:files) a ; seperated list of file1.txt and hello.txt
  • $(AF:license_plate) with the string 'OUTATIME'
In order for this to work in service Properties, make sure that the playback service is initialized before the services where you are using these macros in the Properties.

Advanced Information

Creating Files and Configuration "on the fly"

If the Property 'cache_attachment_archive' of the recorder is set to false, then the recorder will read the configuration and attach the files each time a recording is closed. This happens after the kernel signal PreFileClosed (see adtf::services::ant::IRecordingSignal) has been processed by all recipients. This way you can create files that should be attached or even (re-)create the configuration during handling of this signal.

Mind that all this happens asynchronously to the adtf::services::ant::IRecorder::Stop call. So use the adtf::services::bat::IRecordingFile::GetTimeRange method to choose data to your liking.

Archive Format

The files are stored as a tar.gz archive within the "attached_files" extension of an ADTFDAT file. So the files can easily be extracted with the help of the adtf_datdump tool:

adtf_datdump --extract-extension attached_files recording.adtfdat | tar xvz

On Windows use

adtf_datdump --extract-extension attached_files recording.adtfdat > attached_files.tar.gz

and then open the archive with your preferred archiver.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Tue Sep 28 2021 by doxygen 1.8.14)