Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+55
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "dds_handler.h"
|
||||
#include "logger.h"
|
||||
#include <taboc_dtc.h>
|
||||
#include <QWebSocket>
|
||||
|
||||
class QTimer;
|
||||
|
||||
namespace TrainingAreaBaseOC {
|
||||
|
||||
enum class WebSocketState {
|
||||
DISCONNECTED = 0, // should not happen
|
||||
CONNECTEDTOSERVER, // 1
|
||||
CONNECTTOPPM, // 2
|
||||
CONNECTEDTOPPM, // 3
|
||||
};
|
||||
|
||||
class WebsocketHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
WebsocketHandler(QObject *parent, int exerciseId,
|
||||
const std::shared_ptr<Interface::Dts> dtsTabOc, const std::shared_ptr<Interface::Dtc> dtcTabOc);
|
||||
|
||||
private slots:
|
||||
void onTryConnectionTimerTimeout();
|
||||
void onFetchPositionTimerTimeout();
|
||||
void onNewSocketState(QAbstractSocket::SocketState state);
|
||||
void onNewTextMessageFromSocket(const QString &message);
|
||||
|
||||
private:
|
||||
void connectToExPPM(int exPort);
|
||||
void sendPositionRequest();
|
||||
void onSendOwnPosition(const QString &message);
|
||||
|
||||
void connectToServer();
|
||||
void sendServicePortRequest();
|
||||
void parseServices(const QString &message);
|
||||
|
||||
WebSocketState m_state = WebSocketState::DISCONNECTED;
|
||||
int m_exerciseId = 0;
|
||||
int m_ownEquipmentId = 0;
|
||||
std::shared_ptr<Interface::Dts> m_dtsTaboc;
|
||||
std::shared_ptr<Interface::Dtc> m_dtcTaboc;
|
||||
QTimer *m_tryConnectionTimer = nullptr;
|
||||
QTimer *m_fetchPositionTimer = nullptr;
|
||||
QWebSocket *m_socket = nullptr;
|
||||
|
||||
LOGGER_T &m_logger;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace TrainingAreaBaseOc
|
||||
Reference in new issue
Block a user