Files
pilotclient/src/blackmisc/aviation/atcstationlist.h
Klaus Basan bcbdaaf1a7 COM audio did not tune in (voice room) if channel was already selected at startup
Reason was: hardcoded channel spacing to 8.33kHz

As a result changed to channel spacing based on COM unit, which could also be changed at runtime

* the issue itself was in own aircraft context
* added functions for channel spacing
* changed to COM unit channel spacing (instead of hardcoded spacing)
2019-05-13 11:20:49 +02:00

101 lines
4.0 KiB
C++

/* Copyright (C) 2013
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
* or distributed except according to the terms contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISC_AVIATION_ATCSTATIONLIST_H
#define BLACKMISC_AVIATION_ATCSTATIONLIST_H
#include "blackmisc/aviation/atcstation.h"
#include "blackmisc/aviation/comsystem.h"
#include "blackmisc/aviation/callsignobjectlist.h"
#include "blackmisc/pq/frequency.h"
#include "blackmisc/geo/geoobjectlist.h"
#include "blackmisc/network/userlist.h"
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/collection.h"
#include "blackmisc/sequence.h"
#include "blackmisc/variant.h"
#include <QMetaType>
#include <QHash>
namespace BlackMisc
{
namespace Aviation
{
//! Value object for a list of ATC stations.
class BLACKMISC_EXPORT CAtcStationList :
public CSequence<CAtcStation>,
public Aviation::ICallsignObjectList<CAtcStation, CAtcStationList>,
public Geo::IGeoObjectWithRelativePositionList<CAtcStation, CAtcStationList>,
public Mixin::MetaType<CAtcStationList>
{
public:
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CAtcStationList)
using CSequence::CSequence;
//! Default constructor.
CAtcStationList();
//! Construct from a base class object.
CAtcStationList(const CSequence<CAtcStation> &other);
//! Find 0..n stations tune in frequency of COM unit (with 25kHz channel spacing)
CAtcStationList findIfComUnitTunedIn25KHz(const CComSystem &comUnit) const;
//! Find 0..n stations tune in frequency of COM unit (with channel spacing)
CAtcStationList findIfComUnitTunedInChannelSpacing(const CComSystem &comUnit) const;
//! Find 0..n stations within channel spacing
CAtcStationList findIfFrequencyIsWithinSpacing(const PhysicalQuantities::CFrequency &frequency, CComSystem::ChannelSpacing spacing);
//! Update if message changed
bool updateIfMessageChanged(const CInformationMessage &im, const CCallsign &callsign, bool overrideWithNewer);
//! Set online status
int setOnline(const CCallsign &callsign, bool online);
//! Find 0..n stations with valid voice room
//! \sa CAtcStation::hasValidVoiceRoom
CAtcStationList stationsWithValidVoiceRoom() const;
//! Find 0..n stations with valid COM frequency
//! \sa CAtcStation::hasValidFrequency
CAtcStationList stationsWithValidFrequency() const;
//! All controllers (with valid data)
Network::CUserList getControllers() const;
//! Remove if marked outside of range
int removeIfOutsideRange();
//! Synchronize with ATC station representing booking information.
//! Both sides (booking, online station) will be updated.
//! \pre Can be used only if the stored data in this list are online ATC stations
int synchronizeWithBookedStation(CAtcStation &bookedAtcStation);
//! Sort by ATC suffix sort order and distance
void sortByAtcSuffixSortOrderAndDistance();
//! Sorted by ATC suffix sort order and distance
CAtcStationList sortedByAtcSuffixSortOrderAndDistance() const;
//! Split per suffix
//! \remark sort can be disabled if already sorted
QHash<QString, CAtcStationList> splitPerSuffix(bool sort = true) const;
};
} //namespace
} // namespace
Q_DECLARE_METATYPE(BlackMisc::Aviation::CAtcStationList)
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Aviation::CAtcStation>)
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Aviation::CAtcStation>)
#endif //guard