47 lines
1.1 KiB
C++
Executable File
47 lines
1.1 KiB
C++
Executable File
/**
|
|
* Websocket interface for building control unit
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Christian Ehrlicher, SLSE, 2017-01-30
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <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:
|
|
void textMessageReceived(const QByteArray &msg);
|
|
bool sendTelegram(const NasatBase *tele);
|
|
virtual bool sendTelegramInternal(const QByteArray &tele) = 0;
|
|
|
|
protected:
|
|
LOGGER_T m_logger;
|
|
};
|
|
|
|
} // namespace GuezNasat
|