Aircraft ICAO data should use ICAO code as attribute, this somehow got lost in the merge session, re-applied

This commit is contained in:
Klaus Basan
2015-05-16 18:31:30 +02:00
parent 257430bbbe
commit 104122023c
19 changed files with 170 additions and 212 deletions

View File

@@ -506,7 +506,10 @@ namespace BlackCore
// ICAO response from custom data
if (!aircraftDesignator.isEmpty())
{
CAircraftIcaoData icao(aircraftDesignator, combinedAircraftType, airlineIcao, "", ""); // from custom packet
CAircraftIcaoData icao(
CAircraftIcaoCode(aircraftDesignator, combinedAircraftType),
CAirlineIcaoCode(airlineIcao)
); // from custom packet
if (aircraftContainsCallsign)
{
// we have that aircraft, set straight away
@@ -1074,7 +1077,7 @@ namespace BlackCore
}
// check sort order
Q_ASSERT_X(l.size() < 2 || l[0].getMSecsSinceEpoch() >= l[1].getMSecsSinceEpoch(), "storeAircraftParts", "wrong sort order");
Q_ASSERT_X(l.size() < 2 || l[0].getMSecsSinceEpoch() >= l[1].getMSecsSinceEpoch(), Q_FUNC_INFO, "wrong sort order");
}
} // namespace

View File

@@ -161,7 +161,7 @@ namespace BlackCore
{
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, "Invalid user credentials");
}
else if (!this->ownAircraft().getIcaoInfo().hasAircraftAndAirlineDesignator())
else if (!this->ownAircraft().getIcaoInfo().hasAircraftDesignator())
{
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, "Invalid ICAO data for own aircraft");
}

View File

@@ -90,9 +90,13 @@ namespace BlackCore
// from simulator, if available
this->m_ownAircraft.setCallsign(CCallsign("SWIFT")); // would come from settings
// TODO: This would need to come from somewhere (mappings)
// Own callsign, plane ICAO status, model used
this->m_ownAircraft.setIcaoInfo(CAircraftIcaoData("C172", "L1P", "GA", "GA", "0000ff"));
//! \todo Own aircraft ICAO default data, this would need to come from somewhere (mappings) -> Own callsign, plane ICAO status, model used
this->m_ownAircraft.setIcaoInfo(
CAircraftIcaoData(
CAircraftIcaoCode("C172", "L1P"),
CAirlineIcaoCode(),
"0000ff")
);
}
// voice rooms, if network is already available

View File

@@ -260,20 +260,20 @@ namespace BlackCore
situation.setGroundspeed(CSpeed(groundspeed, CSpeedUnit::kts()));
CAircraft currentAircraft(user.getCallsign().getStringAsSet(), user, situation);
QString icaoCode = clientPartsMap["planned_aircraft"];
if (!icaoCode.isEmpty())
QString aircraftIcaoCode = clientPartsMap["planned_aircraft"];
if (!aircraftIcaoCode.isEmpty())
{
// http://uk.flightaware.com/about/faq_aircraft_flight_plan_suffix.rvt
// we expect something like H/B772/F B773 B773/F
static const QRegularExpression reg("/.");
icaoCode = icaoCode.replace(reg, "").trimmed().toUpper();
if (CAircraftIcaoData::isValidDesignator(icaoCode))
aircraftIcaoCode = aircraftIcaoCode.replace(reg, "").trimmed().toUpper();
if (CAircraftIcaoCode::isValidDesignator(aircraftIcaoCode))
{
currentAircraft.setIcaoInfo(CAircraftIcaoData(icaoCode));
currentAircraft.setAircraftIcaoDesignator(aircraftIcaoCode);
}
else
{
illegalIcaoCodes.append(icaoCode);
illegalIcaoCodes.append(aircraftIcaoCode);
}
}