mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
committed by
Mathew Sutcliffe
parent
229d7c6068
commit
978f3c88e5
@@ -4,6 +4,13 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "samplesaviation.h"
|
||||
#include "blackmisc/pqconstants.h"
|
||||
#include "blackmisc/avheading.h"
|
||||
#include "blackmisc/aviocomsystem.h"
|
||||
#include "blackmisc/avionavsystem.h"
|
||||
#include "blackmisc/aviotransponder.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
@@ -11,51 +18,54 @@ using namespace BlackMisc::PhysicalQuantities;
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
int CSamplesAviation::samples()
|
||||
{
|
||||
CHeading h1(180, CHeading::Magnetic, CAngleUnit::deg());
|
||||
CHeading h2(180, CHeading::True, CAngleUnit::deg());
|
||||
|
||||
qDebug() << h1;
|
||||
qDebug() << h1 << h2 << (h1 == h2) << (h1 != h2) << (h1 == h1);
|
||||
|
||||
CComSystem c1 = CComSystem::getCom1System(125.3);
|
||||
qDebug() << c1;
|
||||
c1.setActiveUnicom();
|
||||
qDebug() << c1;
|
||||
|
||||
// CComSystem *c1p = new CComSystem("Test", CFrequency(125.3,CFrequencyUnit::MHz()));
|
||||
if (!CComSystem::tryGetComSystem(c1, "Test", -1.0))
|
||||
qDebug() << c1 << "is reset to default as expected";
|
||||
else
|
||||
qDebug() << "Something is wrong here";
|
||||
|
||||
try
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
int CSamplesAviation::samples()
|
||||
{
|
||||
// uncomment to test assert
|
||||
// CFrequency f1(-1.0, CFrequencyUnit::MHz());
|
||||
// c1 = CComSystem("ups", f1, f1);
|
||||
// qDebug() << "Why do I get here??";
|
||||
CHeading h1(180, CHeading::Magnetic, CAngleUnit::deg());
|
||||
CHeading h2(180, CHeading::True, CAngleUnit::deg());
|
||||
|
||||
qDebug() << h1;
|
||||
qDebug() << h1 << h2 << (h1 == h2) << (h1 != h2) << (h1 == h1);
|
||||
|
||||
// COM system
|
||||
CComSystem c1 = CComSystem::getCom1System(125.3);
|
||||
qDebug() << c1;
|
||||
c1.setActiveUnicom();
|
||||
qDebug() << c1;
|
||||
|
||||
if (!CComSystem::tryGetComSystem(c1, "Test", -1.0))
|
||||
qDebug() << c1 << "is reset to default as expected";
|
||||
else
|
||||
qDebug() << "Something is wrong here";
|
||||
|
||||
try
|
||||
{
|
||||
// uncomment to test assert
|
||||
// CFrequency f1(-1.0, CFrequencyUnit::MHz());
|
||||
// c1 = CComSystem("ups", f1, f1);
|
||||
// qDebug() << "Why do I get here??";
|
||||
}
|
||||
catch (std::range_error &ex)
|
||||
{
|
||||
qDebug() << "As expected" << ex.what();
|
||||
}
|
||||
|
||||
// NAV system
|
||||
CNavSystem nav1;
|
||||
CNavSystem::tryGetNav1System(nav1, 110.0);
|
||||
qDebug() << nav1;
|
||||
|
||||
// Transponder tests
|
||||
CTransponder tr1("T1", 7000, CTransponder::StateStandby);
|
||||
CTransponder tr2("T2", "4532", CTransponder::ModeMil3);
|
||||
qDebug() << tr1 << tr2;
|
||||
|
||||
|
||||
|
||||
qDebug() << "-----------------------------------------------";
|
||||
return 0;
|
||||
}
|
||||
catch (std::range_error &ex)
|
||||
{
|
||||
qDebug() << "As expected" << ex.what();
|
||||
}
|
||||
|
||||
CNavSystem nav1;
|
||||
CNavSystem::tryGetNav1System(nav1, 110.0);
|
||||
qDebug() << nav1;
|
||||
|
||||
CTransponder tr1("T1", 7000, CTransponder::StateStandby);
|
||||
CTransponder tr2("T2", "4532", CTransponder::ModeMil3);
|
||||
qDebug() << tr1 << tr2;
|
||||
|
||||
// bye
|
||||
qDebug() << "-----------------------------------------------";
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user