Project

General

Profile

Actions

Support Request #11042

closed

Availability of Script/Tool to Convert between Old and New Mapping Formats in DeviceToolbox

Added by hidden about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Customer:
AUDI
Department:
EF
Requester's Priority:
Normal
Support Level:
2nd Level
Resolution:
Product Issue Numbers:
Affected Products:
Platform:
Windows 10 64bit
Topic:
DeviceTB::Common
FAQ Links:

Description

Supportanfrage

I wanted to ask if there is any script or tool available, with which I can convert an old "buffer configuration file" to a new one which is compatable with ADTF_DeviceToolbox version 3.x.
The documentation of ADTF-DeviceToolbox mentions that the syntax has been changed, but does not mentioned any tool to support the migration.
(see <ADTF_DeviceToolbox_ROOT>/doc/devicetoolbox_html/page_whats_new.html#subsection_mapping_vergleich)

Lösung

good timing, today we have pushed a stylesheet for this conversion to the community:

Feel free to use and collaborate in case you are missing features.

Maybe it will grow with an own convinience tooling but now it is possible with an easy xslt.

For a example have a look here:
Actions #1

Updated by hidden about 4 years ago

  • Status changed from New to In Progress
  • Private changed from Yes to No
  • Topic set to DeviceTB::Common
  • Affected Products ADTF Device Toolbox 3.1.0 added
  • Affected Products deleted (ADTF Device Toolbox 3.2.0)
Actions #2

Updated by hidden about 4 years ago

  • Status changed from In Progress to Customer Feedback Required

Hi Samer,

good timing, today we have pushed a stylesheet for this conversion to the community:

Feel free to use and collaborate in case you are missing features.

Maybe it will grow with an own convinience tooling but now it is possible with an easy xslt.

Actions #3

Updated by hidden about 4 years ago

Hi Florian,

I associated the stylesheet to an existing CCC xml file. But I don't see anything in the browser.
I also don't find any html tag in the stylesheet templates. What should I expected to get as an output (html page or something else)?

Actions #4

Updated by hidden about 4 years ago

  • Status changed from Customer Feedback Required to In Progress
Actions #5

Updated by hidden about 4 years ago

  • Status changed from In Progress to Customer Feedback Required

Hi Samer,

we do not want to generate a html or using an XLS stylesheet as "pretty-print".
We want to generate a .map file from .xml file to re-use in ADTF 3.x.

So you need a XSLT Processor (e.g. Saxon, Qt XmlPatterns) to process.
After choosing, please read its documnetation or ask google, this exceeds our supported range.

But let's give an example based on XML Patterns within Qt 5.12.4:

In this showcase we will transform the example buffer configuration xml file from Device TB 2.x:
  • <DEVICE_TB_DIR>/bin/templates/CanConfigCodecExt/CanConfigCodecExt.xml
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<settings>
    <input channel="0" channelmask="0x3">
        <buffer name="RESULT_STRUCT" pack="1" timestamp="$FIRST$" delay="0">
            <trigger start_msg="ESP" stop_msg="Kombi" />
            <struct pack="1">
                <element name="s_FahrGeschw" signal="ESP.ESP_v_Signal" type="tFloat64" />
                <element name="s_AngezGeschw" signal="Kombi.KBI_angez_Geschw" type="tFloat64" />
            </struct>
        </buffer>
    </input>
</settings>

Then we need the XSLT Tool from Qt:
  • <QT5_DIR>/bin/xmlpatterns
If you don't have a complete Qt developer package, have a look here:

It is very simple to use:

xmlpatterns <stylesheet> <file_to_transform>

This will dump the generated structure in console:

<mapping codec="CCC" version="2.00">
    <outputs channel="0">
        <output name="RESULT_STRUCT" delay="0" timestamp="$FIRST$">
            <struct name="" pack="1">
                <assignment>
                    <to>s_FahrGeschw</to>
                    <from>ESP.ESP_v_Signal</from>
                    <type>tFloat64</type>
                </assignment>
                <assignment>
                    <to>s_AngezGeschw</to>
                    <from>Kombi.KBI_angez_Geschw</from>
                    <type>tFloat64</type>
                </assignment>
            </struct>
        </output>
    </outputs>
</mapping>

To generate a file from the output we simple pipe it into a map file and extend the call:

xmlpatterns <stylesheet> <file_to_transform> > <file_to_be_generated>

In our use case (without paths to the files):

xmlpatterns buffer_xml_to_codec_map_conversion_stylesheet.xsl CanConfigCodecExt.xml > CanConfigCodecExt.map

And we are getting a map file which contains the generated structure and can be used within CAN Decoder in ADTF 3.x.


Hope this brings you into business, I will extend the documentation in gitlab about that.

Actions #6

Updated by hidden about 4 years ago

Hi Florian,

Thanks for the information! I could generate the new file :)
However in runtime, I get an error due to identical names of <assignment><to></to></assignment> in the same <output>.
Theses names were in different <struct> nodes in the old file. However the new mapping file does not contain an <struct> node, and flatten all <assignment> directly under <output>.
This is different from your example. I see in your generated file that the node <struct> is available!

Actions #7

Updated by hidden about 4 years ago

Hm... can you provide the xml file from ADTF 2.x to reproduce ?
Otherwise, as mention... it is an open source project... feel free to join working on it :-)

Actions #8

Updated by hidden about 4 years ago

Hi Florian,

when I tried it again, I got a valid .map file with <struct> nodes in it.
At the first time somehow I didn't get any <struct> node in the generated file. I cannot reproduce it again!
But now I have what I need :)
Thanks a lot!

Actions #9

Updated by hidden about 4 years ago

  • Description updated (diff)
  • Status changed from Customer Feedback Required to To Be Closed

Good, don't worry.
Main target is to have a solution.

Thanks also to have a first review and feedback on this new project !

Actions #12

Updated by hidden about 4 years ago

  • Status changed from To Be Closed to Closed
Actions

Also available in: Atom PDF