74 lines
2.4 KiB
C++
Executable File
74 lines
2.4 KiB
C++
Executable File
/**
|
|
* Send / Receive telegrams to/from PrtCnv
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Christian Ehrlicher, SLSE, 2016-09-26
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <TrainingAreaBase/tab_plugin_interface.h>
|
|
#include <memory>
|
|
#include <NGLLogger/INGLLogger.h>
|
|
#include <PrtCnv/PrtCnvApplication.hpp>
|
|
|
|
namespace TetraRadio
|
|
{
|
|
class TetraJsonPlugin : public QObject, public TrainingAreaBase::Plugin::Plugin
|
|
{
|
|
Q_OBJECT
|
|
Q_PLUGIN_METADATA(IID "special:3:tab.jsonsocket")
|
|
Q_INTERFACES(TrainingAreaBase::Plugin::Plugin)
|
|
public:
|
|
TetraJsonPlugin() = default;
|
|
~TetraJsonPlugin() = default;
|
|
std::shared_ptr<TrainingAreaBase::Plugin::Interface> createInterface(TrainingAreaBase::Plugin::DataProvider *pdp,
|
|
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
|
|
const std::shared_ptr<TrainingAreaBase::TxMixin> &sendToTabCb,
|
|
const std::shared_ptr<TrainingAreaBase::DdsHandler> &,
|
|
NGL::Settings *settings) override;
|
|
};
|
|
|
|
class SocketDispatcher;
|
|
class TetraJsonInterfaceImpl final : public TrainingAreaBase::Plugin::Interface
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
TetraJsonInterfaceImpl(TrainingAreaBase::Plugin::DataProvider *pdp,
|
|
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
|
|
NGL::Settings *settings);
|
|
~TetraJsonInterfaceImpl();
|
|
|
|
bool init() override;
|
|
std::shared_ptr<TrainingAreaBase::SendToTab> sendToTab() override;
|
|
bool isDebugInterface() const override
|
|
{
|
|
return false;
|
|
}
|
|
bool canSendData() const override;
|
|
void exerciseChanged() override;
|
|
const char *name() const override { return "TETRA"; }
|
|
private Q_SLOTS:
|
|
void onTetraConnectionChanged(bool bConnected);
|
|
private:
|
|
void cleanupProcess();
|
|
static QString iniFileIn();
|
|
QString iniFileOut() const;
|
|
static QString iniPath();
|
|
static QString playerIdsFile();
|
|
bool updatePrtCnv();
|
|
bool checkConfigTemplates();
|
|
bool startPrtCnv();
|
|
|
|
private:
|
|
std::unique_ptr<SocketDispatcher> m_socketDispatcher;
|
|
TrainingAreaBase::Plugin::DataProvider *m_pdp;
|
|
PrtCnv::PrtCnvApplication *m_prtCnvApp;
|
|
int m_exerciseId;
|
|
int m_radioGrpId;
|
|
NGL::INGLLogger &m_logger;
|
|
};
|
|
} // namespace TetraRadio
|