mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +08:00
[AFV] return aliased stations and use correct frequency
This commit is contained in:
committed by
Mat Sutcliffe
parent
0b8db1a612
commit
52ce9f9205
@@ -162,6 +162,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// this is the callback when the connection has been established
|
// this is the callback when the connection has been established
|
||||||
|
|
||||||
|
// HF stations aliased
|
||||||
const QVector<StationDto> aliasedStations = m_connection->getAllAliasedStations();
|
const QVector<StationDto> aliasedStations = m_connection->getAllAliasedStations();
|
||||||
this->setAliasedStations(aliasedStations); // threadsafe
|
this->setAliasedStations(aliasedStations); // threadsafe
|
||||||
this->onTimerUpdate();
|
this->onTimerUpdate();
|
||||||
@@ -1038,24 +1039,32 @@ namespace BlackCore
|
|||||||
|
|
||||||
if (it != m_aliasedStations.end())
|
if (it != m_aliasedStations.end())
|
||||||
{
|
{
|
||||||
|
roundedFrequencyHz = it->frequencyHz; // we use this frequency
|
||||||
if (sApp->getIContextNetwork())
|
if (sApp->getIContextNetwork())
|
||||||
{
|
{
|
||||||
// Get the callsign for this frequency and fuzzy compare with our alias station
|
// Get the callsign for this frequency and fuzzy compare with our alias station
|
||||||
|
// !\todo KB 2019-10 replace by com unit channel spacing
|
||||||
const CComSystem::ChannelSpacing spacing = CComSystem::ChannelSpacing25KHz;
|
const CComSystem::ChannelSpacing spacing = CComSystem::ChannelSpacing25KHz;
|
||||||
CFrequency f(static_cast<int>(roundedFrequencyHz), CFrequencyUnit::Hz());
|
const CFrequency f(static_cast<int>(roundedFrequencyHz), CFrequencyUnit::Hz());
|
||||||
CAtcStationList matchingAtcStations = sApp->getIContextNetwork()->getOnlineStationsForFrequency(f, spacing);
|
const CAtcStationList matchingAtcStations = sApp->getIContextNetwork()->getOnlineStationsForFrequency(f, spacing);
|
||||||
CAtcStation closest = matchingAtcStations.findClosest(1, sApp->getIContextOwnAircraft()->getOwnAircraftSituation().getPosition()).frontOrDefault();
|
const CAtcStation closest = matchingAtcStations.findClosest(1, sApp->getIContextOwnAircraft()->getOwnAircraftSituation().getPosition()).frontOrDefault();
|
||||||
|
|
||||||
|
|
||||||
if (fuzzyMatchCallSign(it->name, closest.getCallsign().asString()))
|
if (fuzzyMatchCallSign(it->name, closest.getCallsign().asString()))
|
||||||
{
|
{
|
||||||
CLogMessage(this).debug(u"Aliasing %1Hz [VHF] to %2Hz [HF]") << frequencyHz << it->frequencyHz;
|
// this is how it should be
|
||||||
roundedFrequencyHz = it->frequencyHz;
|
CLogMessage(this).debug(u"%1 Aliasing %2Hz [VHF] to %3Hz [HF]") << closest.getCallsign() << frequencyHz << it->frequencyHz;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ups!
|
||||||
|
CLogMessage(this).debug(u"Aliasing %1Hz [VHF] to %2Hz [HF], BUT station NOT found!") << frequencyHz << it->frequencyHz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// without contexts
|
||||||
CLogMessage(this).debug(u"Aliasing %1Hz [VHF] to %2Hz [HF]") << frequencyHz << it->frequencyHz;
|
CLogMessage(this).debug(u"Aliasing %1Hz [VHF] to %2Hz [HF]") << frequencyHz << it->frequencyHz;
|
||||||
roundedFrequencyHz = it->frequencyHz;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,8 +157,8 @@ namespace BlackCore
|
|||||||
|
|
||||||
QVector<StationDto> CApiServerConnection::getAllAliasedStations()
|
QVector<StationDto> CApiServerConnection::getAllAliasedStations()
|
||||||
{
|
{
|
||||||
this->getAsVector<StationDto>("/api/v1/stations/aliased");
|
const QVector<StationDto> stations = this->getAsVector<StationDto>("/api/v1/stations/aliased");
|
||||||
return {};
|
return stations;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CApiServerConnection::setUrl(const QString &url)
|
bool CApiServerConnection::setUrl(const QString &url)
|
||||||
|
|||||||
Reference in New Issue
Block a user