ChristopheJacquet / RdsSurveyor

Multi-platform Radio Data System decoder
http://rds-surveyor.jacquet.xyz/
36 stars 10 forks source link

AlertC.java:102: Code returns RDS country code, which is not mapped to the corresponding TMC country code. #38

Open JacekRuzyczka opened 4 years ago

JacekRuzyczka commented 4 years ago

Example: German FM radio stations typically use 0xD (= 13) in the first 4 bits of the program ID code. The country code in the German TMC location table, on the other hand, is 58. Even worse: In some other countries (Serbia, for instance), the first 4 bits of the PIDC are also 0xD, so that the mapping from the RDS "country code" to the corresponding TMC country code may not be unique.

Any suggestions on how to resolve this issue? Will I have to use my physical location (lat, lon) here? Thank you.

mvglasow commented 3 years ago

Indeed, the RDS country code is not ambiguous. However, decoding a location requires not only the country code but also the location table number (LTN), as a single country may have multiple LTs. The designers of TMC worked around the country code collisions by assigning different ranges of LTNs to countries with the same CC, so the country can be uniquely inferred from the combination of CC+LTN.

For example:

At a later point, however, some irregularities seem to have occurred. The TISA has certified location tables for Australia and India whose CC+LTN is in the range previously assigned to other countries. Not sure if the assigned ranges were ever changed, but in most of these cases, the LTNs in question seem to never have been used by the country to which they were originally assigned. One actual collision that I know of is CC=3, LTN=1, which can either be Andorra or the Australian state of Victoria. There may be more involving the US, Canada, India and China.

So far that has not been an issue, as the potential collisions hardly ever occur within the same continent—usually the territories are far apart. Also, outside of Europe, most TMC traffic is encrypted as far as I have seen, and/or the location tables are not freely available. So far I am not aware of any collisions within Europe—with the data that is freely available, I don’t see this becoming an issue at this point.

If that does change, we will have to come up with a plan. The challenge is that the TMC CID is never transmitted over the air (which is why I went with the CC), so we would need to look for the ECD. Though that might result in lost messages until we get the first ECD transmission—or alternatively we would need to resort to that only where CC+LTN is indeed ambiguous.