43 lines
973 B
C++
Executable File
43 lines
973 B
C++
Executable File
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QtWebSockets/QWebSocketServer>
|
|
#include <logger.h>
|
|
#include "guez_nasat_telegrams.h"
|
|
|
|
namespace GuezNasat
|
|
{
|
|
class AbstractSocketHandler : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit AbstractSocketHandler(const char *loggerName, QObject *parent = nullptr);
|
|
|
|
virtual bool init(quint16 listenPort) = 0;
|
|
|
|
virtual bool isConnected() const = 0;
|
|
|
|
public Q_SLOTS:
|
|
void setSimulationStatus(int nasatId, bool bActivateSimulation);
|
|
|
|
Q_SIGNALS:
|
|
void positionReceived(const NasatPosition &data);
|
|
void weaponReleaseReceived(const NasatWeaponRelease &data);
|
|
void nineLinerReceived(const NasatNineLiner &data);
|
|
void simulationStatusReceived(const NasatSimulationStatus &data);
|
|
|
|
protected:
|
|
NGL::INGLLogger &m_logger;
|
|
void textMessageReceived(const QByteArray &msg);
|
|
bool sendTelegram(const NasatBase *tele);
|
|
virtual bool sendTelegramInternal(const QByteArray &tele) = 0;
|
|
|
|
protected:
|
|
NGL::INGLLogger &m_logger;
|
|
};
|
|
|
|
}
|