mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
Added method getSelectedAtcStations() to network context.
Further isConnected checks in order to avoid updating when not connected (leading to wrnings / errors)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
243ace74fe
commit
6aa6058c57
@@ -158,6 +158,9 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
virtual BlackMisc::Voice::CVoiceRoomList getSelectedVoiceRooms() const;
|
virtual BlackMisc::Voice::CVoiceRoomList getSelectedVoiceRooms() const;
|
||||||
|
|
||||||
|
//! \copydoc IContextNetwork::getSelectedAtcStations
|
||||||
|
virtual BlackMisc::Aviation::CAtcStationList getSelectedAtcStations() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \copydoc IContextNetwork::getUsers()
|
* \copydoc IContextNetwork::getUsers()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,8 +31,12 @@ namespace BlackCore
|
|||||||
aircraft.setIcaoInfo(icaoData);
|
aircraft.setIcaoInfo(icaoData);
|
||||||
aircraft.calculcateDistanceToPlane(this->m_ownAircraft.getPosition());
|
aircraft.calculcateDistanceToPlane(this->m_ownAircraft.getPosition());
|
||||||
this->m_aircraftsInRange.push_back(aircraft);
|
this->m_aircraftsInRange.push_back(aircraft);
|
||||||
emit this->m_network->sendFrequencyQuery(callsign);
|
if (this->isConnected())
|
||||||
emit this->m_network->sendRealNameQuery(callsign);
|
{
|
||||||
|
// emit only if still connected
|
||||||
|
emit this->m_network->sendFrequencyQuery(callsign);
|
||||||
|
emit this->m_network->sendRealNameQuery(callsign);
|
||||||
|
}
|
||||||
emit this->changedAircraftsInRange();
|
emit this->changedAircraftsInRange();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -60,9 +64,14 @@ namespace BlackCore
|
|||||||
aircraft.setTransponder(transponder);
|
aircraft.setTransponder(transponder);
|
||||||
aircraft.calculcateDistanceToPlane(this->m_ownAircraft.getPosition());
|
aircraft.calculcateDistanceToPlane(this->m_ownAircraft.getPosition());
|
||||||
this->m_aircraftsInRange.push_back(aircraft);
|
this->m_aircraftsInRange.push_back(aircraft);
|
||||||
emit this->m_network->sendFrequencyQuery(callsign);
|
|
||||||
emit this->m_network->sendRealNameQuery(callsign);
|
if (this->isConnected())
|
||||||
emit this->m_network->sendIcaoCodesQuery(callsign);
|
{
|
||||||
|
// only emit if still connected
|
||||||
|
emit this->m_network->sendFrequencyQuery(callsign);
|
||||||
|
emit this->m_network->sendRealNameQuery(callsign);
|
||||||
|
emit this->m_network->sendIcaoCodesQuery(callsign);
|
||||||
|
}
|
||||||
emit this->changedAircraftsInRange();
|
emit this->changedAircraftsInRange();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -85,17 +85,30 @@ namespace BlackCore
|
|||||||
/*
|
/*
|
||||||
* Selected voice rooms
|
* Selected voice rooms
|
||||||
*/
|
*/
|
||||||
CVoiceRoomList CContextNetwork::getSelectedVoiceRooms() const
|
CAtcStationList CContextNetwork::getSelectedAtcStations() const
|
||||||
{
|
{
|
||||||
CAtcStationList stationsCom1 = this->m_atcStationsOnline.findIfComUnitTunedIn25KHz(this->m_ownAircraft.getCom1System());
|
CAtcStationList stationsCom1 = this->m_atcStationsOnline.findIfComUnitTunedIn25KHz(this->m_ownAircraft.getCom1System());
|
||||||
CAtcStationList stationsCom2 = this->m_atcStationsOnline.findIfComUnitTunedIn25KHz(this->m_ownAircraft.getCom2System());
|
CAtcStationList stationsCom2 = this->m_atcStationsOnline.findIfComUnitTunedIn25KHz(this->m_ownAircraft.getCom2System());
|
||||||
stationsCom1.sortBy(&CAtcStation::getDistanceToPlane);
|
stationsCom1.sortBy(&CAtcStation::getDistanceToPlane);
|
||||||
stationsCom2.sortBy(&CAtcStation::getDistanceToPlane);
|
stationsCom2.sortBy(&CAtcStation::getDistanceToPlane);
|
||||||
|
|
||||||
CVoiceRoom vr;
|
CAtcStation s;
|
||||||
|
CAtcStationList stations;
|
||||||
|
stations.push_back(stationsCom1.isEmpty() ? s : stationsCom1[0]);
|
||||||
|
stations.push_back(stationsCom2.isEmpty() ? s : stationsCom2[0]);
|
||||||
|
return stations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Selected voice rooms
|
||||||
|
*/
|
||||||
|
CVoiceRoomList CContextNetwork::getSelectedVoiceRooms() const
|
||||||
|
{
|
||||||
|
CAtcStationList stations = this->getSelectedAtcStations();
|
||||||
|
Q_ASSERT(stations.size() == 2);
|
||||||
CVoiceRoomList rooms;
|
CVoiceRoomList rooms;
|
||||||
rooms.push_back(stationsCom1.isEmpty() ? vr : stationsCom1[0].getVoiceRoom());
|
rooms.push_back(stations[0].getVoiceRoom());
|
||||||
rooms.push_back(stationsCom2.isEmpty() ? vr : stationsCom2[0].getVoiceRoom());
|
rooms.push_back(stations[1].getVoiceRoom());
|
||||||
return rooms;
|
return rooms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,9 +194,13 @@ namespace BlackCore
|
|||||||
station.calculcateDistanceToPlane(this->m_ownAircraft.getPosition());
|
station.calculcateDistanceToPlane(this->m_ownAircraft.getPosition());
|
||||||
this->m_atcStationsOnline.push_back(station);
|
this->m_atcStationsOnline.push_back(station);
|
||||||
emit this->changedAtcStationsOnline();
|
emit this->changedAtcStationsOnline();
|
||||||
emit this->m_network->sendAtisQuery(callsign); // request ATIS
|
|
||||||
emit this->m_network->sendRealNameQuery(callsign);
|
if (this->isConnected())
|
||||||
emit this->m_network->sendServerQuery(callsign);
|
{
|
||||||
|
emit this->m_network->sendAtisQuery(callsign); // request ATIS
|
||||||
|
emit this->m_network->sendRealNameQuery(callsign);
|
||||||
|
emit this->m_network->sendServerQuery(callsign);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -96,6 +96,11 @@ namespace BlackCore
|
|||||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Voice::CVoiceRoomList>(QLatin1Literal("getSelectedVoiceRooms"));
|
return this->m_dBusInterface->callDBusRet<BlackMisc::Voice::CVoiceRoomList>(QLatin1Literal("getSelectedVoiceRooms"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlackMisc::Aviation::CAtcStationList IContextNetwork::getSelectedAtcStations() const
|
||||||
|
{
|
||||||
|
return this->m_dBusInterface->callDBusRet<BlackMisc::Aviation::CAtcStationList>(QLatin1Literal("getSelectedAtcStations"));
|
||||||
|
}
|
||||||
|
|
||||||
BlackMisc::Aviation::CAircraft IContextNetwork::getOwnAircraft() const
|
BlackMisc::Aviation::CAircraft IContextNetwork::getOwnAircraft() const
|
||||||
{
|
{
|
||||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Aviation::CAircraft>(QLatin1Literal("getOwnAircraft"));
|
return this->m_dBusInterface->callDBusRet<BlackMisc::Aviation::CAircraft>(QLatin1Literal("getOwnAircraft"));
|
||||||
|
|||||||
@@ -247,6 +247,11 @@ namespace BlackCore
|
|||||||
* \brief Use the selected COM1/2 frequencies, and get the corresponding voice room for it
|
* \brief Use the selected COM1/2 frequencies, and get the corresponding voice room for it
|
||||||
*/
|
*/
|
||||||
virtual BlackMisc::Voice::CVoiceRoomList getSelectedVoiceRooms() const;
|
virtual BlackMisc::Voice::CVoiceRoomList getSelectedVoiceRooms() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Use the selected COM1/2 frequencies, and get the corresponding ATC stations for it
|
||||||
|
*/
|
||||||
|
virtual BlackMisc::Aviation::CAtcStationList getSelectedAtcStations() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user