Close

UGDO BAP part.2

A project log for Opensource HomeLink ecu for VAG

Open-source HomeLink module for VAG cars. Replaces the stock unit, working with standard LIN Bus and supporting various garage doors.

stepan-skopivskiyStepan Skopivskiy 03/23/2025 at 19:320 Comments

After getting the list of elements (BAP Array) the structure of the item data is still unknown. During the testing of the actions and messages, a few actions were recorded. The next data is the pairs of ASG and FSG (request and response).

All this req/res comes to and from function id - 0x10. So, looks like all "CRUD" operations are done through that function. Also, if to do the HEX to Text conversion some RAW data can be extracted.

After hours of "reading" the code, some details were discovered. For example, the classes from the found repository have a pretty same structure like the data in the CAN messages. Here the classes with their property members.

public class UGDOButtonListRA0 {
    public int pos;
    public String name;
    public float positionLatitude;
    public float positionLongitude;
    public int learnedState;
    public int hardkey;
    public int softkey;
    public UGDOSpecialFeatures specialFeatures;
}

public class UGDOButtonListRA1 {
    public int pos;
    public float positionLatitude;
    public float positionLongitude;
    public int learnedState;
    public UGDOSpecialFeatures specialFeatures;
}

public class UGDOButtonListRA2 {
    public int pos;
    public int learnedState;
    public UGDOSpecialFeatures specialFeatures;
}

public class UGDOButtonListRA3 {
    public int pos;
    public UGDOSpecialFeatures specialFeatures;
}

public class UGDOButtonListRA4 {
    public int pos;
    public String name;
}

public class UGDOButtonListRA5 {
    public int pos;
    public int learnedState;
}

And here, let's remember the array header structure: Mode (4bit), RecordAddress (4bit), Start Number (1 byte), and Elements (1 byte). Do You see some relations? What if convert RecordAddress to RA?

So, now, let's check rename and save position (both are requests from ASG):

0x1D440701070A37373737373737373737
0x1C4102010228DEF80256A76E011001

Based on the structure, the ASG_IDTAIDArrayHeader: Mode (4bit), RecordAddress (4bit), Start Number (1 byte), and Elements (1 byte). And now, the record address for rename is 4, and for set position 1. And now, let's check the Java class once again:

public class UGDOButtonListRA1 {
    public int pos;
    public float positionLatitude;
    public float positionLongitude;
    public int learnedState;
    public UGDOSpecialFeatures specialFeatures;
}

public class UGDOButtonListRA4 {
    public int pos;
    public String name;
}

And it is a win! It has a logic now. MMI input has a limit for names - 10 chars max. Also, the known information is that the rename was to "7777777777" for the 7th button, and based on class, it is the only information in the data "package". Using this knowledge let's parse the whole message:

0x1D440701070A37373737373737373737

And what about the save position action class? Which is RA1. Doing the same will add some details here:

0x1C4102010228DEF80256A76E011001

Converting 0x28DEF802 and 0x56A76E01 to the decimal does not have any logic.

0x28DEF802 = 685701122
0x56A76E01 = 1453813249

The actual position lon and lat was lat: 49.8641974062143, and lon: 24.02915713268198. And it is not that position definitely. 

But we have the magic document regarding the NAV SD Bap. The only mentions about those coordinates are there:

We can see that these values should be decimals that have step 1E-06 (0,000001). So, let's convert our coordinates to that format and hex and add zero to have the same size as the sniffed data:

49.8641974062143 = 49864197 = 0x02 F8 DE 05
24.02915713268198 = 24029157 = 0x01 6E A7 E5

Looking similar? For sure! Let's compare them a bit closer:

ParameterData from CARData from Doc
latitude0x28 DE F8 020x02 F8 DE 05
longitude0x56 A7 6E 010x01 6E A7 E5

Looking like the bytes in the car are reversed. After fixing them and converting based on step dimension they will have the next look:

0x28 DE F8 02 = 0x02 F8 DE 28 = 49.864232
0x56 A7 6E 01 = 0x01 6E A7 56 = 24.029014

Here we go! Now the most "loaded" data are parsed and understood. Based on this knowledge we can define that the data requested and received after turning on the ignition is the Record Address 0 or UGDOButtonListRA0.

public class UGDOButtonListRA0 {
    public int pos;
    public String name;
    public float positionLatitude;
    public float positionLongitude;
    public int learnedState;
    public int hardkey;
    public int softkey;
    public UGDOSpecialFeatures specialFeatures;
}

 And it has that data (the hex string is the exact element, not the whole data package):

0x0112D093D0B0D1803120D09AD0BED180D0B5D18948DDF80240A96E01100101

Discussions