Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
95 lines
3.1 KiB
C++
95 lines
3.1 KiB
C++
/**
|
|
* Convert from/to WLS protocol / handler incoming WLS connection
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Christian Ehrlicher, SLSE, 2017-01-10
|
|
*/
|
|
#pragma once
|
|
|
|
#include <QTcpServer>
|
|
#include <QTimer>
|
|
#include <memory>
|
|
#include "logger.h"
|
|
#include "wls_participant_handler.h"
|
|
#include "web_socket_handler.h"
|
|
#include "wls_sfm_message.h"
|
|
|
|
namespace WirelessLocationSystem
|
|
{
|
|
class MainHandler;
|
|
class WlsHandler : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
enum class WlsTelegramId
|
|
{
|
|
VersionInformation = 0,
|
|
PlayerPosition = 1,
|
|
PlayerState = 2,
|
|
PayloadMobileToHost = 3,
|
|
PayloadHostToMobile = 4
|
|
};
|
|
friend std::ostream &operator<<(std::ostream &stream, WlsHandler::WlsTelegramId ti);
|
|
|
|
public:
|
|
static constexpr int s_maxLenTransparentData = 80;
|
|
|
|
explicit WlsHandler(QObject *parent = nullptr);
|
|
~WlsHandler();
|
|
|
|
bool init(WlsParticipantHandler *participantHandler,
|
|
WebSocketHandler *wsHandler,
|
|
quint16 listenPort);
|
|
|
|
bool isConnected() const
|
|
{
|
|
return !m_tcpSockets.isEmpty();
|
|
}
|
|
|
|
bool sendWlsMessage(const WlsParticipant *p, const SfmMessage_tx &msg);
|
|
bool sendWlsMessage(const QByteArray &tagId, const SfmMessage_tx &msg);
|
|
bool sendWlsMessage(const QByteArray &tagId, WlsTelegramId telId, const QByteArray &payload);
|
|
|
|
public Q_SLOTS:
|
|
void sendGpsMode(WlsParticipant *participant);
|
|
private Q_SLOTS:
|
|
void onIncomingConnection();
|
|
void onIncomingData();
|
|
void onSocketDisconnected();
|
|
private:
|
|
QByteArray parseBuffer(const QByteArray &buffer, QTcpSocket *socket);
|
|
void parseWlsTelegram(const QByteArray &baTele, QTcpSocket *socket);
|
|
static bool findNextSyncStartByte(const QByteArray &buffer, int &iCurReadPos);
|
|
static bool findNextSyncEndByte(const QByteArray &buffer, int &iCurReadPos);
|
|
bool checkPayloadIsHex(const QByteArray &payload) const;
|
|
|
|
bool handleVersionsinformation(const QList<QByteArray> &data);
|
|
bool handlePlayerPosition(const QList<QByteArray> &data, const QDateTime ×tamp);
|
|
bool handlePlayerState(const QList<QByteArray> &data);
|
|
bool handleDataPayloadMobileToHost(const QList<QByteArray> &data);
|
|
void handlePayload(WlsParticipant *participant, const SfmMsgEquipmentId *sfmTele);
|
|
void handlePayload(WlsParticipant *participant, const SfmMsgRequestGpsControl_rx *sfmTele);
|
|
void handlePayload(WlsParticipant *participant, const SfmMsgSfmRestart_rx *sfmTele);
|
|
void handlePayload(WlsParticipant *participant, const Acknowledge_rx *sfmTele);
|
|
void handlePayload(WlsParticipant *participant, const SfmMsgTetra_rx *sfmTele);
|
|
|
|
bool parseDoubleCm(const QByteArray &data, double &num) const;
|
|
bool parseInteger(const QByteArray &data, int &num) const;
|
|
WlsParticipant *participantFromTagId(const QByteArray &tagId, bool bAskForEqIdIfNew = true);
|
|
|
|
private:
|
|
QTcpServer *m_tcpServer = nullptr;
|
|
WlsParticipantHandler *m_participantHandler = nullptr;
|
|
WebSocketHandler *m_wsHandler = nullptr;
|
|
// one buffer per socket
|
|
QHash<QTcpSocket *, QByteArray> m_tcpSockets;
|
|
QHash<QByteArray, QTcpSocket *> m_tcpSocketByTagId;
|
|
|
|
double m_wlsZOffset = 0;
|
|
|
|
LOGGER_T m_logger;
|
|
};
|
|
|
|
} // namespace WirelessLocationSystem
|