mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
refs #199, extended core to new functionality
* enable/disable signal/slot log * redirection of output as qDebug, qWarning, ..
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "tool.h"
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/context_application.h"
|
||||
#include "blackcore/context_application_impl.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QMetaType>
|
||||
#include <QMetaMethod>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/context_application.h"
|
||||
#include "blackmisc/valuemap.h"
|
||||
#include "blackmisc/avallclasses.h"
|
||||
#include "blackmisc/pqallquantities.h"
|
||||
@@ -31,8 +32,9 @@ namespace BlackMiscTest
|
||||
/*
|
||||
* Send data to testservice, this sends data to the slots on the server
|
||||
*/
|
||||
void Tool::serverLoop(const BlackCore::CRuntime *runtime)
|
||||
void Tool::serverLoop(BlackCore::CRuntime *runtime)
|
||||
{
|
||||
Q_ASSERT(runtime);
|
||||
QThread::sleep(3); // let the client connect
|
||||
qDebug() << "Running on server here" << Tool::getPid();
|
||||
|
||||
@@ -41,26 +43,30 @@ namespace BlackMiscTest
|
||||
//
|
||||
QTextStream qtin(stdin);
|
||||
QString line;
|
||||
while (line != "x")
|
||||
while (line != "x" && runtime)
|
||||
{
|
||||
const BlackCore::IContextNetwork *networkContext = runtime->getIContextNetwork();
|
||||
const BlackCore::IContextAudio *audioContext = runtime->getIContextAudio();
|
||||
const BlackCore::IContextSettings *settingsContext = runtime->getIContextSettings();
|
||||
BlackCore::IContextApplication *applicationContext = runtime->getIContextApplication();
|
||||
|
||||
qDebug() << "-------------";
|
||||
qDebug() << "Connected with network: " << networkContext->isConnected();
|
||||
|
||||
qDebug() << "-------------";
|
||||
qDebug() << "Key x to exit";
|
||||
qDebug() << "0 .. settings";
|
||||
qDebug() << "1 .. ATC booked";
|
||||
qDebug() << "2 .. ATC online";
|
||||
qDebug() << "3 .. Aircrafts in range";
|
||||
qDebug() << "4 .. my aircraft";
|
||||
qDebug() << "5 .. voice rooms";
|
||||
qDebug() << "x .. to exit 0 .. settings";
|
||||
qDebug() << "1 .. ATC booked 2 .. ATC online";
|
||||
qDebug() << "3 .. Aircrafts in range 4 .. my aircraft 5 .. voice rooms";
|
||||
qDebug() << "-------------";
|
||||
qDebug() << "oe . redirect enabled od . disable redirect";
|
||||
qDebug() << "-------------";
|
||||
qDebug() << "signal / slot logging:";
|
||||
qDebug() << "sig + context + [e]nabled/[d]isabled";
|
||||
qDebug() << "slo + context + [e]nabled/[d]isabled";
|
||||
qDebug() << "contexts: app / aud / net / set / sim / all";
|
||||
qDebug() << "examples: sigappd, slonete, slosimd, sloalle";
|
||||
qDebug() << "-------------";
|
||||
|
||||
line = qtin.readLine();
|
||||
|
||||
if (line.startsWith("0"))
|
||||
{
|
||||
qDebug() << "-------------";
|
||||
@@ -97,7 +103,40 @@ namespace BlackMiscTest
|
||||
qDebug() << "voice rooms";
|
||||
qDebug() << audioContext->getComVoiceRooms();
|
||||
}
|
||||
else if (line.startsWith("oe"))
|
||||
{
|
||||
applicationContext->setOutputRedirectionLevel(IContextApplication::RedirectAllOutput);
|
||||
applicationContext->setStreamingForRedirectedOutputLevel(IContextApplication::RedirectAllOutput);
|
||||
}
|
||||
else if (line.startsWith("od"))
|
||||
{
|
||||
applicationContext->setOutputRedirectionLevel(IContextApplication::RedirectNone);
|
||||
applicationContext->setStreamingForRedirectedOutputLevel(IContextApplication::RedirectNone);
|
||||
}
|
||||
else if (line.startsWith("sig"))
|
||||
{
|
||||
line.replace("sig", "");
|
||||
bool enable = line.endsWith("e");
|
||||
if (line.startsWith("app")) runtime->signalLogForApplication(enable);
|
||||
else if (line.startsWith("aud")) runtime->signalLogForAudio(enable);
|
||||
else if (line.startsWith("net")) runtime->signalLogForNetwork(enable);
|
||||
else if (line.startsWith("set")) runtime->signalLogForSettings(enable);
|
||||
else if (line.startsWith("sim")) runtime->signalLogForSimulator(enable);
|
||||
else if (line.startsWith("all")) runtime->signalLog(enable);
|
||||
}
|
||||
else if (line.startsWith("slo"))
|
||||
{
|
||||
line.replace("slo", "");
|
||||
bool enable = line.endsWith("e");
|
||||
if (line.startsWith("app")) runtime->slotLogForApplication(enable);
|
||||
else if (line.startsWith("aud")) runtime->slotLogForAudio(enable);
|
||||
else if (line.startsWith("net")) runtime->slotLogForNetwork(enable);
|
||||
else if (line.startsWith("set")) runtime->slotLogForSettings(enable);
|
||||
else if (line.startsWith("sim")) runtime->slotLogForSimulator(enable);
|
||||
else if (line.startsWith("all")) runtime->slotLog(enable);
|
||||
}
|
||||
}
|
||||
runtime->gracefulShutdown();
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -29,7 +29,8 @@ namespace BlackMiscTest
|
||||
static QProcess *startNewProcess(const QString &executable, const QStringList &arguments = QStringList(), QObject *parent = 0);
|
||||
|
||||
//! \brief Server loop
|
||||
static void serverLoop(const BlackCore::CRuntime *runtime);
|
||||
static void serverLoop(BlackCore::CRuntime *runtime);
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user