refs #146 , check for valid transponder code. During testing I ran into a situation, where I've received an invalid XPDR code from the network.

This check resets XPDR to 0000 , further logging could be provided.
This commit is contained in:
Klaus Basan
2014-02-25 01:39:39 +01:00
parent 4c81a6f86d
commit b115e3901d

View File

@@ -643,7 +643,19 @@ namespace BlackCore
mode = CTransponder::ModeC;
break;
}
CTransponder transponder(tn, pos.xpdrCode, mode);
// I did have a situation where I got wrong transponger codes (KB)
// So I now check for a valid code in order to detect such codes
CTransponder transponder(tn, 0, mode);
if (CTransponder::isValidTransponderCode(pos.xpdrCode))
{
transponder = CTransponder(tn, pos.xpdrCode, mode);
}
else
{
// TODO: how do with log this
qDebug() << "Wrong transponder code" << pos.xpdrMode << callsign;
}
emit cbvar_cast(cbvar)->aircraftPositionUpdate(callsign, situation, transponder);
}